Editing Module:LevelTables

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 1: Line 1:
local p = {};
local p = {};
local Icon = require('Module:Icon')
local Souls = require('Module:Souls')


-- Loads the necessary data from the wiki's JSON pages.
-- Loads the necessary data from the wiki's JSON pages.
Line 43: Line 40:
--]]
--]]
p.write_power_increase_table = function(frame)
p.write_power_increase_table = function(frame)
    -- Use the same smart sorting for this list.
local function hero_sort(h1, h2)
return get_sortable_name(h1.Name) < get_sortable_name(h2.Name)
end
-- Read and validate the arguments passed from the #invoke call.
-- Read and validate the arguments passed from the #invoke call.
local property = frame.args[1]
local property = frame.args[1]
Line 68: Line 61:
end
end
end
end
local max_boons = #pi_souls_list
local max_boons = #pi_souls_list
-- Define the milestones to display in the summary table.
-- Define the milestones to display in the summary table.
local milestones = {10, 20, max_boons}
local milestones = {10, 20, max_boons}
Line 77: Line 69:
local filtered_heroes = {}
local filtered_heroes = {}
for _, hero in pairs(heroes_data) do
for _, hero in pairs(heroes_data) do
if (not hero["IsDisabled"] and not hero["InDevelopment"] and hero["Name"]) then
if (not hero["IsDisabled"] and not hero["InDevelopment"]) then
table.insert(filtered_heroes, hero)
table.insert(filtered_heroes, hero)
end
end
Line 83: Line 75:
-- Sort the hero list alphabetically, ignoring "The " for proper sorting.
-- Sort the hero list alphabetically, ignoring "The " for proper sorting.
table.sort(filtered_heroes, hero_sort)
table.sort(filtered_heroes, function(a, b)
return get_sortable_name(a.Name) < get_sortable_name(b.Name)
end)
-- Begin building the main data table.
-- Begin building the main data table.
Line 101: Line 95:
local required_souls = pi_souls_list[count]
local required_souls = pi_souls_list[count]
local souls_formatted = string.format("%.1fK", (required_souls + 400) / 1000)
local souls_formatted = string.format("%.1fK", (required_souls + 400) / 1000)
local soul_display = Souls._render(souls_formatted)
local soul_display = frame:expandTemplate{ title = "Souls", args = {souls_formatted} }
local full_header = header_text .. "<br /><small>(" .. soul_display .. ")</small>"
local full_header = header_text .. "<br /><small>(" .. soul_display .. ")</small>"
header_row:tag("th"):wikitext(full_header):done()
header_row:tag("th"):wikitext(full_header):done()
Line 112: Line 106:
local function addHeroRows(hero_data, is_alt_fire)
local function addHeroRows(hero_data, is_alt_fire)
local base, level, suffix
local base, level, suffix
local hero_icon_wikitext = Icon._render(hero_data['Name'])
local hero_icon_wikitext = frame:expandTemplate{ title = "HeroIcon", args = {hero_data["Name"]}}
-- Determine if this is a main weapon or an alt-fire and set the correct data.
-- Determine if this is a main weapon or an alt-fire and set the correct data.
Line 179: Line 173:
local required_souls = pi_souls_list[i]
local required_souls = pi_souls_list[i]
local souls_formatted = string.format("%.1fK", (required_souls + 400) / 1000)
local souls_formatted = string.format("%.1fK", (required_souls + 400) / 1000)
local soul_display = Souls._render(souls_formatted)
local soul_display = frame:expandTemplate{ title = "Souls", args = {souls_formatted} }
local row_html = string.format("<tr><td>%s</td><td style='text-align:right;'>%.2f</td></tr>", soul_display, total)
local row_html = string.format("<tr><td>%s</td><td style='text-align:right;'>%.2f</td></tr>", soul_display, total)
Line 311: Line 305:
local shots = get_stat_value(hero, "BulletsPerShot")
local shots = get_stat_value(hero, "BulletsPerShot")
local hit_once = get_stat_value(hero, "HitOnceAcrossAllBullets")
local hit_once = get_stat_value(hero, "HitOnceAcrossAllBullets")
local hero_icon = Icon._render(hero["Name"])
local hero_icon = frame:expandTemplate{ title = "HeroIcon", args = {hero["Name"]}}
-- Checks for the special property and changes the output text accordingly.
-- Checks for the special property and changes the output text accordingly.
Line 330: Line 324:
local level = math.floor(hero["LevelScaling"]["BulletDamage"] * 100) / 100
local level = math.floor(hero["LevelScaling"]["BulletDamage"] * 100) / 100
local shots = get_stat_value(hero, "BulletsPerBurst")
local shots = get_stat_value(hero, "BulletsPerBurst")
local hero_icon = Icon._render(hero["Name"])
local hero_icon = frame:expandTemplate{ title = "HeroIcon", args = {hero["Name"]}}
local stat_str = "* " .. hero_icon .. ": " .. shots .. " rounds, "  
local stat_str = "* " .. hero_icon .. ": " .. shots .. " rounds, "  
.. base .. "/bullet, +" .. level .. "/bullet\n"
.. base .. "/bullet, +" .. level .. "/bullet\n"
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