Module:HeroData: Difference between revisionsGive feedback
m hero comparison; stats colored by category |
m exclude stats that are always 0 |
||
| Line 357: | Line 357: | ||
local row_str = "" | local row_str = "" | ||
local body_str = "" | local body_str = "" | ||
-- Exclude some specific stats which are currently constant for all heroes at a negligible value | |||
local stats_to_exclude = { | |||
BaseWeaponDamageIncrease = true, | |||
FireRate = true, | |||
ClipSizeIncrease = true, | |||
ReloadSpeed = true, | |||
BulletSpeedIncrease = true, | |||
BulletLifesteal = true, | |||
BulletShieldHealth = true, | |||
TechShieldHealth = true, | |||
HealingOutput = true, | |||
DebuffResist = true, | |||
CritDamageReceivedScale = true, | |||
StaminaRegenIncrease = true, | |||
TechCooldown = true, | |||
TechDuration = true, | |||
TechRange = true, | |||
TechLifesteal = true, | |||
MaxChargesIncrease = true, | |||
TechCooldownBetweenChargeUses = true | |||
} | |||
-- Iterate heroes | -- Iterate heroes | ||
| Line 376: | Line 398: | ||
-- Iterate attributes within the category | -- Iterate attributes within the category | ||
for _, attr_key in ipairs(attribute_orders[category]["attribute_order"]) do | for _, attr_key in ipairs(attribute_orders[category]["attribute_order"]) do | ||
attr_data = category_attrs[attr_key] | if (stats_to_exclude[attr_key] == nil) then | ||
attr_data = category_attrs[attr_key] | |||
--Retrieve the stats value from hero data | |||
stat_value = hero_data[attr_key] | |||
if (stat_value == nil) then stat_value = 0 end | |||
-- Round it | |||
stat_value = util_module.round_to_sig_fig(stat_value, 3) | |||
-- Add it to the row | |||
row_str = row_str .. "<td>" .. stat_value .. "</td>" | |||
end | |||
end | end | ||
end | end | ||
| Line 409: | Line 433: | ||
-- Iterate attributes within the category | -- Iterate attributes within the category | ||
for _, attr_key in ipairs(attribute_orders[category]["attribute_order"]) do | for _, attr_key in ipairs(attribute_orders[category]["attribute_order"]) do | ||
attr_data = category_attrs[attr_key] | if (stats_to_exclude[attr_key] == nil) then | ||
attr_data = category_attrs[attr_key] | |||
-- Localize, fallback to attr_key | |||
attr_localized = lang_module._get_string(attr_data["label"]) | |||
if (attr_localized == nil) then attr_localized = attr_key end | |||
header_style = ' style="background-color: ' .. "rgb(" .. category_rgb .. ') ;"' | |||
headers_str = headers_str .. "<th" .. header_style .. ">" .. attr_localized .. "</th>" | |||
end | |||
end | end | ||
end | end | ||