1,014
个编辑
Economy666(讨论 | 贡献) (test table) |
Economy666(讨论 | 贡献) (《合并同类项》) |
||
第31行: | 第31行: | ||
for _, song in ipairs(mad.listOf('songs', 'mobile')) do | for _, song in ipairs(mad.listOf('songs', 'mobile')) do | ||
songDiffDesigner[song.id]={} | songDiffDesigner[song.id]={} | ||
local lastDesigner= | local lastDesigner=nil | ||
local sameCount= | local sameCount = 0 | ||
local num = 0 | |||
for _,level in ipairs(song.difficulties) do | for _,level in ipairs(song.difficulties) do | ||
local designer = level.chartDesigner | local designer = level.chartDesigner | ||
local diff = level.ratingClass | local diff = level.ratingClass | ||
if lastDesigner ~= designer then | |||
sameCount = 0 | |||
if not pickList[designer] then | if not pickList[designer] then | ||
pickList[designer] = {} | pickList[designer] = {} | ||
第46行: | 第48行: | ||
mobileList[song.id]=true | mobileList[song.id]=true | ||
table.insert(songDiffDesigner[song.id], {diffList[diff+1], linkDesigner(designer, song.id)}) | table.insert(songDiffDesigner[song.id], {diffList[diff+1], linkDesigner(designer, song.id)}) | ||
if specialSong[song.id] then | if specialSong[song.id] then | ||
specialDesigner[designer]=true | specialDesigner[designer]=true | ||
end | end | ||
lastDesigner=designer | lastDesigner=designer | ||
else | |||
sameCount=sameCount+1 | |||
table.insert(songDiffDesigner[song.id], {diffList[diff+1], nil}) | |||
songDiffDesigner[song.id][num-sameCount+1][3]=sameCount+1 | |||
end | |||
num=num+1 | |||
end | end | ||
end | end | ||
-- for _, song in ipairs(mad.listOf('songs', 'ns')) do | |||
-- if not mobileList[song.id] and not multiId[song.id] then | |||
-- for _,level in ipairs(song.difficulties) do | |||
-- local designer = level.chartDesigner | |||
-- local diff = level.ratingClass | |||
-- if lastDesigner ~= designer then | |||
-- sameCount = 0 | |||
-- if not pickList[designer] then | |||
-- pickList[designer] = {} | |||
-- end | |||
-- if not pickList[designer][song.id] then | |||
-- pickList[designer][song.id] = {} | |||
-- end | |||
-- pickList[designer][song.id][diffList[diff+1]]=true | |||
-- table.insert(songDiffDesigner[song.id], {diffList[diff+1], linkDesigner(designer, song.id)}) | |||
-- if specialSong[song.id] then | |||
end | -- specialDesigner[designer]=true | ||
-- end | |||
-- lastDesigner=designer | |||
-- else | |||
-- sameCount=sameCount+1 | |||
-- table.insert(songDiffDesigner[song.id], {diffList[diff+1], nil}) | |||
-- songDiffDesigner[song.id][num-sameCount+1][3]=sameCount+1 | |||
-- end | |||
-- num=num+1 | |||
-- end | |||
-- end | |||
-- end | |||
return pickList | return pickList | ||
end | end | ||
第169行: | 第178行: | ||
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' | ||
local function songUnit(songid) | local function songUnit(songid,text) | ||
local data = songDiffDesigner[songid] | local data = songDiffDesigner[songid] | ||
local pack = '' | local pack = '' | ||
local | local wikiText = '' | ||
local rowspan = '|rowspan='.. #data ..'|' | |||
wikiText = wikiText .. '|-\n'..rowspan ..songid ..'\n' | |||
for | wikiText = wikiText .. rowspan ..pack ..'\n' | ||
for num, i in ipairs(data) do | |||
local diffFormat = '| '..(i[1] or '') | |||
text = | local designerFormat = i[3] and '||rowspan='.. i[3] ..'|' ..i[2] or (i[2] and '||'..i[2] or '') | ||
wikiText = wikiText .. diffFormat ..designerFormat..'\n' | |||
if num == 1 then | |||
wikiText = wikiText..rowspan .. (text or '')..'\n' | |||
end | |||
wikiText = wikiText .. '|-\n' | |||
end | end | ||
return | return wikiText | ||
end | end | ||
第187行: | 第201行: | ||
pickList = readList() | pickList = readList() | ||
singleList = genList(pickList) | singleList = genList(pickList) | ||
local | local wikiText ='' | ||
for designer,songs in pairs(singleList) do | for designer,songs in pairs(singleList) do | ||
wikiText = wikiText .."'''".. designer.."'''\n" | |||
wikiText = wikiText .. head | |||
for songid,diff in pairs(songs) do | for songid,diff in pairs(songs) do | ||
wikiText = wikiText .. songUnit(songid) | |||
end | end | ||
wikiText = wikiText .. '|}' | |||
end | end | ||
-- for i,ii in pairs(songDiffDesigner) do | -- for i,ii in pairs(songDiffDesigner) do | ||
第202行: | 第216行: | ||
-- return list1 | -- return list1 | ||
return | return wikiText | ||
end | end | ||
return p | return p |
个编辑