此处公告通常对读者进行申明或对该WIKI某些规则进行公告,请在确认后修改本通告
本WIKI编辑权限开放,欢迎收藏起来防止迷路,也希望有爱的小伙伴和我们一起编辑哟~
编辑帮助:目录 • BWIKI反馈留言板
此处公告通常对读者进行申明或对该WIKI某些规则进行公告,请在确认后修改本通告。本WIKI编辑权限开放,欢迎收藏起来防止迷路,也希望有爱的小伙伴和我们一起编辑哟~
模板:首页时间
local p={}
function p.isleap(year) if (year%100~=0 and year%4==0 or year%400==0) then -- mw.log("true") return true else -- mw.log("false") return false end end
function p.info(frame)
if (frame==nil) then frame = mw.getCurrentFrame() end
-- 当前时间信息 local wkday = {"周日","周一","周二","周三","周四","周五","周六"} local gamedate = os.date("*t", os.time() - 4*60*60) --当前时间往前4小时,对应凌晨四点刷新日期 local dmonth = gamedate["month"] local dday = gamedate["day"] local dwkday = gamedate["wday"] local text_date = '''现在是:..dmonth..月..dday..日 ..wkday[dwkday]..[[]] -- text_date = text_date.." "..gamedate["hour"].."时"..gamedate["min"].."分"
-- 星芒兑换
local text_exchange = ""
local month_characters = {
[1] = "三月七,停云",
[2] = "佩拉,虎克",
[3] = "青雀,素裳",
[4] = "艾丝妲,阿兰",
[5] = "丹恒,希露瓦",
[6] = "娜塔莎,桑博",
[7] = "三月七,停云",
[8] = "佩拉,虎克",
[9] = "青雀,素裳",
[10] = "艾丝妲,阿兰",
[11] = "丹恒,希露瓦",
[12] = "娜塔莎,桑博"
}
local exg_char_data = month_characters[dmonth]
local exg_char_text = frame:callParserFunction{name="#arraymap:"..exg_char_data, args={", ","@@@","模板:图标",""}}
text_exchange = "[[商店#星芒兑换|"..[[本月商店兑换角色]].."]]
"..exg_char_text
-- 以下代码用于输出结果,不要删
local result = text_date.."
"..text_exchange
mw.log(result) return result end
function p.activity(frame)
if (frame==nil) then frame = mw.getCurrentFrame() end local nowdate = os.date("%Y/%m/%d %H:%M", os.time()) local expdate = os.date("%Y/%m/%d %H:%M", os.time()+5*24*3600) --提前五天预告活动开始 local act_data = frame:callParserFunction{name="#ask:<"..expdate..">"..nowdate.."!永久",args={ "?开始描述", "?结束描述", "?开始时间#-F[Y-m-d H:i]", "?结束时间#-F[Y-m-d H:i]", format="template", template="首页活动/行", sort="开始时间,结束时间", order="desc", link="none", userparam=nowdate}} mw.log(act_data) return act_data end
function p.rtime(frame) local nowdate = os.date("%Y-%m-%d %H:%M", os.time()) mw.log(nowdate) return nowdate end
return p