RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.content.lms.LMSGame Class Reference
Collaboration diagram for com.runehive.content.lms.LMSGame:

Static Public Member Functions

static boolean canAttack (Player player, Player target)
 Checks if the player is allowed to attack the target.
static int getKeyId ()
 The key id the player gets after a kill.
static void giveItems (Player player, boolean clear)
 Handles giving the player correct inventory and equipment.
static void handleFog ()
 Handles the fog closing in on the save zone.
static boolean inGameArea (Player player)
 Handles checking if the player is in the LMS game area.
static boolean isActivePlayer (Player player)
 Checks if a player is a active player within the LMS game.
static void moveToGame (List< Player > players)
 Handles moving all the players to the game.
static void onDeath (Player player, boolean forceRemove)
 Handles when a player within the LMS game dies.
static void onKill (Player killer)
 Handles the killers stuff.
static void processPlayer (Player player)
 Handles processing the player if hes a active player within the LMS game.
static void reset (Player player)
 Handles resetting the player that was in the game and either left by dying or other means.
static void resupplyKiller (Player player)
 Handles resupplying the killer.
static void rollChest (Player player, int keyId, boolean lootCrate)
 Handles rolling the loot chest.
static void setLevels (Player player)
 Handles setting the correct stats of the player It also makes a copy of the player his stats.
static void setupSafezone ()
 Handles setting up the safezone.
static void updateInterface ()
 Handles updating the player's there interface.

Static Public Attributes

static boolean canAttack = false
 Checks if the players are allowed to attack within the game.
static int crateTicks
 The current amount of crate ticks within the lms game.
static boolean gameInProgress
 Checks if there is currently a game in progress.
static List< PlayergamePlayers = new ArrayList<>()
 All the players within the LMS game.
static int gameTicks
 The current amount of game ticks within the lms game.
static LMSCrate lmsCrate
 The lms crate within the game.
static int startingTicks
 The amount of ticks before the real game starts.

Static Private Member Functions

static void gearUpPlayers ()
 Handles gearing up all the players.
static String getGameTypeName ()
static int getItemAmountForItem (int loot)
 Gets the amount of the item its supposed to drop when a player dies/logouts with there upgrades.
static int getPointsForPlacement (int remaining)
 The amount of points the player receives when the player leaves/dies.
static void giveChestItems (int loot, int amount, Player player)
 Handles giving the chest loot to the player by inventory or ground.
static void handleFogDamage (Player player)
 Handles the fog damage for a player.
static void resetLevels (Player player)
 Handles resetting the copied stats to the player.
static void start ()
 Handles starting the lms game.

Static Private Attributes

static Fog currentFog = new Fog(-1, -1, -1, -1)
 The current fod within the LMS game.
static LMSLoadout currentGameType
 The current loadout of the game.
static int lastFogCycle
static List< Positionpossible_spawns
 All the possible spawns of the lms game.
static LMSSafezone safeZone
 The current safe zone within the game.
static List< CustomGameObjectstoredObjects = new ArrayList<>()
 The safezone objects within the lms game.

Detailed Description

Definition at line 38 of file LMSGame.java.

Member Function Documentation

◆ canAttack()

boolean com.runehive.content.lms.LMSGame.canAttack ( Player player,
Player target )
static

Checks if the player is allowed to attack the target.

Parameters
player
target
Returns

Definition at line 161 of file LMSGame.java.

161 {
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 }
String getName()
Gets the name of this entity.
Definition Player.java:774
Combat< Player > getCombat()
The combat of the mob.
Definition Player.java:759

References canAttack, com.runehive.game.world.entity.mob.player.Player.getCombat(), com.runehive.game.world.entity.mob.player.Player.getName(), com.runehive.game.world.entity.mob.player.Player.getUsername(), inGameArea(), com.runehive.game.world.position.Area.inMulti(), com.runehive.game.world.entity.mob.player.Player.lmsImmunity, com.runehive.game.world.entity.mob.player.Player.message(), and com.runehive.game.world.entity.mob.player.Player.send().

Here is the call graph for this function:

◆ gearUpPlayers()

