Module:Patch: Difference between revisions

From Wavu Wiki, the 🌊 wavy Tekken wiki
No edit summary
No edit summary
 
(10 intermediate revisions by the same user not shown)
Line 1: Line 1:
local p = {}
local p = {}


-- Only including recent versions until the notes are tidied up, still big WIP
-- The bool param decides whether [[Module:Changelog]] checks the page when
-- creating a character's changelogs. Eventually won't be needed when all patch
-- notes are on wiki.
local versions = {
local versions = {
{ "4.20", "27 May 2021" },
{ "5.10", "13 Dec 2022", true },
{ "4.10", "22 Mar 2021" },
{ "5.01", "04 Oct 2022", true },
{ "4.01", "26 Nov 2020" },
{ "5.00", "17 Aug 2022", true },
{ "4.00", "10 Nov 2020" },
{ "4.20", "27 May 2021", true },
{ "3.33", "19 Aug 2020" },
{ "4.10", "22 Mar 2021", true },
{ "3.32", "17 Jun 2020" },
{ "4.01", "26 Nov 2020", true },
{ "3.31", "21 Apr 2020" },
{ "4.00", "10 Nov 2020", true },
{ "3.30", "20 Mar 2020" },
{ "3.33", "19 Aug 2020", true },
{ "3.21", "12 Feb 2020" },
{ "3.32", "17 Jun 2020", true },
{ "3.20", "28 Jan 2020" },
{ "3.31", "21 Apr 2020", true },
{ "3.10", "10 Dec 2019" },
{ "3.30", "20 Mar 2020", true },
{ "3.03", "12 Nov 2019" },
{ "3.21", "12 Feb 2020", true },
{ "3.01", "03 Oct 2019" },
{ "3.20", "28 Jan 2020", true },
{ "3.10", "10 Dec 2019", true },
{ "3.03", "12 Nov 2019", true },
{ "3.01", "03 Oct 2019", true },
{ "3.00", "05 Sep 2019", true },
{ "2.30", "30 May 2019" },
{ "2.20", "28 Feb 2019" },
{ "2.11", "14 Dec 2018" },
{ "2.10", "03 Dec 2018" },
{ "2.02", "01 Nov 2018" },
{ "2.00", "04 Sep 2018" },
{ "1.12", "21 Mar 2018" },
{ "1.08", "28 Sep 2017" },
}
}


p.versions = versions
p.versions = versions


p.log = function(frame)
p.date = function(frame)
local char = frame.args[1]
local v = frame.args[1]
return p._log(char)
return p._date(v)
end
 
p._date = function(v)
local i = p._find(v)
if i == nil then return "" end
return versions[i][2]
end
 
p._find = function(v)
for i, version in ipairs(versions) do
if version[1] == v then
return i
end
end
return nil
end
end


p._log = function(char)
p.navbox = function()
local frame = mw.getCurrentFrame()
local frame = mw.getCurrentFrame()
local ret = ""
local lists = {}
for _, obj in ipairs(versions) do
local major = "4"
local version, date = obj[1], obj[2]
local str = ""
local page = "Version " .. version
for i,obj in ipairs(versions) do
local v = obj[1]  
local notes = ""
local link = "[[Version " .. v .. "|" .. v .. "]]"
if string.find(v, "00") then link = "'''" .. link .. "'''" end
-- local globalNotes = frame:callParserFunction{
str = str .. "* " .. link .. "\n"
-- name = '#lsth',
end
-- args = { page, "General changes" }
return frame:preprocess(
-- }
"{{Navbox" ..
-- if globalNotes ~= "" then
"|heading1=[[Patches]] [[[Module:Patch|M]]]" ..
-- notes = notes .. globalNotes .. "\n"
"|marginTop=1.5rem|width=100%" ..
-- end
"|links1={{Dotlist|\n" .. str .. "}}}}"
)
local charNotes = frame:callParserFunction{
end
name = '#lsth',
 
args = { page, char }
p.next = function(frame)
}
local v = frame.args[1]
if charNotes ~= "" then
return p._next(v)
notes = notes .. charNotes .. "\n"
end
end
 
