From b4c0f9beb0d2b7c2a2126fe3e0c48438e66d8d26 Mon Sep 17 00:00:00 2001 From: ddaodan <40017293+ddaodan@users.noreply.github.com> Date: Sun, 30 Nov 2025 19:18:32 +0800 Subject: [PATCH] =?UTF-8?q?=E5=85=A8=E8=87=AA=E5=8A=A8=E5=9C=B0=E8=84=89?= =?UTF-8?q?=E8=8A=B1=204.4.4=EF=BC=9A=20fix:=20oneDragonMode=20=E6=9C=AA?= =?UTF-8?q?=E6=AD=A3=E7=A1=AE=E5=BC=95=E7=94=A8=EF=BC=8C=E9=87=8A=E6=94=BE?= =?UTF-8?q?OCR=E8=AF=86=E5=88=AB=E7=BB=93=E6=9E=9C=E5=88=97=E8=A1=A8?= =?UTF-8?q?=E4=BB=A5=E9=98=B2=E5=86=85=E5=AD=98=E6=B3=84=E6=BC=8F=20(#2419?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix: oneDragonMode 未正确引用 * fix: 释放OCR识别结果列表以防内存泄漏 * fix: 修复自动导航到奖励时的取消令牌创建逻辑 --- repo/js/AutoLeyLineOutcrop/main.js | 6 +++--- repo/js/AutoLeyLineOutcrop/manifest.json | 2 +- repo/js/AutoLeyLineOutcrop/utils/calCountByResin.js | 5 +++++ repo/js/AutoLeyLineOutcrop/utils/loadSettings.js | 3 +++ 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/repo/js/AutoLeyLineOutcrop/main.js b/repo/js/AutoLeyLineOutcrop/main.js index 850c69f30..f41be6e92 100644 --- a/repo/js/AutoLeyLineOutcrop/main.js +++ b/repo/js/AutoLeyLineOutcrop/main.js @@ -811,7 +811,7 @@ async function autoFight(timeout) { */ async function autoNavigateToReward() { // 定义识别对象 - const cts = new CancellationTokenSource(); + let cts = new CancellationTokenSource(); const MAX_RETRY = 3; // 最大重试次数 let retryCount = 0; @@ -853,7 +853,7 @@ async function autoNavigateToReward() { keyUp("s"); await sleep(500); - // 创建新的令牌 + // 创建新的令牌用于下一次重试 cts = new CancellationTokenSource(); } else { // 对于其他错误,直接抛出 @@ -1092,4 +1092,4 @@ async function openCustomMarks() { log.error("未找到开关按钮"); genshin.returnMainUi(); } -} +} \ No newline at end of file diff --git a/repo/js/AutoLeyLineOutcrop/manifest.json b/repo/js/AutoLeyLineOutcrop/manifest.json index 3abeb8ec5..ab9a709f4 100644 --- a/repo/js/AutoLeyLineOutcrop/manifest.json +++ b/repo/js/AutoLeyLineOutcrop/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 1, "name": "全自动地脉花", - "version": "4.4.3", + "version": "4.4.4", "tags": ["地脉花"], "bgi_version": "0.52.0", "description": "基于OCR图像识别的全自动刷取地脉花。\n💡更多信息请查看README! \n\n----------注意事项----------\n●仅支持BetterGI 0.52.0 及以上版本!\n●部分地脉花因特殊原因不支持全自动,具体的点位请在手册中查看。\n●树脂使用的优先级:2倍原粹树脂 > 浓缩树脂 > 原粹树脂。\n●运行时会传送到七天神像设置中设置的七天神像,需要关闭七天神像设置中的“是否就近七天神像恢复血量”,并指定七天神像。\n●战斗策略注意调度器设置中地图追踪行走配置里的“允许在JsSpript中使用”和“覆盖JS中的自动战斗配置”,只有在都打开的情况下脚本才会使用下面的战斗配置,否则会使用独立任务中的战斗策略。战斗超时时间不能大于脚本自定义配置中的时间。\n\n如果遇到问题,请先参照README中的方法进行解决。", diff --git a/repo/js/AutoLeyLineOutcrop/utils/calCountByResin.js b/repo/js/AutoLeyLineOutcrop/utils/calCountByResin.js index 0e9897ea8..7b6191b40 100644 --- a/repo/js/AutoLeyLineOutcrop/utils/calCountByResin.js +++ b/repo/js/AutoLeyLineOutcrop/utils/calCountByResin.js @@ -163,11 +163,13 @@ async function recognizeNumberByOCR(ocrRegion, pattern) { if (!resList || resList.length === 0) { log.warn("OCR未识别到任何文本"); + resList.dispose(); return null; } for (const res of resList) { if (!res || !res.text) { + resList.dispose(); continue; } @@ -175,13 +177,16 @@ async function recognizeNumberByOCR(ocrRegion, pattern) { if (numberMatch) { const number = parseInt(numberMatch[1] || numberMatch[0]); if (!isNaN(number)) { + resList.dispose(); return number; } } } } catch (error) { log.error(`OCR识别时发生异常: ${error.message}`); + resList.dispose(); } + resList.dispose(); return null; } diff --git a/repo/js/AutoLeyLineOutcrop/utils/loadSettings.js b/repo/js/AutoLeyLineOutcrop/utils/loadSettings.js index cae4232b9..3a022a560 100644 --- a/repo/js/AutoLeyLineOutcrop/utils/loadSettings.js +++ b/repo/js/AutoLeyLineOutcrop/utils/loadSettings.js @@ -67,6 +67,9 @@ function () { // 设置通知状态 isNotification = settings.isNotification; + // 设置一条龙模式 + oneDragonMode = settings.oneDragonMode; + if (isNotification) { notification.send(`全自动地脉花开始运行,以下是本次运行的配置:\n\n地脉花类型:${settings.leyLineOutcropType}\n国家:${settings.country}\n刷取次数:${settings.timesValue}`); }