-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauto_play.py
More file actions
94 lines (79 loc) · 2.72 KB
/
auto_play.py
File metadata and controls
94 lines (79 loc) · 2.72 KB
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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
from endpoints import *
from main_functions import *
import os
import subprocess
import argparse
import random
import datetime
"""
Use this file to play automatically.
examples:
python auto_play.py
python auto_play.py --plays 20
python auto_play.py --plays 9000
"""
parser = argparse.ArgumentParser(description='Auto Play')
parser.add_argument('--plays', default=999999999999)
args = parser.parse_args()
plays = int(args.plays)
os.system('pipenv shell')
status_res = status()
# Cooldown penalty check
if status_res['errors'] is not None and len(status_res['errors']) > 0:
print('\n!!!! Cooldown Penalty !!!!')
cooldown(status_res)
print('Grabbing player info...')
current_room = get_current_room()
cooldown(status_res)
else:
print('Grabbing player info...')
cooldown(status_res)
play_counter = 0
play_odds = dict()
# populate odds
for i in range(0, 10):
play_odds[i] = 'gold'
for i in range(10, 50):
play_odds[i] = 'coin'
for i in range(50, 90):
play_odds[i] = 'snitch'
for i in range(90, 100):
play_odds[i] = 'transmogrify'
while play_counter != plays:
# grab user info
print('Updating player info...')
status_res = status()
cooldown(status_res)
# let's just make sure the person isn't encumbered, otherwise sell everything
if status_res['encumbrance'] >= status_res['strength']:
print('\n>>>>>>>>>> Going to get rid of some baggage!\n')
os.system(f'python fast_travel.py --room 1')
# randomly choose an action
lets_do = random.randint(0, 99)
# execute that action
if play_odds[lets_do] == 'gold':
random_num = random.randint(1000, 1500)
print(f'\n{datetime.datetime.now().time()}')
print('>>>>>>>>>> Going to loot some treasure!')
print(f'>>>>>>>>>> Worth {random_num} gold\n')
os.system(f'python auto_gold.py --gold {random_num}')
elif play_odds[lets_do] == 'coin':
random_num = random.randint(1, 10)
print(f'\n{datetime.datetime.now().time()}')
print('>>>>>>>>>> Going to the mines!')
print(f'>>>>>>>>>> Mining {random_num} coins\n')
os.system(f'python auto_mine.py --coin {random_num}')
elif play_odds[lets_do] == 'snitch':
random_num = random.randint(1, 5)
print(f'\n{datetime.datetime.now().time()}')
print('>>>>>>>>>> Going to become a wizard!')
print(f'>>>>>>>>>> Getting {random_num} snitches\n')
os.system(f'python auto_snitch.py --snitches {random_num}')
elif play_odds[lets_do] == 'transmogrify':
print(f'\n{datetime.datetime.now().time()}')
print('>>>>>>>>>> Going to roll for exquisite gear!\n')
os.system(f'python reroll.py')
else:
continue
# let's do it again
play_counter += 1