卡厄思
梦
境
菜单
首页
回到首页
WIKI工具
全站样式
全站JS
修改导航栏
测试
沙盒
可视化管理器
战斗员管理器
卡牌管理器
伙伴管理器
装备管理器
词典管理器
图鉴
战斗员
伙伴
装备
怪物卡牌
中立卡牌
词典
小工具
配队模拟器
节奏榜生成器
搜索
链入页面
相关更改
特殊页面
页面信息
最近更改
登录
模块
查看“︁装备”︁的源代码
←
模块:装备
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} local equipment_data = mw.loadData("模块:装备/data") -- 获取装备星级图标 local function getStarIcon(star) return "[[File:icon_star_rating_" .. star .. ".png|link=]]" end -- 生成装备卡片HTML local function generateEquipmentCard(name, star) local equip = equipment_data[name] if not equip then return "装备不存在: " .. name end local base = equip.base local level = equip[star] or equip[1] local html = mw.html.create('div') :addClass('equipment-card') :attr('data-name', name) :attr('data-star', star) :css({ position = 'relative', display = 'inline-block', width = '150px', height = '230px', cursor = 'pointer' }) -- 背景 html:tag('div') :css({position = 'absolute', top = '0px', left = '0px'}) :wikitext('[[File:bg_equipment_rarity_' .. base.rarity .. '.png|150px|link=]]') -- 装备图片 html:tag('div') :css({position = 'absolute', top = '43px', left = '13px'}) :wikitext('[[File:' .. base.art .. '|124px|link=]]') -- 底部暗色遮罩 html:tag('div') :css({ position = 'absolute', bottom = '5px', left = '5px', width = '140px', height = '35px', ['background-color'] = 'rgba(0,0,0,0.5)', ['border-radius'] = '0px 0px 8px 8px' }) -- 星级 html:tag('div') :css({position = 'absolute', bottom = '10px', left = '20px'}) :wikitext(getStarIcon(star)) -- 顶层蒙版 html:tag('div') :css({position = 'absolute', top = '0px', left = '0px'}) :wikitext('[[File:equipment_顶层蒙版.png|150px|link=]]') return tostring(html) end -- 生成装备弹窗HTML local function generateEquipmentModal(name, star) local equip = equipment_data[name] if not equip then return "" end local base = equip.base local level = equip[star] or equip[1] local html = mw.html.create('div') :addClass('equipment-modal') :css({ position = 'relative', display = 'inline-block', width = '368px', height = '335px', ['background-color'] = '#343434', ['border-radius'] = '9px' }) -- 背景 html:tag('div') :css({position = 'absolute', top = '0px', left = '0px'}) :wikitext('[[File:bg_collection_rarity_' .. base.rarity .. '.png|link=]]') -- 装备图片 html:tag('div') :css({position = 'absolute', top = '40px', left = '128px'}) :wikitext('[[File:' .. base.art .. '|124px|link=]]') -- 分隔线遮罩 html:tag('div') :css({ position = 'absolute', top = '167px', left = '0px', width = '368px', height = '35px', ['background-color'] = 'rgba(0,0,0,0.5)', ['border-radius'] = '0px 0px 8px 8px' }) -- 星级 html:tag('div') :css({position = 'absolute', top = '173px', left = '128px'}) :wikitext(getStarIcon(star)) -- 装备类型图标 html:tag('div') :css({position = 'absolute', top = '205px', left = '5px', color = 'white'}) :wikitext('[[File:icon_equip_' .. base.type .. '_' .. base.rarity .. '.png|25px|link=]]') -- 装备名称 html:tag('div') :css({position = 'absolute', top = '209px', left = '33px', color = 'white'}) :wikitext(name) -- 属性背景 html:tag('div') :css({ position = 'absolute', top = '235px', left = '9px', width = '350px', height = '35px', ['background-color'] = 'rgba(255,255,255,0.3)', ['border-radius'] = '2px' }) -- 属性类型 html:tag('div') :css({position = 'absolute', top = '242px', left = '14px', color = 'white'}) :wikitext(base.value_type) -- 属性值 html:tag('div') :css({position = 'absolute', top = '242px', right = '14px', color = 'white'}) :wikitext(level.value) -- 描述 html:tag('div') :css({position = 'absolute', top = '277px', left = '10px', color = 'white'}) :wikitext(level.desc_global) return tostring(html) end -- 主函数 function p.show(frame) local args = frame:getParent().args local name = args[1] or args.name or "" local star = tonumber(args[2] or args.star or 1) if name == "" then return "错误: 未指定装备名称" end local card = generateEquipmentCard(name, star) local modal = generateEquipmentModal(name, star) return card .. '<div class="equipment-modal-container" style="display:none;">' .. modal .. '</div>' end return p
该页面使用的模板:
模块:装备/doc
(
查看源代码
)
返回
模块:装备
。