Module:沙盒/Economy666/SongCollectionMulti:修订间差异

eden
无编辑摘要
(eden)
(未显示同一用户的4个中间版本)
第36行: 第36行:
end
end


local function artistLink(artist)
local cal = mw.loadJsonData 'Template:ComplexArtistsList.json'
local trans = mw.loadJsonData 'Template:Transition.json'
 
local function link(l, d)
   if d then
     return '[[' .. l .. '|' .. d .. ']]'
   else
     return '[[' .. l .. ']]'
   end
end
end
local onlyMobile = frame:expandTemplate{title = '仅', args = {'移动版', '', '图片角标'}}
local onlyNS = frame:expandTemplate{title = '仅', args = {'NS版', '', '图片角标'}}


local sectionCode = {unknown = 0, free = 1, archive = 2, mainstory = 3, sidestory = 4, collab = 5, single = 6}
local sectionCode = {unknown = 0, free = 1, archive = 2, mainstory = 3, sidestory = 4, collab = 5, single = 6}
第45行: 第55行:
-- local plat = 'mobile'
-- local plat = 'mobile'
-- 不对song下述提及的字段存在性做检验
-- 不对song下述提及的字段存在性做检验
local diffId = {['edenwacca']='eden'}
local multi_song={}
local multi_song={}
第63行: 第75行:
multi_song[song.id] = song
multi_song[song.id] = song
end
end
end
for _,v in pairs(diffId) do
multi_song[v] = nil
end
end
第78行: 第93行:
local display_plat = ''
local display_plat = ''
if mobile_id[song.id] then
local NSid = id
if mobile_id[id] then
   display_plat = display_plat .. '[[文件:Icon Smartphone.png|16px|link=曲目列表 (移动版)]]'
   display_plat = display_plat .. '[[文件:Icon Smartphone.png|16px|link=曲目列表 (移动版)]]'
end
end
if ns_id[song.id] then
if ns_id[id] then
   display_plat = display_plat .. '[[文件:Icon Nintendo switch.png|16px|link=曲目列表 (Nintendo Switch版)]]'
elseif diffId[id] then
   display_plat = display_plat .. '[[文件:Icon Nintendo switch.png|16px|link=曲目列表 (Nintendo Switch版)]]'
   display_plat = display_plat .. '[[文件:Icon Nintendo switch.png|16px|link=曲目列表 (Nintendo Switch版)]]'
   NSid = diffId[id]
end
end
if display_plat == '' then
if display_plat == '' then
第93行: 第112行:
data:insert(input '标题' or table.concat({'[[' .. mad.linkTitle(song) .. ']]', unpack(otherTitles(song))}, '<br>'))
data:insert(input '标题' or table.concat({'[[' .. mad.linkTitle(song) .. ']]', unpack(otherTitles(song))}, '<br>'))
local cal = mw.loadJsonData 'User:Economy666/ComplexArtistsList.json'
local artist = cal[string.gsub(song.artist, ' ' , '') ]
local artist = cal[string.gsub(song.artist, ' ' , '') ]
if not artist then
if not artist then
artist = input '音乐家' or mw.ustring.gsub(
artist = mw.ustring.gsub(
song.artist, '[一-龠ぁ-ゔァ-ヴー々〆〤ヶ]+',
song.artist, '[一-龠ぁ-ゔァ-ヴー々〆〤ヶ]+',
function(v) return ('<span lang="ja">-{%s}-</span>'):format(v) end
function(v) return ('<span lang="ja">-{%s}-</span>'):format(v) end
第102行: 第120行:
artist = '[[曲师列表#'..song.artist..'|'..artist..']]'
artist = '[[曲师列表#'..song.artist..'|'..artist..']]'
end
end
data:insert(artist)
data:insert(input ' 音乐家' or artist)
local pack_main = input ' 所属曲包' or packItem['name']
local function link(v) return '[['.. v ..']]' end
local onlyMobile = frame:expandTemplate{title = '仅', args = {'移动版', '', '图片角标'}}
local onlyNS = frame:expandTemplate{title = '仅', args = {'NS版', '', '图片角标'}}
if mobile_id and ns_id then
local cc = 'Collaboration %- Collaboration'
packItem_ns = mad.packQueryWrap(song.set, 'ns')
local ccl = 'Collaboration#Collaboration'
local pack_ns = packItem_ns['name']
local ccd = 'Collaboration'
local pack_main = string.gsub(trans.packName[song.set] or packItem['name'], cc, ccl)
local pack_md = string.gsub(pack_main, ccl, ccd)
if mobile_id[id] and ns_id[NSid] then
packItem_ns = mad.packQueryWrap(ns_song[NSid].set, 'ns')
local pack_ns = string.gsub(trans.packName[ns_song[NSid].set] or packItem_ns['name'], cc, ccl)
local pack_nd = string.gsub(pack_ns, ccl, ccd)
if pack_ns == pack_main then
if pack_ns == pack_main then
pack = link(pack_main)
pack = link(pack_main, pack_md)
else
else
pack = link(pack_main) --.. onlyMobile .. '\n' ..pack_ns .. onlyNS
pack = link(pack_main, pack_md) .. onlyMobile .. '<br \>' ..link(pack_ns, pack_nd) .. onlyNS
end
end
elseif mobile_id then
elseif mobile_id[id] then
pack = link(pack_main) .. onlyMobile
pack = link(pack_main, pack_md) .. onlyMobile
else 
else 
pack = link(pack_main) .. onlyNS
pack = link(pack_main, pack_md) .. onlyNS
end
end


第127行: 第146行:
local pack_n = packItem_ns['name']
local pack_n = packItem_ns['name']
end
end
data:insert(pack)
data:insert(input '所属曲包' or pack)
local bpm = tonumber(input 'BPM') or song.bpm_base
local bpm = tonumber(input 'BPM') or song.bpm_base
915

个编辑