From 117a2fc63ebc950974fc416d049ab3a92e92074a Mon Sep 17 00:00:00 2001 From: srose Date: Sat, 12 Oct 2024 15:05:54 -0400 Subject: [PATCH] Fix callback found after finding spell --- bots/battleground/battlegroundAgent.py | 6 +++--- core/Monitor.py | 7 ++++--- core/Player.py | 4 ++-- 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/bots/battleground/battlegroundAgent.py b/bots/battleground/battlegroundAgent.py index 9244702..bb89ecb 100644 --- a/bots/battleground/battlegroundAgent.py +++ b/bots/battleground/battlegroundAgent.py @@ -32,8 +32,8 @@ class BattlegroundAgent: self.tagInBg() else: self.logger.log("Deserter debuff found, waiting for debuff to disapear before tagging to bg...") - # self.inBgRoutine() time.sleep(3) + self.logger.log("Battleground bg farming ended.") def isDeserter(self): res = self.monitor.findMatch(self.deserterIcon) @@ -64,10 +64,10 @@ class BattlegroundAgent: self.inBgRoutine() - def foundEndOfBg(self ): + def foundEndOfBg(self, _res): self.logger.log("End of bg detected, leaving...") self.status = BG_STATUS.IDLE - time.sleep(10) + time.sleep(25) def checkEndOfBg(self): self.monitor.findMatchAndClickIfAvailable(self.leaveBgButton, self.foundEndOfBg) diff --git a/core/Monitor.py b/core/Monitor.py index e63e7b4..dffd4e4 100644 --- a/core/Monitor.py +++ b/core/Monitor.py @@ -79,7 +79,7 @@ class Monitor: def findMatchAndMoveToPosition(self, template, method = "TM_CCOEFF_NORMED"): point = self.findMatch(template, method) if (point == -1): - return -1 + return -1 addHumanReaction() pyautogui.moveTo(point[0], point[1]) addHumanReaction() @@ -89,13 +89,14 @@ class Monitor: if (res == -1): addHumanReaction() - if isfunction(onNotFound) is True: + if onNotFound is not None: return onNotFound(res) else: addHumanReaction() pyautogui.click() addHumanReaction() - if (isfunction(onFound) is True): + print(isfunction(onFound)) + if (onFound is not None): return onFound(res) diff --git a/core/Player.py b/core/Player.py index c2d96ea..58edb59 100644 --- a/core/Player.py +++ b/core/Player.py @@ -26,12 +26,12 @@ class Player: self.reconnectButton = cv.imread("assets/" + self.lang + "/menus/Reconnect.jpg", cv.IMREAD_GRAYSCALE) self.logger.log("Connected with " + self.playerName + " (" + self.playerClass + " - " + self.playerSpe + ")") - def connectButtonFound(self): + def connectButtonFound(self, _res): self.isConnected = CONNECT_STATUS.DISCONNECTED self.logger.log("Player not connected attempting to connect...") time.sleep(30) - def connectButtonNotFound(self): + def connectButtonNotFound(self, _res): self.isConnected = CONNECT_STATUS.CONNECTED def checkConnection(self):