From 3fffad6a99b1a336c6259abceb92fdef9ada7f9c Mon Sep 17 00:00:00 2001 From: srose Date: Thu, 12 Sep 2024 10:05:08 -0400 Subject: [PATCH] Fix fishing agent --- bots/fishing/FishingAgent.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bots/fishing/FishingAgent.py b/bots/fishing/FishingAgent.py index 9070a9e..9cb48b6 100644 --- a/bots/fishing/FishingAgent.py +++ b/bots/fishing/FishingAgent.py @@ -25,7 +25,8 @@ class FishingAgent: def castLure(self): self.retry = 0 - pyautogui.moveTo(2,3) + self.lureLoc = None + pyautogui.moveTo(50,50) self.logger.log("Casting Lure.") res = self.monitor.findMatchAndMoveToPosition(self.fishingIconImg) if (res == -1): @@ -39,6 +40,7 @@ class FishingAgent: self.logger.log("Moving cursor to Lure.") time.sleep(2) res = self.monitor.findMatch(self.fishingBobberImg) + if (res == -1): if (self.retry > 4): self.logger.log("Took too to find lure long, retrying fishing from the beginning") @@ -48,9 +50,9 @@ class FishingAgent: self.retry += 1 time.sleep(1) self.findLure() + time.sleep(0.5) self.lureLoc = res - time.sleep(0.2) - pyautogui.moveTo(res[0], res[1]) + pyautogui.moveTo(self.lureLoc[0], self.lureLoc[1]) self.watchLure() def watchLure(self): @@ -60,12 +62,15 @@ class FishingAgent: self.retry += 1 time.sleep(0.1) res = self.monitor.findMatch(self.fishingBobberImg) + print(self.lureLoc) print(res) if (res != -1 and abs(res[1] - self.lureLoc[1]) > 20): + time.sleep(0.2) pyautogui.click() time.sleep(0.5) return elif (self.retry > 200): + self.retry = 0 return def run(self):