Editing Module:HeroDataArrays

Jump to navigation Jump to search
Warning: You are not logged in. Once you make an edit, a temporary account will be created for you. Learn more. Log in or create an account to continue receiving notifications after this account expires, and to access other features.
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
-- Use sort name for edge cases like "The Doorman"
local function sortHeroes(rows)
    local function getSortName(name)
        return (name:gsub("^The ", ""))
    end
    table.sort(rows, function(a, b)
        local nameA = getSortName(a.sortName or a.name or "")
        local nameB = getSortName(b.sortName or b.name or "")
        return nameA:lower() < nameB:lower()
    end)
end
end


Line 33: Line 20:
     if type(value) == "number" then
     if type(value) == "number" then
         return util_module.round_to_sig_fig(value, 3)
         return util_module.round_to_sig_fig(value, 3)
    end
    return value
end
-- Round to 4 digits
local function roundValueFour(value)
    if type(value) == "number" then
        return util_module.round_to_sig_fig(value, 4)
    end
    return value
end
-- Round to an integer (up to 2 digits)
local function roundValueInteger(value)
    if type(value) == "number" then
        return util_module.round_to_sig_fig(value, 2)
     end
     end
     return value
     return value
Line 101: Line 72:
             cells = cells .. " || " .. (r[col.field] or 0)
             cells = cells .. " || " .. (r[col.field] or 0)
         end
         end
        -- A row may carry an alternate sort key and a label suffix, used by
        -- secondary fire rows so they stay underneath their hero's main row
        local nameCell = "| style=\"text-align:left;\""
        if r.sortName then
            nameCell = nameCell .. " data-sort-value=\"" .. r.sortName .. "\""
        end
        nameCell = nameCell .. " | " ..
            frame:expandTemplate{ title = "PageRef", args = { r.name } } ..
            (r.nameSuffix or "")


         t = t ..
         t = t ..
             "|- \n" ..
             "|- \n" ..
             nameCell ..
             "| style=\"text-align:left;\" | " ..
            frame:expandTemplate{ title = "PageRef", args = { r.name } } ..
             cells .. " \n"
             cells .. " \n"
     end
     end
Line 163: Line 125:
         table.insert(rows, {
         table.insert(rows, {
             name = name,
             name = name,
             maxHealth = data["MaxHealth"] or 0,
             maxHealth = tonumber(data["MaxHealth"]) or 0,
             scalingHealth = "+" .. data["LevelScaling>MaxHealth"] or 0,
             scalingHealth = "+" .. tonumber(data["LevelScaling>MaxHealth"]) or 0,
             maxScalingHealth = (data["MaxHealth"] + data["LevelScaling>MaxHealth"] * soul_unlock.get_max("PowerIncrease")) or 0
             maxScalingHealth = tonumber(roundValue(data["MaxHealth"] + data["LevelScaling>MaxHealth"] * soul_unlock.get_max("PowerIncrease"))) or 0
         })
         })
     end
     end
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
         {
         {
             title = "Base Health Stats",
             title = "Hero Base Health Stats",
             columns = {
             columns = {
                 { label = "Starting", field = "maxHealth" },
                 { label = "Starting", field = "maxHealth" },
Line 200: Line 162:
             name = name,
             name = name,
             baseHealthRegen = data["BaseHealthRegen"] or 0,
             baseHealthRegen = data["BaseHealthRegen"] or 0,
             spiritHealthRegen = "+".. (data["SpiritScaling>BaseHealthRegen"] or 0),
             spiritHealthRegen = "+".. (tonumber(data["SpiritScaling>BaseHealthRegen"]) or 0),
         })
         })
     end
     end
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
         {
         {
             title = "Base Health Regen Stats",
             title = "Hero Base Health Regen",
             columns = {
             columns = {
                 { label = "HP/s", field = "baseHealthRegen" },
                 { label = "HP/s", field = "baseHealthRegen" },
Line 248: Line 210:
             altBulletsPerShot = data["Weapon>AltFire>BulletsPerShot"] or 0
             altBulletsPerShot = data["Weapon>AltFire>BulletsPerShot"] or 0
         })
         })
       
        local altBulletDamage = data["Weapon>AltFire>BulletDamage"]
        local altDPS = data["Weapon>AltFire>DPS"]
        local altRoundsPerSecond = data["Weapon>AltFire>RoundsPerSecond"]
        local altBulletsPerShot = data["Weapon>AltFire>BulletsPerShot"]
        if altBulletDamage and altBulletDamage ~= 0 then
            table.insert(rows, {
                name = name,
                sortName = name .. " (alt fire)",
                nameSuffix = " (alt fire)",
                DPS = altDPS,
                reloadDelay = data["Weapon>ReloadDelay"] or 0,
                reloadTime = data["Weapon>ReloadTime"] or 0,
                clipSize = data["Weapon>ClipSize"] or 0,
                roundsPerSecond = altRoundsPerSecond,
                bulletDamage = altBulletDamage,
                bulletsPerShot = altBulletsPerShot
            })
        end
     end
     end
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
     {
     {
             title  = "Base Damage Stats",
             title  = "Hero Base Damage",
             columns = {
             columns = {
                 { label = "Damage per sec", field = "DPS"  },
                 { label = "Damage per sec", field = "DPS"  },
Line 282: Line 225:
                 { label = "Bullets Per Shot", field = "bulletsPerShot"  },
                 { label = "Bullets Per Shot", field = "bulletsPerShot"  },
             }
             }
         }   
         },
    {
            title   = "Hero Base Alt-Fire Damage",
            columns = {
                { label = "Damage per sec", field = "altDPS"  },
                { label = "Ammo Per Shot", field = "altAmmoConsumedPerShot"  },
                { label = "Bullets per sec", field = "altRoundsPerSecond"  },
                { label = "Bullet Damage", field = "altBulletDamage"  },
                { label = "Bullets Per Shot", field = "altBulletsPerShot"  },
            }
        }   
     }
     }


