Anonymous

Module:Items: Difference between revisions

From Melvor Idle
getItemGrid: Implement filtering for certain items
No edit summary
(getItemGrid: Implement filtering for certain items)
Line 24: Line 24:
'Holiday Scarf', 'Gingerbread House', 'Gingerbread Man', 'Edible Candy Cane',
'Holiday Scarf', 'Gingerbread House', 'Gingerbread Man', 'Edible Candy Cane',
'Locked Chest', 'Locked Chest Key', 'Event Token (Holiday 2021)'}
'Locked Chest', 'Locked Chest Key', 'Event Token (Holiday 2021)'}
-- List of item IDs that should typically not be included within outputs, usually
-- because they are not fully implemented despite existing within the game data
p.HiddenItems = {'melvorTotH:Meteorite_Dust'}


function p.getItemByID(ID)
function p.getItemByID(ID)
Line 559: Line 562:
end
end
return false
return false
end
-- Convert list of hidden items into a key/value structure, such that
-- lookups are more efficient than repeated calls to Shared.contains()
local hiddenItemIDs = {}
for i, itemID in ipairs(p.HiddenItems) do
hiddenItemIDs[itemID] = 1
end
end


Line 571: Line 581:
local i = 0
local i = 0
for _, v in pairs(GameData.rawData.items) do
for _, v in pairs(GameData.rawData.items) do
if dlcFunc(v, dlc) == true then
if hiddenItemIDs[v.id] == nil and dlcFunc(v, dlc) == true then
if i >= columns then
if i >= columns then
curRow = html:tag('tr')
curRow = html:tag('tr')