function ec.onDropLoot(monster, corpse)
if not corpse:getType():isContainer() then
return
end
local corpseOwner = Player(corpse:getCorpseOwner())
local items = corpse:getItems()
local warningCapacity = false
for _, item in pairs(items) do
if item then
local itemId = item:getId()
if hasPlayerAutolootItem(corpseOwner, itemId) then
if currencyItems[itemId] then
local worth = item:getCount()
local playerBankBalance = corpseOwner:getBankBalance()
corpseOwner:setBankBalance(playerBankBalance + worth)
corpseOwner:sendTextMessage(MESSAGE_STATUS_SMALL, string.format("Your balance increases by %d gold coins.", worth))
item:remove()
elseif not item:moveTo(corpseOwner, 0) then
warningCapacity = true
end
end
end
end
if warningCapacity then
corpseOwner:sendTextMessage(MESSAGE_EVENT_ADVANCE, "You have no capacity.")
end
end