Genshin Impact Wiki
Genshin Impact Wiki
m (Housekeeping)
(test sunday)
Line 35: Line 35:
 
out = out .. "[[" .. mat_type .. " Books|" .. mat_type .. "]]"
 
out = out .. "[[" .. mat_type .. " Books|" .. mat_type .. "]]"
 
out = out .."|| {{User:Ginslon/Cards by Category 2|Playable Characters&Talents Leveled with " .. mat .. "}}"
 
out = out .."|| {{User:Ginslon/Cards by Category 2|Playable Characters&Talents Leveled with " .. mat .. "}}"
  +
else
  +
local mat = parent[param]
  +
--out = "{{Item Group|" .. (parent["mon-3"]:gsub("Guide to ", "")) .. "|30}}<br />"
  +
local mat_type = parent["mon-3"]:gsub("Guide to ", "")
  +
out = out .. "[[" .. mat_type .. " Books|" .. mat_type .. "]]<br />"
  +
mat_type = parent["tue-3"]:gsub("Guide to ", "")
  +
out = out .. "[[" .. mat_type .. " Books|" .. mat_type .. "]]<br />"
  +
mat_type = parent["wed-3"]:gsub("Guide to ", "")
  +
out = out .. "[[" .. mat_type .. " Books|" .. mat_type .. "]"
  +
  +
out = out .."|| {{User:Ginslon/Cards by Category 2|Talents Leveled with " .. parent["mon-3"]
  +
.. "{{!}}Talents Leveled with " .. parent["tue-3"]
  +
.. "{{!}}Talents Leveled with " .. parent["wed-3"] .. "}}"
 
end
 
end
   

Revision as of 23:27, 17 September 2021

Documentation icon Module documentation

The documentation for this module is missing. Click here to create it.

--wip
local p = {}

function p.main(frame)
	local parent = frame:getParent().args
	--local title = mw.title.getCurrentTitle().text

	--handle resets
	local now = os.time()
	--local day = os.date("%A")
	local day = p.getDay(frame)

	--get material
	local param = ""
	--param = "mon-2"

	if day == "Monday" or day == "Thursday" then
		param = "mon-3"
	elseif day == "Tuesday" or day == "Friday" then
		param = "tue-3"
	elseif day == "Wednesday" or day == "Saturday" then
		param = "wed-3"
	end

	local out = ""
	if day ~= "Sunday" then
		local mat = parent[param]
		--local mat = parent["mon-2"]
		--local out = title .. " || " .. "{{Icons by Category|Playable Characters&Talents Leveled with " .. mat .. "|50}}"
		--local out = "{{Icons by Category|Playable Characters&Talents Leveled with " .. mat .. "|50}}"

		--out = "[[" .. mat .. "]] || {{User:Ginslon/Cards by Category|Playable Characters&Talents Leveled with " .. mat .. "|50}}"
		local mat_type = mat:gsub("Guide to ", "")
		out = "{{Item Group|" .. mat_type .. "|30}}<br />"
		out = out .. "[[" .. mat_type .. " Books|" .. mat_type .. "]]"
		out = out .."|| {{User:Ginslon/Cards by Category 2|Playable Characters&Talents Leveled with " .. mat .. "}}"
	else
		local mat = parent[param]
		--out = "{{Item Group|" .. (parent["mon-3"]:gsub("Guide to ", "")) .. "|30}}<br />"
		local mat_type = parent["mon-3"]:gsub("Guide to ", "")
		out = out .. "[[" .. mat_type .. " Books|" .. mat_type .. "]]<br />"
		mat_type = parent["tue-3"]:gsub("Guide to ", "")
		out = out .. "[[" .. mat_type .. " Books|" .. mat_type .. "]]<br />"
		mat_type = parent["wed-3"]:gsub("Guide to ", "")
		out = out .. "[[" .. mat_type .. " Books|" .. mat_type .. "]"
		
		out = out .."|| {{User:Ginslon/Cards by Category 2|Talents Leveled with " .. parent["mon-3"] 
			.. "{{!}}Talents Leveled with " .. parent["tue-3"]
			.. "{{!}}Talents Leveled with " .. parent["wed-3"] .. "}}"
	end

	return out
end

function p.getDay(frame)
	local server = frame.args["server"]
	local now = os.time()
	local day = ""

	if server == "AS" then
		-- check this
		--day = os.date("%A", now+7200) --AS server, +2 hours
		day = os.date("%A", now+93600) --AS server, +26 hours
	elseif server == "EU" then
		day = os.date("%A", now-10800) --EU server, -3 hours
	else
		day = os.date("%A", now-32400) --NA server, -9 hours
	end

	return day
end

return p