卡厄思
梦
境
菜单
首页
回到首页
WIKI工具
全站样式
全站JS
修改导航栏
测试
沙盒
可视化管理器
战斗员管理器
卡牌管理器
伙伴管理器
装备管理器
词典管理器
图鉴
战斗员
伙伴
装备
怪物卡牌
中立卡牌
词典
小工具
配队模拟器
节奏榜生成器
搜索
链入页面
相关更改
特殊页面
页面信息
最近更改
登录
模块
查看“︁事件”︁的源代码
←
模块:事件
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} local eventData = mw.loadData('模块:事件/data') function p.main(frame) local output = {} -- 遍历所有事件 for eventName, eventInfo in pairs(eventData) do table.insert(output, p.renderEvent(frame, eventName, eventInfo)) end return table.concat(output, '\n') end function p.renderEvent(frame, eventName, eventInfo) local html = mw.html.create('div') :addClass('event-container') :attr('data-event-id', eventInfo.id) -- 背景层 html:tag('div'):addClass('event-background') -- 图片 local imageLink = eventName html:tag('div') :addClass('event-image') :wikitext(string.format('[[File:cc_%s.png|link=%s]]', eventInfo.id, imageLink)) -- 标题背景 html:tag('div'):addClass('event-title-bg') -- 标题 html:tag('div') :addClass('event-title') :wikitext(eventName) -- 选项容器 local optionsContainer = html:tag('div'):addClass('event-options') -- 渲染选项 for i, optionText in ipairs(eventInfo.option) do -- 选项 optionsContainer:tag('div') :addClass('event-option') :attr('data-option-index', i) :wikitext(optionText) -- 结果显示区域 local effectDiv = optionsContainer:tag('div') :addClass('event-effect') :attr('data-effect-index', i) -- 处理结果文本 local effectText = eventInfo.effect[i] if effectText then if frame then effectText = frame:preprocess(effectText) end effectDiv:wikitext(effectText) end end return tostring(html) end -- 单独显示某个事件 function p.show(frame) local eventName = frame.args[1] if not eventName or not eventData[eventName] then return '错误:未找到指定的事件' end return p.renderEvent(frame, eventName, eventData[eventName]) end return p
该页面使用的模板:
模块:事件/doc
(
查看源代码
)
返回
模块:事件
。