From 6a28b44c8efc26bb32fae9b05f0926206bf97d5c Mon Sep 17 00:00:00 2001 From: wxhn1225 <45218021+wxhn1225@users.noreply.github.com> Date: Sun, 12 Oct 2025 09:46:49 +0800 Subject: [PATCH] =?UTF-8?q?Update=20=E8=87=AA=E5=AE=9A=E4=B9=89=E8=8A=82?= =?UTF-8?q?=E7=82=B9=E7=AD=89=E7=BA=A7.pluto?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Scripts/自定义节点等级.pluto | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) 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 只设置最高