Module:StreetBrawlItems: Difference between revisionsGive feedback
p.tier: add layout=grid mode (one wrapping grid, cards outlined by chance) (with help from vergir-bot LLM) |
p.tier columns: conditional widths (drop empty Low; 35/65; narrow one-card Low when High present, fit-content Low when High absent); card size 0.8 (with help from vergir-bot LLM) |
||
| Line 8: | Line 8: | ||
local SLOT_RANK = { Weapon = 1, Armor = 2, Tech = 3 } | local SLOT_RANK = { Weapon = 1, Armor = 2, Tech = 3 } | ||
-- Default card scale passed to ItemBox (tier columns and counter cards). | -- Default card scale passed to ItemBox (tier columns and counter cards). | ||
local CARD_SIZE = "0. | local CARD_SIZE = "0.8" | ||
local NAME_TO_KEY, KEY_TO_NAME, RELEASED = {}, {}, {} | local NAME_TO_KEY, KEY_TO_NAME, RELEASED = {}, {}, {} | ||
| Line 140: | Line 140: | ||
-- {{#invoke:StreetBrawlItems|tier|HERO|TIER|style=icon|card|size=..|theme=..|layout=grid|high=..|middle=..|low=..}} | -- {{#invoke:StreetBrawlItems|tier|HERO|TIER|style=icon|card|size=..|theme=..|layout=grid|high=..|middle=..|low=..}} | ||
-- Default: | -- Default: conditional columns. High chance (favored) 35% and Middle chance (pool) fill | ||
-- layout=grid: one | -- the rest. Low chance (unfavored) is dropped when empty; when present alongside High it | ||
-- becomes a narrow one-card column on the right; when High is absent it sits on the right | |||
-- sized to fit its cards on one line. layout=grid: one grid, cards outlined by chance. | |||
function p.tier(frame) | function p.tier(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 196: | Line 198: | ||
local cls = "sb-tier" | local cls = "sb-tier" | ||
if theme ~= "" then cls = cls .. " " .. theme end | if theme ~= "" then cls = cls .. " " .. theme end | ||
-- Conditional columns per the presence of High and Low. | |||
local out = {} | |||
if #high > 0 then | |||
out[#out + 1] = col(high, "sb-col-high sb-w-high", hi) | |||
end | |||
out[#out + 1] = col(normal, "sb-col-normal sb-w-fill", mid) | |||
if #low > 0 then | |||
local low_w = (#high > 0) and "sb-low-narrow" or "sb-low-wide" | |||
out[#out + 1] = col(low, "sb-col-low " .. low_w, lo) | |||
end | |||
return '<div class="' .. cls .. '">' .. table.concat(out) .. '</div>' | |||
end | end | ||