Jump to content
Main menu
Main menu
move to sidebar
hide
Navigation
Main page
Discord server
Recent changes
Random page
Community
Discord
Steam
Search
Search
English
Appearance
Create account
Log in
Personal tools
Create account
Log in
Pages for logged out editors
learn more
Contributions
Talk
Editing
Module:Changelog
Module
Discussion
English
Read
Edit source
View history
Tools
Tools
move to sidebar
hide
Actions
Read
Edit source
View history
General
What links here
Related changes
Special pages
Page information
Languages
Appearance
move to sidebar
hide
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
local p = {}; local date_module = require('Module:Date') local changelog_configs = mw.loadJsonData("Data:ChangelogConfigs.json") local tag_tree = mw.loadJsonData("Data:ChangelogTagTree.json") local dictionary_module = require('Module:Dictionary') -- Takes in changelog_configs -- Returns [oldest_id, next_oldest_id, ..., newest_id] local function get_ordered_ids(data) -- Collect the keys into a table local keys = {} for key in pairs(data) do table.insert(keys, key) end -- Sort the keys (ascending order) table.sort(keys) -- Build an ordered array local ordered_array = {} for _, key in ipairs(keys) do table.insert(ordered_array, key) end return ordered_array end --Global scope local ordered_ids = get_ordered_ids(changelog_configs) --Only Data:Changelog_05-03-2024.json is loaded right now, as it still needs work and for now it was uploaded manually, need an uploader script to handle it --Returns all lines of a given date that has that tag local function write_changelog_lines(id, config, tag_to_filter) -- Get the data for the respective line local changelog_data = mw.loadJsonData(id_to_changelog_data_page(id)) local lines = "" for index, line in ipairs(changelog_data) do description = line["Description"] if tag_to_filter == 'All' then lines = lines .. description .. "\n" else for index2, tag in ipairs(line["Tags"]) do if tag == tag_to_filter then lines = lines .. description .. "\n" end end end end return lines end -- Write changelogs table p.write_changelog_by_tag = function(frame) tag = frame.args[1] num_dates_str = frame.args[2] local num_dates if (tag == nil) then return "tag parameter must be provided" end if (num_dates_str ~= nil) then num_dates = tonumber(num_dates_str) if (num_dates == nil) then return "num_dates parameter must be numerical" end end local template_title = "Update history table" local template_args = {} local content = "\n" -- Write changelog for each date for index, id in ipairs(ordered_ids) do config = changelog_configs[id] if (num_dates_str ~= nil and index > num_dates) then break else local date = config["date"] local frontfacing_date_id = config["frontfacing_date_id"] local template_title_row = "Update history table/row" local template_args_row = {} local changes --05-03-2024 to May 3, 2024 template_args_row["update"] = frontfacing_date_id template_args_row["changes"] = write_changelog_lines(id, config, tag) if (template_args_row["changes"] ~= "") then changes = frame:expandTemplate{ title = template_title_row, args = template_args_row } else changes = "" end content = content .. frame:preprocess(changes) .. "\n" end index = index+1 end template_args["contents"] = content return frame:expandTemplate{ title = template_title, args = template_args } end function id_to_changelog_data_page(id) return "Data:Changelog " .. id .. ".json" end --Shows all changelog date data pages as a list of pages p.write_data_pages_list = function(frame) local str = "" for i, id in ipairs(ordered_ids) do str = str .. "[[" .. id_to_changelog_data_page(id) .. "]]<br>" end return str end p.write_changelog_by_date_id = function(frame) local req_date_id = frame.args[1] --req = requested, as this is the requested changelog local config = changelog_configs[req_date_id] if config == nil then return "date id " .. req_date_id .. " not found" end local frontfacing_req_date_id = config["frontfacing_date_id"] local req_is_herolab = config["is_hero_lab"] -- Determine the previous and next update -- Find the index in dates list --ordered_ids defined at global scope local previous_ff_id = '' local the_ff_id = '' local next_ff_id = '' local id_found = false local frontfacing_date_id local is_herolab for i, id in ipairs(ordered_ids) do frontfacing_date_id = changelog_configs[id]["frontfacing_date_id"] is_herolab = changelog_configs[id]["is_hero_lab"] if is_herolab == req_is_herolab then --only look at herolab or non-herolab patches, not mix and match if frontfacing_date_id == frontfacing_req_date_id then --id found the_ff_id = frontfacing_date_id the_id = id id_found = true elseif id_found and next_ff_id == '' then --on next iteration, save the next id next_ff_id = frontfacing_date_id break end if not id_found then previous_ff_id = frontfacing_date_id -- only update previous if the_id isnt found end end end if not id_found then return "date_id " .. req_date_id .. " not found" end local template_title = 'Update layout' local template_args = { ['prev_update'] = prev_ff_id, ['current_update'] = the_ff_id, ['next_update'] = next_ff_id, ['source'] = config[link], ['source_title'] = the_ff_id .. ' Update', ['is_herolab'] = req_is_herolab, ['notes'] = frame:preprocess(write_changelog_lines(the_id, config, 'All')) } return frame:expandTemplate{title = template_title, args = template_args} end p.get_last_updated = function(frame) local tag_to_search = frame.args[1] local last_or_first = frame.args["last_or_first"] if last_or_first == nil or last_or_first == 'last' then last_or_first = 'last' else last_or_first = 'first' end local list = {} if last_or_first == 'last' then list = ordered_ids else -- Create the list in reverse for i = #ordered_ids, 1, -1 do table.insert(list, ordered_ids[i]) end end -- Iterate changelog dates local frontfacing_date_id for i, id in ipairs(list) do -- Get frontfacing date from id frontfacing_date_id = changelog_configs[id]["frontfacing_date_id"] -- If next changelog data page doesn't yet exist, return latest page that exists local page_name = id_to_changelog_data_page(id) local title = mw.title.new(page_name) if not (title and title.exists) then return '[[Update:' .. frontfacing_date_id .. '|' .. frontfacing_date_id .. ']]' end local changelog_data = mw.loadJsonData(page_name) -- Iterate lines for _, line in ipairs(changelog_data) do local tags = line['Tags'] -- Iterate tags for _, tag in ipairs(tags) do if tag_to_search == tag then return '[[Update:' .. frontfacing_date_id .. '|' .. frontfacing_date_id .. ']]' end end end end return dictionary_module.translate('N/A') end function p.write_tag_tree(frame) return p.write_branch(tag_tree, 1) end function p.write_branch(branch, depth) local list_str = "" if branch == nil then return "" end for parent, children in pairs(branch) do -- If parent starts with < or ends with >, its referencing individual page -- the link won't work, so instead we just display the parent raw local parent_str if string.sub(parent, 1, 1) == '<' or string.sub(parent, -1) == '>' then parent_str = parent else parent_str = string.format("[[%s#Update history|%s]]", parent, parent) end list_str = list_str .. string.rep("*", depth) .. parent_str .. "\n" if children ~= nil then list_str = list_str .. p.write_branch(children, depth+1) end end return list_str end return p
Summary:
Please note that all contributions to 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
Templates used on this page:
Template:PageRef
(
edit
)
Template:Update history table
(
edit
)
Template:Update history table/row
(
edit
)
Template:Update layout
(
edit
)
Module:Changelog
(
edit
)
Module:Changelog/doc
(
edit
)
Module:Date
(
edit
)
Module:Dictionary
(
edit
)
Module:PageRef
(
edit
)
Data:ChangelogConfigs.json
(
edit
)
Data:ChangelogTagTree.json
(
edit
)
Data:Changelog 2024-05-03.json
(
edit
)
Data:Changelog 2024-05-10.json
(
edit
)
Data:Changelog 2024-05-13.json
(
edit
)
Data:Changelog 2024-05-16.json
(
edit
)
Data:Changelog 2024-05-19.json
(
edit
)
Data:Changelog 2024-05-23.json
(
edit
)
Data:Changelog 2024-05-24.json
(
edit
)
Data:Changelog 2024-05-30.json
(
edit
)
Data:Changelog 2024-06-01.json
(
edit
)
Data:Changelog 2024-06-06.json
(
edit
)
Data:Changelog 2024-06-07.json
(
edit
)
Data:Changelog 2024-06-13.json
(
edit
)
Data:Changelog 2024-06-14.json
(
edit
)
Data:Changelog 2024-06-16.json
(
edit
)
Data:Changelog 2024-06-20.json
(
edit
)
Data:Dictionary
(
edit
)
Data:LangCodes.json
(
edit
)
This page is a member of a hidden category:
Category:Pages with broken file links