elseif item.itemid == TYPE_PB_FREE_POKE then -- Free Poke
if isCorpse(itemEx.uid) then
-- local name = getItemName(itemEx.uid):lower()
--name = name:sub(name:find('dead') + 5, name:len())
--isMonster(itemEx.uid)
local name = getItemInfo(itemEx.itemid).name
local b, e = name:find('dead ')
if e then
name = name:sub(e+1)
end
--local a, b, cn = getItemDescriptionsById(itemEx.itemid).name;
--local a, b, cn = string.find(getItemName(itemEx.uid), "dead (%a+)")
--local corpsen = string.len(tostring(corpseName2)) > 0 and tostring(corpseName2) or string.len(tostring(corpseName1)) > 0 and tostring(corpseName1) or " "
local chance = tonumber(CHANCE_TO_CAPTURE)
local outpoint = CHANCE_TO_CAPTURE
string.gsub(outpoint, ".", "")
if math.random(1,(10 ^ string.len(outpoint))*100) <= (((10 ^ string.len(outpoint)) * 100) * chance) then
doSendMagicEffect(toPosition, 24)
--doItemSetAttribute(item.uid, "description", "It contains a " .. name .. ".")
doSetItemAttr(item.uid, "specialdescr", "It contains a " .. b .. ".")
--doSetItemSpecialDescription(item.uid, )
doTransformItem(item.uid, TYPE_PB_OUT_POKE)
doSendMagicEffect(getThingPos(cid), 28)
doRemoveItem(itemEx.uid)
doPlayerRemoveItem(cid, 2149, 1)
else
doSendMagicEffect(toPosition, 23)
doRemoveItem(itemEx.uid)
doPlayerRemoveItem(cid, item.itemid, 1)
end
end