fixed numerous bugs
This commit is contained in:
@@ -2,7 +2,7 @@ from time import time
|
|||||||
import sys
|
import sys
|
||||||
import cv2 as cv
|
import cv2 as cv
|
||||||
import keyboard
|
import keyboard
|
||||||
from utils import get_click_point, dig_point, check_for_ok_button, check_for_craft_button
|
from utils import get_click_point, dig_point, check_for_craft_ok_button, check_for_craft_button
|
||||||
import pydirectinput
|
import pydirectinput
|
||||||
from craft_overlay import CraftOverlay
|
from craft_overlay import CraftOverlay
|
||||||
from config_file import UserConfigs
|
from config_file import UserConfigs
|
||||||
@@ -307,7 +307,8 @@ def run():
|
|||||||
# initialize the StunVision class
|
# initialize the StunVision class
|
||||||
vision_stun = Vision()
|
vision_stun = Vision()
|
||||||
# odig_overlay = DiggingOverlay(config)
|
# odig_overlay = DiggingOverlay(config)
|
||||||
check_for_craft_button(capture_window2, vision_stun, capture_config)
|
check_for_craft_button(capture_window2, vision_stun)
|
||||||
|
check_for_craft_ok_button(capture_window2, vision_stun)
|
||||||
run_counter = run_counter + 1
|
run_counter = run_counter + 1
|
||||||
overlay.update_status_label(mode, run_target - run_counter)
|
overlay.update_status_label(mode, run_target - run_counter)
|
||||||
#check_for_ok_button(capture_window, vision_stun, capture_config)
|
#check_for_ok_button(capture_window, vision_stun, capture_config)
|
||||||
|
|||||||
@@ -35,8 +35,10 @@ def run():
|
|||||||
overlay.run_mode = 'init'
|
overlay.run_mode = 'init'
|
||||||
continue
|
continue
|
||||||
elif overlay.run_mode == 'started':
|
elif overlay.run_mode == 'started':
|
||||||
|
cv.waitKey(1000)
|
||||||
pass
|
pass
|
||||||
elif overlay.run_mode == 'init':
|
elif overlay.run_mode == 'init':
|
||||||
|
cv.waitKey(1)
|
||||||
continue
|
continue
|
||||||
elif overlay.run_mode == 'paused':
|
elif overlay.run_mode == 'paused':
|
||||||
continue
|
continue
|
||||||
|
|||||||
11
utils.py
11
utils.py
@@ -174,7 +174,7 @@ def check_for_ok_button(cap_win, vis, conf):
|
|||||||
for pointi in pointis:
|
for pointi in pointis:
|
||||||
dig_point(pointi[0] + offset_left, pointi[1] + offset_down, 150)
|
dig_point(pointi[0] + offset_left, pointi[1] + offset_down, 150)
|
||||||
|
|
||||||
def check_for_craft_button(cap_win, vis, conf):
|
def check_for_craft_button(cap_win, vis):
|
||||||
screenshot = cap_win.get_screenshot()
|
screenshot = cap_win.get_screenshot()
|
||||||
needle = cv.imread("play.jpg", cv.IMREAD_UNCHANGED)
|
needle = cv.imread("play.jpg", cv.IMREAD_UNCHANGED)
|
||||||
rectangles = vis.find(screenshot, needle, 0.7, 1)
|
rectangles = vis.find(screenshot, needle, 0.7, 1)
|
||||||
@@ -183,6 +183,15 @@ def check_for_craft_button(cap_win, vis, conf):
|
|||||||
for pointi in pointis:
|
for pointi in pointis:
|
||||||
dig_point(pointi[0], pointi[1], 150)
|
dig_point(pointi[0], pointi[1], 150)
|
||||||
|
|
||||||
|
def check_for_craft_ok_button(cap_win, vis):
|
||||||
|
screenshot = cap_win.get_screenshot()
|
||||||
|
rectangles = vis.find(screenshot, cv.imread("ok_button.jpg", cv.IMREAD_UNCHANGED), 0.5, 1)
|
||||||
|
offset_left = 0
|
||||||
|
offset_down = 0
|
||||||
|
if len(rectangles) == 1:
|
||||||
|
pointis = vis.get_click_points(rectangles)
|
||||||
|
for pointi in pointis:
|
||||||
|
dig_point(pointi[0] + offset_left, pointi[1] + offset_down, 150)
|
||||||
|
|
||||||
def get_click_point(rectangle):
|
def get_click_point(rectangle):
|
||||||
# Loop over all the rectangles
|
# Loop over all the rectangles
|
||||||
|
|||||||
Reference in New Issue
Block a user