「Module:Songtable」:修訂間差異

增加 197 位元組 、​ 2022年8月29日 (星期一)
重构一部分架构
無編輯摘要
(重构一部分架构)
第1行: 第1行:
local getArgs = require('Module:Arguments').getArgs
local getArgs = require('Module:Arguments').getArgs
local link = require('Module:Link')._link
local link = require('Module:Link')._link
local getData = require("Module:data")
local getData = require("Module:Arcaea Data")
local p = {}
local p = {}


第40行: 第40行:
end
end


function bydMark(byd, name)
function bydMark(byd, name, inNs)
    local diff, mark = mw.html.create('div'), mw.html.create('div')
    local diff, mark = mw.html.create('div'), mw.html.create('div')
    diff:wikitext('[Beyond]')
    diff:wikitext('[Beyond]')
    mark:wikitext('仅移动版')
    mark:wikitext('仅移动版')
    if byd and name ~= 'Tempestissimo' and name ~= 'Quon' and name ~= 'lastendconductor' and name ~= 'Infinite Strife,' and name ~= 'World Ender' and name ~= 'Pentiment' and name ~= 'Arcana Eden' and name ~= 'Testify'
    if byd and inNs
      then
      then
      return tostring(tostring(diff)..tostring(mark))
      return tostring(tostring(diff)..tostring(mark))
第215行: 第215行:
function p._main(args)
function p._main(args)


    local data, dataNs = getData.getMobile(args[' 曲名'], args['id']), getData.getNS(args['曲名'], args['id'])
   -- 获取数据查找函数
    local data, dataNs
   if args["id"]
   then
     data, dataNs = getData.singleSongInformation(args['id'], "id", "mobile"), getData.singleSongInformation(args['id'], "id", "ns")
   elseif args["曲名"]
   then
     data, dataNs = getData.singleSongInformation(args['曲名'], "name", "mobile"), getData.singleSongInformation(args[' 曲名'], "name", "ns")
   end
 
   -- 判断曲目在哪个平台存在。
   local inMobile,inNs = false, false
   if data("id") or args["更新时间"] then
     inMobile = true
   end
 
   if dataNs("id") or args["更新时间NS"] then
     inNs = true
   end


   -- 判断byd谱面是否存在;先假定NS不会有beyond等级。
    local byd
    local byd
    if args['Beyond等级'] or data('bydRating') then byd = true else byd = false end
    if args['Beyond等级'] or data('bydRating') then byd = true else byd = false end


   -- 处理谱师参数,未填写的等级谱师向前级复制(向下兼容)
    local getChartDesigner = {
    local getChartDesigner = {
      [1] = {'mobile', 'PastNote编写', 'note编写', 'pstChartDesigner'},
      [1] = 
      [2] = {'mobile', 'PresentNote编写', 'note编写', 'prsChartDesigner'},
     {'mobile', 'PastNote编写', 'note编写', 'pstChartDesigner'},
      [3] = {'mobile', 'FutureNote编写', 'note编写', 'ftrChartDesigner'},
      [2] = 
    [4] = {'mobile', 'BeyondNote编写', 'note编写', 'bydChartDesigner'}}
     {'mobile', 'PresentNote编写', 'note编写', 'prsChartDesigner'},
      [3] = 
     {'mobile', 'FutureNote编写', 'note编写', 'ftrChartDesigner'},
    [4] = 
     {'mobile', 'BeyondNote编写', 'note编写', 'bydChartDesigner'}}


    local chartDesigner = {}
    local chartDesigner = {}
第242行: 第266行:
    end
    end


   -- 依据byd是否存在处理单元格合并参数。
    local span
    local span
    if byd then
    if byd then
