跳到内容

User:在咕咕咕的咕子/Sandbox1:修订间差异

无编辑摘要
(copy Module:DesignerSong
第1行: 第1行:
<includeonly>|-
p={}
| rowspan="{{#expr: {{#if:{{{谱师|}}}|+1}}{{#if:{{{PST谱师|}}}|+1}}{{#if:{{{PRS谱师|}}}|+1}}{{#if:{{{FTR 谱师|}}}|+1}}{{#if:{{{ETR谱师|}}}|+1}}{{#if:{{{BYD谱师|}}}|+1}}{{#if:{{{BYD曲名|}}}|{{#ifeq: {{{ 曲名}}} | {{{BYD曲名}}} | +0 | -1}}}} }}" |{{{ 曲名}}}
local DL = mw.loadJsonData 'Template:DesignersList.json'
| rowspan="{{#expr: {{#if:{{{谱师|}}}|+1}}{{#if:{{{PST谱师|}}}|+1}}{{#if:{{{PRS谱师|}}}|+1}}{{#if:{{{FTR谱师|}}}|+1}}{{#if:{{{ETR谱师|}}}|+1}}{{#if:{{{BYD谱师|}}}|+1}} }}" |{{{曲包}}}
local multiId = mw.loadJsonData 'Template:Transition.json'.multiId
| {{#if:{{{谱师|}}}|colspan="1" style="height: 35px"|colspan="1" style="height: 20px"}}{{#if:{{{谱师|}}}|| width="10%"}} | {{#if: {{{谱师|}}} | 全难度{{!}}{{!}}{{{谱师}}} | {{#if:{{{PST谱师|}}}|{{color|PST|Past}}|{{#if:{{{PRS谱师|}}}|{{color|PRS|Present}}|{{#if:{{{FTR 谱师|}}}|{{color|FTR|Future}}|{{#if:{{{ETR谱师|}}}|{{color|ETR|Eternal}}|{{color|BYD|Beyond}}}}}}}}}}}}
local trans = mw.loadJsonData 'Template:Transition.json'
{{#if: {{{PST谱师|}}}| {{!}} rowspan="{{#ifeq: {{{PST谱师|}}} | {{{PRS谱师|}}} | {{#ifeq: {{{PRS谱师|}}} | {{{FTR谱师|}}} | {{#ifeq: {{{FTR谱师|}}} | {{{ETR谱师|}}} | {{#ifeq: {{{ETR谱师|}}} | {{{BYD谱师|}}} | 5 | 4 }} | 3 }} | 2 }} | 1 }}" {{!}} {{{PST谱师}}} |{{#if:{{{PRS谱师|}}}|{{!}} rowspan="{{#ifeq: {{{PRS谱师|}}} | {{{FTR谱师|}}} | {{#ifeq: {{{FTR谱师|}}} | {{{ETR谱师|}}} | {{#ifeq: {{{ETR谱师|}}} | {{{BYD谱师|}}} | 4 | 3 }} | 2 }} | 1 }}" {{!}} {{{PRS谱师}}}|{{#if:{{{FTR 谱师|}}}|{{!}} rowspan="{{#ifeq: {{{FTR谱师|}}} | {{{ETR谱师|}}} | {{#ifeq: {{{ETR谱师|}}} | {{{BYD谱师|}}} | 3 | 2 }} | 1 }}" {{!}} {{{FTR谱师}}}| {{#if:{{{ETR谱师|}}}|{{!}} rowspan="{{#ifeq: {{{ETR谱师|}}} | {{{BYD谱师|}}} | 2 | 1 }}"{{#if:{{{BYD谱师|}}}|{{!}}{{{BYD谱师}}}|}} }} }} }} }}
 
| rowspan="{{#expr: {{#if:{{{谱师|}}}|+1}}{{#if:{{{PST谱师|}}}|+1}}{{#if:{{{PRS谱师|}}}|+1}}{{#if:{{{FTR谱师|}}}|+1}}{{#if:{{{ETR谱师|}}}|+1}}{{#if:{{{BYD谱师|}}}|+1}} }}" |{{{备注}}}{{#if:{{{PST谱师|}}}|{{#if:{{{PRS谱师|}}}|<nowiki></nowiki>
local mad = require 'Module:AnotherData'
{{!}}-
local data = require "Module:Arcaea Data"
{{!}}style="height: 15px"{{!}} {{color|PRS|Present}}
local CL = require 'Module:ConvertLink'
{{#ifeq: {{{PST谱师|}}} | {{{PRS谱师|}}} ||{{!}} rowspan="{{#ifeq: {{{PRS谱师|}}} | {{{FTR谱师|}}} | {{#ifeq: {{{FTR谱师|}}} | {{{ETR谱师|}}} | {{#ifeq: {{{ETR谱师|}}} | {{{BYD谱师|}}} | 4 | 3 }} | 2 }} | 1 }}" {{!}} {{{PRS谱师}}}}}}}|}}{{#if:{{{PST谱师|}}}{{{PRS谱师|}}}|{{#if:{{{FTR谱师|}}}|<nowiki></nowiki>
 
{{!}}-
local CDL = DL.complex
{{!}}style="height: 15px"{{!}} {{color|FTR|Future}}
local SDL = DL.simple
{{#ifeq: {{{PRS谱师|}}} | {{{FTR谱师|}}} || {{!}} rowspan="{{#ifeq: {{{FTR谱师|}}} | {{{ETR谱师|}}} | {{#ifeq: {{{ETR谱师|}}} | {{{BYD谱师|}}} | 3 | 2 }} | 1 }}" {{!}} {{{FTR谱师}}}}}}}|}}{{#if:{{{PST谱师|}}}{{{PRS谱师|}}}{{{FTR谱师|}}}|{{#if:{{{ETR 谱师|}}}|<nowiki></nowiki>
local specialSong = DL.special
{{!}}-
 
{{!}}style="height: 15px"{{!}} {{color|ETR|Eternal}}
local queryMO = data.allSongInformation("id", "mobile")
{{#ifeq: {{{FTR 谱师|}}} | {{{ETR 谱师|}}} || {{!}} rowspan="{{#ifeq: {{{ETR谱师|}}} | {{{BYD谱师|}}} | 2 | 1 }}" {{!}} {{{ETR谱师}}}}}}}|}}{{#if:{{{PST谱师|}}}{{{PRS谱师|}}}{{{FTR谱师|}}}{{{ETR谱师|}}}|{{#if:{{{BYD谱师|}}}|<nowiki></nowiki>
local queryNS = data.allSongInformation("id", "ns")
{{!}}-
local diffList = {'PST', 'PRS', 'FTR', 'BYD', 'ETR'}
{{#if: {{{BYD曲名|}}}|{{#ifeq: {{{曲名}}} | {{{BYD曲名}}} || {{!}} {{{BYD曲名}}}}}}}
local diffNameList = {PST='Past', PRS='Present', FTR='Future', BYD='Beyond', ETR='Eternal'}
{{!}}style="height: 15px"{{!}} {{color|BYD|Beyond}}
local bydAppend = {[284]='last'}
{{#ifeq: {{{ETR谱师|}}} | {{{BYD谱师|}}} || {{!}}{{{BYD谱师}}}}}}}}}</includeonly>
 
<noinclude>{| class="wikitable" border="1" cellspacing="1" cellpadding="5" style="text-align:center" width="100%"
local songDiffDesigner={}
! width="20%" style="position:-webkit-sticky;position:sticky;top:0px;" |曲名
local specialDesigner ={}
! width="20%" style="position:-webkit-sticky;position:sticky;top:0px;" |所属曲包
local LinkedDesignerMemory={['/']='/'}
! colspan="2" width="40%" style="position:-webkit-sticky;position:sticky;top:0px;" |谱师名义
local bydAppendInfo={}
! width="20%" style="position:-webkit-sticky;position:sticky;top:0px;" |备注
 
{{User:在咕咕咕的咕子/Sandbox1
local function linkDesigner(designer, songid)
|曲名=[[Sayonara Hatsukoi]]
if LinkedDesignerMemory[designer] then return LinkedDesignerMemory[designer] end
|BYD曲名=[[Sayonara Hatsukoi]]
local Linked = CL.designerLink(designer, songid)
|曲包=[[Arcaea]]
LinkedDesignerMemory[designer] = Linked
|PST谱师=Nitro
return Linked
|PRS谱师=Nitro
end
|FTR谱师=Nitro
 
|ETR谱师=Luxance + Exschwasion
local function readList(appendList)
|备注=
local pickList = {}
}}
   local mobileList = {}
{{User:在咕咕咕的咕子/Sandbox1
   local listMO = mad.listOf('songs', 'mobile')
|曲名=[[PRAGMATISM]]
|BYD曲名=[[PRAGMATISM|PRAGMATISM -RESURRECTION-]]
local function write(songid, songDiffList)
|曲包=[[Eternal Core]]
songDiffDesigner[songid]={}
|PST谱师={{lang|ja|東星}}
local num, sameCount = 0,0
|PRS谱师={{lang|ja|東星}}
local lastDesigner = nil
|FTR谱师={{lang|ja|東星}}
for _,level in ipairs(songDiffList) do
|BYD谱师=THE LAST DREAM
local diff = diffList[level.ratingClass+1]
|备注=根据谱面特征推断,THE LAST DREAM疑似Toaster
local designer = level.chartDesigner
}}
num=num+1
{{User:在咕咕咕的咕子/Sandbox1
if lastDesigner ~= designer then
|曲名=[[Ignotus]]
sameCount = 0
|BYD曲名=[[Ignotus|Ignotus Afterburn]]
if not pickList[designer] then
|曲包=[[Arcaea]]
pickList[designer] = {}
|PST谱师=Toaster
end
|PRS谱师=Toaster
if not pickList[designer][songid] then
|FTR谱师=Toaster
pickList[designer][songid] = {}
|BYD谱师=Toaster × {{lang|ja|石樂}}
end
|备注=Toaster难得的良心之作
pickList[designer][songid][diff]=true
}}
mobileList[songid]=true
{{User:在咕咕咕的咕子/Sandbox1
table.insert(songDiffDesigner[songid], {diff, linkDesigner(designer, songid)})
|曲名=[[Red and Blue]]
if specialSong[songid] then
|BYD曲名=[[Red and Blue|Red and Blue and Green]]
specialDesigner[designer]=true
|曲包=[[Arcaea]]
end
|PST谱师=-chartaesthesia- RED side
lastDesigner=designer
|PRS谱师=side BLUE -chartaesthesia-
else
|FTR谱师=-chartaesthesia-<br>LEFT=BLUE RED=RIGHT
sameCount=sameCount+1
|BYD谱师=moonquay "retrograde"<br>BLUE=LEFT RIGHT=RED
table.insert(songDiffDesigner[songid], {diff, nil})
|备注=开启“色彩辅助”模式时,谱师名义中的RED会被替换为YELLOW
-- if songDiffDesigner[songid][num-sameCount] then
}}
songDiffDesigner[songid][num-sameCount][3]=sameCount+1
{{User:在咕咕咕的咕子/Sandbox1
-- end
|曲名=[[Singularity]]
-- songDiffDesigner[songid][num][3]=sameCount+1
|BYD曲名=[[Singularity|Singularity VVVIP]]
end
|曲包=[[Binary Enfold]]
   end
|PST谱师={{lang|ja|東星}}
end
|PRS谱师={{lang|ja|東星}}
  
|FTR谱师={{lang|ja|東星※コラプサー}}
   for index, id in pairs(bydAppend) do
|BYD谱师=Exschwasion against. {{lang|ja|絶滅}}
bydAppendInfo[id] = listMO[index].difficulties[4]
|备注=
bydAppendInfo[id].id=listMO[index].id
}}
end
{{User:在咕咕咕的咕子/Sandbox1
  
|曲名=[[dropdead]]
   for index, song in ipairs(listMO) do
|BYD曲名=[[dropdead|overdead.]]
   local songid = song.id
|曲包=[[Memory Archive]]
   local songDiffList = song.difficulties
|PST谱师=-chartaesthesia-<br>LIMITER:10%
   if bydAppendInfo[songid] then table.insert(songDiffList,bydAppendInfo[songid]) end
|PRS谱师=-chartaesthesia-<br>LIMITER:100%
   if not bydAppend[index] then
|FTR谱师=-chartaesthesia-<br>LIMITER:25% (OVERDRIVE:+100%)
   write(songid, songDiffList)
|BYD谱师={{lang|ja|絶滅}} over {{lang|ja|夜浪}}.
   end
|备注=Limiter的百分比代表了谱面下落速度(+100%即25%+100%=125%)
   end
}}
  
|-
--  有独占ns曲目再启用
| rowspan=3 | [[Last]]
--  for index, song in ipairs(listNS) do
| rowspan=5 | [[Final Verdict#Silent Answer|Silent Answer]]
-- local songid = song.id
| style="height: 20px" | {{color|PST|Past}} || rowspan=5 | Arcaea
-- local songDiffList = song.difficulties
| rowspan=5 | 游戏名称,可视作是“为游戏故事画上句号”之意<br>也可视作指代记忆碎片本身:“Arcaea”
-- if not mobileList.songid then
|-
-- write(songid, songDiffList)
| {{color|PRS|Present}}
-- end
|-
-- end
| {{color|FTR|Future}}
  
|-
for songid, songDiffList in pairs(appendList) do
| [[Last|Last <nowiki>|</nowiki> Moment]]
   write(songid, songDiffList)
| rowspan=2 | {{color|BYD|Beyond}}
   end
|-
return pickList
| [[Last|Last <nowiki>|</nowiki> Eternity]]
end
{{User:在咕咕咕的咕子/Sandbox1
 
|曲名=[[Vicious Heroism]]
local function genList(pickList)
|BYD曲名=[[Vicious Heroism|Vicious <nowiki>[ANTi]</nowiki> Heroism]]
local function cate(singleList, cArtist, artist)
|曲包=[[Absolute Reason]]
local artist = artist or cArtist
|PST谱师=Nitro vanquish Toaster.
if not singleList[artist] then singleList[artist] = {} end
|PRS谱师=Nitro vanquish Toaster.
     for id,diff in pairs(pickList[cArtist]) do
|FTR谱师=Nitro vanquish Toaster.
     singleList[artist][id]=diff
|BYD谱师=<nowiki>[FUTiLE] Defiance</nowiki>
     end
|备注=Beyond难度谱师名义模仿曲名(用“[ ]”框起的单词除i外全部大写),意为“徒劳的反抗”
     return singleList
}}
end
|}
<!--目前只有Beyond难度拥有不同曲名,Last因为其双曲目的特殊性所以不用专门在Template做处理,基于此就懒得做全难度谱师显示支持与其他难度曲名支持--></noinclude>
   local singleList = {}
   for cDesigner,songids in pairs(pickList) do
   local designerList={}
     if CDL[cDesigner] then
if CDL[cDesigner].__FullData__ then
for _,text in pairs(CDL[cDesigner].__FullData__) do
if text.link then
           local designer = text['link']
if not designerList[designer] then
singleList = cate(singleList, cDesigner, designer)
designerList[designer]=true
end
end
end
else
for link in pairs(CDL[cDesigner]) do
           local designer = link
if not designerList[designer] then
singleList = cate(singleList, cDesigner, designer)
designerList[designer]=true
end
end
end
     else
     local temp_text = cDesigner
     local count = 0
     for _,data in ipairs(SDL) do
local designer = data.link
local dis = data.display
if string.find(temp_text, dis) then
singleList = cate(singleList, cDesigner, designer)
designerList[designer]=true
temp_text = string.gsub(temp_text, dis, '')
count = count + 1
end
end
if count == 0 then
if specialDesigner[cDesigner] then
singleList = cate(singleList, cDesigner, '与主线剧情相关的特殊名义')
else
singleList = cate(singleList, cDesigner, '其他未确认 谱师 名义')
end
end
     end
end
   return singleList
end
 
-- Function to convert table to string
-- local function t2s(tbl, indent)
--   indent = indent or 0
--   local toPrint = string.rep(" ", indent) .. "{\n"
  
--   for k, v in pairs(tbl) do
--     local keyString = tostring(k)
--     local valueString
 
--     if type(v) == "table" then
--       valueString = t2s(v, indent + 2)
--     else
--       valueString = tostring(v)
--     end
 
--     toPrint = toPrint .. string.rep(" ", indent + 2) .. "[" .. keyString .. "] = " .. valueString .. ",\n"
--   end
 
--   toPrint = toPrint .. string.rep(" ", indent) .. "}"
--   return toPrint
-- end
 
local function songTitle(id,byd)
local display
local title = queryMO(id, 'title') or queryNS(id, 'title')
if byd then
display = queryMO(id, 'bydSongName')
-- 如果有新的ns独占byd曲目再使用
-- display = queryMO(id, 'bydSongName') or queryNS(id, 'bydSongName') or 'cant find BYD'
if not display then
return nil
end
else
display = title
end
local res = trans.songNameToDisplayName[title]
if res then return res..'|'..display end
res = trans.sameName[title]
if res then return res[id]..'|'..display end
if title then return title..'|'..display
else return nil end
end
 
local function songPack(id)
local packid,plat,isNS
-- if queryNS(id, 'set') then
-- packid = queryNS(id, 'set')
-- plat = 'ns'
-- isNS = 1
if queryMO(id, 'set') then
packid = queryMO(id, 'set')
else
return nil
end
local packName = trans.packName[packid] or mad.packQueryWrap(packid, plat).name
local packLink = CL.packLink(packName,1,isNS)
return packLink
end
 
local head = '\n{| class="wikitable" border="1" cellspacing="1" cellpadding="5" style="text-align:center" width="100%"\n'
head = head .. '! width="20%" style="position:-webkit-sticky;position:sticky;top:0px;" | 曲名 \n'
head = head .. '! width="20%" style="position:-webkit-sticky;position:sticky;top:0px;" | 所属曲包 \n'
head = head .. '! colspan="2" width="40%" style="position:-webkit-sticky;position:sticky;top:0px;" | 谱师 名义 \n'
head = head .. '! width="20%" style="position:-webkit-sticky;position:sticky;top:0px;" |备注 \n'
 
local ratingSortMemory ={}
local function ratingSort(rating)
local findInMemory = ratingSortMemory[rating]
if findInMemory then return findInMemory end
local num
if string.find(rating, '+') then
num = tonumber(string.match(rating,'%d+'))*2 +1
else
num = tonumber(rating)*2
end
ratingSortMemory[rating] = num
return num
end
 
 
function p.main(frame)
local parentArgs = frame:getParent().args
local Args = frame.args
local function getOrder(name)
local orderArg = Args[name]
if orderArg then return mw.text.split(orderArg,'\n') end
end
local function getDescription(title)
return parentArgs[title .. '.description'] or ''
end
local function getText(dasigner, songid)
local argName = dasigner..'.'..songid .. '.text'
return parentArgs[argName] or '<span title="'.. argName .. '">' .. '-'..'</span>'
end
local function color(diff,theText)
theText = theText or (diffNameList[diff] or '?')
return frame:expandTemplate{ title = "color", args = {diff, theText} }
end
local append = Args['appendList']
local appendList = {}
if append then
local list = mw.text.split(append,'\n')
for _,id in pairs(list) do
appendList[id] = {}
local designerList = {}
for i=0,4 do
local diffDesigner = Args[id .. '.'.. i ..'.designer']
if diffDesigner then
table.insert(designerList,{ratingClass = i, chartDesigner = diffDesigner})
-- chartDesigner ratingClass
end
end
-- appendList[id].pack = Args[id .. '.pack']
appendList[id] = designerList
end
end
local pickList = readList(appendList)
local singleList = genList(pickList)
 
local function songUnit(songid,text)
if not songDiffDesigner[songid] then return '' end
   local data = songDiffDesigner[songid]
   local name =  songTitle(songid) or Args[songid .. '.title'] or '???'
   local nameBYD = {songTitle(songid,true)}
   table.insert(nameBYD, bydAppendInfo[songid] and songTitle(bydAppendInfo[songid].id))
   local pack = songPack(songid) or Args[songid .. '.pack'] or '/'
   if data[1][3] and data[1][3]==3 and #data==3 then
   local PST_PRS_FTR = color(diffList[1],'全')..color(diffList[2],'难')..color(diffList[3],'度')
   -- local PST_PRS_FTR = '全难度'
   local style = '|style="height: 35px"'
   return '|-\n'.. style ..'|[['..name..']]||'..pack..'||'..PST_PRS_FTR..'||'..data[1][2]..'\n|'..text..'\n|-\n'
   end
   local row = #data
   local wikiText = ''
   local rowspanSong = nameBYD and ('|rowspan='.. row-#nameBYD ..'|') or ('|rowspan='.. #data ..'|')
   local rowspan ='|rowspan='.. row ..'|'
   wikiText = wikiText .. '|-\n'..rowspanSong ..'[['..name..']]'..'\n'
   wikiText = wikiText .. rowspan ..pack ..'\n'
   local j = 1
   local style='|style="height: 15px" width="10%"'
   for num, i in ipairs(data) do
   wikiText = wikiText ..style
   if nameBYD[1] and i[1] == 'BYD' then
   wikiText = wikiText ..'|'..'[['..(nameBYD[1] or '')..']]'..'\n'
   -- j = j + 1
   end
   local diffFormat = '| '..(i[1] and color(i[1]) or '')
   local designerFormat = i[3] and '||rowspan='.. i[3] ..'|' ..i[2]  or (i[2] and '||'..i[2] or '')
     wikiText = wikiText .. diffFormat ..designerFormat..'\n'
   wikiText = wikiText .. (num == 1 and rowspan .. (text or '')..'\n' or '')
   wikiText = wikiText ..'\n|-\n'
   end
   return wikiText
end
local function cateText(cate, titelStr, formatJa)
local theText = ''
local sectionCode = {unknown = 100, free = 1, archive = 2, mainstory = 3, sidestory = 4, collab = 5, single = 6}
function sort_fun(a, b)
a, b = a.sort, b.sort
for i = 1, 3 do
local d = a[i] - b[i]
if d ~= 0 then return d < 0 end
end
return a[4]<b[4]
end
local function getSongSort(songs)
local songSort = {}
for songid, diff in pairs(songs) do
local packItem = mad.packQueryWrap(queryMO(songid, 'set'), 'mobile')
local sortLevel = ratingSort(queryMO(songid, 'ftrRating') or 0)
table.insert(songSort, {
id=songid,
sort={
sectionCode[packItem['section']],
packItem['numero'] or Args[songid..'.sortNum'] or 0,
sortLevel,
songid
}})
end
table.sort(songSort, sort_fun)
return songSort
end
local function writeText(designer, songs)
local songSort = getSongSort(songs)
local designerTitle = designer
if formatJa and mw.ustring.match(designer,'[一-龠ぁ-ゔァ-ヴー々〆〤ヶ]+') then
designerTitle = '<span lang="ja">' .. designer .. '</span>'
end
theText = theText .."\n"..titelStr.. designerTitle ..titelStr.."\n"
theText = theText .. getDescription(designer)
theText = theText .. head
for _,data in ipairs(songSort) do
local songid = data.id
local text = getText(designer, songid)
theText = theText .. songUnit(songid,text)
end
theText = theText .. '|}'
end
if cate then
for _,designer in ipairs(cate) do
local songs = singleList[designer] or {}
writeText(designer, songs)
singleList[designer]=nil
end
else
for designer,songs in pairs(singleList) do
writeText(designer, songs)
singleList[designer]=nil
end
end
return theText
end
 
local common = getOrder("common")
local commonText = cateText(common, '==')
local rare = getOrder("rare")
local rareTitle = '非常驻 谱师'
local rareSpanid = '\n<span id="已确认的其他谱师名义及相关曲目名单" />'
local rareText = rareSpanid.. '\n=='.. rareTitle .. '==\n' .. getDescription(rareTitle)
rareText = rareText .. cateText(rare, '===')
local uncommonTitle = '未确认 谱师'
local uncommonSpanid = '\n<span id="未采用常驻 谱师 名义的曲目名单及所用名义" />'
local uncommonText = uncommonSpanid..'\n=='.. uncommonTitle .. '==\n' .. getDescription(uncommonTitle)
local headText = cateText(getOrder("uncommon_head"), '===', true)
local endText = cateText(getOrder("uncommon_end"), '===')
uncommonText = uncommonText..headText..cateText(nil, '===')..endText
 
return commonText..rareText..uncommonText
-- return tableToString(appendList) ..'\n'..commonText..rareText..uncommonText
end
 
return p
1,205

个编辑