Module:沙盒/盐棋/Sandbox2:修订间差异

来自Arcaea中文维基
(artist)
(try1)
第1行: 第1行:
local getArgs = require('Module:Arguments').getArgs
local p={}
local p={}
local W=mw
local W=mw
第39行: 第37行:
v.__plat={mbIcon}
v.__plat={mbIcon}
tmp[v.id]=v
tmp[v.id]=v
v.__title=v.title_localized.en
end
end
for i,v in pairs(display) do
for i,v in pairs(display) do
tmp[i].__title=v
tmp[i].__title=v
tmp[i].__titleLink=v..'|'..tmp[i].title_localized.en
end
end
for i,v in ipairs(LoadJson("songlist NS").songs) do
for i,v in ipairs(LoadJson("songlist NS").songs) do
第50行: 第48行:
v.__plat={nsIcon}
v.__plat={nsIcon}
tmp[v.id]=v
tmp[v.id]=v
v.__title=v.title_localized.en
end
end
end
end
for i,v in pairs(tmp) do
for i,v in pairs(tmp) do
local page=W.title.new(v.__title):getContent()
local page=W.title.new(v.__title or v.title_localized.en):getContent()
local dur='0'..(page:match("时长%s*=%s*0?(%d:%d%d)")or'nilErr')
local dur=page:match("时长%s*=%s*0?(%d:%d%d)")or'nilErr'--test
local plat,bpm,rate='',v.bpm,''
local plat,bpm,rate='',v.bpm,''
local mark=W.getCurrentFrame():expandTemplate{title=':仅',args={'移动版','','图片角标'}}
if not tonumber(bpm) then
if not tonumber(bpm) then
bpm='data-sort-value='..v.bpm_base..'|'..bpm
bpm='data-sort-value='..v.bpm_base..'|'..bpm
第64行: 第62行:
end
end
for j,d in ipairs(v.difficulties) do
for j,d in ipairs(v.difficulties) do
rate=rate..'|'..d.rating
rate=rate..'||'..d.rating
if d.ratingPlus then
if d.ratingPlus then
rate=rate..'+'
rate=rate..'+'
第71行: 第69行:
if v.difficulties[4] then
if v.difficulties[4] then
if not NS_byd_set[v.id] then
if not NS_byd_set[v.id] then
rate=rate..'{{仅|移动版||图片角标}}'
rate=rate..mark
end
end
else
else
rate=rate..'|/'
rate=rate..'||/'
end
end
page=nil
page=nil
SS[i]='|'..plat..'|[[文件:Songs '..v.id..'.jpg|75px]]'
SS[i]='|'..plat..'\n|[[文件:Songs '..v.id..'.jpg|75px]]'
..'|[['..v.__title..']]'--4ids
..'\n|[['..v.__titleLink or v.title_localized.en..']]'
..'|[['..v.artist..']]'
..'\n|'..v.artist
..'|[['..packName[v.set]..']]'
..'\n|[['..packName[v.set]..']]'
..'|'..bpm
..'\n|'..bpm
..'|'..dur
..'\n|0'..dur
..'|'..rate
..'\n'..rate:sub(2)
..'\n|-\n'
end
end
return SS
return SS
第89行: 第88行:


