mNo edit summary |
RogerDodger (talk | contribs) No edit summary |
||
(13 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
local p = {} | 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 = { | 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 }, | ||
{ "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. | p.versions = versions | ||
local | |||
return p. | p.date = function(frame) | ||
local v = frame.args[1] | |||
return p._date(v) | |||
end | end | ||
p. | 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 frame = mw.getCurrentFrame() | ||
local | local lists = {} | ||
for | local major = "4" | ||
local | local str = "" | ||
local | 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 | ||
end | end | ||
p. | p.prev = function(frame) | ||
local v = frame.args[1] | local v = frame.args[1] | ||
return p. | return p._prev(v) | ||
end | end | ||
p. | 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 | ||
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