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}`); }