mirror of
https://github.com/opentibiabr/canary
synced 2026-08-16 06:26:09 -04:00
20 lines
659 B
Lua
20 lines
659 B
Lua
local removeEmptyParcelsEvent = CreatureEvent("RemoveEmptyParcelsOnLogin")
|
|
|
|
function removeEmptyParcelsEvent.onLogin(player)
|
|
local emptyParcelsToRemove = {}
|
|
for _, parcel in ipairs(player:getStoreInbox():getItems(true)) do
|
|
if parcel:getId() == ITEM_PARCEL_STAMPED and parcel:getEmptySlots() == 10 then
|
|
table.insert(emptyParcelsToRemove, parcel)
|
|
end
|
|
end
|
|
|
|
if #emptyParcelsToRemove > 0 then
|
|
for _, parcel in pairs(emptyParcelsToRemove) do
|
|
parcel:remove()
|
|
end
|
|
player:sendTextMessage(MESSAGE_EVENT_ADVANCE, #emptyParcelsToRemove .. " empty parcels were removed from your store inbox!")
|
|
end
|
|
return true
|
|
end
|
|
|
|
removeEmptyParcelsEvent:register()
|