Module:Abilities/details table: Difference between revisions

Initial get_details_table function
added alt and other props
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'}


p.get_details_table = function(frame)
p.get_details_table = function(frame)
Line 28: Line 30:
if alt ~= nil then
if alt ~= nil then
for i, prop in pairs(alt) do
for i, prop in pairs(alt) do
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
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
-- then any header data, cooldowns, charges, range etc.
for i, attr in pairs(header_attrs) do
local prop = ability[attr]
if prop then
local scale_type = prop.Scale and prop.Scale.Type or nil
local scale_value = prop.Scale and prop.Scale.Value or nil
rows = rows .. create_row(attr, prop.Value, scale_type, scale_value)
end
end
end
end
-- then any header data, cooldowns, charges, range etc.
-- then other data that is hidden on the ability card
-- then other data that is hidden on the ability card
if ability.Other then
for i, prop in pairs(ability.Other) do
local scale_type = prop.Scale and prop.Scale.Type 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)
end
end
return rows
return rows
end
end