Module:ItemTables: Difference between revisionsGive feedback
Gammaton32 (talk | contribs) No edit summary |
No edit summary |
||
| Line 49: | Line 49: | ||
return copy | return copy | ||
end | end | ||
local friendly_to_internal = {} | local friendly_to_internal = {} | ||
| Line 216: | Line 196: | ||
-- query all the filtered items. itemName is the item table. | -- query all the filtered items. itemName is the item table. | ||
for internalName, itemName in ipairs(filteredData) do | for internalName, itemName in ipairs(filteredData) do | ||
local display = frame:expandTemplate{ | local display = frame:expandTemplate{ | ||
title = 'ItemIcon', | |||
args = { | |||
itemName["Name"] | |||
} | } | ||
} | } | ||
| Line 229: | Line 208: | ||
listofItems = listofItems .. itemName["Name"] .. "<br/>" | listofItems = listofItems .. itemName["Name"] .. "<br/>" | ||
copyVar = copyVar:gsub("^%l", string.upper) | copyVar = copyVar:gsub("^%l", string.upper) | ||
-- Get category display using ItemType template with appropriate parameters | |||
local categoryDisplay | |||
if itemName["Slot"] == "Armor" then | |||
categoryDisplay = frame:expandTemplate{ | |||
title = 'ItemType', | |||
args = { "Armor", "Vitality" } | |||
} | |||
elseif itemName["Slot"] == "Tech" then | |||
categoryDisplay = frame:expandTemplate{ | |||
title = 'ItemType', | |||
args = { "Tech", "Spirit" } | |||
} | |||
else -- Weapon | |||
categoryDisplay = frame:expandTemplate{ | |||
title = 'ItemType', | |||
args = { "Weapon", "Weapon" } | |||
} | |||
end | |||
local tableData = mw.html.create('tr') | local tableData = mw.html.create('tr') | ||
| Line 234: | Line 232: | ||
:tag('td'):wikitext(display):done() | :tag('td'):wikitext(display):done() | ||
:tag('td'):wikitext(commas._add(get_cost(itemName["Name"]))):done() | :tag('td'):wikitext(commas._add(get_cost(itemName["Name"]))):done() | ||
:tag('td'):wikitext( | :tag('td'):wikitext(categoryDisplay):done() | ||
if (t == "LocalBulletArmorReduction") then | if (t == "LocalBulletArmorReduction") then | ||
tableData | |||
:tag('td'):wikitext("<span style=\"color:red;\">" .. signPrefix(itemName[t]) .. appendSuffix(t) .. "</span> " .. copyVar):done() | |||
else | else | ||
tableData | |||
:tag('td'):wikitext(signPrefix(itemName[t]) .. appendSuffix(t) .. "</span> " .. copyVar):done() | |||
end | end | ||
| Line 250: | Line 248: | ||
for _, row in ipairs(requirements) do | for _, row in ipairs(requirements) do | ||
createTable:node(row) | |||
end | end | ||
return tostring(createTable) | return tostring(createTable) | ||
end | end | ||
return p | return p | ||