mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-13 14:24:55 +02:00
introduce talkaction to query house tile items by id
This commit is contained in:
@@ -25,3 +25,25 @@ end
|
||||
function Container.isTile(self)
|
||||
return false
|
||||
end
|
||||
|
||||
function Container.getItemsById(self, itemId)
|
||||
local list = {}
|
||||
for index = 0, (self:getSize() - 1) do
|
||||
local item = self:getItem(index)
|
||||
if item then
|
||||
if item:isContainer() then
|
||||
local rlist = item:getItemsById(itemId)
|
||||
if type(rlist) == 'table' then
|
||||
for _, v in pairs(rlist) do
|
||||
table.insert(list, v)
|
||||
end
|
||||
end
|
||||
else
|
||||
if item:getId() == itemId then
|
||||
table.insert(list, item)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return list
|
||||
end
|
Reference in New Issue
Block a user