卡厄思
梦
境
菜单
首页
回到首页
WIKI工具
全站样式
全站JS
修改导航栏
测试
沙盒
可视化管理器
战斗员管理器
卡牌管理器
伙伴管理器
装备管理器
词典管理器
图鉴
战斗员
伙伴
装备
怪物卡牌
中立卡牌
词典
小工具
配队模拟器
节奏榜生成器
搜索
链入页面
相关更改
特殊页面
页面信息
最近更改
登录
模块
查看“︁物品”︁的源代码
←
模块:物品
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} local data = mw.loadData("模块:物品/data") function p.main(frame) local args = frame:getParent().args return p._main(args) end function p._main(args) local itemName = args[1] or "" local count = args[2] or "" local size = args["size"] or "124px" -- 获取物品数据 local itemData = data[itemName] if not itemData then return "[[Category:物品数据缺失]]<span style='color:red'>物品数据不存在: " .. itemName .. "</span>" end -- 解析尺寸 local sizeNum = tonumber(string.match(size, "%d+")) or 124 local frameSize = sizeNum local artSize = sizeNum - 12 local innerSize = sizeNum - 16 local borderTop = math.floor(sizeNum * 8 / 124) local borderLeft = math.floor(sizeNum * 8 / 124) local artTop = math.floor(sizeNum * 6 / 124) local artLeft = math.floor(sizeNum * 6 / 124) local countBottom = math.floor(sizeNum * 6 / 124) local countRight = math.floor(sizeNum * 1 / 124) local rarity = itemData.rarity or "白" local art = itemData.art or "" local html = mw.html.create('div') :css('position', 'relative') :css('width', frameSize .. 'px') :css('height', frameSize .. 'px') -- 背景框 html:tag('div') :css('position', 'absolute') :css('top', '0px') :css('left', '0px') :wikitext('[[File:frame_item_rarity_' .. rarity .. '.png|' .. frameSize .. 'px|link=]]') -- 边框 html:tag('div') :css('position', 'absolute') :css('top', borderTop .. 'px') :css('left', borderLeft .. 'px') :css('width', innerSize .. 'px') :css('height', innerSize .. 'px') :css('border', '1px #f282ff solid') -- 物品图标 html:tag('div') :css('position', 'absolute') :css('top', artTop .. 'px') :css('left', artLeft .. 'px') :wikitext('[[File:' .. art .. '|' .. artSize .. 'px|link=]]') -- 数量显示 if count ~= "" then html:tag('div') :css('position', 'absolute') :css('bottom', countBottom .. 'px') :css('right', countRight .. 'px') :css('color', '#ffffff') :css('font-weight', 'bold') :css('background-color', 'rgba(0,0,0,0.5)') :css('padding', '2px 5px') :css('text-align', 'right') :wikitext(count) end return tostring(html) end return p
该页面使用的模板:
模块:物品/doc
(
查看源代码
)
返回
模块:物品
。