Module:Partnertable:修订间差异

来自Arcaea中文维基
无编辑摘要
无编辑摘要
第155行: 第155行:
    local category = ''
    local category = ''


    if args['更新 版本NS'] or dataNs('id')
    if args['更新 时间NS']
      then
      then
      if args['更新版本'] or args['更新时间'] or data('id')
      if args['更新时间']
        then
        then
        category = category..'[[分类:双平台 曲目]]'
        category = category..'[[分类:双平台 搭档]]'
      else
      else
        category = category..'[[分类:NS版 曲目]]'
        category = category..'[[分类:NS版 搭档]]'
      end
      end
    else
    else
      category = category..'[[分类:移动版 曲目]]'
      category = category..'[[分类:移动版 搭档]]'
    end
    end
   if dataNs('pstChange') or dataNs('prsChange') or dataNs('ftrChange') then category = category..'[[分类:多模式谱面有差异的曲目]]' end
   if not(data('id') or dataNs('id') or #args > 1) then category = category..'[[分类:未登陆的曲目]]' end


    if data('id') or dataNs('id')
    if data('id') or dataNs('id')

2021年7月26日 (一) 16:52的版本

可在Module:Partnertable/doc创建此模块的帮助文档

local getArgs = require('Module:Arguments').getArgs
local link = require('Module:Link')._link
local getData = require("Module:data")
local p = {}

function labelText(text,class)
	local span = mw.html.create( 'span' )
	span:addClass( 'label-text' )
	span:wikitext(text)
	return tostring(span)
end

function update(version,device,awakenyes,version2)
	if device == 'ns'
	then
		return '<div class="date-box"><div>'..labelText('NS版')..'</div><div>'..version..'</div><div></div></div>'
	else
		if awakenyes
		then 
			return '<div class="date-box"><div>'..labelText('移动版')..'</div><div>搭档:'..version..'<br />觉醒形态:'..version2..'</div><div></div></div>'
		end
	    return '<div class="date-box"><div>'..labelText('移动版')..'</div><div>'..version..'</div><div></div></div>'
	end
end

function getImage(normal,awaken,JacketArgs,awakenyes,type,size)
	local container,tab=mw.html.create('div'),mw.html.create('div')
	local tab1,tab2,part1,part2,jacket
	container:addClass( 'container' )
	tab:attr( 'id','tab-'..type ) tab:addClass( 'img-tab' )
	
	local Jacket=JacketArgs
	
	if awaken
	then
		 	tab1,tab2,part1,part2=mw.html.create('div'),mw.html.create('div'),mw.html.create('div'),mw.html.create('div')

		tab1:wikitext('Normal') tab2:wikitext('Awaken')
		tab1:addClass('img-tab-part normal') tab2:addClass('img-tab-part awaken')
		tab:wikitext(tostring(tab1)) tab:wikitext(tostring(tab2))
		container:wikitext(tostring(tab))
		
		part1:wikitext('[[文件:'..normal..'|'..size..'px|none]]'..labelText('画师')..Jacket) part2:wikitext('[[文件:'..awaken..'|'..size..'px|none]]'..labelText('画师')..tostring(Jacket)) 
		part1:addClass('active tab-text-'..type) part2:addClass('tab-text-'..type) 
		container:wikitext(tostring(part1)) container:wikitext(tostring(part2)) 
		
		return tostring(container)
	end
	
	return '<div><div class="floatnone">[[文件:'..normal..'|'..size..'px]]</div><div>'..labelText('画师')..Jacket..'</div></div>'
end

function p.main(frame)
	local args = getArgs(frame)
	return p._main(args)
end

function p._main(args)
	
	local awaken
	local size
	local belongs
	if args['觉醒形态'] == '有' then awaken=true else awaken=false end
	if args['名称'] == '白姬' or args['名称'] == '凛可' then size=200 else size=300 end
	if args['所属曲包']
	then
		belongs='所属曲包'
	else
		if args['所属单曲'] then belongs='所属单曲' else belongs='所属单曲/曲包' end
	end
	local imageA=getImage(args['图片'],args['觉醒图片'],args['画师'],awaken,'a',size)
	local imageB=getImage(args['图片'],args['觉醒图片'],args['画师'],awaken,'b',size)
	local infoList = {
        [1] = { args['名称'], {id = 'title'}},
        [2] = { imageA, {id = 'top-image'}},
        [3] = { imageB, {id = 'right-image'}},
        [4] = { '搭档信息', {class = 'header'}},
        [5] = { '类型', {class = 'label'}},
        [6] = { args['类型'], {class = 'data'}},
        [7] = { belongs, {class = 'label'}},
        [8] = { args['所属曲包'] or args['所属单曲'] or '-', {class = 'data'}},
        [9] = { '觉醒形态', {class = 'label'}},
        [10] = { args['觉醒形态'] or '无', {class = 'data'}},
        [11] = { '搭档数据', {class = 'header', id='all-play-header'}},
        [12] = { '搭档数据 (移动版)', {class = 'header', id='mobile-play-header'}},
        [13] = { '等级', {class = 'label'}},
        [14] = { 'Lv1', {class = 'level-data'}},
        [15] = { 'Lv20', {class = 'level-data'}},
        [16] = { 'Lv30', {class = 'awaken-data'}},
        [17] = { 'Frag', {class = 'label'}},
        [18] = { args['Frag1'], {class = 'level-data'}},
        [19] = { args['Frag20'], {class = 'level-data'}},
        [20] = { args['Frag30'], {class = 'awaken-data'}},
        [21] = { 'Step', {class = 'label'}},
        [22] = { args['Step1'], {class = 'level-data'}},
        [23] = { args['Step20'], {class = 'level-data'}},
        [24] = { args['Step30'], {class = 'awaken-data'}},
        [25] = { 'Over', {class = 'label over'}},
        [26] = { args['Over1'], {class = 'level-data over'}},
        [27] = { args['Over20'], {class = 'level-data over'}},
        [28] = { args['Over30'], {class = 'awaken-data over'}},
        [29] = { '搭档数据 (Nintendo Switch版)', {class = 'header ns', id='ns-play-header'}},
        [30] = { '等级', {class = 'label ns'}},
        [31] = { 'Lv1', {class = 'level-data ns'}},
        [32] = { 'Lv20', {class = 'level-data ns'}},
        [33] = { 'Lv30', {class = 'awaken-data ns'}},
        [34] = { 'Frag', {class = 'label ns'}},
        [35] = { args['Frag1NS'], {class = 'level-data ns'}},
        [36] = { args['Frag20NS'], {class = 'level-data ns'}},
        [37] = { args['Frag30NS'], {class = 'awaken-data ns'}},
        [38] = { 'Step', {class = 'label ns'}},
        [39] = { args['Step1NS'], {class = 'level-data ns'}},
        [40] = { args['Step20NS'], {class = 'level-data ns'}},
        [41] = { args['Step30NS'], {class = 'awaken-data ns'}},
        [42] = { '技能', {class = 'label', id='skill-label'}},
        [43] = { args['技能'] or '-', {class = 'data', id = 'skill-normal'}},
        [44] = { args['觉醒技能'], {class = 'data', id = 'skill-awaken'}},
        [45] = { '更新时间', {id='update-data-label' ,class = 'label'}},
        [46] = { update(args['更新时间'] or '无','mobile',awaken,args['觉醒更新时间'] or args['更新时间']), {id='mobile-date-normal', class = 'data'}},
        [47] = { update(args['更新时间NS'] or '无','ns',awaken,'无'), {id='ns-date-normal', class = 'data'}}
	}

	local box = mw.html.create( 'div' )
	
	--样式控制
	box:addClass( "partnerbox" )
	if awaken then box:addClass( "awaken" ) end
	if args['名称'] == '白姬' or args['名称'] == '凛可' then box:addClass( "ns-only" ) end
	if awaken and args['技能'] ~= args['觉醒技能'] and args['觉醒技能'] ~= nil then box:addClass( "skill-different" ) end
	if args['类型']=='支援型'
	then
		box:addClass( "support" )
	else
		if args['类型']=='挑战型' then box:addClass( "challenge" ) else box:addClass( "balance" ) end
	end

	if args['更新时间NS']
	then
		box:addClass( "ns-box" )
	end
	
	--表格生成
	local boxList={}
    for i, o in ipairs(infoList) do
        boxList[i] = mw.html.create('div')
        boxList[i]
        :attr(infoList[i][2])
        :cssText(infoList[i][3])
        :wikitext(infoList[i][1])
        box:wikitext(tostring(boxList[i]))
    end
	
	--分类添加
	
    local category = ''

    if args['更新时间NS']
        then
        if args['更新时间']
            then
            category = category..'[[分类:双平台搭档]]'
        else
            category = category..'[[分类:NS版搭档]]'
        end
    else
        category = category..'[[分类:移动版搭档]]'
    end

    if data('id') or dataNs('id')
        then
        category = category..'[[分类:'..tostring(choice(getData.pack({data('set')}), data('set'), getData.pack({dataNs('set')}), dataNs('set'))) .. '曲包曲目]]'

        if dataNs('side') == 1 or args['侧'] == '1'
            then
            category = category..'[[分类:纷争侧曲目]]'
        else
            category = category..'[[分类:光芒侧曲目]]'
        end

        category = category..'[[分类:PST'..infoList[20][1] .. '级曲目]]'
        category = category..'[[分类:PRS'..infoList[21][1] .. '级曲目]]'
        category = category..'[[分类:FTR'..infoList[22][1] .. '级曲目]]'
        if byd then category = category..'[[分类:BYD'..infoList[23][1] .. '级曲目]]' end

        category = category..'[[分类:采用'..(args['背景'] or data('bg') or dataNs('bg')) .. '背景的曲目]]'

        if args['曲目版本'] then category = category..'[[分类:'..args['曲目版本']:gusb('v', 'V') .. '添加的曲目]]' end
        if args['曲目版本NS'] then category = category..'[[分类:NS '..args['曲目版本NS']:gusb('v', 'V') .. '添加的曲目]]' end
    end
	
	return tostring(box)
end

return p