dig failed added opencv
BIN
dig/Brown0.jpg
Normal file
|
After Width: | Height: | Size: 1.2 KiB |
BIN
dig/D1.jpg
Normal file
|
After Width: | Height: | Size: 1.6 KiB |
BIN
dig/D2.jpg
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
dig/D3.jpg
Normal file
|
After Width: | Height: | Size: 1.5 KiB |
BIN
dig/D4.jpg
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
dig/D5.jpg
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
BIN
dig/D6.jpg
Normal file
|
After Width: | Height: | Size: 1.9 KiB |
BIN
dig/D7.jpg
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
BIN
dig/H1.jpg
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
BIN
dig/H2.jpg
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
dig/H3.jpg
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
BIN
dig/H4.jpg
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
BIN
dig/digging.jpg
Normal file
|
After Width: | Height: | Size: 1.8 MiB |
BIN
dig/digging2.jpg
Normal file
|
After Width: | Height: | Size: 1.2 MiB |
BIN
dig/digging3.jpg
Normal file
|
After Width: | Height: | Size: 770 KiB |
BIN
dig/digging4.jpg
Normal file
|
After Width: | Height: | Size: 1.8 MiB |
BIN
dig/down.jpg
Normal file
|
After Width: | Height: | Size: 91 KiB |
BIN
dig/left.jpg
Normal file
|
After Width: | Height: | Size: 54 KiB |
BIN
dig/ok_button.jpg
Normal file
|
After Width: | Height: | Size: 12 KiB |
BIN
dig/right.jpg
Normal file
|
After Width: | Height: | Size: 133 KiB |
BIN
dig/test1.jpg
Normal file
|
After Width: | Height: | Size: 47 KiB |
BIN
dig/up.jpg
Normal file
|
After Width: | Height: | Size: 93 KiB |
BIN
dig/wtf.jpg
Normal file
|
After Width: | Height: | Size: 1.4 KiB |
@@ -1,5 +1,6 @@
|
||||
from config_file import UserConfigs
|
||||
import keyboard
|
||||
import cv2 as cv
|
||||
from utils import dig_point, check_for_ok_button
|
||||
from window_capture import WindowCapture
|
||||
from vision import Vision
|
||||
@@ -12,6 +13,8 @@ def run():
|
||||
# initialize the StunWindowCapture class
|
||||
capture_config = UserConfigs()
|
||||
capture_window = WindowCapture(None, "screen_conf", capture_config)
|
||||
|
||||
|
||||
# initialize the StunVision class
|
||||
vision_stun = Vision()
|
||||
dig_overlay = DiggingOverlay(config)
|
||||
@@ -22,7 +25,7 @@ def run():
|
||||
width = 32
|
||||
depth = 24
|
||||
plot_size = 45
|
||||
DIG_TIME = 150
|
||||
DIG_TIME = 100
|
||||
|
||||
while True:
|
||||
if keyboard.is_pressed('p') == True:
|
||||
@@ -38,11 +41,15 @@ def run():
|
||||
continue
|
||||
dig_overlay.hide_window()
|
||||
|
||||
if level == 21:
|
||||
if level >= 40:
|
||||
break
|
||||
if level == 23:
|
||||
DIG_TIME = 850
|
||||
if level == 24:
|
||||
if level == 27:
|
||||
DIG_TIME = 1850
|
||||
if level % 2 == 0:
|
||||
if level <= 10:
|
||||
plot_size = plot_size - 1
|
||||
elif level % 2 == 0:
|
||||
plot_size = plot_size - 1
|
||||
|
||||
p1 = int((config.returnDiggingWindowPos2()[0] / 2) + config.returnDiggingWindowPos2()[2])
|
||||
@@ -64,11 +71,38 @@ def run():
|
||||
for f in range(0, e, 1):
|
||||
# up click
|
||||
tp2 = tp2 - plot_size
|
||||
if tp2 >= config.returnDiggingWindowPos2()[1] + plot_size:
|
||||
if tp2 >= config.returnDiggingWindowPos2()[1] + (plot_size / 2):
|
||||
continue
|
||||
if tp2 <= config.returnDiggingWindowPos2()[3] + plot_size:
|
||||
if tp2 <= config.returnDiggingWindowPos2()[3] + (plot_size / 2):
|
||||
continue
|
||||
'''
|
||||
x = int(tp1 - (plot_size / 2))
|
||||
y = int(tp2 - ((e * plot_size) - (plot_size / 2)))
|
||||
w = plot_size
|
||||
h = plot_size * e
|
||||
|
||||
capture_win_lanes = WindowCapture(None, "lanes", None, (w, h, x+w, y+h))
|
||||
screenshot = capture_win_lanes.get_screenshot()
|
||||
needlew = cv.imread("test1.jpg", cv.IMREAD_UNCHANGED)
|
||||
res = vision_stun.find(needlew, screenshot, 0.9, 1)
|
||||
if len(res) >= 1:
|
||||
break
|
||||
#vision_stun.draw_rectangles(needlew, res)
|
||||
#cv.imshow("screenshot", needlew)
|
||||
#cv.waitKey(150)
|
||||
|
||||
|
||||
# ul[0], ul[1], plot_size, plotsize*e
|
||||
|
||||
# ll -> tp1 - plot/2 ooooooooooo
|
||||
# -> tp2 + plot/2
|
||||
# ul -> tp1 - plot/2
|
||||
# -> tp2 - e*plot - plot/2
|
||||
# lr -> tp1 + plot/2
|
||||
# -> tp2 - plot/2
|
||||
# ur -> tp1 + plot/2
|
||||
# -> tp2 - e*plot - plot/2
|
||||
'''
|
||||
dig_point(tp1, tp2, DIG_TIME)
|
||||
# cv.circle(screenshot, (tp1, tp2), 7, (255, 0, 255), -1)
|
||||
# cv.imshow("screenshot", screenshot)
|
||||
@@ -83,8 +117,18 @@ def run():
|
||||
for g in range(0, e, 1):
|
||||
# right click
|
||||
tp1 = tp1 + plot_size
|
||||
if tp2 <= config.returnDiggingWindowPos2()[3] + plot_size:
|
||||
if tp2 <= config.returnDiggingWindowPos2()[3] + (plot_size / 2):
|
||||
continue
|
||||
|
||||
# ll -> tp1 - plot/2
|
||||
# -> tp2 + plot/2
|
||||
# ul -> tp1 - plot/2
|
||||
# -> tp2 - plot/2
|
||||
# lr -> tp1 + e*plot + plot/2
|
||||
# -> tp2 + plot/2
|
||||
# ur -> tp1 + e*plot + plot/2
|
||||
# -> tp2 - plot/2
|
||||
|
||||
dig_point(tp1, tp2, DIG_TIME)
|
||||
# cv.circle(screenshot, (tp1, tp2), 7, (127, 0, 255), -1)
|
||||
# cv.imshow("screenshot", screenshot)
|
||||
@@ -117,7 +161,7 @@ def run():
|
||||
for u in range(0, e, 1):
|
||||
# left click
|
||||
tp1 = tp1 - plot_size
|
||||
if tp2 >= config.returnDiggingWindowPos2()[1] + plot_size:
|
||||
if tp2 >= config.returnDiggingWindowPos2()[1] + (plot_size / 2):
|
||||
continue
|
||||
dig_point(tp1, tp2, DIG_TIME)
|
||||
# cv.circle(screenshot, (tp1, tp2), 7, (0, 0, 255), -1)
|
||||
|
||||
1
utils.py
@@ -156,6 +156,7 @@ def update_screenshot_with_short_pic_list(short_pic_lst, lst_bl_items):
|
||||
|
||||
def dig_point(point1, point2, dig_time):
|
||||
pydirectinput.moveTo(point1, point2)
|
||||
cv.waitKey(50)
|
||||
pydirectinput.mouseDown()
|
||||
w = random.randint(1, 50)
|
||||
cv.waitKey(dig_time + w)
|
||||
|
||||
@@ -17,7 +17,7 @@ class WindowCapture:
|
||||
offset_y = 0
|
||||
|
||||
# constructor
|
||||
def __init__(self, window_name, area, config):
|
||||
def __init__(self, window_name, area, config, coords = 0):
|
||||
# find the handle for the window we want to capture.
|
||||
# if no window name is given, capture the entire screen
|
||||
if window_name is None:
|
||||
@@ -37,6 +37,8 @@ class WindowCapture:
|
||||
val = config.returnEquipmentWindowPos()
|
||||
elif area == "screen_conf":
|
||||
val = config.returnOKWindowPos()
|
||||
elif area == "lanes":
|
||||
val = coords
|
||||
else:
|
||||
val = config.returnFullScreenWindowPos()
|
||||
|
||||
|
||||