From c73252d6748aaa3ba967d32ad666c1423e644b1f Mon Sep 17 00:00:00 2001 From: 5117600049 <511760049@qq.com> Date: Tue, 6 May 2025 19:48:27 +0800 Subject: [PATCH] =?UTF-8?q?JS=E8=84=9A=E6=9C=AC=EF=BC=9A=E5=91=A8=E6=9C=AC?= =?UTF-8?q?=E5=92=8C=E6=89=93=E7=89=8C=20bug=20=E4=BF=AE=E5=A4=8D=20(#716)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 测试 * 你的提交信息 * 周本全2.0更新以及打牌更新 * Update manifest.json * Update manifest.json * Update manifest.json * Update manifest.json * Update manifest.json * Update manifest.json * Update manifest.json * Update manifest.json * Update manifest.json * 打牌、周本bug 修复 --- .../main.js | 31 ++++++++++++++----- repo/js/七圣召唤七日历练全自动/main.js | 20 ++++-------- repo/js/七圣召唤七日历练全自动/manifest.json | 2 +- repo/js/周本10-仆人/main.js | 15 +++++++-- repo/js/周本3-公子/main.js | 19 ++++++++++-- repo/js/周本4-若陀/main.js | 20 ++++++++++-- repo/js/周本5-女士/main.js | 16 +++++++--- repo/js/周本6-雷神/main.js | 16 +++++++--- repo/js/周本7-散兵/main.js | 15 +++++++-- repo/js/周本8-草龙/main.js | 17 +++++++--- repo/js/周本9-鲸鱼/main.js | 15 +++++++-- 11 files changed, 137 insertions(+), 49 deletions(-) diff --git a/repo/js/一条龙领奖无树脂(用于周本、首领刷取)+尘歌壶/main.js b/repo/js/一条龙领奖无树脂(用于周本、首领刷取)+尘歌壶/main.js index ed4c7c3e..9dd45231 100644 --- a/repo/js/一条龙领奖无树脂(用于周本、首领刷取)+尘歌壶/main.js +++ b/repo/js/一条龙领奖无树脂(用于周本、首领刷取)+尘歌壶/main.js @@ -1,5 +1,26 @@ (async function () { +//检测传送结束 await tpEndDetection(); +async function tpEndDetection() { + const region = RecognitionObject.ocr(1690, 230, 75, 350);// 队伍名称区域 + let tpTime = 0; + await sleep(3000);//点击传送后等待一段时间避免误判 + //最多30秒传送时间 + while (tpTime < 300) { + let capture = captureGameRegion(); + let res = capture.find(region); + if (!res.isEmpty()){ + log.info("传送完成"); + await sleep(1200);//传送结束后有僵直 + return; + } + tpTime++; + await sleep(100); + } + throw new Error('传送时间超时'); +} + + let teaPot = settings.teaPot ?? 0; let delay = 2000; let ksl = settings.kslSelect ?? "枫丹"; async function kslAutoPath(location) { @@ -89,11 +110,7 @@ await sleep(delay); await pathingScript.runFile("assets/recover.json"); -await sleep(5000);//前往神像,避免茶壶放不出来 - - - let teaPot = settings.teaPot ?? 0; - await sleep(1000); +await sleep(500);//前往神像,避免茶壶放不出来 if(teaPot){ keyPress("B"); @@ -105,8 +122,8 @@ if(teaPot){ click(1700, 1018); //放置 await sleep(1500); keyPress("F"); //进入 - await sleep(20000); - + await tpEndDetection(); + await sleep(1500); if (teaPot == "璃月"){ keyDown("D"); await sleep(500); diff --git a/repo/js/七圣召唤七日历练全自动/main.js b/repo/js/七圣召唤七日历练全自动/main.js index 6ab4bf36..d66d91e6 100644 --- a/repo/js/七圣召唤七日历练全自动/main.js +++ b/repo/js/七圣召唤七日历练全自动/main.js @@ -8,8 +8,8 @@ async function checkChallengeResults() { const region1 = RecognitionObject.ocr(785, 890, 340, 82);// 对话区域 let capture = captureGameRegion(); let res1 = capture.find(region1); - if (res1.test != "对局胜利"){ - log.info("挑战失败"); + + if (1){ await sleep(1000); click(960, 540); await sleep(500); @@ -25,15 +25,7 @@ async function checkChallengeResults() { await sleep(1000); return; } - else{ - log.info("挑战成功"); - await sleep(1000); - click(754,915 );//退出挑战 - await sleep(4000); - await autoConversation(); - await sleep(1000); - return; - } + } @@ -42,7 +34,7 @@ async function autoConversation() { const region1 = RecognitionObject.ocr(785, 890, 340, 82);// 对话区域 const region2 = RecognitionObject.ocr(1250, 400, 660, 440);// 选项区域 let talkTime = 0; - await sleep(500);//点击后等待一段时间避免误判 + await sleep(2000);//点击后等待一段时间避免误判 //最多10次对话 while (talkTime < 20) { let capture = captureGameRegion(); @@ -72,7 +64,7 @@ async function autoConversation() { async function tpEndDetection() { const region = RecognitionObject.ocr(1690, 230, 75, 350);// 队伍名称区域 let tpTime = 0; - await sleep(500);//点击传送后等待一段时间避免误判 + await sleep(1500);//点击传送后等待一段时间避免误判 //最多30秒传送时间 while (tpTime < 300) { let capture = captureGameRegion(); @@ -332,7 +324,7 @@ keyDown("w"); await sleep(1200); keyUp("d"); keyUp("w"); -await sleep(700); +await sleep(600); } //前往二号桌 async function gotoTable2() { diff --git a/repo/js/七圣召唤七日历练全自动/manifest.json b/repo/js/七圣召唤七日历练全自动/manifest.json index 20435dad..9c95af8b 100644 --- a/repo/js/七圣召唤七日历练全自动/manifest.json +++ b/repo/js/七圣召唤七日历练全自动/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 1, "name": "打牌一条龙", - "version": "1.5", + "version": "1.6", "description": "只靠一个牌组的话,胜率还是太低了,所以有没有既简单又强势的卡组推荐下呢?", "authors": [ { diff --git a/repo/js/周本10-仆人/main.js b/repo/js/周本10-仆人/main.js index c2ec900f..b1bf8bd5 100644 --- a/repo/js/周本10-仆人/main.js +++ b/repo/js/周本10-仆人/main.js @@ -55,7 +55,7 @@ const autoNavigateToReward = async () => { log.info("已到达领奖点,检测到文字: " + rewardResult.text); return; } - else if(advanceNum > 80){ + else if(advanceNum > 20){ throw new Error('前进时间超时'); } // 2. 未到达领奖点,则调整视野 @@ -94,7 +94,7 @@ const autoNavigateToReward = async () => { } // 3. 前进一小步 keyDown("w"); - await sleep(800); + await sleep(500); keyUp("w"); await sleep(100); // 等待角色移动稳定 } @@ -123,10 +123,19 @@ async function autoFightAndEndDetection() { if (hasText1 && !hasText2 && hasText3) { challengeNum++; await sleep(500);//避免切人冷却,导致角色识别失败 + capture = captureGameRegion(); + res1 = capture.find(region1); + res2 = capture.find(region2); + res3 = capture.find(region3); + hasText1 = !res1.isEmpty() && res1.text.trim().length > 0; + hasText2 = !res2.isEmpty() && res2.text.trim().length > 0; + hasText3 = !res3.isEmpty() && res3.text.trim().length > 0; + //二次检测避免无法启动战斗 + if (hasText1 && !hasText2 && hasText3){ log.info(`执行第${challengeNum}次战斗`); challengeTime = challengeTime + 205; - await dispatcher.runTask(new SoloTask("AutoFight")); + } } // 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环 else if (hasText2 && !hasText1 && hasText3) { diff --git a/repo/js/周本3-公子/main.js b/repo/js/周本3-公子/main.js index 117cc3fa..863dc37c 100644 --- a/repo/js/周本3-公子/main.js +++ b/repo/js/周本3-公子/main.js @@ -27,9 +27,22 @@ async function autoFightAndEndDetection() { await sleep(1800); keyUp("s"); challengeNum++; + capture = captureGameRegion(); + res1 = capture.find(region1); + res2 = capture.find(region2); + res3 = capture.find(region3); + hasText1 = !res1.isEmpty() && res1.text.trim().length > 0; + hasText2 = !res2.isEmpty() && res2.text.trim().length > 0; + hasText3 = !res3.isEmpty() && res3.text.trim().length > 0; + //二次检测避免无法启动战斗 + if (hasText1 && !hasText2 && hasText3){ log.info(`执行第${challengeNum}次战斗`); - challengeTime = challengeTime + 40; + challengeTime = challengeTime + 205; await dispatcher.runTask(new SoloTask("AutoFight")); + } + + + } // 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环 else if (hasText2 && !hasText1 && hasText3) { @@ -76,12 +89,12 @@ const autoNavigateToReward = async () => { log.info("已到达领奖点,检测到文字: " + rewardResult.text); return; } - else if(advanceNum > 30){ + else if(advanceNum > 15){ throw new Error('前进时间超时'); } // 前进一小步 keyDown("w"); - await sleep(700); + await sleep(500); keyUp("w"); await sleep(100); // 等待角色移动稳定 } diff --git a/repo/js/周本4-若陀/main.js b/repo/js/周本4-若陀/main.js index 43d712c1..4dc0cfa3 100644 --- a/repo/js/周本4-若陀/main.js +++ b/repo/js/周本4-若陀/main.js @@ -54,7 +54,7 @@ const autoNavigateToReward = async () => { log.info("已到达领奖点,检测到文字: " + rewardResult.text); return; } - else if(advanceNum > 80){ + else if(advanceNum > 30){ throw new Error('前进时间超时'); } // 2. 未到达领奖点,则调整视野 @@ -93,7 +93,7 @@ const autoNavigateToReward = async () => { } // 3. 前进一小步 keyDown("w"); - await sleep(800); + await sleep(500); keyUp("w"); await sleep(100); // 等待角色移动稳定 } @@ -123,9 +123,23 @@ async function autoFightAndEndDetection() { challengeNum++; await sleep(500);//避免切人冷却,导致角色识别失败 log.info(`执行第${challengeNum}次战斗`); + capture = captureGameRegion(); + res1 = capture.find(region1); + res2 = capture.find(region2); + res3 = capture.find(region3); + hasText1 = !res1.isEmpty() && res1.text.trim().length > 0; + hasText2 = !res2.isEmpty() && res2.text.trim().length > 0; + hasText3 = !res3.isEmpty() && res3.text.trim().length > 0; + //二次检测避免无法启动战斗 + if (hasText1 && !hasText2 && hasText3){ + log.info(`执行第${challengeNum}次战斗`); challengeTime = challengeTime + 205; - await dispatcher.runTask(new SoloTask("AutoFight")); + } + + + + } // 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环 else if (hasText2 && !hasText1 && hasText3) { diff --git a/repo/js/周本5-女士/main.js b/repo/js/周本5-女士/main.js index 9b93226a..50f2d47b 100644 --- a/repo/js/周本5-女士/main.js +++ b/repo/js/周本5-女士/main.js @@ -42,12 +42,12 @@ const autoNavigateToReward = async () => { log.info("已到达领奖点,检测到文字: " + rewardResult.text); return; } - else if(advanceNum > 30){ + else if(advanceNum > 20){ throw new Error('前进时间超时'); } // 前进一小步 keyDown("w"); - await sleep(700); + await sleep(500); keyUp("w"); await sleep(100); // 等待角色移动稳定 } @@ -78,11 +78,19 @@ async function autoFightAndEndDetection() { keyDown("s"); await sleep(1200); keyUp("s"); - await sleep(500);//避免切人冷却,导致角色识别失败 + capture = captureGameRegion(); + res1 = capture.find(region1); + res2 = capture.find(region2); + res3 = capture.find(region3); + hasText1 = !res1.isEmpty() && res1.text.trim().length > 0; + hasText2 = !res2.isEmpty() && res2.text.trim().length > 0; + hasText3 = !res3.isEmpty() && res3.text.trim().length > 0; + //二次检测避免无法启动战斗 + if (hasText1 && !hasText2 && hasText3){ log.info(`执行第${challengeNum}次战斗`); challengeTime = challengeTime + 205; - await dispatcher.runTask(new SoloTask("AutoFight")); + } } // 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环 else if (hasText2 && !hasText1 && hasText3) { diff --git a/repo/js/周本6-雷神/main.js b/repo/js/周本6-雷神/main.js index 0b64881f..be62ad58 100644 --- a/repo/js/周本6-雷神/main.js +++ b/repo/js/周本6-雷神/main.js @@ -152,12 +152,12 @@ const autoNavigateToReward = async () => { log.info("已到达领奖点,检测到文字: " + rewardResult.text); return; } - else if(advanceNum > 30){ + else if(advanceNum > 20){ throw new Error('前进时间超时'); } // 前进一小步 keyDown("w"); - await sleep(700); + await sleep(500); keyUp("w"); await sleep(100); // 等待角色移动稳定 } @@ -189,11 +189,19 @@ async function autoFightAndEndDetection() { keyDown("s"); await sleep(1800); keyUp("s"); - await sleep(500);//避免切人冷却,导致角色识别失败 + capture = captureGameRegion(); + res1 = capture.find(region1); + res2 = capture.find(region2); + res3 = capture.find(region3); + hasText1 = !res1.isEmpty() && res1.text.trim().length > 0; + hasText2 = !res2.isEmpty() && res2.text.trim().length > 0; + hasText3 = !res3.isEmpty() && res3.text.trim().length > 0; + //二次检测避免无法启动战斗 + if (hasText1 && !hasText2 && hasText3){ log.info(`执行第${challengeNum}次战斗`); challengeTime = challengeTime + 205; - await dispatcher.runTask(new SoloTask("AutoFight")); + } } // 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环 else if (hasText2 && !hasText1 && hasText3) { diff --git a/repo/js/周本7-散兵/main.js b/repo/js/周本7-散兵/main.js index 3d3a1045..f0c7c99e 100644 --- a/repo/js/周本7-散兵/main.js +++ b/repo/js/周本7-散兵/main.js @@ -153,12 +153,12 @@ const autoNavigateToReward = async () => { log.info("已到达领奖点,检测到文字: " + rewardResult.text); return; } - else if(advanceNum > 30){ + else if(advanceNum > 25){ throw new Error('前进时间超时'); } // 前进一小步 keyDown("w"); - await sleep(700); + await sleep(500); keyUp("w"); await sleep(100); // 等待角色移动稳定 } @@ -191,10 +191,19 @@ async function autoFightAndEndDetection() { await sleep(1800); keyUp("s"); await sleep(500);//避免切人冷却,导致角色识别失败 + capture = captureGameRegion(); + res1 = capture.find(region1); + res2 = capture.find(region2); + res3 = capture.find(region3); + hasText1 = !res1.isEmpty() && res1.text.trim().length > 0; + hasText2 = !res2.isEmpty() && res2.text.trim().length > 0; + hasText3 = !res3.isEmpty() && res3.text.trim().length > 0; + //二次检测避免无法启动战斗 + if (hasText1 && !hasText2 && hasText3){ log.info(`执行第${challengeNum}次战斗`); challengeTime = challengeTime + 205; - await dispatcher.runTask(new SoloTask("AutoFight")); + } } // 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环 else if (hasText2 && !hasText1 && hasText3) { diff --git a/repo/js/周本8-草龙/main.js b/repo/js/周本8-草龙/main.js index d398316c..60b1cac0 100644 --- a/repo/js/周本8-草龙/main.js +++ b/repo/js/周本8-草龙/main.js @@ -54,7 +54,7 @@ const autoNavigateToReward = async () => { log.info("已到达领奖点,检测到文字: " + rewardResult.text); return; } - else if(advanceNum > 80){ + else if(advanceNum > 20){ throw new Error('前进时间超时'); } // 2. 未到达领奖点,则调整视野 @@ -72,7 +72,7 @@ const autoNavigateToReward = async () => { await sleep(800); keyUp("a"); keyDown("w"); - await sleep(800); + await sleep(500); keyUp("w"); } if (iconRes.x >= 920 && iconRes.x <= 980 && iconRes.y <= 540) { @@ -93,7 +93,7 @@ const autoNavigateToReward = async () => { } // 3. 前进一小步 keyDown("w"); - await sleep(800); + await sleep(500); keyUp("w"); await sleep(100); // 等待角色移动稳定 } @@ -122,10 +122,19 @@ async function autoFightAndEndDetection() { if (hasText1 && !hasText2 && hasText3) { challengeNum++; await sleep(500);//避免切人冷却,导致角色识别失败 + capture = captureGameRegion(); + res1 = capture.find(region1); + res2 = capture.find(region2); + res3 = capture.find(region3); + hasText1 = !res1.isEmpty() && res1.text.trim().length > 0; + hasText2 = !res2.isEmpty() && res2.text.trim().length > 0; + hasText3 = !res3.isEmpty() && res3.text.trim().length > 0; + //二次检测避免无法启动战斗 + if (hasText1 && !hasText2 && hasText3){ log.info(`执行第${challengeNum}次战斗`); challengeTime = challengeTime + 205; - await dispatcher.runTask(new SoloTask("AutoFight")); + } } // 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环 else if (hasText2 && !hasText1 && hasText3) { diff --git a/repo/js/周本9-鲸鱼/main.js b/repo/js/周本9-鲸鱼/main.js index 58d888d4..fc11e6e9 100644 --- a/repo/js/周本9-鲸鱼/main.js +++ b/repo/js/周本9-鲸鱼/main.js @@ -54,7 +54,7 @@ const autoNavigateToReward = async () => { log.info("已到达领奖点,检测到文字: " + rewardResult.text); return; } - else if(advanceNum > 80){ + else if(advanceNum > 30){ throw new Error('前进时间超时'); } // 2. 未到达领奖点,则调整视野 @@ -93,7 +93,7 @@ const autoNavigateToReward = async () => { } // 3. 前进一小步 keyDown("w"); - await sleep(800); + await sleep(500); keyUp("w"); await sleep(100); // 等待角色移动稳定 } @@ -122,10 +122,19 @@ async function autoFightAndEndDetection() { if (hasText1 && !hasText2 && hasText3) { challengeNum++; await sleep(500);//避免切人冷却,导致角色识别失败 + capture = captureGameRegion(); + res1 = capture.find(region1); + res2 = capture.find(region2); + res3 = capture.find(region3); + hasText1 = !res1.isEmpty() && res1.text.trim().length > 0; + hasText2 = !res2.isEmpty() && res2.text.trim().length > 0; + hasText3 = !res3.isEmpty() && res3.text.trim().length > 0; + //二次检测避免无法启动战斗 + if (hasText1 && !hasText2 && hasText3){ log.info(`执行第${challengeNum}次战斗`); challengeTime = challengeTime + 205; - await dispatcher.runTask(new SoloTask("AutoFight")); + } } // 情况2: 区域2有文字 且 区域1无文字 且 区域3有文字 → 结束循环 else if (hasText2 && !hasText1 && hasText3) {