RuneHive-Game
Loading...
Searching...
No Matches
LMSGame.java
Go to the documentation of this file.
1package com.runehive.content.lms;
2
3import com.runehive.Config;
4import com.runehive.content.lms.crate.LMSCrate;
5import com.runehive.content.lms.fog.Fog;
6import com.runehive.content.lms.loadouts.LMSLoadout;
7import com.runehive.content.lms.loadouts.LMSLoadoutManager;
8import com.runehive.content.lms.lobby.LMSLobby;
9import com.runehive.content.lms.lobby.LMSLobbyEvent;
10import com.runehive.content.lms.safezone.LMSSafezone;
11import com.runehive.game.Animation;
12import com.runehive.game.Graphic;
13import com.runehive.game.world.World;
14import com.runehive.game.world.entity.combat.hit.Hit;
15import com.runehive.game.world.entity.combat.hit.HitIcon;
16import com.runehive.game.world.entity.combat.hit.Hitsplat;
17import com.runehive.game.world.entity.combat.strategy.player.special.CombatSpecial;
18import com.runehive.game.world.entity.combat.weapon.WeaponInterface;
19import com.runehive.game.world.entity.mob.Direction;
20import com.runehive.game.world.entity.mob.UpdateFlag;
21import com.runehive.game.world.entity.mob.player.Player;
22import com.runehive.game.world.entity.mob.player.PlayerOption;
23import com.runehive.game.world.entity.mob.player.persist.PlayerSerializer;
24import com.runehive.game.world.entity.skill.Skill;
25import com.runehive.game.world.items.Item;
26import com.runehive.game.world.items.ItemDefinition;
27import com.runehive.game.world.items.ground.GroundItem;
28import com.runehive.game.world.object.CustomGameObject;
29import com.runehive.game.world.position.Area;
30import com.runehive.game.world.position.Boundary;
31import com.runehive.game.world.position.Position;
32import com.runehive.net.packet.out.*;
33import com.runehive.util.StringUtils;
34import com.runehive.util.Utility;
35
36import java.util.*;
37
38public class LMSGame {
39
40 /**
41 * All the players within the LMS game
42 */
43 public static List<Player> gamePlayers = new ArrayList<>();
44
45 /**
46 * Checks if there is currently a game in progress
47 */
48 public static boolean gameInProgress;
49
50 /**
51 * Checks if the players are allowed to attack within the game
52 */
53 public static boolean canAttack = false;
54
55 /**
56 * The current fod within the LMS game
57 */
58 private static Fog currentFog = new Fog(-1, -1, -1, -1);
59
60 private static int lastFogCycle;
61
62 /**
63 * The current amount of game ticks within the lms game
64 */
65 public static int gameTicks;
66
67 /**
68 * The amount of ticks before the real game starts
69 */
70 public static int startingTicks;
71
72 /**
73 * The current amount of crate ticks within the lms game
74 */
75 public static int crateTicks;
76
77 /**
78 * The lms crate within the game
79 */
80 public static LMSCrate lmsCrate;
81
82 /**
83 * The current safe zone within the game
84 */
85 private static LMSSafezone safeZone;
86
87 /**
88 * The safezone objects within the lms game
89 */
90 private static List<CustomGameObject> storedObjects = new ArrayList<>();
91
92 /**
93 * The current loadout of the game
94 */
96
97 private static String getGameTypeName() {
98 return currentGameType.getClass().getSimpleName();
99 }
100
101 /**
102 * All the possible spawns of the lms game
103 */
104 private static List<Position> possible_spawns = Arrays.asList(
105 new Position(3399, 5766, 0),
106 new Position(3409, 5784, 0),
107 new Position(3401, 5774, 0),
108 new Position(3422, 5770, 0),
109 new Position(3453, 5816, 0),
110 new Position(3441, 5812, 0),
111 new Position(3433, 5804, 0),
112 new Position(3415, 5821, 0),
113 new Position(3402, 5832, 0),
114 new Position(3400, 5851, 0),
115 new Position(3410, 5865, 0),
116 new Position(3400, 5876, 0),
117 new Position(3423, 5872, 0),
118 new Position(3439, 5875, 0),
119 new Position(3451, 5859, 0),
120 new Position(3467, 5869, 0),
121 new Position(3466, 5819, 0),
122 new Position(3480, 5810, 0),
123 new Position(3495, 5801, 0),
124 new Position(3494, 5790, 0),
125 new Position(3511, 5790, 0),
126 new Position(3505, 5771, 0),
127 new Position(3513, 5766, 0),
128 new Position(3492, 5772, 0),
129 new Position(3460, 5787, 0),
130 new Position(3468, 5788, 0),
131 new Position(3476, 5796, 0),
132 new Position(3477, 5779, 0),
133 new Position(3491, 5773, 0)
134
135 );
136
137 /**
138 * Handles checking if the player is in the LMS game area
139 * @param player
140 * @return
141 */
142 public static boolean inGameArea(Player player) {
143 return Boundary.isIn(player, new Boundary(3390, 5757, 3524, 5901));
144 }
145
146 /**
147 * Checks if a player is a active player within the LMS game
148 * @param player
149 * @return
150 */
151 public static boolean isActivePlayer(Player player) {
152 return gamePlayers != null && gamePlayers.contains(player) && inGameArea(player);
153 }
154
155 /**
156 * Checks if the player is allowed to attack the target
157 * @param player
158 * @param target
159 * @return
160 */
161 public static boolean canAttack(Player player, Player target) {
162 if (!inGameArea(player)) {
163 return false;
164 }
165
166 if (!canAttack) {
167 player.message("The game has not started yet.");
168 return false;
169 }
170
171 if (target.lmsImmunity > System.currentTimeMillis()) {
172 player.message(target.getUsername() + " has temporary immunity from being attacked!");
173 return false;
174 }
175
176 if (target.getCombat().isUnderAttack() && !target.getCombat().isUnderAttackBy(player)) {
177 if (!Area.inMulti(player) || !Area.inMulti(target)) {
178 player.send(new SendMessage(target.getName() + " is currently in combat and can not be attacked."));
179 return false;
180 }
181 }
182
183 return true;
184 }
185
186 /**
187 * Handles rolling the loot chest
188 * @param player
189 * @param keyId
190 * @param lootCrate
191 */
192 public static void rollChest(Player player, int keyId, boolean lootCrate) {
193 if (player == null || !player.inventory.contains(keyId) && !lootCrate)
194 return;
195
196 LMSLoadout currentLoadout = currentGameType;
197
198 boolean upgradedKey = keyId == 20608;
199
200 int lootTable = Utility.random(1);
201
202 int loot = -1;
203
204 int amount = 1;
205
206 int maximumUnlocks = currentLoadout.getOffensiveItem().length + currentLoadout.getDefensiveItem().length + currentLoadout.getOffensiveItemUpgrades().length;
207
208 if (player.unlockedLMSItems.size() >= maximumUnlocks) return;
209
210 if (!upgradedKey) {
211 if (lootTable == 0)
212 loot = currentLoadout.getOffensiveItem()[Utility.random(currentLoadout.getOffensiveItem().length - 1)];
213 else if (lootTable == 1)
214 loot = currentLoadout.getDefensiveItem()[Utility.random(currentLoadout.getDefensiveItem().length - 1)];
215 } else
216 loot = currentLoadout.getOffensiveItemUpgrades()[Utility.random(currentLoadout.getOffensiveItemUpgrades().length - 1)];
217
218 //Handles duplicated items
219 if (player.unlockedLMSItems.contains(loot)) {
220 rollChest(player, keyId, lootCrate);
221 return;
222 }
223
224 player.unlockedLMSItems.add(loot);
225
226 //Add dragon arrows when its a dark bow
227 if (loot == 11235) player.unlockedLMSItems.add(11212);
228 //Add dragon javelins if its a balista
229 if (loot == 19481) player.unlockedLMSItems.add(19484);
230 //Add opal bolts e if its a arma cbow
231 //if (loot == 11785) player.unlockedLMSItems.add(8723);
232
233 if (!lootCrate) player.inventory.remove(keyId);
234
235 //Set the amount of certain items
236 if (loot == 22636 || loot == 299) amount = 1000;
237
238 giveChestItems(loot, amount, player);
239
240 if (lootCrate) {
241 player.animate(832);
242 World.sendObjectAnimation(86, lmsCrate.getLootCrate());
243 lmsCrate.destroy();
244 lmsCrate = null;
245 }
246
247 //Checks if the loot was javelins or dragon arrows
248
249 int secondary = -1;
250
251 if (loot == 11235) secondary = 11212;
252 else if(loot == 19481) secondary = 19484;
253 //else if(loot == 11785) secondary = 8723;
254
255 if(secondary != -1)
256 giveChestItems(secondary, getItemAmountForItem(secondary), player);
257 }
258
259 /**
260 * Handles giving the chest loot to the player by inventory or ground
261 * @param loot
262 * @param amount
263 * @param player
264 */
265 private static void giveChestItems(int loot, int amount, Player player) {
266 boolean space = player.inventory.getFreeSlots() > 0;
267
268 if (space) {
269 player.inventory.add(loot, amount);
270 } else
271 GroundItem.create(player, new Item(loot, amount));
272
273 player.message("You have received " + amount + "x " + ItemDefinition.get(loot).getName() + ". It has been added to " + (space ? "your inventory" : "the ground"));
274 }
275
276 /**
277 * Handles moving all the players to the game
278 * @param players
279 */
280 public static void moveToGame(List<Player> players) {
282 gamePlayers.addAll(players);
283 gameInProgress = true;
284 canAttack = false;
285 start();
286
287 //Handles setting a different loadout for next game
288 LMSLoadout loadout = null;
289 do {
291 } while(!(loadout != LMSLobby.currentGameType));
292 LMSLobby.currentGameType = loadout;
293 }
294
295 /**
296 * Handles starting the lms game
297 */
298 private static void start() {
300 startingTicks = 10;
301 safeZone = null;
302 gameTicks = 0;
303 crateTicks = 0;
304 currentFog.reset();
305 }
306
307 /**
308 * Handles gearing up all the players
309 */
310 private static void gearUpPlayers() {
311 List<Position> copySpawns = new ArrayList<>();
312 copySpawns.addAll(possible_spawns);
313
314 gamePlayers.stream().filter(Objects::nonNull).forEach(player -> {
315 //Turns of all the prayers
316 player.prayer.reset();
317 //Clears all unlocked items
318 player.unlockedLMSItems = new ArrayList<>();
319 //Toggles the fog on
320 player.send(new SendLMSFog(true));
321 //Sets the levels
322 setLevels(player);
323 //Gives the items & equipment
324 giveItems(player, false);
325 //Reset kills
326 player.lmsKills = 0;
327 //Pick a random spawn
328 Collections.shuffle(copySpawns);
329 int randomPick = Utility.random(copySpawns.size() - 1);
330 player.move(copySpawns.get(randomPick));
331 copySpawns.remove(randomPick);
332 });
333 }
334
335 /**
336 * Handles setting the correct stats of the player
337 * It also makes a copy of the player his stats
338 * @param player
339 */
340 public static void setLevels(Player player) {
341 for(int index = 0; index < currentGameType.getSkills().length; index++) {
342 int level = currentGameType.getSkills()[index];
343 Skill skill = player.skills.get(index);
344
345 skill.setLevel(level);
346 skill.setMaxLevel(level);
347 skill.setExperience(skill.getExperienceForLevel(level));
348 }
349
350 player.skills.refresh();
351 }
352
353 /**
354 * Handles giving the player correct inventory and equipment
355 * @param player
356 * @param clear
357 */
358 public static void giveItems(Player player, boolean clear) {
359 LMSLoadout loadout = currentGameType;
360
361 if(clear) {
362 player.equipment.clear();
363 player.inventory.clear();
364 player.runePouch.clear();
365 }
366
367 //Handles setting the correct spellbook
368 player.spellbook = loadout.getSpellbook();
370
371 //Handles setting up the inventory
372 player.inventory.set(loadout.getInventorySetup().getItems().clone());
373
374 //Handles setting up the equipment
375 player.equipment.clear();
376 player.equipment.set(loadout.getEquipmentSetup().getItems().clone());
377 player.equipment.updateAnimation();
378 WeaponInterface.execute(player, player.equipment.getWeapon());
379
380 //Handles the rune pouch
381 for(int index = 0; index < loadout.getRunePouchRunes().length; index++)
382 player.runePouch.runes.add(new Item(loadout.getRunePouchRunes()[index][0], loadout.getRunePouchRunes()[index][1]));
383
384 player.inventory.refresh();
385 player.equipment.refresh();
387 player.runePouch.refresh();
388
389
390 //Call the appearance update flag
392 }
393
394 /**
395 * Handles resetting the player that was in the game and either left by dying or other means
396 * @param player
397 */
398 public static void reset(Player player) {
399 player.send(new SendHintArrow(0));
400
401 player.face(Direction.SOUTH);
402 player.equipment.updateAnimation();
403 player.animate(Animation.RESET, true);
404 player.graphic(Graphic.RESET, true);
405
406 player.inventory.clear();
407 player.equipment.clear();
408 player.runePouch.clear(false);
409
410 player.inventory.set(player.inventory_copy.getItems().clone());
411
412 player.equipment.set(player.equipment_copy.getItems().clone());
413 for(int index = 0; index < player.runePouch_copy.runes.size(); index++)
414 player.runePouch.runes.add(player.runePouch_copy.runes.get(index));
415 player.equipment.updateAnimation();
416 WeaponInterface.execute(player, player.equipment.getWeapon());
417
418
419 //Handles clearing the copies of the containers
420 player.inventory_copy.clear();
421 player.equipment_copy.clear();
422 player.runePouch_copy.clear(false);
423
424 player.inventory.refresh();
425 player.equipment.refresh();
426 player.runePouch.refresh();
427
428 //Handles reseting the spellbook
429 player.spellbook = player.spellbook_copy;
431
432 player.prayer.reset();
433 player.send(new SendPlayerOption(PlayerOption.ATTACK, false, true));
434
435 resetLevels(player);
436 player.send(new SendLMSFog(false));
437 if (gamePlayers.contains(player))
438 gamePlayers.remove(player);
441 PlayerSerializer.save(player);
442 }
443
444 /**
445 * Handles resetting the copied stats to the player
446 * @param player
447 */
448 private static void resetLevels(Player player) {
449 for(int index = 0; index < player.skills.getSkills().length; index++) {
450 Skill skill = player.skills.get(index);
451 Skill copy_skill = player.skills_copy.get(index);
452
453 skill.setLevel(copy_skill.getLevel());
454 skill.setMaxLevel(copy_skill.getMaxLevel());
455 skill.setExperience(skill.getExperienceForLevel(copy_skill.getLevel()));
456 }
457
458 player.skills.refresh();
459 }
460
461 /**
462 * Handles setting up the safezone
463 */
464 public static void setupSafezone() {
465 safeZone = LMSSafezone.values()[Utility.random(LMSSafezone.values().length - 1)];
466 gamePlayers.stream().forEach(player -> player.message("@red@Fog approaching. Get to the safezone at "+ StringUtils.capitalize(safeZone.name().toLowerCase().replaceAll("_", " ")+"!")));
467
468 for (int i = safeZone.boundsYSW; i < safeZone.boundsYSW + 10; i++) {
469 CustomGameObject gameObject = new CustomGameObject(34905, new Position(safeZone.boundsXSW, i));
470 gameObject.register();
471 storedObjects.add(gameObject);
472 }
473 for (int i = safeZone.boundsXSW; i < safeZone.boundsXSW + 10; i++) {
474 CustomGameObject gameObject = new CustomGameObject(34905, new Position(i, safeZone.boundsYSW));
475 gameObject.register();
476 storedObjects.add(gameObject);
477 }
478 for (int i = safeZone.boundsXNE - 10; i < safeZone.boundsXNE; i++) {
479 CustomGameObject gameObject = new CustomGameObject(34905, new Position(i, safeZone.boundsYNE));
480 gameObject.register();
481 storedObjects.add(gameObject);
482 }
483 for (int i = safeZone.boundsYNE - 10; i <= safeZone.boundsYNE; i++) {
484 CustomGameObject gameObject = new CustomGameObject(34905, new Position(safeZone.boundsXNE, i));
485 gameObject.register();
486 storedObjects.add(gameObject);
487 }
488
489 currentFog = new Fog(safeZone.boundsXSW - 100, safeZone.boundsYSW - 100, safeZone.boundsXNE + 100, safeZone.boundsYNE + 100);
491 gamePlayers.stream().forEach(player -> player.send(new SendHintArrow(new Position(safeZone.boundsXSW + 5, safeZone.boundsYSW + 5, 0), 7)));
492 }
493
494 /**
495 * Handles processing the player if hes a active player within the LMS game
496 * @param player
497 */
498 public static void processPlayer(Player player) {
499
500 if (!isActivePlayer(player))
501 return;
502
503 handleFogDamage(player);
504 }
505
506 /**
507 * Handles the fog damage for a player
508 * @param player
509 */
510 private static void handleFogDamage(Player player) {
511 if(safeZone == null) return;
512
513 if(safeZone.inSafeZone(player)) return;
514
515 if(!Boundary.isIn(player, new Boundary(currentFog.getLowX(), currentFog.getLowY(), currentFog.getHighX(), currentFog.getHighY()))) {
516 int distanceX = player.getPosition().getDistances(new Position(currentFog.getLowX(), currentFog.getLowY()));
517 int distanceY = player.getPosition().getDistances(new Position(currentFog.getHighX(), currentFog.getHighY()));
518
519 int damage = (distanceX > distanceY) ? distanceY / 10 : distanceX / 10;
520 if (damage <= 0)
521 damage = 1;
522
523 if (gameTicks > 600)
524 damage *= 2;
525 else if (gameTicks > 900)
526 damage *= 3;
527
528 int fogStrength = (distanceX > distanceY) ? distanceY * 3 : distanceX * 3;
529 player.lastFogSent = fogStrength;
530 player.send(new SendLMSFog(fogStrength > 155 ? 155 : fogStrength));
531 player.damage(new Hit(damage > 10 ? 10 : damage, Hitsplat.NORMAL, HitIcon.NONE, true));
532 } else if (player.lastFogSent != 0)
533 player.send(new SendLMSFog(0));
534 }
535
536 /**
537 * Handles the fog closing in on the save zone
538 */
539 public static void handleFog() {
540 lastFogCycle++;
541 if (lastFogCycle == 10) {
542 if (currentFog == null) {
543 lastFogCycle = 0;
544 return;
545 }
546
547 if (safeZone.boundsXSW == currentFog.getLowX() && safeZone.boundsYSW == currentFog.getLowY() && safeZone.boundsXNE == currentFog.getHighX() && safeZone.boundsYNE == currentFog.getHighY()) {
548 lastFogCycle = 0;
549 return;
550 }
551
552 currentFog.decrease();
553 lastFogCycle = 0;
554 }
555 }
556
557 /**
558 * Handles updating the player's there interface
559 */
560 public static void updateInterface() {
561 gamePlayers.stream().filter(Objects::nonNull).forEach(player -> {
562 player.send(new SendString("Survivors: " + gamePlayers.size() + "/" + LMSLobby.maxPlayers, 44664));
563 player.send(new SendString("Kills: " + player.lmsKills, 44665));
564 player.send(new SendString("Fog: " + (currentFog.isSafe() ? "Safe" : "Approaching"), 44666));
565 });
566 }
567
568 /**
569 * Handles the killers stuff
570 * @param killer
571 */
572 public static void onKill(Player killer) {
573
574 killer.lmsImmunity = System.currentTimeMillis() + 20_000;
575 killer.runEnergy = 100;
576 CombatSpecial.restore(killer, 100);
577 killer.skills.get(Skill.HITPOINTS).modifyLevel(level -> level + 99, 0, 99);
578
579 killer.lmsKills++;
580 killer.lmsTotalKills++;
582
583 if (killer.lmsKills == 5)
584 killer.lmsPoints += 2;
585 else if (killer.lmsKills == 3)
586 killer.lmsPoints += 1;
587
588 boolean inventory = killer.inventory.getFreeSlots() > 0;
589
590 Item key = new Item(getKeyId(), 1);
591 if (inventory)
592 killer.inventory.add(key);
593 else
594 GroundItem.create(killer, key);
595
596 for(int index = 0; index < killer.inventory.getItems().length; index++) {
597 if(killer.inventory.get(index) == null) continue;
598 Item potion = killer.inventory.get(index);
599
600 ItemDefinition def = ItemDefinition.get(potion.getId());
601 if(def == null || !def.isPotion()) continue;
602
603 killer.inventory.remove(potion);
604 }
605
606 resupplyKiller(killer);
607 }
608
609 /**
610 * Handles resupplying the killer
611 * @param player
612 */
613 public static void resupplyKiller(Player player) {
614 LMSLoadout loadout = currentGameType;
615 for (int i = 6; i < loadout.getInventory().length; i++) {
616 int itemId = loadout.getInventory()[i];
617 if(itemId == -1) continue;
618
619 ItemDefinition def = ItemDefinition.get(itemId);
620 if(def == null || !def.isPotion()) continue;
621
622 player.inventory.add(itemId, 1);
623 }
624 player.inventory.add(385, player.inventory.getFreeSlots());
625
626 player.inventory.refresh();
627 }
628
629 /**
630 * Handles when a player within the LMS game dies
631 * @param player
632 * @param forceRemove
633 */
634 public static void onDeath(Player player, boolean forceRemove) {
635 player.lmsTotalDeaths++;
636 if (!forceRemove) {
637 Player killer = (Player) player.getCombat().getDamageCache().calculateProperKiller().orElse(null);
638
639 int containerSize = player.unlockedLMSItems.size();
640 if(containerSize != 0) {
641 for (int i = 0; i < containerSize; i++) {
642 int itemId = player.unlockedLMSItems.get(i);
643 Item item = new Item(itemId, getItemAmountForItem(itemId));
644 if (killer == null)
645 GroundItem.createGlobal(player, item);
646 else
647 GroundItem.create(killer, item);
648 }
649 }
650
651 player.lmsPoints += getPointsForPlacement(gamePlayers.size());
652 player.message("You have been awarded: @red@"+getPointsForPlacement(gamePlayers.size())+" @bla@points for placing @red@#"+gamePlayers.size());
653 }
654
655 reset(player);
656
657 if(gamePlayers.size() == 1) {
658 gameInProgress = false;
660 Player winner = gamePlayers.get(0);
661 winner.lmsPoints+= 5;
662 winner.lmsWins++;
663 winner.message("Congratulations! You've won the LMS Game!");
664 winner.message("You have been awarded: @red@5 points@bla@ for your win!");
665 reset(winner);
666 if (lmsCrate != null) {
667 lmsCrate.destroy();
668 lmsCrate = null;
669 }
670 for(CustomGameObject gameObject : storedObjects)
671 gameObject.unregister();
672 storedObjects.clear();
673 gamePlayers.clear();
674 }
675 }
676
677 /**
678 * Gets the amount of the item its supposed to drop when a player dies/logouts with there upgrades
679 * @param loot
680 * @return
681 */
682 private static int getItemAmountForItem(int loot) {
683 switch(loot){
684 case 22636:
685 case 299:
686 case 11212:
687 case 19481:
688 return 1000;
689 default:
690 return 1;
691 }
692 }
693
694 /**
695 * The amount of points the player receives when the player leaves/dies
696 * @param remaining
697 * @return
698 */
699 private static int getPointsForPlacement(int remaining) {
700 if (remaining == 2)
701 return 4;
702 else if (remaining == 3 || remaining == 4)
703 return 3;
704 else if (remaining >= 5 && remaining <= 9)
705 return 2;
706 else if (remaining >= 10 && remaining <= 19)
707 return 1;
708
709 return 0;
710 }
711
712 /**
713 * The key id the player gets after a kill
714 * @return
715 */
716 public static int getKeyId() {
717 return gamePlayers.size() <= 4 ? 20608 : 20526;
718 }
719}
The class that contains setting-related constants for the server.
Definition Config.java:24
static final int MAGIC_TAB
Definition Config.java:194
static void giveChestItems(int loot, int amount, Player player)
Handles giving the chest loot to the player by inventory or ground.
Definition LMSGame.java:265
static Fog currentFog
The current fod within the LMS game.
Definition LMSGame.java:58
static LMSCrate lmsCrate
The lms crate within the game.
Definition LMSGame.java:80
static void updateInterface()
Handles updating the player's there interface.
Definition LMSGame.java:560
static void processPlayer(Player player)
Handles processing the player if hes a active player within the LMS game.
Definition LMSGame.java:498
static void handleFogDamage(Player player)
Handles the fog damage for a player.
Definition LMSGame.java:510
static void rollChest(Player player, int keyId, boolean lootCrate)
Handles rolling the loot chest.
Definition LMSGame.java:192
static LMSLoadout currentGameType
The current loadout of the game.
Definition LMSGame.java:95
static boolean canAttack
Checks if the players are allowed to attack within the game.
Definition LMSGame.java:53
static int getPointsForPlacement(int remaining)
The amount of points the player receives when the player leaves/dies.
Definition LMSGame.java:699
static void moveToGame(List< Player > players)
Handles moving all the players to the game.
Definition LMSGame.java:280
static String getGameTypeName()
Definition LMSGame.java:97
static int crateTicks
The current amount of crate ticks within the lms game.
Definition LMSGame.java:75
static int getItemAmountForItem(int loot)
Gets the amount of the item its supposed to drop when a player dies/logouts with there upgrades.
Definition LMSGame.java:682
static boolean isActivePlayer(Player player)
Checks if a player is a active player within the LMS game.
Definition LMSGame.java:151
static int getKeyId()
The key id the player gets after a kill.
Definition LMSGame.java:716
static LMSSafezone safeZone
The current safe zone within the game.
Definition LMSGame.java:85
static void resetLevels(Player player)
Handles resetting the copied stats to the player.
Definition LMSGame.java:448
static void giveItems(Player player, boolean clear)
Handles giving the player correct inventory and equipment.
Definition LMSGame.java:358
static List< Player > gamePlayers
All the players within the LMS game.
Definition LMSGame.java:43
static boolean inGameArea(Player player)
Handles checking if the player is in the LMS game area.
Definition LMSGame.java:142
static void resupplyKiller(Player player)
Handles resupplying the killer.
Definition LMSGame.java:613
static void start()
Handles starting the lms game.
Definition LMSGame.java:298
static int gameTicks
The current amount of game ticks within the lms game.
Definition LMSGame.java:65
static List< Position > possible_spawns
All the possible spawns of the lms game.
Definition LMSGame.java:104
static void onDeath(Player player, boolean forceRemove)
Handles when a player within the LMS game dies.
Definition LMSGame.java:634
static int startingTicks
The amount of ticks before the real game starts.
Definition LMSGame.java:70
static void setLevels(Player player)
Handles setting the correct stats of the player It also makes a copy of the player his stats.
Definition LMSGame.java:340
static boolean gameInProgress
Checks if there is currently a game in progress.
Definition LMSGame.java:48
static void handleFog()
Handles the fog closing in on the save zone.
Definition LMSGame.java:539
static boolean canAttack(Player player, Player target)
Checks if the player is allowed to attack the target.
Definition LMSGame.java:161
static void setupSafezone()
Handles setting up the safezone.
Definition LMSGame.java:464
static void onKill(Player killer)
Handles the killers stuff.
Definition LMSGame.java:572
static void reset(Player player)
Handles resetting the player that was in the game and either left by dying or other means.
Definition LMSGame.java:398
static List< CustomGameObject > storedObjects
The safezone objects within the lms game.
Definition LMSGame.java:90
static void gearUpPlayers()
Handles gearing up all the players.
Definition LMSGame.java:310
static int maxPlayers
The max amount of players allowed in a single game.
Definition LMSLobby.java:38
static LMSLoadout currentGameType
The current game type.
Definition LMSLobby.java:43
static Position finish
The position the player gets put on when finishing a game.
Definition LMSLobby.java:23
List< Item > runes
The runes stores in the rune pouch;.
Class that models a single animation used by an entity.
static final Animation RESET
Represents a single graphic that can be used by entities.
Definition Graphic.java:10
static final Graphic RESET
Definition Graphic.java:17
Represents the game world.
Definition World.java:46
static void sendObjectAnimation(int animation, GameObject object)
Sends a world object animation.
Definition World.java:284
A Hit object holds the damage amount and hitsplat data.
Definition Hit.java:10
final EnumSet< UpdateFlag > updateFlags
Definition Mob.java:94
final SkillManager skills_copy
Definition Mob.java:97
void move(Position position)
Moves the mob to a set position.
Definition Mob.java:340
void face(GameObject object)
Sets the client update flag to face a certain direction.
Definition Mob.java:289
Optional< Graphic > graphic
Definition Mob.java:91
This class represents a character controlled by a player.
Definition Player.java:125
String getName()
Gets the name of this entity.
Definition Player.java:774
Combat< Player > getCombat()
The combat of the mob.
Definition Player.java:759
void reset()
Iterates through the active prayers and disables them all.
Represents a trainable and usable skill.
Definition Skill.java:18
void modifyLevel(Function< Integer, Integer > function)
Modifies the current level with a given function.
Definition Skill.java:281
int getLevel()
Gets the current skill level.
Definition Skill.java:205
int getMaxLevel()
Gets the maximum skill level.
Definition Skill.java:214
static final int HITPOINTS
The hitpoints skill id.
Definition Skill.java:30
Skill[] getSkills()
Gets the skills of the mob.
Skill get(int id)
Gets the skill for an id.
void refresh()
Refreshes all the skills for the mob.
Represents all of an in-game Item's attributes.
static ItemDefinition get(int id)
Gets an item definition.
The container class that represents an item that can be interacted with.
Definition Item.java:21
final int getId()
Gets the identification of this item.
Definition Item.java:324
boolean remove(Item item)
Attempts to withdraw item from this container.
final Item get(int index)
Gets the Item located on index.
boolean add(Item item)
Attempts to deposit item into this container.
boolean contains(int id)
Determines if this container contains id.
void clear()
Removes all of the items from this container.
void clear()
Removes all of the items from this container.
void refresh()
Forces a refresh of Equipment items to the EQUIPMENT_DISPLAY_ID widget.
void refresh()
Refreshes the players inventory.
Represents a single Ground item on the world map.
static GroundItem create(Player player, Item item)
Creates a new GroundItem object for a player and an item.
static void createGlobal(Player player, Item item)
Creates a new GroundItem object for a player and an item.
Represents a static game object loaded from the map fs.
void register()
Registers an entity to the World.
Handles checking if mobs are in a certain area.
Definition Area.java:13
static boolean inMulti(Entity entity)
Definition Area.java:263
Created by Daniel on 2017-11-24.
Definition Boundary.java:12
static boolean isIn(Mob mob, Boundary... boundaries)
Definition Boundary.java:49
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
int getDistances(Position other)
Absolute distance between this Coordiante and another.
The OutgoingPacket that sends a message to a Players chatbox in the client.
Shows a player options such as right clicking a player.
The OutgoingPacket that sends a string to a Players itemcontainer in the client.
static String capitalize(String string)
Handles miscellaneous methods.
Definition Utility.java:27
static int random(int bound)
Definition Utility.java:239
int getInterfaceId()
Gets the sidebar interfaceId of this spellbook.
The enumerated type whose elements represent the hit icon of a Hit.
Definition HitIcon.java:8
The enumerated type whose elements represent the combat special attacks.
static void restore(Player player, int amount)
Restores the special bar for player.
The enumerated type whose elements represent the weapon interfaces.
static void execute(Player player, Item item)
The method executed when weapon item is equipped or unequipped that assigns a weapon interface to pla...
Represents the enumerated directions an entity can walk or face.
Represents the options for right-clicking players.
ATTACK
The option for attacking another player.