17,101
edits
(Update for v1.1) |
(Update for v1.1) |
||
Line 2: | Line 2: | ||
-- run p.getItemsTableAlt() in debug and copy the result to [[Template:ItemsTable]] after an update that adds new items. | -- run p.getItemsTableAlt() in debug and copy the result to [[Template:ItemsTable]] after an update that adds new items. | ||
--[=[ | --[=[ | ||
mw.log(p.getItemsTableAlt( | mw.log(p.getItemsTableAlt(nil, 60)) | ||
--]=] | --]=] | ||
Line 36: | Line 26: | ||
--Alternate version that has everything still | --Alternate version that has everything still | ||
function p.getItemsTableAlt( | function p.getItemsTableAlt(fromItemID, rows) | ||
local itemList = {} | local itemList = {} | ||
local | local rowCount = 0 | ||
local genRows = false | |||
for i, item in ipairs(GameData.rawData.items) do | for i, item in ipairs(GameData.rawData.items) do | ||
if | if not genRows then | ||
genRows = fromItemID == nil or item.id == fromItemID | |||
elseif genRows then | |||
rowCount = rowCount + 1 | |||
if rowCount > rows then | |||
break | break | ||
end | |||
local iCat = item.category ~= nil and item.category or '' | |||
local itemRow = {'\n|-'} | |||
table.insert(itemRow, '\n|'..Icons.Icon({item.name, type='item', notext=true, size=50})) | |||
table.insert(itemRow, '||'..Icons.Icon({item.name, type='item', noicon=true})..'||'..item.id..'||'..iCat..'||'..item.type) | |||
table.insert(itemRow, '|| '..Items._getItemStat(item, 'completionReq')) | |||
table.insert(itemRow, '||data-sort-value="'..math.floor(item.sellsFor)..'"|'..Icons.GP(math.floor(item.sellsFor))) | |||
table.insert(itemRow, '||style="text-align:right;"|'..SourceTables._getItemSources(item)) | |||
table.insert(itemRow, '||style="text-align:right;"|'..UseTables._getItemUses(item, false)) | |||
table.insert(itemList, table.concat(itemRow)) | |||
end | end | ||
end | end |