-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.py
62 lines (47 loc) · 1.62 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
54
55
56
57
58
59
60
61
62
import argparse
import enum
from core.browser import Driver
from core.characters import *
from core.setup_logger import logger_init
__author__ = "TopKeingt"
class Character(enum.Enum):
ARCHER = archer.Archer, 0
MAGE = mage.Mage, 1
SHAMAN = shaman.Shaman, 2
WARRIOR = warrior.Warrior, 3
def choose_character():
print('''
1) {0}
2) {1}
3) {2}
4) {3}
'''.format(*[c.name for c in Character])) # ID go according to character's enum
_id = int(input("Choose your character (number only): "))
for _class in Character:
if _class.value[1] == (_id - 1):
return _class.value[0]
print("Please choose again...")
choose_character()
def parse_arguments():
parser = argparse.ArgumentParser(description="Hordes.io bot configuration")
parser.add_argument('--browser', '-b', default="chrome", dest="browser", help="Specific a web browser to start (chrome)")
parser.add_argument('--path', default='', type=str, dest="path", help="Path to chromedriver.exe")
parser.add_argument('--verbose', '-v', default=False, action='store_true', dest="verbose", help="Display bot's workflow")
_args = parser.parse_args()
return _args
def banner():
print('''.----. .---. .-----. .----.
| {_} }/ {-. \`-' '-'{ {__-`
| {_} }\ '-} / } { .-._} }
`----' `---' `-' `----'
@TopKeingt''')
def main():
args = parse_arguments()
banner()
player = choose_character()
logger_init(args.verbose)
driver = Driver(args.browser, args.path)
driver.start()
player(driver).run()
if __name__ == "__main__":
main()