From fe2d532dc173fcc730049297ea08c2b159b65bae Mon Sep 17 00:00:00 2001 From: srose Date: Sat, 28 Sep 2024 14:40:11 -0400 Subject: [PATCH] Add routine for hunter mark first step --- bots/components/spell.py | 9 +++++++++ bots/fighting/FightingAgent.py | 13 +++++++++++-- bots/fighting/hunter/marksmanship/Routine.py | 11 ++++++++++- config.json | 2 +- core/Player.py | 3 ++- 5 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 bots/components/spell.py diff --git a/bots/components/spell.py b/bots/components/spell.py new file mode 100644 index 0000000..3d8dce7 --- /dev/null +++ b/bots/components/spell.py @@ -0,0 +1,9 @@ +import cv2 as cv + +class Spell: + def __init__(self, monitor, path, cooldown) -> None: + self.monitor = monitor + self.spellIcon = cv.imread("assets/spells/" + path, cv.IMREAD_GRAYSCALE) + + def click(): + self.monitor.findMatchAndClickIfAvailable(self.spellIcon) \ No newline at end of file diff --git a/bots/fighting/FightingAgent.py b/bots/fighting/FightingAgent.py index 934af26..deffcd1 100644 --- a/bots/fighting/FightingAgent.py +++ b/bots/fighting/FightingAgent.py @@ -1,25 +1,34 @@ import time from threading import Thread from core.Logger import Logger +from core.Player import CLASSES, SPE class FightingAgent: def __init__(self, monitor, player) -> None: self.isCombatModeEnabled = False self.monitor = monitor self.player = player + self.classRoutine = None self.logger = Logger("Combat Agent", player.debug) self.hasTarget = False self.combatClass = self.loadCombatClass() + self.getRoutine() def loadCombatClass(self): return 42 + def getRoutine(self): + if (self.player.playerClass == CLASSES.HUNTER and self.player.player.playerSpe == SPE.MARKSMANSHIP): + from bots.fighting.hunter.marksmanship.Routine import Routine + else: + self.logger.log("Cannot find a Routine for your class and spe") + self.classRoutine = Routine(self.monitor, self.player) + def startFighting(self): self.player.checkConnection() + self.classRoutine.start() self.isCombatModeEnabled = True - while self.isCombatModeEnabled is True: - time.sleep(0.1) self.logger.log("Combat mode is now disabled...") diff --git a/bots/fighting/hunter/marksmanship/Routine.py b/bots/fighting/hunter/marksmanship/Routine.py index 5cda055..f51dec7 100644 --- a/bots/fighting/hunter/marksmanship/Routine.py +++ b/bots/fighting/hunter/marksmanship/Routine.py @@ -1,4 +1,13 @@ +from bots.components.spell import Spell + class Routine: def __init__(self, monitor, player) -> None: self.player = player - self.monitor = monitor \ No newline at end of file + self.monitor = monitor + self.arcaneShotSpell = Spell(monitor, "hunter/general/ArcaneShot.jpg") + + def hasTarget(self): + pass + + def start(self): + print("Starting fight routine") \ No newline at end of file diff --git a/config.json b/config.json index db2d766..3b6005b 100644 --- a/config.json +++ b/config.json @@ -1,7 +1,7 @@ { "antiAfk": true, "class": "DRUID", - "spe": "MARKSMANSHIP", + "spe": "RESTORATION", "debug": false, "lang": "en", "name": "Droïde" diff --git a/core/Player.py b/core/Player.py index b434c41..c5016ba 100644 --- a/core/Player.py +++ b/core/Player.py @@ -1,4 +1,3 @@ -import json from enum import Enum import time import cv2 as cv @@ -6,6 +5,7 @@ from core.Logger import Logger CONNECT_STATUS = Enum('CONNECT_STATUS', ["CONNECTED", "CONNECTING", "DISCONNECTED"]) CLASSES = Enum('CLASSES', ['DRUID', 'MAGE', 'HUNTER', 'PRIEST']) +SPE = Enum('SPE', ['MARKSMANSHIP']) PLAYER_STATE = Enum('STATE', ['IDLE', 'FISHING', 'FARMING', 'BG_FARMING']) class Player: @@ -20,6 +20,7 @@ class Player: self.state = PLAYER_STATE.IDLE self.monitor = monitor self.playerClass = self.config.file["class"] + self.playerSpe = self.config.file["spe"] self.playerName = self.config.file["name"] self.enterWorldButton = cv.imread("assets/" + self.lang + "/menus/EnterWorldButton.jpg", cv.IMREAD_GRAYSCALE) self.reconnectButton = cv.imread("assets/" + self.lang + "/menus/Reconnect.jpg", cv.IMREAD_GRAYSCALE)