Module:Sandbox/One Bar: Difference between revisionsGive feedback
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
| Line 2: | Line 2: | ||
local item_data = mw.loadJsonData("Data:ItemData.json") | local item_data = mw.loadJsonData("Data:ItemData.json") | ||
local heroes_data = mw.loadJsonData("Data:HeroData.json") | local heroes_data = mw.loadJsonData("Data:HeroData.json") | ||
local | local ability_data = mw.loadJsonData("Data:AbilityCards.json") | ||
p.write_spirit_scaling_table = function(frame) | |||
p. | |||
local pi_souls_list = {} | local pi_souls_list = {} | ||
for _, v in ipairs(soul_unlocks_data) do | for _, v in ipairs(soul_unlocks_data) do | ||
| Line 30: | Line 15: | ||
local filtered_heroes = {} | local filtered_heroes = {} | ||
for | for hero_key, hero in pairs(heroes_data) do | ||
if (not hero["IsDisabled"]) then | 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 | |||
local title_header = mw.html.create("tr") | local title_header = mw.html.create("tr") | ||
title_header:tag("th"):attr("colspan", (level_count + 3)):wikitext("Base " .. name .. " based on PI"):done() | title_header:tag("th"):attr("colspan", (level_count + 3)):wikitext("Base " .. name .. " based on PI"):done() | ||
create_table:node(title_header) | create_table:node(title_header) | ||
local | local header = mw.html.create("tr") | ||
header | |||
:tag("th"):attr(" | :tag("th"):wikitext("Hero"):done() | ||
:tag("th"):attr(" | :tag("th"):wikitext("Stats"):done() | ||
:tag("th"):attr(" | :tag("th"):attr("colspan", 2):wikitext("First Skill"):done() | ||
:tag("th"):attr("colspan", | :tag("th"):attr("colspan", 2):wikitext("Second Skill"):done() | ||
create_table:node( | :tag("th"):attr("colspan", 2):wikitext("Third Skill"):done() | ||
:tag("th"):attr("colspan", 2):wikitext("Ultimate"):done() | |||
create_table:node(header) | |||
for hero_key, hero in pairs(filtered_heroes) do | |||
local test = hero["Spirit Scaling"] | |||
for | |||
local | |||
local hero_row = mw.html.create("tr") | local hero_row = mw.html.create("tr") | ||
stats_text = "" | |||
if (hero["SpiritScaling"] ~= nil and next(hero["SpiritScaling"]) ~= nil) then | |||
for k, v in ipairs(hero["SpiritScaling"]) do | |||
stats_text = stats_text .. k ..": ".. hero[k] .. "+" .. v .. "\n" | |||
end | |||
else | |||
stats_text = "-" | |||
end | end | ||
hero_row:tag('td'):wikitext(hero_text):done() | |||
for i=1,4 do | |||
local ability = ability_data[hero_key][tostring(i)] | |||
hero_row:tag('td'):wikitext(ability["Name"]):done() | |||
local ability_text = "" | |||
-- Nowhere close to all the instances of ability spirit scaling | |||
if (ability["Info1"]["Main"]["Props"] ~= nil and next(ability["Info1"]["Main"]["Props"]) ~= nil) then | |||
for _, prop in ipairs(ability["Info1"]["Main"]["Props"]) do | |||
if (prop["Scale"] ~= nil and next(prop["Scale"]) ~= nil) then | |||
ability_text = ability_text .. prop["Name"] ..": " .. prop["Value"] .. " + " .. prop["Scale"]["Value"] .. "\n" | |||
end | |||
end | |||
else | |||
ability_text = "-" | |||
end | end | ||
hero_row:tag('td'):wikitext(ability_text):done() | |||
end | end | ||
create_table:node(hero_row) | |||
end | end | ||
return tostring(create_table) | |||
return tostring( | |||
end | end | ||