From 9d9cae2e18823b5c677288fba96749f5603d0263 Mon Sep 17 00:00:00 2001 From: mno <718135749@qq.com> Date: Thu, 28 Aug 2025 21:21:20 +0800 Subject: [PATCH] =?UTF-8?q?js=EF=BC=9AAAA=E7=8B=97=E7=B2=AE=E6=89=B9?= =?UTF-8?q?=E5=8F=911.2.0=20(#1746)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * js:AAA狗粮批发1.2.0 * js:狗粮联机团购 * Update main.js * 地图追踪:绯樱绣球 修复bgi本体对于简易策略的改动导致地图追踪无法运行(所有的pathing都经过排查,只有这里有) --- repo/js/AAA-Artifacts-Bulk-Supply/README.md | 3 + repo/js/AAA-Artifacts-Bulk-Supply/main.js | 61 ++++++++++++------- .../AAA-Artifacts-Bulk-Supply/manifest.json | 2 +- repo/js/ArtifactsGroupPurchasing/main.js | 47 +++++++------- .../js/ArtifactsGroupPurchasing/manifest.json | 2 +- .../稻妻/绯樱绣球/01-绯樱绣球-稻妻城-6个.json | 2 +- .../稻妻/绯樱绣球/03-绯樱绣球-绀田村-3个.json | 2 +- .../稻妻/绯樱绣球/04-绯樱绣球-荒海-8个.json | 4 +- .../稻妻/绯樱绣球/05-绯樱绣球-荒海-2个.json | 4 +- .../稻妻/绯樱绣球/08-绯樱绣球-镇守之森-8个.json | 2 +- 10 files changed, 75 insertions(+), 54 deletions(-) diff --git a/repo/js/AAA-Artifacts-Bulk-Supply/README.md b/repo/js/AAA-Artifacts-Bulk-Supply/README.md index f7afdc045..4b4ab4efb 100644 --- a/repo/js/AAA-Artifacts-Bulk-Supply/README.md +++ b/repo/js/AAA-Artifacts-Bulk-Supply/README.md @@ -82,6 +82,9 @@ https://www.kdocs.cn/wo/sl/v13uXscL ## 更新日志 +### 1.2.0(2025.08.28) +1.修正时间判断逻辑(该bug曾导致北京时间4:00-8:00被视为前一天,不刷新路线cd) +2.路线末坐标判断加入重试,判断失败时等待1秒后重试 ### 1.1.6(2025.08.28) 1.修几条路线414,501,506,623,632,640,642,643,06灵迷纹 2.新增多人联机629清怪 diff --git a/repo/js/AAA-Artifacts-Bulk-Supply/main.js b/repo/js/AAA-Artifacts-Bulk-Supply/main.js index ce48b4f56..82c29120d 100644 --- a/repo/js/AAA-Artifacts-Bulk-Supply/main.js +++ b/repo/js/AAA-Artifacts-Bulk-Supply/main.js @@ -71,7 +71,10 @@ let furinaState = "unknown"; } await writeCDInfo(accountName); //更新日期信息 - record.lastRunDate = `${new Date().getFullYear()}/${String(new Date().getMonth() + 1).padStart(2, '0')}/${String(new Date().getDate()).padStart(2, '0')}`; + record.lastRunDate = new Date(Date.now() - 4 * 60 * 60 * 1000) + .toLocaleDateString('zh-CN', { timeZone: 'Asia/Shanghai', year: 'numeric', month: '2-digit', day: '2-digit' }) + .replace(/\//g, '/'); + await writeRecord(accountName); //运行前按自定义配置清理狗粮 @@ -240,12 +243,14 @@ async function readRecord(accountName) { log.error("读取或解析 manifest.json 失败:", err); } - /* ---------- 判断今日是否运行 ---------- */ + /* ---------- 判断今日是否运行(北京时间 04:00 分界,手动拼接 UTC 20 点) ---------- */ if (record.lastRunDate) { const [y, m, d] = record.lastRunDate.split("/").map(Number); - const lastRun4AM = new Date(y, m - 1, d, 4, 0, 0); - const now = new Date(); + // 东八区 04:00 对应 UTC 20:00 + const lastRun4AM = new Date(`${y}-${String(m).padStart(2, '0')}-${String(d - 1).padStart(2, '0')}T20:00:00.000Z`).getTime(); + //log.info(`lastRun4AM = ${new Date(lastRun4AM).toISOString()}`); + const now = Date.now(); if (now - lastRun4AM < 24 * 60 * 60 * 1000) { log.info("今日已经运行过狗粮"); state.runnedToday = true; @@ -253,7 +258,7 @@ async function readRecord(accountName) { state.runnedToday = false; } - if (record.lastActivateTime - lastRun4AM > 0 && state.runnedToday) { + if (record.lastActivateTime.getTime() - lastRun4AM > 0 && state.runnedToday) { log.info("今日已经运行过激活路线"); state.activatedToday = true; } else { @@ -1011,31 +1016,43 @@ async function runPaths(folderFilePath, PartyName, doStop, furinaRequirement = " } await fakeLog(Path.fileName, false, false, 0); if (pathInfo.ok) { - //回到主界面 await genshin.returnMainUi(); await sleep(500); - try { - // 获取当前人物在指定地图上的坐标 - const currentPosition = await genshin.getPositionFromMap(pathInfo.map_name); - // 计算与最后一个非 orientation 点的距离 - const distToLast = Math.hypot( - currentPosition.x - pathInfo.x, - currentPosition.y - pathInfo.y - ); + const maxAttempts = 3; + let attempts = 0; - // 距离超过 50 认为路线没有正常完成(卡死或未开图等) - if (distToLast >= 50) { - failcount++; + while (attempts < maxAttempts) { + try { + const cur = await genshin.getPositionFromMap(pathInfo.map_name); + const dist = Math.hypot(cur.x - pathInfo.x, cur.y - pathInfo.y); + + if (dist < 50) break; // 成功跳出 + + attempts++; + log.warn( + `路线 ${Path.fileName} 第 ${attempts} 次检测失败 ` + + `(距离 ${dist.toFixed(2)}) —— ` + + `当前(${cur.x.toFixed(2)}, ${cur.y.toFixed(2)}) ` + + `目标(${pathInfo.x.toFixed(2)}, ${pathInfo.y.toFixed(2)})` + ); + + if (attempts === maxAttempts) { + failcount++; + skiprecord = true; + await sleep(5000); + break; + } + + await sleep(1000); + } catch (err) { + log.error(`发生错误:${err.message}`); skiprecord = true; - log.warn(`路线${Path.fileName}没有正常完成`); - await sleep(5000); + break; } - } catch (error) { - log.error(`发生错误:${error.message}`); - skiprecord = true; } } + if (!skiprecord) { CDInfo = [...new Set([...CDInfo, Path.fullPath])]; await writeCDInfo(accountName); diff --git a/repo/js/AAA-Artifacts-Bulk-Supply/manifest.json b/repo/js/AAA-Artifacts-Bulk-Supply/manifest.json index 9ba0c159c..903b601af 100644 --- a/repo/js/AAA-Artifacts-Bulk-Supply/manifest.json +++ b/repo/js/AAA-Artifacts-Bulk-Supply/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 1, "name": "AAA狗粮批发", - "version": "1.1.6", + "version": "1.2.0", "tags": [ "狗粮" ], diff --git a/repo/js/ArtifactsGroupPurchasing/main.js b/repo/js/ArtifactsGroupPurchasing/main.js index 7c9159edc..daf317efd 100644 --- a/repo/js/ArtifactsGroupPurchasing/main.js +++ b/repo/js/ArtifactsGroupPurchasing/main.js @@ -3,10 +3,10 @@ let decomposeMode = settings.decomposeMode || "保留";//狗粮分解模式 let keep4Star = settings.keep4Star;//保留四星 let autoSalvage = settings.autoSalvage;//启用自动分解 let notify = settings.notify;//启用通知 -let p1EndingRoute = settings.p1EndingRoute || "踏鞴砂"; +let p1EndingRoute = settings.p1EndingRoute || "枫丹高塔"; let p2EndingRoute = settings.p2EndingRoute || "度假村"; let p3EndingRoute = settings.p3EndingRoute || "智障厅"; -let p4EndingRoute = settings.p4EndingRoute || "清籁丸"; +let p4EndingRoute = settings.p4EndingRoute || "踏鞴砂"; let accountName = settings.accountName || "默认账户"; let runExtra = settings.runExtra || false; let forceGroupNumber = settings.forceGroupNumber || 0; @@ -125,31 +125,32 @@ let _infoPoints = null; // 缓存 assets/info.json 解析后的数组 dispatcher.addTimer(new RealtimeTimer("AutoPick")); await runExtraPath(); } - - for (i = 0; i < 3; i++) { - //确保回到单机模式 - const finalPlayerSign = await getPlayerSign(); - if (finalPlayerSign != 0) { - await genshin.returnMainUi(); - await keyPress("F2"); - await sleep(2000); - if (finalPlayerSign === 1) { - await findAndClick(kickAllRo); - await sleep(500); - await findAndClick(confirmKickRo); - await waitForMainUI(true);//等待直到回到主界面 + /* + for (i = 0; i < 3; i++) { + //确保回到单机模式 + const finalPlayerSign = await getPlayerSign(); + if (finalPlayerSign != 0) { await genshin.returnMainUi(); + await keyPress("F2"); + await sleep(2000); + if (finalPlayerSign === 1) { + await findAndClick(kickAllRo); + await sleep(500); + await findAndClick(confirmKickRo); + await waitForMainUI(true);//等待直到回到主界面 + await genshin.returnMainUi(); + } else { + await findAndClick(leaveTeamRo); + await sleep(500); + await waitForMainUI(true);//等待直到回到主界面 + await genshin.returnMainUi(); + } } else { - await findAndClick(leaveTeamRo); - await sleep(500); - await waitForMainUI(true);//等待直到回到主界面 - await genshin.returnMainUi(); + log.info("已成功回到单人模式"); + break; } - } else { - log.info("已成功回到单人模式"); - break; } - } + */ } )(); diff --git a/repo/js/ArtifactsGroupPurchasing/manifest.json b/repo/js/ArtifactsGroupPurchasing/manifest.json index 9cf4f6b49..c19cff72f 100644 --- a/repo/js/ArtifactsGroupPurchasing/manifest.json +++ b/repo/js/ArtifactsGroupPurchasing/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 1, "name": "AAA狗粮联机团购", - "version": "1.0.4", + "version": "1.0.5", "tags": [ "狗粮" ], diff --git a/repo/pathing/地方特产/稻妻/绯樱绣球/01-绯樱绣球-稻妻城-6个.json b/repo/pathing/地方特产/稻妻/绯樱绣球/01-绯樱绣球-稻妻城-6个.json index 0833470e1..c2b3c4594 100644 --- a/repo/pathing/地方特产/稻妻/绯樱绣球/01-绯樱绣球-稻妻城-6个.json +++ b/repo/pathing/地方特产/稻妻/绯樱绣球/01-绯樱绣球-稻妻城-6个.json @@ -160,7 +160,7 @@ "y": -2987.94, "action": "combat_script", "move_mode": "walk", - "action_params": "丽莎 attack,wait(0.5),attack,wait(1); 瓦雷莎 charge,wait(2); 八重神子 charge", + "action_params": "丽莎 attack,wait(0.5),attack,wait(1);瓦雷莎 charge,wait(2);八重神子 charge", "type": "target" }, { diff --git a/repo/pathing/地方特产/稻妻/绯樱绣球/03-绯樱绣球-绀田村-3个.json b/repo/pathing/地方特产/稻妻/绯樱绣球/03-绯樱绣球-绀田村-3个.json index 2b2777fbd..9881835c2 100644 --- a/repo/pathing/地方特产/稻妻/绯樱绣球/03-绯樱绣球-绀田村-3个.json +++ b/repo/pathing/地方特产/稻妻/绯樱绣球/03-绯樱绣球-绀田村-3个.json @@ -97,7 +97,7 @@ "y": -2651.3, "action": "combat_script", "move_mode": "walk", - "action_params": "瓦雷莎 charge,wait(2); 八重神子 charge", + "action_params": "瓦雷莎 charge,wait(2);八重神子 charge", "type": "target" }, { diff --git a/repo/pathing/地方特产/稻妻/绯樱绣球/04-绯樱绣球-荒海-8个.json b/repo/pathing/地方特产/稻妻/绯樱绣球/04-绯樱绣球-荒海-8个.json index 4aca7a61f..a4a5a5a91 100644 --- a/repo/pathing/地方特产/稻妻/绯樱绣球/04-绯樱绣球-荒海-8个.json +++ b/repo/pathing/地方特产/稻妻/绯樱绣球/04-绯樱绣球-荒海-8个.json @@ -198,7 +198,7 @@ "y": -2346.99, "action": "combat_script", "move_mode": "walk", - "action_params": "丽莎 attack,wait(0.5),attack,wait(1); 瓦雷莎 charge,wait(2); 八重神子 charge", + "action_params": "丽莎 attack,wait(0.5),attack,wait(1);瓦雷莎 charge,wait(2);八重神子 charge", "type": "target" }, { @@ -215,7 +215,7 @@ "y": -2343.69, "action": "combat_script", "move_mode": "walk", - "action_params": "丽莎 attack,wait(0.5),attack,wait(1); 瓦雷莎 charge,wait(2); 八重神子 charge", + "action_params": "丽莎 attack,wait(0.5),attack,wait(1);瓦雷莎 charge,wait(2);八重神子 charge", "type": "target" }, { diff --git a/repo/pathing/地方特产/稻妻/绯樱绣球/05-绯樱绣球-荒海-2个.json b/repo/pathing/地方特产/稻妻/绯樱绣球/05-绯樱绣球-荒海-2个.json index 0502f5ab6..75e51614c 100644 --- a/repo/pathing/地方特产/稻妻/绯樱绣球/05-绯樱绣球-荒海-2个.json +++ b/repo/pathing/地方特产/稻妻/绯樱绣球/05-绯樱绣球-荒海-2个.json @@ -40,7 +40,7 @@ "y": -2346.99, "action": "combat_script", "move_mode": "walk", - "action_params": "瓦雷莎 charge,wait(2); 八重神子 charge", + "action_params": "瓦雷莎 charge,wait(2);八重神子 charge", "type": "target" }, { @@ -57,7 +57,7 @@ "y": -2343.69, "action": "combat_script", "move_mode": "walk", - "action_params": "瓦雷莎 charge,wait(2); 八重神子 charge", + "action_params": "瓦雷莎 charge,wait(2);八重神子 charge", "type": "target" }, { diff --git a/repo/pathing/地方特产/稻妻/绯樱绣球/08-绯樱绣球-镇守之森-8个.json b/repo/pathing/地方特产/稻妻/绯樱绣球/08-绯樱绣球-镇守之森-8个.json index 1c9c121f6..45fdbad3e 100644 --- a/repo/pathing/地方特产/稻妻/绯樱绣球/08-绯樱绣球-镇守之森-8个.json +++ b/repo/pathing/地方特产/稻妻/绯樱绣球/08-绯樱绣球-镇守之森-8个.json @@ -223,7 +223,7 @@ "y": -2819.58, "action": "combat_script", "move_mode": "walk", - "action_params": "丽莎 attack,wait(0.5),attack,wait(1); 瓦雷莎 charge,wait(2); 八重神子 charge", + "action_params": "丽莎 attack,wait(0.5),attack,wait(1);瓦雷莎 charge,wait(2);八重神子 charge", "type": "target" }, {