Editing Module:Sandbox/One Bar

Warning: You are not logged in. Once you make an edit, a temporary account will be created for you. Learn more. Log in or create an account to continue receiving notifications after this account expires, and to access other features.
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 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 ability_data = mw.loadJsonData("Data:AbilityCards.json")
local soul_unlocks_data = mw.loadJsonData("Data:SoulUnlockData.json")


local function format_spirit_scale(frame, key, base, scale)
local level_scaling_key_to_name = {
local spirit_scale = frame:expandTemplate{ title = "ss", args = {(scale or 0)}}
BulletDamage = "Bullet Damage",
return key ..": ".. (base or 0) .. "+" .. spirit_scale .. "\n"
MaxHealth = "Health",
end
TechPower = "Spirit Power",
LightMeleeDamage = "Light Melee Damage",
HeavyMeleeDamage = "Heavy Melee Damage"
}


local function get_stats_spirit_scaling(frame, hero)
-- Not in HeroData.json although Shiv is just (bullet damage * 12)
local spirit_scaling = hero["SpiritScaling"]
local alt_fires = {
stats_text = ""
Shiv = {base = 59.4, level = 2.64, suffix = "alt fire 12 pellets"},
if (spirit_scaling ~= nil) then
Viscous = {base = 70, level = 0.9, suffix = "alt fire AOE"},
for k, v in pairs(spirit_scaling) do
Yamato = {base = 70, level = 0.35, suffix = "alt fire AOE"}
stats_text = stats_text .. format_spirit_scale(frame, k, hero[k], v)
}
end
else
stats_text = "-"
end
return stats_text
end


local function get_abilities_spirit_scaling(frame, hero_key, hero)
p.pi_table = function(frame)
local ret = {}
local pi_souls_list = get_pi_list()
for i=1,4 do
for _, v in ipairs(soul_unlocks_data) do
local ability = ability_data[hero_key][i]
if (v["PowerIncrease"]) then
local ability_text = ""
table.insert(pi_souls_list, v["RequiredSouls"])
if (ability ~= nil) then
ret[i*2-1] = ability["Name"]
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 and prop["Scale"]["Type"] == "spirit" and prop["Scale"]["Value"] ~= 0) then
ability_text = ability_text .. format_spirit_scale(frame, prop["Name"], prop["Value"], prop["Scale"]["Value"])
end
end
end
else
ret[i*2-1] = "-"
end
if (ability_text == "") then
ability_text = "-"
end
end
ret[i*2] = ability_text
end
end
return ret
local level_count = 0
end
for _ in ipairs(pi_souls_list) do level_count = level_count + 1 end
 
