Updated hunter mark routine
This commit is contained in:
@@ -1,9 +1,27 @@
|
||||
import time
|
||||
import cv2 as cv
|
||||
|
||||
import pyautogui
|
||||
from core.Logger import Logger
|
||||
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.spellIcon = cv.imread("assets/spells/" + path, cv.IMREAD_GRAYSCALE)
|
||||
self.lastUsed = None
|
||||
|
||||
def click():
|
||||
self.monitor.findMatchAndClickIfAvailable(self.spellIcon)
|
||||
def isOnCooldown(self):
|
||||
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()
|
||||
Reference in New Issue
Block a user