Module:Abilities/details table: Difference between revisions

Jump to navigation Jump to search
added localization
Added value formatting
Line 25: Line 25:
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, frame)  
end
end
end
end
Line 34: Line 34:
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, frame)
end
end
end
end
Line 45: Line 45:
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, frame)
end
end
end
end
Line 54: Line 54:
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, frame)
end
end
end
end
Line 76: Line 76:
local scale_type = upgrade.Scale and upgrade.Scale.Type or nil
local scale_type = upgrade.Scale and upgrade.Scale.Type or nil
local scale_value = upgrade.Scale and upgrade.Scale.Value or nil
local scale_value = upgrade.Scale and upgrade.Scale.Value or nil
rows = rows .. create_row(key, value, scale_type, scale_value)
rows = rows .. create_row(key, value, scale_type, scale_value, frame)
end
end
end
end
Line 83: Line 83:
end
end


function create_row(key, value, scale_type, scale_value)
function create_row(key, value, scale_type, scale_value, frame)
if key == nil or value == nil then
if key == nil or value == nil then
return ''
return ''
end
end
local label = lang._get_string(key)
local label = lang._get_string(key..'_label')
if label == nil then
if label == nil then
label = commonutils.add_space_before_cap(key)
label = commonutils.add_space_before_cap(key)
end
end
local row = '|' .. label .. '||' .. value
local formatted_value = utils.format_value_with_prepost(key, value, frame)
local row = '|' .. label .. '||' .. formatted_value
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*100 .. '%'
end
end