-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathinteractions.py
174 lines (155 loc) · 4.87 KB
/
interactions.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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
from utils import *
res_ratio = (game_res[0] / DEFAULT_GAME_RES[0],
game_res[1] / DEFAULT_GAME_RES[1])
def clickConfirm(ref_img, thresh=0.7):
''' Clicks a button and confirms.
### Parameters:
`ref_img` (string): filename of target image
'''
x, y = findImage(ref_img, thresh)
if (x, y) == (-1, -1):
raise NameError('template not found...')
gui.moveTo(x, y)
gui.move(random.randint(1, 5), 0)
gui.click()
time.sleep(random.uniform(0.15, 0.30))
gui.keyDown('enter')
time.sleep(random.uniform(0.05, 0.1))
gui.keyUp('enter')
# The skill rotation is based on a specific set of keybinds for the Artillerist class.
def rotation(iters=3):
''' Executes a full skill rotation for `iters` number of times.
### Parameters:
`iters` (int): number of times to do skill rotation, default of 3
'''
align()
# while (findImage('./assets/img/portal.png') == (-1, -1)):
for i in range(iters):
# One-shot burst
# Resolution-dependent
gui.moveTo(resolution[0]/2 - 200 * res_ratio[0],
resolution[1]/2 - 150 * res_ratio[0])
gui.keyDown('w')
time.sleep(random.uniform(0.05, 0.1))
gui.keyUp('w')
# Cast time
time.sleep(random.uniform(0.6, 0.8))
kite()
# One-shot burst
# Resolution-dependent
gui.moveTo(resolution[0]/2 - 200 * res_ratio[0],
resolution[1]/2 - 150 * res_ratio[0])
gui.keyDown('s')
time.sleep(random.uniform(0.05, 0.1))
gui.keyUp('s')
gui.keyDown('s')
time.sleep(random.uniform(0.075, 0.125))
gui.keyUp('s')
# Cast time
time.sleep(random.uniform(1.75, 2.0))
kite()
# Defensive
gui.keyDown('d')
time.sleep(random.uniform(0.05, 0.1))
gui.keyUp('d')
# Cast time
time.sleep(random.uniform(0.25, 0.5))
# Other (turret)
gui.keyDown('f')
time.sleep(random.uniform(0.05, 0.1))
gui.keyUp('f')
# Cast time
time.sleep(random.uniform(0.75, 1.0))
# Mini burst
# Resolution-dependent
gui.moveTo(resolution[0]/2 - 200 * res_ratio[0],
resolution[1]/2 - 100 * res_ratio[0])
gui.keyDown('a')
time.sleep(random.uniform(0.05, 0.1))
gui.keyUp('a')
# Cast time
time.sleep(random.uniform(0.6, 0.8))
# DoT
gui.keyDown('r')
time.sleep(random.uniform(0.05, 0.1))
gui.keyUp('r')
# Cast time
time.sleep(random.uniform(1.25, 1.5))
# kite()
# Wait for cds
# time.sleep(random.uniform(4.5, 5.0))
# One-shot burst
# Resolution-dependent
gui.moveTo(resolution[0]/2 - 200 * res_ratio[0],
resolution[1]/2 - 150 * res_ratio[0])
gui.keyDown('w')
time.sleep(random.uniform(0.05, 0.1))
gui.keyUp('w')
# Cast time
time.sleep(random.uniform(2.0, 2.5))
def kite():
''' Primitive kiting by moving in a rectangle. Probably drifts in some direction over time. '''
# Resolution-dependent
# X cursor offset
l = 900 * res_ratio[0]
# Y cursor offset
l2 = 350 * res_ratio[0]
x, y = (resolution[0]/2, resolution[1]/2)
# Up
x1, y1 = (x, y-l2)
# Left
x2, y2 = (x-l, y)
# Down
x3, y3 = (x, y+l2)
# Right
x4, y4 = (x+l, y)
gui.moveTo(x1, y1)
gui.click(button='right')
time.sleep(1.0)
gui.moveTo(x2, y2)
gui.click(button='right')
time.sleep(1.25)
gui.moveTo(x3, y3)
gui.click(button='right')
time.sleep(1.0)
gui.moveTo(x4, y4)
gui.click(button='right')
time.sleep(1.25)
def align():
''' Move towards the bottom left of the map (for initial alignment). '''
# Resolution-dependent
# X cursor offset
l = 600 * res_ratio[0]
# Y cursor offset
l2 = 350 * res_ratio[0]
x, y = (resolution[0]/2, resolution[1]/2)
# Down
x3, y3 = (x, y+l2)
# Right
x4, y4 = (x+l, y)
gui.moveTo(x3, y3)
gui.click(button='right')
time.sleep(0.75)
gui.moveTo(x4, y4)
gui.click(button='right')
time.sleep(0.5)
def repair(ref_img):
''' Repairs armor.
### Parameters:
`ref_img` (string): filename of target image
'''
x, _ = findImage(ref_img)
if x > -1:
gui.keyDown('alt')
gui.keyDown('p')
time.sleep(random.uniform(0.05, 0.1))
gui.keyUp('p')
gui.keyUp('alt')
time.sleep(random.uniform(1.5, 2.0))
clickConfirm('pet', thresh=0.75)
time.sleep(random.uniform(0.5, 1.0))
clickConfirm('repair')
gui.keyDown('esc')
time.sleep(random.uniform(0.05, 0.1))
gui.keyUp('esc')
print('armor\'s all good!')