Module:AutoUpdate
可在Module:AutoUpdate/doc创建此模块的帮助文档
local getArgs = require('Module:Arguments').getArgs
local data=require('模块:Data')
local p = {}
local function makeInvokeFunc(funcName)
return function (frame)
local args = getArgs(frame)
return p[funcName](args)
end
end
p.unlockA = makeInvokeFunc('_unlockA')
function p._unlockA(args)
local con=data.unlock("espebranch")
local text={'','',''}
local switch = {
[0] = function(list)
return list['credit']..' 残片<br>'
end,
[1] = function(list)
local difficulty={ [0] = '[PST]', [1] = '[PRS]', [2] = '[FTR]' }
local condition={ [0] = '', [1] = 'C或以上', [2] = 'B或以上', [3] = 'A或以上', [4] = 'AA或以上', [5] = 'EX或以上' }
return '[['..data._song({ 'title' , list['song_id'] , ['type']='id' })..']]'..difficulty[list['song_difficulty']]..condition[list['grade']]..'通过<br>'
end,
[3] = function(list)
local difficulty={ [0] = '[PST]', [1] = '[PRS]', [2] = '[FTR]' }
return '游玩'..'[['..data._song({ 'title' , list['song_id'] , ['type']='id' })..']]'..difficulty[list['song_difficulty']]..'<br>'
end,
[4] = function(list)
--没时间后面再做
return nil
end
}
for i=1,3 do
if con[i] then
for o,n in ipairs(con[i]) do
text[i]=text[i]..switch[n['type']](n)
end
end
end
return mw.getCurrentFrame():expandTemplate { title = '解禁方法', args = { ['PST解禁方法']=text[1] , ['PRS解禁方法']=text[2] , ['FTR解禁方法']=text[3] } }
end
return p