Module:Sandbox/One Bar: Difference between revisionsGive feedback
No edit summary |
No edit summary |
||
| 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") | ||
local function format_spirit_scale(frame, key, base, scale) | |||
local spirit_scale = frame:expandTemplate{ title = "ss", args = {(scale or 0)}} | |||
return key ..": ".. (base or 0) .. "+" .. spirit_scale .. "\n" | |||
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 35: | Line 40: | ||
if (spirit_scaling ~= nil) then | if (spirit_scaling ~= nil) then | ||
for k, v in pairs(spirit_scaling) do | for k, v in pairs(spirit_scaling) do | ||
stats_text = stats_text .. (k | stats_text = stats_text .. format_spirit_scale(k, hero[k], v) | ||
end | end | ||
else | else | ||
| Line 51: | Line 56: | ||
for _, prop in ipairs(ability["Info1"]["Main"]["Props"]) do | for _, prop in ipairs(ability["Info1"]["Main"]["Props"]) do | ||
if (prop["Scale"] ~= nil and next(prop["Scale"]) ~= nil) then | if (prop["Scale"] ~= nil and next(prop["Scale"]) ~= nil) then | ||
ability_text = ability_text .. (prop["Name"] | ability_text = ability_text .. format_spirit_scale(prop["Name"], prop["Value"], prop["Scale"]["Value"]) | ||
end | end | ||
end | end | ||