-
Notifications
You must be signed in to change notification settings - Fork 3
/
payday_farm.py
116 lines (99 loc) · 3.49 KB
/
payday_farm.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
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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
from pokeAPI import *
import time
from threading import Thread
from prompt_toolkit import HTML, print_formatted_text
from prompt_toolkit.styles import Style
import sys
import os
try:
driver = pokeAPI().register_window(name="РokеММO")
wx, wy = driver.get_window_rect()[:2]
ROUND_COUNT = 0
print = print_formatted_text
style = Style.from_dict({
'msg': '#71f076 bold',
'sub-msg': '#616161 italic'
})
def display_metrics():
while(True):
global ROUND_COUNT
driver.clear_console()
#Current dungeon run number
str_buffer = str(ROUND_COUNT)
print(HTML(
u'<b>></b> <ansicyan><u>Current Dungeon Run</u></ansicyan>'+"<b> : </b>"+'<i><ansigrey>'+str_buffer+'</ansigrey></i>'
), style=style)
time.sleep(1)
def navigate_to_low_level_grass():
driver.hold_key('left',0.6)
driver.hold_key('up',1.3)
driver.hold_key('right',1.7)
driver.hold_key('up',0.50)
driver.hold_key('right',.5)
driver.hold_key('up',2.4)
def navigate_to_high_level_grass():
#get on bike
driver.toggle_bike()
driver.hold_key('left',5.6)
driver.hold_key('up',1.5)
driver.hold_key('right',2.3)
driver.toggle_bike()
driver.hold_key('right',1)
def farm_money_until_low():
#Start bot underneath poke-center exit facing down
print("Going to pokecenter")
driver.use_pokecenter(location="lacunosa")
# driver.fly_to(location="lacunosa")
# driver.press_key("up")
# driver.press_key("up")
currentPP = 10
print("Navigating to Grass Patches")
navigate_to_high_level_grass()
driver.press_key('up')
driver.press_key('up')
print("Starting farm loop")
while(currentPP>0):
print("Looking for battle")
while((not driver.is_in_battle()) and (not driver.is_in_horde())):
driver.look_for_battle()
print("Battle")
in_battle = True
#wait for battle options to pop up
print("Intro animations")
time.sleep(7)
if (driver.is_in_horde()):
print("Fleeing from battle")
driver.flee_from_battle()
print("Attack animations & battle close")
time.sleep(11)
in_battle = False
else:
while(in_battle):
print("Using attack")
driver.use_first_attack()
print("Attack animations & battle close")
time.sleep(11)
#if battle is over set loop flag to false
if(not driver.is_in_battle()):
print("Enemy pokemon was defeated")
in_battle = False
print("Holding z through any prompts")
driver.hold_key('z',3)
currentPP -= 1
metric_thread = Thread(target=display_metrics,args=())
try:
#metric_thread.start()
while True:
farm_money_until_low()
ROUND_COUNT += 1
except KeyboardInterrupt:
print ('Interrupted')
try:
sys.exit(0)
except SystemExit:
os._exit(0)
except Exception as e:
try:
sys.exit(0)
except SystemExit:
os._exit(0)