Editing Module:ItemsByStatGive feedback
Jump to navigation
Jump to search
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 31: | Line 31: | ||
local outData = {} | local outData = {} | ||
local i = 1 | local i = 1 | ||
for | for m,itemData in pairs(InGameItemData) do | ||
if itemData[stat] ~= nil and itemData[stat] ~= "0" then -- If Item has non-zero stat in its keys, | if itemData[stat] ~= nil and itemData[stat] ~= "0" then -- If Item has non-zero stat in its keys, | ||
outData[i] = {} -- start a new record of data and | outData[i] = {} -- start a new record of data and | ||
| Line 37: | Line 37: | ||
outData[i][x] = itemData[inKeys[x]] -- grab stat and other values | outData[i][x] = itemData[inKeys[x]] -- grab stat and other values | ||
end | end | ||
i = i+1 | i = i+1 | ||
end | end | ||
| Line 44: | Line 42: | ||
-- Sort by cost within slot | -- Sort by cost within slot | ||
table.sort(outData, function(a,b) return a[ | table.sort(outData, function(a,b) return a[3]*multBySlot[a[4]]<b[3]*multBySlot[b[4]] end) | ||
return outData -- outData is a table of tables, one for each Item that has the specified stat, where each inner table has the data specified with inKeys, in order | return outData -- outData is a table of tables, one for each Item that has the specified stat, where each inner table has the data specified with inKeys, in order | ||
end | end | ||
| Line 62: | Line 60: | ||
outString = outString.. | outString = outString.. | ||
'|-style="background:'..colorBySlot[tableData[i][4]]..'"\n|'.. | '|-style="background:'..colorBySlot[tableData[i][4]]..'"\n|'.. | ||
frame:expandTemplate{title="Item", args={tableData[i][1],Lang._search_string(tableData[i][1])}}.."||".. | |||
frame:expandTemplate{title="Souls", args={tableData[i][3]}}.."||".. | frame:expandTemplate{title="Souls", args={tableData[i][3]}}.."||".. | ||
'style="text-align:center;"|+'..tableData[i][5]..suffix.."\n" | 'style="text-align:center;"|+'..tableData[i][5]..suffix.."\n" | ||