跳到内容
折叠侧栏
搜索
创建账号
个人工具
创建账号
登录
导航
首页
最近更改
随机页面
维基项目
方针
指引
讨论版
格式手册
挂起清单
版本更新列表
玩法条目
游戏玩法
界面
机制
搭档
潜力值
世界模式
故事模式
段位挑战
解歌系统
成就系统
版本更新日志
列表条目
定数表
曲目列表
曲包列表
曲师列表
谱师列表
画师列表
背景列表
友情链接
Rotaeno中文维基
工具
链入页面
相关更改
特殊页面
页面信息
查看“Module:沙盒/盐棋/Sandbox”的源代码
模块
讨论
English
阅读
查看源代码
查看历史
更多
阅读
查看源代码
查看历史
←
Module:沙盒/盐棋/Sandbox
因为以下原因,您没有权限编辑本页:
您请求的操作仅限属于该用户组的用户执行:
用户
您可以查看和复制此页面的源代码。
--- module: Another Data local mad = require 'Module:沙盒/盐棋/Sandbox1' local lang = mw.language.getContentLanguage() local p = {} local function opt(format, value, default) return value and format:format(tostring(value)) or default end local versions = {date = {}, name = {}} local function verQuery(mDate) local dDate = tonumber(lang:formatDate('ymd', '@' .. mDate)) - 1 local dates = versions.date if dDate > dates[#dates] then return '?' end local l, r = 1, #dates while l < r do local m = math.floor((l + r) / 2) if dates[m] < dDate then l = m + 1 else r = m end end return versions.name[l] end local sectionCode = {unknown = 0, free = 1, archive = 2, mainstory = 3, sidestory = 4, collab = 5, single = 6} local langJa = '<span lang="ja">-{%s}-</span>' -- 不对song的id、title_localized、artist、date、set、version、difficulties存在性做检验 local function main(plat, frame) local lSong = mad.listOf('songs', plat) local mid = {} for _, song in ipairs(lSong) do local id = song.id local function input(...) return frame.args[table.concat({id, ...}, '.')] end if id ~= 'lasteternity' then local query = mad.songQueryWrap(song) local packItem = mad.packQueryWrap(song.set, plat) local row = {sort = {sectionCode[packItem['section']], packItem['numero'], song.date}} table.insert(mid, row) table.insert(row, id) local title = input '标题' if not title then local baseTitle = {query.titleName} table.insert(baseTitle, query.title) local titles = {'[[' .. table.concat(baseTitle, '|') .. ']]'} table.insert(titles, opt(langJa, song.title_localized.ja)) table.insert(titles, song.title_localized['zh-Hans']) table.insert(titles, opt('%s <span style=color:#822328>[Beyond]</span>', query['.difficulties.4?title_localized?en'])) title = table.concat(titles, '<br />') end table.insert(row, title) table.insert(row, input '音乐家' or mw.ustring.gsub(song.artist, '[一-龠ぁ-ゔァ-ヴー々〆〤ヶ]+', function(v) return langJa:format(v) end)) table.insert(row, input '所属曲包' or packItem['name']) local bpm = tonumber(input 'BPM') or song.bpm_base table.insert(row, (tonumber(song.bpm) ~= bpm and ('data-sort-value=%s|'):format(bpm) or '') .. song.bpm) table.insert(row, input '时长' or ' - ') if plat ~= 'ns' then local version = input '收录版本' or verQuery(song.date) table.insert(row, song.version .. '.' .. version) end for idx, key in ipairs {'PST', 'PRS', 'FTR', 'BYD'} do local rating = input('等级', key) if not rating then local difficulty = song.difficulties[idx] rating = difficulty and difficulty.rating .. (difficulty.ratingPlus and '+' or '') or '/' end table.insert(row, rating) end end end table.sort(mid, function(a, b) for i = 1, 3 do local d = a.sort[i] - b.sort[i] if d ~= 0 then return d < 0 end end return false end) local res = {} local template = '|-\n|[[文件:Songs %s.jpg|75px]]' .. ('||%s'):rep(plat == 'ns' and 9 or 10) for idx, value in ipairs(mid) do res[idx] = template:format(unpack(value)) end return table.concat(res, '\n') end function p.mobile(frame) for record in mw.text.gsplit(frame.args.versions, '%s') do local date, name = record:match '(%d+):(.*)' table.insert(versions.date, tonumber(date)) table.insert(versions.name, name) end return main('mobile', frame:getParent()) end function p.ns(frame) return main('ns', frame:getParent()) end return p
本页使用的模板:
Module:沙盒/盐棋/Sandbox/doc
(
查看源代码
)
返回
Module:沙盒/盐棋/Sandbox
。