Module:Sandbox/S22e450
跳到导航
跳到搜索
local getArgs = require('Module:Arguments').getArgs local p = {} local function toWikitext(text1) return mw.getCurrentFrame():preprocess(text1) end --武器图片 function p.WeaponImg(frame) local args = getArgs(frame) if (not frame) then frame = mw.getCurrentFrame() end -- 初始化 if string.gmatch(args['name'], "_") then if frame:callParserFunction('filepath', 'BA_Arm_'..args['name']..'.png') == '' then local tmp = mw.text.split(args['name'], "_") for i, v in ipairs(tmp) do fileName = v break end else fileName = args['name'] end else fileName = args['name'] end local html = mw.html.create('div') html :wikitext('[[File:BA_Arm_' .. fileName .. '.png|450px|' .. args['武器名称'] .. ']]') :done() return toWikitext(tostring(html)) end --武器等级切换显示 function p.WLvSwitcher(frame) if (not frame) then frame = mw.getCurrentFrame() end local args = getArgs(frame) local swWpnLv = '{{切换显示按钮|@forceNoCancel=1|@default=' .. args['name'] .. 'WeaponLv30|@radio=0' for i = 3, 7 do if not args[i] then args[i] = "[无数据]" end swWpnLv = swWpnLv .. '|' .. args['name'] .. 'WeaponLv'.. (i*10) ..'=Lv.' .. (i*10) end swWpnLv = swWpnLv .. '}}' local html = mw.html.create('div') html :addClass('ba-toggle-container') :wikitext(swWpnLv) :tag('div') :addClass('baTabContent') :wikitext(args['武器等级描述'] .. '{{切换显示|'..args['name'] .. 'WeaponLv40|<br/>被动技能提升}}{{切换显示|' .. args['name'] .. 'WeaponLv50|<br/>' .. args['ter'] .. '战斗力提升至\'\'\'' .. args['terLv'] .. '\'\'\'}}') :done() return toWikitext(tostring(html)) end --武器技能切换显示 function p.WSkillSwitcher(frame) if (not frame) then frame = mw.getCurrentFrame() end local args = getArgs(frame) local swWpnSkill = '{{切换显示按钮|@forceNoCancel=1|@default=' .. args['name'] .. 'WeaponSkillLv1|@radio=0' for i = 1, 10 do if not args[i] then args[i] = "[无数据]" end swWpnSkill = swWpnSkill .. '|'.. args['name'] .. 'WeaponSkillLv' .. i .. '=Lv.' .. i end swWpnSkill = swWpnSkill .. '}}' local html = mw.html.create('div') html :addClass('ba-toggle-container') :wikitext(swWpnSkill) :tag('div') :addClass('baTabContent') :wikitext(args['武器技能描述']) :done() return toWikitext(tostring(html)) end --羁绊等级切换显示 function p.KizunaSwitcher(frame) local args = getArgs(frame) if (not frame) then frame = mw.getCurrentFrame() end local swBond = '{{切换显示按钮|@forceNoCancel=1|@default=' .. args['name'] .. 'KizunaLv10|@radio=0' for i = 1, 5 do if not args[i] then args[i] = "[无数据]" end swBond = swBond .. '|' .. args['name'] .. 'KizunaLv' .. (i * 10) .. '=RANK ' .. (i * 10) end swBond = swBond .. '}}' local html = mw.html.create('div') html :addClass('ba-toggle-container') :wikitext(swBond) :tag('div') :addClass('baTabContent') :wikitext(args['羁绊描述']) :done() --t = "{{切换显示|"..args['name'].."KizunaLv"..i.."0|"..args[i].."}}" return toWikitext(tostring(html)) end return p