Editing Module:StreetBrawlItems

Warning: You are not logged in. Once you make an edit, a temporary account will be created for you. Learn more. Log in or create an account to continue receiving notifications after this account expires, and to access other features.
The edit can be undone. Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
Latest revision Your text
Line 184: Line 184:
out[#out + 1] = classdiv(parts, "sb-cards")
out[#out + 1] = classdiv(parts, "sb-cards")
return table.concat(out, "\n")
return table.concat(out, "\n")
end
-- {{#invoke:StreetBrawlItems|counters_table}}
-- Every hero that has counter items, one row each, sorted by hero name. Items
-- within a row are listed alphabetically. Built as HTML rather than pipe-table
-- markup so the invoke does not have to sit at the start of a line.
function p.counters_table(frame)
local by_hero, rows = {}, {}
for _, o in ipairs(sb.Outliers) do
if o.Counter ~= nil and iok(o.Item) then
local hero = heroes[o.Hero]
if hero and hero.Name then
local row = by_hero[o.Hero]
if not row then
row = { name = hero.Name, items = {}, seen = {} }
by_hero[o.Hero] = row
rows[#rows + 1] = row
end
-- Guard against a hero/item pair being listed twice.
if not row.seen[o.Item] then
row.seen[o.Item] = true
row.items[#row.items + 1] = iname(o.Item)
end
end
end
end
if #rows == 0 then return "" end
table.sort(rows, function(a, b) return a.name < b.name end)
local tbl = mw.html.create("table"):addClass("wikitable")
local head = tbl:tag("tr")
head:tag("th"):wikitext("Hero")
head:tag("th"):wikitext("Items")
for _, row in ipairs(rows) do
table.sort(row.items)
local icons = {}
for _, n in ipairs(row.items) do
icons[#icons + 1] = frame:expandTemplate{title = "ItemIcon", args = {n}}
end
local tr = tbl:tag("tr")
tr:tag("td"):wikitext(frame:expandTemplate{title = "HeroIcon", args = {row.name}})
tr:tag("td"):wikitext(table.concat(icons, ", "))
end
return tostring(tbl)
end
end


return p
return p
Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Deadlock:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template

Page included on this page: