「Module:DesignerSong」:修訂間差異

增加 112 位元組 、​ 2024年7月26日 (星期五)
無編輯摘要
無編輯摘要
無編輯摘要
行 255: 行 255:
end
end


local sectionCode = {unknown = 0, 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']] or 100, packItem['numero'] or 100, sortLevel, songid}})
end
table.sort(songSort, sort_fun)
return songSort
end


function p.main(frame)
function p.main(frame)
行 353: 行 334:
local function cateText(cate, titelStr)
local function cateText(cate, titelStr)
local theText = ''
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 function writeText(designer, songs)
local songSort = getSongSort(songs)
local songSort = getSongSort(songs)
941

次編輯