跳到内容

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

个编辑