This repository has been archived by the owner on Jan 9, 2019. It is now read-only.
forked from konatakun/powerbot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMobileIdNameQuery.java
175 lines (151 loc) · 3.43 KB
/
MobileIdNameQuery.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
package org.powerbot.script.rt6;
import java.util.regex.Pattern;
import org.powerbot.script.AbstractQuery;
import org.powerbot.script.Actionable;
import org.powerbot.script.Area;
import org.powerbot.script.Filter;
import org.powerbot.script.Identifiable;
import org.powerbot.script.Locatable;
import org.powerbot.script.Nameable;
import org.powerbot.script.Viewable;
/**
* MobileIdNameQuery
*
* @param <K>
*/
public abstract class MobileIdNameQuery<K extends Locatable & Identifiable & Nameable & Viewable & Actionable> extends AbstractQuery<MobileIdNameQuery<K>, K, ClientContext>
implements Locatable.Query<MobileIdNameQuery<K>>, Identifiable.Query<MobileIdNameQuery<K>>,
Nameable.Query<MobileIdNameQuery<K>>, Viewable.Query<MobileIdNameQuery<K>>,
Actionable.Query<MobileIdNameQuery<K>> {
public MobileIdNameQuery(final ClientContext ctx) {
super(ctx);
}
/**
* {@inheritDoc}
*/
@Override
protected MobileIdNameQuery<K> getThis() {
return this;
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> at(final Locatable l) {
return select(new Locatable.Matcher(l));
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> within(final double radius) {
return within(ctx.players.local(), radius);
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> within(final Locatable locatable, final double radius) {
return select(new Locatable.WithinRange(locatable, radius));
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> within(final Area area) {
return select(new Locatable.WithinArea(area));
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> nearest() {
return nearest(ctx.players.local());
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> nearest(final Locatable locatable) {
return sort(new Locatable.NearestTo(locatable));
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> id(final int... ids) {
return select(new Identifiable.Matcher(ids));
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> id(final int[]... ids) {
int z = 0;
for (final int[] x : ids) {
z += x.length;
}
final int[] a = new int[z];
int i = 0;
for (final int[] x : ids) {
for (final int y : x) {
a[i++] = y;
}
}
return select(new Identifiable.Matcher(a));
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> id(final Identifiable... identifiables) {
return select(new Identifiable.Matcher(identifiables));
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> name(final String... names) {
return select(new Nameable.Matcher(names));
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> name(final Pattern... names) {
return select(new Nameable.Matcher(names));
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> name(final Nameable... names) {
return select(new Nameable.Matcher(names));
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> action(final String... actions) {
return select(new Actionable.Matcher(actions));
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> action(final Pattern... actions) {
return select(new Actionable.Matcher(actions));
}
/**
* {@inheritDoc}
*/
@Override
public MobileIdNameQuery<K> viewable() {
return select(new Filter<K>() {
@Override
public boolean accept(final K k) {
return k.inViewport();
}
});
}
}