Line 310: Line 263:
             altBulletSpeed = data["Weapon>AltFire>BulletSpeed"] or 0
             altBulletSpeed = data["Weapon>AltFire>BulletSpeed"] or 0
         })
         })
       
        local altBulletSpeed = data["Weapon>AltFire>BulletSpeed"]
        if altBulletSpeed and altBulletSpeed ~= 0 then
            table.insert(rows, {
                name = name,
                sortName = name .. " (alt fire)",
                nameSuffix = " (alt fire)",
                bulletSpeed = altBulletSpeed
            })
        end
     end
     end


     sortHeroes(rows)
     table.sort(rows, function(a, b)
        return a.name:lower() < b.name:lower()
    end)


     local tableDefs = {
     local tableDefs = {
Line 329: Line 274:
             columns = {
             columns = {
                 { label = "m/s", field = "bulletSpeed" }
                 { label = "m/s", field = "bulletSpeed" }
            }
        },
        {
            title = "Base Alt-Fire Bullet Velocity",
            columns = {
                { label = "m/s", field = "altBulletSpeed" }
             }
             }
         }
         }
Line 345: Line 296:


p.heroClipSizeTable = function(frame)
p.heroClipSizeTable = function(frame)
     local heroClipSizeData = heroDataArray({"Name", "Weapon>ClipSize","Weapon>BulletsPerBurst","Weapon>AltFire>AmmoConsumedPerShot","SpiritScaling>ClipSize"})
     local heroClipSizeData = heroDataArray({"Name", "Weapon>ClipSize","Weapon>AltFire>AmmoConsumedPerShot","SpiritScaling>ClipSize"})
      
      
     local rows = {}
     local rows = {}
Line 352: Line 303:
             name = name,
             name = name,
             clipSize = data["Weapon>ClipSize"] or 0,
             clipSize = data["Weapon>ClipSize"] or 0,
             spiritClipSize = "+".. (data["SpiritScaling>ClipSize"] or 0),
             spiritClipSize = "+".. (tonumber(data["SpiritScaling>ClipSize"]) or 0),
            bulletsPerBurst = data["Weapon>BulletsPerBurst"] or 0,
            burstClipSize = data["Weapon>ClipSize"] or 0 / data["Weapon>BulletsPerBurst"] or 0,
             ammoConsumedPerShot = data["Weapon>AltFire>AmmoConsumedPerShot"] or 0
             ammoConsumedPerShot = data["Weapon>AltFire>AmmoConsumedPerShot"] or 0
         })
         })
       
        local ammoConsumedPerShot = data["Weapon>AltFire>AmmoConsumedPerShot"]
        if ammoConsumedPerShot and ammoConsumedPerShot ~= 0 then
            table.insert(rows, {
                name = name,
                sortName = name .. " (alt fire)",
                nameSuffix = " (alt fire)",
                bulletsPerBurst = ammoConsumedPerShot,
                clipSize = data["Weapon>ClipSize"] or 0,
                spiritClipSize = "+".. (data["SpiritScaling>ClipSize"] or 0),
            })
        end
     end
     end
   
   
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
Line 378: Line 315:
             columns = {
             columns = {
                 { label = "Ammo", field = "clipSize"  },
                 { label = "Ammo", field = "clipSize"  },
                { label = "Ammo Per Shot", field = "bulletsPerBurst"  },
                 { label = "Spirit Scaling", field = "spiritClipSize"  },
                 { label = "Spirit Scaling", field = "spiritClipSize"  },
             }
             }
         }  
         },
    {
            title  = "Alt-Fire Ammo Cost",
            columns = {
                { label = "Ammo Per Shot", field = "ammoConsumedPerShot"  },
            }
        }   
     }
     }


