Add humanReaction

This commit is contained in:
2024-10-10 20:29:15 -04:00
parent 0b8d761a37
commit 154bdbbd9f
3 changed files with 17 additions and 9 deletions
+6 -5
View File
@@ -6,6 +6,7 @@ import pyautogui
import numpy as np
import cv2 as cv
from core.Logger import Logger
from core.utils import addHumanReaction
FPS_REPORT_DELAY = 3
@@ -79,21 +80,21 @@ class Monitor:
point = self.findMatch(template, method)
if (point == -1):
return -1
time.sleep(0.2)
addHumanReaction()
pyautogui.moveTo(point[0], point[1])
time.sleep(0.15)
addHumanReaction()
def findMatchAndClickIfAvailable(self, template, onFound = None, onNotFound = None):
res = self.findMatchAndMoveToPosition(template)
if (res == -1):
time.sleep(0.3)
addHumanReaction()
if isfunction(onNotFound) is True:
return onNotFound(res)
else:
time.sleep(0.1)
addHumanReaction()
pyautogui.click()
time.sleep(0.15)
addHumanReaction()
if (isfunction(onFound) is True):
return onFound(res)
+6
View File
@@ -0,0 +1,6 @@
import time
import random
def addHumanReaction():
delay = random.uniform(0.1, 0.4)
time.sleep(delay)