Module:Abilities/details table: Difference between revisionsGive feedback
m Fixed fallback string |
mNo edit summary |
||
| (2 intermediate revisions by the same user not shown) | |||
| Line 10: | Line 10: | ||
local hero_name = frame.args[1] | local hero_name = frame.args[1] | ||
local ability_num = frame.args[2] | local ability_num = frame.args[2] | ||
local ability = utils.get_ability_card_data( | local hero_key = utils.get_hero_key(hero_name) | ||
local ability = utils.get_ability_card_data(hero_key, ability_num) | |||
if(ability == nil) then error(string.format('Ability %s#%s not found', hero_name, ability_num)) end | if(ability == nil) then error(string.format('Ability %s#%s not found', hero_name, ability_num)) end | ||
| Line 67: | Line 68: | ||
local upgrade_num = frame.args[3] | local upgrade_num = frame.args[3] | ||
local ability = utils.get_ability_card_data( | local hero_key = utils.get_hero_key(hero_name) | ||
local ability = utils.get_ability_card_data(hero_key, ability_num) | |||
if(ability == nil) then error(string.format('Ability %s#%s not found', hero_name, ability_num)) end | if(ability == nil) then error(string.format('Ability %s#%s not found', hero_name, ability_num)) end | ||
| Line 85: | Line 87: | ||
end | end | ||
end | end | ||
rows = rows .. string.format("\n!rowspan=%s style=\"background-color: #121212; color: #FFEFD7; text-align: center\" | [[File:Ability_point_unlock_icon.png|20px|link=Ability_Point]] '''%s'''\n", num_of_attrs, UPGRADE_COST_MAP[i]) | rows = rows .. string.format("\n!rowspan=%s style=\"background-color: #121212; color: #FFEFD7; text-align: center; text-wrap: nowrap;\" | [[File:Ability_point_unlock_icon.png|20px|link=Ability_Point]] '''%s'''\n", num_of_attrs, UPGRADE_COST_MAP[i]) | ||
rows = rows .. data_rows | rows = rows .. data_rows | ||
end | end | ||
| Line 99: | Line 101: | ||
-- get localized label, if none exists, fallback to one that is based on the key | -- get localized label, if none exists, fallback to one that is based on the key | ||
local label = lang.get_string(key..'_label' | local label = lang.get_string(key..'_label') | ||
if label == '' then | |||
label = commonutils.add_space_before_cap(key) | |||
end | |||
local formatted_value = utils.format_value_with_prepost(key, value, frame, with_plus~=true) | local formatted_value = utils.format_value_with_prepost(key, value, frame, with_plus~=true) | ||