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