卡厄思
梦
境
菜单
首页
回到首页
WIKI工具
全站样式
全站JS
修改导航栏
测试
沙盒
可视化管理器
战斗员管理器
卡牌管理器
伙伴管理器
装备管理器
词典管理器
图鉴
战斗员
伙伴
装备
怪物卡牌
中立卡牌
词典
小工具
配队模拟器
节奏榜生成器
搜索
链入页面
相关更改
特殊页面
页面信息
最近更改
登录
模块
查看“︁装备”︁的源代码
←
模块:装备
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} local equipmentData = mw.loadData('模块:装备/data') -- 辅助函数:解析文本格式 local function parseText(text) if not text then return "" end -- 将 {{文本|橙|数值}} 格式转换为HTML text = text:gsub("{{文本|橙|([^}]+)}}", '<span style="color:#ff9500">%1</span>') return text end -- 生成单个装备卡片 function p.card(frame) local args = frame.args local name = args[1] or args.name local level = args[2] or args.level or "1" if not name or not equipmentData[name] then return "装备不存在" end local equip = equipmentData[name] local base = equip.base local levelData = equip[level] if not levelData then return "等级数据不存在" end -- 生成装备卡片HTML,添加data属性用于JavaScript识别 local html = '<span class="equipment-card-wrapper" data-equipment-name="' .. mw.text.encode(name) .. '" data-equipment-level="' .. level .. '">' html = html .. '<div style="position: relative; display: inline-block; width:150px; height: 230px; cursor: pointer;">' html = html .. '<div style="position: absolute; top: 0px; left: 0px;">[[File:bg_equipment_rarity_' .. base.rarity .. '.png|150px|link=]]</div>' html = html .. '<div style="position: absolute; top: 43px; left: 13px;">[[File:' .. base.art .. '|124px|link=]]</div>' html = html .. '<div style="position: absolute; bottom: 5px; left: 5px; width: 140px; height: 35px; background-color: rgba(0,0,0,0.5); border-radius: 0px 0px 8px 8px"></div>' html = html .. '<div style="position: absolute; bottom: 10px; left: 20px;">[[File:icon_star_rating_' .. level .. '.png|link=]]</div>' html = html .. '<div style="position: absolute; top: 0px; left: 0px;">[[File:equipment_顶层蒙版.png|150px|link=]]</div>' html = html .. '</div>' -- 生成隐藏的弹窗数据 local desc = parseText(levelData.desc_global) html = html .. '<div class="equipment-popup-data" style="display:none;">' html = html .. '<div data-rarity="' .. base.rarity .. '" ' html = html .. 'data-art="' .. base.art .. '" ' html = html .. 'data-level="' .. level .. '" ' html = html .. 'data-type="' .. base.type .. '" ' html = html .. 'data-name="' .. mw.text.encode(name) .. '" ' html = html .. 'data-value-type="' .. mw.text.encode(base.value_type) .. '" ' html = html .. 'data-value="' .. levelData.value .. '" ' html = html .. 'data-desc="' .. mw.text.encode(desc) .. '">' html = html .. '</div></div>' html = html .. '</span>' return frame:preprocess(html) end -- 生成装备列表 function p.list(frame) local result = {} for name, _ in pairs(equipmentData) do local newFrame = { args = {name = name, level = "1"}, preprocess = frame.preprocess } table.insert(result, p.card(newFrame)) end return table.concat(result, "\n") end return p
该页面使用的模板:
模块:装备/doc
(
查看源代码
)
返回
模块:装备
。