-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpokepy.py
executable file
·44 lines (39 loc) · 1021 Bytes
/
pokepy.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
#!/usr/bin/env python3
# coding:utf-8
'''Client for the game'''
import sys
import argparse
from lib.client import Client
argparser: argparse.ArgumentParser = argparse.ArgumentParser()
argparser.add_argument(
'-H',
'--host',
help='host of the server, default is localhost',
default='localhost')
argparser.add_argument(
'-p',
'--port',
help='port of the server',
type=int,
default=3333)
argparser.add_argument(
'-v',
'--verbose',
help='increase output verbosity',
action='store_true')
args = argparser.parse_args()
if __name__ == '__main__':
try:
client: Client = Client(args.host, args.port)
if args.verbose:
print(f'Connected to server on {args.host}:{args.port}')
client.get_id()
client.ready()
client.communicate()
# Stop the client and return 0
client.stop()
sys.exit(0)
except KeyboardInterrupt:
print('\nStopping client...')
client.stop()
sys.exit(0)