|
@@ -12,7 +12,7 @@ from util import debug
|
|
|
|
|
|
def login(username=None, password=None):
|
|
|
if connection.session_id is not None:
|
|
|
- fake_loading_bar('Signing out', delay=0.025)
|
|
|
+ fake_loading_bar('Signing out', duration=0.7)
|
|
|
connection.session_id = None
|
|
|
|
|
|
if username is None:
|
|
@@ -24,6 +24,7 @@ def login(username=None, password=None):
|
|
|
else:
|
|
|
password = input('Password: ')
|
|
|
|
|
|
+ fake_loading_bar('Signing in', duration=2.3)
|
|
|
response = client_request('login', {"username": username, "password": password})
|
|
|
success = 'session_id' in response
|
|
|
if success:
|
|
@@ -38,8 +39,8 @@ def login(username=None, password=None):
|
|
|
|
|
|
def register(username=None, password=None, game_key=''):
|
|
|
if connection.session_id is not None:
|
|
|
- fake_loading_bar('Signing out', delay=0.025)
|
|
|
connection.session_id = None
|
|
|
+ fake_loading_bar('Signing out', duration=0.7)
|
|
|
|
|
|
if username is None:
|
|
|
username = input('Username: ')
|
|
@@ -51,10 +52,13 @@ def register(username=None, password=None, game_key=''):
|
|
|
password = input('Password: ')
|
|
|
|
|
|
if not debug:
|
|
|
- if game_key is '':
|
|
|
+ if game_key == '':
|
|
|
print('Entering a game key will provide you with some starting money and other useful stuff.')
|
|
|
game_key = input('Game key (leave empty if you don\'t have one): ')
|
|
|
|
|
|
+ fake_loading_bar('Validating Registration', duration=5.2)
|
|
|
+ if game_key != '':
|
|
|
+ fake_loading_bar('Validating Game Key', duration=0.4)
|
|
|
response = client_request('register', {"username": username, "password": password, "game_key": game_key})
|
|
|
|
|
|
if 'error_message' in response:
|
|
@@ -65,6 +69,7 @@ def cancel_order(order_no=None):
|
|
|
if order_no is None:
|
|
|
order_no = input('Order No.: ')
|
|
|
|
|
|
+ fake_loading_bar('Validating Request', duration=0.6)
|
|
|
response = client_request('cancel_order', {"session_id": connection.session_id, "order_id": order_no})
|
|
|
|
|
|
if 'error_message' in response:
|
|
@@ -93,10 +98,11 @@ def help():
|
|
|
|
|
|
|
|
|
def depot():
|
|
|
+ fake_loading_bar('Loading data', duration=1.3)
|
|
|
response = client_request('depot', {"session_id": connection.session_id})
|
|
|
success = 'data' in response and 'own_wealth' in response
|
|
|
if success:
|
|
|
- print(tabulate(response['data'], headers=['Object', 'Amount'], tablefmt="pipe"))
|
|
|
+ print(tabulate(response['data'], headers=['Object', 'Amount', 'Est. Value'], tablefmt="pipe"))
|
|
|
print('This corresponds to a wealth of roughly', response['own_wealth'])
|
|
|
else:
|
|
|
if 'error_message' in response:
|
|
@@ -106,6 +112,7 @@ def depot():
|
|
|
|
|
|
|
|
|
def leaderboard():
|
|
|
+ fake_loading_bar('Loading data', duration=1.3)
|
|
|
response = client_request('leaderboard', {"session_id": connection.session_id})
|
|
|
success = 'data' in response
|
|
|
if success:
|
|
@@ -125,6 +132,7 @@ def activate_key(key=''):
|
|
|
if key == '':
|
|
|
print('Invalid key.')
|
|
|
|
|
|
+ fake_loading_bar('Validating Key', duration=0.4)
|
|
|
response = client_request('activate_key', {"session_id": connection.session_id, 'key': key})
|
|
|
if 'error_message' in response:
|
|
|
print('Key activation failed with message:', response['error_message'])
|
|
@@ -204,6 +212,7 @@ def sell(amount=None, object_name=None, limit=None, stop_loss=None, time_until_e
|
|
|
|
|
|
|
|
|
def orders():
|
|
|
+ fake_loading_bar('Validating Key', duration=0.9)
|
|
|
response = client_request('orders', {"session_id": connection.session_id})
|
|
|
success = 'data' in response
|
|
|
if success:
|
|
@@ -220,6 +229,7 @@ def orders():
|
|
|
def orders_on(object_name=None):
|
|
|
if object_name is None: # TODO list some available objects
|
|
|
object_name = input('Name of object to check: ')
|
|
|
+ fake_loading_bar('Validating Key', duration=2.3)
|
|
|
response = client_request('orders_on', {"session_id": connection.session_id, "ownable": object_name})
|
|
|
success = 'data' in response
|
|
|
if success:
|
|
@@ -234,6 +244,7 @@ def orders_on(object_name=None):
|
|
|
|
|
|
|
|
|
def news():
|
|
|
+ fake_loading_bar('Loading Data', duration=0.76)
|
|
|
response = client_request('news', {"session_id": connection.session_id})
|
|
|
success = 'data' in response
|
|
|
if success:
|
|
@@ -250,6 +261,7 @@ def news():
|
|
|
def transactions(object_name=None):
|
|
|
if object_name is None: # TODO list some available objects
|
|
|
object_name = input('Name of object to check: ')
|
|
|
+ fake_loading_bar('Loading Data', duration=1.3)
|
|
|
response = client_request('transactions', {"session_id": connection.session_id, "ownable": object_name})
|
|
|
success = 'data' in response
|
|
|
if success:
|