Editing Module:Abilities/details tableGive feedback
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 2: | Line 2: | ||
local utils = require "Module:Abilities/utils" | local utils = require "Module:Abilities/utils" | ||
local header_attrs = {'Radius', 'AbilityCastRange', 'AbilityDuration', 'AbilityCooldown', 'AbilityCooldownBetweenCharge', 'AbilityCharges'} | local header_attrs = {'Radius', 'AbilityCastRange', 'AbilityDuration', 'AbilityCooldown', 'AbilityCooldownBetweenCharge', 'AbilityCharges'} | ||
| Line 10: | Line 8: | ||
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(hero_name, ability_num) | |||
local ability = utils.get_ability_card_data( | |||
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 26: | Line 23: | ||
local scale_value = prop.Scale and prop.Scale.Value or nil | local scale_value = prop.Scale and prop.Scale.Value or nil | ||
local scale_type = prop.Scale and prop.Scale.Type or nil | local scale_type = prop.Scale and prop.Scale.Type or nil | ||
rows = rows .. create_row(prop.Key, prop.Value, scale_type, scale_value | rows = rows .. create_row(prop.Key, prop.Value, scale_type, scale_value) | ||
end | end | ||
end | end | ||
| Line 35: | Line 32: | ||
local scale_type = prop.Scale and prop.Scale.Type or nil | local scale_type = prop.Scale and prop.Scale.Type or nil | ||
local scale_value = prop.Scale and prop.Scale.Value or nil | local scale_value = prop.Scale and prop.Scale.Value or nil | ||
rows = rows .. create_row(prop.Key, prop.Value, scale_type, scale_value | rows = rows .. create_row(prop.Key, prop.Value, scale_type, scale_value) | ||
end | end | ||
end | end | ||
| Line 46: | Line 43: | ||
local scale_type = prop.Scale and prop.Scale.Type or nil | local scale_type = prop.Scale and prop.Scale.Type or nil | ||
local scale_value = prop.Scale and prop.Scale.Value or nil | local scale_value = prop.Scale and prop.Scale.Value or nil | ||
rows = rows .. create_row(attr, prop.Value, scale_type, scale_value | rows = rows .. create_row(attr, prop.Value, scale_type, scale_value) | ||
end | end | ||
end | end | ||
| Line 55: | Line 52: | ||
local scale_type = prop.Scale and prop.Scale.Type or nil | local scale_type = prop.Scale and prop.Scale.Type or nil | ||
local scale_value = prop.Scale and prop.Scale.Value or nil | local scale_value = prop.Scale and prop.Scale.Value or nil | ||
rows = rows .. create_row(attr, prop.Value, scale_type, scale_value | rows = rows .. create_row(attr, prop.Value, scale_type, scale_value) | ||
end | end | ||
end | end | ||
| Line 62: | Line 59: | ||
end | end | ||
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 68: | Line 64: | ||
local upgrade_num = frame.args[3] | local upgrade_num = frame.args[3] | ||
local ability = utils.get_ability_card_data(hero_name, ability_num) | |||
local ability = utils.get_ability_card_data( | |||
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 = '' | ||
local upgrade = ability.Upgrades[tonumber(upgrade_num)] | |||
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 | |||
rows = rows .. create_row(key, value, scale_type, scale_value) | |||
end | end | ||
end | end | ||
| Line 94: | Line 81: | ||
end | end | ||
function create_row(key, value, scale_type, scale_value) | |||
function create_row(key, value, scale_type, scale_value | |||
if key == nil or value == nil then | if key == nil or value == nil then | ||
return '' | return '' | ||
end | end | ||
local row = '|' .. key .. '||' .. value | |||
local row = '|' .. | |||
if scale_type and scale_value then | if scale_type and scale_value then | ||
row = row .. '||' .. scale_type .. '||' .. scale_value | row = row .. '||' .. scale_type .. '||' .. scale_value | ||
end | end | ||
return | return '\n|-\n'..row | ||
end | end | ||