Editing Module:HeroDataArrays

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 23: Line 23:


     table.sort(rows, function(a, b)
     table.sort(rows, function(a, b)
         local nameA = getSortName(a.sortName or a.name or "")
         local nameA = getSortName(a.name or "")
         local nameB = getSortName(b.sortName or b.name or "")
         local nameB = getSortName(b.name or "")
         return nameA:lower() < nameB:lower()
         return nameA:lower() < nameB:lower()
     end)
     end)
Line 33: Line 33:
     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
     end
     return value
     return value
Line 101: Line 93:
             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 165: Line 148:
             maxHealth = data["MaxHealth"] or 0,
             maxHealth = data["MaxHealth"] or 0,
             scalingHealth = "+" .. data["LevelScaling>MaxHealth"] or 0,
             scalingHealth = "+" .. data["LevelScaling>MaxHealth"] or 0,
             maxScalingHealth = (data["MaxHealth"] + data["LevelScaling>MaxHealth"] * soul_unlock.get_max("PowerIncrease")) or 0
             maxScalingHealth = roundValue(data["MaxHealth"] + data["LevelScaling>MaxHealth"] * soul_unlock.get_max("PowerIncrease")) or 0
         })
         })
     end
     end
Line 248: Line 231:
             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)
     sortHeroes(rows)
Line 282: Line 246:
                 { label = "Bullets Per Shot", field = "bulletsPerShot"  },
                 { label = "Bullets Per Shot", field = "bulletsPerShot"  },
             }
             }
         }   
         },
    {
            title   = "Base Alt-Fire Damage Stats",
            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 284:
             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


Line 329: Line 293:
             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 357: Line 327:
             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
   
   
Line 381: Line 339:
                 { label = "Spirit Scaling", field = "spiritClipSize"  },
                 { label = "Spirit Scaling", field = "spiritClipSize"  },
             }
             }
         }  
         },
    {
            title  = "Alt-Fire Ammo Cost",
            columns = {
                { label = "Ammo Per Shot", field = "ammoConsumedPerShot"  },
            }
        }   
     }
     }


Line 407: Line 371:
             spiritFireRate = "+".. (data["SpiritScaling>FireRate"] or 0),
             spiritFireRate = "+".. (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)
     sortHeroes(rows)
Line 428: Line 381:
                 { label = "Spirit Scaling", field = "spiritRoundsPerSecond"  },
                 { label = "Spirit Scaling", field = "spiritRoundsPerSecond"  },
             }
             }
         }   
         },
    {
            title  = "Base Alt-Fire Fire Rate",
            columns = {
                { label = "Rounds/s", field = "altRoundsPerSecond" },
            }
        }   
     }
     }


Line 455: Line 414:
             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))
             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)
     sortHeroes(rows)