function p.main()
function p.main()
return W.text.jsonEncode({packPrior=packPrior, packName=packName, songs=songs},W.text.JSON_PRETTY)
local chart=
[[{| class="wikitable sortable" border="1" cellspacing="1" cellpadding="5" style="text-align:center"
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |平台
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |曲目封面<ref>一首曲目的不同难度使用的封面有差异时,统一采用Future谱面下的曲目封面</ref>
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |标题
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |音乐家
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |所属曲包
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |BPM
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |时长
! colspan="4" style="height:27px;position:-webkit-sticky;position:sticky;top:0px;" |等级
|-
! style="height:27px;position:-webkit-sticky;position:sticky;top:33px;" |PST
! style="height:27px;position:-webkit-sticky;position:sticky;top:33px;" |PRS
! style="height:27px;position:-webkit-sticky;position:sticky;top:33px;" |FTR
! style="height:27px;position:-webkit-sticky;position:sticky;top:33px;" |BYD
|-
]]
for i, v in pairs(songs) do
chart=chart..v
end
return chart..'|}'
end
end


return p
return p

2022年5月11日 (三) 16:01的版本

可在Module:沙盒/盐棋/Sandbox2/doc创建此模块的帮助文档

local p={}
local W=mw
function LoadJson(filename)
    return W.text.jsonDecode(W.getCurrentFrame():expandTemplate{ title = filename })
end

local packPrior,packName=(function ()
	local huge=16383
	local P,N={single = huge},{single = 'Memory Archive'}
	local contest={['base']=true,['observer']=true,['omatsuri']=true}
	local conbine=function(rt,lf)return rt..'#'..rt..' - '..lf..'|'..rt..' - '..lf end
	for i,v in ipairs(LoadJson("packlist").packs) do
		P[v.id]=i
		N[v.id]=v.name_localized.en
		if v.pack_parent then
			P[v.id]=P[v.pack_parent]
			N[v.id]=conbine(N[v.pack_parent],N[v.id])
		elseif v.custom_banner and not contest[v.id] then
			N[v.id]=N[v.id]..' Collaboration'
		end
	end
	for i,v in ipairs(LoadJson("packlist NS").packs) do
		if not N[v.id] and v.pack_parent then--single-append
			P[v.id]=P[v.pack_parent]
			N[v.id]=conbine(N[v.pack_parent],v.name_localized.en)
		end
	end
	return P,N
end)()

local songs=(function ()
	local tmp,SS={},{}
	local mbIcon,nsIcon='[[文件:Icon Smartphone.png|16px|link=曲目列表 (移动版)]]','[[文件:Icon Nintendo switch.png|16px|link=曲目列表 (Nintendo Switch版)]]'
	local NS_byd_set={['tempestissimo']=true}
	local display={['ifi']='#1f1e33',['aiueoon']='AI[UE]OON',['quon']='Quon (Feryquitous)',['quonwacca']='Quon (DJ Noriken)'}
	for i,v in ipairs(LoadJson("songlist").songs) do
		v.__plat={mbIcon}
		tmp[v.id]=v
	end
	for i,v in pairs(display) do
		tmp[i].__title=v
		tmp[i].__titleLink=v..'|'..tmp[i].title_localized.en
	end
	for i,v in ipairs(LoadJson("songlist NS").songs) do
		if tmp[v.id] then
			tmp[v.id].__plat[2]=nsIcon
		else
			v.__plat={nsIcon}
			tmp[v.id]=v
		end
	end
	for i,v in pairs(tmp) do
		local page=W.title.new(v.__title or v.title_localized.en):getContent()
		local dur=page:match("时长%s*=%s*0?(%d:%d%d)")or'nilErr'--test
		local plat,bpm,rate='',v.bpm,''
		local mark=W.getCurrentFrame():expandTemplate{title=':仅',args={'移动版','','图片角标'}}
		if not tonumber(bpm) then
			bpm='data-sort-value='..v.bpm_base..'|'..bpm
		end
		for j,d in ipairs(v.__plat) do
			plat=plat..d
		end
		for j,d in ipairs(v.difficulties) do
			rate=rate..'||'..d.rating
			if d.ratingPlus then
				rate=rate..'+'
			end
		end
		if v.difficulties[4] then
			if not NS_byd_set[v.id] then
				rate=rate..mark
			end
		else
			rate=rate..'||/'
		end
		page=nil
		SS[i]='|'..plat..'\n|[[文件:Songs '..v.id..'.jpg|75px]]'
		..'\n|[['..v.__titleLink or v.title_localized.en..']]'
		..'\n|'..v.artist
		..'\n|[['..packName[v.set]..']]'
		..'\n|'..bpm
		..'\n|0'..dur
		..'\n'..rate:sub(2)
		..'\n|-\n'
	end
	return SS
end)()

function p.main()
	local chart=
[[{| class="wikitable sortable" border="1" cellspacing="1" cellpadding="5" style="text-align:center"
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |平台
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |曲目封面<ref>一首曲目的不同难度使用的封面有差异时,统一采用Future谱面下的曲目封面</ref>
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |标题
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |音乐家
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |所属曲包
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |BPM
! rowspan="2" style="height:55px;position:-webkit-sticky;position:sticky;top:0px;" |时长
! colspan="4" style="height:27px;position:-webkit-sticky;position:sticky;top:0px;" |等级
|-
! style="height:27px;position:-webkit-sticky;position:sticky;top:33px;" |PST
! style="height:27px;position:-webkit-sticky;position:sticky;top:33px;" |PRS
! style="height:27px;position:-webkit-sticky;position:sticky;top:33px;" |FTR
! style="height:27px;position:-webkit-sticky;position:sticky;top:33px;" |BYD
|-
]]
	for i, v in pairs(songs) do
		chart=chart..v
	end
	return chart..'|}'
end

return p