Module:StreetBrawlItems: Difference between revisions

Card size 0.75; extract tier logic; add p.tiers (all tiers for a hero) (with help from vergir-bot LLM)
No tier badge on Legendary (tier 5) cards; p.tiers uses === headings === (with help from vergir-bot LLM)
Line 57: Line 57:
local name = iname(code); if not name then return nil end
local name = iname(code); if not name then return nil end
if style == "icon" then return frame:expandTemplate{title = "ItemIcon", args = {name}} end
if style == "icon" then return frame:expandTemplate{title = "ItemIcon", args = {name}} end
return frame:expandTemplate{title = "ItemBox", args = {name, showTierTag = "true", size = size or CARD_SIZE}}
local args = { name, size = size or CARD_SIZE }
-- Legendary (tier 5) cards omit the tier badge; it is redundant in the Legendary tier.
if itier(code) ~= 5 then args.showTierTag = "true" end
return frame:expandTemplate{title = "ItemBox", args = args}
end
end
local function render_hero(frame, key)
local function render_hero(frame, key)
Line 153: Line 156:
local style = frame.args.style
local style = frame.args.style
if not style or style == "" then style = (group == "common") and "icon" or "card" end
if not style or style == "" then style = (group == "common") and "icon" or "card" end
local collapse = (frame.args.collapse == "yes" or frame.args.collapse == "true")
local label = frame.args.label or ""
local label = frame.args.label or ""


Line 210: Line 212:
end
end


-- {{#invoke:StreetBrawlItems|tiers|HERO|style=..|size=..|theme=..}} -> all five tiers stacked.
-- {{#invoke:StreetBrawlItems|tiers|HERO|style=..|size=..|theme=..}} -> all five tiers, each with a heading.
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 223: Line 225:
local out = {}
local out = {}
for t = 1, 5 do
for t = 1, 5 do
out[#out + 1] = "'''" .. labels[t] .. "'''\n" .. tier_columns(frame, hkey, t, style, size, theme, hi, mid, lo)
out[#out + 1] = "=== " .. labels[t] .. " ===\n" .. tier_columns(frame, hkey, t, style, size, theme, hi, mid, lo)
end
end
return table.concat(out, "\n\n")
return table.concat(out, "\n\n")