Module:Patch: Difference between revisions

From Wavu Wiki, the 🌊 wavy Tekken wiki
mNo edit summary
mNo edit summary
Line 8: Line 8:
{ "4.00", "10 Nov 2020" },
{ "4.00", "10 Nov 2020" },
{ "3.33", "19 Aug 2020" },
{ "3.33", "19 Aug 2020" },
{ "3.32", "17 Jun 2020" },
{ "3.31", "21 Apr 2020" },
{ "3.30", "20 Mar 2020" },
{ "3.21", "12 Feb 2020" },
{ "3.20", "28 Jan 2020" },
{ "3.10", "10 Dec 2019" },
{ "3.03", "12 Nov 2019" },
{ "3.01", "03 Oct 2019" },
}
}



Revision as of 18:22, 16 July 2021

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

local p = {}

-- Only including recent versions until the notes are tidied up, still big WIP
local versions = {
	{ "4.20", "27 May 2021" },
	{ "4.10", "22 Mar 2021" },
	{ "4.01", "26 Nov 2020" },
	{ "4.00", "10 Nov 2020" },
	{ "3.33", "19 Aug 2020" },
	{ "3.32", "17 Jun 2020" },
	{ "3.31", "21 Apr 2020" },
	{ "3.30", "20 Mar 2020" },
	{ "3.21", "12 Feb 2020" },
	{ "3.20", "28 Jan 2020" },
	{ "3.10", "10 Dec 2019" },
	{ "3.03", "12 Nov 2019" },
	{ "3.01", "03 Oct 2019" },
}

p.log = function(frame)
	local char = frame.args[1]
	return p._log(char)
end

p._log = function(char)
	local frame = mw.getCurrentFrame()
	local ret = ""
	for _, obj in ipairs(versions) do
		local version, date = obj[1], obj[2]
		local page = "Version " .. version
		
		local notes = ""
		
		local globalNotes = frame:callParserFunction{
			name = '#lsth',
			args = { page, "General changes" }
		}
		if globalNotes ~= "" then
			notes = notes .. globalNotes .. "\n"		
		end
		
		local charNotes = frame:callParserFunction{
			name = '#lsth',
			args = { page, char }
		}
		if charNotes ~= "" then
			notes = notes .. charNotes .. "\n"
		end
		
		if notes ~= "" then
			local h2 = "==" .. version .. ", " .. date .. "=="
			local hat = frame:expandTemplate{
				title = "Hatnote",
				args = { "Main article: [[" .. page .. "]]" }
			}
			ret = ret .. h2 .. "\n\n" .. hat .. "\n" .. notes
		end
	end
	
	return ret
end

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

p._date = function(v)
	for _, version in ipairs(versions) do
		if version[1] == v then
			return version[2]
		end
	end
	return ""
end

return p