卡厄思
梦
境
菜单
首页
回到首页
WIKI工具
全站样式
全站JS
修改导航栏
测试
沙盒
可视化管理器
战斗员管理器
卡牌管理器
伙伴管理器
装备管理器
词典管理器
图鉴
战斗员
伙伴
装备
怪物卡牌
中立卡牌
词典
小工具
配队模拟器
节奏榜生成器
搜索
链入页面
相关更改
特殊页面
页面信息
最近更改
登录
模块
查看“︁配队/卡牌”︁的源代码
←
模块:配队/卡牌
因为以下原因,您没有权限编辑该页面:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p = {} local getArgs = require('Module:Arguments').getArgs -- 卡牌模块 local cardModule = require('Module:卡牌') -- 安全的错误输出 local function err(msg) return '<span style="color: red;">' .. mw.text.encode(msg) .. '</span>' end -- 安全获取 SMW 属性 local function getProperty(pageName, propertyName) local result = mw.smw.ask({ '[[' .. pageName .. ']]', '?' .. propertyName, limit = 1 }) if result and result[1] and result[1][propertyName] then return result[1][propertyName] end return nil end -- 主函数 function p.main(frame) local args = getArgs(frame, { removeBlank = true }) local fighterName = args[1] or args['战斗员'] or args['name'] if not fighterName or fighterName == '' then return err('错误: 未指定战斗员名称') end -- 构造完整页面名称 local pageName = '战斗员:' .. fighterName -- 检查页面是否存在 local title = mw.title.new(pageName) if not title or not title.exists then return err('错误: 找不到战斗员 "' .. fighterName .. '"') end -- 定义卡牌属性顺序 local cardProperties = { '自我意识技能', '起始卡牌_1', '起始卡牌_2', '起始卡牌_3', '起始卡牌_4', '独特卡牌_1', '独特卡牌_2', '独特卡牌_3', '独特卡牌_4' } -- 收集卡牌调用参数 local batchArgs = {} local argIndex = 1 for _, propName in ipairs(cardProperties) do local cardValue = getProperty(pageName, propName) if cardValue and cardValue ~= '' then -- 解析卡牌值(格式:模块名|卡牌名) local moduleName, cardName = cardValue:match('^([^|]+)|(.+)$') if moduleName and cardName then moduleName = mw.text.trim(moduleName) cardName = mw.text.trim(cardName) -- 添加到批量参数(每组5个参数:模块名, 卡牌名, 变体类型, 变体参数, 变体索引) batchArgs[argIndex] = moduleName batchArgs[argIndex + 1] = cardName batchArgs[argIndex + 2] = nil -- 变体类型 batchArgs[argIndex + 3] = nil -- 变体参数 batchArgs[argIndex + 4] = nil -- 变体索引 argIndex = argIndex + 5 end end end -- 如果没有找到任何卡牌 if #batchArgs == 0 then return err('错误: 战斗员 "' .. fighterName .. '" 没有配置卡牌数据') end -- 调用批量渲染 local batchFrame = { args = batchArgs, getParent = function() return frame end } return cardModule.batch(batchFrame) end return p
该页面使用的模板:
模块:配队/卡牌/doc
(
查看源代码
)
返回
模块:配队/卡牌
。