Update 自定义节点等级.pluto

This commit is contained in:
wxhn1225 2025-10-12 09:46:49 +08:00
parent 036725f697
commit 6a28b44c8e

View File

@ -18,8 +18,13 @@ local function launchNode(nodeId, minLevel, maxLevel, hardMode)
infoStr = infoStr:gsub("}", " tier=1\r\n}") infoStr = infoStr:gsub("}", " tier=1\r\n}")
end end
infoStr = infoStr:gsub("minEnemyLevel=%d+", $"minEnemyLevel={minLevel}") if minLevel then
infoStr = infoStr:gsub("maxEnemyLevel=%d+", $"maxEnemyLevel={maxLevel}") infoStr = infoStr:gsub("minEnemyLevel=%d+", $"minEnemyLevel={minLevel}")
end
if maxLevel then
infoStr = infoStr:gsub("maxEnemyLevel=%d+", $"maxEnemyLevel={maxLevel}")
end
args:SetLevel(info.levelOverride:GetFullName()) args:SetLevel(info.levelOverride:GetFullName())
args:AddContextTag(infoStr) args:AddContextTag(infoStr)
@ -35,16 +40,21 @@ local function launchNode(nodeId, minLevel, maxLevel, hardMode)
Engine.OpenLevel(args) Engine.OpenLevel(args)
end end
local commands = {} local function parseCommand(text, hardMode)
commands["节点"] = function(text)
local parts = text:split(" ") local parts = text:split(" ")
launchNode(regionNames[parts[2]], tonumber(parts[3]), tonumber(parts[4]), false) local nodeId = regionNames[parts[2]] or parts[2]
local min = parts[3]
local max = parts[4]
local minLevel = (min and min ~= "-" and min ~= "x") ? tonumber(min) : nil
local maxLevel = (max and max ~= "-" and max ~= "x") ? tonumber(max) : nil
launchNode(nodeId, minLevel, maxLevel, hardMode)
end end
commands["钢铁"] = function(text) local commands = {}
local parts = text:split(" ") commands["节点"] = |text| -> parseCommand(text, false)
launchNode(regionNames[parts[2]], tonumber(parts[3]), tonumber(parts[4]), true) commands["钢铁"] = |text| -> parseCommand(text, true)
end
for prefix in commands do for prefix in commands do
chat_subscribe_prefix("/" .. prefix, true) chat_subscribe_prefix("/" .. prefix, true)
@ -63,4 +73,7 @@ repeat
end end
until yield() until yield()
-- 示例:/钢铁 赛德娜-Kappa 9999 -- 示例:
-- /钢铁 赛德娜-Kappa 9999 只设置最低
-- /节点 赛德娜-Kappa 9999 10000 同时设置
-- /钢铁 赛德娜-Kappa - 10000 只设置最高