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}")
end
infoStr = infoStr:gsub("minEnemyLevel=%d+", $"minEnemyLevel={minLevel}")
infoStr = infoStr:gsub("maxEnemyLevel=%d+", $"maxEnemyLevel={maxLevel}")
if minLevel then
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:AddContextTag(infoStr)
@ -35,16 +40,21 @@ local function launchNode(nodeId, minLevel, maxLevel, hardMode)
Engine.OpenLevel(args)
end
local commands = {}
commands["节点"] = function(text)
local function parseCommand(text, hardMode)
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
commands["钢铁"] = function(text)
local parts = text:split(" ")
launchNode(regionNames[parts[2]], tonumber(parts[3]), tonumber(parts[4]), true)
end
local commands = {}
commands["节点"] = |text| -> parseCommand(text, false)
commands["钢铁"] = |text| -> parseCommand(text, true)
for prefix in commands do
chat_subscribe_prefix("/" .. prefix, true)
@ -63,4 +73,7 @@ repeat
end
until yield()
-- 示例:/钢铁 赛德娜-Kappa 9999
-- 示例:
-- /钢铁 赛德娜-Kappa 9999 只设置最低
-- /节点 赛德娜-Kappa 9999 10000 同时设置
-- /钢铁 赛德娜-Kappa - 10000 只设置最高