Updated hunter mark routine
This commit is contained in:
parent
fe2d532dc1
commit
20b77c9168
Binary file not shown.
|
Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.3 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 1.6 KiB After Width: | Height: | Size: 1.8 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 2.1 KiB After Width: | Height: | Size: 2.2 KiB |
|
|
@ -1,9 +1,27 @@
|
||||||
|
import time
|
||||||
import cv2 as cv
|
import cv2 as cv
|
||||||
|
import pyautogui
|
||||||
|
from core.Logger import Logger
|
||||||
class Spell:
|
class Spell:
|
||||||
def __init__(self, monitor, path, cooldown) -> None:
|
def __init__(self, monitor, path, name, castTime = 0, cooldown = 2) -> None:
|
||||||
|
self.spellName = name
|
||||||
|
self.castTime = castTime
|
||||||
|
self.logger = Logger("Spell")
|
||||||
|
self.cooldown = cooldown
|
||||||
self.monitor = monitor
|
self.monitor = monitor
|
||||||
self.spellIcon = cv.imread("assets/spells/" + path, cv.IMREAD_GRAYSCALE)
|
self.spellIcon = cv.imread("assets/spells/" + path, cv.IMREAD_GRAYSCALE)
|
||||||
|
self.lastUsed = None
|
||||||
|
|
||||||
def click():
|
def isOnCooldown(self):
|
||||||
self.monitor.findMatchAndClickIfAvailable(self.spellIcon)
|
if self.lastUsed is None:
|
||||||
|
return False
|
||||||
|
return time.time() - self.lastUsed <= self.cooldown
|
||||||
|
|
||||||
|
def cast(self):
|
||||||
|
if self.isOnCooldown() is False:
|
||||||
|
self.logger.log("Casting " + self.spellName)
|
||||||
|
lastCursorPosition = pyautogui.position()
|
||||||
|
self.monitor.findMatchAndClickIfAvailable(self.spellIcon)
|
||||||
|
time.sleep(self.castTime)
|
||||||
|
pyautogui.moveTo(lastCursorPosition)
|
||||||
|
self.lastUsed = time.time()
|
||||||
|
|
@ -12,24 +12,25 @@ class FightingAgent:
|
||||||
self.logger = Logger("Combat Agent", player.debug)
|
self.logger = Logger("Combat Agent", player.debug)
|
||||||
self.hasTarget = False
|
self.hasTarget = False
|
||||||
self.combatClass = self.loadCombatClass()
|
self.combatClass = self.loadCombatClass()
|
||||||
self.getRoutine()
|
|
||||||
|
|
||||||
def loadCombatClass(self):
|
def loadCombatClass(self):
|
||||||
return 42
|
return 42
|
||||||
|
|
||||||
def getRoutine(self):
|
def getRoutine(self):
|
||||||
if (self.player.playerClass == CLASSES.HUNTER and self.player.player.playerSpe == SPE.MARKSMANSHIP):
|
if (self.player.playerClass == CLASSES.HUNTER.name and self.player.playerSpe == SPE.MARKSMANSHIP.name):
|
||||||
from bots.fighting.hunter.marksmanship.Routine import Routine
|
from bots.fighting.hunter.marksmanship.Routine import Routine
|
||||||
|
self.classRoutine = Routine(self.monitor, self.player)
|
||||||
else:
|
else:
|
||||||
self.logger.log("Cannot find a Routine for your class and spe")
|
self.logger.log("Cannot find a Routine for your class and spe")
|
||||||
self.classRoutine = Routine(self.monitor, self.player)
|
|
||||||
|
|
||||||
def startFighting(self):
|
def startFighting(self):
|
||||||
|
self.getRoutine()
|
||||||
self.player.checkConnection()
|
self.player.checkConnection()
|
||||||
self.classRoutine.start()
|
if self.classRoutine is not None:
|
||||||
self.isCombatModeEnabled = True
|
self.isCombatModeEnabled = True
|
||||||
while self.isCombatModeEnabled is True:
|
while self.isCombatModeEnabled is True :
|
||||||
time.sleep(0.1)
|
self.classRoutine.start()
|
||||||
|
time.sleep(0.1)
|
||||||
self.logger.log("Combat mode is now disabled...")
|
self.logger.log("Combat mode is now disabled...")
|
||||||
|
|
||||||
def stopFighting(self):
|
def stopFighting(self):
|
||||||
|
|
|
||||||
|
|
@ -4,10 +4,14 @@ class Routine:
|
||||||
def __init__(self, monitor, player) -> None:
|
def __init__(self, monitor, player) -> None:
|
||||||
self.player = player
|
self.player = player
|
||||||
self.monitor = monitor
|
self.monitor = monitor
|
||||||
self.arcaneShotSpell = Spell(monitor, "hunter/general/ArcaneShot.jpg")
|
self.arcaneShotSpell = Spell(monitor, "hunter/general/ArcaneShot.jpg", "Arcane shot")
|
||||||
|
self.hunterMarkSpell = Spell(monitor, "hunter/general/HuntersMark.jpg", "Hunter's Mark", 0, 20)
|
||||||
|
self.blackArrowSpell = Spell(monitor, "hunter/marksmanship/BlackArrow.jpg", "Black Arrow", 0, 30)
|
||||||
|
|
||||||
def hasTarget(self):
|
def hasTarget(self):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
print("Starting fight routine")
|
self.hunterMarkSpell.cast()
|
||||||
|
self.blackArrowSpell.cast()
|
||||||
|
self.arcaneShotSpell.cast()
|
||||||
|
|
@ -24,7 +24,7 @@ class Player:
|
||||||
self.playerName = self.config.file["name"]
|
self.playerName = self.config.file["name"]
|
||||||
self.enterWorldButton = cv.imread("assets/" + self.lang + "/menus/EnterWorldButton.jpg", cv.IMREAD_GRAYSCALE)
|
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)
|
self.reconnectButton = cv.imread("assets/" + self.lang + "/menus/Reconnect.jpg", cv.IMREAD_GRAYSCALE)
|
||||||
self.logger.log("Connected with " + self.playerName + " (" + self.playerClass + ")")
|
self.logger.log("Connected with " + self.playerName + " (" + self.playerClass + " - " + self.playerSpe + ")")
|
||||||
|
|
||||||
def connectButtonFound(self):
|
def connectButtonFound(self):
|
||||||
self.isConnected = CONNECT_STATUS.DISCONNECTED
|
self.isConnected = CONNECT_STATUS.DISCONNECTED
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user