Compare commits
3 Commits
3318d309fc
...
dddfa60c77
| Author | SHA1 | Date | |
|---|---|---|---|
| dddfa60c77 | |||
| 62dc818be1 | |||
| f9455ade48 |
@@ -17,7 +17,17 @@ class UserConfigs:
|
|||||||
elif user_from_env == self.EDDIEUSER:
|
elif user_from_env == self.EDDIEUSER:
|
||||||
self.user = self.EDDIEUSER
|
self.user = self.EDDIEUSER
|
||||||
else:
|
else:
|
||||||
self.user = self.ADWAUSER
|
self.user = self.THALOUSER
|
||||||
|
|
||||||
|
def returnOKWindowPos(self):
|
||||||
|
if self.user == self.THALOUSER:
|
||||||
|
return [310, 200, 1120, 920]
|
||||||
|
elif self.user == self.ADWAUSER:
|
||||||
|
return [740, 450, 1625, 985]
|
||||||
|
elif self.user == self.EDDIEUSER:
|
||||||
|
return [740, 450, 1625, 985]
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
def returnMagicWindowPos(self):
|
def returnMagicWindowPos(self):
|
||||||
if self.user == self.THALOUSER:
|
if self.user == self.THALOUSER:
|
||||||
@@ -49,6 +59,16 @@ class UserConfigs:
|
|||||||
else:
|
else:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def returnDiggingWindowPos2(self):
|
||||||
|
if self.user == self.THALOUSER:
|
||||||
|
return [1440, 1150, 570, 22]
|
||||||
|
elif self.user == self.ADWAUSER:
|
||||||
|
return [740, 450, 1625, 985]
|
||||||
|
elif self.user == self.EDDIEUSER:
|
||||||
|
return [740, 450, 1625, 985]
|
||||||
|
else:
|
||||||
|
pass
|
||||||
|
|
||||||
def returnEquipmentWindowPos(self):
|
def returnEquipmentWindowPos(self):
|
||||||
if self.user == self.THALOUSER:
|
if self.user == self.THALOUSER:
|
||||||
return [1800, 1150, 0, 0]
|
return [1800, 1150, 0, 0]
|
||||||
|
|||||||
139
digging_main2.py
Normal file
139
digging_main2.py
Normal file
@@ -0,0 +1,139 @@
|
|||||||
|
from config_file import UserConfigs
|
||||||
|
import keyboard
|
||||||
|
from utils import dig_point, check_for_ok_button
|
||||||
|
from window_capture import WindowCapture
|
||||||
|
from vision import Vision
|
||||||
|
|
||||||
|
def run():
|
||||||
|
# initialize the user-class
|
||||||
|
config = UserConfigs()
|
||||||
|
# initialize the StunWindowCapture class
|
||||||
|
capture_config = UserConfigs()
|
||||||
|
capture_window = WindowCapture(None, "screen_conf", capture_config)
|
||||||
|
# initialize the StunVision class
|
||||||
|
vision_stun = Vision()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
pause = True
|
||||||
|
level = 1
|
||||||
|
|
||||||
|
width = 32
|
||||||
|
depth = 24
|
||||||
|
plot_size = 47
|
||||||
|
DIG_TIME = 150
|
||||||
|
|
||||||
|
while True:
|
||||||
|
if keyboard.is_pressed('p') == True:
|
||||||
|
pause = True
|
||||||
|
print('q pressed')
|
||||||
|
elif keyboard.is_pressed('o') == True:
|
||||||
|
pause = False
|
||||||
|
print('o pressed')
|
||||||
|
if pause:
|
||||||
|
# cv.waitKey(500)
|
||||||
|
print("pausing")
|
||||||
|
continue
|
||||||
|
|
||||||
|
if level == 3:
|
||||||
|
width = 30
|
||||||
|
if level == 17:
|
||||||
|
DIG_TIME = 1850
|
||||||
|
|
||||||
|
plot_size = plot_size - level
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
p1 = int((config.returnDiggingWindowPos2()[0] / 2) + config.returnDiggingWindowPos2()[2])
|
||||||
|
p2 = int((config.returnDiggingWindowPos2()[1] / 2) + config.returnDiggingWindowPos2()[3])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# start 705 , 564 -> click
|
||||||
|
# move L D -> click
|
||||||
|
# move U , U , R, R , D , D , L , L
|
||||||
|
# move L D
|
||||||
|
# move U , U , U , U , R, R , R, R, D, D, D, D, L, L, L , L
|
||||||
|
dig_point(p1, p2, DIG_TIME)
|
||||||
|
#cv.circle(screenshot, (p1, p2), 7, (0, 255, 0), -1)
|
||||||
|
i = 0
|
||||||
|
for e in range(2, width, 2):
|
||||||
|
i = i + 1
|
||||||
|
|
||||||
|
tp1 = p1 - (i * plot_size)
|
||||||
|
tp2 = p2 + (i * plot_size)
|
||||||
|
for f in range(0, e, 1):
|
||||||
|
# up click
|
||||||
|
tp2 = tp2 - plot_size
|
||||||
|
if tp2 >= config.returnDiggingWindowPos2()[1] + plot_size:
|
||||||
|
continue
|
||||||
|
if tp2 <= config.returnDiggingWindowPos2()[3] + plot_size:
|
||||||
|
continue
|
||||||
|
|
||||||
|
dig_point(tp1, tp2, DIG_TIME)
|
||||||
|
#cv.circle(screenshot, (tp1, tp2), 7, (255, 0, 255), -1)
|
||||||
|
#cv.imshow("screenshot", screenshot)
|
||||||
|
#cv.waitKey(150)
|
||||||
|
check_for_ok_button(capture_window, vision_stun, capture_config)
|
||||||
|
if keyboard.is_pressed('p') == True or pause == True:
|
||||||
|
pause = True
|
||||||
|
break
|
||||||
|
|
||||||
|
tp1 = p1 - (i * plot_size)
|
||||||
|
tp2 = p2 - (i * plot_size)
|
||||||
|
for g in range(0, e, 1):
|
||||||
|
# right click
|
||||||
|
tp1 = tp1 + plot_size
|
||||||
|
if tp2 <= config.returnDiggingWindowPos2()[3] + plot_size:
|
||||||
|
continue
|
||||||
|
dig_point(tp1, tp2, DIG_TIME)
|
||||||
|
#cv.circle(screenshot, (tp1, tp2), 7, (127, 0, 255), -1)
|
||||||
|
#cv.imshow("screenshot", screenshot)
|
||||||
|
#cv.waitKey(150)
|
||||||
|
check_for_ok_button(capture_window, vision_stun, capture_config)
|
||||||
|
if keyboard.is_pressed('p') == True or pause == True:
|
||||||
|
pause = True
|
||||||
|
break
|
||||||
|
|
||||||
|
tp1 = p1 + (i * plot_size)
|
||||||
|
tp2 = p2 - (i * plot_size)
|
||||||
|
for r in range(0, e, 1):
|
||||||
|
# down click
|
||||||
|
tp2 = tp2 + plot_size
|
||||||
|
if tp2 >= config.returnDiggingWindowPos2()[1] + plot_size:
|
||||||
|
continue
|
||||||
|
if tp2 <= config.returnDiggingWindowPos2()[3] + plot_size:
|
||||||
|
continue
|
||||||
|
dig_point(tp1, tp2, DIG_TIME)
|
||||||
|
#cv.circle(screenshot, (tp1, tp2), 7, (255, 0, 127), -1)
|
||||||
|
#cv.imshow("screenshot", screenshot)
|
||||||
|
#cv.waitKey(150)
|
||||||
|
check_for_ok_button(capture_window, vision_stun, capture_config)
|
||||||
|
if keyboard.is_pressed('p') == True or pause == True:
|
||||||
|
pause = True
|
||||||
|
break
|
||||||
|
|
||||||
|
tp1 = p1 + (i * plot_size)
|
||||||
|
tp2 = p2 + (i * plot_size)
|
||||||
|
for u in range(0, e, 1):
|
||||||
|
# left click
|
||||||
|
tp1 = tp1 - plot_size
|
||||||
|
if tp2 >= config.returnDiggingWindowPos2()[1] + plot_size:
|
||||||
|
continue
|
||||||
|
dig_point(tp1, tp2, DIG_TIME)
|
||||||
|
#cv.circle(screenshot, (tp1, tp2), 7, (0, 0, 255), -1)
|
||||||
|
#cv.imshow("screenshot", screenshot)
|
||||||
|
#cv.waitKey(150)
|
||||||
|
check_for_ok_button(capture_window, vision_stun, capture_config)
|
||||||
|
if keyboard.is_pressed('p') == True or pause == True:
|
||||||
|
pause = True
|
||||||
|
break
|
||||||
|
if keyboard.is_pressed('p') == True or pause == True:
|
||||||
|
pause = True
|
||||||
|
break
|
||||||
|
if keyboard.is_pressed('p') == True or pause == True:
|
||||||
|
pause = True
|
||||||
|
break
|
||||||
|
level = level +1
|
||||||
|
if __name__ == "__main__":
|
||||||
|
run()
|
||||||
29
utils.py
29
utils.py
@@ -2,6 +2,16 @@ import numpy as np
|
|||||||
import os
|
import os
|
||||||
import cv2 as cv
|
import cv2 as cv
|
||||||
from PIL import Image
|
from PIL import Image
|
||||||
|
import pydirectinput
|
||||||
|
import random
|
||||||
|
import random
|
||||||
|
from time import time
|
||||||
|
|
||||||
|
import cv2 as cv
|
||||||
|
|
||||||
|
import pydirectinput
|
||||||
|
import keyboard
|
||||||
|
from tresh_util import super_tresh_main, super_tresh_needle
|
||||||
|
|
||||||
|
|
||||||
def mse(imageA, imageB):
|
def mse(imageA, imageB):
|
||||||
@@ -144,3 +154,22 @@ def update_screenshot_with_short_pic_list(short_pic_lst, lst_bl_items):
|
|||||||
# save_line_item_npy_jpg(r_short_pic_lst)
|
# save_line_item_npy_jpg(r_short_pic_lst)
|
||||||
|
|
||||||
return screenshot
|
return screenshot
|
||||||
|
|
||||||
|
|
||||||
|
def dig_point(point1, point2, dig_time):
|
||||||
|
pydirectinput.moveTo(point1, point2)
|
||||||
|
pydirectinput.mouseDown()
|
||||||
|
w = random.randint(1, 50)
|
||||||
|
cv.waitKey(dig_time + w)
|
||||||
|
pydirectinput.mouseUp()
|
||||||
|
|
||||||
|
|
||||||
|
def check_for_ok_button(cap_win, vis, conf):
|
||||||
|
screenshot = cap_win.get_screenshot()
|
||||||
|
rectangles = vis.find(screenshot, cv.imread("dig/ok_button.jpg", cv.IMREAD_UNCHANGED), 0.5, 1)
|
||||||
|
offset_left = conf.returnOKWindowPos()[2]
|
||||||
|
offset_down = conf.returnOKWindowPos()[3]
|
||||||
|
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)
|
||||||
|
|||||||
@@ -31,8 +31,12 @@ class WindowCapture:
|
|||||||
val = config.returnDiggingWindowPos()
|
val = config.returnDiggingWindowPos()
|
||||||
elif area == "magic":
|
elif area == "magic":
|
||||||
val = config.returnMagicWindowPos()
|
val = config.returnMagicWindowPos()
|
||||||
|
elif area == "dig2":
|
||||||
|
val = config.returnDiggingWindowPos2()
|
||||||
elif area == "equip":
|
elif area == "equip":
|
||||||
val = config.returnEquipmentWindowPos()
|
val = config.returnEquipmentWindowPos()
|
||||||
|
elif area == "screen_conf":
|
||||||
|
val = config.returnOKWindowPos()
|
||||||
else:
|
else:
|
||||||
val = config.returnFullScreenWindowPos()
|
val = config.returnFullScreenWindowPos()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user