Module:云图计划心智人形
跳到导航
跳到搜索
local dollName local p = {} --[[ 参数str格式示例: 网安精英(默认投影) *扩容Live2D 要伪装成他人对一个白帽客来说很容易,要安心做自己却很难。 ---- 天网深潜者(完型投影) *Live2D 在对白帽客展开攻击时,好好想想自己是不是那条待钓的鱼。 ---- 最初口令(唤醒) *模型 保护您的信息安全?从唤醒我的第一秒开始,我就在做了哦。 ]] local function structureSkinData(str) local raws = mw.text.split(str, '%s*\n%-%-%-%-\n%s*') local skins = {} local flag = false -- 是否专门写了“扩容投影”。不知道变量怎么起名了 for i, v in ipairs(raws) do local name, series, desc local args = {} -- 提取args,在v中移除相应行 v = v:gsub('\n%*[ \t]*([^\n]+)', function(s) args[mw.text.trim(s)] = true return '' end) -- 提取name, series, desc name, series, desc = mw.ustring.match(v, '([^\n]*)(%b())%s-\n%s*(.+)') if name then -- 提取成功时 if series == '()' then series = nil else series = mw.ustring.sub(series, 2, -2) -- 去掉括号 if series == '扩容投影' then flag = true end end else -- 提取失败时 name = '参数出错' series = nil desc = '请检查以下代码:<pre>'..raws[i]..'</pre>' args = {} end skins[i] = { name = name, series = series, desc = desc, args = args, } end -- 在没有手动录入的情况下,自动添加扩容投影 if not flag then table.insert(skins, 2, { name = skins[1].name, series = '扩容投影', desc = skins[1].desc, args = { ['模型'] = skins[1].args['扩容模型'], ['Live2D'] = skins[1].args['扩容Live2D'], ['动态立绘'] = skins[1].args['扩容动态立绘'], } }) end return skins end -- 生成一个心智投影用到的tab local function genSkinItem(frame, skin) local label = table.concat({ skin.args['模型'] and '<div class="pnc-figr-label" style="background:#00F2FE">模型</div>' or '', skin.args['Live2D'] and '<div class="pnc-figr-label" style="background:#F6BF00">Live2D</div>' or '', skin.args['动态立绘'] and '<div class="pnc-figr-label" style="background:#F6BF00"><div style="transform:scale(.9)">动态立绘</div></div>' or '' }) return frame:expandTemplate{ title = '云图计划心智人形/投影tab', args = { dollName = dollName, name = skin.name, series = skin.series, label = label, desc = skin.desc } } end function p.neursoulItems(frame) local parentArgs = frame:getParent().args dollName = parentArgs['姓名'] local skins = structureSkinData(parentArgs['投影'] or frame.args['投影']) local items = {} for i, skin in ipairs(skins) do items[i] = genSkinItem(frame, skin) end return table.concat(items) end function p.VoiceList(frame) local args = frame:getParent().args local Item do local function pre(text) return text:gsub('^[#*:;]', mw.text.encode):gsub('\n', '<br>') end local fmt = string.format local template = '<div class="pnc-info mw-customtoggle-%s">%s</div><div id="mw-customcollapsible-%s" class="mw-collapsible"><p style="white-space:pre-wrap">%s</p>%s</div>' if args['语音文件'] and args['语音文件'] ~= '' then local prefix, suffix = 'PNC-'..args['英文名']..'-', '.wav|bg=0x646464' Item = function(title, content, filename) local media = frame:extensionTag('sm2', prefix..filename..suffix, args) return fmt(template, title, title, title, pre(content), media) end else Item = function(title, content) return fmt(template, title, title, title, pre(content), '') end end end local title_filename = { {'早上好', 'morning'}, {'下午好', 'afternoon'}, {'晚上好', 'evening'}, {'晚安', 'midnight'}, {'主界面语音1', 'dialogue1'}, {'主界面语音2', 'dialogue2'}, {'主界面语音3', 'dialogue4'}, {'互动语音1', 'interact1'}, {'互动语音2', 'interact2'}, {'互动语音3', 'interact3'}, {'获得', 'gain'}, {'潜能突破', 'levelup'}, {'心智扩容', 'rankup'}, {'编入队伍', 'formation'}, {'开始战斗', 'battle'}, {'终极技', 'skill', '终极技语音'}, {'MVP1', 'mvp1'}, {'MVP2', 'mvp2'}, {'力竭', 'retreat'}, {'云图计划', 'title'}, } local list = {} for i, v in ipairs(title_filename) do list[i] = Item(v[1], args[v[3] or v[1]], v[2]) end return table.concat(list) end return p