void com.runehive.content.lms.LMSGame.gearUpPlayers ( )
staticprivate

Handles gearing up all the players.

Definition at line 310 of file LMSGame.java.

310 {
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 }

References gamePlayers, giveItems(), possible_spawns, com.runehive.util.Utility.random(), and setLevels().

Referenced by start().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getGameTypeName()

String com.runehive.content.lms.LMSGame.getGameTypeName ( )
staticprivate

Definition at line 97 of file LMSGame.java.

97 {
98 return currentGameType.getClass().getSimpleName();
99 }

References currentGameType.

◆ getItemAmountForItem()

int com.runehive.content.lms.LMSGame.getItemAmountForItem ( int loot)
staticprivate

Gets the amount of the item its supposed to drop when a player dies/logouts with there upgrades.

Parameters
loot
Returns

Definition at line 682 of file LMSGame.java.

682 {
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 }

Referenced by onDeath(), and rollChest().

Here is the caller graph for this function:

◆ getKeyId()

int com.runehive.content.lms.LMSGame.getKeyId ( )
static

The key id the player gets after a kill.

Returns

Definition at line 716 of file LMSGame.java.

716 {
717 return gamePlayers.size() <= 4 ? 20608 : 20526;
718 }

References gamePlayers.

Referenced by onKill().

Here is the caller graph for this function:

◆ getPointsForPlacement()

int com.runehive.content.lms.LMSGame.getPointsForPlacement ( int remaining)
staticprivate

The amount of points the player receives when the player leaves/dies.

Parameters
remaining
Returns

Definition at line 699 of file LMSGame.java.

699 {
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 }

Referenced by onDeath().

Here is the caller graph for this function:

◆ giveChestItems()

void com.runehive.content.lms.LMSGame.giveChestItems ( int loot,
int amount,
Player player )
staticprivate

Handles giving the chest loot to the player by inventory or ground.

Parameters
loot
amount
player

Definition at line 265 of file LMSGame.java.

265 {
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 }
boolean add(Item item)
Attempts to deposit item into this container.

References com.runehive.game.world.items.containers.ItemContainer.add(), com.runehive.game.world.items.ground.GroundItem.create(), com.runehive.game.world.items.ItemDefinition.get(), com.runehive.game.world.items.containers.ItemContainer.getFreeSlots(), com.runehive.game.world.items.ItemDefinition.getName(), com.runehive.game.world.entity.mob.player.Player.inventory, and com.runehive.game.world.entity.mob.player.Player.message().

Referenced by rollChest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ giveItems()

void com.runehive.content.lms.LMSGame.giveItems ( Player player,
boolean clear )
static

Handles giving the player correct inventory and equipment.

Parameters
player
clear

Definition at line 358 of file LMSGame.java.

358 {
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();
369 player.interfaceManager.setSidebar(Config.MAGIC_TAB, player.spellbook.getInterfaceId());
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
391 player.updateFlags.add(UpdateFlag.APPEARANCE);
392 }
List< Item > runes
The runes stores in the rune pouch;.
final EnumSet< UpdateFlag > updateFlags
Definition Mob.java:94
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.
int getInterfaceId()
Gets the sidebar interfaceId of this spellbook.
val index

