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:GameInfo/Skills: Difference between revisions

From SpiritVale Wiki
No edit summary
Tags: Mobile edit Mobile web edit
No edit summary
Tags: Mobile edit Mobile web edit
Line 825: Line 825:


return root
return root
end
local function _build_meta_card(frame, parent, spec)
spec = _safe_tbl(spec)
local card = parent:tag("div")
:addClass("sv-tile")
:addClass("sv-meta-card")
:addClass("sv-hover-lift")
local icon_div = card:tag("div")
:addClass("sv-meta-icon")
:addClass("sv-tile")
local icon_page = _safe_str(spec.icon_page, "")
local icon_alt = _safe_str(spec.icon_alt, "")
if icon_page ~= "" then
icon_div:node(_render_file_image(icon_page, icon_alt, 24))
else
icon_div:node(_question_badge())
end
local wrap = card:tag("div"):addClass("sv-meta-textwrap")
local text = wrap:tag("div"):addClass("sv-meta-text")
local lines = _safe_tbl(spec.lines)
if #lines > 0 then
text:node(_meta_lines_def(frame, lines))
else
text:wikitext("—")
end
local hit_tok = _safe_str(spec.hit_tok, "")
if _has_pipe(hit_tok) then
local wt = _render_def_token(frame, hit_tok, true, { pill = "1", fill = "1" })
if wt then
card:tag("span")
:addClass("sv-meta-hit")
:attr("aria-hidden", "true")
:wikitext(wt)
end
end
end
end


Line 833: Line 875:
for i = 1, 4 do
for i = 1, 4 do
local cell = _safe_tbl(meta_row[i])
local cell = _safe_tbl(meta_row[i])
local card = meta:tag("div")
:addClass("sv-tile")
:addClass("sv-meta-card")
:addClass("sv-hover-lift")
local icon = _safe_tbl(cell.icon)
local icon = _safe_tbl(cell.icon)
local icon_page = _safe_str(icon.page, "")
local icon_alt = _safe_str(icon.alt, "")
local icon_div = card:tag("div")
:addClass("sv-meta-icon")
:addClass("sv-tile")
if icon_page ~= "" then
icon_div:node(_render_file_image(icon_page, icon_alt, 24))
else
icon_div:node(_question_badge())
end
local wrap = card:tag("div"):addClass("sv-meta-textwrap")
local text = wrap:tag("div"):addClass("sv-meta-text")
local lines = _safe_tbl(cell.label_lines)
local lines = _safe_tbl(cell.label_lines)
if #lines > 0 then
local hit_tok = ""
text:node(_meta_lines_def(frame, lines))
else
text:wikitext("")
end


local hit_tok = ""
for _, ln in ipairs(lines) do
for _, ln in ipairs(lines) do
local s = _safe_str(ln, "")
local s = _safe_str(ln, "")
Line 870: Line 886:
end
end
end
end
if hit_tok ~= "" then
 
local wt = _render_def_token(frame, hit_tok, true, { pill = "1", fill = "1" })
_build_meta_card(frame, meta, {
if wt then
icon_page = _safe_str(icon.page, ""),
card:tag("span")
icon_alt = _safe_str(icon.alt, ""),
:addClass("sv-meta-hit")
lines = lines,
:attr("aria-hidden", "true")
hit_tok = hit_tok,
:wikitext(wt)
})
end
end
end
end


Line 890: Line 904:
for i = 1, 4 do
for i = 1, 4 do
local cell = _safe_tbl(skill_meta[i])
local cell = _safe_tbl(skill_meta[i])
local card = meta:tag("div")
local lines = _safe_tbl(cell.label_lines)
:addClass("sv-tile")
local hit_tok = _safe_str(cell.label_wt, "")
:addClass("sv-meta-card")
:addClass("sv-hover-lift")
 
local icon_div = card:tag("div")
:addClass("sv-meta-icon")
:addClass("sv-tile")


local icon_page = _safe_str(cell.icon, "")
if #lines == 0 and hit_tok ~= "" then
if icon_page ~= "" then
lines = { hit_tok }
icon_div:node(_render_file_image(icon_page, "", 24))
else
icon_div:node(_question_badge())
end
end


local wrap = card:tag("div"):addClass("sv-meta-textwrap")
_build_meta_card(frame, meta, {
local text = wrap:tag("div"):addClass("sv-meta-text")
icon_page = _safe_str(cell.icon, ""),
 
icon_alt = "",
local display_lines = _safe_tbl(cell.label_lines)
lines = lines,
if #display_lines == 0 then
hit_tok = hit_tok,
local label_wt = _safe_str(cell.label_wt, "")
})
if label_wt ~= "" then display_lines = { label_wt } end
end
 
if #display_lines > 0 then
text:node(_meta_lines_def(frame, display_lines))
else
text:wikitext("—")
end
 
local hit_tok = _safe_str(cell.label_wt, "")
if _has_pipe(hit_tok) then
local wt = _render_def_token(frame, hit_tok, true, { pill = "1", fill = "1" })
if wt then
card:tag("span")
:addClass("sv-meta-hit")
:attr("aria-hidden", "true")
:wikitext(wt)
end
end
end
end


Line 1,589: Line 1,575:
if usr_box then row:node(usr_box) end
if usr_box then row:node(usr_box) end
return row
return row
end
local function _append_meta_req_bubble(wrap, mod, node)
if not node then return false end
wrap:tag("div")
:addClass("sv-skill-meta-block__bubble")
:addClass("sv-skill-meta-block__bubble--" .. mod)
:node(node)
return true
end
end


Line 1,598: Line 1,595:


local count = 0
local count = 0
 
if _append_meta_req_bubble(wrap, "meta", meta_node) then count = count + 1 end
if meta_node then
if _append_meta_req_bubble(wrap, "req", req_node) then count = count + 1 end
count = count + 1
local bubble = wrap:tag("div")
:addClass("sv-skill-meta-block__bubble")
:addClass("sv-skill-meta-block__bubble--meta")
bubble:node(meta_node)
end
 
if req_node then
count = count + 1
local bubble = wrap:tag("div")
:addClass("sv-skill-meta-block__bubble")
:addClass("sv-skill-meta-block__bubble--req")
bubble:node(req_node)
end


if count == 1 then
if count == 1 then