UNCOMMON_ITEMS = {5875,5878,5879}
RARE_ITEMS = {2498,2466,2487}
EPIC_ITEMS = {2472,2470,2195}
function getTopItem(p) -- from Darkhaos's arena script
p.stackpos = 0
local v = getThingFromPos(p)
repeat
p.stackpos = p.stackpos + 1
v = getThingFromPos(p)
until v.itemid == 0
p.stackpos = p.stackpos - 1
return getThingFromPos(p)
end
function scanCorpseLoot(cid, pos)
local corpse = getTopItem(pos)
if isContainer(corpse.uid) then
for n = (getContainerSize(corpse.uid) - 1), 0, -1 do
if isInArray(UNCOMMON_ITEMS, getContainerItem(corpse.uid, n).itemid) then
addEvent(warningRareLoot, 100, pos, 1)
addEvent(warningRareLoot, 1000, pos, 1)
addEvent(warningRareLoot, 2000, pos, 1)
break
elseif isInArray(RARE_ITEMS, getContainerItem(corpse.uid, n).itemid) then
addEvent(warningRareLoot, 100, pos, 2)
addEvent(warningRareLoot, 1000, pos, 2)
addEvent(warningRareLoot, 2000, pos, 2)
break
elseif isInArray(EPIC_ITEMS, getContainerItem(corpse.uid, n).itemid) then
addEvent(warningRareLoot, 100, pos, 3)
addEvent(warningRareLoot, 1000, pos, 3)
addEvent(warningRareLoot, 2000, pos, 3)
break
end
end
end
end
function warningRareLoot(pos, rtype)
if rtype == 1 then
doSendAnimatedText(pos, "UNCOMMON", 23)
doSendMagicEffect(pos, 23) -- azul
elseif rtype == 2 then
doSendAnimatedText(pos, "RARE", 22)
doSendMagicEffect(pos, 22) -- rosa
elseif rtype then
doSendAnimatedText(pos, "EPIC", 19)
doSendMagicEffect(pos, 19) -- vermelho
end
end
function onKill(cid, target, lastHit)
if isMonster(target) then
addEvent(scanCorpseLoot, 150, cid, getThingPos(target))
end
return true
end