diff --git a/Scripts/自定义节点等级.pluto b/Scripts/自定义节点等级.pluto index 4665997..3ca5e9b 100644 --- a/Scripts/自定义节点等级.pluto +++ b/Scripts/自定义节点等级.pluto @@ -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 只设置最高