|
|
| Line 3: |
Line 3: |
| local heroes_data = mw.loadJsonData("Data:HeroData.json") | | local heroes_data = mw.loadJsonData("Data:HeroData.json") |
| local ability_data = mw.loadJsonData("Data:AbilityCards.json") | | local ability_data = mw.loadJsonData("Data:AbilityCards.json") |
|
| |
| -- Outputs a string list of gun stats from heroes with either spreadshot or burst fire
| |
| -- @function p.write_multishot_stats
| |
| -- @param {}
| |
| -- @return {string}
| |
| p.write_multishot_stats = function(frame)
| |
| local function hero_sort(h1, h2)
| |
| return h1["Name"] < h2["Name"]
| |
| end
| |
| local spreadshot_heroes = {}
| |
| local burst_heroes = {}
| |
| for _, hero in pairs(heroes_data) do
| |
| if (hero["BulletsPerShot"] > 1 and not hero["IsDisabled"]) then
| |
| table.insert(spreadshot_heroes, hero)
| |
| elseif (hero["BulletsPerBurst"] > 1 and not hero["IsDisabled"]) then
| |
| table.insert(burst_heroes, hero)
| |
| end
| |
| end
| |
|
| |
| table.sort(spreadshot_heroes, hero_sort)
| |
| table.sort(burst_heroes, hero_sort)
| |
|
| |
| local multishot_str = "Weapons with multiple projectiles (Spreadshot):\n"
| |
| for _, hero in ipairs(spreadshot_heroes) do
| |
| local base = math.floor(hero["BulletDamage"] * 100) / 100
| |
| local level = math.floor(hero["LevelScaling"]["BulletDamage"] * 100) / 100
| |
| local shots = hero["BulletsPerShot"]
| |
| local hero_icon = frame:expandTemplate{ title = "HeroIcon", args = {hero["Name"]}}
| |
| local stat_str = "* " .. hero_icon .. ": " .. shots .. " pellets, "
| |
| .. base .. "/pellet, +" .. level .. "/pellet\n"
| |
| multishot_str = multishot_str .. stat_str
| |
| end
| |
|
| |
| multishot_str = multishot_str .. "Weapons with burst fire (Burst Fire):\n"
| |
| for _, hero in ipairs(burst_heroes) do
| |
| local base = math.floor(hero["BulletDamage"] * 100) / 100
| |
| local level = math.floor(hero["LevelScaling"]["BulletDamage"] * 100) / 100
| |
| local shots = hero["BulletsPerBurst"]
| |
| local hero_icon = frame:expandTemplate{ title = "HeroIcon", args = {hero["Name"]}}
| |
| local stat_str = "* " .. hero_icon .. ": " .. shots .. " rounds, "
| |
| .. base .. "/bullet, +" .. level .. "/bullet\n"
| |
| multishot_str = multishot_str .. stat_str
| |
| end
| |
|
| |
| return multishot_str
| |
| end
| |
|
| |
|
| -- Outputs a wikitable of heroes and their stats' and abilities' spirit scaling | | -- Outputs a wikitable of heroes and their stats' and abilities' spirit scaling |
| Line 80: |
Line 34: |
| stats_text = "" | | stats_text = "" |
| if (spirit_scaling ~= nil and next(spirit_scaling) ~= nil) then | | if (spirit_scaling ~= nil and next(spirit_scaling) ~= nil) then |
| for k, v in ipairs(spirit_scaling) do | | for k, v in pairs(spirit_scaling) do |
| stats_text = stats_text .. k ..": ".. hero[k] .. "+" .. v .. "\n" | | stats_text = stats_text .. k ..": ".. hero[k] .. "+" .. v .. "\n" |
| end | | end |