function getContentDescription(uid, comma)
local ret, i = '', 0
while i < getContainerSize(uid) do
local v, descr = getContainerItem(uid, i), ''
if v.type > 1 and isItemStackable(v.itemid) then
descr = v.type .. ' ' .. getItemDescriptionsById(v.itemid).plural
else
descr = getItemDescriptionsById(v.itemid).article .. ' ' .. getItemNameById(v.itemid)
end
ret = ret .. (i == 0 and not comma and '' or ', ') .. descr
if isContainer(v.uid) and getContainerSize(v.uid) ~= 0 then
ret = ret .. getContentDescription(v.uid, true)
end
i = i + 1
end
return ret
end
local function send(cid, pos, corpseid, monster)
local corpse, ret = getTileItemById(pos, corpseid).uid, ''
if isContainer(corpse) then
ret = getContentDescription(corpse)
end
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Loot of a ' .. monster .. ': ' .. (ret == '' and 'nothing' or ret))
end
function onKill(cid, target)
local monster = getCreatureName(target)
if not isPlayer(target) and getMonsterInfo(monster).lookCorpse > 0 then
addEvent(send, 100, cid, getThingPos(target), getMonsterInfo(monster).lookCorpse, monster)
end
return true
end