-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
53 lines (42 loc) · 1.97 KB
/
main.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import logging, sys
from src.emulator import Keyboard, Joystick, Emulator, WALK_TIMEOUTS
from src.settings import get_settings
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s',
level=logging.INFO,
handlers=[
logging.FileHandler('debug.logs'),
logging.StreamHandler(sys.stdout)
]
)
def main() -> None:
settings = get_settings('settings.yaml')
logging.info(f"Your settings are:\n{settings}")
emulator: Emulator = Joystick() if settings.joystick else Keyboard()
logging.info(f'Started {emulator.__class__.__name__} emulator.')
logging.info(f"Press '{settings.start_key}' to start.")
Keyboard.wait(settings.start_key)
logging.info("Starting, to quit press 'CTRL+C' while having the terminal open.")
runs_n = 0
try:
while True:
emulator.back_to_grace(settings.grace_timeout) # We start by going to the site of grace
emulator.walk(0, 1, WALK_TIMEOUTS[0]) # Forward
emulator.walk(-1, 0, WALK_TIMEOUTS[1]) # Left
emulator.walk(0, 1, WALK_TIMEOUTS[2]) # Forward
emulator.ability(settings.skill_key) # We got to the first albinaurics batch, we can kill them
emulator.walk(0, 1, WALK_TIMEOUTS[3]) # Forward
emulator.ability(settings.skill_key) # We got to the second albinaurics batch, we can kill them
runs_n += 1
except KeyboardInterrupt:
pass
after_phrase = "I'm sorry Albus..." if runs_n != 0 else "That's great Albus!"
logging.info(f'Program finished successfully and killed the albinaurics {runs_n} times! {after_phrase}')
if __name__ == '__main__':
try:
main()
except Exception as e:
logging.critical("There has been an error!! Please report it immediately on https://github.com/GiuseppeFn/EldenRingFarmBot", exc_info=e, stack_info=True)
finally:
logging.info('Waiting for space to be pressed...')
Keyboard.wait('space')