forked from konatakun/powerbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Interactive.java
229 lines (208 loc) · 10 KB
/
Interactive.java
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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
package org.powerbot.script;
import java.awt.Point;
import java.awt.Polygon;
/**
* Interactive
* An entity which can be interacted with through direct clicking and menu options.
*/
public interface Interactive extends Targetable, Validatable, Viewable, Drawable {
/**
* Finds the centroid of the entity within the game screen.
*
* @return the centroid if the entity is on the screen; null otherwise
*/
Point centerPoint();
/**
* Hovers the target and compensates for movement.
*
* @return <tt>true</tt> if the mouse is within the target; otherwise <tt>false</tt>
*/
boolean hover();
/**
* Clicks the target and compensates for movement. Does not check intent or expected result (mouse cross-hair).
*
* @return <tt>true</tt> if the click was executed; otherwise <tt>false</tt>
*/
boolean click();
/**
* Clicks the target and compensates for movement. Does not check intent or expected result (mouse cross-hair).
*
* @param left <tt>true</tt> to click left, <tt>false</tt> to click right
* @return <tt>true</tt> if the click was executed; otherwise <tt>false</tt>
*/
boolean click(boolean left);
/**
* Clicks the target and compensates for movement. Does not check intent or expected result (mouse cross-hair).
*
* @param button the desired mouse button to press
* @return <tt>true</tt> if the click was executed; otherwise <tt>false</tt>
*/
boolean click(int button);
/**
* Clicks the target and compensates for movement.
* This method expects (and requires) that the given action is up-text (menu index 0).
* This method can be used when precision clicking is required, and the option is guaranteed to be up-text.
* WARNING: this method DOES NOT check intent or expected result (mouse cross-hair).
* WARNING: The return status does not guarantee the correct action was acted upon.
*
* @param action the action to look for
* @return <tt>true</tt> if the mouse was clicked, otherwise <tt>false</tt>
*/
boolean click(String action);
/**
* Clicks the target and compensates for movement.
* This method expects (and requires) that the given action is up-text (menu index 0).
* This method can be used when precision clicking is required, and the option is guaranteed to be up-text.
* WARNING: this method DOES NOT check intent or expected result (mouse cross-hair).
* WARNING: The return status does not guarantee the correct action was acted upon.
*
* @param action the action to look for
* @param option the option to look for
* @return <tt>true</tt> if the mouse was clicked, otherwise <tt>false</tt>
*/
boolean click(String action, String option);
/**
* Clicks the target and compensates for movement.
* This method expects (and requires) that the given action is up-text (menu index 0).
* This method can be used when precision clicking is required, and the option is guaranteed to be up-text.
* WARNING: this method DOES NOT check intent or expected result (mouse cross-hair).
* WARNING: The return status does not guarantee the correct action was acted upon.
*
* @param c the menu command to look for
* @return <tt>true</tt> if the mouse was clicked, otherwise <tt>false</tt>
*/
boolean click(Filter<? super MenuCommand> c);
/**
* Interacts with the target and compensates for movement.
* This method will interact (and choose it) when it finds the desired action.
* This method accomplishes it via left or right click.
* WARNING: this method DOES NOT check intent or expected result (mouse cross-hair).
* WARNING: The return status does not guarantee the correct action was acted upon.
*
* @param action the action to look for
* @return <tt>true</tt> if the mouse was clicked, otherwise <tt>false</tt>
*/
boolean interact(String action);
/**
* Interacts with the target and compensates for movement.
* This method will interact (and choose it) when it finds the desired action.
* This method accomplishes it via left or right click.
* WARNING: this method DOES NOT check intent or expected result (mouse cross-hair).
* WARNING: The return status does not guarantee the correct action was acted upon.
*
* @param action the action to look for
* @param option the option to look for
* @return <tt>true</tt> if the mouse was clicked, otherwise <tt>false</tt>
*/
boolean interact(String action, String option);
/**
* Interacts with the target and compensates for movement.
* This method will interact (and choose it) when it finds the desired action.
* This method accomplishes it via left or right click (as defined).
* When auto is set to false, the method forcibly right clicks before searching for menu options.
* This is useful when precision clicking is required and the option is always in the menu (not up-text).
* WARNING: this method DOES NOT check intent or expected result (mouse cross-hair).
* WARNING: The return status does not guarantee the correct action was acted upon.
*
* @param auto <tt>true</tt> is normal behavior, <tt>false</tt> forces right click
* @param action the action to look for
* @return <tt>true</tt> if the mouse was clicked, otherwise <tt>false</tt>
*/
boolean interact(boolean auto, String action);
/**
* Interacts with the target and compensates for movement.
* This method will interact (and choose it) when it finds the desired action.
* This method accomplishes it via left or right click (as defined).
* When auto is set to false, the method forcibly right clicks before searching for menu options.
* This is useful when precision clicking is required and the option is always in the menu (not up-text).
* WARNING: this method DOES NOT check intent or expected result (mouse cross-hair).
* WARNING: The return status does not guarantee the correct action was acted upon.
*
* @param auto <tt>true</tt> is normal behavior, <tt>false</tt> forces right click
* @param action the action to look for
* @param option the option to look for
* @return <tt>true</tt> if the mouse was clicked, otherwise <tt>false</tt>
*/
boolean interact(boolean auto, String action, String option);
/**
* Interacts with the target and compensates for movement.
* This method will interact (and choose it) when it finds the desired action.
* This method accomplishes it via left or right click.
* WARNING: this method DOES NOT check intent or expected result (mouse cross-hair).
* WARNING: The return status does not guarantee the correct action was acted upon.
*
* @param c the menu command to look for
* @return <tt>true</tt> if the mouse was clicked, otherwise <tt>false</tt>
*/
boolean interact(Filter<? super MenuCommand> c);
/**
* Interacts with the target and compensates for movement.
* This method will interact (and choose it) when it finds the desired action.
* This method accomplishes it via left or right click (as defined).
* When auto is set to false, the method forcibly right clicks before searching for menu options.
* This is useful when precision clicking is required and the option is always in the menu (not up-text).
* WARNING: this method DOES NOT check intent or expected result (mouse cross-hair).
* WARNING: The return status does not guarantee the correct action was acted upon.
*
* @param auto <tt>true</tt> is normal behavior, <tt>false</tt> forces right click
* @param c the menu command to look for
* @return <tt>true</tt> if the mouse was clicked, otherwise <tt>false</tt>
*/
boolean interact(boolean auto, Filter<? super MenuCommand> c);
/**
* Clicks the target and compensates for movement. Does not check intent.
*
* @param result the crosshair to check against after interaction
* @return <tt>true</tt> if the click was executed and <code>ctx.game.crosshair() == result</code>; otherwise <tt>false</tt>
*/
boolean click(Crosshair result);
/**
* Clicks the target and compensates for movement.
* This method expects (and requires) that the given action is up-text (menu index 0).
* This method can be used when precision clicking is required, and the option is guaranteed to be up-text.
* WARNING: this method DOES NOT check intent.
* WARNING: The return status does not guarantee the correct action was acted upon.
*
* @param action the action to look for
* @param result the crosshair to check against after interaction
* @return <tt>true</tt> if the mouse was clicked and <code>ctx.game.crosshair() == result</code>, otherwise <tt>false</tt>
*/
boolean click(String action, Crosshair result);
/**
* Clicks the target and compensates for movement.
* This method expects (and requires) that the given action is up-text (menu index 0).
* This method can be used when precision clicking is required, and the option is guaranteed to be up-text.
* WARNING: this method DOES NOT check intent.
* WARNING: The return status does not guarantee the correct action was acted upon.
*
* @param action the action to look for
* @param option the option to look for
* @param result the crosshair to check against after interaction
* @return <tt>true</tt> if the mouse was clicked and <code>ctx.game.crosshair() == result</code>, otherwise <tt>false</tt>
*/
boolean click(String action, String option, Crosshair result);
/**
* Clicks the target and compensates for movement.
* This method expects (and requires) that the given action is up-text (menu index 0).
* This method can be used when precision clicking is required, and the option is guaranteed to be up-text.
* WARNING: this method DOES NOT check intent.
* WARNING: The return status does not guarantee the correct action was acted upon.
*
* @param c the menu command to look for
* @param result the crosshair to check against after interaction
* @return <tt>true</tt> if the mouse was clicked and <code>ctx.game.crosshair() == result</code>, otherwise <tt>false</tt>
*/
boolean click(Filter<? super MenuCommand> c, Crosshair result);
/**
* Sets the boundaries of this entity utilizing an array.
*
* @param arr {x1, x2, y1, y2, z1, z2}
*/
void bounds(final int[] arr);
/**
* The translated model triangles.
*
* @return the translated model triangles
*/
Polygon[] triangles();
}