6,304
个编辑
小无编辑摘要 |
小无编辑摘要 |
||
第4行: | 第4行: | ||
local trans = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{ title = 'Template:Transition.json' }) | local trans = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{ title = 'Template:Transition.json' }) | ||
local function | |||
local function cv() | |||
local list = {} | local list = {} | ||
for i,k in pairs(songlist['songs']) | for i,k in pairs(songlist['songs']) | ||
第28行: | 第29行: | ||
local specialSongNameConverter = { | |||
["#1f1e33"] = "#1f1e33", | |||
["AI[UE]OON"] = "AI[UE]OON", | |||
["Last | Eternity"] = "Last", | |||
["Last | Moment"] = "Last" | |||
} | |||
local n = { | |||
["Last | Eternity"] = "Last \| Eternity", | |||
["Last | Moment"] = "Last \| Moment" | |||
} | |||
function p.main( | function p.main() | ||
local list = {} | |||
local | |||
local name, link | local name, link | ||
local cvList = | local cvList = cv() | ||
for i, k in pairs(chartConstantList) do | for i, k in pairs(chartConstantList) do | ||
if k[2] or k[3] or k[4] then | if k[2] or k[3] or k[4] then | ||
name = cvList[i][1] | name = cvList[i][1] | ||
end | end | ||
if trans["songNameToDisplayName"][name] then | if trans["songNameToDisplayName"][name] then | ||
link = trans["songNameToDisplayName"][name] | link = trans["songNameToDisplayName"][name] | ||
第69行: | 第53行: | ||
link = name | link = name | ||
end | end | ||
if n[name] then | |||
name = n[name] | |||
end | |||
if k[2] and tonumber(k[2]['constant'])>=8 and not(k[2]['old']) | if k[2] and tonumber(k[2]['constant'])>=8 and not(k[2]['old']) then | ||
table.insert(list, { i, name, k[2]['constant'], "PRS", link, cvList[i][2] }) | |||
table.insert( | end | ||
if k[3] and tonumber(k[3]['constant'])>=8 and not(k[3]['old']) then | |||
table.insert(list, { i, name, k[3]['constant'], "FTR", link, cvList[i][2] }) | |||
table.insert( | end | ||
if k[4] and tonumber(k[4]['constant'])>=8 and not(k[4]['old']) then | |||
if cvList[i][3] then | |||
if cvList[i][3] | |||
name = cvList[i][3] | name = cvList[i][3] | ||
end | end | ||
if cvList[i][4] | if cvList[i][4] then | ||
table.insert(list, { i, name, k[4]['constant'], "BYD", link, cvList[i][4] }) | |||
table.insert( | |||
else | else | ||
table.insert( | table.insert(list, { i, name, k[4]['constant'], "BYD", link, cvList[i][2] }) | ||
end | end | ||
end | end | ||
end | end | ||
-- make lists | -- make lists | ||
local result = {} | |||
local mid_result = {} | |||
result[11], result[12] = {}, {} | |||
mid_result[11], mid_result[12] = {}, {} | |||
for s, k in pairs( | for s, k in pairs(list) do | ||
if not( | if not(mid_result[k[3]]) then mid_result[k[3]]={} end | ||
if k[3]>=11 | if k[3]>=11 then | ||
if k[3]>=12 then | if k[3]>=12 then | ||
table.insert( | table.insert(mid_result[12], k) | ||
else | else | ||
table.insert( | table.insert(mid_result[11], k) | ||
end | end | ||
else | else table.insert(mid_result[k[3]], k) end | ||
end | end | ||
-- sort songs | -- sort songs | ||
local diffConverter = { PRS=2, FTR=3, BYD=4 } | |||
for s, k in pairs( | for s, k in pairs(mid_result) do | ||
table.sort(k, function (a, b) | table.sort(k, function (a, b) | ||
if not(a[3]==b[3]) then | if not(a[3]==b[3]) then | ||
第128行: | 第109行: | ||
end | end | ||
-- use template | -- use template | ||
-- 组排单元 第一个参数是曲名,第二个是id,第三个是难度,link字面意思 | -- 组排单元 第一个参数是曲名,第二个是id,第三个是难度,link字面意思 | ||
for s, k in pairs( | for s, k in pairs(mid_result) do | ||
if s<11 then | if s<11 then | ||
if not(result[s]) then result[s]={} end | if not(result[s]) then result[s]={} end |