跳到内容
折叠侧栏
搜索
创建账号
个人工具
创建账号
登录
导航
首页
最近更改
随机页面
维基项目
方针
指引
讨论版
格式手册
挂起清单
版本更新列表
玩法条目
游戏玩法
界面
机制
搭档
潜力值
世界模式
故事模式
段位挑战
解歌系统
成就系统
版本更新日志
列表条目
定数表
曲目列表
曲包列表
曲师列表
谱师列表
画师列表
背景列表
友情链接
Rotaeno中文维基
工具
链入页面
相关更改
特殊页面
页面信息
查看“Module:沙盒/盐棋/Sandbox1”的源代码
模块
讨论
English
阅读
查看源代码
查看历史
更多
阅读
查看源代码
查看历史
←
Module:沙盒/盐棋/Sandbox1
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local p={cfg=nil} local L={ {version="v1.0.0c",date="2021.5.18"}, {version="v1.1.0",date="2021.6.22"}, {version="v1.2.0",date="2021.9.16"}, {version="v1.3.0",date="2022.2.24"}, } local postscript={MobileTime={}, NSTime={[""]=L[1],["groovecoaster"]=L[2],["observer"]=L[3],["alice"]=L[3], ["enchantedlove"]=L[3],["take"]=L[3],["lifeispiano"]=L[3],["lapis"]=L[3],["purpleverse"]=L[3],["turbocharger"]=L[3],["vandalism"]=L[3],["glow"]=L[3], ["musedash"]=L[4],["observer_append_2"]=L[4],["single_append_1"]=L[4],["single_append_2"]=L[4],["energysynergymatrix"]=L[4],["bluecomet"]=L[4],["hivemind"]=L[4],["kyogenkigo"]=L[4],}, duration={}} local W=mw local function opChain(tar) local status,result=pcall(tar) if status then return result else return nil end end local function LoadJson(filename) return W.text.jsonDecode(W.getCurrentFrame():expandTemplate{ title = filename }) end local function cfgPush(key,val) if val~=nil then if p.cfg[key]==nil then p.cfg[key]={} end p.cfg[key][#p.cfg[key]+1]=val end end local function NSBydFilter(info) local NsBydSet={["tempestissimo"] = true} if not NsBydSet[info["id"]] then info["difficulties"][4] = nil end return info end local function AudioFilter(info) if opChain(function ()return info["difficulties"][4]["audioOverride"] end) then local byd=info["difficulties"][4] p.cfg["bydSongOverride"]={ title_localized=byd["title_localized"]["en"], artist=byd["artist"], bpm=byd["bpm"], bpm_base=byd["bpm_base"], bg=byd["bg"], duration=postscript.duration[info["id"]], } end return info end local function BGFilter(info) assert(info["bg"] and info["side"],"'bg'字段必须存在") local board={[0]="light",[1]="conflict"} if info["bg"]=="" then info["bg"] = "base_"..board[info["side"]] else-- aterlbus p.cfg["bgOverride"]=info["difficulties"][3]["bg"] end return info end local function TitleFilter(info) assert(info["title_localized"]["en"],"'en'字段必须存在") cfgPush("title",info["title_localized"]["en"]) cfgPush("title",info["title_localized"]["ja"]) cfgPush("title",info["title_localized"]["zh-Hans"]) return info end local function JacketFilter(info) if opChain(function ()return info["difficulties"][4]["jacketOverride"] end) then cfgPush("jacketOverride","byd") p.cfg.jacketDesigner=info["difficulties"][4]["jacketDesigner"] elseif info["difficulties"][1]["jacketOverride"] then-- stager, avril, lanota2 cfgPush("jacketOverride","pstprs") elseif info["jacket_localized"] then-- solitarydream cfgPush("jacketOverride","lang") elseif info["difficulties"][3]["jacket_night"] then-- melodyoflove cfgPush("jacketOverride","sunset") end return info end local function MobileTimeFilter(info) local searcher=function (x) return {version=string.match(W.getCurrentFrame():expandTemplate{ title = ":版本更新日志" }, "(v%d%.%d%d?%.%d%d?)%s*|%s*" .. W.language.getContentLanguage():formatDate("Y%.n%.j","@"..x) .. "%D"), date=os.date("(%Y/%m/%d)", x)}--maybe change lang:formatDate? end p.cfg["stamp"]=searcher(info["date"]) or postscript.MobileTime[info["id"]] p.cfg["err"]=opChain(function ()return p.cfg["stamp"].version end)==nil if info["difficulties"][4] then p.cfg["stampbyd"]=searcher(info["difficulties"][4]["date"]) p.cfg["err"]=p.cfg["err"] or p.cfg["stampbyd"]==nil end return info end local function NSTimeFilter(info) p.cfg["stamp"]=postscript.NSTime[info["set"]] or postscript.NSTime[info["id"]] or postscript.NSTime[""] p.cfg["err"]=p.cfg["stamp"]==nil return info end function QuerySong(json,key,queryById,...) local searcher if queryById then -- quon, ifi, aiueoon searcher = function (x)return x['id']end else key = W.text.decode(key,true) searcher = function (x)return W.ustring.gsub(x['title_localized']['en'],"^%l",W.ustring.upper)end end for _, song in ipairs(json["songs"]) do if searcher(song) == key then p.cfg = {} for _, filter in ipairs({...}) do filter(song) end song.__config=p.cfg return song end end end function p.GetSong(args) local Mobile = QuerySong(LoadJson("Songlist"),args['曲名'],args['id'],BGFilter,TitleFilter,JacketFilter,AudioFilter,MobileTimeFilter) local NS = QuerySong(LoadJson("Songlist NS"),args['曲名'],args['id'],NSBydFilter,NSTimeFilter) Mobile.__config.version=string.match( W.getCurrentFrame():expandTemplate{ title = ":版本更新日志" }, "(v%d%.%d%d?%.%d%d?)%s*|%s*" .. W.language.getContentLanguage():formatDate("Y%.n%.j","@"..Mobile["date"]) .. "%D") local main=Mobile or NS if Mobile and NS then -- end return W.text.jsonEncode({Mobile=Mobile, NS=NS, args=args},W.text.JSON_PRETTY) end return p
本页使用的模板:
Module:沙盒/盐棋/Sandbox1/doc
(
查看源代码
)
返回
Module:沙盒/盐棋/Sandbox1
。