Module:HeroData: Difference between revisionsGive feedback
Jump to navigation
Jump to search
m comments for get_hero_scalar_str |
m scalings added |
||
| Line 89: | Line 89: | ||
-- Retrieve scaling string of a hero's given stat, if it has scaling, else return blank | -- Retrieve scaling string of a hero's given stat, if it has scaling, else return blank | ||
-- Scaling string meaning the expanded template {{Ss|scalar}} or {{Ls|scalar}} | -- Scaling string meaning the expanded template {{Ss|scalar}} or {{Ls|scalar}} | ||
function p.get_hero_scalar_str( | function p.get_hero_scalar_str(hero_data, hero_stat_key) | ||
local scaling_type_full | local scaling_type_full | ||
local scaling_data | local scaling_data | ||
| Line 98: | Line 98: | ||
for index, scaling_type in ipairs(scaling_types) do | for index, scaling_type in ipairs(scaling_types) do | ||
scaling_type_full = scaling_type .. "Scaling" | scaling_type_full = scaling_type .. "Scaling" | ||
scaling_data = | scaling_data = hero_data[scaling_type_full] | ||
--If the scaling data exists | --If the scaling data exists | ||
| Line 324: | Line 324: | ||
-- Add the scaling str if it scales | -- Add the scaling str if it scales | ||
local scalar_str = p.get_hero_scalar_str(hero_data, stat_name) | local scalar_str = p.get_hero_scalar_str(hero_data, stat_name) | ||
if (scalar_str ~= "") then scalar_str = " " .. scalar_str end | |||
-- Set cell value as "Icon StatvaluePostfix Statname Scaling," | -- Set cell value as "Icon StatvaluePostfix Statname Scaling," | ||
-- If icon file already exists, set it to #REDIRECT to the duplicate file page | -- If icon file already exists, set it to #REDIRECT to the duplicate file page | ||
cell_value = image_file .. " " .. stat_value .. postfix .. " " .. label | cell_value = image_file .. " " .. stat_value .. postfix .. " " .. label .. scalar_str .. "," .. extra_blank_cell | ||
cell_values = cell_values .. cell_value --add value to values list | cell_values = cell_values .. cell_value --add value to values list | ||
| Line 362: | Line 363: | ||
local hero_icon | local hero_icon | ||
local hero_td_style | local hero_td_style | ||
local scalar_str | |||
-- Exclude some specific stats which are currently constant for all heroes at a negligible value | -- Exclude some specific stats which are currently constant for all heroes at a negligible value | ||
| Line 428: | Line 430: | ||
-- Round it | -- Round it | ||
stat_value = util_module.round_to_sig_fig(stat_value, 3) | stat_value = util_module.round_to_sig_fig(stat_value, 3) | ||
-- Retrieve scaling str if it scales | |||
scalar_str = p.get_hero_scalar_str(hero_data, attr_key) | |||
if (scalar_str ~= "") then scalar_str = " " .. scalar_str end | |||
-- Add it to the row | -- Add it to the row | ||
row_str = row_str .. "<td>" .. stat_value .. "</td>" | row_str = row_str .. "<td>" .. stat_value .. scalar_str .. "</td>" | ||
end | end | ||
end | end | ||