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 4: | Line 4: | ||
local ability_data = mw.loadJsonData("Data:AbilityCards.json") | local ability_data = mw.loadJsonData("Data:AbilityCards.json") | ||
p.write_spirit_scaling_table = function(frame) | |||
local | local pi_souls_list = {} | ||
for _, v in ipairs(soul_unlocks_data) do | |||
if (v["PowerIncrease"]) then | |||
table.insert(pi_souls_list, v["RequiredSouls"]) | |||
end | end | ||
end | end | ||
local level_count = 0 | |||
for _ in ipairs(pi_souls_list) do level_count = level_count + 1 end | |||
local | |||
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() | ||
local title_header = mw.html.create("tr") | |||
title_header:tag("th"):attr("colspan", (level_count + 3)):wikitext("Base " .. name .. " based on PI"):done() | |||
create_table:node(title_header) | |||
local header = mw.html.create("tr") | local header = mw.html.create("tr") | ||
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 36: | ||
create_table:node(header) | create_table:node(header) | ||
for | for hero_key, hero in pairs(filtered_heroes) do | ||
local | local test = hero["Spirit Scaling"] | ||
local hero_row = mw.html.create("tr") | local hero_row = mw.html.create("tr") | ||
stats_text = "" | |||
hero_row:tag('td'):wikitext( | if (hero["SpiritScaling"] ~= nil and next(hero["SpiritScaling"]) ~= nil) then | ||
local | for k, v in ipairs(hero["SpiritScaling"]) do | ||
stats_text = stats_text .. k ..": ".. hero[k] .. "+" .. v .. "\n" | |||
hero_row:tag('td'):wikitext( | end | ||
else | |||
stats_text = "-" | |||
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 | |||
hero_row:tag('td'):wikitext(ability_text):done() | |||
end | end | ||
create_table:node(hero_row) | create_table:node(hero_row) | ||