Module:GameSkills: Difference between revisions
From SpiritVale Wiki
More actions
No edit summary |
No edit summary |
||
| Line 1: | Line 1: | ||
-- Standard Hero Layout (reused across the wiki): | -- Standard Hero Layout (reused across the wiki): | ||
-- 1) hero-title-bar ( | -- 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 ( | -- - 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") | ||
heroCell:wikitext(buildHeroBarUI(rec, level, maxLevel, icon, title)) | |||
if desc ~= "" then | if desc ~= "" then | ||