From a37ef42922d8608bf648b7781b2733b10ccdd3fb Mon Sep 17 00:00:00 2001 From: Patrick-Ze <19711799+Patrick-Ze@users.noreply.github.com> Date: Wed, 25 Jun 2025 19:17:18 +0800 Subject: [PATCH] =?UTF-8?q?js:=20CD-Aware-AutoGather:=20=E4=BF=AE=E5=A4=8D?= =?UTF-8?q?=E6=B2=A1=E6=9C=89=E6=8C=89=E7=85=A7=E8=AE=BE=E5=AE=9A=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E5=81=9C=E6=AD=A2=E8=BF=90=E8=A1=8C=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98=20(#1195)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- repo/js/CD-Aware-AutoGather/main.js | 15 ++++++++------- repo/js/CD-Aware-AutoGather/manifest.json | 2 +- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/repo/js/CD-Aware-AutoGather/main.js b/repo/js/CD-Aware-AutoGather/main.js index 5e06da54..8f008c3d 100644 --- a/repo/js/CD-Aware-AutoGather/main.js +++ b/repo/js/CD-Aware-AutoGather/main.js @@ -4,7 +4,7 @@ const settingFile = "settings.json"; const defaultTime = getDefaultTime(); const CooldownDataBase = readRefreshInfo("CooldownData.txt"); -let stopTime = null; +let stopAtTime = null; let currentParty = null; class ReachStopTime extends Error { @@ -96,16 +96,17 @@ async function runScanMode() { // 采集选中的材料 async function runGatherMode() { + if (settings.stopAtTime) { + stopAtTime = settings.stopAtTime; + log.info("脚本已被配置为达到{0}后停止运行", stopAtTime); + } + const selectedMaterials = getSelectedMaterials(); if (selectedMaterials.length === 0) { log.error("未选择任何材料,请在脚本配置中勾选所需项目"); return; } - if (settings.Time) { - stopTime = settings.stopAtTime; - log.info("脚本已被配置为达到{0}后停止运行", stopTime); - } log.info("共{0}组材料路线待执行:", selectedMaterials.length); for (const item of selectedMaterials) { @@ -127,7 +128,7 @@ async function runGatherMode() { } } catch (e) { if (e instanceof ReachStopTime) { - log.info("达到设置的停止时间 {0},终止运行", stopTime); + log.info("达到设置的停止时间 {0},终止运行", stopAtTime); } else { throw e; } @@ -272,7 +273,7 @@ async function runPathTaskIfCooldownExpired(account, pathTask) { const lastTime = recordMap[fileName] || defaultTime; const progress = `[${i + 1}/${jsonFiles.length}]`; - if (settings.Time && isTargetTimeReached(stopTime)) { + if (stopAtTime && isTargetTimeReached(stopAtTime)) { throw new ReachStopTime("达到设置的停止时间,终止运行"); } diff --git a/repo/js/CD-Aware-AutoGather/manifest.json b/repo/js/CD-Aware-AutoGather/manifest.json index 32f3e54a..c42224ee 100644 --- a/repo/js/CD-Aware-AutoGather/manifest.json +++ b/repo/js/CD-Aware-AutoGather/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 1, "name": "带CD管理的自动采集", - "version": "1.2", + "version": "1.3", "bgi_version": "0.45.0", "description": "自动同步你通过BetterGI订阅的地图追踪任务,执行采集任务,并管理材料刷新时间(支持多账号)。\n首次使用前请先简单阅读说明(可在`全自动`——`JS脚本`页面,点击本脚本名称查看)", "authors": [