Module:HeroData: Difference between revisionsGive feedback
m exclude heroes in development or disabled |
m hero icon filling fixed |
||
| Line 350: | Line 350: | ||
local spirit_power = frame.args[2] | local spirit_power = frame.args[2] | ||
if (spirit_power == nil) then spirit_power = 0 end | if (spirit_power == nil) then spirit_power = 0 end | ||
-- Initializations and declarations | -- Initializations and declarations | ||
local row_str = "" | local row_str = "" | ||
local body_str = "" | local body_str = "" | ||
local in_development | |||
local is_disabled | |||
local template_title = "" | |||
local template_args = {} | |||
local hero_icon | |||
local hero_td_style | |||
-- Exclude some specific stats which are currently constant for all heroes at a negligible value | -- Exclude some specific stats which are currently constant for all heroes at a negligible value | ||
| Line 390: | Line 393: | ||
row_str = "" | row_str = "" | ||
-- Retrieve hero's name | -- Retrieve hero's localized name | ||
hero_name = lang_module._get_string(hero_key) | hero_name = lang_module._get_string(hero_key) | ||
-- Retrieve hero's english name, used for hero icon | |||
hero_name_en = hero_data["Name"] | |||
-- Expand hero icon | |||
template_title = "Template:HeroIcon" | |||
template_args[1] = hero_name_en | |||
template_args[2] = hero_name | |||
hero_icon = mw.getCurrentFrame():expandTemplate{ title = template_title, args = template_args } | |||
-- First column in each row is hero name | -- First column in each row is hero name | ||
row_str = row_str .. "<td> | -- This style forces the icon and the name to be on the same line, rather than | ||
-- adding a newline and increasing the height of all other cells in the row | |||
hero_td_style = ' style="white-space: nowrap; overflow: hidden; text-overflow: ellipsis;"' | |||
row_str = row_str .. "<td" .. hero_td_style .. '>' .. hero_icon .. "</td>" | |||
-- Consecutive columns are then stats | -- Consecutive columns are then stats | ||