From fe2e37c9e4d2e1c17369f7b58c0cfd53bc2ded8d Mon Sep 17 00:00:00 2001 From: Iluvenis Date: Fri, 25 Jul 2025 20:02:26 +0800 Subject: [PATCH] =?UTF-8?q?JS=E8=84=9A=E6=9C=AC:=20=E9=B8=A1=E8=85=BF?= =?UTF-8?q?=E5=A5=BD=E6=84=9F=E6=B7=BB=E5=8A=A0Ocr=E5=8A=9F=E8=83=BD?= =?UTF-8?q?=EF=BC=8C=E6=8F=90=E9=AB=98=E6=88=90=E5=8A=9F=E7=8E=87=20(#1406?= =?UTF-8?q?)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../{从甜甜花到狗盆.json => 到狗盆.json} | 12 ++--------- .../{从狗盆到甜甜花.json => 到甜甜花.json} | 14 +++---------- .../assets/AutoPath/导航至甜甜花位置.json | 4 ++-- repo/js/AutoFriendship鸡腿/main.js | 20 ++++++++++++++++--- repo/js/AutoFriendship鸡腿/manifest.json | 13 +++++++----- 5 files changed, 32 insertions(+), 31 deletions(-) rename repo/js/AutoFriendship鸡腿/assets/AutoPath/{从甜甜花到狗盆.json => 到狗盆.json} (58%) rename repo/js/AutoFriendship鸡腿/assets/AutoPath/{从狗盆到甜甜花.json => 到甜甜花.json} (52%) diff --git a/repo/js/AutoFriendship鸡腿/assets/AutoPath/从甜甜花到狗盆.json b/repo/js/AutoFriendship鸡腿/assets/AutoPath/到狗盆.json similarity index 58% rename from repo/js/AutoFriendship鸡腿/assets/AutoPath/从甜甜花到狗盆.json rename to repo/js/AutoFriendship鸡腿/assets/AutoPath/到狗盆.json index c7b0145e..ec640d5e 100644 --- a/repo/js/AutoFriendship鸡腿/assets/AutoPath/从甜甜花到狗盆.json +++ b/repo/js/AutoFriendship鸡腿/assets/AutoPath/到狗盆.json @@ -1,23 +1,15 @@ { "info": { - "name": "从甜甜花到狗盆", + "name": "到狗盆", "type": "collect", "author": "花火", - "version": "1.0", + "version": "1.2", "description": "", "bgi_version": "0.35.1" }, "positions": [ { "id": 1, - "action": "", - "move_mode": "walk", - "type": "path", - "x": -4529.2578125, - "y": -3084.009765625 - }, - { - "id": 2, "x": -4500.28125, "y": -3116.0146484375, "type": "target", diff --git a/repo/js/AutoFriendship鸡腿/assets/AutoPath/从狗盆到甜甜花.json b/repo/js/AutoFriendship鸡腿/assets/AutoPath/到甜甜花.json similarity index 52% rename from repo/js/AutoFriendship鸡腿/assets/AutoPath/从狗盆到甜甜花.json rename to repo/js/AutoFriendship鸡腿/assets/AutoPath/到甜甜花.json index 8bf67c2a..27933b16 100644 --- a/repo/js/AutoFriendship鸡腿/assets/AutoPath/从狗盆到甜甜花.json +++ b/repo/js/AutoFriendship鸡腿/assets/AutoPath/到甜甜花.json @@ -1,24 +1,16 @@ { "info": { - "name": "从狗盆到甜甜花", + "name": "到甜甜花", "type": "collect", "author": "花火", - "version": "1.1", + "version": "1.2", "description": "", "bgi_version": "0.43.5" }, "positions": [ { "id": 1, - "x": -4500.28125, - "y": -3116.0146484375, - "type": "path", - "move_mode": "walk", - "action": "" - }, - { - "id": 2, - "action": "exit_and_relogin", + "action": "", "move_mode": "walk", "type": "target", "x": -4529.2578125, diff --git a/repo/js/AutoFriendship鸡腿/assets/AutoPath/导航至甜甜花位置.json b/repo/js/AutoFriendship鸡腿/assets/AutoPath/导航至甜甜花位置.json index 4ca242a7..bc9e003e 100644 --- a/repo/js/AutoFriendship鸡腿/assets/AutoPath/导航至甜甜花位置.json +++ b/repo/js/AutoFriendship鸡腿/assets/AutoPath/导航至甜甜花位置.json @@ -3,7 +3,7 @@ "name": "到达甜甜花位置", "type": "collect", "author": "花火", - "version": "1.1", + "version": "1.2", "description": "", "bgi_version": "0.43.5" }, @@ -46,7 +46,7 @@ "y": -3084.009765625, "type": "target", "move_mode": "walk", - "action": "exit_and_relogin" + "action": "" } ] } \ No newline at end of file diff --git a/repo/js/AutoFriendship鸡腿/main.js b/repo/js/AutoFriendship鸡腿/main.js index 9bb893a4..0fefa5da 100644 --- a/repo/js/AutoFriendship鸡腿/main.js +++ b/repo/js/AutoFriendship鸡腿/main.js @@ -25,7 +25,7 @@ await sleep(1000); click(1010, 760); await sleep(1000); - } // todo:考虑添加ocr参数确保一定点击到 F + } async function AutoPath(locationName) { try { @@ -37,18 +37,32 @@ await sleep(2000); } + async function OcrF() { + let capture = await captureGameRegion(); + let ocr = await capture.find(RecognitionObject.ocrThis); + if(ocr.text.includes('投喂')){ + return true; + } + return false; + } + async function AutoFriendshipDev(times) { log.info(`导航至甜甜花位置`); await AutoPath('导航至甜甜花位置'); + await genshin.relogin(); log.info(`自动好感开始...`); const startFirstTime = Date.now(); for (let i = 0; i < times; i++) { log.info(`自动好感当前次数:${i + 1}/${times}`); - await AutoPath('从甜甜花到狗盆'); + await AutoPath('到狗盆'); + for(let j = 0; j < 3 && !await OcrF(); j++){ + await AutoPath('到狗盆'); + } await Feed(); if( i != times - 1) { - await AutoPath('从狗盆到甜甜花'); + await AutoPath('到甜甜花'); + await genshin.relogin(); } //最后一次不需要返回到甜甜花 const estimatedCompletion = CalculateEstimatedCompletion(startFirstTime, i + 1, times); const currentTime = LogTimeTaken(startFirstTime); diff --git a/repo/js/AutoFriendship鸡腿/manifest.json b/repo/js/AutoFriendship鸡腿/manifest.json index cb2343b0..e357a0f6 100644 --- a/repo/js/AutoFriendship鸡腿/manifest.json +++ b/repo/js/AutoFriendship鸡腿/manifest.json @@ -1,13 +1,16 @@ { "manifest_version": 1, "name": "鸡腿好感", - "version": "1.1", - "tags": ["好感", "突发事件"], - "bgi_version": "0.43.5", - "description": "通过喂狗突发事件刷好感度,使用满员好感度队伍,每天上限10次,有概率失败可以适当增加次数", + "version": "1.2", + "tags": [ + "好感", + "突发事件" + ], + "bgi_version": "0.44.0", + "description": "通过喂狗突发事件刷好感度,确保队伍满员,4个角色都能刷,每天上限10次", "authors": [ { - "name": "花火" + "name": "花火" }, { "name": "秋云",