From 0586349304c8ae4ead1672ad66413e08b6debc8b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E8=B5=B7=E4=B8=AA=E5=90=8D=E5=AD=97=E5=A5=BD=E9=9A=BE?= =?UTF-8?q?=E7=9A=84=E5=96=B5?= <25520958+MisakaAldrich@users.noreply.github.com> Date: Thu, 19 Jun 2025 02:46:46 +0800 Subject: [PATCH] =?UTF-8?q?JS=E8=84=9A=E6=9C=AC:=20=E6=91=A7=E6=AF=81?= =?UTF-8?q?=E5=9C=A3=E9=81=97=E7=89=A9=E6=B7=BB=E5=8A=A0=E5=8C=BA=E5=9F=9F?= =?UTF-8?q?=E9=99=90=E5=88=B6=20(#1128)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * JS脚本: 摧毁圣遗物添加区域限制 --- repo/js/DestroyArtifactsForMora/main.js | 23 ++++++++++--------- repo/js/DestroyArtifactsForMora/manifest.json | 2 +- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/repo/js/DestroyArtifactsForMora/main.js b/repo/js/DestroyArtifactsForMora/main.js index bcbe885c..9887a500 100644 --- a/repo/js/DestroyArtifactsForMora/main.js +++ b/repo/js/DestroyArtifactsForMora/main.js @@ -3,12 +3,13 @@ const DeleteButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("As const AutoAddButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/AutoAddButton.png")); const ConfirmButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/ConfirmButton.png")); const DestoryButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/DestoryButton.png")); +const MidDestoryButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("Assets/RecognitionObject/DestoryButton.png"), 900, 600, 500, 300); /** * @returns {Promise} */ -(async function() { +(async function () { await genshin.returnMainUi(); keyPress("B"); await sleep(1500); @@ -21,15 +22,15 @@ const DestoryButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("A } //计算摧毁次数 - if (settings.number > 21){ - times = Math.ceil(settings.number/100) - } else if (settings.number <= 21){ + if (settings.number > 21) { + times = Math.ceil(settings.number / 100) + } else if (settings.number <= 21) { times = settings.number } else { times = 1 } try { - for (let i=0 ;i < times ; i++) { + for (let i = 0; i < times; i++) { captureGameRegion().find(DeleteButtonRo).click();// 点击摧毁 await sleep(600); captureGameRegion().find(AutoAddButtonRo).click();// 点击自动添加 @@ -37,31 +38,31 @@ const DestoryButtonRo = RecognitionObject.TemplateMatch(file.ReadImageMatSync("A if (settings.oneStar) { await sleep(300); - click(150,150); + click(150, 150); } if (settings.twoStar) { await sleep(300); - click(150,220); + click(150, 220); } if (settings.threeStar) { await sleep(300); - click(150,300); + click(150, 300); } if (settings.fourStar) { await sleep(300); - click(150,370); + click(150, 370); } captureGameRegion().find(ConfirmButtonRo).click();// 点击快捷放入 await sleep(600); captureGameRegion().find(DestoryButtonRo).click();// 点击摧毁 await sleep(600); - captureGameRegion().find(DestoryButtonRo).click();// 弹出页面点击摧毁 + captureGameRegion().find(MidDestoryButtonRo).click();// 弹出页面点击摧毁 await sleep(600); click(960, 1000);// 点击空白处 await sleep(1000); } - } catch(ex) { + } catch (ex) { log.info("背包里的圣遗物已摧毁完毕,提前结束") } finally { await genshin.returnMainUi(); diff --git a/repo/js/DestroyArtifactsForMora/manifest.json b/repo/js/DestroyArtifactsForMora/manifest.json index 097f5b2d..33707619 100644 --- a/repo/js/DestroyArtifactsForMora/manifest.json +++ b/repo/js/DestroyArtifactsForMora/manifest.json @@ -1,7 +1,7 @@ { "manifest_version": 1, "name": "摧毁圣遗物换摩拉", - "version": "1.0", + "version": "1.1", "bgi_version": "0.44.6", "description": "图像识别改造版", "authors": [