Module:AbilityTable: Difference between revisionsGive feedback
add scalingspirit |
grouped repeated hero cells with rowspan |
||
| Line 326: | Line 326: | ||
end | end | ||
table.insert(out, header_row) | table.insert(out, header_row) | ||
local hero_counts = {} | |||
for _, key in ipairs(filtered) do | |||
local hero = views[key].heroName | |||
hero_counts[hero] = (hero_counts[hero] or 0) + 1 | |||
end | |||
local hero_seen = {} | |||
for _, key in ipairs(filtered) do | for _, key in ipairs(filtered) do | ||
local entry = views[key] | local entry = views[key] | ||
local ability = entry.view | local ability = entry.view | ||
local hero = entry.heroName | |||
local | local ability_cell = frame:expandTemplate{ | ||
title = "AbilityIcon", | |||
args = { ability["Name"] } | |||
} | |||
local extra = get_cells(ability) | local extra = get_cells(ability) | ||
enrich_notes_full(extra, stat_notes and stat_notes[ability["Name"]]) | enrich_notes_full(extra, stat_notes and stat_notes[ability["Name"]]) | ||
local row = '| class="ability-table-cell-hero" | ' | local row | ||
if not hero_seen[hero] then | |||
local hero_cell = frame:expandTemplate{ | |||
title = "HeroIcon", | |||
args = { hero } | |||
} | |||
if hero_counts[hero] > 1 then | |||
row = '| rowspan="' .. hero_counts[hero] .. '" class="ability-table-cell-hero" | ' | |||
.. hero_cell | |||
.. ' || class="ability-table-cell-ability" | ' .. ability_cell | |||
else | |||
row = '| class="ability-table-cell-hero" | ' | |||
.. hero_cell | |||
.. ' || class="ability-table-cell-ability" | ' .. ability_cell | |||
end | |||
hero_seen[hero] = true | |||
else | |||
row = '| class="ability-table-cell-ability" | ' .. ability_cell | |||
end | |||
for _, header in ipairs(final_headers) do | for _, header in ipairs(final_headers) do | ||
local value = extra[header] | local value = extra[header] | ||