第254行: 第279行:
    local imageB = getImage(data('id'), args['图片'], args['Past曲绘'], args['Present曲绘'], args['Future曲绘'], args['Beyond曲绘'], args['第二曲绘图片'], args['画师'], args['Beyond画师'], data('ftrJacketDesigner'), data('bydJacketDesigner'), byd, 'b', args['图片显示控制'])
    local imageB = getImage(data('id'), args['图片'], args['Past曲绘'], args['Present曲绘'], args['Future曲绘'], args['Beyond曲绘'], args['第二曲绘图片'], args['画师'], args['Beyond画师'], data('ftrJacketDesigner'), data('bydJacketDesigner'), byd, 'b', args['图片显示控制'])


   -- 生成Grid表格的信息表;在后文中依据格式进行生成。
   --
    local infoList = {
    local infoList = {
      [1] = {
      [1] = 
       title(args['曲名'] or data('title') or dataNs('title'), args['第二曲名'], data('id') or dataNs('id') or #args > 1),
     { title(args['曲名'] or data('title') or dataNs('title'), args['第二曲名'], data('id') or dataNs('id') or #args > 1), { id = 'title'}},
     {id = 'title'}},
      [2] = 
      [2] = {
     { imageA or choice('[[文件:Songs '..tostring(data('id')) .. '.jpg|点此上传图片]]', data('id'), '[[文件:Songs '..tostring(dataNs('id')) .. '.jpg|点此上传图片]]', dataNs('id')), { id = 'top-image'}},
       imageA or choice('[[文件:Songs '..tostring(data('id')) .. '.jpg|点此上传图片]]', data('id'), '[[文件:Songs '..tostring(dataNs('id')) .. '.jpg|点此上传图片]]', dataNs('id')),
      [3] = 
     {id = 'top-image'}},
     { imageB or choice('[[文件:Songs '..tostring(data('id')) .. '.jpg|点此上传图片]]', data('id'), '[[文件:Songs '..tostring(dataNs('id')) .. '.jpg|点此上传图片]]', dataNs('id')), { id = 'right-image'}},
      [3] = {
      [4] = 
       imageB or choice('[[文件:Songs '..tostring(data('id')) .. '.jpg|点此上传图片]]', data('id'), '[[文件:Songs '..tostring(dataNs('id')) .. '.jpg|点此上传图片]]', dataNs('id')),
     { '曲目信息', {class = 'header'} },
     {id = 'right-image'}},
      [5] = 
      [4] = {
     { '曲师', { class = 'label'}},
       '曲目信息',
      [6] = 
     {class = 'header'}},
     { args['编曲'] or choice(link({'曲师', tostring(data('artist'))}) or link({'曲师', tostring(dataNs('artist'))}), data('artist') or dataNs('artist'), '', true), { class = 'data'}},
      [5] = {
      [7] = 
       '曲师',
     { '曲包', { class = 'label'}},
     {class = 'label'}},
      [8] = 
      [6] = {
     { args['曲包'] or choice('[['..tostring(choice(getData.packName(data('set')), data('set'), getData.packName(dataNs('set')), dataNs('set')))..']]',data('set') or dataNs('set'),'',true), { class = 'data'}},
       args['编曲'] or choice(link({'曲师', tostring(data('artist'))}) or link({'曲师', tostring(dataNs('artist'))}), data('artist') or dataNs('artist'), '', true),
      [9] = 
     {class = 'data'}},
     { '时长', { class = 'label'}},
      [7] = {
      [10] = 
       '曲包',
     { args['时长'] or '空', { class = 'data'}},
     {class = 'label'}},
      [11] = 
      [8] = {
     { 'BPM', { class = 'label'}},
       args['曲包'] or choice('[['..tostring(choice(getData.pack({data('set')}), data('set'), getData.pack({dataNs('set')}), dataNs('set')))..']]',data('set') or dataNs('set'),'',true),
      [12] = 
     {class = 'data'}},
     { args['BPM'] or data('bpm') or dataNs('bpm'), { class = 'data'}},
      [9] = {
      [13] = 
       '时长',
     { '谱面信息', { class = 'header'}},
     {class = 'label'}},
      [14] = 
      [10] = {
     { '难度', { class = 'label'}},
       args['时长'] or '空',
      [15] = 
     {class = 'data'}},
     { '[Past]', { class = 'pst-label'}},
      [11] = {
      [16] = 
       'BPM',
     { '[Present]', { class = 'prs-label'}},
     {class = 'label'}},
      [17] = 
      [12] = {
     { '[Future]', { class = 'ftr-label'}},
       args['BPM'] or data('bpm') or dataNs('bpm'),
      [18] = 
     {class = 'data'}},
     { bydMark(byd, args['曲名'], inNs), { class = 'byd-label'}},
      [13] = {
      [19] = 
       '谱面信息',
     { '等级', { class = 'label'}},
     {class = 'header'}},
      [20] = 
      [14] = {
     { args['Past等级'] or data('pstRating'), { class = 'pst-data'}},
       '难度',
      [21] = 
     {class = 'label'}},
     { args['Present等级'] or data('prsRating'), { class = 'prs-data'}},
      [15] = {
      [22] = 
       '[Past]',
     { args['Future等级'] or data('ftrRating'), { class = 'ftr-data'}},
     {class = 'pst-label'}},
      [23] = 
      [16] = {
     { args['Beyond等级'] or data('bydRating'), { class = 'byd-data'}},
       '[Present]',
      [24] = 
     {class = 'prs-label'}},
     { 'note数量', { class = 'label'}},
      [17] = {
      [25] = 
       '[Future]',
     { args['PastNote'] or '空', { class = 'pst-data'}},
     {class = 'ftr-label'}},
      [26] = 
      [18] = {
     { args['PresentNote'] or '空', { class = 'prs-data'}},
       bydMark(byd, args['曲名']),
      [27] = 
     {class = 'byd-label'}},
      { args['FutureNote'] or '空', {class = 'ftr-data'}},
      [19] = {
      [28] = 
       '等级',
     { args['BeyondNote'] or '空', { class = 'byd-data'}},
     {class = 'label'}},
      [29] = 
      [20] = {
     { '谱面设计', { class = 'label'}},
       args['Past等级'] or data('pstRating'),
      [30] = 
     {class = 'pst-data'}},
     { chartDesigner[1] or '空', { class = 'pst-data'}, span[1]},
      [21] = {
      [31] = 
       args['Present等级'] or data('prsRating'),
     { chartDesigner[2] or '空', { class = 'prs-data'}, span[2]},
     {class = 'prs-data'}},
      [32] = 
      [22] = {
     { chartDesigner[3] or '空', { class = 'ftr-data'}, span[3]},
       args['Future等级'] or data('ftrRating'),
      [33] = 
     {class = 'ftr-data'}},
     { chartDesigner[4] or '空', { class = 'byd-data'}, span[4]},
      [23] = {
      [34] = 
       args['Beyond等级'] or data('bydRating'),
     { '谱面信息(Joy-Con)', { class = 'header ns', id = 'ns-play-header'}},
     {class = 'byd-data'}},
      [35] = 
      [24] = {
     { '难度', { class = 'label ns'}},
       'note数量',
      [36] = 
     {class = 'label'}},
     { '[Past]', { class = 'pst-label ns'}},
      [25] = {
      [37] = 
       args['PastNote'] or '空',
     { '[Present]', { class = 'prs-label ns'}},
     {class = 'pst-data'}},
      [38] = 
      [26] = {
     { '[Future]', { class = 'ftr-label ns'}},
       args['PresentNote'] or '空',
      [39] = 
     {class = 'prs-data'}},
     { bydMark(byd, args['曲名'], inNs), { class = 'byd-label ns'}},
      [27] = {
      [40] = 
      args['FutureNote'] or '空', {class = 'ftr-data'}},
     { 'note数量', { class = 'label ns'}},
      [28] = {
      [41] = 
       args['BeyondNote'] or '空',
     { args['PastNoteNS'] or args['PastNote'], { class = 'pst-data ns'}},
     {class = 'byd-data'}},
      [42] = 
      [29] = {
     { args['PresentNoteNS'] or args['PresentNote'], { class = 'prs-data ns'}},
       '谱面设计',
      [43] = 
     {class = 'label'}},
     { args['FutureNoteNS'] or args['FutureNote'], { class = 'ftr-data ns'}},
      [30] = {
      [44] = 
       chartDesigner[1] or '空',
     { args['BeyondNoteNS'] or '空', { class = 'byd-data ns'}},
     {class = 'pst-data'}, span[1]},
      [45] = 
      [31] = {
     { '背景', { class = 'label'}},
       chartDesigner[2] or '空',
      [46] = 
     {class = 'prs-data'}, span[2]},
     { bgCov(args['背景']) or bgCov(data('bg')) or bgCov(dataNs('bg')), { class = 'data' , id = 'bg-normal' }},
      [32] = {
      [47] = 
       chartDesigner[3] or '空',
     { bgCov(args['Future背景']) , { class = 'data' , id = 'bg-ftr' }},
     {class = 'ftr-data'}, span[3]},
      [48] = 
      [33] = {
     { '更新时间', { id = 'update-data-label', class = 'label'}},
       chartDesigner[4] or '空',
      [49] = 
     {class = 'byd-data'}, span[4]},
     { dateCov(args['更新版本'], args['更新时间'], labelText('移动版'), 'arg') or dateCov(data('version'), tonumber(data('date')), labelText('移动版'), 'data'), { id = 'mobile-date-normal', class = 'data'}},
      [34] = {
      [50] = 
       '谱面信息(Joy-Con)',
     { dateCov(args['Beyond更新版本'], args['Beyond更新时间'], labelText('移动版'), 'arg') or '空', { id = 'mobile-date-byd', class = 'data'}},
     {class = 'header ns', id = 'ns-play-header'}},
      [51] = 
      [35] = {
     { dateCov(args['更新版本NS'], args['更新时间NS'], labelText('NS版'), 'arg') or dateCov(dataNs('version'), tonumber(dataNs('date')), labelText('NS版'), 'data'), { id = 'ns-date-normal', class = 'data ns'}},
       '难度',
      [52] = 
     {class = 'label ns'}},
     { '空', { id = 'ns-date-byd', class = 'data ns'}}
      [36] = {
   }
       '[Past]',
     {class = 'pst-label ns'}},
      [37] = {
       '[Present]',
     {class = 'prs-label ns'}},
      [38] = {
       '[Future]',
     {class = 'ftr-label ns'}},
      [39] = {
       bydMark(byd, args['曲名']),
     {class = 'byd-label ns'}},
      [40] = {
       'note数量',
     {class = 'label ns'}},
      [41] = {
       args['PastNoteNS'] or args['PastNote'],
     {class = 'pst-data ns'}},
      [42] = {
       args['PresentNoteNS'] or args['PresentNote'],
     {class = 'prs-data ns'}},
      [43] = {
       args['FutureNoteNS'] or args['FutureNote'],
     {class = 'ftr-data ns'}},
      [44] = {
       args['BeyondNoteNS'] or '空',
     {class = 'byd-data ns'}},
      [45] = {
       '背景',
     {class = 'label'}},
      [46] = {
       bgCov(args['背景']) or bgCov(data('bg')) or bgCov(dataNs('bg')),
     {class = 'data' , id = 'bg-normal' }},
      [47] = {
       bgCov(args['Future背景']) ,
     {class = 'data' , id = 'bg-ftr' }},
      [48] = {
       '更新时间',
     {id = 'update-data-label', class = 'label'}},
      [49] = {
       dateCov(args['更新版本'], args['更新时间'], labelText('移动版'), 'arg') or dateCov(data('version'), tonumber(data('date')), labelText('移动版'), 'data'),
     {id = 'mobile-date-normal', class = 'data'}},
      [50] = {
       dateCov(args['Beyond更新版本'], args['Beyond更新时间'], labelText('移动版'), 'arg') or '空',
     {id = 'mobile-date-byd', class = 'data'}},
      [51] = {
       dateCov(args['更新版本NS'], args['更新时间NS'], labelText('NS版'), 'arg') or dateCov(dataNs('version'), tonumber(dataNs('date')), labelText('NS版'), 'data'),
     {id = 'ns-date-normal', class = 'data ns'}},
      [52] = {
       '空',
     {id = 'ns-date-byd', class = 'data ns'}}}


    local box = mw.html.create('div')
    local box = mw.html.create('div')
第455行: 第432行:
    if (data('id') or dataNs('id')) and not(args['unset'])
    if (data('id') or dataNs('id')) and not(args['unset'])
      then
      then
      category = category..'[[分类:'..tostring(choice(getData.pack({data('set')}), data('set'), getData.pack({dataNs('set')}), dataNs('set'))) .. '曲包曲目]]'
      category = category..'[[分类:'..tostring(choice(getData.packName(data('set')), data('set'), getData.packName(dataNs('set')), dataNs('set'))) .. '曲包曲目]]'
    
    
      if data('side') == 1 or dataNs('side') == 1 or args['侧'] == '1'
      if data('side') == 1 or dataNs('side') == 1 or args['侧'] == '1'
第522行: 第499行:
    if noticeText ~= ''
    if noticeText ~= ''
      then
      then
      notice = mw.getCurrentFrame():expandTemplate {title = 'Collapse', args = {
      notice = mw.getCurrentFrame():expandTemplate {title = 'Collapse', args = { ['标题'] = '曲目信息模板提示信息', ['状态'] = '折叠',
       ['标题'] = '曲目信息模板提示信息', ['状态'] = '折叠',
        ['标题文字方向'] = 'center', ['标题颜色'] = '#dddddd',
        ['标题文字方向'] = 'center', ['标题颜色'] = '#dddddd',
        ['内容颜色'] = '#eeeeee', ['内容样式'] = 'width:800px',
        ['内容颜色'] = '#eeeeee', ['内容样式'] = 'width:800px',