Module:Songconstant:修订间差异

来自Arcaea中文维基
无编辑摘要
无编辑摘要
 
(未显示同一用户的4个中间版本)
第2行: 第2行:
local getData = require("Module:Arcaea Data")
local getData = require("Module:Arcaea Data")
local constantTable = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{ title = 'ChartConstant.json' })
local constantTable = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{ title = 'ChartConstant.json' })
local specialTransition={
["Quon (DJ Noriken)"]="quonwacca",
["Quon (Feryquitous)"]="quon",
["Genesis (Iris)"]="genesis",
["Genesis (Morrigan)"]="genesischunithm",
["#1f1e33"]="ifi",
["AI[UE]OON"]="aiueoon",
["[X]"]="infinity",
}
-- 你维好像没有关于这个的 直接的 东西
local p={}
local p={}


第10行: 第20行:


function p._main(args)
function p._main(args)
-- arg: id, name, diff
-- arg: id, name, nameAuto, diff
-- id 优先于 name
-- id 优先于 name 优先于 nameAuto
-- diff 是难度, 为 0~4
-- diff 是难度, 为 0~4
-- 不存在返回空, 存在返回定数
-- 不存在返回空, 存在返回定数
第17行: 第27行:
if args["id"] and args["id"] ~= "" then
if args["id"] and args["id"] ~= "" then
id=args["id"]
id=args["id"]
elseif args["name"] then
elseif args["name"] or args["nameAuto"] then
id=getData.singleSongInformation(args["name"],"name","mobile")("id")
local name=''
if args["name"] then
name=args["name"]
else
name=args["nameAuto"]
end
if specialTransition[name] then
id=specialTransition[name]
else
id=getData.singleSongInformation(name,"name","mobile")("id")
end
end
end
local diff=args['diff']
if id=='' or id==nil then
if constantTable[id][diff] then
return ''
return constantTable[id][diff]["constant"]
end
local diff=tonumber(args['diff'])
if constantTable[id] then
if constantTable[id][diff] then
return string.format("%.1f",constantTable[id][diff]["constant"])
end
end
end
return ""
return ""

2024年4月26日 (五) 12:57的最新版本

可在Module:Songconstant/doc创建此模块的帮助文档

local getArgs = require('Module:Arguments').getArgs
local getData = require("Module:Arcaea Data")
local constantTable = mw.text.jsonDecode(mw.getCurrentFrame():expandTemplate{ title = 'ChartConstant.json' })
local specialTransition={
	["Quon (DJ Noriken)"]="quonwacca",
	["Quon (Feryquitous)"]="quon",
	["Genesis (Iris)"]="genesis",
	["Genesis (Morrigan)"]="genesischunithm",
	["#1f1e33"]="ifi",
	["AI[UE]OON"]="aiueoon",
	["[X]"]="infinity",
}
-- 你维好像没有关于这个的 直接的 东西
local p={}

function p.main(frame)
    local args = getArgs(frame)
    return p._main(args)
end

function p._main(args)
	-- arg: id, name, nameAuto, diff
	-- id 优先于 name 优先于 nameAuto
	-- diff 是难度, 为 0~4
	-- 不存在返回空, 存在返回定数
	local id=''
	if args["id"] and args["id"] ~= "" then
		id=args["id"]
	elseif args["name"] or args["nameAuto"] then
		local name=''
		if args["name"] then
			name=args["name"]
		else
			name=args["nameAuto"]
		end
		if specialTransition[name] then
			id=specialTransition[name]
		else
			id=getData.singleSongInformation(name,"name","mobile")("id")
		end
	end
	if id=='' or id==nil then
		return ''
	end
	local diff=tonumber(args['diff'])
	if constantTable[id] then
		if constantTable[id][diff] then
			return string.format("%.1f",constantTable[id][diff]["constant"])
		end
	end
	return ""
end

return p