Module:ItemsByStat: Difference between revisionsGive feedback
Jump to navigation
Jump to search
SerpentofSet (talk | contribs) No edit summary |
SerpentofSet (talk | contribs) No edit summary |
||
| Line 1: | Line 1: | ||
local p = {} | local p = {} | ||
local AllItemData = mw.loadJsonData("Data:ItemData.json") | local AllItemData = mw.loadJsonData("Data:ItemData.json") | ||
local Lang = require("Module:Lang") | |||
-- I truly have no better idea of how to sort by cost within slot, so I'm gonna multiply the costs of slots I want lower in the table | -- I truly have no better idea of how to sort by cost within slot, so I'm gonna multiply the costs of slots I want lower in the table | ||
| Line 7: | Line 8: | ||
multBySlot["Armor"] = 10000 | multBySlot["Armor"] = 10000 | ||
multBySlot["Tech"] = 100000000 | multBySlot["Tech"] = 100000000 | ||
-- For coloring the table by slot | |||
local colorBySlot = {} | |||
colorBySlot["Weapon"] = "#FCAC4D" | |||
colorBySlot["Armor"] = "#86C921" | |||
colorBySlot["Tech"] = "#DE9CFF" | |||
local selectByStat = function(stat) | local selectByStat = function(stat) | ||
| Line 29: | Line 36: | ||
end | end | ||
--{{#invoke:ItemsByStat|tablefy|stat|statName|suffix}} | --{{#invoke:ItemsByStat|tablefy|stat|statName|suffix}} | ||
| Line 45: | Line 48: | ||
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]}}.."||".. | 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" | ||