Neccor 4 years ago
parent
commit
dbf7838361
1 changed files with 98 additions and 39 deletions
  1. 98
    39
      main.py

+ 98
- 39
main.py View File

@@ -2,13 +2,14 @@ import cv2
2 2
 import time
3 3
 import pyautogui
4 4
 
5
-def findt(image):
5
+def find(image):
6 6
 	print(f"\n{image} |")
7 7
 	template = cv2.imread("assets/{}".format(image), 0)
8 8
 	width, height = template.shape[::-1]
9 9
 	pyautogui.screenshot("screenshot.png")
10 10
 	screen = cv2.imread("screenshot.png", 0)
11 11
 	width2, height2 = screen.shape[::-1]
12
+	print(f"Breite: {width} | Höhe: {height}\nBreite: {width2} | Höhe: {height2}")
12 13
 	match = cv2.matchTemplate(screen, template, cv2.TM_CCOEFF_NORMED)
13 14
 	value, location = cv2.minMaxLoc(match)[1], cv2.minMaxLoc(match)[3]
14 15
 	if (value >= 0.8):
@@ -19,51 +20,109 @@ def findt(image):
19 20
 while True:
20 21
 	# Start
21 22
 
22
-	# Assist Duel
23
-	Assist = find("assistduel.png")
24
-	pyautogui.click((Assist[0], Assist[1]))
25 23
 	time.sleep(3)
26 24
 
27
-	Rndclick = find("rndclick.png")
28
-	pyautogui.click((Rndclick[0], Rndclick[1]))
29
-	time.sleep(3)
25
+	try:
26
+		print(f"Start Duell")
27
+		# Assist Duel
28
+		Assist = find("assistduel.png")
29
+		if Assist == None:
30
+			pass
31
+		else:
32
+			test = pyautogui.click((Assist[0], Assist[1]))
33
+	except:
34
+		print(f"Start Duell nicht gefunden")
30 35
 
31
-	# Auto-Duel
32
-	autoduel = find("autoduel.png")
33
-	pyautogui.click((autoduel[0], autoduel[1]))
34
-	time.sleep(3)
36
+	try:
37
+		Rndclick = find("rndclick.png")
38
+		if Rndclick == None:
39
+			pass
40
+		else:
41
+			pyautogui.click((Rndclick[0], Rndclick[1]))
42
+	except:
43
+		print(f"Dialog nicht gefunden")
35 44
 
36
-	# Result
37
-	result = find("ok.png")
38
-	pyautogui.click((result[0], result[1]))
39
-	time.sleep(3)
45
+	try:
46
+		# Auto-Duel
47
+		autoduel = find("autoduel.png")
48
+		if autoduel == None:
49
+			pass
50
+		else:
51
+			pyautogui.click((autoduel[0], autoduel[1]))
52
+	except:
53
+		print(f"Auto-Duel nicht gefunden")
40 54
 
41
-	# Duel Result
42
-	duelresult = find("ok.png")
43
-	pyautogui.click((duelresult[0], duelresult[1]))
44
-	time.sleep(3)
55
+	try:
56
+		# Result
57
+		result = find("ok.png")
58
+		if result == None:
59
+			pass
60
+		else:
61
+			pyautogui.click((result[0], result[1]))
62
+	except:
63
+		print(f"Result nicht gefunden")
45 64
 
46
-	# Event Points Obtained
47
-	EPO = find("ok.png")
48
-	pyautogui.click((EPO[0], EPO[1]))
49
-	time.sleep(3)
65
+	try:
66
+		# Duel Result
67
+		duelresult = find("ok.png")
68
+		if duelresult == None:
69
+			pass
70
+		else:
71
+			pyautogui.click((duelresult[0], duelresult[1]))
72
+	except:
73
+		print(f"Duel Result nicht gefunden")
50 74
 
51
-	# Rescue Complete
52
-	RC = find("mark.png")
53
-	pyautogui.click((RC[0], RC[1]))
54
-	time.sleep(3)
55 75
 
56
-	# Assisting Players
57
-	AP = find("next.png")
58
-	pyautogui.click((AP[0], AP[1]))
59
-	time.sleep(3)
76
+	try:
77
+		# Event Points Obtained
78
+		EPO = find("ok.png")
79
+		if EPO == None:
80
+			pass
81
+		else:
82
+			pyautogui.click((EPO[0], EPO[1]))
83
+	except:
84
+		print(f"Event Points Obtained nicht gefunden")
85
+
86
+
87
+	try:
88
+		# Rescue Complete
89
+		RC = find("mark.png")
90
+		if RC == None:
91
+			pass
92
+		else:
93
+			pyautogui.click((RC[0], RC[1]))
94
+	except:
95
+		print(f"Rescue Complete nicht gefunden")
96
+
97
+
98
+	try:
99
+		# Assisting Players
100
+		AP = find("next.png")
101
+		if AP == None:
102
+			pass
103
+		else:
104
+			pyautogui.click((AP[0], AP[1]))
105
+	except:
106
+		print(f"Assisting Players nicht gefunden")
107
+
108
+
109
+	try:
110
+		# Treasure Boxes Obtained
111
+		TBO = find("ok.png")
112
+		if TBO == None:
113
+			pass
114
+		else:
115
+			pyautogui.click((TBO[0], TBO[1]))
116
+	except:
117
+		print(f"Treasure Boxes Obtained nicht gefunden")
60 118
 
61
-	# Treasure Boxes Obtained
62
-	TBO = find("ok.png")
63
-	pyautogui.click((TBO[0], TBO[1]))
64
-	time.sleep(3)
65 119
 
66
-	# Lootboxen
67
-	LB = find("next.png")
68
-	pyautogui.click((LB[0], LB[1]))
69
-	time.sleep(3)
120
+	try:
121
+		# Lootboxen
122
+		LB = find("next.png")
123
+		if LB == None:
124
+			pass
125
+		else:
126
+			pyautogui.click((LB[0], LB[1]))
127
+	except:
128
+		print(f"Lootboxen nicht gefunden")

Loading…
Cancel
Save