added ok button check to magic

This commit is contained in:
2022-11-17 12:28:18 +01:00
parent 79db89b90b
commit aa92f20758

View File

@@ -4,6 +4,7 @@ from hsvfilter import HsvFilter
import pydirectinput import pydirectinput
from game_base_class import GameBase from game_base_class import GameBase
from window_capture import WindowCapture from window_capture import WindowCapture
from utils import dig_point
class Magic(GameBase): class Magic(GameBase):
@@ -72,6 +73,14 @@ class Magic(GameBase):
return return
# for needles in needle_list: # for needles in needle_list:
for rer in range(0, len(self.needle_list), 1): for rer in range(0, len(self.needle_list), 1):
screenshot = self.capture_window.get_screenshot_by_area(self.config.returnOKWindowPos())
rectangles = self.vision_stun.find(screenshot, self.ok_button, 0.5, 1)
if len(rectangles) == 1:
pointis = self.vision_stun.get_click_points(rectangles)
for pointi in pointis:
dig_point(pointi[0] + self.config.returnOKWindowPos()[2],
pointi[1] + self.config.returnOKWindowPos()[3], 150)
cv.waitKey(2000)
while True: while True:
screenshot = self.capture_window.get_screenshot() screenshot = self.capture_window.get_screenshot()
processed_screenshot = self.vision_stun.apply_hsv_filter(screenshot, self.hsv_list[rer]) processed_screenshot = self.vision_stun.apply_hsv_filter(screenshot, self.hsv_list[rer])