Editing Module:Sandbox/One BarGive feedback
Jump to navigation
Jump to search
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 7: | Line 7: | ||
local spirit_scale = frame:expandTemplate{ title = "ss", args = {(scale or 0)}} | local spirit_scale = frame:expandTemplate{ title = "ss", args = {(scale or 0)}} | ||
return key ..": ".. (base or 0) .. "+" .. spirit_scale .. "\n" | return key ..": ".. (base or 0) .. "+" .. spirit_scale .. "\n" | ||
end | end | ||
| Line 54: | Line 15: | ||
p.write_spirit_scaling_table = function(frame) | p.write_spirit_scaling_table = function(frame) | ||
local filtered_heroes = {} | local filtered_heroes = {} | ||
for hero_key, hero in pairs(heroes_data) do | for hero_key, hero in pairs(heroes_data) do | ||
if (not hero["IsDisabled | if (not hero["IsDisabled"]) then | ||
filtered_heroes[hero_key] = hero | |||
end | end | ||
end | end | ||
local create_table = mw.html.create("table"):addClass("wikitable sortable"):done() | local create_table = mw.html.create("table"):addClass("wikitable sortable"):done() | ||
| Line 67: | Line 25: | ||
header | header | ||
:tag("th"):wikitext("Hero"):done() | :tag("th"):wikitext("Hero"):done() | ||
:tag("th"):wikitext("Stats"):done() | |||
:tag("th"):attr("colspan", 2):wikitext("First Skill"):done() | :tag("th"):attr("colspan", 2):wikitext("First Skill"):done() | ||
:tag("th"):attr("colspan", 2):wikitext("Second Skill"):done() | :tag("th"):attr("colspan", 2):wikitext("Second Skill"):done() | ||
| Line 73: | Line 32: | ||
create_table:node(header) | create_table:node(header) | ||
for | for hero_key, hero in pairs(filtered_heroes) do | ||
local | local hero_icon = frame:expandTemplate{ title = "HeroIcon", args = {hero["Name"]}} | ||
local | 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() | hero_row:tag('td'):wikitext(hero_icon):done() | ||
stats_text = "" | |||
for i=1, | if (spirit_scaling ~= nil) then | ||
hero_row:tag('td'):wikitext( | for k, v in pairs(spirit_scaling) do | ||
stats_text = stats_text .. format_spirit_scale(frame, k, hero[k], v) | |||
end | |||
else | |||
stats_text = "-" | |||
end | |||
hero_row:tag('td'):wikitext(stats_text):done() | |||
for i=1,4 do | |||
local ability = ability_data[hero_key][i] | |||
hero_row:tag('td'):wikitext(ability["Name"]):done() | |||
local ability_text = "" | |||
-- Nowhere close to all the instances of ability spirit scaling | |||
-- probably too much nil check but I want the table to print for now | |||
if (ability["Info1"] ~= nil and ability["Info1"]["Main"] ~= nil | |||
and ability["Info1"]["Main"]["Props"] ~= nil) then | |||
for _, prop in ipairs(ability["Info1"]["Main"]["Props"]) do | |||
if (prop["Scale"] ~= nil) then | |||
ability_text = ability_text .. format_spirit_scale(frame, prop["Name"], prop["Value"], prop["Scale"]["Value"]) | |||
end | |||
end | |||
else | |||
ability_text = "-" | |||
end | |||
hero_row:tag('td'):wikitext(ability_text):done() | |||
end | end | ||
create_table:node(hero_row) | create_table:node(hero_row) | ||