References com.runehive.game.world.entity.mob.UpdateFlag.APPEARANCE, com.runehive.content.skill.impl.magic.RunePouch.clear(), com.runehive.game.world.items.containers.equipment.Equipment.clear(), com.runehive.game.world.items.containers.ItemContainer.clear(), com.runehive.game.world.items.Item.clone(), currentGameType, com.runehive.game.world.entity.mob.player.Player.equipment, com.runehive.game.world.entity.combat.weapon.WeaponInterface.execute(), com.runehive.content.lms.loadouts.LMSLoadout.getEquipmentSetup(), com.runehive.content.skill.impl.magic.Spellbook.getInterfaceId(), com.runehive.content.lms.loadouts.LMSLoadout.getInventorySetup(), com.runehive.game.world.items.containers.ItemContainer.getItems(), com.runehive.content.lms.loadouts.LMSLoadout.getRunePouchRunes(), com.runehive.content.lms.loadouts.LMSLoadout.getSpellbook(), com.runehive.game.world.items.containers.equipment.Equipment.getWeapon(), com.runehive.game.world.entity.mob.player.Player.interfaceManager, com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.Config.MAGIC_TAB, com.runehive.content.skill.impl.magic.RunePouch.refresh(), com.runehive.game.world.items.containers.equipment.Equipment.refresh(), com.runehive.game.world.items.containers.inventory.Inventory.refresh(), com.runehive.game.world.entity.mob.player.Player.runePouch, com.runehive.content.skill.impl.magic.RunePouch.runes, com.runehive.game.world.items.containers.ItemContainer.set(), com.runehive.game.world.entity.mob.player.InterfaceManager.setSidebar(), com.runehive.game.world.entity.mob.player.Player.spellbook, com.runehive.game.world.items.containers.equipment.Equipment.updateAnimation(), com.runehive.game.world.entity.mob.Mob.updateFlags, and com.runehive.game.world.items.containers.equipment.Equipment.updateRangedEquipment().

Referenced by gearUpPlayers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ handleFog()

void com.runehive.content.lms.LMSGame.handleFog ( )
static

Handles the fog closing in on the save zone.

Definition at line 539 of file LMSGame.java.

539 {
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 }

References currentFog, lastFogCycle, and safeZone.

Referenced by com.runehive.content.lms.LMSGameEvent.execute().

Here is the caller graph for this function:

◆ handleFogDamage()

void com.runehive.content.lms.LMSGame.handleFogDamage ( Player player)
staticprivate

Handles the fog damage for a player.

Parameters
player

Definition at line 510 of file LMSGame.java.

510 {
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 }
int getDistances(Position other)
Absolute distance between this Coordiante and another.

References currentFog, com.runehive.game.world.entity.mob.Mob.damage(), gameTicks, com.runehive.game.world.position.Position.getDistances(), com.runehive.game.world.entity.Entity.getPosition(), com.runehive.game.world.position.Boundary.isIn(), com.runehive.game.world.entity.mob.player.Player.lastFogSent, com.runehive.game.world.entity.combat.hit.HitIcon.NONE, com.runehive.game.world.entity.combat.hit.Hitsplat.NORMAL, safeZone, and com.runehive.game.world.entity.mob.player.Player.send().

Referenced by processPlayer().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ inGameArea()

boolean com.runehive.content.lms.LMSGame.inGameArea ( Player player)
static

Handles checking if the player is in the LMS game area.

Parameters
player
Returns

Definition at line 142 of file LMSGame.java.

142 {
143 return Boundary.isIn(player, new Boundary(3390, 5757, 3524, 5901));
144 }

References com.runehive.game.world.position.Boundary.isIn().

Referenced by com.runehive.game.world.entity.skill.SkillManager.addExperience(), canAttack(), com.runehive.game.world.entity.combat.CombatUtil.canAttack(), com.runehive.game.world.entity.mob.player.PlayerDeath.death(), isActivePlayer(), com.runehive.game.world.entity.mob.player.Player.onStep(), and com.runehive.content.combat.Skulling.skull().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ isActivePlayer()

boolean com.runehive.content.lms.LMSGame.isActivePlayer ( Player player)
static

Checks if a player is a active player within the LMS game.

Parameters
player
Returns

Definition at line 151 of file LMSGame.java.

151 {
152 return gamePlayers != null && gamePlayers.contains(player) && inGameArea(player);
153 }

References gamePlayers, and inGameArea().

Referenced by com.runehive.content.lms.lobby.LMSLobby.joinLobby(), com.runehive.game.world.entity.mob.player.PlayerDeath.postDeath(), processPlayer(), com.runehive.content.skill.impl.magic.teleport.Teleportation.teleport(), and com.runehive.game.world.entity.mob.player.Player.unregister().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ moveToGame()

void com.runehive.content.lms.LMSGame.moveToGame ( List< Player > players)
static

Handles moving all the players to the game.

Parameters
players

