Module:ChartConstant:修订间差异

删除108字节 、​ 2024年3月14日 (星期四)
data模块调整适配
(新定数)
(data模块调整适配)
第16行: 第16行:
local songCcs = mw.text.jsonDecode(mw.title.new('ChartConstant.json', 'Template'):getContent())
local songCcs = mw.text.jsonDecode(mw.title.new('ChartConstant.json', 'Template'):getContent())
for _, song in ipairs(mad.listOf 'songs') do
for _, song in ipairs(mad.listOf 'songs') do
local id, titleBase, dateBase = song.id, song.title_localized.en, song.date
local id, titleBase, dateBase = song.id, mad.title(song), song.date
local songCc = songCcs[id] or {}
local songCc = songCcs[id] or {}
--
local query = mad.songQueryWrap(song)
local link = query.linkTitle:match '([^%|]+)'
for _, chart in ipairs {}, song.difficulties, 1 do
for _, chart in ipairs {}, song.difficulties, 1 do
local rc = chart.ratingClass + 1
local rc = chart.ratingClass + 1
第29行: 第26行:
local nCc = chartCc.constant
local nCc = chartCc.constant
if nCc < 8 then break end
if nCc < 8 then break end
local title, date = (chart.title_localized or {}).en or titleBase, chart.date or dateBase
local title, date = mad.title(chart) or titleBase, chart.date or dateBase


local rowId, sCc, rowAttr
local rowId, sCc, rowAttr
第45行: 第42行:
end
end
table.insert(rowData, {
table.insert(rowData, {
data = {title, song.id, ({'PST', 'PRS', 'FTR', 'BYD', 'ETR'})[rc], link = link, CC = sCc},
data = {title, song.id, ({'PST', 'PRS', 'FTR', 'BYD', 'ETR'})[rc], link = mad.linkName(song), CC = sCc},
sort = {nCc, rc, date}
sort = {nCc, rc, date}
})
})
第58行: 第55行:
:tag 'div':addClass 'ds':wikitext(rowId):done()
:tag 'div':addClass 'ds':wikitext(rowId):done()
:tag 'div':addClass 'number'
:tag 'div':addClass 'number'
:wikitext(frame:expandTemplate {title = '组排列', args = rowData.attr})
:wikitext(frame:expandTemplate {title = '组排列', args = next(rowData).CC and {['高度'] = '154px'}})
table.sort(rowData, function(a, b)
table.sort(rowData, function(a, b)
a, b = a.sort, b.sort
a, b = a.sort, b.sort
第81行: 第78行:
local songCc = songCcs[id] or {}
local songCc = songCcs[id] or {}
--
--
local query = mad.songQueryWrap(song)
local data = {mad.linkTitle(song)}
local data = {query.linkTitle}
local sort = {0, song.date}
local sort = {0, song.date}
table.insert(datas, {data = data, sort = sort})
table.insert(datas, {data = data, sort = sort})
1,124

个编辑