Editing Module:HeroDataArraysGive feedback
Jump to navigation
Jump to search
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then publish the changes below to finish undoing the edit.
| Latest revision | Your text | ||
| Line 14: | Line 14: | ||
end | end | ||
end | end | ||
end | end | ||
| Line 35: | Line 22: | ||
end | end | ||
return value | return value | ||
end | end | ||
| Line 163: | Line 64: | ||
table.insert(rows, { | table.insert(rows, { | ||
name = name, | name = name, | ||
maxHealth = data["MaxHealth"] or 0, | maxHealth = tonumber(data["MaxHealth"]) or 0, | ||
scalingHealth = | scalingHealth = tonumber(data["LevelScaling>MaxHealth"]) or 0 | ||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local | -- Input table will be called a, output wikitable will be called z | ||
local z = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ Hero Base Health Stats \n".. | |||
"! Hero !! Starting !! Added per Boon !! At Max Boon \n" | |||
{ | -- Iterate over heroes adding a new row to the wikitable for each | ||
for _, r in ipairs(rows) do | |||
z = z.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
" || "..r.maxHealth.." || +"..r.scalingHealth.." || ".. | |||
tostring(roundValue(r.maxHealth + r.scalingHealth * soul_unlock.get_max('PowerIncrease'))).." \n" | |||
end | |||
z = z.."|}" | |||
return z | |||
return | |||
end | end | ||
p.heroRegenTable = function(frame) | p.heroRegenTable = function(frame) | ||
local heroRegenData = heroDataArray({"Name", " | local heroRegenData = heroDataArray({"Name", "BaseHealthRegen"}) | ||
local rows = {} | local rows = {} | ||
| Line 199: | Line 96: | ||
table.insert(rows, { | table.insert(rows, { | ||
name = name, | name = name, | ||
baseHealthRegen = data["BaseHealthRegen"] or 0 | baseHealthRegen = data["BaseHealthRegen"] or 0 | ||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local | local z = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | ||
"|+ Hero Base Health Regen \n".. | |||
"! Hero !! HP/s \n" | |||
for _, r in ipairs(rows) do | |||
for _, | z = z.. | ||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
" || "..r.baseHealthRegen.." \n" | |||
end | end | ||
z = z.."|}" | |||
return z | |||
end | end | ||
| Line 248: | Line 138: | ||
altBulletsPerShot = data["Weapon>AltFire>BulletsPerShot"] or 0 | altBulletsPerShot = data["Weapon>AltFire>BulletsPerShot"] or 0 | ||
}) | }) | ||
end | |||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local z = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ Hero Base Damage \n".. | |||
"! Hero !! Damage per sec !! Reload Delay (s) !! Reload Time (s) !! Ammo !! Bullets per sec !! Bullet Damage !! Bullets Per Shot \n" | |||
for _, r in ipairs(rows) do | |||
z = z.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
" || "..r.DPS.." || "..r.reloadDelay.." || "..r.reloadTime.." || "..r.clipSize.. | |||
" || "..r.roundsPerSecond.." || "..r.bulletDamage.." || "..r.bulletsPerShot.." \n" | |||
end | end | ||
z = z.."|}" | |||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local tableDefs = { | local tableDefs = { | ||
{ | { | ||
title = "Base Damage | title = "Hero Base Alt-Fire Damage", | ||
columns = { | columns = { | ||
{ label = "Damage per sec", field = " | { label = "Damage per sec", field = "altDPS" }, | ||
{ label = "Ammo Per Shot", field = "altAmmoConsumedPerShot" }, | |||
{ label = "Bullets per sec", field = "altRoundsPerSecond" }, | |||
{ label = "Ammo", field = " | { label = "Bullet Damage", field = "altBulletDamage" }, | ||
{ label = "Bullets per sec", field = " | { label = "Bullets Per Shot", field = "altBulletsPerShot" }, | ||
{ label = "Bullet Damage", field = " | |||
{ label = "Bullets Per Shot", field = " | |||
} | } | ||
} | } | ||
} | } | ||
local output = | local output = "" | ||
for _, | |||
local | for _, tableDef in ipairs(tableDefs) do | ||
local filteredRows = {} | |||
table.insert( | for _, r in ipairs(rows) do | ||
local hasValue = false | |||
for _, col in ipairs(tableDef.columns) do | |||
if r[col.field] ~= 0 then | |||
hasValue = true | |||
break | |||
end | |||
end | |||
if hasValue then | |||
table.insert(filteredRows, r) | |||
end | |||
end | |||
if #filteredRows > 0 then | |||
local header = "" | |||
for _, col in ipairs(tableDef.columns) do | |||
header = header.." !! "..col.label | |||
end | |||
local t = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ "..tableDef.title.." \n".. | |||
"! Hero"..header.." \n" | |||
for _, r in ipairs(filteredRows) do | |||
local cells = "" | |||
for _, col in ipairs(tableDef.columns) do | |||
cells = cells.." || "..r[col.field] | |||
end | |||
t = t.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
cells.." \n" | |||
end | |||
t = t.."|}" | |||
if output ~= "" then | |||
output = output.."\n\n" | |||
end | |||
output = output..t | |||
end | end | ||
end | end | ||
return | return z .. "\n\n" .. output | ||
end | end | ||
p.heroBulletSpeedTable = function(frame) | p.heroBulletSpeedTable = function(frame) | ||
local heroBulletSpeedData = heroDataArray({ | local heroBulletSpeedData = heroDataArray({"Name", "Weapon>BulletSpeed", "Weapon>AltFire>BulletSpeed"}) | ||
local rows = {} | local rows = {} | ||
for name, data in pairs(heroBulletSpeedData) do | for name, data in pairs(heroBulletSpeedData) do | ||
| Line 310: | Line 230: | ||
altBulletSpeed = data["Weapon>AltFire>BulletSpeed"] or 0 | altBulletSpeed = data["Weapon>AltFire>BulletSpeed"] or 0 | ||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local z = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ Base Bullet Velocity \n".. | |||
"! Hero !! m/s \n" | |||
for _, r in ipairs(rows) do | |||
z = z.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
" || "..r.bulletSpeed.." \n" | |||
end | |||
z = z.."|}" | |||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local tableDefs = { | local tableDefs = { | ||
{ | |||
title = "Base Bullet Velocity", | title = "Base Alt-Fire Bullet Velocity", | ||
columns = { | columns = { | ||
{ label = "m/s", field = " | { label = "m/s", field = "altBulletSpeed" }, | ||
} | } | ||
} | } | ||
} | } | ||
local output = | local output = "" | ||
for _, | |||
local | for _, tableDef in ipairs(tableDefs) do | ||
local filteredRows = {} | |||
table.insert( | for _, r in ipairs(rows) do | ||
local hasValue = false | |||
for _, col in ipairs(tableDef.columns) do | |||
if r[col.field] ~= 0 then | |||
hasValue = true | |||
break | |||
end | |||
end | |||
if hasValue then | |||
table.insert(filteredRows, r) | |||
end | |||
end | |||
if #filteredRows > 0 then | |||
local header = "" | |||
for _, col in ipairs(tableDef.columns) do | |||
header = header.." !! "..col.label | |||
end | |||
local t = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ "..tableDef.title.." \n".. | |||
"! Hero"..header.." \n" | |||
for _, r in ipairs(filteredRows) do | |||
local cells = "" | |||
for _, col in ipairs(tableDef.columns) do | |||
cells = cells.." || "..r[col.field] | |||
end | |||
t = t.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
cells.." \n" | |||
end | |||
t = t.."|}" | |||
if output ~= "" then | |||
output = output.."\n\n" | |||
end | |||
output = output..t | |||
end | end | ||
end | end | ||
return | return z .. "\n\n" .. output | ||
end | end | ||
p.heroClipSizeTable = function(frame) | p.heroClipSizeTable = function(frame) | ||
local heroClipSizeData = heroDataArray({"Name", "Weapon>ClipSize | local heroClipSizeData = heroDataArray({"Name", "Weapon>ClipSize","Weapon>AltFire>AmmoConsumedPerShot"}) | ||
local rows = {} | local rows = {} | ||
| Line 352: | Line 314: | ||
name = name, | name = name, | ||
clipSize = data["Weapon>ClipSize"] or 0, | clipSize = data["Weapon>ClipSize"] or 0, | ||
ammoConsumedPerShot = data["Weapon>AltFire>AmmoConsumedPerShot"] or 0 | ammoConsumedPerShot = data["Weapon>AltFire>AmmoConsumedPerShot"] or 0 | ||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local z = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ Base Ammo Count \n".. | |||
"! Hero !! Ammo \n" | |||
for _, r in ipairs(rows) do | |||
z = z.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
" || "..r.clipSize.." \n" | |||
end | |||
z = z.."|}" | |||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local tableDefs = { | local tableDefs = { | ||
{ | { | ||
title = " | title = "Alt-Fire Ammo Cost", | ||
columns = { | columns = { | ||
{ label = "Ammo Per Shot", field = "ammoConsumedPerShot" }, | |||
{ label = "Ammo Per Shot", field = " | |||
} | } | ||
} | } | ||
} | } | ||
local output = | local output = "" | ||
for _, | |||
local | for _, tableDef in ipairs(tableDefs) do | ||
local filteredRows = {} | |||
table.insert( | for _, r in ipairs(rows) do | ||
local hasValue = false | |||
for _, col in ipairs(tableDef.columns) do | |||
if r[col.field] ~= 0 then | |||
hasValue = true | |||
break | |||
end | |||
end | |||
if hasValue then | |||
table.insert(filteredRows, r) | |||
end | |||
end | |||
if #filteredRows > 0 then | |||
local header = "" | |||
for _, col in ipairs(tableDef.columns) do | |||
header = header.." !! "..col.label | |||
end | |||
local t = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ "..tableDef.title.." \n".. | |||
"! Hero"..header.." \n" | |||
for _, r in ipairs(filteredRows) do | |||
local cells = "" | |||
for _, col in ipairs(tableDef.columns) do | |||
cells = cells.." || "..r[col.field] | |||
end | |||
t = t.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
cells.." \n" | |||
end | |||
t = t.."|}" | |||
if output ~= "" then | |||
output = output.."\n\n" | |||
end | |||
output = output..t | |||
end | end | ||
end | end | ||
return | return z .. "\n\n" .. output | ||
end | end | ||
p.heroRoundsPerSecondTable = function(frame) | p.heroRoundsPerSecondTable = function(frame) | ||
local heroRoundsPerSecondData = heroDataArray({"Name", "Weapon>RoundsPerSecond", "Weapon>AltFire>RoundsPerSecond | local heroRoundsPerSecondData = heroDataArray({"Name", "Weapon>RoundsPerSecond", "Weapon>AltFire>RoundsPerSecond"}) | ||
local rows = {} | local rows = {} | ||
| Line 403: | Line 401: | ||
name = name, | name = name, | ||
roundsPerSecond = data["Weapon>RoundsPerSecond"] or 0, | roundsPerSecond = data["Weapon>RoundsPerSecond"] or 0, | ||
altRoundsPerSecond = data["Weapon>AltFire>RoundsPerSecond"] or 0 | altRoundsPerSecond = data["Weapon>AltFire>RoundsPerSecond"] or 0 | ||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local z = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ Base Fire Rate \n".. | |||
"! Hero !! Rounds/s \n" | |||
for _, r in ipairs(rows) do | |||
z = z.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
" || "..r.roundsPerSecond.." \n" | |||
end | |||
z = z.."|}" | |||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local tableDefs = { | local tableDefs = { | ||
{ | { | ||
title = "Base Fire Rate", | title = "Base Alt-Fire Fire Rate", | ||
columns = { | columns = { | ||
{ label = "Rounds/s", field = " | { label = "Rounds/s", field = "altRoundsPerSecond" }, | ||
} | } | ||
} | } | ||
} | } | ||
local output = | local output = "" | ||
for _, | |||
local | for _, tableDef in ipairs(tableDefs) do | ||
local filteredRows = {} | |||
table.insert( | for _, r in ipairs(rows) do | ||
local hasValue = false | |||
for _, col in ipairs(tableDef.columns) do | |||
if r[col.field] ~= 0 then | |||
hasValue = true | |||
break | |||
end | |||
end | |||
if hasValue then | |||
table.insert(filteredRows, r) | |||
end | |||
end | |||
if #filteredRows > 0 then | |||
local header = "" | |||
for _, col in ipairs(tableDef.columns) do | |||
header = header.." !! "..col.label | |||
end | |||
local t = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ "..tableDef.title.." \n".. | |||
"! Hero"..header.." \n" | |||
for _, r in ipairs(filteredRows) do | |||
local cells = "" | |||
for _, col in ipairs(tableDef.columns) do | |||
cells = cells.." || "..r[col.field] | |||
end | |||
t = t.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
cells.." \n" | |||
end | |||
t = t.."|}" | |||
if output ~= "" then | |||
output = output.."\n\n" | |||
end | |||
output = output..t | |||
end | end | ||
end | end | ||
return | return z .. "\n\n" .. output | ||
end | end | ||
p.heroFalloffRangeTable = function(frame) | p.heroFalloffRangeTable = function(frame) | ||
local heroFalloffRangeData = heroDataArray({"Name", "Weapon>FalloffStartRange", "Weapon>FalloffEndRange", "Weapon>AltFire>FalloffStartRange", "Weapon>AltFire>FalloffEndRange", | local heroFalloffRangeData = heroDataArray({"Name", "Weapon>FalloffStartRange", "Weapon>FalloffEndRange", "Weapon>AltFire>FalloffStartRange", "Weapon>AltFire>FalloffEndRange", | ||
"Weapon>AltFire>ExplosionRadius" | "Weapon>AltFire>ExplosionRadius"}) | ||
local rows = {} | local rows = {} | ||
| Line 452: | Line 490: | ||
falloffStartRange = data["Weapon>FalloffStartRange"] or 0, | falloffStartRange = data["Weapon>FalloffStartRange"] or 0, | ||
falloffEndRange = data["Weapon>FalloffEndRange"] or 0, | falloffEndRange = data["Weapon>FalloffEndRange"] or 0, | ||
altFalloffStartRange = data["Weapon>AltFire>FalloffStartRange"] or 0, | altFalloffStartRange = data["Weapon>AltFire>FalloffStartRange"] or 0, | ||
altFalloffEndRange = data["Weapon>AltFire>FalloffEndRange"] or 0, | altFalloffEndRange = data["Weapon>AltFire>FalloffEndRange"] or 0, | ||
altExplosionRadius = | altExplosionRadius = data["Weapon>AltFire>ExplosionRadius"] or 0 | ||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local z = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ Base Falloff Range \n".. | |||
"! Hero !! Minimum Range (m) !! Maximum Range (m) \n" | |||
for _, r in ipairs(rows) do | |||
z = z.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
" || "..r.falloffStartRange.." || "..r.falloffEndRange.." \n" | |||
end | |||
z = z.."|}" | |||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local tableDefs = { | local tableDefs = { | ||
{ | { | ||
title = "Base Falloff Range", | title = "Base Alt-Fire Falloff Range", | ||
columns = { | columns = { | ||
{ label = "Minimum Range (m)", field = " | { label = "Minimum Range (m)", field = "altFalloffStartRange" }, | ||
{ label = "Maximum Range (m)", field = " | { label = "Maximum Range (m)", field = "altFalloffEndRange" }, | ||
{ label = "Explosion Radius (m)", field = "altExplosionRadius" }, | { label = "Explosion Radius (m)", field = "altExplosionRadius" }, | ||
} | } | ||
| Line 489: | Line 522: | ||
} | } | ||
local output = | local output = "" | ||
for _, | |||
local | for _, tableDef in ipairs(tableDefs) do | ||
local filteredRows = {} | |||
table.insert( | for _, r in ipairs(rows) do | ||
local hasValue = false | |||
for _, col in ipairs(tableDef.columns) do | |||
if r[col.field] ~= 0 then | |||
hasValue = true | |||
break | |||
end | |||
end | |||
if hasValue then | |||
table.insert(filteredRows, r) | |||
end | |||
end | end | ||
if #filteredRows > 0 then | |||
end | local header = "" | ||
for _, col in ipairs(tableDef.columns) do | |||
header = header.." !! "..col.label | |||
end | |||
local t = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ "..tableDef.title.." \n".. | |||
"! Hero"..header.." \n" | |||
for _, r in ipairs(filteredRows) do | |||
local cells = "" | |||
for _, col in ipairs(tableDef.columns) do | |||
cells = cells.." || "..r[col.field] | |||
end | |||
t = t.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
cells.." \n" | |||
end | |||
t = t.."|}" | |||
if output ~= "" then | |||
output = output.."\n\n" | |||
end | |||
output = output..t | |||
end | end | ||
end | end | ||
return z .. "\n\n" .. output | |||
end | end | ||
p. | p.heroBulletDamageTable = function(frame) | ||
-- Pull data | -- Pull data | ||
local | local heroBulletDamageData = heroDataArray({"Name", "Weapon>BulletDamage", "LevelScaling>BulletDamage", "Weapon>AltFire>BulletDamage", "LevelScaling>BulletDamageAltFire"}) | ||
local rows = {} | local rows = {} | ||
for name, data in pairs( | for name, data in pairs(heroBulletDamageData) do | ||
table.insert(rows, { | table.insert(rows, { | ||
name = name, | name = name, | ||
bulletDamage = tonumber(data["Weapon>BulletDamage"]) or 0, | |||
scalingDamage = tonumber(data["LevelScaling>BulletDamage"]) or 0, | |||
altBulletDamage = tonumber(data["Weapon>AltFire>BulletDamage"]) or 0, | |||
altScalingDamage = tonumber(data["LevelScaling>BulletDamageAltFire"]) or 0 | |||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local | local z = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | ||
"|+ Hero Base Bullet Damage Stats \n".. | |||
"! Hero !! Starting !! Added per Boon !! At Max Boon \n" | |||
-- Iterate over heroes adding a new row to the wikitable for each | |||
for _, r in ipairs(rows) do | |||
z = z.. | |||
"|- \n".. | |||
{ | "| style=\"text-align:left;\" | ".. | ||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
" || "..r.bulletDamage.." || +"..r.scalingDamage.." || ".. | |||
tostring(roundValue(r.bulletDamage + r.scalingDamage * soul_unlock.get_max('PowerIncrease'))).." \n" | |||
end | |||
z = z.."|}" | |||
return z | |||
return | |||
end | end | ||
| Line 611: | Line 614: | ||
table.insert(rows, { | table.insert(rows, { | ||
name = name, | name = name, | ||
lightMeleeDamage = data["LightMeleeDamage"] or 0, | lightMeleeDamage = tonumber(data["LightMeleeDamage"]) or 0, | ||
scalingDamage = | scalingDamage = tonumber(data["LevelScaling>LightMeleeDamage"]) or 0 | ||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local | local z = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | ||
"|+ Hero Base Light Melee Stats \n".. | |||
"! Hero !! Starting !! Added per Boon !! At Max Boon \n" | |||
-- Iterate over heroes adding a new row to the wikitable for each | |||
{ | for _, r in ipairs(rows) do | ||
z = z.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
" || "..r.lightMeleeDamage.." || +"..r.scalingDamage.." || ".. | |||
tostring(roundValue(r.lightMeleeDamage + r.scalingDamage * soul_unlock.get_max('PowerIncrease'))).." \n" | |||
end | |||
z = z.."|}" | |||
return z | |||
return | |||
end | end | ||
p.heroHeavyMeleeTable = function(frame) | p.heroHeavyMeleeTable = function(frame) | ||
-- Pull data | -- Pull data | ||
local heroHeavyMeleeData = heroDataArray({"Name", "HeavyMeleeDamage", "LevelScaling | local heroHeavyMeleeData = heroDataArray({"Name", "HeavyMeleeDamage", "LevelScaling>HeavyMeleeDamage"}) | ||
local rows = {} | local rows = {} | ||
| Line 648: | Line 646: | ||
table.insert(rows, { | table.insert(rows, { | ||
name = name, | name = name, | ||
heavyMeleeDamage = data["HeavyMeleeDamage"] or 0, | heavyMeleeDamage = tonumber(data["HeavyMeleeDamage"]) or 0, | ||
scalingDamage = | scalingDamage = tonumber(data["LevelScaling>HeavyMeleeDamage"]) or 0 | ||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local z = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ Hero Base Heavy Melee Stats \n".. | |||
"! Hero !! Starting !! Added per Boon !! At Max Boon \n" | |||
-- Iterate over heroes adding a new row to the wikitable for each | |||
for _, r in ipairs(rows) do | |||
z = z.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
{ | frame:expandTemplate{title="PageRef", args={r.name}}.. | ||
" || "..r.heavyMeleeDamage.." || +"..r.scalingDamage.." || ".. | |||
tostring(roundValue(r.heavyMeleeDamage + r.scalingDamage * soul_unlock.get_max('PowerIncrease'))).." \n" | |||
end | |||
z = z.."|}" | |||
return z | |||
return | |||
end | end | ||
| Line 690: | Line 681: | ||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local z = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ Hero Base Stamina Stats \n".. | |||
"! Hero !! Stamina Bars !! Cooldown (s) \n" | |||
for _, r in ipairs(rows) do | |||
z = z.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
{ | frame:expandTemplate{title="PageRef", args={r.name}}.. | ||
" || "..r.stamina.." || "..r.staminaCooldown.." \n" | |||
end | end | ||
z = z.."|}" | |||
return z | |||
end | end | ||
p.heroDashTable = function(frame) | p.heroDashTable = function(frame) | ||
local heroDashData = heroDataArray({"Name", "GroundDashSpeed | local heroDashData = heroDataArray({"Name", "GroundDashSpeed"}) | ||
local rows = {} | local rows = {} | ||
| Line 720: | Line 705: | ||
table.insert(rows, { | table.insert(rows, { | ||
name = name, | name = name, | ||
duration = tonumber(data.GroundDashSpeed) or 0 | |||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local | local z = '{| class="wikitable sortable mw-collapsible" style="text-align:center"\n' .. | ||
'|+ Hero Base Dash Speed Stats\n' .. | |||
'! Hero !! Dash Speed (m/s)\n' | |||
for _, r in ipairs(rows) do | |||
z = z .. '|-\n| style="text-align:left;" | ' .. | |||
frame:expandTemplate{title = 'PageRef', args = {r.name}} .. | |||
' || ' .. r.duration .. '\n' | |||
for _, | |||
end | end | ||
return z .. '|}' | |||
return | |||
end | end | ||
| Line 754: | Line 724: | ||
local heroReloadData = heroDataArray({"Name", "Weapon>ReloadTime"}) | local heroReloadData = heroDataArray({"Name", "Weapon>ReloadTime"}) | ||
-- 1. collect rows | |||
local rows = {} | local rows = {} | ||
for name, data in pairs(heroReloadData) do | for name, data in pairs(heroReloadData) do | ||
table.insert(rows, { | table.insert(rows, { | ||
name = name, | name = name, | ||
reloadTime = data["Weapon>ReloadTime"] or 0 | reloadTime = tonumber(data["Weapon>ReloadTime"]) or 0 | ||
}) | }) | ||
end | end | ||
-- 2. alphabetical by hero name | |||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local | -- 3. build table | ||
local z = '{| class="wikitable sortable mw-collapsible" style="text-align:center"\n' .. | |||
'|+ Hero Base Reload Time Stats\n' .. | |||
'! Hero !! Reload Time (s) \n' | |||
for _, r in ipairs(rows) do | |||
z = z .. | |||
'|-\n' .. | |||
'| style="text-align:left;" | ' .. | |||
frame:expandTemplate{title = 'PageRef', args = {r.name}} .. | |||
for _, | ' || '.. r.reloadTime ..' \n' | ||
end | end | ||
return z .. '|}' | |||
return | |||
end | end | ||
| Line 794: | Line 761: | ||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local tableDefs = { | local tableDefs = { | ||
{ | { | ||
title = "Base Reload Delay", | title = "Hero Base Reload Delay Stats", | ||
columns = { | columns = { | ||
{ label = "Reload Delay (s)", field = "reloadDelay" } | { label = "Reload Delay (s)", field = "reloadDelay" } | ||
| Line 805: | Line 772: | ||
} | } | ||
local output = | local output = "" | ||
for _, | |||
local | for _, tableDef in ipairs(tableDefs) do | ||
local filteredRows = {} | |||
table.insert( | for _, r in ipairs(rows) do | ||
local hasValue = false | |||
for _, col in ipairs(tableDef.columns) do | |||
if r[col.field] ~= 0 then | |||
hasValue = true | |||
break | |||
end | |||
end | |||
if hasValue then | |||
table.insert(filteredRows, r) | |||
end | |||
end | |||
if #filteredRows > 0 then | |||
local header = "" | |||
for _, col in ipairs(tableDef.columns) do | |||
header = header.." !! "..col.label | |||
end | |||
local t = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ "..tableDef.title.." \n".. | |||
"! Hero"..header.." \n" | |||
for _, r in ipairs(filteredRows) do | |||
local cells = "" | |||
for _, col in ipairs(tableDef.columns) do | |||
cells = cells.." || "..r[col.field] | |||
end | |||
t = t.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
cells.." \n" | |||
end | |||
t = t.."|}" | |||
if output ~= "" then | |||
output = output.."\n\n" | |||
end | |||
output = output..t | |||
end | end | ||
end | end | ||
return | return output | ||
end | end | ||
p.heroMoveSpeedTable = function(frame) | p.heroMoveSpeedTable = function(frame) | ||
local heroMoveSpeedData = heroDataArray({"Name", "MaxMoveSpeed", " | local heroMoveSpeedData = heroDataArray({"Name", "MaxMoveSpeed", "SprintSpeed"}) | ||
local rows = {} | local rows = {} | ||
| Line 823: | Line 829: | ||
table.insert(rows, { | table.insert(rows, { | ||
name = name, | name = name, | ||
moveSpeed = data["MaxMoveSpeed"] or 0, | moveSpeed = tonumber(data["MaxMoveSpeed"]) or 0, | ||
sprintSpeed = | sprintSpeed = tonumber(data["SprintSpeed"]) or 0 | ||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local | local z = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | ||
"|+ Hero Base Move Speed Stats \n".. | |||
"! Hero !! Move Speed (m/s) !! Sprint Speed (m/s) !! Total Speed (m/s) \n" | |||
for _, r in ipairs(rows) do | |||
for _, | z = z.. | ||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
" || "..r.moveSpeed.." || "..r.sprintSpeed.." || "..r.moveSpeed + r.sprintSpeed .." \n" | |||
end | end | ||
z = z.."|}" | |||
return z | |||
end | end | ||
p.heroDamageResistTable = function(frame) | p.heroDamageResistTable = function(frame) | ||
local heroDamageResistData = heroDataArray({"Name", "BulletResist", "LevelScaling>BulletResist", "TechResist", "LevelScaling>TechResist", "MeleeResist", "CritDamageReceivedPercent" | local heroDamageResistData = heroDataArray({"Name", "BulletResist", "LevelScaling>BulletResist", "TechResist", "LevelScaling>TechResist", "MeleeResist", "CritDamageReceivedPercent"}) | ||
local rows = {} | local rows = {} | ||
| Line 870: | Line 858: | ||
name = name, | name = name, | ||
bulletResist = data["BulletResist"] or 0, | bulletResist = data["BulletResist"] or 0, | ||
bulletScaling = data["LevelScaling>BulletResist"] or 0, | |||
spiritResist = data["TechResist"] or 0, | spiritResist = data["TechResist"] or 0, | ||
spiritScaling = data["LevelScaling>TechResist"] or 0, | |||
meleeResist = data["MeleeResist"] or 0, | meleeResist = data["MeleeResist"] or 0, | ||
critReduction = data["CritDamageReceivedPercent"] or 0 | critReduction = data["CritDamageReceivedPercent"] or 0 | ||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local tableDefs = { | local tableDefs = { | ||
{ | { | ||
title = "Base Bullet Resist Stats", | title = "Hero Base Bullet Resist Stats", | ||
columns = { | columns = { | ||
{ label = " | { label = "Bullet Resist (%)", field = "bulletResist" }, | ||
{ label = " | { label = "BR per Boon (%)", field = "bulletScaling" }, | ||
} | } | ||
}, | }, | ||
{ | { | ||
title = "Base Spirit Resist Stats", | title = "Hero Base Spirit Resist Stats", | ||
columns = { | columns = { | ||
{ label = " | { label = "Spirit Resist (%)", field = "spiritResist" }, | ||
{ label = " | { label = "SR per Boon (%)", field = "spiritScaling" }, | ||
} | } | ||
}, | }, | ||
{ | { | ||
title = "Base Melee Resist Stats", | title = "Hero Base Melee Resist Stats", | ||
columns = { | columns = { | ||
{ label = "Melee Resist (%)", field = "meleeResist" }, | { label = "Melee Resist (%)", field = "meleeResist" }, | ||
| Line 909: | Line 889: | ||
}, | }, | ||
{ | { | ||
title = "Base Crit Reduction Stats", | title = "Hero Base Crit Reduction Stats", | ||
columns = { | columns = { | ||
{ label = "Crit Reduction (%)", field = "critReduction" }, | { label = "Crit Reduction (%)", field = "critReduction" }, | ||
| Line 916: | Line 896: | ||
} | } | ||
local output | local output = "" | ||
for _, tableDef in ipairs(tableDefs) do | |||
local filteredRows = {} | |||
for _, r in ipairs(rows) do | |||
local hasValue = false | |||
for _, col in ipairs(tableDef.columns) do | |||
if r[col.field] ~= 0 then | |||
hasValue = true | |||
break | |||
end | |||
end | |||
if hasValue then | |||
table.insert(filteredRows, r) | |||
end | |||
table.insert( | |||
end | end | ||
if #filteredRows > 0 then | |||
end | local header = "" | ||
for _, col in ipairs(tableDef.columns) do | |||
header = header.." !! "..col.label | |||
end | |||
local t = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ "..tableDef.title.." \n".. | |||
"! Hero"..header.." \n" | |||
for _, r in ipairs(filteredRows) do | |||
local cells = "" | |||
for _, col in ipairs(tableDef.columns) do | |||
cells = cells.." || "..r[col.field] | |||
end | |||
t = t.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
cells.." \n" | |||
end | |||
t = t.."|}" | |||
if output ~= "" then | |||
output = output.."\n\n" | |||
end | |||
output = output..t | |||
end | end | ||
end | end | ||
return | return output | ||
end | end | ||
p. | p.heroCritTable = function(frame) | ||
local | local heroCritData = heroDataArray({"Name", "CritDamageBonusPercent"}) | ||
local rows = {} | local rows = {} | ||
for name, data in pairs( | for name, data in pairs(heroCritData) do | ||
table.insert(rows, { | table.insert(rows, { | ||
name = name, | name = name, | ||
critBonusScale = data["CritDamageBonusPercent"] or 0 | |||
}) | }) | ||
end | end | ||
table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end) | |||
local tableDefs = { | local tableDefs = { | ||
{ | { | ||
title = "Base | title = "Hero Base Crit Bonus Scale Stats", | ||
columns = { | columns = { | ||
{ label = " | { label = "Crit Bonus Scale (%)", field = "critBonusScale" } | ||
} | } | ||
} | } | ||
} | } | ||
local output | local output = "" | ||
for _, tableDef in ipairs(tableDefs) do | |||
local filteredRows = {} | |||
for _, r in ipairs(rows) do | |||
local hasValue = false | |||
for _, col in ipairs(tableDef.columns) do | |||
if r[col.field] ~= 0 then | |||
hasValue = true | |||
break | |||
end | |||
end | |||
if hasValue then | |||
table.insert(filteredRows, r) | |||
end | |||
end | end | ||
if #filteredRows > 0 then | |||
end | local header = "" | ||
for _, col in ipairs(tableDef.columns) do | |||
header = header.." !! "..col.label | |||
end | |||
local t = "{| class=\"wikitable sortable mw-collapsible\" style=\"text-align:center\" \n".. | |||
"|+ "..tableDef.title.." \n".. | |||
"! Hero"..header.." \n" | |||
for _, r in ipairs(filteredRows) do | |||
local cells = "" | |||
for _, col in ipairs(tableDef.columns) do | |||
cells = cells.." || "..r[col.field] | |||
end | |||
t = t.. | |||
"|- \n".. | |||
"| style=\"text-align:left;\" | ".. | |||
frame:expandTemplate{title="PageRef", args={r.name}}.. | |||
cells.." \n" | |||
end | |||
t = t.."|}" | |||
if output ~= "" then | |||
output = output.."\n\n" | |||
end | |||
output = output..t | |||
end | end | ||
end | end | ||
return | return output | ||
end | end | ||
return p | return p | ||