Module:Unlocks
可在Module:Unlocks/doc创建此模块的帮助文档
local getArgs = require('Module:Arguments')
local data = require('Module:Arcaea_Data')
local l = {}
local query = data.singleSongInformation(l["song_id"], id, mobile)
-- 初始化变量与switch表
local optstr = ''
local switchDifficulty = {'PST', 'PRS', 'FTR', 'BYD', 'ETR'}
local switchGrade = {'C', 'B', 'A', 'AA', 'EX', 'EX+'}
local switchTrackType = {'FULL RECALL', 'FULL RECALL', 'FULL RECALL', 'FULL RECALL'} -- SiC
-- 十依托十
-- 喜欢我字符串链接吗
local function type0(tb)
optstr = tb["credit"] .. ' 残片'
return optstr
end
local function type1(tb)
optstr = ''
if tb["grade"] ~= 0 then
optstr = '以「' .. switchGrade[tb["grade"] + 1] .. '」或更高的成绩'
end
optstr = optstr .. '通关 [[' .. tostring(query("title")) .. ']] {{' .. switchDifficulty[tb["song_difficulty"] + 1] .. '}}'
return optstr
end
local function type2(tb)
optstr = '游玩 [[' .. tostring(query("title")) .. ']] {{' .. switchDifficulty[tb["song_difficulty"] + 1] .. '}}'
return optstr
end
local function type3(tb)
optstr = '以「' .. switchGrade[tb["grade"] + 1] .. '」或更高的成绩通关 [[' .. tostring(query("title")) .. ']] {{' .. switchDifficulty[tb["song_difficulty"] + 1] .. '}} ' .. tostring(tb["times"]) .. ' 回'
return optstr
end
local function type4(tb)
optstr = convert(tb["contains"][1]) .. ' \'\'\'或\'\'\' ' .. convert(tb["contains"][2])
return optstr
end
local function type5(tb)
optstr = '个人游玩[[潜力值]] ' .. string.sub(tostring(tb["rating"]), 1, 2) .. '.' .. string.sub(tostring(tb["rating"]), -2) .. ' 或以上'
return optstr
end
local function type6(tb)
optstr = '通关 ' .. tostring(tb["count"]) .. ' 次 ' .. tostring(tb["rating"])
if tb["ratingPlus"] then
optstr = optstr .. '+'
end
optstr = optstr .. ' 级曲目'
return optstr
end
local function type7(tb)
optstr = '解锁 [[' .. tostring(query("title")) .. ']] {{' .. tb["song_difficulty"] .. '}}'
return optstr
end
local function type8(tb)
optstr = switchTrackType[tb["lamp"] + 1] .. '通关 [[' .. tostring(query("title")) .. ']] {{' .. tb["song_difficulty"] .. '}}'
return optstr
end
local function type9(tb)
optstr = '以「' .. switchGrade[tb["grade"] + 1] .. '」或更高的成绩通关 ' .. tostring(tb["count"]) .. ' 次 {{' .. switchDifficulty[tb["difficulty"] + 1] .. '|1}} 曲目'
return optstr
end
local function type10(tb)
optstr = '阅读剧情【' .. tostring(tb["major"]) .. '-' .. tostring(tb["minor"]) .. '】'
return optstr
end
-- local function type103(tb) 待定
-- 功能实现
function convert(unlockInfo)
local text = {}
local switchFunction = {
["type0"] = function() type0(k) end,
["type1"] = function() type1(k) end,
["type2"] = function() type2(k) end,
["type3"] = function() type3(k) end,
["type4"] = function() type4(k) end,
["type5"] = function() type5(k) end,
["type6"] = function() type6(k) end,
["type7"] = function() type7(k) end,
["type8"] = function() type8(k) end,
["type9"] = function() type9(k) end,
["type10"] = function() type10(k) end
}
for i, k in ipairs(unlockInfo) do
l = k
text[i] = switchFunction[tostring("type" .. tostring(k["type"]))]
end
return text
end
function p.main(frame)
local args = getArgs(frame)
local queryP = data.singleSongInfomation(args["songtitle"], name, mobile)
local unlockInfo = data.unlockText(queryP["id"])
return convert(unlockInfo)
end