|
|
(未显示同一用户的7个中间版本) |
第1行: |
第1行: |
| local p={} | | local p = { single = { idx = -100, name = "Memory Archive" } } |
| local W=mw | | local plst = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate { title = "packlist" }).packs |
| function LoadJson(filename)
| | local special = { base = true, omatsuri = true, observer = true } |
| return W.text.jsonDecode(W.getCurrentFrame():expandTemplate{ title = filename })
| | for i, v in ipairs(plst) do |
| end
| | local co = v.custom_banner and not special[v.id] |
| | | local name = v.name_localized.en |
| local packPrior,packName=(function ()
| | if co then name = name .. " Collaboration" end |
| local huge=16383
| | if (p[v.pack_parent or ""] or p.single).name:find " Collaboration" then |
| local P,N={single = huge},{single = 'Memory Archive'}
| | name = p[v.pack_parent].name .. " - " .. name |
| local contest={['base']=true,['observer']=true,['omatsuri']=true}
| |
| local conbine=function(rt,lf)return rt..'#'..rt..' - '..lf..'|'..rt..' - '..lf end
| |
| for i,v in ipairs(LoadJson("packlist").packs) do
| |
| P[v.id]=i
| |
| N[v.id]=v.name_localized.en
| |
| if v.pack_parent then
| |
| P[v.id]=P[v.pack_parent]
| |
| N[v.id]=conbine(N[v.pack_parent],N[v.id])
| |
| elseif v.custom_banner and not contest[v.id] then
| |
| N[v.id]=N[v.id]..' Collaboration'
| |
| end
| |
| end | |
| for i,v in ipairs(LoadJson("packlist NS").packs) do
| |
| if not N[v.id] and v.pack_parent then--single-append
| |
| P[v.id]=P[v.pack_parent]
| |
| N[v.id]=conbine(N[v.pack_parent],v.name_localized.en)
| |
| end
| |
| end | |
| for i,v in ipairs(N) do
| |
| N[i]='[['..v..']]'
| |
| end
| |
| return P,N
| |
| end)()
| |
| | |
| local songLines,songList=(function ()
| |
| local tmp,LS,LST={},{},{}
| |
| local mbIcon,nsIcon='[[文件:Icon Smartphone.png|16px|link=曲目列表 (移动版)]]','[[文件:Icon Nintendo switch.png|16px|link=曲目列表 (Nintendo Switch版)]]'
| |
| local NS_byd_set={['tempestissimo']=true}
| |
| local display={['ifi']='#1f1e33',['aiueoon']='AI[UE]OON',['quon']='Quon (Feryquitous)',['quonwacca']='Quon (DJ Noriken)'}
| |
| for i,v in ipairs(LoadJson("songlist").songs) do
| |
| v.__plat={mbIcon}
| |
| tmp[v.id]=v
| |
| end
| |
| for i,v in pairs(display) do | |
| tmp[i].__title=v
| |
| tmp[i].__titleLink=v..'|'..tmp[i].title_localized.en
| |
| end
| |
| for i,v in ipairs(LoadJson("songlist NS").songs) do
| |
| if tmp[v.id] then
| |
| tmp[v.id].__plat[2]=nsIcon
| |
| if tmp[v.id].set~=v.set then
| |
| tmp[v.id].__NS_pack_alt=v.set
| |
| end
| |
| else
| |
| v.__plat={nsIcon}
| |
| tmp[v.id]=v
| |
| end
| |
| end
| |
| for i,v in pairs(tmp) do
| |
| table.insert(LST,i)
| |
| local page=W.title.new(v.__title or v.title_localized.en):getContent()
| |
| local dur=page:match(" 时长%s*=%s*0?(%d:%d%d)")
| |
| local plat,pack,bpm,rate='',packName[v.set],v.bpm,''
| |
| local mbMark,nsMark=W.getCurrentFrame():expandTemplate{title='仅',args={'移动版','','图片角标'}},W.getCurrentFrame():expandTemplate{title='仅',args={'NS版','','图片角标'}}
| |
| for j,d in ipairs(v.__plat) do
| |
| plat=plat..d
| |
| end
| |
| if v.__NS_pack_alt then
| |
| pack=pack..mbIcon..'<br />'..packName[v.__NS_pack_alt]..nsIcon
| |
| end
| |
| if not tonumber(bpm) then | |
| bpm='data-sort-value='..v.bpm_base..'|'..bpm
| |
| end
| |
| for j,d in ipairs(v.difficulties) do
| |
| rate=rate..'||'..d.rating
| |
| if d.ratingPlus then
| |
| rate=rate..'+'
| |
| end
| |
| end
| |
| if v.difficulties[4] then
| |
| if not NS_byd_set[v.id] then
| |
| rate=rate..mbMark
| |
| end
| |
| else
| |
| rate=rate..'||/'
| |
| end
| |
| page=nil
| |
| LS[i]='|'..plat..'\n|[[文件:Songs '..v.id..'.jpg|75px]]'
| |
| ..'\n|[['..(v.__titleLink or v.title_localized.en)..']]'
| |
| ..'\n| '..v.artist--gengaozuo(-45),so can't omit sapce
| |
| ..'\n|'..pack
| |
| ..'\n|'..bpm
| |
| ..'\n|0'..dur
| |
| ..'\n'..rate:sub(2)
| |
| ..'\n|-\n'
| |
| end
| |
| table.sort(LST,function (a, b)
| |
| if packPrior[tmp[a].set]~=packPrior[tmp[b].set] then
| |
| return packPrior[tmp[a].set]<packPrior[tmp[b].set]
| |
| else
| |
| return tmp[a].date<tmp[b].date
| |
| end
| |
| end)
| |
| return LS,LST
| |
| end)()
| |
| | |
| function p.main(frames)
| |
| local chart=''
| |
| for i,v in ipairs(songList) do
| |
| chart=chart..songLines[v]
| |
| end | | end |
| return chart | | p[v.id] = { idx = i, name = name } |
| end | | end |
|
| |
| return p | | return p |