refactor dig
This commit is contained in:
@@ -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]
|
||||||
|
|||||||
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.returnDiggingWindowPos2()[2]
|
||||||
|
offset_down = conf.returnDiggingWindowPos2()[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