Module:StreetBrawlItems: Difference between revisions

Jump to navigation Jump to search
Vergir (talk | contribs)
Hero section: move styling to classes (Template:HeroStreetBrawl/styles.css), sort items by slot then cost then name, wrap groups for spacing (with help from vergir-bot LLM)
Vergir (talk | contribs)
Filter out disabled items; render Common as a clickable label toggle with a pipe-delimited list (with help from vergir-bot LLM)
Line 26: Line 26:


local function iname(code) local it = items[code]; return it and it.Name or nil end
local function iname(code) local it = items[code]; return it and it.Name or nil end
local function iok(code) local it = items[code]; return it ~= nil and it.Name ~= nil end
-- A "real" item: exists, has a display name, and is not disabled/removed.
local function iok(code)
local it = items[code]
return it ~= nil and it.Name ~= nil and it.IsDisabled ~= true
end
local function itier(code)
local function itier(code)
local it = items[code]; if not it then return nil end
local it = items[code]; if not it then return nil end
Line 118: Line 122:


if collapse then
if collapse then
local head = (label ~= "" and label) or " "
-- Common: a bold label (like Favored/Unfavored) that toggles a collapsed,
return '{| class="wikitable mw-collapsible mw-collapsed sb-common"\n'
-- pipe-delimited list of the remaining pool items.
.. '! class="sb-common-head" | ' .. head .. '\n|-\n| '
local id = "sbcommon-" .. hkey .. "-" .. tostring(tier or 0)
.. classdiv(parts, "sb-icons") .. '\n|}'
local head = (label ~= "" and label) or "Common"
return '<div class="sb-group">'
.. '<div class="sb-label sb-toggle mw-customtoggle-' .. id .. '">' .. head .. '</div>'
.. '<div class="sb-common mw-collapsible mw-collapsed" id="mw-customcollapsible-' .. id .. '">'
.. '<div class="sb-common-body mw-collapsible-content">' .. table.concat(parts, " | ") .. '</div>'
.. '</div></div>'
end
end