1package com.runehive.content.lms;
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;
90 private static List<CustomGameObject>
storedObjects =
new ArrayList<>();
167 player.
message(
"The game has not started yet.");
171 if (target.
lmsImmunity > System.currentTimeMillis()) {
172 player.
message(target.
getUsername() +
" has temporary immunity from being attacked!");
176 if (target.
getCombat().isUnderAttack() && !target.
getCombat().isUnderAttackBy(player)) {
198 boolean upgradedKey = keyId == 20608;
213 else if (lootTable == 1)
236 if (loot == 22636 || loot == 299) amount = 1000;
251 if (loot == 11235) secondary = 11212;
252 else if(loot == 19481) secondary = 19484;
273 player.
message(
"You have received " + amount +
"x " +
ItemDefinition.
get(loot).
getName() +
". It has been added to " + (space ?
"your inventory" :
"the ground"));
311 List<Position> copySpawns =
new ArrayList<>();
314 gamePlayers.stream().filter(Objects::nonNull).forEach(player -> {
316 player.prayer.reset();
318 player.unlockedLMSItems =
new ArrayList<>();
328 Collections.shuffle(copySpawns);
330 player.move(copySpawns.get(randomPick));
331 copySpawns.remove(randomPick);
341 for(
int index = 0; index <
currentGameType.getSkills().length; index++) {
345 skill.setLevel(level);
346 skill.setMaxLevel(level);
347 skill.setExperience(
skill.getExperienceForLevel(level));
449 for(
int index = 0; index < player.
skills.
getSkills().length; index++) {
513 if(
safeZone.inSafeZone(player))
return;
519 int damage = (distanceX > distanceY) ? distanceY / 10 : distanceX / 10;
528 int fogStrength = (distanceX > distanceY) ? distanceY * 3 : distanceX * 3;
529 player.lastFogSent = fogStrength;
530 player.
send(
new SendLMSFog(fogStrength > 155 ? 155 : fogStrength));
561 gamePlayers.stream().filter(Objects::nonNull).forEach(player -> {
563 player.send(
new SendString(
"Kills: " + player.lmsKills, 44665));
574 killer.lmsImmunity = System.currentTimeMillis() + 20_000;
575 killer.runEnergy = 100;
584 killer.lmsPoints += 2;
586 killer.lmsPoints += 1;
601 if(def ==
null || !def.isPotion())
continue;
615 for (
int i = 6; i < loadout.
getInventory().length; i++) {
617 if(itemId == -1)
continue;
620 if(def ==
null || !def.isPotion())
continue;
640 if(containerSize != 0) {
641 for (
int i = 0; i < containerSize; i++) {
663 winner.
message(
"Congratulations! You've won the LMS Game!");
664 winner.
message(
"You have been awarded: @red@5 points@bla@ for your win!");
671 gameObject.unregister();
702 else if (remaining == 3 || remaining == 4)
704 else if (remaining >= 5 && remaining <= 9)
706 else if (remaining >= 10 && remaining <= 19)
The class that contains setting-related constants for the server.
static final int MAGIC_TAB
static void giveChestItems(int loot, int amount, Player player)
Handles giving the chest loot to the player by inventory or ground.
static Fog currentFog
The current fod within the LMS game.
static LMSCrate lmsCrate
The lms crate within the game.
static void updateInterface()
Handles updating the player's there interface.
static void processPlayer(Player player)
Handles processing the player if hes a active player within the LMS game.
static void handleFogDamage(Player player)
Handles the fog damage for a player.
static void rollChest(Player player, int keyId, boolean lootCrate)
Handles rolling the loot chest.
static LMSLoadout currentGameType
The current loadout of the game.
static boolean canAttack
Checks if the players are allowed to attack within the game.
static int getPointsForPlacement(int remaining)
The amount of points the player receives when the player leaves/dies.
static void moveToGame(List< Player > players)
Handles moving all the players to the game.
static String getGameTypeName()
static int crateTicks
The current amount of crate ticks within the lms game.
static int getItemAmountForItem(int loot)
Gets the amount of the item its supposed to drop when a player dies/logouts with there upgrades.
static boolean isActivePlayer(Player player)
Checks if a player is a active player within the LMS game.
static int getKeyId()
The key id the player gets after a kill.
static LMSSafezone safeZone
The current safe zone within the game.
static void resetLevels(Player player)
Handles resetting the copied stats to the player.
static void giveItems(Player player, boolean clear)
Handles giving the player correct inventory and equipment.
static List< Player > gamePlayers
All the players within the LMS game.
static boolean inGameArea(Player player)
Handles checking if the player is in the LMS game area.
static void resupplyKiller(Player player)
Handles resupplying the killer.
static void start()
Handles starting the lms game.
static int gameTicks
The current amount of game ticks within the lms game.
static List< Position > possible_spawns
All the possible spawns of the lms game.
static void onDeath(Player player, boolean forceRemove)
Handles when a player within the LMS game dies.
static int startingTicks
The amount of ticks before the real game starts.
static void setLevels(Player player)
Handles setting the correct stats of the player It also makes a copy of the player his stats.
static boolean gameInProgress
Checks if there is currently a game in progress.
static void handleFog()
Handles the fog closing in on the save zone.
static boolean canAttack(Player player, Player target)
Checks if the player is allowed to attack the target.
static void setupSafezone()
Handles setting up the safezone.
static void onKill(Player killer)
Handles the killers stuff.
static void reset(Player player)
Handles resetting the player that was in the game and either left by dying or other means.
static List< CustomGameObject > storedObjects
The safezone objects within the lms game.
static void gearUpPlayers()
Handles gearing up all the players.
abstract int[][] getRunePouchRunes()
abstract int[] getOffensiveItemUpgrades()
ItemContainer getEquipmentSetup()
abstract Spellbook getSpellbook()
abstract int[] getInventory()
ItemContainer getInventorySetup()
abstract int[] getOffensiveItem()
abstract int[] getDefensiveItem()
static List< LMSLoadout > getLmsLoadouts()
static final int defaultLobbyTime
static int maxPlayers
The max amount of players allowed in a single game.
static LMSLoadout currentGameType
The current game type.
static Position finish
The position the player gets put on when finishing a game.
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.
static final Graphic RESET
Represents the game world.
static void sendObjectAnimation(int animation, GameObject object)
Sends a world object animation.
A Hit object holds the damage amount and hitsplat data.
final SkillManager skills
final EnumSet< UpdateFlag > updateFlags
void animate(int animation)
final SkillManager skills_copy
void move(Position position)
Moves the mob to a set position.
void face(GameObject object)
Sets the client update flag to face a certain direction.
Optional< Graphic > graphic
void setSidebar(int tab, int id)
This class represents a character controlled by a player.
final Inventory inventory
List< Integer > unlockedLMSItems
void message(String message)
final Equipment equipment
final Equipment equipment_copy
String getName()
Gets the name of this entity.
final RunePouch runePouch_copy
int lastFogSent
LMS Variables.
transient long lmsImmunity
final Inventory inventory_copy
final InterfaceManager interfaceManager
void send(OutgoingPacket encoder)
Combat< Player > getCombat()
The combat of the mob.
final RunePouch runePouch
static void save(Player player)
void reset()
Iterates through the active prayers and disables them all.
Represents a trainable and usable skill.
void modifyLevel(Function< Integer, Integer > function)
Modifies the current level with a given function.
int getLevel()
Gets the current skill level.
int getMaxLevel()
Gets the maximum skill level.
static final int HITPOINTS
The hitpoints skill id.
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.
String getName()
Gets the item name.
The container class that represents an item that can be interacted with.
final int getId()
Gets the identification of this item.
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.
final void set(Item[] toSet)
void clear()
Removes all of the items from this container.
void updateAnimation()
Updates the weapon animation.
void refresh()
Forces a refresh of Equipment items to the EQUIPMENT_DISPLAY_ID widget.
void updateRangedEquipment()
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.
static boolean inMulti(Entity entity)
Created by Daniel on 2017-11-24.
static boolean isIn(Mob mob, Boundary... boundaries)
Represents a single tile on the game world.
int getY()
Gets the absolute y coordinate.
int getX()
Gets the absolute x coordinate.
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.
static int random(int bound)
int getInterfaceId()
Gets the sidebar interfaceId of this spellbook.
The enumerated type whose elements represent the hit icon of a Hit.
NONE
Represents no hit icon at all.
NORMAL
Represents a normal hit type.
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.