Module:Data:修订间差异
小无编辑摘要 |
小无编辑摘要 |
||
第50行: | 第50行: | ||
["id"] = function() | ["id"] = function() | ||
return list[args[2]]["id"] | return list[args[2]]["id"] | ||
end, | |||
["title"] = function() | |||
return list[args[2]]['title_localized']['en'] | |||
end, | end, | ||
["artist"] = function() | ["artist"] = function() |
2021年5月10日 (一) 22:41的版本
可在Module:Data/doc创建此模块的帮助文档
local getArgs = require('Module:Arguments').getArgs
local p = {}
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame)
return p[funcName](args)
end
end
p.pack = makeInvokeFunc('_pack')
function p._pack(args)
local json=require("Module:LoadJson").Packlist()['packs']
for i,k in ipairs(json) do
if k['id']==args[1] then
return k['name_localized']['en']
end
end
end
function p.unlock(songId)
local json=require("Module:LoadJson").unlocks()['unlocks']
local result={}
for i,k in ipairs(json) do
if k['songId']==songId then
result[tonumber(k['ratingClass']+1)]=k['conditions']
end
end
return result
end
p.song = makeInvokeFunc('_song')
function p._song(args)
local json=require("Module:LoadJson").Songlist()
local s,list="",{}
for i=1,250 do
if json['songs'][i]==nil then break end
if args['type']=="id" then
s=json['songs'][i]['id']
else
s=json['songs'][i]['title_localized']['en']
end
list[s]=json['songs'][i]
end
local switch = {
["id"] = function()
return list[args[2]]["id"]
end,
["title"] = function()
return list[args[2]]['title_localized']['en']
end,
["artist"] = function()
return list[args[2]]["artist"]
end,
["bpm"] = function()
return list[args[2]]["bpm"]
end,
["set"] = function()
return list[args[2]]["set"]
end,
["side"] = function()
return list[args[2]]["side"]
end,
["date"] = function()
return list[args[2]]["date"]
end,
["version"] = function()
return list[args[2]]["version"]
end,
["pstChartDesigner"] = function()
return list[args[2]]["difficulties"][1]['chartDesigner']
end,
["pstJacketDesigner"] = function()
return list[args[2]]["difficulties"][1]['jacketDesigner']
end,
["pstRating"] = function()
return list[args[2]]["difficulties"][1]['rating']
end,
["prsChartDesigner"] = function()
return list[args[2]]["difficulties"][2]['chartDesigner']
end,
["prsJacketDesigner"] = function()
return list[args[2]]["difficulties"][2]['jacketDesigner']
end,
["prsRating"] = function()
return list[args[2]]["difficulties"][2]['rating']
end,
["ftrChartDesigner"] = function()
return list[args[2]]["difficulties"][3]['chartDesigner']
end,
["ftrJacketDesigner"] = function()
return list[args[2]]["difficulties"][3]['jacketDesigner']
end,
["ftrRating"] = function()
return list[args[2]]["difficulties"][3]['rating']
end,
["bydChartDesigner"] = function()
if list[args[2]]["difficulties"][4] then
return list[args[2]]["difficulties"][4]['chartDesigner']
end
end,
["bydJacketDesigner"] = function()
if list[args[2]]["difficulties"][4] then
return list[args[2]]["difficulties"][4]['jacketDesigner']
end
end,
["bydRating"] = function()
if list[args[2]]["difficulties"][4] then
return list[args[2]]["difficulties"][4]['rating']
end
end
}
return switch[args[1]]()
end
return p