Module:沙盒/在咕咕咕的咕子/Sandbox1:修订间差异

试添加旧图片机制(我不会写lua SOS)
(copy Module:Partnertable)
(试添加旧图片机制(我不会写lua SOS))
第41行: 第41行:
end
end


function getImage(normal, awaken, normalJacket, awakenJacket, awakenyes, type)
function getImage(args, hasawaken, hasold, type)
local container = mw.html.create 'div':addClass 'container'
local container = mw.html.create 'div':addClass 'container'
local JacketNormal = normalJacket
local imageNormal = args['图片']
if awaken then
local jacketNormal = args['画师']
local JacketAwaken = awakenJacket or normalJacket
if hasawaken or hasold then
container -- tab
-- tab
container
:tag 'div':addClass 'img-tab':attr('id', 'tab-' .. type)
:tag 'div':addClass 'img-tab':attr('id', 'tab-' .. type)
:tag 'div':wikitext 'Normal':addClass 'img-tab-part normal active':done()
:tag 'div':wikitext 'Normal':addClass 'img-tab-part normal active':done()
:tag 'div':wikitext 'Awaken':addClass 'img-tab-part awaken':done()
if hasold then
container -- part
local imageOld = args['旧图片'] or args['图片']
:tag 'div':wikitext('[[文件:', normal, '|300px|none]]'):node(labelText '画师'):wikitext(tostring(JacketNormal)):addClass('active tab-text-' .. type):done()
local jacketOld = args['旧画师'] or args['画师']
:tag 'div':wikitext('[[文件:', awaken, '|300px|none]]'):node(labelText '画师'):wikitext(tostring(JacketAwaken)):addClass('tab-text-' .. type):done()
container:tag 'div':wikitext 'Old':addClass 'img-tab-part old':done()
end
if hasawaken then
local imageAwaken = args['觉醒图片'] or args['图片']
local jacketAwaken = args['觉醒画师'] or args['画师']
container:tag 'div':wikitext 'Awaken':addClass 'img-tab-part awaken':done()
end
-- part
container:tag 'div':wikitext('[[文件:', imageNormal, '|300px|none]]'):node(labelText '画师'):wikitext(tostring(jacketNormal)):addClass('active tab-text-' .. type):done()
if hasold then container:tag 'div':wikitext('[[文件:', imageOld, '|300px|none]]'):node(labelText '画师'):wikitext(tostring(jacketOld)):addClass('tab-text-' .. type):done() end
if hasawaken then container:tag 'div':wikitext('[[文件:', imageAwaken, '|300px|none]]'):node(labelText '画师'):wikitext(tostring(jacketAwaken)):addClass('tab-text-' .. type):done() end
else
else
container
container
:tag 'div':wikitext('[[文件:', normal, '|300px]]'):done()
:tag 'div':wikitext('[[文件:', imageNormal, '|300px]]'):done()
:tag 'div':node(labelText '画师'):wikitext(JacketNormal):done()
:tag 'div':node(labelText '画师'):wikitext(jacketNormal):done()
end
end
return container
return container
第67行: 第78行:


