-
Notifications
You must be signed in to change notification settings - Fork 1
/
run.py
37 lines (27 loc) · 1.22 KB
/
run.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import logging
import subprocess
import time
from internals.bot import Bot
from managers.process_memory_manager import Process
def main():
logging.basicConfig(format='[%(asctime)s.%(msecs)03d] %(message)s', datefmt='%d-%m-%Y %H:%M:%S', level=logging.INFO)
while True:
try:
Bot().start()
except Exception as e:
logging.debug("Ignoring exception:", exc_info=True)
# if game/Steam crashes, or the character is stuck in throwing animation, or Trove isn't found
logging.error(str(e))
logging.warning("Killing Trove and Steam in 5 seconds...")
time.sleep(5.0)
Process.kill_by_name(['Trove.exe', 'GlyphClientApp.exe', 'GlyphCrashHandler64.exe',
'steam.exe', 'SteamService.exe', 'steamwebhelper.exe'])
logging.warning("Re-launching... I will wait 60 seconds for the game to launch.")
# "Auto Launch Game On Start" needs to be enabled in order for this to work.
subprocess.run("start steam://run/304050", shell=True)
time.sleep(60.0)
else:
# if exited without errors, break the loop
break
if __name__ == "__main__":
main()