Toggle menu
505
2.3K
828
21.8K
Deadlock Wiki
Toggle preferences menu
Toggle personal menu
Not logged in
Your IP address will be publicly visible if you make any edits.

Module:Abilities/details table: Difference between revisions

From Deadlock Wiki
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'
local upgrade = ability.Upgrades[tonumber(upgrade_num)]
for i, upgrade in pairs(ability.Upgrades) do
for key, value in pairs(upgrade) do
local data_rows = ''
if key ~= 'DescKey' then
local scale_type = upgrade.Scale and upgrade.Scale.Type or nil
-- track number of attributes so we can assign the correct rowspan for the upgrade cost column
local scale_value = upgrade.Scale and upgrade.Scale.Value or nil
local num_of_attrs = 0
rows = rows .. create_row(key, value, scale_type, scale_value, frame, true)
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