Module:HeroData: Difference between revisionsGive feedback
m write_hero_comparison_table complete, now uses level/spirit scaling params |
m finally a functioning version of all stats added |
||
| Line 3: | Line 3: | ||
local attributes_data = mw.loadJsonData("Data:AttributeData.json") | local attributes_data = mw.loadJsonData("Data:AttributeData.json") | ||
local attribute_orders = mw.loadJsonData("Data:StatInfoboxOrder.json") | local attribute_orders = mw.loadJsonData("Data:StatInfoboxOrder.json") | ||
local hero_comp_stats = mw.loadJsonData("Data:HeroStatConstants.json") | |||
local util_module = require('Module:Utilities') | local util_module = require('Module:Utilities') | ||
local lang_module = require('Module:Lang') | local lang_module = require('Module:Lang') | ||
| Line 383: | Line 384: | ||
local scalar_str | local scalar_str | ||
-- | -- Add hero comp stats to | ||
local stats_to_include = { | |||
local | Weapon = { | ||
BaseWeaponDamageIncrease | "DPS", | ||
"SustainedDPS", | |||
"BulletDamage", | |||
"BaseWeaponDamageIncrease", | |||
"RoundsPerSecond", | |||
"FireRate", | |||
"ClipSize", | |||
"ClipSizeIncrease", | |||
"ReloadTime", | |||
"ReloadDelay", | |||
"ReloadSpeed", | |||
"BulletSpeed", | |||
"BulletSpeedIncrease", | |||
"BulletLifesteal", | |||
"LightMeleeDamage", | |||
"HeavyMeleeDamage", | |||
"BulletsPerShot", | |||
"ReloadSingle", | |||
"BulletGravityScale", | |||
"FalloffStartRange", | |||
"FalloffEndRange" | |||
}, | |||
Vitality = { | |||
"MaxHealth", | |||
"BaseHealthRegen", | |||
"BulletArmorDamageReduction", | |||
"TechArmorDamageReduction", | |||
"BulletShieldHealth", | |||
"TechShieldHealth", | |||
"HealingOutput", | |||
"DebuffResist", | |||
"CritDamageReceivedScale", | |||
"MaxMoveSpeed", | |||
"SprintSpeed", | |||
"StaminaCooldown", | |||
"StaminaRegenIncrease", | |||
"Stamina" | |||
} | |||
} | } | ||
| Line 437: | Line 458: | ||
-- Iterate attributes within the category | -- Iterate attributes within the category | ||
for _, attr_key in ipairs( | if (stats_to_include[category] ~= nil) then | ||
for _, attr_key in ipairs(stats_to_include[category]) do | |||
--Retrieve the stats value from hero data | --Retrieve the stats value from hero data | ||
stat_value = hero_data[attr_key] | stat_value = hero_data[attr_key] | ||
| Line 457: | Line 478: | ||
end | end | ||
-- | -- Convert from boolean to string, or round it | ||
stat_value = util_module.round_to_sig_fig(stat_value, 3) | if (type(stat_value)) == 'boolean' then | ||
stat_value = tostring(stat_value) | |||
else | |||
stat_value = util_module.round_to_sig_fig(stat_value, 3) | |||
end | |||
-- Add it to the row | -- Add it to the row | ||
| Line 486: | Line 511: | ||
-- Iterate attributes within the category | -- Iterate attributes within the category | ||
for _, attr_key in ipairs( | if (stats_to_include[category] ~= nil) then | ||
for _, attr_key in ipairs(stats_to_include[category]) do | |||
attr_data = category_attrs[attr_key] | attr_data = category_attrs[attr_key] | ||
-- Localize, fallback to attr_key | -- If not in attributes data, use key as localized | ||
if (attr_data ~= nil) then | |||
-- Localize, fallback to attr_key | |||
attr_localized = lang_module._get_string(attr_data["label"]) | |||
if (attr_localized == nil) then attr_localized = attr_key end | |||
else | |||
attr_localized = attr_key | |||
end | |||
header_style = ' style="background-color: ' .. "rgb(" .. category_rgb .. ') ;"' | header_style = ' style="background-color: ' .. "rgb(" .. category_rgb .. ') ;"' | ||