Module:Sandbox/LVL: Difference between revisions

Jump to navigation Jump to search
LVL (talk | contribs)
No edit summary
LVL (talk | contribs)
No edit summary
Line 493: Line 493:
)
)
-- Build data attributes for JavaScript manipulation
-- At the point where you build data_attrs for DPS/SustainedDPS cells
local hit_once = "false"
if (attr_key == 'DPS' or attr_key == 'SustainedDPS') and hero_data.Weapon and hero_data.Weapon.HitOnceAcrossAllBullets then
    hit_once = "true"
end
local data_attrs = string.format(
local data_attrs = string.format(
    'data-stat-name="%s" data-base="%s" data-spirit-scale="%s" data-level-scale="%s" data-innate-spirit-scale="%s" data-sort-value="%s"',
    'data-stat-name="%s" data-base="%s" data-spirit-scale="%s" data-level-scale="%s" data-innate-spirit-scale="%s" data-sort-value="%s" data-hit-once="%s"',
    attr_key,
    attr_key,
    tostring(type(base_value) == "number" and util_module.round_to_sig_fig(base_value, 3) or base_value),
    tostring(type(base_value) == "number" and util_module.round_to_sig_fig(base_value, 3) or base_value),
    tonumber(spirit_scale) or 0,
    tonumber(spirit_scale) or 0,
    (attr_key == "TechPower") and "0" or (tonumber(level_scale) or 0), -- Keep this TechPower check to prevent double-scaling
    (attr_key == "TechPower") and "0" or (tonumber(level_scale) or 0),
    innate_spirit_scale or 0,
    innate_spirit_scale or 0,
    stat_value  
    stat_value,
    hit_once
)
)