Line 484: Line 427:
                 { label = "Maximum Range (m)", field = "falloffEndRange"  },
                 { label = "Maximum Range (m)", field = "falloffEndRange"  },
                 { label = "Damage Falloff (%)", field = "falloffEndScale"  },
                 { 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 516: Line 466:
             spiritScalingDamage = "+" .. (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)
     sortHeroes(rows)
Line 567: Line 502:
             lightMeleeDamage = data["LightMeleeDamage"] or 0,
             lightMeleeDamage = data["LightMeleeDamage"] or 0,
             lightScalingDamage = "+" .. data["LevelScaling>LightMeleeDamage"] or 0,
             lightScalingDamage = "+" .. data["LevelScaling>LightMeleeDamage"] or 0,
             lightMaxScalingDamage = (roundValueFour(data["LightMeleeDamage"] + data["LevelScaling>LightMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
             lightMaxScalingDamage = (roundValue(data["LightMeleeDamage"] + data["LevelScaling>LightMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
             heavyMeleeDamage = data["HeavyMeleeDamage"] or 0,
             heavyMeleeDamage = data["HeavyMeleeDamage"] or 0,
             heavyScalingDamage = "+" .. data["LevelScaling>HeavyMeleeDamage"] or 0,
             heavyScalingDamage = "+" .. data["LevelScaling>HeavyMeleeDamage"] or 0,
             heavyMaxScalingDamage =  (roundValueFour(data["HeavyMeleeDamage"] + data["LevelScaling>HeavyMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
             heavyMaxScalingDamage =  (roundValue(data["HeavyMeleeDamage"] + data["LevelScaling>HeavyMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
             heavySpiritScalingDamage = "+" .. (data["SpiritScaling>HeavyMeleeDamage"] or 0),
             heavySpiritScalingDamage = "+" .. (data["SpiritScaling>HeavyMeleeDamage"] or 0),
         })
         })
Line 613: Line 548:
             lightMeleeDamage = data["LightMeleeDamage"] or 0,
             lightMeleeDamage = data["LightMeleeDamage"] or 0,
             scalingDamage = "+" .. data["LevelScaling>LightMeleeDamage"] or 0,
             scalingDamage = "+" .. data["LevelScaling>LightMeleeDamage"] or 0,
             maxScalingDamage =  (roundValueFour(data["LightMeleeDamage"] + data["LevelScaling>LightMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
             maxScalingDamage =  (roundValue(data["LightMeleeDamage"] + data["LevelScaling>LightMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
         })
         })
     end
     end
Line 650: Line 585:
             heavyMeleeDamage = data["HeavyMeleeDamage"] or 0,
             heavyMeleeDamage = data["HeavyMeleeDamage"] or 0,
             scalingDamage = "+" .. data["LevelScaling>HeavyMeleeDamage"] or 0,
             scalingDamage = "+" .. data["LevelScaling>HeavyMeleeDamage"] or 0,
             maxScalingDamage = (roundValueFour(data["HeavyMeleeDamage"] + data["LevelScaling>HeavyMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
             maxScalingDamage = (roundValue(data["HeavyMeleeDamage"] + data["LevelScaling>HeavyMeleeDamage"] * soul_unlock.get_max("PowerIncrease"))) or 0,
             spiritScalingDamage = "+" .. (data["SpiritScaling>HeavyMeleeDamage"] or 0),
             spiritScalingDamage = "+" .. (data["SpiritScaling>HeavyMeleeDamage"] or 0),
         })
         })
Line 817: Line 752:


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", "ShootMoveSpeed", "SpiritScaling>MaxMoveSpeed", "SpiritScaling>SprintSpeed"})


     local rows = {}
     local rows = {}
Line 826: Line 761:
             sprintSpeed = data["SprintSpeed"] or 0,
             sprintSpeed = data["SprintSpeed"] or 0,
             totalSpeed = data["MaxMoveSpeed"] + data["SprintSpeed"] or 0,
             totalSpeed = data["MaxMoveSpeed"] + data["SprintSpeed"] or 0,
             shootSpeed = (data["Weapon>ShootMoveSpeed"] or 0) * 100,
             shootSpeed = (data["ShootMoveSpeed"] or 0) * 100,
             totalShootingSpeed = roundValue((data["MaxMoveSpeed"] + data["SprintSpeed"] or 0) * (data["Weapon>ShootMoveSpeed"] or 0)),
             totalShootingSpeed = (data["MaxMoveSpeed"] + data["SprintSpeed"] or 0) * (data["ShootMoveSpeed"] or 0),
             spiritMoveSpeed = "+" .. (data["SpiritScaling>MaxMoveSpeed"] or 0),
             spiritMoveSpeed = "+" .. (data["SpiritScaling>MaxMoveSpeed"] or 0),
             spiritSprintSpeed = "+" .. (data["SpiritScaling>SprintSpeed"] or 0),
             spiritSprintSpeed = "+" .. (data["SpiritScaling>SprintSpeed"] or 0),
Line 841: Line 776:
                 { 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 = "Total Shooting Speed (m/s)", field = "totalShootingSpeed"  },
                 { label = "Shooting Mult (%)", field = "shootSpeed"  },
                 { label = "Shooting Speed 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 1,076: Line 1,011:
             altBulletRadiusInches  = roundValueInteger((data["Weapon>AltFire>BulletRadius"] or 0) * 100 * 0.394),
             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
     end
     sortHeroes(rows)
     sortHeroes(rows)
Line 1,097: Line 1,020:
                 { label = "Bullet Radius (cm)", field = "bulletRadius"  },
                 { label = "Bullet Radius (cm)", field = "bulletRadius"  },
                 { label = "Bullet Radius (in)", field = "bulletRadiusInches"  },
                 { label = "Bullet Radius (in)", field = "bulletRadiusInches"  },
            }
        },
        {
            title  = "Alt-fire Bullet Radius Stats",
            columns = {
                { label = "Bullet Radius (cm)", field = "altBulletRadius"  },
                { label = "Bullet Radius (in)", field = "altBulletRadiusInches"  },
             }
             }
         }
         }
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: