此处公告通常对读者进行申明或对该WIKI某些规则进行公告,请在确认后修改本通告
本WIKI编辑权限开放,欢迎收藏起来防止迷路,也希望有爱的小伙伴和我们一起编辑哟~
编辑帮助:目录 • BWIKI反馈留言板
此处公告通常对读者进行申明或对该WIKI某些规则进行公告,请在确认后修改本通告。本WIKI编辑权限开放,欢迎收藏起来防止迷路,也希望有爱的小伙伴和我们一起编辑哟~
模块:日历函数
此模块的文档可以在模块:日历函数/doc创建
local d
= require('模块:日历数据')
local colorTb = {
["里菲尼斯之塔"] = "#FF69B4",
["日常本3倍掉落"] = "#FFA500",
["无限池活动"] = "#B8BBDE",
["泳装卡池1"] = "#87CEFA",
["泳装卡池2"] = "#87CEFA",
["日常本up"] = "#ffc0cb",
["二周年纪念卡池第二弹"] = "#c2d94c",
["PICK UP卡池"] = "#2e9bdc",
["PICK UP卡池2"] = "#2e9bdc",
["PICK UP卡池3"] = "#ab69e3",
["常驻卡池"] = "#FF7C80",
["复刻卡池"] = "#FF9C9F",
["限定卡池"] = "#FF7C80",
["收集活动"] = "#f299ff",
["收集活动2"] = "#f299ff",
["讨伐活动"] = "#ff3a3a",
["种族交流会"] = "#FFFF99",
["种族交流战"] = "#FFFF99",
["材料本回数+1"] = "#FFA500",
["主线特别"] = "#808069",
["经验/金币掉落up"] = "#FFA500",
["合同演习掉落up"] = "#FFA500",
["挑战活动"] = "#FFA500",
["BOSS RUSH活动"] = "#bebebe",
["应援道具收集"] = "#de193f",
["阿波罗的英雄特训"] = "#d8c8d0",
["奈奈香卡池"] = "#e04a17",
["2周年box活动"] = "#37c3ff",
["萝萝特卡池"] = "#21b0f1",
["2周年限定卡池"] = "#ffed65",
["世界BOSS"] = "#a5fff7",
["天昇魔運頂上決戰"] = "#ff3a3a",
}
local p = {}
function p.getAllData(frame)
local dtTb = d.tb
local outStr = ""
for _, mTb in pairs(dtTb) do
for i=1,#mTb do
outStr = outStr .. p.getSpanStr(mTb,i)
end
end
return outStr
end
function p.getDataForWeekCalendar(frame)
local baseY = frame.args[1]
local baseM = frame.args[2]
local outStr = ""
--当月
outStr = outStr ..p.getDataByMonth(baseY .. string.format("%02d",baseM))
--前月
baseM = frame.args[2] -1
if baseM == 0 then
baseM = 12
baseY = frame.args[1] -1
end
outStr = outStr ..p.getDataByMonth(baseY .. string.format("%02d",baseM))
--下月
baseM = frame.args[2] +1
if baseM > 12 then
baseM = 1
baseY = frame.args[1] +1
end
outStr = outStr ..p.getDataByMonth(baseY .. string.format("%02d",baseM))
return outStr
end
function p.getDataByMonth(strYM)
local dtTb = d.tb
local outStr = ""
if dtTb[strYM] ~= nil then
for i=1,#dtTb[strYM] do
outStr = outStr .. p.getSpanStr(dtTb[strYM],i)
end
end
return outStr
end
function p.getSpanStr(dt,i)
local spanStr = "{0},{1},{2},{3},{4},{5};"
spanStr=spanStr:gsub("{0}", dt[i]["start"])
spanStr=spanStr:gsub("{1}", dt[i]["end"])
spanStr=spanStr:gsub("{2}", dt[i]["title"])
spanStr=spanStr:gsub("{3}", dt[i]["type"])
spanStr=spanStr:gsub("{4}", dt[i]["link"])
if colorTb[dt[i]["type"]] ~= nil then
spanStr=spanStr:gsub("{5}", colorTb[dt[i]["type"]])
else
spanStr=spanStr:gsub("{5}", "")
end
return spanStr
end
return p