Definition at line 280 of file LMSGame.java.

280 {
281 currentGameType = LMSLobby.currentGameType;
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 {
290 loadout = LMSLoadoutManager.getLmsLoadouts().get(Utility.random(LMSLoadoutManager.getLmsLoadouts().size()));
291 } while(!(loadout != LMSLobby.currentGameType));
292 LMSLobby.currentGameType = loadout;
293 }

References canAttack, currentGameType, com.runehive.content.lms.lobby.LMSLobby.currentGameType, gameInProgress, gamePlayers, com.runehive.content.lms.loadouts.LMSLoadoutManager.getLmsLoadouts(), com.runehive.util.Utility.random(), and start().

Referenced by com.runehive.content.lms.lobby.LMSLobbyEvent.execute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onDeath()

void com.runehive.content.lms.LMSGame.onDeath ( Player player,
boolean forceRemove )
static

Handles when a player within the LMS game dies.

Parameters
player
forceRemove

Definition at line 634 of file LMSGame.java.

634 {
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;
659 LMSLobbyEvent.lobbyTicks = LMSLobbyEvent.defaultLobbyTime;
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 }

References com.runehive.game.world.items.ground.GroundItem.create(), com.runehive.game.world.items.ground.GroundItem.createGlobal(), com.runehive.content.lms.lobby.LMSLobbyEvent.defaultLobbyTime, gameInProgress, gamePlayers, com.runehive.game.world.entity.mob.player.Player.getCombat(), getItemAmountForItem(), getPointsForPlacement(), lmsCrate, com.runehive.game.world.entity.mob.player.Player.lmsPoints, com.runehive.game.world.entity.mob.player.Player.lmsTotalDeaths, com.runehive.game.world.entity.mob.player.Player.lmsWins, com.runehive.content.lms.lobby.LMSLobbyEvent.lobbyTicks, com.runehive.game.world.entity.mob.player.Player.message(), reset(), storedObjects, and com.runehive.game.world.entity.mob.player.Player.unlockedLMSItems.

Referenced by com.runehive.game.world.entity.mob.player.PlayerDeath.postDeath(), and com.runehive.game.world.entity.mob.player.Player.unregister().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ onKill()

void com.runehive.content.lms.LMSGame.onKill ( Player killer)
static

Handles the killers stuff.

Parameters
killer

Definition at line 572 of file LMSGame.java.

572 {
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++;
581 updateInterface();
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 }
void modifyLevel(Function< Integer, Integer > function)
Modifies the current level with a given function.
Definition Skill.java:281
Skill get(int id)
Gets the skill for an id.
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.

References com.runehive.game.world.items.containers.ItemContainer.add(), com.runehive.game.world.items.ground.GroundItem.create(), com.runehive.game.world.entity.skill.SkillManager.get(), com.runehive.game.world.items.containers.ItemContainer.get(), com.runehive.game.world.items.ItemDefinition.get(), com.runehive.game.world.items.containers.ItemContainer.getFreeSlots(), com.runehive.game.world.items.Item.getId(), com.runehive.game.world.items.containers.ItemContainer.getItems(), getKeyId(), com.runehive.game.world.entity.skill.Skill.HITPOINTS, com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.game.world.entity.mob.player.Player.lmsKills, com.runehive.game.world.entity.mob.player.Player.lmsTotalKills, com.runehive.game.world.entity.skill.Skill.modifyLevel(), com.runehive.game.world.items.containers.ItemContainer.remove(), com.runehive.game.world.entity.combat.strategy.player.special.CombatSpecial.restore(), resupplyKiller(), com.runehive.game.world.entity.mob.Mob.skills, and updateInterface().

Referenced by com.runehive.game.world.entity.mob.player.PlayerDeath.death().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ processPlayer()

void com.runehive.content.lms.LMSGame.processPlayer ( Player player)
static

Handles processing the player if hes a active player within the LMS game.

Parameters
player

Definition at line 498 of file LMSGame.java.

498 {
499
500 if (!isActivePlayer(player))
501 return;
502
503 handleFogDamage(player);
504 }

References handleFogDamage(), and isActivePlayer().

