More actions
m keep '+' for upgrade data |
m upgrade table generated in a single function |
||
Line 61: | Line 61: | ||
end | end | ||
local UPGRADE_COST_MAP = {1, 2, 5} | |||
p.get_upgrade_table = function(frame) | p.get_upgrade_table = function(frame) | ||
local hero_name = frame.args[1] | local hero_name = frame.args[1] | ||
Line 69: | Line 70: | ||
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 | ||
local rows = '' | local rows = '\n|-\n' | ||
for i, upgrade in pairs(ability.Upgrades) do | |||
local data_rows = '' | |||
-- track number of attributes so we can assign the correct rowspan for the upgrade cost column | |||
local num_of_attrs = 0 | |||
for key, value in pairs(upgrade) do | |||
if key ~= 'DescKey' then | |||
local scale_type = upgrade.Scale and upgrade.Scale.Type or nil | |||
local scale_value = upgrade.Scale and upgrade.Scale.Value or nil | |||
data_rows = data_rows .. create_row(key, value, scale_type, scale_value, frame, true) | |||
num_of_attrs = num_of_attrs + 1 | |||
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 .. data_rows | |||
end | end | ||