Module:HeroDataArrays: Difference between revisions

mNo edit summary
changed to replace nil values with 0
Line 102: Line 102:
          
          
     for i,a in pairs(heroDpsData) do
     for i,a in pairs(heroDpsData) do
    local ReloadDelay = a["ReloadDelay"] or 0
    local ReloadTime = a["ReloadTime"] or 0
    local ClipSize = a["ClipSize"] or 0
    local RoundsPerSecond = a["RoundsPerSecond"] or 0
    local BulletDamage = a["BulletDamage"] or 0
    local BulletsPerShot = a["BulletsPerShot"] or 0
         z = z..
         z = z..
             "|- \n"..
             "|- \n"..
             "| style=\"text-align:left;\" | "..
             "| style=\"text-align:left;\" | "..
                 frame:expandTemplate{title="PageRef", args={a["Name"]}}..
                 frame:expandTemplate{title="PageRef", args={a["Name"]}}..
                 " || "..a["ReloadDelay"].." || "..a["ReloadTime"].."  || "..a["ClipSize"]..
                 " || "..ReloadDelay.." || "..ReloadTime.."  || "..ClipSize..
                 " || "..a["RoundsPerSecond"].." || "..a["BulletDamage"].." || "..a["BulletsPerShot"].." \n"
                 " || "..RoundsPerSecond.." || "..BulletDamage.." || "..BulletsPerShot.." \n"
     end
     end
     z = z.."|}"
     z = z.."|}"
Line 121: Line 127:


     for i,a in pairs(heroBulletSpeedData) do
     for i,a in pairs(heroBulletSpeedData) do
    local BulletSpeed = a["BulletSpeed"] or 0
         z = z..
         z = z..
             "|- \n"..
             "|- \n"..
             "| style=\"text-align:left;\" | "..
             "| style=\"text-align:left;\" | "..
                 frame:expandTemplate{title="PageRef", args={a["Name"]}}..
                 frame:expandTemplate{title="PageRef", args={a["Name"]}}..
                 " || "..a["BulletSpeed"].." \n"
                 " || "..BulletSpeed.." \n"
     end
     end
     z = z.."|}"
     z = z.."|}"
Line 139: Line 146:


     for i,a in pairs(heroClipSizeData) do
     for i,a in pairs(heroClipSizeData) do
    local ClipSize = a["ClipSize"] or 0
         z = z..
         z = z..
             "|- \n"..
             "|- \n"..
             "| style=\"text-align:left;\" | "..
             "| style=\"text-align:left;\" | "..
                 frame:expandTemplate{title="PageRef", args={a["Name"]}}..
                 frame:expandTemplate{title="PageRef", args={a["Name"]}}..
                 " || "..a["ClipSize"].." \n"
                 " || "..ClipSize.." \n"
     end
     end
     z = z.."|}"
     z = z.."|}"
Line 175: Line 183:


     for i,a in pairs(heroRoundsPerSecondData) do
     for i,a in pairs(heroRoundsPerSecondData) do
    local RoundsPerSecond = a["RoundsPerSecond"] or 0
         z = z..
         z = z..
             "|- \n"..
             "|- \n"..
             "| style=\"text-align:left;\" | "..
             "| style=\"text-align:left;\" | "..
                 frame:expandTemplate{title="PageRef", args={a["Name"]}}..
                 frame:expandTemplate{title="PageRef", args={a["Name"]}}..
                 " || "..a["RoundsPerSecond"].." \n"
                 " || "..RoundsPerSecond.." \n"
     end
     end
     z = z.."|}"
     z = z.."|}"
Line 193: Line 202:


     for i,a in pairs(heroFalloffRangeData) do
     for i,a in pairs(heroFalloffRangeData) do
    local FalloffStartRange = a["FalloffStartRange"] or 0
    local FalloffEndRange = a["FalloffEndRange"] or 0
         z = z..
         z = z..
             "|- \n"..
             "|- \n"..
             "| style=\"text-align:left;\" | "..
             "| style=\"text-align:left;\" | "..
                 frame:expandTemplate{title="PageRef", args={a["Name"]}}..
                 frame:expandTemplate{title="PageRef", args={a["Name"]}}..
                 " || "..a["FalloffStartRange"].." || "..a["FalloffEndRange"].." \n"
                 " || "..FalloffStartRange.." || "..FalloffEndRange.." \n"
     end
     end
     z = z.."|}"
     z = z.."|}"
Line 215: Line 226:
     -- Iterate over heroes adding a new row to the wikitable for each
     -- Iterate over heroes adding a new row to the wikitable for each
     for i,a in pairs(heroBulletDamageData) do
     for i,a in pairs(heroBulletDamageData) do
    local BulletDamage = a["BulletDamage"] or 0
         z = z..
         z = z..
             "|- \n"..
             "|- \n"..
             "| style=\"text-align:left;\" | "..
             "| style=\"text-align:left;\" | "..
                 frame:expandTemplate{title="PageRef", args={a["Name"]}}..
                 frame:expandTemplate{title="PageRef", args={a["Name"]}}..
                 " || "..a["BulletDamage"].." || +"..a["LevelScaling>BulletDamage"].." || "..
                 " || "..BulletDamage.." || +".."LevelScaling>BulletDamage".." || "..
                 tostring(roundValue(tonumber(a["BulletDamage"])+tonumber(a["LevelScaling>BulletDamage"])*soul_unlock.get_max('PowerIncrease'))).." \n"
                 tostring(roundValue(tonumber(a["BulletDamage"])+tonumber(a["LevelScaling>BulletDamage"])*soul_unlock.get_max('PowerIncrease'))).." \n"
     end
     end
Line 307: Line 319:


     for i,a in pairs(heroDashData) do
     for i,a in pairs(heroDashData) do
    local GroundDashDuration = a["GroundDashDuration"] or 0
         z = z..
         z = z..
             "|- \n"..
             "|- \n"..