Module:Items: Difference between revisions
From Melvor Idle
No edit summary |
No edit summary |
||
Line 544: | Line 544: | ||
function p.getItemGrid(frame) | function p.getItemGrid(frame) | ||
local | --melvorD, melvorTotH, melvorAoD | ||
table | local dlcFunc = function(item, dlc) | ||
for | local itemDLC = Shared.getLocalID(item.id) | ||
if i | if dlc == 'all' then | ||
return true | |||
end | |||
if itemDLC == dlc then | |||
return true | |||
end | |||
return false | |||
end | |||
local args = frame:getParent().args | |||
local dlc = args[1] or args.DLC or args.dlc or nil | |||
local columns = args[2] or args.Columns or args.columns or 17 | |||
local html = mw.html.create('table') | |||
:addClass('wikitable lighttable individual') | |||
local curRow = html:tag('tr') | |||
local i = 0 | |||
for _, v in pairs(GameData.rawData.items) do | |||
if dlcFunc(v, dlc) == true then | |||
if i == columns then | |||
curRow = html:tag('tr') | |||
i = 0 | |||
else | |||
cell = curRow:tag('td') | |||
:css('height', '48px') | |||
:css('width', '48px') | |||
:css('padding', '0px') | |||
cell:tag('div') | |||
:css('padding', '8px') | |||
:wikitext(Icons.Icon({v.name, type='item', notext=true, size='32'})) | |||
-- Mod operator is slow. We use this instead | |||
i = i + 1 | |||
end | |||
end | end | ||
end | end | ||
return | return tostring(html) | ||
end | end | ||