Referenced by com.runehive.content.lms.LMSGameEvent.execute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

void com.runehive.content.lms.LMSGame.reset ( Player player)
static

Handles resetting the player that was in the game and either left by dying or other means.

Parameters
player

Definition at line 398 of file LMSGame.java.

398 {
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;
430 player.interfaceManager.setSidebar(Config.MAGIC_TAB, player.spellbook.getInterfaceId());
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);
439 updateInterface();
440 player.move(new Position(LMSLobby.finish.getX() + Utility.random(1), LMSLobby.finish.getY() + Utility.random(3), 0));
441 PlayerSerializer.save(player);
442 }
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
void reset()
Iterates through the active prayers and disables them all.

References com.runehive.game.world.entity.mob.Mob.animate(), com.runehive.game.world.entity.mob.player.PlayerOption.ATTACK, com.runehive.content.skill.impl.magic.RunePouch.clear(), com.runehive.game.world.items.containers.equipment.Equipment.clear(), com.runehive.game.world.items.containers.ItemContainer.clear(), com.runehive.game.world.items.Item.clone(), com.runehive.game.world.entity.mob.player.Player.equipment, com.runehive.game.world.entity.mob.player.Player.equipment_copy, com.runehive.game.world.entity.combat.weapon.WeaponInterface.execute(), com.runehive.game.world.entity.mob.Mob.face(), com.runehive.content.lms.lobby.LMSLobby.finish, gamePlayers, com.runehive.content.skill.impl.magic.Spellbook.getInterfaceId(), com.runehive.game.world.items.containers.ItemContainer.getItems(), com.runehive.game.world.items.containers.equipment.Equipment.getWeapon(), com.runehive.game.world.position.Position.getX(), com.runehive.game.world.position.Position.getY(), com.runehive.game.world.entity.mob.Mob.graphic, com.runehive.game.world.entity.mob.player.Player.interfaceManager, com.runehive.game.world.entity.mob.player.Player.inventory, com.runehive.game.world.entity.mob.player.Player.inventory_copy, com.runehive.Config.MAGIC_TAB, com.runehive.game.world.entity.mob.Mob.move(), com.runehive.game.world.entity.mob.Mob.prayer, com.runehive.util.Utility.random(), com.runehive.content.skill.impl.magic.RunePouch.refresh(), com.runehive.game.world.items.containers.equipment.Equipment.refresh(), com.runehive.game.world.items.containers.inventory.Inventory.refresh(), com.runehive.game.Animation.RESET, com.runehive.game.Graphic.RESET, com.runehive.game.world.entity.mob.prayer.PrayerBook.reset(), resetLevels(), com.runehive.game.world.entity.mob.player.Player.runePouch, com.runehive.game.world.entity.mob.player.Player.runePouch_copy, com.runehive.content.skill.impl.magic.RunePouch.runes, com.runehive.game.world.entity.mob.player.persist.PlayerSerializer.save(), com.runehive.game.world.entity.mob.player.Player.send(), com.runehive.game.world.items.containers.ItemContainer.set(), com.runehive.game.world.entity.mob.player.InterfaceManager.setSidebar(), com.runehive.game.world.entity.mob.Direction.SOUTH, com.runehive.game.world.entity.mob.player.Player.spellbook, com.runehive.game.world.entity.mob.player.Player.spellbook_copy, com.runehive.game.world.items.containers.equipment.Equipment.updateAnimation(), and updateInterface().

Referenced by onDeath().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resetLevels()

void com.runehive.content.lms.LMSGame.resetLevels ( Player player)
staticprivate

Handles resetting the copied stats to the player.

Parameters
player

Definition at line 448 of file LMSGame.java.

448 {
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 }
final SkillManager skills_copy
Definition Mob.java:97
void setMaxLevel(int maxLevel)
Sets the maximum level for this skill.
Definition Skill.java:250
void setExperience(double experience)
Sets the experience for this skill.
Definition Skill.java:259
int getLevel()
Gets the current skill level.
Definition Skill.java:205
void setLevel(int level)
Sets the level for this skill.
Definition Skill.java:241
static final int getExperienceForLevel(int level)
Gets the experience for a given level.
Definition Skill.java:454
int getMaxLevel()
Gets the maximum skill level.
Definition Skill.java:214
Skill[] getSkills()
Gets the skills of the mob.
void refresh()
Refreshes all the skills for the mob.

