RuneHive-Tarnish
Neural OSRS Enhancement Framework
Loading...
Searching...
No Matches
Area.java
1package com.osroyale.game.world.position;
2
3import com.osroyale.game.world.Interactable;
4import com.osroyale.game.world.entity.Entity;
5import com.osroyale.game.world.entity.mob.Mob;
6import com.osroyale.game.world.position.impl.SquareArea;
7
49
50public abstract class Area {
51
52 private static final Area[] SAFEZONE = {
53 new SquareArea("Edgeville Bank", 3091, 3488, 3098, 3499),
54 new SquareArea("Edgeville Bank", 3091, 3507, 3100, 3513) };
55
56 private static final Area DZ = new SquareArea("Donator Zone", 2462, 10422, 2493, 10463);
57 private static final Area SDZ = new SquareArea("Super Donator Zone", 2398, 10404, 2444, 10440);
59 private static final Area BANDOS_ROOM = new SquareArea("General Graardor room", 2864, 5351, 2876, 5369, 2);
60 private static final Area SARADOMIN_ROOM = new SquareArea("Saradomin room", 2889, 5258, 2907, 5275, 0);
61 private static final Area ZAMORAK_ROOM = new SquareArea("Zamorak room", 2918, 5318, 2936, 5331, 2);
62 private static final Area ARMADYL_ROOM = new SquareArea("Armadyl room", 2824, 5296, 2842, 5308, 2);
63 public static final Boundary NEX = new Boundary(2900, 5183, 2943, 5227);
64
65 public static final Area[] INFERNO = { new SquareArea("Arena Zone", 2243, 5314, 2300, 5372) };
66 // new SquareArea("Inferno", 2243, 5372, 2300, 5314),
67
69 private static final Area RFD_MINIGAME = new SquareArea("RFD Minigame", 1889, 5345, 1910, 5366, 2);
70
72 public static final Area[] WILDERNESS_RESOURCE = { new SquareArea("Wilderness Resource", 3174, 3924, 3196, 3944) };
73
75 private static final Area[] ZULRAH = { new SquareArea("Zulrah", 2235, 3050, 2288, 3083) };
76
78 private static final Area[] KBD = { new SquareArea("King Black Dragon lair", 2256, 4680, 2287, 4711) };
79
80 private static final Area[] LMS_LOBBY = { new SquareArea("LMS Lobby", 3138, 3639, 3145, 3645) };
81
82 private static final Area[] LMS_BUILDING = { new SquareArea("LMS Lobby", 3140, 3632, 3144, 3638) };
83
84 private static final Area[] FEROX_ENCLAVE = {
85 new SquareArea(3125, 3618, 3143, 3639),
86 new SquareArea(3123, 3622, 3124, 3632),
87 new SquareArea(3144, 3627, 3153, 3640),
88 new SquareArea(3138, 3640, 3145, 3645),
89 new SquareArea(3148, 3641, 3155, 3646),
90 new SquareArea(3130, 3617, 3139, 3617),
91 new SquareArea(3153, 3636, 3155, 3640),
92 new SquareArea(3153, 3627, 3155, 3633),
93 new SquareArea(3143, 3618, 3146, 3626),
94 new SquareArea(3146, 3622, 3151, 3626)
95 };
96
98 private static final Area[] KRAKEN = { new SquareArea("Kraken Cave", 2268, 10022, 2292, 10046) };
99 private static final Area[] LMS_GAME = {new SquareArea("LMS Game", 3392, 5760, 3519, 5893) };
100 private static final Area[] PEST_CONTROL_GAME = { new SquareArea("Pest Control Game", 2622, 2558, 2693, 2627) };
101
102 private static final Area[] EVENT_ARENA = { new SquareArea("Event Arena", 3082, 3506, 3089, 3513) };
103
104 private static final Area[] BARROWS = {
105 new SquareArea("Barrows", 3533, 3261, 3585, 3328),
106 new SquareArea("Barrows Underground", 3523, 9672, 3591, 9725, 3) };
107
108 private static final Area[] CATACOMBS = { new SquareArea("Catacombs", 1591, 9982, 1736, 10111) };
109
111 private static final Area[] DUEL_ARENA_LOBBY = {
112 new SquareArea("Lobby", 3353, 3263, 3388, 3287),
113 new SquareArea("Lobby Altar", 3374, 3280, 3379, 3286),
114 new SquareArea("Lobby east bank", 3380, 3267, 3388, 3273) };
115
117 private static final Area[] MULTI_COMBAT_ZONES = {
118 new SquareArea("Lizard shamans", 1408, 3692, 1457, 3729),
119 new SquareArea("Al-kahrid Warrior", 3281, 3158, 3304, 3178),
120 new SquareArea("Smoke devils", 2378, 9421, 2429, 9465),
121 new SquareArea("Rock Crab", 2660, 3711, 2743, 3739),
122 new SquareArea("Skotizo", 2255, 5646, 2290, 5680),
123 new SquareArea("Wilderness Resource", 3174, 3924, 3196, 3944),
124 new SquareArea("Start of Varrock Wilderness", 3134, 3525, 3327, 3607),
125 new SquareArea("North of GE, near gravestones", 3190, 3648, 3327, 3839),
126 new SquareArea("Near Chaos Elemental", 3200, 3840, 3390, 3967),
127 new SquareArea("Near wilderness agility course", 2992, 3912, 3007, 3967),
128 new SquareArea("West wilderness altar", 2946, 3816, 2959, 3831),
129 new SquareArea("Deep wilderness 1", 3008, 3856, 3199, 3903),
130 new SquareArea("Near wilderness castle", 3008, 3600, 3071, 3711),
131 new SquareArea("North of varrock lumbermill", 3072, 3608, 3327, 3647),
132 new SquareArea("Pest control", 2624, 2550, 2690, 2619),
133 new SquareArea("Fight caves", 2371, 5062, 2422, 5117),
134 new SquareArea("Fight arena", 2896, 3595, 2927, 3630),
135 new SquareArea("Inferno", 2243, 5314, 2300, 5372),
136 new SquareArea("Scorpia lair", 3218, 10329, 3248, 10353),
137 new SquareArea("Corporeal Beast lair", 2964, 4360, 3001, 4399),
138 new SquareArea("Revenant Cave", 3168, 10047, 3290, 10143),
139 new SquareArea("Catacombs of Kourend 1", 1588, 9982, 1747, 10068),//2 to leave out brutals
140 new SquareArea("Catacombs of Kourend 2", 1641, 9982, 1734, 10110),
141 new SquareArea("Dagannoth lair", 2890, 4425, 2942, 4466) };
142
143 private static final SquareArea[] DUEL_ARENAS = {
144 new SquareArea("Arena", 3327, 3203, 3389, 3290)
145 };
146
147 private static final SquareArea[] DUEL_OBSTICLE_ARENAS = {
148 new SquareArea("South East Obstacle Arena", 3362, 3205, 3390, 3221),
149 new SquareArea("West Obstacle Arena", 3331, 3224, 3359, 3240),
150 new SquareArea("North East Obstacle Arena", 3362, 3243, 3390, 3259) };
151
153 private static final Area[] WILDERNESS = {
154 new SquareArea("Wilderness 1", 2941, 3525, 3392, 3966),
155 new SquareArea("Wilderness 2", 2941, 9920, 3392, 10366),
156 new SquareArea("Wilderness 3", 2250, 4672, 2296, 4721) };
157
158 public static boolean inEdgeville(Interactable entity) {
159 return inArea(entity, new Position(3075, 3457, 0), new Position(3116, 3518, 0));
160 }
161
162 public static boolean inCerberus(Interactable entity) {
163 return inArea(entity, new Position(1217, 1223, 0), new Position(1262, 1264, 0));
164 }
165
166 public static boolean inFightCaves(Interactable entity) {
167 return inArea(entity, new Position(2368, 5057, 0), new Position(2428, 5120, 0));
168 }
169
170 public static boolean inGodwars(Interactable entity) {
171 return inArea(entity, new Position(2810, 5250, entity.getHeight()), new Position(2950, 5370, entity.getHeight()));
172 }
173 public static boolean inWarriorGuild(Interactable entity) {
174 return inArea(entity, new Position(2838, 3535, 0), new Position(2875, 3555, 0));
175 }
176
177 public static boolean inCyclops(Interactable entity) {
178 return inArea(entity, new Position(2847, 3532, 2), new Position(2876, 3542, 2)) ||
179 inArea(entity, new Position(2838, 3543, 2), new Position(2877, 3577, 2));
180 }
181
182 public static boolean inkolodionArena(Entity entity) {
183 return entity.instance != Mob.DEFAULT_INSTANCE && inArea(entity, new Position(3092, 3921, entity.getHeight()), new Position(3117, 3947, entity.getHeight()));
184 }
185 public static boolean inSuperDonatorZone(Interactable entity) {
186 return SDZ.inArea(entity.getPosition());
187 }
188 public static boolean inRegularDonatorZone(Interactable entity) {
189 return DZ.inArea(entity.getPosition());
190 }
191
192 public static boolean inGnomeCourse(Interactable entity) {
193 return inArea(entity, new Position(2464, 3412, entity.getHeight()), new Position(2490, 3444, entity.getHeight()));
194 }
195
196 public static boolean inBarbarianCourse(Interactable entity) {
197 return inArea(entity, new Position(2529, 3542, entity.getHeight()), new Position(2553, 3559, entity.getHeight()));
198 }
199
200 public static boolean inSeersCourse(Interactable entity) {
201 return inArea(entity, new Position(2695, 3455, entity.getHeight()), new Position(2740, 3500, entity.getHeight()));
202 }
203
204 public static boolean inArdougneCourse(Interactable entity) {
205 return inArea(entity, new Position(2642, 3285, entity.getHeight()), new Position(2681, 3331, entity.getHeight()));
206 }
207
208 public static boolean inWildernessCourse(Interactable entity) {
209 return inArea(entity, new Position(2989, 3933, entity.getHeight()), new Position(3006, 3964, entity.getHeight()));
210 }
211
212 public static boolean inWildernessResource(Interactable entity) {
213 return inArea(entity, new Position(3714, 3924, entity.getHeight()), new Position(3196, 3944, entity.getHeight()));
214 }
215
216 public static boolean inBarrowsChamber(Interactable entity) {
217 return inArea(entity, new Position(3547, 9690, entity.getHeight()), new Position(3556, 9699, entity.getHeight()));
218 }
219
220 public static boolean inVorkath(Interactable entity) {
221 return inArea(entity, new Position(2257, 4053, entity.getHeight()), new Position(2288, 4079, entity.getHeight()));
222 }
223
224 public static boolean inKingBlackDragon(Interactable entity) {
225 for (Area zone : KBD) {
226 if (zone.inArea(entity.getPosition())) {
227 return true;
228 }
229 }
230 return false;
231 }
232
233 public static boolean inFeroxEnclave(Interactable entity) {
234 for(Area zone : FEROX_ENCLAVE) {
235 if(zone.inArea(entity.getPosition())) {
236 return true;
237 }
238 }
239 return false;
240 }
241 public static boolean inCatacombs(Interactable entity) {
242 for(Area zone : CATACOMBS) {
243 if(zone.inArea(entity.getPosition())) {
244 return true;
245 }
246 }
247 return false;
248 }
249
250
251 public static boolean inLMSLobby(Interactable entity) {
252 for(Area zone : LMS_LOBBY) {
253 if(zone.inArea(entity.getPosition())) {
254 return true;
255 }
256 }
257 return false;
258 }
259
260 public static boolean inLMSBuilding(Interactable entity) {
261 for(Area zone : LMS_BUILDING) {
262 if(zone.inArea(entity.getPosition())) {
263 return true;
264 }
265 }
266 return false;
267 }
268
269
270 public static boolean inRFD(Interactable entity) {
271 return RFD_MINIGAME.inArea(entity.getPosition());
272 }
273
274 public static boolean inKraken(Interactable entity) {
275 for (Area zone : KRAKEN) {
276 if (zone.inArea(entity.getPosition())) {
277 return true;
278 }
279 }
280 return false;
281 }
282 public static boolean inInferno(Entity entity) {
283 for (Area zone1 : INFERNO) {
284 if (zone1.inArea(entity.getPosition())) {
285 return true;
286 }
287 }
288 return false;
289 }
290
291 public static boolean inBarrows(Entity entity) {
292 for (Area zone : BARROWS) {
293 if (zone.inArea(entity.getPosition())) {
294 return true;
295 }
296 }
297 return false;
298 }
299
300 public static boolean inMulti(Entity entity) {
301 for (Area zone : MULTI_COMBAT_ZONES) {
302 if (zone.inArea(entity.getPosition())) {
303 return true;
304 }
305 }
306 return /*inEventArena(entity) ||*/ inVorkath(entity) || inkolodionArena(entity) || inKraken(entity) || inKingBlackDragon(entity) || inGodwars(entity) || inZulrah(entity);
307 }
308
309 public static boolean inWilderness(Position position) {
310 for (Area wild : WILDERNESS) {
311 if (wild.inArea(position)) {
312 return true;
313 }
314 }
315 return false;
316 }
317
318 public static boolean inWilderness(Interactable entity) {
319 if (entity == null) return false;
320 if (inKingBlackDragon(entity)) return false;
321 if (inFeroxEnclave(entity) || inLMSLobby(entity) || inLMSBuilding(entity)) return false;
322 for (Area wild : WILDERNESS) {
323 if (wild.inArea(entity.getPosition())) {
324 return true;
325 }
326 }
327 return false;
328 }
329
330 public static boolean inDuelArenaLobby(Entity entity) {
331 for (Area zone : DUEL_ARENA_LOBBY) {
332 if (zone.inArea(entity.getPosition())) {
333 return true;
334 }
335 }
336 return false;
337 }
338
339 public static boolean inDuelObsticleArena(Interactable entity) {
340 for (Area zone : DUEL_OBSTICLE_ARENAS) {
341 if (zone.inArea(entity.getPosition())) {
342 return true;
343 }
344 }
345 return false;
346 }
347
348 public static boolean inDuelArena(Interactable entity) {
349 for (Area zone : DUEL_ARENAS) {
350 if (zone.inArea(entity.getPosition())) {
351 return true;
352 }
353 }
354 return false;
355 }
356
357 public static boolean inZulrah(Interactable entity) {
358 for (Area zone : ZULRAH) {
359 if (zone.inArea(entity.getPosition())) {
360 return true;
361 }
362 }
363 return false;
364 }
365
366 public static boolean inPestControl(Interactable entity) {
367 for (Area zone : PEST_CONTROL_GAME) {
368 if (zone.inArea(entity.getPosition())) {
369 return true;
370 }
371 }
372 return false;
373 }
374 public static boolean inLMSGame(Interactable entity) {
375 for (Area zone : LMS_GAME) {
376 if (zone.inArea(entity.getPosition())) {
377 return true;
378 }
379 }
380 return false;
381 }
382
383 /* public static boolean inEventArena(Interactable entity) {
384 for (Area zone : EVENT_ARENA) {
385 if (zone.inArea(entity.getPosition())) {
386 return true;
387 }
388 }
389 return false;
390 }
391*/
392 public static boolean inPvP(Interactable entity) {
393 boolean pvp = false;
394 for (Area zone : SAFEZONE) {
395 if (zone.inArea(entity.getPosition())) {
396 pvp = true;
397 break;
398 }
399 }
400 return !pvp;
401 }
402
403 public static boolean inBandos(Mob mob) {
404 return BANDOS_ROOM.inArea(mob.getPosition());
405 }
406
407 private static boolean inSaradomin(Mob mob) {
408 return SARADOMIN_ROOM.inArea(mob.getPosition());
409 }
410
411 private static boolean inArmadyl(Mob mob) {
412 return ARMADYL_ROOM.inArea(mob.getPosition());
413 }
414
415 private static boolean inZamorak(Mob mob) {
416 return ZAMORAK_ROOM.inArea(mob.getPosition());
417 }
418
419 public static boolean inGodwarsChambers(Mob mob) {
420 return inBandos(mob) || inSaradomin(mob) || inArmadyl(mob) || inZamorak(mob);
421 }
422 public static boolean inRestrictedArea(Mob mob) {
423 return inGodwarsChambers(mob) || inCerberus(mob) || inBarbarianCourse(mob)
424 || inCyclops(mob) || inDuelArena(mob) || inDuelArenaLobby(mob) || inFightCaves(mob) || inDuelObsticleArena(mob)
425 || inGnomeCourse(mob) || inGodwars(mob) || inGodwarsChambers(mob) || inInferno(mob) || inKingBlackDragon(mob)
426 || inkolodionArena(mob) || inKraken(mob) || inLMSBuilding(mob) || inPestControl(mob) || inRFD(mob)
427 || inVorkath(mob) || inVorkath(mob) || inWilderness(mob) || inZulrah(mob) || inLMSGame(mob) || inLMSLobby(mob);
428 }
429
430
431 private static boolean inArea(Interactable interactable, Position bottomLeft, Position topRight) {
432 return (interactable.getPosition().getX() >= bottomLeft.getX())
433 && (interactable.getPosition().getX() <= topRight.getX())
434 && (interactable.getPosition().getY() >= bottomLeft.getY())
435 && (interactable.getPosition().getY() <= topRight.getY());
436 }
437
438 public static boolean inAllArea(Interactable entity, Area... area) {
439 for (Area zone : area) {
440 if (!zone.inArea(entity.getPosition())) {
441 return false;
442 }
443 }
444 return true;
445 }
446
447 public static boolean inAnyArea(Interactable entity, Area... area) {
448 for (Area zone : area) {
449 if (zone.inArea(entity.getPosition())) {
450 return true;
451 }
452 }
453 return false;
454 }
455
456
457 public abstract boolean inArea(Position position);
458
459 public abstract Position getRandomLocation();
460}
static final Area[] WILDERNESS_RESOURCE
Definition Area.java:72