跳到内容

Module:Unlock:修订间差异

添加450字节 、​ 2022年9月18日 (星期日)
emm
(Unlocks)
 
(emm)
第19行: 第19行:
}, {
}, {
__call = function(self, args)
__call = function(self, args)
return string.gsub(self[args.type] or "", "%$[a-z12_]+", function(k)
return (string.gsub(self[args.type] or "", "%$[a-z12_]+", function(k)
k = k:sub(2)
k = k:sub(2)
if self[k] then return self[k](args[k]) end
if self[k] then return self[k](args[k]) end
if tonumber(k) then return self(args.conditions[tonumber(k)]) end
if tonumber(k) then return self(args.conditions[tonumber(k)]) end
return args[k]
return args[k]
end)
end))
end
end
})
})
第38行: 第38行:
i = i + 1
i = i + 1
until ware[i].songId ~= key
until ware[i].songId ~= key
if ware[i].songId == "lasteternity" then i = i + 4 end--
if ware[i].songId == "lasteternity" then i = i + 4 end --
return key, arr
return key, arr
end
end
end
end


function p.single(id)
function p.single(frame)
local id = frame.args.id or slstIdx[mw.title.getCurrentTitle().text]
local stringify = function(songv)
local r = {}
for _, v in ipairs(songv or {}) do table.insert(r, p.condition(v)) end
return table.concat(r, "<br>")
end
--- unlocks song k/v :
--- unlocks song k/v :
for songk, songv in unlocksIt(unlocks) do
for songk, songv in unlocksIt(unlocks) do
if id == songk then return songv end
if id == songk then return mw.getCurrentFrame():expandTemplate { title = "解禁方法", args = {
["PST解禁方法"] = stringify(songv[1]),
["PRS解禁方法"] = stringify(songv[2]),
["FTR解禁方法"] = stringify(songv[3]),
} }
end
end
end
end
end
第68行: 第79行:
if key then
if key then
row[key][rate] = row[key][rate] or {}
row[key][rate] = row[key][rate] or {}
table.insert(row[key][rate], (p.condition(cond)))
table.insert(row[key][rate], p.condition(cond))
end
end
end
end
2,544

个编辑