References com.runehive.game.world.entity.skill.SkillManager.get(), com.runehive.game.world.entity.skill.Skill.getLevel(), com.runehive.game.world.entity.skill.Skill.getMaxLevel(), com.runehive.game.world.entity.skill.SkillManager.getSkills(), com.runehive.game.world.entity.skill.SkillManager.refresh(), com.runehive.game.world.entity.mob.Mob.skills, and com.runehive.game.world.entity.mob.Mob.skills_copy.

Referenced by reset().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ resupplyKiller()

void com.runehive.content.lms.LMSGame.resupplyKiller ( Player player)
static

Handles resupplying the killer.

Parameters
player

Definition at line 613 of file LMSGame.java.

613 {
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 }

References com.runehive.game.world.items.containers.ItemContainer.add(), currentGameType, com.runehive.game.world.items.ItemDefinition.get(), com.runehive.game.world.items.containers.ItemContainer.getFreeSlots(), com.runehive.content.lms.loadouts.LMSLoadout.getInventory(), com.runehive.game.world.entity.mob.player.Player.inventory, and com.runehive.game.world.items.containers.inventory.Inventory.refresh().

Referenced by onKill().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ rollChest()

void com.runehive.content.lms.LMSGame.rollChest ( Player player,
int keyId,
boolean lootCrate )
static

Handles rolling the loot chest.

Parameters
player
keyId
lootCrate

Definition at line 192 of file LMSGame.java.

192 {
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 }
boolean contains(int id)
Determines if this container contains id.

References com.runehive.game.world.entity.mob.Mob.animate(), com.runehive.game.world.items.containers.ItemContainer.contains(), currentGameType, com.runehive.content.lms.loadouts.LMSLoadout.getDefensiveItem(), getItemAmountForItem(), com.runehive.content.lms.loadouts.LMSLoadout.getOffensiveItem(), com.runehive.content.lms.loadouts.LMSLoadout.getOffensiveItemUpgrades(), giveChestItems(), com.runehive.game.world.entity.mob.player.Player.inventory, lmsCrate, com.runehive.util.Utility.random(), com.runehive.game.world.items.containers.ItemContainer.remove(), rollChest(), com.runehive.game.world.World.sendObjectAnimation(), and com.runehive.game.world.entity.mob.player.Player.unlockedLMSItems.

Referenced by rollChest().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setLevels()

void com.runehive.content.lms.LMSGame.setLevels ( Player player)
static

Handles setting the correct stats of the player It also makes a copy of the player his stats.

Parameters
player

Definition at line 340 of file LMSGame.java.

340 {
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 }

References currentGameType, com.runehive.game.world.entity.skill.SkillManager.get(), com.runehive.game.world.entity.skill.SkillManager.refresh(), and com.runehive.game.world.entity.mob.Mob.skills.

Referenced by gearUpPlayers().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ setupSafezone()

void com.runehive.content.lms.LMSGame.setupSafezone ( )
static

Handles setting up the safezone.

Definition at line 464 of file LMSGame.java.

464 {
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);
490 updateInterface();
491 gamePlayers.stream().forEach(player -> player.send(new SendHintArrow(new Position(safeZone.boundsXSW + 5, safeZone.boundsYSW + 5, 0), 7)));
492 }

References com.runehive.util.StringUtils.capitalize(), currentFog, gamePlayers, com.runehive.util.Utility.random(), com.runehive.game.world.object.CustomGameObject.register(), safeZone, storedObjects, and updateInterface().

Referenced by com.runehive.content.lms.LMSGameEvent.execute().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ start()

void com.runehive.content.lms.LMSGame.start ( )
staticprivate

Handles starting the lms game.

Definition at line 298 of file LMSGame.java.

