Compare commits

...

3 Commits

Author SHA1 Message Date
5e78ed790b make screenshots 2022-12-26 21:39:58 +03:00
0ea5e2da0e return to map by level timeout 2022-12-26 21:23:27 +03:00
ac411136e9 up clicked speed 2022-12-26 21:11:29 +03:00
3 changed files with 48 additions and 14 deletions

View File

@ -1,13 +1,32 @@
from datetime import datetime
import shutil
__author__ = "Alexander Popov <iiiypuk@fastmail.fm>"
__version__ = "1.0.0"
__license__ = "Unlicense"
def runLevel():
"""Running level and farming applesю"""
def date_string(symbols=True):
"""Return current date."""
date_now = datetime.now()
if symbols:
date_str = date_now.strftime("%Y-%m-%d %H:%M:%S")
else:
date_str = date_now.strftime("%Y-%m-%d_%H_%M_%S")
return(date_str)
def make_screenshot():
"""..."""
image = capture(App.focusedWindow())
shutil.move(image, "{0}.png".format(date_string(False)))
def run_level():
"""Running level and farming apples"""
wait("images/farm_level_on_map.png", 10)
click("images/farm_level_on_map.png")
@ -15,6 +34,8 @@ def runLevel():
wait("images/level_title.png", 3)
click("images/level_start_button.png")
make_screenshot()
wait("images/equip_window.png", 3)
click("images/button_start.png")
@ -23,16 +44,31 @@ def runLevel():
Mouse.wheel(WHEEL_DOWN, 6)
for pillar in range(2):
click("images/pillar_fire.png")
pillar_heal = find("images/pillar_heal.png")
pillar_fire = find("images/pillar_fire.png")
for x in range(7):
click("images/pillar_heal.png")
for pillar in range(2):
pillar_fire.click("images/pillar_fire.png")
for x in range(6):
pillar_heal.click("images/pillar_heal.png")
click("images/pillar_go.png")
wait("images/winner_window.png", 60 * 3)
try:
wait("images/winner_window.png", 60 * 2)
click("images/level_complete.png")
except FindFailed as e:
print("[{0}] Level timeout. Return to Map".format(date_string()))
return_to_menu()
def return_to_menu():
"""Return to Map if an error has passed"""
click("images/menu_button.png")
click("images/menu_map_button.png")
def main():
@ -41,19 +77,17 @@ def main():
print("Battlepillars Farming Bot {0} by {1}".format(__version__, __author__))
run_count = 0
while True:
run_count += 1
date_now = datetime.now()
date_string = date_now.strftime("%Y-%m-%d %H:%M:%S")
print(
"[{date}] Running farm {times} times".format(
date=date_string, times=run_count
date=date_string(), times=run_count
)
)
runLevel()
run_level()
if __name__ == "__main__":

BIN
images/menu_button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 9.8 KiB

BIN
images/menu_map_button.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB