Add humanReaction
This commit is contained in:
+6
-5
@@ -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)
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
import time
|
||||
import random
|
||||
|
||||
def addHumanReaction():
|
||||
delay = random.uniform(0.1, 0.4)
|
||||
time.sleep(delay)
|
||||
Reference in New Issue
Block a user