p._next = function(v)
if notes ~= "" then
local i = p._find(v)
local h2 = "==" .. version .. ", " .. date .. "=="
if i == nil then error("Version " .. v .. " not found") end
local hat = frame:expandTemplate{
local r = versions[i-1]
title = "Hatnote",
if r ~= nil then
args = { "Main article: [[" .. page .. "]]" }
return "[[Version " .. r[1] .. "]] "
}
else
ret = ret .. h2 .. "\n\n" .. hat .. "\n" .. notes
return "''(latest)''"
end
end
end
return ret
end
end


p.date = function(frame)
p.prev = function(frame)
local v = frame.args[1]
local v = frame.args[1]
return p._date(v)
return p._prev(v)
end
end


p._date = function(v)
p._prev = function(v)
for _, version in ipairs(versions) do
local i = p._find(v)
if version[1] == v then
if i == nil then error("Version " .. v .. " not found") end
return version[2]
local r = versions[i+1]
end
if r ~= nil then
return "← [[Version " .. r[1] .. "]]"
else
return "''(earliest)''"
end
end
return ""
end
end


return p
return p

Latest revision as of 09:39, 13 December 2022

Documentation for this module may be created at Module:Patch/doc

local p = {}

-- The bool param decides whether [[Module:Changelog]] checks the page when
-- creating a character's changelogs. Eventually won't be needed when all patch
-- notes are on wiki.
local versions = {
	{ "5.10", "13 Dec 2022", true },
	{ "5.01", "04 Oct 2022", true },
	{ "5.00", "17 Aug 2022", true },
	{ "4.20", "27 May 2021", true },
	{ "4.10", "22 Mar 2021", true },
	{ "4.01", "26 Nov 2020", true },
	{ "4.00", "10 Nov 2020", true },
	{ "3.33", "19 Aug 2020", true },
	{ "3.32", "17 Jun 2020", true },
	{ "3.31", "21 Apr 2020", true },
	{ "3.30", "20 Mar 2020", true },
	{ "3.21", "12 Feb 2020", true },
	{ "3.20", "28 Jan 2020", true },
	{ "3.10", "10 Dec 2019", true },
	{ "3.03", "12 Nov 2019", true },
	{ "3.01", "03 Oct 2019", true },
	{ "3.00", "05 Sep 2019", true },
	{ "2.30", "30 May 2019" },
	{ "2.20", "28 Feb 2019" },
	{ "2.11", "14 Dec 2018" },
	{ "2.10", "03 Dec 2018" },
	{ "2.02", "01 Nov 2018" },
	{ "2.00", "04 Sep 2018" },
	{ "1.12", "21 Mar 2018" },
	{ "1.08", "28 Sep 2017" },
}

p.versions = versions

p.date = function(frame)
	local v = frame.args[1]
	return p._date(v)
end

p._date = function(v)
	local i = p._find(v)
	if i == nil then return "" end
	return versions[i][2]
end

p._find = function(v)
	for i, version in ipairs(versions) do
		if version[1] == v then
			return i
		end
	end
	return nil
end

p.navbox = function()
	local frame = mw.getCurrentFrame()
	local lists = {}
	local major = "4"
	local str = ""
	for i,obj in ipairs(versions) do
		local v = obj[1] 
		local link = "[[Version " .. v .. "|" .. v .. "]]"
		if string.find(v, "00") then link = "'''" .. link .. "'''" end
		str = str .. "* " .. link .. "\n"
	end
	return frame:preprocess(
		"{{Navbox" ..
		"|heading1=[[Patches]] [[[Module:Patch|M]]]" ..
		"|marginTop=1.5rem|width=100%" ..
		"|links1={{Dotlist|\n" .. str .. "}}}}"
	)
end

p.next = function(frame)
	local v = frame.args[1]
	return p._next(v)
end

p._next = function(v)
	local i = p._find(v)
	if i == nil then error("Version " .. v .. " not found") end
	local r = versions[i-1]
	if r ~= nil then
		return "[[Version " .. r[1] .. "]] →"
	else
		return "''(latest)''"
	end
end

p.prev = function(frame)
	local v = frame.args[1]
	return p._prev(v)
end

p._prev = function(v)
	local i = p._find(v)
	if i == nil then error("Version " .. v .. " not found") end
	local r = versions[i+1]
	if r ~= nil then
		return "← [[Version " .. r[1] .. "]]"
	else
		return "''(earliest)''"
	end
end

return p