298 {
299 gearUpPlayers();
300 startingTicks = 10;
301 safeZone = null;
302 gameTicks = 0;
303 crateTicks = 0;
304 currentFog.reset();
305 }

References crateTicks, currentFog, gameTicks, gearUpPlayers(), safeZone, and startingTicks.

Referenced by moveToGame().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ updateInterface()

void com.runehive.content.lms.LMSGame.updateInterface ( )
static

Handles updating the player's there interface.

Definition at line 560 of file LMSGame.java.

560 {
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 }

References currentFog, gamePlayers, and com.runehive.content.lms.lobby.LMSLobby.maxPlayers.

Referenced by com.runehive.content.lms.LMSGameEvent.execute(), onKill(), reset(), and setupSafezone().

Here is the caller graph for this function:

Member Data Documentation

◆ canAttack

boolean com.runehive.content.lms.LMSGame.canAttack = false
static

Checks if the players are allowed to attack within the game.

Definition at line 53 of file LMSGame.java.

Referenced by canAttack(), com.runehive.game.world.entity.combat.CombatUtil.canAttack(), com.runehive.content.lms.LMSGameEvent.execute(), and moveToGame().

◆ crateTicks

int com.runehive.content.lms.LMSGame.crateTicks
static

The current amount of crate ticks within the lms game.

Definition at line 75 of file LMSGame.java.

Referenced by com.runehive.content.lms.LMSGameEvent.execute(), and start().

◆ currentFog

Fog com.runehive.content.lms.LMSGame.currentFog = new Fog(-1, -1, -1, -1)
staticprivate

The current fod within the LMS game.

Definition at line 58 of file LMSGame.java.

Referenced by handleFog(), handleFogDamage(), setupSafezone(), start(), and updateInterface().

◆ currentGameType

LMSLoadout com.runehive.content.lms.LMSGame.currentGameType
staticprivate

The current loadout of the game.

Definition at line 95 of file LMSGame.java.

Referenced by getGameTypeName(), giveItems(), moveToGame(), resupplyKiller(), rollChest(), and setLevels().

◆ gameInProgress

boolean com.runehive.content.lms.LMSGame.gameInProgress
static

◆ gamePlayers

List<Player> com.runehive.content.lms.LMSGame.gamePlayers = new ArrayList<>()
static

◆ gameTicks

int com.runehive.content.lms.LMSGame.gameTicks
static

The current amount of game ticks within the lms game.

Definition at line 65 of file LMSGame.java.

Referenced by com.runehive.content.lms.LMSGameEvent.execute(), handleFogDamage(), and start().

◆ lastFogCycle

int com.runehive.content.lms.LMSGame.lastFogCycle
staticprivate

Definition at line 60 of file LMSGame.java.

Referenced by handleFog().

◆ lmsCrate

LMSCrate com.runehive.content.lms.LMSGame.lmsCrate
static

The lms crate within the game.

Definition at line 80 of file LMSGame.java.

Referenced by com.runehive.content.lms.LMSGameEvent.execute(), onDeath(), and rollChest().

◆ possible_spawns

List<Position> com.runehive.content.lms.LMSGame.possible_spawns
staticprivate

All the possible spawns of the lms game.

Definition at line 104 of file LMSGame.java.

Referenced by gearUpPlayers().

◆ safeZone

LMSSafezone com.runehive.content.lms.LMSGame.safeZone
staticprivate

The current safe zone within the game.

Definition at line 85 of file LMSGame.java.

Referenced by handleFog(), handleFogDamage(), setupSafezone(), and start().

◆ startingTicks

int com.runehive.content.lms.LMSGame.startingTicks
static

The amount of ticks before the real game starts.

Definition at line 70 of file LMSGame.java.

Referenced by com.runehive.content.lms.LMSGameEvent.execute(), and start().

◆ storedObjects

List<CustomGameObject> com.runehive.content.lms.LMSGame.storedObjects = new ArrayList<>()
staticprivate

The safezone objects within the lms game.

Definition at line 90 of file LMSGame.java.

Referenced by onDeath(), and setupSafezone().


The documentation for this class was generated from the following file: