Browse Source

reboot function

Neccor 4 years ago
parent
commit
ae80342cfb
4 changed files with 51 additions and 4 deletions
  1. BIN
      assets/Initiatelink.png
  2. BIN
      assets/arrow.png
  3. BIN
      assets/reboot.png
  4. 51
    4
      main.py

BIN
assets/Initiatelink.png View File


BIN
assets/arrow.png View File


BIN
assets/reboot.png View File


+ 51
- 4
main.py View File

@@ -1,15 +1,16 @@
1 1
 import cv2
2 2
 import time
3 3
 import pyautogui
4
+import subprocess
4 5
 
5 6
 def find(image):
6
-	print(f"\n{image} |")
7
+	#print(f"\n{image} |")
7 8
 	template = cv2.imread("assets/{}".format(image), 0)
8 9
 	width, height = template.shape[::-1]
9 10
 	pyautogui.screenshot("screenshot.png")
10 11
 	screen = cv2.imread("screenshot.png", 0)
11 12
 	width2, height2 = screen.shape[::-1]
12
-	print(f"Breite: {width} | Höhe: {height}\nBreite: {width2} | Höhe: {height2}")
13
+	#print(f"Breite: {width} | Höhe: {height}\nBreite: {width2} | Höhe: {height2}")
13 14
 	match = cv2.matchTemplate(screen, template, cv2.TM_CCOEFF_NORMED)
14 15
 	value, location = cv2.minMaxLoc(match)[1], cv2.minMaxLoc(match)[3]
15 16
 	if (value >= 0.8):
@@ -17,6 +18,41 @@ def find(image):
17 18
 	else:
18 19
 		return None
19 20
 
21
+#  Event Start 950 260
22
+
23
+def startgame():
24
+	try:
25
+		subprocess.run("C:\\Program Files (x86)\\Steam\\steamapps\\common\\Yu-Gi-Oh! Duel Links")
26
+	except Exception as e:
27
+		raise e
28
+	restart() # Starts the Event 
29
+
30
+
31
+
32
+def restart():
33
+	# Reboot function
34
+	initiate = None
35
+
36
+	while initiate == None:
37
+		time.sleep(1)
38
+		try:
39
+			initiate = find("Initiatelink.png")
40
+		else:
41
+			pass
42
+	pyautogui.click((initiate[0], initiate[1]))
43
+
44
+	notifications = None
45
+
46
+	while notifications == None:
47
+		time.sleep(1)
48
+		try:
49
+			notifications = find("arrow.png")
50
+		except:
51
+			pass
52
+	pyautogui.click((notifications[0], notifications[1]))
53
+
54
+	# Click Event
55
+	pyautogui.click(950, 250)
20 56
 
21 57
 
22 58
 while True:
@@ -30,7 +66,8 @@ while True:
30 66
 		if turbo == None:
31 67
 			pass
32 68
 		else:
33
-			pyautogui.scroll(500, 850, 650)
69
+			pyautogui.click(950, 700)
70
+			pyautogui.scroll(-200, pause=1)
34 71
 			# pyautogui.click((turbo[0], turbo[1]))
35 72
 
36 73
 		Assist = find("assistduel.png")
@@ -145,4 +182,14 @@ while True:
145 182
 		else:
146 183
 			pyautogui.click((LB[0], LB[1]))
147 184
 	except:
148
-		print(f"Lootboxen nicht gefunden")
185
+		print(f"Lootboxen nicht gefunden")
186
+
187
+	try:
188
+		# Reboot
189
+		RB = find("reboot.png")
190
+		if RB == None:
191
+			pass
192
+		else:
193
+			restart()
194
+	except:
195
+		print(f"Reboot nicht gefunden")

Loading…
Cancel
Save