Module:HeroData: Difference between revisions

Sur (talk | contribs)
m display error msg if attribute order is incorrect
Sur (talk | contribs)
m fixed postfixes for hero comparison table cols that are not valve-translated
Line 449: Line 449:
             "ReloadTime",
             "ReloadTime",
             "ReloadDelay",
             "ReloadDelay",
             "BulletSpeed",
             "BulletsPerShot",
            "BulletsPerBurst",
            "BurstInterShotInterval",
             "LightMeleeDamage",
             "LightMeleeDamage",
             "HeavyMeleeDamage",
             "HeavyMeleeDamage",
            "BulletsPerShot",
             "ReloadSingle",
             "ReloadSingle",
            "BulletSpeed",
             "BulletGravityScale",
             "BulletGravityScale",
             "FalloffStartRange",
             "FalloffStartRange",
Line 565: Line 567:
local category_data = attribute_module.get_category_data()
local category_data = attribute_module.get_category_data()
local postfix
local postfix
-- Used for keys that are not localized by Valve
local postfix_key_map = {
["ReloadDelay"] = "StatDesc_ReloadTime_postfix",
["BulletsPerShot"] = "",
["BulletsPerBurst"] = "",
["BurstInterShotInterval"] = "StatDesc_ReloadTime_postfix",
["ReloadSingle"] = "",
["BonusAttackRange"] = "StatDesc_WeaponRangeFalloffMax_postfix",
["SustainedDPS"] = "DPS_postfix"
}
-- Iterate stats again for displaying headers with their respective color
-- Iterate stats again for displaying headers with their respective color
Line 588: Line 600:
postfix = " (" .. postfix .. ")"
postfix = " (" .. postfix .. ")"
end
end
else -- If not in attributes data, use key with proper spacing
else -- If not in attributes data, use dictionary translate and postfix
attr_localized = dictionary_module.translate(attr_key)
attr_localized = dictionary_module.translate(attr_key)
postfix = lang_module.get_string(postfix_key_map[attr_key])
if postfix == nil then
return "attr_key " .. attr_key .. " must be added to postfix_key_map"
end
if postfix ~= "" then
postfix = " (" .. postfix .. ")"
end
end
end