Module:StreetBrawlItems: Difference between revisionsGive feedback
Jump to navigation
Jump to search
Finalize: keep only the Fill card layout; drop legacy hero renderer, grid mode, theme/style/size options (with help from vergir-bot LLM) |
Add gated-preview support: styled non-TOC tier/section headings via heading_div, and optional gate=ID param on tiers to open a clip container after Tier 1 (with help from vergir-bot LLM) |
||
| Line 70: | Line 70: | ||
if #parts == 0 then return "" end | if #parts == 0 then return "" end | ||
return '<div class="' .. class .. '">' .. table.concat(parts) .. '</div>' | return '<div class="' .. class .. '">' .. table.concat(parts) .. '</div>' | ||
end | |||
-- A tier/section heading styled to look like a heading but rendered as a plain | |||
-- div, so it stays out of the table of contents (and can be hidden inside the gate). | |||
local function heading_div(label) | |||
return '<div class="sb-tier-head">' .. label .. '</div>' | |||
end | end | ||
| Line 142: | Line 148: | ||
end | end | ||
-- {{#invoke:StreetBrawlItems|tiers|HERO|high=..|middle=..|low=..}} | -- {{#invoke:StreetBrawlItems|tiers|HERO|high=..|middle=..|low=..|gate=ID}} | ||
-- All five tiers, | -- All five tiers under styled (non-TOC) headings. With gate=ID, everything from | ||
-- the Tier 1 columns onward is wrapped in an open <div id=ID class="sb-gate"> | |||
-- <div class="sb-gate-body"> that the caller must close after any trailing content. | |||
function p.tiers(frame) | function p.tiers(frame) | ||
local hkey = hero_key(frame.args[1]); if not hkey then return "" end | local hkey = hero_key(frame.args[1]); if not hkey then return "" end | ||
| Line 149: | Line 157: | ||
local mid = frame.args.middle or "Average chance" | local mid = frame.args.middle or "Average chance" | ||
local lo = frame.args.low or "Low chance" | local lo = frame.args.low or "Low chance" | ||
local gate = frame.args.gate | |||
if gate == "" then gate = nil end | |||
local labels = { "Tier 1", "Tier 2", "Tier 3", "Tier 4", "Legendary" } | local labels = { "Tier 1", "Tier 2", "Tier 3", "Tier 4", "Legendary" } | ||
local out = {} | local out = {} | ||
for t = 1, 5 do | for t = 1, 5 do | ||
out[#out + 1] = "=== " .. | local head = heading_div(labels[t]) | ||
local cols = tier_columns(frame, hkey, t, hi, mid, lo) | |||
if t == 1 and gate then | |||
out[#out + 1] = head .. "\n" | |||
.. '<div id="' .. gate .. '" class="sb-gate"><div class="sb-gate-body">\n' | |||
.. cols | |||
else | |||
out[#out + 1] = head .. "\n" .. cols | |||
end | |||
end | end | ||
return table.concat(out, "\n\n") | return table.concat(out, "\n\n") | ||
| Line 174: | Line 192: | ||
local out = {} | local out = {} | ||
local heading = frame.args.heading | local heading = frame.args.heading | ||
if heading and heading ~= "" then out[#out + 1] = | if heading and heading ~= "" then out[#out + 1] = heading_div(heading) end | ||
local note = frame.args.note | local note = frame.args.note | ||
if note and note ~= "" then out[#out + 1] = "''" .. note .. "''" end | if note and note ~= "" then out[#out + 1] = "''" .. note .. "''" end | ||