function p._main(args)
function p._main(args)
local awaken   --觉醒判定
local old         --旧图片判定
local size    --图片大小
local awaken     --觉醒判定
local belongs --所属单位
local size         --图片大小
local belongs     --所属单位
local skillawaken --觉醒技能
local skillawaken --觉醒技能
local skillsec --第二技能
local skillsec      --第二技能
if args['旧图片'] then old = true else old = false end
if args['觉醒形态'] == '有' then awaken = true else awaken = false end
if args['觉醒形态'] == '有' then awaken = true else awaken = false end
if awaken and args['技能'] ~= args['觉醒技能'] and args['觉醒技能'] ~= nil then skillawaken = true else skillawaken = false end
if awaken and args['技能'] ~= args['觉醒技能'] and args['觉醒技能'] ~= nil then skillawaken = true else skillawaken = false end
第82行: 第95行:
belongs = '所属单曲/曲包'
belongs = '所属单曲/曲包'
end
end
local imageA = getImage(args['图片'], args['觉醒图片'], args['画师'], args['觉醒画师'], awaken, 'a')
local imageA = getImage(args, awaken, old, 'a')
local imageB = getImage(args['图片'], args['觉醒图片'], args['画师'], args['觉醒画师'], awaken, 'b')
local imageA = getImage(args, awaken, old, 'b')
local infoList = {
local infoList = {
[1] = {title(args['名称'], args['第二名称']), {id = 'title'}},
[1] = {title(args['名称'], args['第二名称']), {id = 'title'}},
第165行: 第178行:
end
end


--分类添加
--手动关闭
local category = mw.html.create()
if args['nocat'] then
category = ''
else
--分类添加
local category = mw.html.create()


--平台
--平台
local plat
local plat
if args['更新时间NS'] then
if args['更新时间NS'] then
if args['更新时间'] then
if args['更新时间'] then
plat = '双平台'
plat = '双平台'
else
plat = 'NS版'
end
else
else
plat = 'NS 版'
plat = ' 移动 版'
end
end
else
category:wikitext('[[分类:', plat, '搭档]]')
plat = '移动版'
end
category:wikitext('[[分类:', plat, '搭档]]')


--觉醒
--觉醒
category:wikitext('[[分类:', awaken and '有' or '没有', '觉醒形态的', '搭档]]')
category:wikitext('[[分类:', awaken and '有' or '没有', '觉醒形态的', '搭档]]')


--类型
--类型
local type = args['类型'] or '平衡型'
local type = args['类型'] or '平衡型'
local typeSet = {['支援型'] = true, ['平衡型'] = true, ['挑战型'] = true,}
local typeSet = {['支援型'] = true, ['平衡型'] = true, ['挑战型'] = true,}
category:wikitext('[[分类:', typeSet[type] and type or '特殊类型', '搭档]]')
category:wikitext('[[分类:', typeSet[type] and type or '特殊类型', '搭档]]')
-- ???/创世型; ???/探索者; ???
-- ???/创世型; ???/探索者; ???


--种类
--种类
local cMap = {['限时'] = '限时活动', ['特殊'] = '获取方式特殊的', ['专辑'] = 'Arcaea原声专辑特典',}
local cMap = {['限时'] = '限时活动', ['特殊'] = '获取方式特殊的', ['专辑'] = 'Arcaea原声专辑特典',}
for c in mw.text.gsplit(args['种类'], '/', true) do
for c in mw.text.gsplit(args['种类'], '/', true) do
if c ~= '原创' then
if c ~= '原创' then
category:wikitext('[[分类:', cMap[c] or c, '搭档]]')
category:wikitext('[[分类:', cMap[c] or c, '搭档]]')
end
end
end
end


--版本
--版本
if args['更新时间'] then
if args['更新时间'] then
category:wikitext('[[分类:', lang:ucfirst(version(args['更新时间'])), '添加的', '搭档]]')
category:wikitext('[[分类:', lang:ucfirst(version(args['更新时间'])), '添加的', '搭档]]')
end
if awaken then
category:wikitext('[[分类:', lang:ucfirst(version(args[' 觉醒 更新时间'] or args['更新时间'])), '添加觉醒形态的', '搭档]]')
end
if args['更新时间NS'] then
category:wikitext('[[分类:', 'NS ', lang:ucfirst(version(args['更新时间NS'])), '添加的', '搭档]]')
end
end
end
if awaken then
category:wikitext('[[分类:', lang:ucfirst(version(args['觉醒更新时间'] or args['更新时间'])), '添加觉醒形态的', '搭档]]')
end
if args['更新时间NS'] then
category:wikitext('[[分类:', 'NS ', lang:ucfirst(version(args['更新时间NS'])), '添加的', '搭档]]')
end
--手动关闭
if args['nocat'] then category = '' end


return tostring(box) .. tostring(category)
return tostring(box) .. tostring(category)
1,386

个编辑