1package com.runehive.game.world.entity.mob.player;
3import com.runehive.Config;
4import com.runehive.content.ActivityLog;
5import com.runehive.content.ActivityLogger;
6import com.runehive.content.achievement.AchievementKey;
7import com.runehive.content.activity.Activity;
8import com.runehive.content.activity.impl.barrows.BrotherData;
9import com.runehive.content.activity.record.PlayerRecord;
10import com.runehive.content.bags.impl.CoalBag;
11import com.runehive.content.bags.impl.GemBag;
12import com.runehive.content.clanchannel.channel.ClanChannel;
13import com.runehive.content.clanchannel.channel.ClanChannelHandler;
14import com.runehive.content.clanchannel.content.ClanViewer;
15import com.runehive.content.collectionlog.CollectionLog;
16import com.runehive.content.collectionlog.CollectionLogData;
17import com.runehive.content.collectionlog.CollectionLogPage;
18import com.runehive.content.collectionlog.CollectionLogSaving;
19import com.runehive.content.combat.Killstreak;
20import com.runehive.content.combat.Skulling;
21import com.runehive.content.dailyeffect.DailyEffect;
22import com.runehive.content.dailyeffect.impl.DailySlayerTaskSkip;
23import com.runehive.content.dailyeffect.impl.DailySlayerTaskTeleport;
24import com.runehive.content.dailyeffect.impl.DailySpellBookSwap;
25import com.runehive.content.dialogue.ChatBoxItemDialogue;
26import com.runehive.content.dialogue.Dialogue;
27import com.runehive.content.dialogue.DialogueFactory;
28import com.runehive.content.dialogue.OptionDialogue;
29import com.runehive.content.donators.Donation;
30import com.runehive.content.emote.EmoteUnlockable;
31import com.runehive.content.event.EventDispatcher;
32import com.runehive.content.event.impl.LogInEvent;
33import com.runehive.content.gambling.GambleManager;
34import com.runehive.content.lms.LMSGame;
35import com.runehive.content.lms.lobby.LMSLobby;
36import com.runehive.content.lms.lobby.LMSLobbyEvent;
37import com.runehive.content.mysterybox.MysteryBoxManager;
38import com.runehive.content.overrides.Overrides;
39import com.runehive.content.pet.PetData;
40import com.runehive.content.pet.Pets;
41import com.runehive.content.preset.PresetManager;
42import com.runehive.content.prestige.Prestige;
43import com.runehive.content.puzzle.PuzzleDisplay;
44import com.runehive.content.skill.impl.construction.House;
45import com.runehive.content.skill.impl.farming.Farming;
46import com.runehive.content.skill.impl.hunter.birdhouse.PlayerBirdHouseData;
47import com.runehive.content.skill.impl.hunter.trap.TrapManager;
48import com.runehive.content.skill.impl.magic.RunePouch;
49import com.runehive.content.skill.impl.magic.Spellbook;
50import com.runehive.content.skill.impl.magic.spell.SpellCasting;
51import com.runehive.content.skill.impl.runecrafting.RunecraftPouch;
52import com.runehive.content.skill.impl.slayer.Slayer;
53import com.runehive.content.store.impl.PersonalStore;
54import com.runehive.content.teleport.Teleport;
55import com.runehive.content.tittle.PlayerTitle;
56import com.runehive.content.tradingpost.TradingPost;
57import com.runehive.game.event.impl.MovementEvent;
58import com.runehive.game.plugin.PluginManager;
59import com.runehive.game.service.Highscores;
60import com.runehive.game.task.impl.PvPTimerTask;
61import com.runehive.game.task.impl.TeleblockTask;
62import com.runehive.game.world.World;
63import com.runehive.game.world.entity.EntityType;
64import com.runehive.game.world.entity.combat.Combat;
65import com.runehive.game.world.entity.combat.CombatConstants;
66import com.runehive.game.world.entity.combat.attack.FightType;
67import com.runehive.game.world.entity.combat.effect.AntifireDetails;
68import com.runehive.game.world.entity.combat.magic.CombatSpell;
69import com.runehive.game.world.entity.combat.ranged.RangedAmmunition;
70import com.runehive.game.world.entity.combat.ranged.RangedWeaponDefinition;
71import com.runehive.game.world.entity.combat.strategy.CombatStrategy;
72import com.runehive.game.world.entity.combat.strategy.player.special.CombatSpecial;
73import com.runehive.game.world.entity.combat.weapon.WeaponInterface;
74import com.runehive.game.world.entity.mob.Mob;
75import com.runehive.game.world.entity.mob.UpdateFlag;
76import com.runehive.game.world.entity.mob.Viewport;
77import com.runehive.game.world.entity.mob.movement.waypoint.PickupWaypoint;
78import com.runehive.game.world.entity.mob.movement.waypoint.Waypoint;
79import com.runehive.game.world.entity.mob.npc.Npc;
80import com.runehive.game.world.entity.mob.player.appearance.Appearance;
81import com.runehive.game.world.entity.mob.player.exchange.ExchangeSessionManager;
82import com.runehive.game.world.entity.mob.player.relations.ChatMessage;
83import com.runehive.game.world.entity.mob.player.relations.PlayerRelation;
84import com.runehive.game.world.entity.mob.player.requests.PlayerPunishment;
85import com.runehive.game.world.entity.mob.player.requests.RequestManager;
86import com.runehive.game.world.entity.mob.prayer.Prayer;
87import com.runehive.game.world.entity.mob.prayer.PrayerBook;
88import com.runehive.game.world.items.Item;
89import com.runehive.game.world.items.containers.bank.Bank;
90import com.runehive.game.world.items.containers.bank.BankPin;
91import com.runehive.game.world.items.containers.bank.BankVault;
92import com.runehive.game.world.items.containers.bank.DonatorDeposit;
93import com.runehive.game.world.items.containers.equipment.Equipment;
94import com.runehive.game.world.items.containers.impl.LootingBag;
95import com.runehive.game.world.items.containers.impl.LostUntradeables;
96import com.runehive.game.world.items.containers.inventory.Inventory;
97import com.runehive.game.world.items.containers.pricechecker.PriceChecker;
98import com.runehive.game.world.object.CustomGameObject;
99import com.runehive.game.world.object.ObjectDirection;
100import com.runehive.game.world.object.ObjectType;
101import com.runehive.game.world.position.Area;
102import com.runehive.game.world.position.Boundary;
103import com.runehive.game.world.position.Position;
104import com.runehive.game.world.region.Region;
105import com.runehive.net.packet.OutgoingPacket;
106import com.runehive.net.packet.out.*;
107import com.runehive.net.session.GameSession;
108import com.runehive.util.*;
109import org.apache.logging.log4j.LogManager;
110import org.apache.logging.log4j.Logger;
111import org.jire.runehiveps.event.Events;
114import java.util.concurrent.TimeUnit;
115import java.util.concurrent.atomic.AtomicBoolean;
116import java.util.concurrent.atomic.AtomicInteger;
117import java.util.function.Consumer;
134 public Map<String, Position>
waypoints =
new HashMap<>();
169 = com.runehive.game.world.entity.mob.player.camera.DialogueCameraDirector.Mode.OFF;
202 public HashMap<WeaponInterface, FightType>
fightStyles =
new HashMap<>();
205 return this.collectionLog;
208 private static final Logger
logger = LogManager.getLogger(
Player.class);
237 public Optional<Dialogue>
dialogue = Optional.empty();
297 public final AtomicBoolean
saved =
new AtomicBoolean(
false);
354 public final Set<String>
hostList =
new HashSet<>();
390 private Optional<GameSession>
session = Optional.empty();
470 message(
true,
"We are currently in early access.");
473 message(
"Double experience is currently active!");
493 final long seconds = TimeUnit.SECONDS.convert(
495 TimeUnit.MILLISECONDS);
496 send(
new SendMessage(
"You must wait " + seconds +
" second" + (seconds > 1 ?
"s" :
"")
497 +
" before you can logout as you were recently in combat."));
502 send(
new SendMessage(
"Please close what you are doing before logging out!"));
515 public final void logout(
boolean force) {
529 int objectId = playerBirdHouseData.birdhouseData.objectData[playerBirdHouseData.seedAmount >= 10 ? 1 : 0];
539 region.sendGroundItems(
this);
540 region.sendGameObjects(
this);
544 if (!
npc.getCombat().inCombat())
545 npc.face(
npc.faceDirection);
561 action.clearNonWalkableActions();
614 com.runehive.content.ai.LazyAIManager.clearPlayerConsent(
getUsername());
626 region.removePlayer(
this);
640 com.runehive.game.world.entity.mob.player.camera.DialogueCameraDirector.tick(
this);
794 if (obj ==
null || !(obj instanceof
Player)) {
812 public void message(
boolean filtered, String... messages) {
813 for (String
message : messages) {
819 for (String
message : messages) {
833 this.specialActivated = activated;
837 this.combatSpecial = special;
934 this.session = Optional.of(
session);
936 final String host =
session.getHost();
937 this.lastHost = host;
938 this.hostList.add(host);
967 this.sceneBaseChunkX = chunkX;
968 this.sceneBaseChunkY = chunkY;
The class that contains setting-related constants for the server.
static final Appearance DEFAULT_APPEARANCE
The default appearance of a player.
static final Position DEFAULT_POSITION
The default, i.e.
static boolean DOUBLE_EXPERIENCE
static final double COMBAT_MODIFICATION
The experience modification for combat.
static final String SERVER_NAME
The name of the server.
Handles displaying player's activity log.
A Activity object constructs an in-game activity and sequences it through the start() and finish() me...
static boolean evaluate(Mob mob, Predicate< Activity > predicate)
static void forActivity(Mob mob, Consumer< Activity > consumer)
The handler for the clan channel.
static boolean disconnect(Player player, boolean logout)
Handles player joining a clan channel.
Handles the clan chat channel.
Handles viewing clan information.
static void save(Player player)
Handles the skulling class.
Represents a factory class that contains important functions for building dialogues.
This class handles everything related to donators.
static boolean execute(Player player, InteractionEvent event)
void decline(Player player)
Handles declining the gamble.
static final Boundary GAMBLING_ZONE
static boolean isActivePlayer(Player player)
Checks if a player is a active player within the LMS game.
static boolean inGameArea(Player player)
Handles checking if the player is in the LMS game area.
static void onDeath(Player player, boolean forceRemove)
Handles when a player within the LMS game dies.
static int maxPlayers
The max amount of players allowed in a single game.
static List< Player > lobbyMembers
A list with all the players in the lobby.
static LMSLoadout currentGameType
The current game type.
static int requiredPlayers
The amount of players in the lobby required.
Handles spawning, rewarding and picking up of pets.
static void onLogout(Player player)
Handles what happens to a pet when a player logouts.
Handles managing the preset system.
Handles the prestige class.
Handles displaying the puzzle.
static void handleLogout(Player p)
static void handleRegionChange(Player client)
Handles a player casting a non-combat spell (mostly on items).
Handles the slayer skill.
static PlayerTitle empty()
Creates an empty player title.
boolean publish(Player player, Event event)
This class handles how plugins are loaded/unloaded and accessed.
static PlayerDataBus getDataBus()
This randomevent handles the teleblock counter.
Represents the game world.
static void schedule(Task task)
Submits a new event.
static int getPlayerCount()
Gets the amount of valid players online.
static void cancelTask(Object attachment)
static void sendMessage(String... messages)
Sends a global message.
static MobList< Player > getPlayers()
static RegionManager getRegions()
static void queueLogout(Player player)
Handles queueing the player logouts.
void setVisible(boolean visible)
void setRegistered(boolean registered)
final boolean isRegistered()
Entity destroy()
Destroys this entity.
void setPosition(Position position)
static final int COMBAT_LOGOUT_COOLDOWN
The amount of time it takes in milliseconds it takes to logout.
MobAnimation mobAnimation
final SkillManager skills
final EnumSet< UpdateFlag > updateFlags
final void resetWaypoint()
Resets the waypoint.
Mob(Position position)
Constructs a new Mob.
void move(Position position)
Moves the mob to a set position.
Represents a viewport in which a Player can see.
boolean equals(Object obj)
Represents a non-player character in the in-game world.
Contains information about the state of interfaces enter in the client.
Method handles small methods for players that do not have any parent class.
Handles the player death listener.
HashMap< WeaponInterface, FightType > fightStyles
void message(boolean filtered, String... messages)
final DonatorDeposit donatorDeposit
final MutableNumber specialPercentage
void setUsername(String username)
final Inventory inventory
CombatSpecial getCombatSpecial()
Optional< ChatMessage > getChatMessage()
final BankVault bankVault
void forClan(Consumer< ClanChannel > action)
final PresetManager presetManager
List< Integer > unlockedLMSItems
void chat(ChatMessage chatMessage)
final void logout(boolean force)
transient int dialogueCamDelayTicks
Delay ticks before camera activates (prevents coordinate misalignment at dialogue start).
List< Teleport > favoriteTeleport
void setPassword(String password)
final LostUntradeables lostUntradeables
void setCombatSpecial(CombatSpecial special)
CombatStrategy< Player > getStrategy()
The combat strategy of the mob.
void unregister()
Unregisters an entity from the World.
Stopwatch staffOfDeadSpecial
void setMemberId(int memberId)
void message(String message)
DailyEffect dailySpellBookSwap
final Equipment equipment
CombatSpell getAutocastSpell()
final Equipment equipment_copy
int toSceneLocalX(int worldX)
CollectionLog collectionLog
void sendInitialPackets()
CombatSpecial combatSpecial
void setSession(GameSession session)
String getName()
Gets the name of this entity.
transient int dialogueCamSwapBoostTicks
While >0, camera turns use slightly faster "swap" speeds for a smoother P↔NPC flip.
Optional< ChatMessage > chatMessage
static final Logger logger
Optional< Player > managing
void appendDeath()
Handles the mob death.
void setAntifireDetail(AntifireDetails antifireDetails)
final MutableNumber getPoisonImmunity()
boolean isAutoRetaliate()
State of the mob's auto retaliate.
List< EmoteUnlockable > emoteUnlockable
transient com.runehive.game.world.entity.mob.player.camera.DialogueCameraDirector.Mode dialogueCamMode
Dialogue camera system.
transient com.runehive.game.world.entity.mob.npc.Npc dialogueCamNpc
void removeFromRegion(Region region)
Removes this entity from the specified region.
Stopwatch databaseRequest
Player(String username, Position position)
void pickup(Item item, Position position)
DialogueFactory dialogueFactory
void setSceneBaseChunks(int chunkX, int chunkY)
HashMap< AchievementKey, Integer > playerAchievements
void setSingleCast(CombatSpell singleCast)
List< PlayerBirdHouseData > birdHouseData
final PlayerRecord gameRecord
int viggorasChainmaceCharges
Optional< OptionDialogue > optionDialogue
final RunePouch runePouch_copy
int lastFogSent
LMS Variables.
HashMap< ActivityLog, Integer > loggedActivities
boolean equals(Object obj)
transient int sceneBaseChunkY
CombatSpell getSingleCastSpell()
int toSceneLocalY(int worldY)
final RequestManager requestManager
Stopwatch aggressionTimer
boolean isSpecialActivated()
int toSceneLocalY(Position pos)
long getLastModification()
DailyEffect dailySlayerTaskSkip
final Set< String > hostList
transient int sceneBaseChunkX
Client's current scene base, in 8x8 chunks (set when SendMapRegion is sent).
void sequence()
The method which is invoked every tick.
Set< PetData > petInsurance
final PlayerPunishment punishment
BrotherData hiddenBrother
int serpentineHelmCharges
ChatBoxItemDialogue chatBoxItemDialogue
transient long lmsImmunity
final Inventory inventory_copy
void setCollectionLog(CollectionLog collectionLog)
SpellCasting spellCasting
Optional< GameSession > getSession()
MutableNumber getSpecialPercentage()
void setAutocast(CombatSpell autocast)
Optional< AntifireDetails > getAntifireDetails()
final AtomicInteger teleblockTimer
int thammoranSceptreCharges
DailyEffect dailySlayerTaskTeleport
final MutableNumber getVenomImmunity()
void setWeapon(WeaponInterface weapon)
final TradingPost tradingPost
Deque< String > lastKilled
final GambleManager gamblingManager
final InterfaceManager interfaceManager
final ClanViewer clanViewer
final Combat< Player > combat
Map< String, Position > waypoints
AntifireDetails antifireDetails
CollectionLogData collectionLogView
final ActivityLogger activityLogger
void addToRegion(Region region)
Adds this entity to the specified region.
final Set< PlayerOption > contextMenus
void send(OutgoingPacket encoder)
EntityType getType()
Gets the EntityType.
int toSceneLocalX(Position pos)
Combat< Player > getCombat()
The combat of the mob.
final PriceChecker priceChecker
HashSet< Prayer > unlockedPrayers
final MutableNumber venomImmunity
RangedWeaponDefinition rangedDefinition
Optional< GameSession > session
void register()
Registers an entity to the World.
final PlayerAssistant playerAssistant
final PuzzleDisplay puzzle
Optional< Consumer< String > > enterInputListener
final ExchangeSessionManager exchangeSession
CollectionLog getCollectionLog()
RangedAmmunition rangedAmmo
final Map< Integer, PersonalStore > viewing_shops
WeaponInterface getWeapon()
CollectionLogPage collectionLogPageOpen
boolean completedMageArena
Appearance getAppearance()
final RunePouch runePouch
Optional< Dialogue > dialogue
final LootingBag lootingBag
void setLastModification(long lastModification)
final MysteryBoxManager mysteryBox
final AtomicBoolean saved
final Overrides overrides
final Killstreak killstreak
final PlayerRelation relations
GambleManager getGambling()
final RunecraftPouch runecraftPouch
void message(String... messages)
void setSpecialActivated(boolean activated)
void setGambleLock(boolean gambleLocked)
final MutableNumber poisonImmunity
boolean isValid()
Validates this npc based on its current region and registered state.
LinkedList< Item > lostItems
Represents a Players appearance.
Represents a chat message that can be displayed over an entities head.
Handles the player punishment.
The request manager manages.
A PrayerBook which stores prayers.
The container class that represents an item that can be interacted with.
Handles the Bank container.
Handles the bank pin system.
Handles the bank vault system.
Handles the donator deposit box.
The container that manages the equipment for a player.
Handles the looting bag container.
Handles the donator deposit box.
An ItemContainer implementation that manages the inventory for a Player.
The price checker container.
Represents a static game object loaded from the map fs.
Handles checking if mobs are in a certain area.
static boolean inLMSBuilding(Interactable entity)
static boolean inMulti(Entity entity)
static boolean inRegularDonatorZone(Interactable entity)
static boolean inDuelArenaLobby(Entity entity)
static boolean inDuelArena(Interactable entity)
static boolean inWilderness(Position position)
static boolean inLMSLobby(Interactable entity)
static boolean inDuelObsticleArena(Interactable entity)
static boolean inSuperDonatorZone(Interactable entity)
static boolean inPvP(Interactable 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.
Represents a single region.
Region[] getSurroundingRegions(Position position)
Gets the regions surrounding a position.
void execute(Player player)
The OutgoingPacket resets the camera position for Player.
The OutgoingPacket responsible for changing settings on a client.
Sends experience to the client's experience counter.
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.
Represents a Session when a Player has been authenticated and active in the game world.
Created by Daniel on 2017-11-05.
The container class that contains functions to simplify the modification of a number.
Handles miscellaneous methods.
static String formatName(final String input)
static long nameToLong(String text)
Converts the first 12 characters in a string of text to a hash.
static final boolean goodDistance(int objectX, int objectY, int playerX, int playerY, int distance)
static String getDate()
Gets the date of server.
The in-game spellbooks for players.
The enumerated type whose elements represent the combat special attacks.
The enumerated type whose elements represent the weapon interfaces.
Represents the options for right-clicking players.
DUEL_REQUEST
The option for challenging another player to a duel.
ATTACK
The option for attacking another player.
FOLLOW
The option for following another player.
VIEW_PROFILE
The option for moderators and staff which brings up the report abuse option.
TRADE_REQUEST
The option for trading another player.
Holds all the player right data.
static boolean isDonator(Player player)
Checks if the player has donator status.
static boolean isDeveloper(Player player)
Checks if the player has developer status.
The enumerated type whose elements represent the directions for objects.
static Optional< ObjectDirection > valueOf(final int id)
Returns a ObjectDirection wrapped in an Optional for the specified id.
The enumerated type whose elements represent all of the object types.
static Optional< ObjectType > valueOf(final int id)
Returns a ObjectType wrapped in an Optional for the specified id.
Holds an enum of colors for ease.