Module:Sandbox/LVL: Difference between revisionsGive feedback
Jump to navigation
Jump to search
No edit summary |
reload time, spirit first |
||
| Line 178: | Line 178: | ||
local base_value | local base_value | ||
if is_alt_fire then | if is_alt_fire then | ||
if attr_key == "ClipSize" then | if attr_key == "ClipSize" or attr_key == "ReloadTime" then | ||
base_value = get_nested_stat_value(hero_data, attr_key) | |||
elseif hero_data.Weapon and hero_data.Weapon.AltFire | elseif hero_data.Weapon and hero_data.Weapon.AltFire | ||
and hero_data.Weapon.AltFire[attr_key] ~= nil then | and hero_data.Weapon.AltFire[attr_key] ~= nil then | ||
| Line 195: | Line 195: | ||
local scaling_data | local scaling_data | ||
if is_alt_fire then | if is_alt_fire then | ||
if attr_key == "ClipSize" then | if attr_key == "ClipSize" or attr_key == "ReloadTime" then | ||
scaling_data = hero_data_module.get_hero_scaling_data(hero_data, attr_key) | |||
elseif hero_key == "hero_shiv" and attr_key == "BulletDamage" then | elseif hero_key == "hero_shiv" and attr_key == "BulletDamage" then | ||
scaling_data = hero_data_module.get_hero_scaling_data(hero_data, attr_key) | scaling_data = hero_data_module.get_hero_scaling_data(hero_data, attr_key) | ||
| Line 256: | Line 256: | ||
local spirit_scale = 0 | local spirit_scale = 0 | ||
local level_scale = 0 | local level_scale = 0 | ||
local spirit_val = 0 | |||
local level_val = 0 | |||
if scaling_data ~= nil then | if scaling_data ~= nil then | ||
-- Find the scaling values for each type | |||
for scaling_val, scaling_type in pairs(scaling_data) do | for scaling_val, scaling_type in pairs(scaling_data) do | ||
if scaling_type == "Spirit" then | |||
spirit_val = scaling_val | |||
elseif scaling_type == "Level" then | |||
level_val = scaling_val | |||
end | end | ||
end | |||
if | -- Build strings: Spirit first, then Level | ||
local function append_scaling(val, stype) | |||
if val ~= 0 then | |||
local scaling_str = hero_data_module.write_scalar_str(val, stype, true) | |||
if scaling_str ~= "" then | |||
scaling_strs = scaling_strs .. " " .. scaling_str | |||
end | |||
end | end | ||
end | end | ||
append_scaling(spirit_val, "Spirit") | |||
append_scaling(level_val, "Level") | |||
-- Update the stat value for display | |||
stat_value = stat_value + (spirit_power * spirit_val) | |||
stat_value = stat_value + (power_increases * level_val) | |||
spirit_scale = spirit_val | |||
level_scale = level_val | |||
end | end | ||
| Line 333: | Line 347: | ||
hero_cell_content = '[[#alt-fire-' .. hero_key .. '|+]] ' .. hero_cell_content | hero_cell_content = '[[#alt-fire-' .. hero_key .. '|+]] ' .. hero_cell_content | ||
end | end | ||
row_str = row_str .. '<td style="position: sticky; left: 0; z-index: 9; background-color: #202122; isolation: isolate; overflow: hidden; min-width: 150px;">' .. hero_cell_content .. '</td>' | local sort_name = (hero_data["Name"] or hero_key):gsub("^The ", "") row_str = row_str .. '<td style="position: sticky; left: 0; z-index: 9; background-color: #202122; isolation: isolate; overflow: hidden; min-width: 150px;" data-sort-value="' .. sort_name .. '">' .. hero_cell_content .. '</td>' | ||
for _, category in ipairs(attribute_orders["category_order"]) do | for _, category in ipairs(attribute_orders["category_order"]) do | ||
if stats_to_include[category] ~= nil then | if stats_to_include[category] ~= nil then | ||
| Line 352: | Line 366: | ||
local hero_icon = mw.getCurrentFrame():expandTemplate{ title = "Template:HeroIcon", args = template_args } | local hero_icon = mw.getCurrentFrame():expandTemplate{ title = "Template:HeroIcon", args = template_args } | ||
local hero_cell_content = hero_icon .. ' <small style="color:#aaa;">(Alt‑fire)</small>' | local hero_cell_content = hero_icon .. ' <small style="color:#aaa;">(Alt‑fire)</small>' | ||
row_str = row_str .. '<td style="position: sticky; left: 0; z-index: 10; background-color: #202122; isolation: isolate; overflow: hidden; min-width: 150px;">' .. hero_cell_content .. '</td>' | local sort_name = (hero_data["Name"] or hero_key):gsub("^The ", "") row_str = row_str .. '<td style="position: sticky; left: 0; z-index: 10; background-color: #202122; isolation: isolate; overflow: hidden; min-width: 150px;" data-sort-value="' .. sort_name .. '">' .. hero_cell_content .. '</td>' | ||
for _, category in ipairs(attribute_orders["category_order"]) do | for _, category in ipairs(attribute_orders["category_order"]) do | ||
if stats_to_include[category] ~= nil then | if stats_to_include[category] ~= nil then | ||