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:GameSkills: Difference between revisions

From SpiritVale Wiki
No edit summary
No edit summary
Line 1: Line 1:
-- Module:GameSkills
--
-- Renders active skill data (Data:skills.json) into an infobox-style table,
-- and can also list all skills for a given user/class (page name).
--
-- Standard Hero Layout (reused across the wiki):
-- Standard Hero Layout (reused across the wiki):
--  1) hero-title-bar        (icon + name)
--  1) hero-title-bar        (TOP BAR, 2 slots: herobar 1..2)
--        - Herobar 1: Icon + Skill Name (left)
--        - Herobar 2: Reserved for compact info (right)
--  2) hero-description-bar  (description strip)
--  2) hero-description-bar  (description strip)
--  3) hero-modules row      (4 slots: hero-module-1..4)
--  3) hero-modules row      (4 slots: hero-module-1..4)
--        - Slot 1: module-level-selector
--        - Slot 1: module-level-selector
--        - Slot 2: module-skill-type
--        - Slot 2: module-skill-type
--        - Slot 3: skill-source-module (Basis + Source + Scaling) OR blank
--        - Slot 3: skill-source-module (Modifier + Source + Scaling) OR blank
--        - Slot 4: module-quick-stats (Range/Area/Cost/Cast/Cooldown/Duration)
--        - Slot 4: module-quick-stats (Range/Area/Cost/Cast/Cooldown/Duration)
--
--
Line 735: Line 732:


return (ext and mw.ustring.lower(ext) == pageName) or (internal and mw.ustring.lower(internal) == pageName) or false
return (ext and mw.ustring.lower(ext) == pageName) or (internal and mw.ustring.lower(internal) == pageName) or false
end
----------------------------------------------------------------------
-- Hero bar modules (2-slot scaffold)
--  - Slot 1: Icon + Title (left)
--  - Slot 2: Reserved for future compact info (right)
----------------------------------------------------------------------
local function heroBarBox(slot, extraClasses, innerHtml, isEmpty)
local box = mw.html.create("div")
box:addClass("hero-bar-module")
box:addClass("hero-bar-module-" .. tostring(slot))
box:attr("data-hero-bar-module", tostring(slot))
if extraClasses then
if type(extraClasses) == "string" then
box:addClass(extraClasses)
elseif type(extraClasses) == "table" then
for _, c in ipairs(extraClasses) do
box:addClass(c)
end
end
end
if isEmpty then
box:addClass("hero-bar-module-empty")
end
local body = box:tag("div"):addClass("hero-bar-module-body")
if innerHtml and innerHtml ~= "" then
body:wikitext(innerHtml)
end
return tostring(box)
end
local function buildEmptyHeroBar(slot)
return heroBarBox(slot, nil, "", true)
end
local function buildHeroBar1(icon, title)
local wrap = mw.html.create("div")
wrap:addClass("sv-herobar-1-wrap")
if icon and icon ~= "" then
wrap:tag("div")
:addClass("sv-herobar-icon")
:wikitext(string.format("[[File:%s|80px|link=]]", icon))
end
wrap:tag("div")
:addClass("spiritvale-infobox-title")
:wikitext(title or "Unknown Skill")
return heroBarBox(1, "module-herobar-1", tostring(wrap), false)
end
-- Reserved slot: keep it empty for now (but fully wired for later)
local function buildHeroBar2(rec, level, maxLevel)
-- Return an empty container so the slot exists for future use.
-- When you're ready, populate this with compact badges, tags, etc.
local wrap = mw.html.create("div")
wrap:addClass("sv-herobar-2-wrap")
return heroBarBox(2, "module-herobar-2", tostring(wrap), false)
end
local function buildHeroBarUI(rec, level, maxLevel, icon, title)
local bar = mw.html.create("div")
bar:addClass("hero-bar-grid")
bar:wikitext(buildHeroBar1(icon, title))
local hb2 = buildHeroBar2(rec, level, maxLevel)
bar:wikitext(hb2 or buildEmptyHeroBar(2))
return tostring(bar)
end
end


Line 1,477: Line 1,549:
heroCell:addClass("sv-hero-title-cell")
heroCell:addClass("sv-hero-title-cell")


local heroInner = heroCell:tag("div")
    heroCell:wikitext(buildHeroBarUI(rec, level, maxLevel, icon, title))
heroInner:addClass("spiritvale-infobox-main-left-inner")
 
if icon and icon ~= "" then
heroInner:wikitext(string.format("[[File:%s|80px|link=]]", icon))
end
 
heroInner:tag("div")
:addClass("spiritvale-infobox-title")
:wikitext(title)


if desc ~= "" then
if desc ~= "" then