卡厄思
梦
境
菜单
首页
回到首页
WIKI工具
全站样式
全站JS
修改导航栏
测试
沙盒
可视化管理器
战斗员管理器
卡牌管理器
伙伴管理器
装备管理器
词典管理器
图鉴
战斗员
伙伴
装备
怪物卡牌
中立卡牌
词典
小工具
配队模拟器
节奏榜生成器
搜索
链入页面
相关更改
特殊页面
页面信息
最近更改
登录
模块
查看“︁卡牌”︁的源代码
←
模块:卡牌
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
-- 模块:卡牌 local p = {} -- 颜色映射表 local colorMap = { ["白"] = { bgColor = "rgba(249, 249, 249, 0.5)", textColor = "white" }, ["蓝"] = { bgColor = "rgba(115, 236, 254, 0.5)", textColor = "#7de5ff" }, ["橙"] = { bgColor = "rgba(254, 199, 109, 0.5)", textColor = "#ffee75" }, ["彩"] = { bgColor = "rgba(201, 88, 241, 0.5)", textColor = "#eba2fc" } } -- 获取卡牌HTML local function getCardHTML(cardName, cardData) if not cardData then return "找不到卡牌数据: " .. (cardName or "未指定") end local data = cardData[1] -- 使用第一个数据条目 local color = data["颜色"] or "白" local colorStyle = colorMap[color] or colorMap["白"] local ap = data["AP"] or "" local cardType = data["类型"] or "" local description = data["描述"] or "" -- 构建卡牌HTML local html = '<div style="position: relative; width: 168px; height: 230px; overflow: hidden;">' .. '<div style="position: absolute; top: 1px; left: 12px;">[[File:start_1041_01.png|151px|link=]]</div>' .. '<div style="position: absolute; top: 1px; left: 12px;">[[File:card_黑色蒙版.png|151px|link=]]</div>' .. '<div style="position: absolute; top: 20px; left: 10px; width: 148px; height: 10px; background-color: ' .. colorStyle.bgColor .. ';"></div>' .. '<div style="position: absolute; left: 23px; top: 4px; color: white; font-weight: bold; text-shadow: 0 0 10px #4a90e2,0 0 20px #4a90e2, 0 0 30px #4a90e2, 0 0 40px #4a90e2; font-size: 32px;">' .. ap .. '</div>' .. '<div style="position: absolute; left: 25px; top: 34px; color: white; font-weight: bold; text-shadow: 0 0 10px #4a90e2,0 0 20px #4a90e2, 0 0 30px #4a90e2, 0 0 40px #4a90e2;">—</div>' .. '<div style="position: absolute; left: 50px; top: 13px; color: ' .. colorStyle.textColor .. '; font-size:16px">' .. cardName .. '</div>' .. '<div style="position: absolute; left: 48px; top: 30px; ">[[File:icon_card_' .. cardType .. '.png|18px|link=]]</div>' .. '<div style="position: absolute; left: 68px; top: 33px; color: white; font-size:14px">' .. cardType .. '</div>' .. '<div style="position: absolute; top: 0px; left: 1px;">[[File:card_属性边框_虚无_normal.png|160px|link=]]</div>' .. '<div style="position: absolute; top: 10px; left: 0px;">[[File:card_稀有度_' .. color .. '.png|22px|link=]]</div>' .. '<div style="position: absolute; top: 2px; right: 4px;">[[File:card_稀有度_边框_' .. color .. '.png|11px|link=]]</div>' .. '<div style="position: absolute; bottom: 7px; left: 15px; width: 144px; height: 100px; font-size: 12px; color: white; line-height: 13px; text-align: center;">' .. description .. '</div>' .. '</div>' return html end -- 主函数,用于处理模板调用 function p.main(frame) local args = frame.args local characterName = args[1] or "" local cardName = args[2] or "" -- 动态加载角色模块 local characterModule = nil local success = pcall(function() characterModule = require("模块:卡牌/" .. characterName) end) if not success or not characterModule then return "找不到角色模块: 模块:卡牌/" .. characterName end -- 获取卡牌数据 local cards = characterModule.card or {} local cardData = cards[cardName] -- 返回卡牌HTML return getCardHTML(cardName, cardData) end -- 为每个角色创建一个直接调用方法 setmetatable(p, { __index = function(t, characterName) return function(frame) local args = frame.args local cardName = args[1] or "" -- 动态加载角色模块 local characterModule = nil local success = pcall(function() characterModule = require("模块:卡牌/" .. characterName) end) if not success or not characterModule then return "找不到角色模块: 模块:卡牌/" .. characterName end -- 获取卡牌数据 local cards = characterModule.card or {} local cardData = cards[cardName] -- 返回卡牌HTML return getCardHTML(cardName, cardData) end end }) return p
该页面使用的模板:
模块:卡牌/doc
(
查看源代码
)
返回
模块:卡牌
。