卡厄思
梦
境
菜单
首页
回到首页
WIKI工具
全站样式
全站JS
修改导航栏
测试
沙盒
可视化管理器
战斗员管理器
卡牌管理器
伙伴管理器
装备管理器
词典管理器
图鉴
战斗员
伙伴
装备
怪物卡牌
中立卡牌
词典
小工具
配队模拟器
节奏榜生成器
搜索
链入页面
相关更改
特殊页面
页面信息
最近更改
登录
模块
查看“︁装备”︁的源代码
←
模块:装备
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local Equipment = {} -- 从数据模块加载装备数据 local equipmentData = require("模块:装备/data") -- 生成装备显示HTML function Equipment.renderEquipment(equipName, level) level = level or "1" -- 默认等级为1 local equip = equipmentData[equipName] if not equip then return "<div class='error'>找不到装备:" .. equipName .. "</div>" end local base = equip.base local levelData = equip[level] if not levelData then return "<div class='error'>找不到装备等级:" .. level .. "</div>" end -- 生成装备卡片HTML local html = [=[ <div class="equipment-card" data-equip-name="]=] .. equipName .. [=[" data-equip-level="]=] .. level .. [=[" style="position: relative; display: inline-block; width:150px; height: 230px;"> <div style="position: absolute; top: 0px; left: 0px;">[[File:bg_equipment_rarity_]=] .. base.rarity .. [=[.png|150px|link=]]</div> <div style="position: absolute; top: 43px; left: 13px;">[[File:]=] .. base.art .. [=[|124px|link=]]</div> <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> <div style="position: absolute; bottom: 10px; left: 20px; ">[[File:icon_star_rating_]=] .. level .. [=[.png|link=]]</div> <div style="position: absolute; top: 0px; left: 0px;">[[File:equipment_顶层蒙版.png|150px|link=]]</div> </div> ]=] return html end -- 生成装备详情弹窗HTML function Equipment.renderEquipmentDetail(equipName, level) level = level or "1" -- 默认等级为1 local equip = equipmentData[equipName] if not equip then return "<div class='error'>找不到装备:" .. equipName .. "</div>" end local base = equip.base local levelData = equip[level] if not levelData then return "<div class='error'>找不到装备等级:" .. level .. "</div>" end -- 生成装备详情弹窗HTML local html = [=[ <div class="equipment-detail" style="position: relative; display: inline-block; width:368px; height: 335px; background-color: #343434; border-radius: 9px"> <div style="position: absolute; top: 0px; left: 0px;">[[File:bg_collection_rarity_]=] .. base.rarity .. [=[.png|link=]]</div> <div style="position: absolute; top: 40px; left: 128px;">[[File:]=] .. base.art .. [=[|124px|link=]]</div> <div style="position: absolute; top: 167px; left: 0px; width: 368px; height: 35px; background-color: rgba(0,0,0,0.5); border-radius: 0px 0px 8px 8px"></div> <div style="position: absolute; top: 173px; left: 128px; ">[[File:icon_star_rating_]=] .. level .. [=[.png|link=]]</div> <div style="position: absolute; top: 205px; left: 5px; color: white">[[File:icon_equip_]=] .. base.type .. [=[_]=] .. base.rarity .. [=[.png|25px|link=]]</div> <div style="position: absolute; top: 209px; left: 33px; color: white">]=] .. equipName .. [=[</div> <div style="position: absolute; top: 235px; left: 9px; width: 350px; height: 35px; background-color: rgba(255,255,255,0.3); border-radius: 2px"></div> <div style="position: absolute; top: 242px; left: 14px; color: white">]=] .. base.value_type .. [=[</div> <div style="position: absolute; top: 242px; right: 14px; color: white">]=] .. levelData.value .. [=[</div> <div style="position: absolute; top: 277px; left: 10px; color: white">]=] .. levelData.desc_global .. [=[</div> </div> ]=] return html end -- 生成装备列表 function Equipment.renderEquipmentList(filter) filter = filter or {} local html = "<div class='equipment-list'>" for equipName, equipData in pairs(equipmentData) do -- 应用筛选条件 local shouldShow = true if filter.rarity and equipData.base.rarity ~= filter.rarity then shouldShow = false end if filter.type and equipData.base.type ~= filter.type then shouldShow = false end if filter.area and equipData.base.area ~= filter.area then shouldShow = false end if shouldShow then html = html .. Equipment.renderEquipment(equipName, "1") -- 默认显示1级 end end html = html .. "</div>" return html end -- 列出所有可用的装备名称 function Equipment.listEquipmentNames() local names = {} for equipName, _ in pairs(equipmentData) do table.insert(names, equipName) end return names end -- 获取装备数据(供其他模块使用) function Equipment.getEquipmentData(equipName, level) level = level or "1" -- 默认等级为1 local equip = equipmentData[equipName] if not equip then return nil end local levelData = equip[level] if not levelData then return nil end -- 返回装备基本数据和指定等级的数据 return { base = equip.base, level = levelData, name = equipName, level_num = level } end return Equipment
该页面使用的模板:
模块:装备/doc
(
查看源代码
)
返回
模块:装备
。