Module:Patch

From Wavu Wiki, the 🌊 wavy Tekken wiki

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 = {
	{ "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

return p