-
Notifications
You must be signed in to change notification settings - Fork 0
/
runner.py
79 lines (66 loc) · 1.8 KB
/
runner.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
from utils import *
from map_finder import *
from interactions import *
# For starting/stopping script
import keyboard
from multiprocessing import Process
# Tested on resolutions:
# [1920x1200, 1920x1080, 1600x1200, 1600x900]
# Only works on fullscreen (for now)
LOAD_IN_TIME = 9
LOAD_OUT_TIME = 10
DEFENSIVE = ['d']
AOE = ['w', 's']
OTHER = ['a', 'f', 'r']
def executeScript():
print(res_ratio)
scale_images()
mainScript()
# The main script
def mainScript():
while True:
repair('armor')
# Enter dungeon
gui.keyDown('g')
time.sleep(random.uniform(0.05,0.1))
gui.keyUp('g')
time.sleep(random.uniform(0.5, 0.75))
try:
clickConfirm('enter')
except:
mainScript()
time.sleep(random.uniform(LOAD_IN_TIME, LOAD_IN_TIME + 0.5))
# Room 1
gui.moveTo(resolution[0]/2, resolution[1]/2)
gui.click()
time.sleep(random.uniform(3.7, 3.9))
rotation()
# Find next room
find_portal()
time.sleep(random.uniform(3.5, 4.0))
# Room 2
# -- TO-DO -- #
gui.moveTo(resolution[0]/2, resolution[1]/2)
gui.click()
time.sleep(random.uniform(3.9, 4.1))
find_elites()
find_boss()
find_portal()
time.sleep(random.uniform(3.5, 4.0))
# Exit dungeon
clickConfirm('leave')
time.sleep(random.uniform(LOAD_OUT_TIME, LOAD_OUT_TIME + 0.5))
# Control script using key '0'
def controlScript(p):
if p.is_alive():
p.terminate()
raise SystemExit()
else:
p.start()
if __name__ == '__main__':
pressed = 0
p = Process(target=executeScript)
keyboard.wait('0')
controlScript(p)
keyboard.wait('0')
controlScript(p)