Selaa lähdekoodia

add dungeon bot

Richard Köhl 1 vuosi sitten
vanhempi
commit
baf54e5753

+ 42 - 0
dungeon.py

@@ -0,0 +1,42 @@
+import cv2
+import time
+from helper import (
+    tap,
+    look_for_templates,
+    find_template,
+    capture_current_screen,
+)
+
+# templates
+templates = {
+    "to_battle": cv2.imread("templates/dungeon/to_battle2.png"),
+    "attack": cv2.imread("templates/dungeon/attack.png"),
+    "water": cv2.imread("templates/dungeon/water.png"),
+    "mixed": cv2.imread("templates/dungeon/mixed.png"),
+    "earth": cv2.imread("templates/dungeon/earth.png"),
+    "auto_battle": cv2.imread("templates/dungeon/auto_battle.png"),
+    "ok": cv2.imread("templates/dungeon/ok.png"),
+    "lock": cv2.imread("templates/dungeon/lock.png"),
+    "collect": cv2.imread("templates/dungeon/collect.png"),
+}
+
+print("watching the screen...")
+while True:
+    time.sleep(0.5)  # Polling interval
+    capture_current_screen()
+
+    name, locations = look_for_templates(templates)
+    if name is not None:
+        if name in ["to_battle", "auto_battle", "ok", "lock", "collect"]:
+            tap(*locations[0])
+            if name in ["auto_battle"]:
+                time.sleep(0.5)
+        if name == "attack" and len(locations) == 1:
+            tap(*locations[0])
+        if name == "attack" and len(locations) == 2:
+            element = find_template(templates["mixed"])
+            if len(element) == 0:
+                element = find_template(templates["water"])
+                if len(element) == 0:
+                    element = find_template(templates["earth"])
+            tap(element[0][0], locations[0][1])

BIN
templates/dungeon/attack.png


BIN
templates/dungeon/auto_battle.png


BIN
templates/dungeon/collect.png


BIN
templates/dungeon/earth.png


BIN
templates/dungeon/lock.png


BIN
templates/dungeon/mixed.png


BIN
templates/dungeon/ok.png


BIN
templates/dungeon/to_battle2.png


BIN
templates/dungeon/water.png