Module:Sandbox/One Bar: Difference between revisions

One Bar (talk | contribs)
No edit summary
One Bar (talk | contribs)
No edit summary
Line 4: Line 4:
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)
p.write_multishot_stats = function(frame)
local function hero_sort(h1, h2)  
local function hero_sort(h1, h2)  
Line 46: Line 50:
end
end


-- Outputs a wikitable of heroes and their stats' and abilities' spirit scaling
-- @function  p.write_spirit_scaling_table
-- @param      {}
-- @return    {string}
p.write_spirit_scaling_table = function(frame)
p.write_spirit_scaling_table = function(frame)
local filtered_heroes = {}
local filtered_heroes = {}
Line 66: Line 74:
for hero_key, hero in pairs(filtered_heroes) do
for hero_key, hero in pairs(filtered_heroes) do
local hero_icon = frame:expandTemplate{ title = "HeroIcon", args = {hero["Name"]}}
local spirit_scaling = hero["SpiritScaling"]
local spirit_scaling = hero["SpiritScaling"]
local hero_row = mw.html.create("tr")
local hero_row = mw.html.create("tr")
hero_row:tag('td'):wikitext(hero_icon):done()
stats_text = ""
stats_text = ""
if (spirit_scaling ~= nil and next(spirit_scaling) ~= nil) then
if (spirit_scaling ~= nil and next(spirit_scaling) ~= nil) then
Line 76: Line 86:
stats_text = "-"
stats_text = "-"
end
end
hero_row:tag('td'):wikitext(hero_text):done()
hero_row:tag('td'):wikitext(stats_text):done()
for i=1,4 do
for i=1,4 do
local ability = ability_data[hero_key][i]
local ability = ability_data[hero_key][i]