Line 404: Line 346:
             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,
             spiritRoundsPerSecond = "+".. (data["SpiritScaling>RoundsPerSecond"] or 0),
             spiritRoundsPerSecond = "+".. (tonumber(data["SpiritScaling>RoundsPerSecond"]) or 0),
             spiritFireRate = "+".. (data["SpiritScaling>FireRate"] or 0),
             spiritFireRate = "+".. (tonumber(data["SpiritScaling>FireRate"]) or 0),
         })
         })
       
        local altRoundsPerSecond = data["Weapon>AltFire>RoundsPerSecond"]
        if altRoundsPerSecond and altRoundsPerSecond ~= 0 then
            table.insert(rows, {
                name = name,
                sortName = name .. " (alt fire)",
                nameSuffix = " (alt fire)",
                roundsPerSecond = altRoundsPerSecond,
                spiritRoundsPerSecond = "+".. (data["SpiritScaling>RoundsPerSecond"] or 0),
            })
        end
     end
     end
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
Line 428: Line 359:
                 { label = "Spirit Scaling", field = "spiritRoundsPerSecond"  },
                 { label = "Spirit Scaling", field = "spiritRoundsPerSecond"  },
             }
             }
         }   
         },
    {
            title  = "Base Alt-Fire Fire Rate",
            columns = {
                { label = "Rounds/s", field = "altRoundsPerSecond" },
            }
        }   
     }
     }


Line 444: Line 381:
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>FalloffEndScale", "Weapon>AltFire>ExplosionDamageScaleAtMaxRadius",})
     "Weapon>AltFire>ExplosionRadius"})
      
      
     local rows = {}
     local rows = {}
Line 452: Line 389:
             falloffStartRange = data["Weapon>FalloffStartRange"] or 0,
             falloffStartRange = data["Weapon>FalloffStartRange"] or 0,
             falloffEndRange = data["Weapon>FalloffEndRange"] or 0,
             falloffEndRange = data["Weapon>FalloffEndRange"] or 0,
            falloffEndScale = -100 + (100 * (data["Weapon>FalloffEndScale"] 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 = 0,
             altExplosionRadius = data["Weapon>AltFire>ExplosionRadius"] or 0
            altExplosionEndScale = (100 * (data["Weapon>AltFire>ExplosionDamageScaleAtMaxRadius"] or 0))
         })
         })
   
        local altFalloffStartRange = data["Weapon>AltFire>FalloffStartRange"]
        local altFalloffEndRange = data["Weapon>AltFire>FalloffEndRange"]
        local altExplosionRadius = data["Weapon>AltFire>ExplosionRadius"] or 0
        local altExplosionEndScale = (100 * (data["Weapon>AltFire>ExplosionDamageScaleAtMaxRadius"] or 0))
        if altFalloffStartRange and altFalloffStartRange ~= 0 then
            table.insert(rows, {
                name = name,
                sortName = name .. " (alt fire)",
                nameSuffix = " (alt fire)",
                falloffStartRange = altFalloffStartRange,
                falloffEndRange = altFalloffEndRange,
                altExplosionRadius = data["Weapon>AltFire>ExplosionRadius"] or 0,
                falloffEndScale = -100 + (100 * (data["Weapon>FalloffEndScale"] or 0))
            })
        end
     end
     end
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
Line 483: Line 402:
                 { label = "Minimum Range (m)", field = "falloffStartRange"  },
                 { label = "Minimum Range (m)", field = "falloffStartRange"  },
                 { label = "Maximum Range (m)", field = "falloffEndRange"  },
                 { label = "Maximum Range (m)", field = "falloffEndRange"  },
                 { label = "Damage Falloff (%)", field = "falloffEndScale"  },
            }
        } ,
    {
            title  = "Base Alt-Fire Falloff Range",
            columns = {
                { label = "Minimum Range (m)", field = "altFalloffStartRange"  },
                 { label = "Maximum Range (m)", field = "altFalloffEndRange"  },
                 { label = "Explosion Radius (m)", field = "altExplosionRadius"  },
                 { label = "Explosion Radius (m)", field = "altExplosionRadius"  },
             }
             }
