Neccor 4 years ago
commit
f9b72d2dfd
7 changed files with 103 additions and 0 deletions
  1. 2
    0
      README.md
  2. BIN
      assets/continue.png
  3. BIN
      assets/ok.png
  4. BIN
      assets/options.png
  5. BIN
      assets/ready.png
  6. BIN
      assets/surrender.png
  7. 101
    0
      main.py

+ 2
- 0
README.md View File

@@ -0,0 +1,2 @@
1
+# LoR_Bot
2
+

BIN
assets/continue.png View File


BIN
assets/ok.png View File


BIN
assets/options.png View File


BIN
assets/ready.png View File


BIN
assets/surrender.png View File


+ 101
- 0
main.py View File

@@ -0,0 +1,101 @@
1
+import cv2
2
+import time
3
+import pyautogui
4
+from datetime import datetime, date
5
+
6
+
7
+def find_image(image, coef=None):
8
+	print(f"\n[find_image] {image}")
9
+	template = cv2.imread("assets/{}".format(image), 0)
10
+	width, height = template.shape[::-1]
11
+	screen = cv2.imread("screenshot.png", 0)
12
+	width2, height2 = screen.shape[::-1]
13
+	match = cv2.matchTemplate(screen, template, cv2.TM_CCOEFF_NORMED)
14
+	value, location = cv2.minMaxLoc(match)[1], cv2.minMaxLoc(match)[3]
15
+	print(f"Value for {image}: {value}")
16
+	if (value >= 0.8):
17
+		return (location[0], location[1], width, height, value)
18
+	else:
19
+		print("Error while searching for image")
20
+		return None
21
+
22
+def loop():
23
+	while True:
24
+		time.sleep(1)
25
+		pyautogui.screenshot("screenshot.png")
26
+
27
+		v_options = False
28
+		v_surrender = False
29
+		v_ok = False
30
+		v_continue = False
31
+		v_ready = False
32
+
33
+		# Options
34
+
35
+		while v_options == False:
36
+			time.sleep(3)
37
+			pyautogui.screenshot("screenshot.png")
38
+			options = find_image("options.png")
39
+			if options != None:
40
+				v_options = True
41
+				pyautogui.click((options[0], options[1]))
42
+			else:
43
+				print(f"Zahnräder nicht gefunden")
44
+				time.sleep(3)
45
+
46
+		# Surrender
47
+
48
+		while v_surrender == False:
49
+			time.sleep(3)
50
+			pyautogui.screenshot("screenshot.png")
51
+			surrender = find_image("surrender.png")
52
+			if surrender != None:
53
+				v_surrender = True
54
+				pyautogui.click((surrender[0], surrender[1]))
55
+			else:
56
+				print(f"Surrender nicht gefunden")
57
+				time.sleep(3)
58
+
59
+		# OK
60
+
61
+		while v_ok == False:
62
+			time.sleep(3)
63
+			pyautogui.screenshot("screenshot.png")
64
+			ok = find_image("ok.png")
65
+			if ok != None:
66
+				v_ok = True
67
+				pyautogui.click((ok[0], ok[1]))
68
+			else:
69
+				print(f"OK nicht gefunden")
70
+				time.sleep(3)
71
+
72
+		# Continue
73
+
74
+		while v_continue == False:
75
+			time.sleep(3)
76
+			pyautogui.screenshot("screenshot.png")
77
+			f_continue = find_image("continue.png")
78
+			if f_continue != None:
79
+				v_continue = True
80
+				pyautogui.click((f_continue[0], f_continue[1]))
81
+			else:
82
+				print(f"Continue nicht gefunden")
83
+				time.sleep(3)
84
+
85
+		# Ready
86
+
87
+		while v_ready == False:
88
+			time.sleep(3)
89
+			pyautogui.screenshot("screenshot.png")
90
+			ready = find_image("ready.png")
91
+			if ready != None:
92
+				v_ready = True
93
+				pyautogui.click((ready[0], ready[1]))
94
+			else:
95
+				print(f"Ready nicht gefunden")
96
+				time.sleep(3)
97
+
98
+		print(f"\n\n Loop complete restarting \n\n")
99
+
100
+while True:
101
+	loop()

Loading…
Cancel
Save