|
|
@@ -2,7 +2,7 @@ import cv2
|
|
|
import time
|
|
|
import numpy as np
|
|
|
from helper import (
|
|
|
- tap,
|
|
|
+ tap as tap_helper,
|
|
|
look_for_templates,
|
|
|
first_template,
|
|
|
capture_current_screen,
|
|
|
@@ -62,6 +62,22 @@ def read_screen():
|
|
|
return cv2.imdecode(image_data, cv2.IMREAD_COLOR)
|
|
|
|
|
|
|
|
|
+def tap(name, x, y=None):
|
|
|
+ sleep = 0.5
|
|
|
+ if name in ["ok"]:
|
|
|
+ sleep = 2
|
|
|
+ elif name in ["collect"]:
|
|
|
+ sleep = 5
|
|
|
+ elif name in ["lock"]:
|
|
|
+ sleep = 2
|
|
|
+ elif name in ["remove angus", "remove moloch"]:
|
|
|
+ sleep = 1
|
|
|
+
|
|
|
+ text = f"- {name} ({sleep})"
|
|
|
+ tap_helper(x, y, text)
|
|
|
+ time.sleep(sleep)
|
|
|
+
|
|
|
+
|
|
|
print("watching the screen...")
|
|
|
is_mixed = False
|
|
|
while True:
|
|
|
@@ -71,7 +87,7 @@ while True:
|
|
|
name, locations = look_for_templates(templates)
|
|
|
if name is not None:
|
|
|
if name in ["to_battle", "ok", "lock", "collect"]:
|
|
|
- tap(*locations[0])
|
|
|
+ tap(name, *locations[0])
|
|
|
continue
|
|
|
if name in ["auto_battle"]:
|
|
|
dead = first_template(tpl_dead)
|
|
|
@@ -83,9 +99,8 @@ while True:
|
|
|
if moloch and moloch[1] < 1000 and low_health(moloch, "moloch"):
|
|
|
angus = first_template(tpl_angus2)
|
|
|
if angus:
|
|
|
- tap(angus)
|
|
|
- time.sleep(0.5)
|
|
|
- tap(angus[0] + 500, angus[1])
|
|
|
+ tap("remove angus", angus)
|
|
|
+ tap("add moloch", angus[0] + 500, angus[1])
|
|
|
else:
|
|
|
print(
|
|
|
"######### seems like angus is dead already. stopping"
|
|
|
@@ -96,21 +111,20 @@ while True:
|
|
|
if angus and angus[1] < 1000 and low_health(angus, "angus"):
|
|
|
moloch = first_template(tpl_moloch2)
|
|
|
if moloch:
|
|
|
- tap(moloch)
|
|
|
- time.sleep(0.5)
|
|
|
- tap(moloch[0] - 500, moloch[1])
|
|
|
+ tap("remove moloch", moloch)
|
|
|
+ tap("add angus", moloch[0] - 500, moloch[1])
|
|
|
else:
|
|
|
print(
|
|
|
"######### seems like moloch is dead already. stopping"
|
|
|
)
|
|
|
break
|
|
|
- tap(*locations[0])
|
|
|
+ tap(name, *locations[0])
|
|
|
continue
|
|
|
if name == "attack":
|
|
|
if len(locations) == 1:
|
|
|
element = first_template(tpl_mixed)
|
|
|
is_mixed = element is not None
|
|
|
- tap(*locations[0])
|
|
|
+ tap(name, *locations[0])
|
|
|
continue
|
|
|
|
|
|
if len(locations) == 2:
|
|
|
@@ -123,7 +137,7 @@ while True:
|
|
|
if element is None:
|
|
|
element = first_template(tpl_earth)
|
|
|
|
|
|
- tap(element[0], locations[0][1])
|
|
|
+ tap(name, element[0], locations[0][1])
|
|
|
continue
|
|
|
print("...")
|
|
|
except Exception as e:
|