-- Outputs a wikitable of heroes and their stats' and abilities' spirit scaling
local filtered_heroes = filtered_heroes()
-- @function  p.write_spirit_scaling_table
for _, hero in pairs(heroes_data) do
-- @param      {}
if (not hero["IsDisabled"]) then
-- @return    {string}
table.insert(filtered, hero)
p.write_spirit_scaling_table = function(frame)
local filtered_heroes = {}
local hero_keys = {}
for hero_key, hero in pairs(heroes_data) do
if (not hero["IsDisabled"] and not hero["InDevelopment"]) then
local hero_data = {["hero"] = hero; ["hero_key"] = hero_key}
table.insert(filtered_heroes, hero_data)
end
end
end
end
table.sort(filtered_heroes, function(a, b) return a.hero.Name:lower() < b.hero.Name:lower() end)
local create_table = mw.html.create("table"):addClass("wikitable sortable"):done()
local property = frame.args[1] --frame:getParent().args[1]
local header = mw.html.create("tr")
local name = level_scaling_key_to_name[property]
header
local suffix = property == "BulletDamage" and " (Full Shot)" or ""
:tag("th"):wikitext("Hero"):done()
:tag("th"):attr("colspan", 2):wikitext("First Skill"):done()
local create_div = mw.html.create("div"):css("overflow-x", "auto")
:tag("th"):attr("colspan", 2):wikitext("Second Skill"):done()
local create_table = mw.html.create("table"):addClass("wikitable sortable mw-collapsible mw-collapsed"):done()
:tag("th"):attr("colspan", 2):wikitext("Third Skill"):done()
:tag("th"):attr("colspan", 2):wikitext("Ultimate"):done()
local title_header = mw.html.create("tr")
create_table:node(header)
title_header:tag("th"):attr("colspan", (level_count + 3)):wikitext("Base " .. name .. " based on PI"):done()
create_table:node(title_header)
local label_header = mw.html.create("tr")
label_header
:tag("th"):attr("rowspan", 2):wikitext("Hero"):done()
:tag("th"):attr("rowspan", 2):wikitext("Base " .. name .. suffix):done()
:tag("th"):attr("rowspan", 2):wikitext("PL Increase" .. suffix):done()
:tag("th"):attr("colspan", level_count):wikitext("Souls Collected"):done()
create_table:node(label_header)
local souls_header = mw.html.create("tr")
for _, v in ipairs(pi_souls_list) do
local souls_formatted = string.format("%.1fK", (v + 400) / 1000)
souls_formatted = frame:expandTemplate{ title = "Souls", args = {souls_formatted}}
souls_header:tag("th"):wikitext(souls_formatted):done()
end
create_table:node(souls_header)
for _, hero_data in ipairs(filtered_heroes) do
for _, hero in ipairs(filtered_heroes) do
local hero = hero_data.hero
local base = math.floor((hero[property] or 0) * 100) / 100
local hero_key = hero_data.hero_key
local level = math.floor(hero["LevelScaling"][property] * 100) / 100
local shots = hero["BulletsPerShot"]
local burst = hero["BulletsPerBurst"]
local bullet_mult = shots * burst
local hero_icon = frame:expandTemplate{ title = "HeroIcon", args = {hero["Name"]}}
local hero_suffix = ""
if (property == "BulletDamage" and bullet_mult > 1) then
base = base * bullet_mult
level = level * bullet_mult
if (shots > 1) then hero_suffix = hero_suffix .. " (" .. shots .. " pellets)" end
if (burst > 1) then hero_suffix = hero_suffix .. " (" .. burst .. " bullets)" end
end
local hero_row = mw.html.create("tr")
local hero_row = mw.html.create("tr")
local hero_icon = frame:expandTemplate{ title = "HeroIcon", args = {hero["Name"]}}
hero_row
hero_row:tag('td'):wikitext(hero_icon):done()
:tag("td"):wikitext(hero_icon .. hero_suffix):done()
local abilities = get_abilities_spirit_scaling(frame, hero_key, hero)
:tag("td"):wikitext(base):done()
for i=1,8 do
:tag("td"):wikitext("+" .. level):done()
hero_row:tag('td'):wikitext(abilities[i]):done()
for i, v in ipairs(pi_souls_list) do
local total = (tonumber(base) ~= nil and base or 0) + (tonumber(level) ~= nil and level or 0)  * i
hero_row
:tag("td"):wikitext(total):done()
end
end
create_table:node(hero_row)
create_table:node(hero_row)
if (property == "BulletDamage" and alt_fires[hero["Name"]] ~= nil) then
local alt_fire = alt_fires[hero["Name"]]
local alt_base = alt_fire["base"]
local alt_level = alt_fire["level"]
local alt_suffix = " (" .. alt_fire["suffix"] .. ")"
local alt_fire_row = mw.html.create("tr")
alt_fire_row
:tag("td"):wikitext(hero_icon .. alt_suffix):done()
:tag("td"):wikitext(alt_base):done()
:tag("td"):wikitext("+" .. alt_level):done()
for i, v in ipairs(pi_souls_list) do
local total = alt_base + alt_level * i
alt_fire_row:tag("td"):wikitext(total):done()
end
create_table:node(alt_fire_row)
end
end
end
return tostring(create_table)
create_div:node(create_table)
return tostring(create_div)
end
end


Please note that all contributions to The Deadlock Wiki are considered to be released under the Creative Commons Attribution-NonCommercial-ShareAlike (see Deadlock:Copyrights for details). If you do not want your writing to be edited mercilessly and redistributed at will, then do not submit it here.
You are also promising us that you wrote this yourself, or copied it from a public domain or similar free resource. Do not submit copyrighted work without permission!
Cancel Editing help (opens in new window)
Preview page with this template

Page included on this page: