Compare commits
No commits in common. "5e78ed790bd4a6aa9a2af8ca9aa7df2971e0a7c1" and "630a0c7835ba3938d7f1564528def5dbdae34f96" have entirely different histories.
5e78ed790b
...
630a0c7835
@ -1,32 +1,13 @@
|
||||
from datetime import datetime
|
||||
import shutil
|
||||
|
||||
|
||||
__author__ = "Alexander Popov <iiiypuk@fastmail.fm>"
|
||||
__version__ = "1.0.0"
|
||||
__license__ = "Unlicense"
|
||||
|
||||
|
||||
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"""
|
||||
def runLevel():
|
||||
"""Running level and farming applesю"""
|
||||
|
||||
wait("images/farm_level_on_map.png", 10)
|
||||
click("images/farm_level_on_map.png")
|
||||
@ -34,8 +15,6 @@ def run_level():
|
||||
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")
|
||||
|
||||
@ -44,31 +23,16 @@ def run_level():
|
||||
|
||||
Mouse.wheel(WHEEL_DOWN, 6)
|
||||
|
||||
pillar_heal = find("images/pillar_heal.png")
|
||||
pillar_fire = find("images/pillar_fire.png")
|
||||
|
||||
for pillar in range(2):
|
||||
pillar_fire.click("images/pillar_fire.png")
|
||||
click("images/pillar_fire.png")
|
||||
|
||||
for x in range(6):
|
||||
pillar_heal.click("images/pillar_heal.png")
|
||||
for x in range(7):
|
||||
click("images/pillar_heal.png")
|
||||
|
||||
click("images/pillar_go.png")
|
||||
|
||||
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")
|
||||
wait("images/winner_window.png", 60 * 3)
|
||||
click("images/level_complete.png")
|
||||
|
||||
|
||||
def main():
|
||||
@ -77,17 +41,19 @@ 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
|
||||
)
|
||||
)
|
||||
|
||||
run_level()
|
||||
runLevel()
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
|
Binary file not shown.
Before Width: | Height: | Size: 9.8 KiB |
Binary file not shown.
Before Width: | Height: | Size: 30 KiB |
Loading…
Reference in New Issue
Block a user