Module:GamePassives: Difference between revisions
From SpiritVale Wiki
More actions
No edit summary |
No edit summary |
||
| Line 45: | Line 45: | ||
end | end | ||
-- CHANGED: tag body rows so we can center text without touching the hero row | |||
local function addRow(tbl, label, value) | local function addRow(tbl, label, value) | ||
if value == nil or value == "" then | if value == nil or value == "" then | ||
| Line 50: | Line 51: | ||
end | end | ||
local row = tbl:tag("tr") | local row = tbl:tag("tr") | ||
row:addClass("spiritvale-passive-body-row") | |||
row:tag("th"):wikitext(label):done() | row:tag("th"):wikitext(label):done() | ||
row:tag("td"):wikitext(value):done() | row:tag("td"):wikitext(value):done() | ||
end | end | ||
-- CHANGED: tag section header rows as body rows too (for centering) | |||
local function addSectionHeader(tbl, label) | local function addSectionHeader(tbl, label) | ||
local row = tbl:tag("tr") | local row = tbl:tag("tr") | ||
row:addClass("spiritvale-passive-body-row") | |||
local cell = row:tag("th") | local cell = row:tag("th") | ||
cell:attr("colspan", 2) | cell:attr("colspan", 2) | ||
| Line 330: | Line 335: | ||
local function buildInfobox(rec) | local function buildInfobox(rec) | ||
local root = mw.html.create("table") | local root = mw.html.create("table") | ||
root:addClass("wikitable spiritvale-passive-infobox") | root:addClass("wikitable") | ||
root:addClass("spiritvale-passive-infobox") -- CSS will lock size / wrapping | |||
-- ========================================================== | -- ========================================================== | ||
| Line 374: | Line 380: | ||
------------------------------------------------------------------ | ------------------------------------------------------------------ | ||
addSectionHeader(root, "General") | addSectionHeader(root, "General") | ||
addRow(root, "Max level", rec["Max Level"] and tostring(rec["Max Level"])) | addRow(root, "Max level", rec["Max Level"] and tostring(rec["Max Level"])) | ||
-- CHANGED: Remove Classes from passives (template usage is on class pages) | |||
local users = rec.Users or {} | local users = rec.Users or {} | ||
addRow(root, "Classes", listToText(users.Classes)) | -- addRow(root, "Classes", listToText(users.Classes)) -- removed | ||
addRow(root, "Summons", listToText(users.Summons)) | addRow(root, "Summons", listToText(users.Summons)) | ||
addRow(root, "Monsters", listToText(users.Monsters)) | addRow(root, "Monsters", listToText(users.Monsters)) | ||
| Line 513: | Line 517: | ||
local args = getArgs(frame) | local args = getArgs(frame) | ||
local raw1 = args[1] | local raw1 = args[1] | ||
local name = args.name or raw1 | local name = args.name or raw1 | ||
| Line 543: | Line 543: | ||
(not id or id == "") | (not id or id == "") | ||
if noExplicitArgs then | if noExplicitArgs then | ||
return p.listForUser(frame) | return p.listForUser(frame) | ||
end | end | ||
if name and name ~= "" and name == pageName and (not id or id == "") then | if name and name ~= "" and name == pageName and (not id or id == "") then | ||
return p.listForUser(frame) | return p.listForUser(frame) | ||
end | end | ||
local label = name or id or "?" | local label = name or id or "?" | ||
return string.format( | return string.format( | ||
| Line 562: | Line 559: | ||
end | end | ||
return buildInfobox(rec) | return buildInfobox(rec) | ||
end | end | ||
return p | return p | ||