Add humanReaction
This commit is contained in:
parent
0b8d761a37
commit
154bdbbd9f
|
|
@ -6,6 +6,7 @@ import cv2 as cv
|
|||
import pyautogui
|
||||
from core.Logger import Logger
|
||||
from core.Player import PLAYER_STATE
|
||||
from core.utils import addHumanReaction
|
||||
|
||||
class FishingAgent:
|
||||
def __init__(self, monitor, player) -> None:
|
||||
|
|
@ -58,24 +59,24 @@ class FishingAgent:
|
|||
time.sleep(1)
|
||||
self.findLure()
|
||||
else:
|
||||
time.sleep(0.5)
|
||||
addHumanReaction()
|
||||
pyautogui.moveTo(res[0], res[1])
|
||||
self.watchLure()
|
||||
|
||||
def watchLure(self):
|
||||
self.retry = 0
|
||||
self.logger.log("Waiting for fish...")
|
||||
time.sleep(0.4)
|
||||
addHumanReaction()
|
||||
res = self.monitor.findMatch(self.fishingBobberImg)
|
||||
if (res != -1):
|
||||
self.lureLoc = res
|
||||
while True:
|
||||
self.retry += 1
|
||||
time.sleep(0.1)
|
||||
addHumanReaction()
|
||||
res = self.monitor.findMatch(self.fishingBobberImg)
|
||||
print(res)
|
||||
if (res == -1 or abs(res[1] - self.lureLoc[1]) > 20):
|
||||
time.sleep(0.2)
|
||||
addHumanReaction()
|
||||
pyautogui.click()
|
||||
return
|
||||
elif (self.retry > 150):
|
||||
|
|
|
|||
|
|
@ -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
core/utils.py
Normal file
6
core/utils.py
Normal file
|
|
@ -0,0 +1,6 @@
|
|||
import time
|
||||
import random
|
||||
|
||||
def addHumanReaction():
|
||||
delay = random.uniform(0.1, 0.4)
|
||||
time.sleep(delay)
|
||||
Loading…
Reference in New Issue
Block a user