WIKI公告栏
欢迎各位引航者访问卡拉彼丘WIKI,由于游客访问页面会有一定的页面旧版缓存,建议你登陆B站账号进行浏览,如果您觉得本WIKI有帮助到你,欢迎推荐给身边的引航者。
全站通知:

模块:RoleBirthday

来自卡拉彼丘WIKI_BWIKI_哔哩哔哩
跳到导航 跳到搜索

此模块用于在wiki页头位置展示当天过生日的角色。


local p = {}

local Birthday = { ["令"] = "1/5", 
	               ["香奈美"] = "1/27",
	               ["芙拉薇娅"] = "2/14",
	               ["加拉蒂亚"] = "2/22",
	               ["玛德蕾娜"] = "3/7",
	               ["忧雾"] = "3/22",
	               ["米雪儿·李"] = "3/25",
	               ["绯莎"] = "5/10",
	               ["伊薇特"] = "5/23",
	               ["信"]= "7/11",
	               ["奥黛丽"] = "7/29",
	               ["明"] = "8/15",
	               ["梅瑞狄斯"] = "8/28",
	               ["珐格兰丝"]= "9/10",
	               ["星绘"]= "9/26",
	               ["拉薇"]= "10/29",
	               ["艾卡"] = "11/11",
	               ["心夏"]= "12/12",
	               ["白墨"] = "12/20",
}

function p.Birthday(month , day)
	local currentMonth = tonumber(os.date("%m"))
    local currentDay = tonumber(os.date("%d"))
    local formattedDate = currentMonth .. "/" .. currentDay

    local zhcn = mw.language.new("zh-cn")

    for key, value in pairs(Birthday) do
        if value == formattedDate then
            local Role = key
            local result = mw.getCurrentFrame():expandTemplate{ 
        	               title = '信息', 
        	               args = {
        	                       	class = 'info',
        	                       	color = '#FFD700',
        	                       	leftimage = '[[File:Birthday Cake.svg|64px|link=]]',
        	                       	['text-style'] = 'font-size: 20px;font-weight: bold',
        	                       	text = mw.getCurrentFrame():expandTemplate{ title = 'Color', args = { 'orange' , '今天(' 
        	                       	.. mw.getCurrentFrame():expandTemplate{ title = 'Color', args = { 'red' , zhcn:formatDate("Mj日", formattedDate) } } 
        	                       	..')是[[' .. Role .. ']]的生日,让我们一起祝ta生日快乐吧!' }}
        	                       }   
        }  
            return result
        end
    end

    return ""
end

return p