跳到内容
折叠侧栏
搜索
创建账号
个人工具
创建账号
登录
导航
首页
最近更改
随机页面
维基项目
方针
指引
讨论版
格式手册
挂起清单
版本更新列表
玩法条目
游戏玩法
界面
机制
搭档
潜力值
世界模式
故事模式
段位挑战
解歌系统
成就系统
版本更新日志
列表条目
定数表
曲目列表
曲包列表
曲师列表
谱师列表
画师列表
背景列表
友情链接
Rotaeno中文维基
工具
链入页面
相关更改
特殊页面
页面信息
查看“Module:Aichan”的源代码
模块
讨论
English
阅读
查看源代码
查看历史
更多
阅读
查看源代码
查看历史
←
Module:Aichan
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
local getArgs = require('Module:Arguments').getArgs local songlist = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{ title = 'Songlist.json' } ).songs local mad = require 'Module:AnotherData' local p={} local randomizer={} function initRandomizer(seed) randomizer.x=seed randomizer.y=seed randomizer.z=seed end function getNext() randomizer.x=(171*randomizer.x)%30269 randomizer.y=(172*randomizer.y)%30307 randomizer.z=(170*randomizer.z)%30323 return ((randomizer.x/30269+randomizer.y/30307+randomizer.z/30323)%1) end function dateStringToTime(date) if date==nil then return nil end local y,m,d = string.match(date, "([^/]+)/([^/]+)/([^/]+)") return os.time({year=y,month=m,day=d,hour=12,min=30}); end function p.main(frame) local args = getArgs(frame) return p._main(args) end function p._main(args) -- args: -- time: unix时间戳 -- date: YYYY/MM/DD格式的时间, 按这一天的北京时间12:30算 -- 优先级: time > date > 读取当前时间 local time = args['time'] or dateStringToTime(args['date']) or os.time() local seed = math.floor((time-144e2)/864e2) initRandomizer(seed) local length=5000 local arr={} for i=0,length-1,1 do arr[i]=i end for i=length-1,1,-1 do local r=getNext() local swapPos=math.floor(r*i) local temp=arr[i] arr[i]=arr[swapPos] arr[swapPos]=temp end local result={} local resultIndex=0 local remainPaidCount=2 local remainFreeCount=1 local songSize=table.getn(songlist) for i=0,length-1,1 do if resultIndex>=3 then break end local value=arr[i] if value<songSize then local info=songlist[value+1] if info.set=='base' or info.id=='innocence' then if remainFreeCount>0 then remainFreeCount=remainFreeCount-1 resultIndex=resultIndex+1 result[resultIndex]=info end else if remainPaidCount>0 then remainPaidCount=remainPaidCount-1 resultIndex=resultIndex+1 result[resultIndex]=info end end end end local frame = mw.getCurrentFrame() local text = mw.html.create 'div' text=text:wikitext(frame:expandTemplate {title = '组排列', args = {height = 'auto'}}) for i=1,3,1 do local id=result[i].id local title=result[i].title_localized.en local link=mad.linkName(result[i]) or title text:wikitext(frame:expandTemplate {title = '组排单元', args = {title,id,link=link}}) end text = text:wikitext(frame:expandTemplate {title = '组排列-end'}):done() return text end return p
本页使用的模板:
Module:Aichan/doc
(
查看源代码
)
返回
Module:Aichan
。