Toggle menu
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Join the Playtest on Steam Now: SpiritVale

Module:GamePassives: Difference between revisions

From SpiritVale Wiki
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")
    -- Description now lives in the hero row.
    -- addRow(root, "Description", rec.Description)


     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)


    -- Allow:
    --  {{Passive|Honed Blade}}          -> args[1] = "Honed Blade" (Name)
    --  {{Passive|name=Honed Blade}}      -> args.name
    --  {{Passive|id=CritMastery}}        -> args.id (Internal Name)
     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 == "")


        -- Case A: {{Passive}} with no parameters on a page → list for that page name.
         if noExplicitArgs then
         if noExplicitArgs then
             return p.listForUser(frame)
             return p.listForUser(frame)
         end
         end


        -- Case B: {{Passive|Acolyte}} on the "Acolyte" page and no id → treat as list.
         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


        -- Otherwise, genuinely unknown passive.
         local label = name or id or "?"
         local label = name or id or "?"
         return string.format(
         return string.format(
Line 562: Line 559:
     end
     end


    -- Normal single-passive behavior
     return buildInfobox(rec)
     return buildInfobox(rec)
end
end


return p
return p