Line 503: Line 428:
     -- Pull data
     -- Pull data
     local heroBulletDamageData = heroDataArray({"Name", "Weapon>BulletDamage", "LevelScaling>BulletDamage", "Weapon>AltFire>BulletDamage", "LevelScaling>BulletDamageAltFire",
     local heroBulletDamageData = heroDataArray({"Name", "Weapon>BulletDamage", "LevelScaling>BulletDamage", "Weapon>AltFire>BulletDamage", "LevelScaling>BulletDamageAltFire",
     "SpiritScaling>BulletDamage", "Weapon>BulletsPerShot", "Weapon>BulletsPerBurst"})
     "SpiritScaling>BulletDamage" })


     local rows = {}
     local rows = {}
Line 509: Line 434:
         table.insert(rows, {
         table.insert(rows, {
             name = name,
             name = name,
             bulletDamage = data["Weapon>BulletDamage"] or 0,
             bulletDamage = tonumber(data["Weapon>BulletDamage"]) or 0,
            bulletDamagePerShot = ((data["Weapon>BulletDamage"] or 0) * (data["Weapon>BulletsPerShot"] or 0) * (data["Weapon>BulletsPerBurst"] or 0)),
             scalingDamage = "+" .. tonumber(data["LevelScaling>BulletDamage"]) or 0,
             scalingDamage = "+" .. data["LevelScaling>BulletDamage"] or 0,
             maxScalingDamage =  tonumber(roundValue(data["Weapon>BulletDamage"] + data["LevelScaling>BulletDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
             maxScalingDamage =  (roundValue(data["Weapon>BulletDamage"] + data["LevelScaling>BulletDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
             altBulletDamage = tonumber(data["Weapon>AltFire>BulletDamage"]) or 0,
             altBulletDamage = data["Weapon>AltFire>BulletDamage"] or 0,
             spiritScalingDamage = "+" .. (tonumber(data["SpiritScaling>BulletDamage"]) or 0),
             spiritScalingDamage = "+" .. (data["SpiritScaling>BulletDamage"] or 0),
         })
         })
        -- Secondary fire is listed as its own row, right under the hero's main row
        local altDamage = data["Weapon>AltFire>BulletDamage"]
        if altDamage and altDamage ~= 0 then
            local altScaling = data["LevelScaling>BulletDamageAltFire"] or 0
            table.insert(rows, {
                name = name,
                sortName = name .. " (alt fire)",
                nameSuffix = " (alt fire)",
                bulletDamage = altDamage,
                scalingDamage = "+" .. altScaling,
                maxScalingDamage = roundValue(altDamage + altScaling * soul_unlock.get_max("PowerIncrease")),
                spiritScalingDamage = "+0",
            })
        end
     end
     end
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
     {
     {
             title  = "Base Bullet Damage Stats",
             title  = "Hero Base Bullet Damage Stats",
             columns = {
             columns = {
                 { label = "Starting", field = "bulletDamage"  },
                 { label = "Starting", field = "bulletDamage"  },
Line 546: Line 455:
     }
     }


    local output = {}
    for _, def in ipairs(tableDefs) do
        local t = buildTable(frame, rows, def, def.options)
        if t ~= "" then
            table.insert(output, t)
        end
    end
    return table.concat(output, "\n\n")
end
p.heroMeleeTable = function(frame)
    -- Pull data
    local heroMeleeData = heroDataArray({"Name", "LightMeleeDamage", "LevelScaling>LightMeleeDamage", "HeavyMeleeDamage", "LevelScaling>HeavyMeleeDamage", "SpiritScaling>HeavyMeleeDamage"})
    local rows = {}
    for name, data in pairs(heroMeleeData) do
        table.insert(rows, {
            name = name,
            lightMeleeDamage = data["LightMeleeDamage"] or 0,
            lightScalingDamage = "+" .. data["LevelScaling>LightMeleeDamage"] or 0,
            lightMaxScalingDamage = (roundValueFour(data["LightMeleeDamage"] + data["LevelScaling>LightMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
            heavyMeleeDamage = data["HeavyMeleeDamage"] or 0,
            heavyScalingDamage = "+" .. data["LevelScaling>HeavyMeleeDamage"] or 0,
            heavyMaxScalingDamage =  (roundValueFour(data["HeavyMeleeDamage"] + data["LevelScaling>HeavyMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
            heavySpiritScalingDamage = "+" .. (data["SpiritScaling>HeavyMeleeDamage"] or 0),
        })
    end
    sortHeroes(rows)
    local tableDefs = {
    {
            title  = "Base Light & Heavy Melee Stats",
            columns = {
                { label = "Starting Light", field = "lightMeleeDamage"  },
                { label = "Added per Boon (L)", field = "lightScalingDamage"  },
                { label = "At Max Boon (L)", field = "lightMaxScalingDamage"  },
                { label = "Starting Heavy", field = "heavyMeleeDamage"  },
                { label = "Added per Boon (H)", field = "heavyScalingDamage"  },
                { label = "At Max Boon (H)", field = "heavyMaxScalingDamage"  },
                { label = "Spirit Scaling (H)", field = "heavySpiritScalingDamage"  },
               
            }
        }
    }
   
     local output = {}
     local output = {}
     for _, def in ipairs(tableDefs) do
     for _, def in ipairs(tableDefs) do
Line 611: Line 474:
         table.insert(rows, {
         table.insert(rows, {
             name = name,
             name = name,
             lightMeleeDamage = data["LightMeleeDamage"] or 0,
             lightMeleeDamage = tonumber(data["LightMeleeDamage"]) or 0,
             scalingDamage = "+" .. data["LevelScaling>LightMeleeDamage"] or 0,
             scalingDamage = "+" .. tonumber(data["LevelScaling>LightMeleeDamage"]) or 0,
             maxScalingDamage =  (roundValueFour(data["LightMeleeDamage"] + data["LevelScaling>LightMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
             maxScalingDamage =  tonumber(roundValue(data["LightMeleeDamage"] + data["LevelScaling>LightMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
         })
         })
     end
     end
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
     {
     {
             title  = "Base Light Melee Stats",
             title  = "Hero Base Light Melee Stats",
             columns = {
             columns = {
                 { label = "Starting", field = "lightMeleeDamage"  },
                 { label = "Starting", field = "lightMeleeDamage"  },
Line 648: Line 511:
         table.insert(rows, {
         table.insert(rows, {
             name = name,
             name = name,
             heavyMeleeDamage = data["HeavyMeleeDamage"] or 0,
             heavyMeleeDamage = tonumber(data["HeavyMeleeDamage"]) or 0,
             scalingDamage = "+" .. data["LevelScaling>HeavyMeleeDamage"] or 0,
             scalingDamage = "+" .. tonumber(data["LevelScaling>HeavyMeleeDamage"]) or 0,
             maxScalingDamage = (roundValueFour(data["HeavyMeleeDamage"] + data["LevelScaling>HeavyMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
             maxScalingDamage = tonumber(roundValue(data["HeavyMeleeDamage"] + data["LevelScaling>HeavyMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
             spiritScalingDamage = "+" .. (data["SpiritScaling>HeavyMeleeDamage"] or 0),
             spiritScalingDamage = "+" .. (tonumber(data["SpiritScaling>HeavyMeleeDamage"]) or 0),
         })
         })
     end
     end
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
     {
     {
             title  = "Base Heavy Melee Stats",
             title  = "Hero Base Heavy Melee Stats",
             columns = {
             columns = {
                 { label = "Starting", field = "heavyMeleeDamage"  },
                 { label = "Starting", field = "heavyMeleeDamage"  },
Line 690: Line 553:
         })
         })
     end
     end
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
     {
     {
             title  = "Base Stamina Stats",
             title  = "Hero Base Stamina Stats",
             columns = {
             columns = {
                 { label = "Stamina Bars", field = "stamina"  },
                 { label = "Stamina Bars", field = "stamina"  },
Line 714: Line 577:


p.heroDashTable = function(frame)
p.heroDashTable = function(frame)
     local heroDashData = heroDataArray({"Name", "GroundDashSpeed", "GroundDashDuration", "AirDashSpeed", "AirDashDuration"})
     local heroDashData = heroDataArray({"Name", "GroundDashSpeed"})


     local rows = {}
     local rows = {}
Line 720: Line 583:
         table.insert(rows, {
         table.insert(rows, {
             name    = name,
             name    = name,
             dashSpeed = data["GroundDashSpeed"] or 0,
             dashSpeed = data["GroundDashSpeed"] or 0
            dashDuration = data["GroundDashDuration"] or 0,
            airDashSpeed = data["AirDashSpeed"] or 0,
            airDashDuration = data["AirDashDuration"] or 0,
         })
         })
     end
     end
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)
      
      
     local tableDefs = {
     local tableDefs = {
     {
     {
             title  = "Base Dash Speed Stats",
             title  = "Hero Base Dash Speed Stats",
             columns = {
             columns = {
                 { label = "Dash Speed (m/s)", field = "dashSpeed"  },
                 { label = "Dash Speed (m/s)", field = "dashSpeed"  },
                { label = "Dash Duration (s)", field = "dashDuration"  },
                { label = "Air Dash Speed (m/s)", field = "airDashSpeed"  },
                { label = "Air Dash Duration (s)", field = "airDashDuration"  },
             }
             }
         }  
         }  
Line 758: Line 615:
         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


     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
     {
     {
             title  = "Base Reload Time",
             title  = "Hero Base Reload Time Stats",
             columns = {
             columns = {
                 { label = "Reload Time (s)", field = "reloadTime"  },
                 { label = "Reload Time (s)", field = "reloadTime"  },
Line 794: Line 651:
         })
         })
     end
     end
     sortHeroes(rows)
     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 817: Line 674:


p.heroMoveSpeedTable = function(frame)
p.heroMoveSpeedTable = function(frame)
     local heroMoveSpeedData = heroDataArray({"Name", "MaxMoveSpeed", "SprintSpeed", "Weapon>ShootMoveSpeed", "SpiritScaling>MaxMoveSpeed", "SpiritScaling>SprintSpeed"})
     local heroMoveSpeedData = heroDataArray({"Name", "MaxMoveSpeed", "SprintSpeed", "SpiritScaling>MaxMoveSpeed", "SpiritScaling>SprintSpeed"})


     local rows = {}
     local rows = {}
Line 823: Line 680:
         table.insert(rows, {
         table.insert(rows, {
             name = name,
             name = name,
             moveSpeed = data["MaxMoveSpeed"] or 0,
             moveSpeed = tonumber(data["MaxMoveSpeed"]) or 0,
             sprintSpeed = data["SprintSpeed"] or 0,
             sprintSpeed = tonumber(data["SprintSpeed"]) or 0,
             totalSpeed = data["MaxMoveSpeed"] + data["SprintSpeed"] or 0,
             totalSpeed = tonumber(data["MaxMoveSpeed"] + data["SprintSpeed"]) or 0,
            shootSpeed = (data["Weapon>ShootMoveSpeed"] or 0) * 100,
             spiritMoveSpeed = "+" .. (tonumber(data["SpiritScaling>MaxMoveSpeed"]) or 0),
            totalShootingSpeed = roundValue((data["MaxMoveSpeed"] + data["SprintSpeed"] or 0) * (data["Weapon>ShootMoveSpeed"] or 0)),
             spiritSprintSpeed = "+" .. (tonumber(data["SpiritScaling>SprintSpeed"]) or 0),
             spiritMoveSpeed = "+" .. (data["SpiritScaling>MaxMoveSpeed"] or 0),
             spiritSprintSpeed = "+" .. (data["SpiritScaling>SprintSpeed"] or 0),
         })
         })
     end
     end
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
     {
     {
             title  = "Base Move Speed Stats",
             title  = "Hero Base Move Speed Stats",
             columns = {
             columns = {
                 { label = "Move Speed (m/s)", field = "moveSpeed"  },
                 { label = "Move Speed (m/s)", field = "moveSpeed"  },
                 { label = "Sprint Speed (m/s)", field = "sprintSpeed"  },
                 { label = "Sprint Speed (m/s)", field = "sprintSpeed"  },
                 { label = "Total Speed (m/s)", field = "totalSpeed"  },
                 { label = "Total Speed (m/s)", field = "totalSpeed"  },
                { label = "Shooting Speed (m/s)", field = "totalShootingSpeed"  },
                { label = "Shooting Mult (%)", field = "shootSpeed"  },
                 { label = "MS Spirit Scaling", field = "spiritMoveSpeed"  },
                 { label = "MS Spirit Scaling", field = "spiritMoveSpeed"  },
                 { label = "SS Spirit Scaling", field = "spiritSprintSpeed"  },
                 { label = "SS Spirit Scaling", field = "spiritSprintSpeed"  },
Line 871: Line 724:
             bulletResist  = data["BulletResist"] or 0,
             bulletResist  = data["BulletResist"] or 0,
             bulletResistScaling = "+".. (data["LevelScaling>BulletResist"] or 0),
             bulletResistScaling = "+".. (data["LevelScaling>BulletResist"] or 0),
             bulletResistScalingMax = ((roundValue((data["BulletResist"] or 0) + (data["LevelScaling>BulletResist"] or 0) * soul_unlock.get_max("PowerIncrease"))) or 0),
             bulletResistScalingMax = (tonumber(roundValue((data["BulletResist"] or 0) + (data["LevelScaling>BulletResist"] or 0) * soul_unlock.get_max("PowerIncrease"))) or 0),
             bulletResistSpiritScaling = "+".. (data["SpiritScaling>BulletResist"] or 0),
             bulletResistSpiritScaling = "+".. (data["SpiritScaling>BulletResist"] or 0),
             spiritResist  = data["TechResist"] or 0,
             spiritResist  = data["TechResist"] or 0,
             spiritResistScaling = "+".. (data["LevelScaling>TechResist"] or 0),
             spiritResistScaling = "+".. (data["LevelScaling>TechResist"] or 0),
             spiritResistScalingMax = ((roundValue((data["TechResist"] or 0) + (data["LevelScaling>TechResist"] or 0) * soul_unlock.get_max("PowerIncrease"))) or 0),
             spiritResistScalingMax = (tonumber(roundValue((data["TechResist"] or 0) + (data["LevelScaling>TechResist"] or 0) * soul_unlock.get_max("PowerIncrease"))) or 0),
             spiritResistSpiritScaling = "+".. (data["SpiritScaling>TechResist"] or 0),
             spiritResistSpiritScaling = "+".. (data["SpiritScaling>TechResist"] or 0),
             meleeResist  = data["MeleeResist"] or 0,
             meleeResist  = data["MeleeResist"] or 0,
Line 881: Line 734:
         })
         })
     end
     end
     sortHeroes(rows)
     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 = "Starting (%)", field = "bulletResist"  },
                 { label = "Starting (%)", field = "bulletResist"  },
Line 894: Line 747:
         },
         },
         {
         {
             title  = "Base Spirit Resist Stats",
             title  = "Hero Base Spirit Resist Stats",
             columns = {
             columns = {
                 { label = "Starting (%)", field = "spiritResist"  },
                 { label = "Starting (%)", field = "spiritResist"  },
Line 903: Line 756:
         },
         },
         {
         {
             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 762:
         },
         },
         {
         {
             title  = "Base Crit Reduction Stats",
             title  = "Hero Base Crit Reduction Stats",
             columns = {
             columns = {
                 { label = "Crit Reduction (%)", field = "critReduction" },
                 { label = "Crit Reduction (%)", field = "critReduction" },
Line 937: Line 790:
         })
         })
     end
     end
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
     {
     {
             title  = "Base Crit Bonus Scale Stats",
             title  = "Hero Base Crit Bonus Scale Stats",
             columns = {
             columns = {
                 { label = "Crit Bonus Scale (%)", field = "critBonusScale"  }
                 { label = "Crit Bonus Scale (%)", field = "critBonusScale"  }
Line 967: Line 820:
             name = name,
             name = name,
             spiritScaling  = "+".. data["LevelScaling>TechPower"] or 0,
             spiritScaling  = "+".. data["LevelScaling>TechPower"] or 0,
             maxSpiritScaling = (data["LevelScaling>TechPower"] * soul_unlock.get_max("PowerIncrease")) or 0,
             maxSpiritScaling = tonumber(data["LevelScaling>TechPower"] * soul_unlock.get_max("PowerIncrease")) or 0,
         })
         })
     end
     end
     sortHeroes(rows)
     table.sort(rows, function(a, b) return a.name:lower() < b.name:lower() end)


     local tableDefs = {
     local tableDefs = {
     {
     {
             title  = "Spirit Scaling Stats",
             title  = "Hero Spirit Scaling Stats",
             columns = {
             columns = {
                 { label = "Spirit Per Boon", field = "spiritScaling"  },
                 { label = "Spirit Per Boon", field = "spiritScaling"  },
Line 980: Line 833:
             }
             }
         }     
         }     
    }
    local output = {}
    for _, def in ipairs(tableDefs) do
        local t = buildTable(frame, rows, def, def.options)
        if t ~= "" then
            table.insert(output, t)
        end
    end
    return table.concat(output, "\n\n")
end
p.heroGravityTable = function(frame)
    local heroGravityData = heroDataArray({"Name", "GravityChange"})
    local rows = {}
    for name, data in pairs(heroGravityData) do
        table.insert(rows, {
            name = name,
            gravityScale  = (data["GravityChange"] or 0),
        })
    end
    sortHeroes(rows)
    local tableDefs = {
    {
            title  = "Base Gravity Scale Stats",
            columns = {
                { label = "Gravity Scale (%)", field = "gravityScale"  },
            }
        }   
    }
    local output = {}
    for _, def in ipairs(tableDefs) do
        local t = buildTable(frame, rows, def, def.options)
        if t ~= "" then
            table.insert(output, t)
        end
    end
    return table.concat(output, "\n\n")
end
p.bulletGravityTable = function(frame)
    local heroGravityData = heroDataArray({"Name", "Weapon>BulletGravityScale", "Weapon>AltFire>BulletGravityScale"})
    local rows = {}
    for name, data in pairs(heroGravityData) do
        table.insert(rows, {
            name = name,
            gravityScale  = (data["Weapon>BulletGravityScale"] or 0),
            altGravityScale  = (data["Weapon>AltFire>BulletGravityScale"] or 0),
        })
    end
    sortHeroes(rows)
    local tableDefs = {
    {
            title  = "Base Bullet Gravity Scale Stats",
            columns = {
                { label = "Gravity Scale", field = "gravityScale"  },
            }
        },
        {
            title  = "Base Alt-fire Bullet Gravity Scale Stats",
            columns = {
                { label = "Gravity Scale", field = "altGravityScale"  },
            }
        }
    }
    local output = {}
    for _, def in ipairs(tableDefs) do
        local t = buildTable(frame, rows, def, def.options)
        if t ~= "" then
            table.insert(output, t)
        end
    end
    return table.concat(output, "\n\n")
end
p.bulletRadiusTable = function(frame)
    local heroBulletRadiusData = heroDataArray({"Name", "Weapon>BulletRadius", "Weapon>AltFire>BulletRadius"})
    local rows = {}
    for name, data in pairs(heroBulletRadiusData) do
        table.insert(rows, {
            name = name,
            bulletRadius  = (data["Weapon>BulletRadius"] or 0) * 100,
            bulletRadiusInches  = roundValueInteger((data["Weapon>BulletRadius"] or 0) * 100 * 0.394),
            altBulletRadius  = (data["Weapon>AltFire>BulletRadius"] or 0) * 100,
            altBulletRadiusInches  = roundValueInteger((data["Weapon>AltFire>BulletRadius"] or 0) * 100 * 0.394),
        })
       
        local altBulletRadius = (data["Weapon>AltFire>BulletRadius"] or 0) * 100
        local altBulletRadiusInches  = roundValueInteger((data["Weapon>AltFire>BulletRadius"] or 0) * 100 * 0.394)
        if altBulletRadius and altBulletRadius ~= 0 then
            table.insert(rows, {
                name = name,
                sortName = name .. " (alt fire)",
                nameSuffix = " (alt fire)",
                bulletRadius = altBulletRadius,
                bulletRadiusInches = altBulletRadiusInches
            })
        end
    end
    sortHeroes(rows)
    local tableDefs = {
    {
            title  = "Base Bullet Radius Stats",
            columns = {
                { label = "Bullet Radius (cm)", field = "bulletRadius"  },
                { label = "Bullet Radius (in)", field = "bulletRadiusInches"  },
            }
        }
     }
     }


Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Deadlock:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template

Page included on this page: