Module:ChartConstant:修订间差异
(创建页面,内容为“local p = {} local json = require("Module:LoadJson").ChartConstant() local getData = require("Module:Data").getMobile function p.main() local list = {} local name for i, k in pairs(json) do if k[2] or k[3] or k[4] then name = getData(nil,i)("title") end if k[2] and tonumber(k[2]['constant'])>=8 and not(k[2]['old']) then table.insert(list, { i, name, k[2]['constant'], "PRS" }) end if k[3] and tonumber(k[3]['…”) |
小无编辑摘要 |
||
第1行: | 第1行: | ||
local p = {} | local p = {} | ||
local json = require("Module:LoadJson").ChartConstant() | local json = require("Module:LoadJson").ChartConstant() | ||
function cv() | |||
local songlist = require("Module:LoadJson").Songlist() | |||
local list = {} | |||
for i,k in pairs(songlist['songs']) | |||
do | |||
list[k['id']] = k['title_localized']['en'] | |||
end | |||
return list | |||
end | |||
function p.main() | function p.main() | ||
local list = {} | local list = {} | ||
local name | local name | ||
local cvList = cv() | |||
for i, k in pairs(json) | for i, k in pairs(json) | ||
do | do | ||
if k[2] or k[3] or k[4] | if k[2] or k[3] or k[4] | ||
then | then | ||
name = | name = cvList[i] | ||
end | end | ||
if k[2] and tonumber(k[2]['constant'])>=8 and not(k[2]['old']) then | if k[2] and tonumber(k[2]['constant'])>=8 and not(k[2]['old']) then | ||
第26行: | 第36行: | ||
local result = {} | local result = {} | ||
result[11], result[12] = {}, {} | result[11], result[12] = {}, {} | ||
for s, k in pairs(list) do | for s, k in pairs(list) do | ||
table.insert(result[k[3]],mw.getCurrentFrame():expandTemplate {{title = '组排单元', args = { | if k[3]<11 | ||
then | |||
if not(result[k[3]]) then result[k[3]]={} end | |||
table.insert(result[k[3]],mw.getCurrentFrame():expandTemplate { title = '组排单元', args = { k[2], k[1], k[4] } } ) | |||
else | |||
if k[3]<12 | |||
then | |||
table.insert(result[11],mw.getCurrentFrame():expandTemplate { title = '组排单元', args = { k[2], k[1], k[4] } } ) | |||
else | |||
table.insert(result[12],mw.getCurrentFrame():expandTemplate { title = '组排单元', args = { k[2], k[1], k[4] } } ) | |||
end | |||
end | |||
end | |||
local textList = {} | |||
textList[1] = "<div class='notaninfobox dstable'>\n" | |||
textList[2]= "</div>" | |||
local sText = "" | |||
for i,k in pairs(result) | |||
do | |||
sText = "<div class='ds'>"..string.format("%.1f", i).."</div>\n<div class='number'>"..mw.getCurrentFrame():expandTemplate { title = '组排列' } | |||
..table.concat(k)..mw.getCurrentFrame():expandTemplate { title = '组排列-end' }.."</div>\n" | |||
table.insert (textList, 2, sText) | |||
end | end | ||
return table.concat( | return table.concat(textList) | ||
end | end | ||
return p | return p |
2022年7月8日 (五) 22:50的版本
可在Module:ChartConstant/doc创建此模块的帮助文档
local p = {}
local json = require("Module:LoadJson").ChartConstant()
function cv()
local songlist = require("Module:LoadJson").Songlist()
local list = {}
for i,k in pairs(songlist['songs'])
do
list[k['id']] = k['title_localized']['en']
end
return list
end
function p.main()
local list = {}
local name
local cvList = cv()
for i, k in pairs(json)
do
if k[2] or k[3] or k[4]
then
name = cvList[i]
end
if k[2] and tonumber(k[2]['constant'])>=8 and not(k[2]['old']) then
table.insert(list, { i, name, k[2]['constant'], "PRS" })
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" })
end
if k[4] and tonumber(k[4]['constant'])>=8 and not(k[4]['old']) then
table.insert(list, { i, name, k[4]['constant'], "BYD" })
end
end
local result = {}
result[11], result[12] = {}, {}
for s, k in pairs(list) do
if k[3]<11
then
if not(result[k[3]]) then result[k[3]]={} end
table.insert(result[k[3]],mw.getCurrentFrame():expandTemplate { title = '组排单元', args = { k[2], k[1], k[4] } } )
else
if k[3]<12
then
table.insert(result[11],mw.getCurrentFrame():expandTemplate { title = '组排单元', args = { k[2], k[1], k[4] } } )
else
table.insert(result[12],mw.getCurrentFrame():expandTemplate { title = '组排单元', args = { k[2], k[1], k[4] } } )
end
end
end
local textList = {}
textList[1] = "<div class='notaninfobox dstable'>\n"
textList[2]= "</div>"
local sText = ""
for i,k in pairs(result)
do
sText = "<div class='ds'>"..string.format("%.1f", i).."</div>\n<div class='number'>"..mw.getCurrentFrame():expandTemplate { title = '组排列' }
..table.concat(k)..mw.getCurrentFrame():expandTemplate { title = '组排列-end' }.."</div>\n"
table.insert (textList, 2, sText)
end
return table.concat(textList)
end
return p