Cuberite
A lightweight, fast and extensible game server for Minecraft
Player.h
Go to the documentation of this file.
1 
2 #pragma once
3 
4 #include "Pawn.h"
5 #include "../Inventory.h"
6 #include "../Defines.h"
7 #include "../World.h"
8 #include "../Items/ItemHandler.h"
9 
10 #include "../StatisticsManager.h"
11 
12 #include "../UUID.h"
13 
14 
15 
16 
17 
18 class cWindow;
19 class cClientHandle;
20 class cTeam;
21 
22 
23 
24 
25 
26 // tolua_begin
27 class cPlayer:
28  public cPawn
29 {
30  // tolua_end
31 
32  using Super = cPawn;
33 
36  {
37  BodyStanceCrouching(cPlayer & a_Player);
38  };
39 
43  {
44  BodyStanceSleeping(cPlayer & a_Player);
45  };
46 
49  {
50  };
51 
54  {
55  BodyStanceStanding(cPlayer & a_Player);
56  };
57 
60  {
61  BodyStanceGliding(cPlayer & a_Player);
62 
64  };
65 
66  /*
67  struct HandStanceNeutral
68  {
69  };
70 
71  struct HandStandChargingBow
72  {
73  int m_BowCharge;
74  };
75 
76  struct HandStanceEating
77  {
78  };
79  */
80 
81  // tolua_begin
82 
83 public:
84 
85  static const int MAX_HEALTH;
86 
87  static const int MAX_FOOD_LEVEL;
88 
89  // tolua_end
90 
92 
93  cPlayer(const std::shared_ptr<cClientHandle> & a_Client);
94  virtual ~cPlayer() override;
95 
97  void OnLoseSpectated();
98 
99  // tolua_begin
100 
105  bool SetCurrentExperience(int a_XpTotal);
106 
107  /* changes Xp by Xp_delta, you "shouldn't" inc more than MAX_EXPERIENCE_ORB_SIZE
108  Wont't allow xp to go negative
109  Returns the new current experience, -1 on error
110  */
111  int DeltaExperience(int a_Xp_delta);
112 
114  inline int GetXpLifetimeTotal(void) { return m_LifetimeTotalXp; }
115 
117  inline int GetCurrentXp(void) { return m_CurrentXp; }
118 
120  int GetXpLevel(void) const;
121 
123  float GetXpPercentage(void) const;
124 
128  static int XpForLevel(int a_Level);
129 
134  static int CalcLevelFromXp(int a_CurrentXp);
135 
136  // tolua_end
137 
139  const std::set<UInt32> & GetKnownRecipes() const;
140 
142  void StartChargingBow(void);
143 
145  int FinishChargingBow(void);
146 
148  void CancelChargingBow(void);
149 
151  bool IsChargingBow(void) const { return m_IsChargingBow; }
152 
153  void SetTouchGround(bool a_bTouchGround);
154  double GetEyeHeight(void) const; // tolua_export
155  Vector3d GetEyePosition(void) const; // tolua_export
156  inline cInventory & GetInventory(void) { return m_Inventory; } // tolua_export
157  inline const cInventory & GetInventory(void) const { return m_Inventory; }
158 
161 
162  inline const cItem & GetEquippedItem(void) const { return GetInventory().GetEquippedItem(); } // tolua_export
163 
165  bool IsClimbing(void) const;
166 
167  virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ) override;
168 
170  void UpdateCapabilities();
171 
172  // tolua_begin
173 
175  void Freeze(const Vector3d & a_Location);
176 
178  bool IsFrozen();
179 
181  void Unfreeze();
182 
187  void SendRotation(double a_YawDegrees, double a_PitchDegrees);
188 
190  void SpectateEntity(cEntity * a_Target);
191 
193  Vector3d GetThrowStartPos(void) const;
194 
196  Vector3d GetThrowSpeed(double a_SpeedCoeff) const;
197 
199  eGameMode GetGameMode(void) const { return m_GameMode; }
200 
202  eGameMode GetEffectiveGameMode(void) const;
203 
208  void SetGameMode(eGameMode a_GameMode);
209 
211  bool IsGameModeCreative(void) const;
212 
214  bool IsGameModeSurvival(void) const;
215 
217  bool IsGameModeAdventure(void) const;
218 
220  bool IsGameModeSpectator(void) const;
221 
225  virtual bool IsFireproof() const override
226  {
228 
229  }
230 
232  bool CanMobsTarget(void) const;
233 
234  AString GetIP(void) const; // tolua_export
235 
238 
240  cTeam * GetTeam(void) { return m_Team; } // tolua_export
241 
243  const cTeam * GetTeam(void) const { return m_Team; }
244 
246  void SetTeam(cTeam * a_Team);
247 
248  // tolua_end
249 
251  cTeam * UpdateTeam(void);
252 
256  void AwardAchievement(CustomStatistic a_Ach);
257 
260  void ForceSetSpeed(const Vector3d & a_Speed); // tolua_export
261 
262  cWindow * GetWindow(void) { return m_CurrentWindow; } // tolua_export
263  const cWindow * GetWindow(void) const { return m_CurrentWindow; }
264 
265  // tolua_begin
266 
268  void OpenWindow(cWindow & a_Window);
269 
271  void CloseWindow(bool a_CanRefuse = true);
272 
274  void CloseWindowIfID(char a_WindowID, bool a_CanRefuse = true);
275 
276  cClientHandle * GetClientHandle(void) const { return m_ClientHandle.get(); }
277 
278  // tolua_end
279 
283 
285  void PermuteEnchantmentSeed();
286 
287  // tolua_begin
288 
289  void SendMessage (const AString & a_Message);
290  void SendMessageInfo (const AString & a_Message);
291  void SendMessageFailure (const AString & a_Message);
292  void SendMessageSuccess (const AString & a_Message);
293  void SendMessageWarning (const AString & a_Message);
294  void SendMessageFatal (const AString & a_Message);
295  void SendMessagePrivateMsg (const AString & a_Message, const AString & a_Sender);
296  void SendMessage (const cCompositeChat & a_Message);
297  void SendMessageRaw (const AString & a_MessageRaw, eChatType a_Type = eChatType::ctChatBox);
298  void SendSystemMessage (const AString & a_Message);
299  void SendAboveActionBarMessage(const AString & a_Message);
300  void SendSystemMessage (const cCompositeChat & a_Message);
301  void SendAboveActionBarMessage(const cCompositeChat & a_Message);
302 
303  const AString & GetName(void) const;
304 
305  // tolua_end
306 
307  bool HasPermission(const AString & a_Permission) const; // tolua_export
308 
312  static bool PermissionMatches(const AStringVector & a_Permission, const AStringVector & a_Template); // Exported in ManualBindings with AString params
313 
315  const AStringVector & GetPermissions(void) const { return m_Permissions; } // Exported in ManualBindings.cpp
316 
318  const AStringVector & GetRestrictions(void) const { return m_Restrictions; } // Exported in ManualBindings.cpp
319 
320  // tolua_begin
321 
324  AString GetColor(void) const;
325 
327  AString GetPrefix(void) const;
328 
330  AString GetSuffix(void) const;
331 
333  AString GetPlayerListName(void) const;
334 
336  void TossEquippedItem(char a_Amount = 1);
337 
344 
346  void TossHeldItem(char a_Amount = 1);
347 
349  void TossPickup(const cItem & a_Item);
350 
352  virtual void Heal(int a_Health) override;
353 
354  int GetFoodLevel (void) const { return m_FoodLevel; }
355  double GetFoodSaturationLevel (void) const { return m_FoodSaturationLevel; }
356  int GetFoodTickTimer (void) const { return m_FoodTickTimer; }
357  double GetFoodExhaustionLevel (void) const { return m_FoodExhaustionLevel; }
358 
360  bool IsSatiated(void) const { return (m_FoodLevel >= MAX_FOOD_LEVEL); }
361 
362  void SetFoodLevel (int a_FoodLevel);
363  void SetFoodSaturationLevel (double a_FoodSaturationLevel);
364  void SetFoodTickTimer (int a_FoodTickTimer);
365  void SetFoodExhaustionLevel (double a_FoodExhaustionLevel);
366 
368  bool Feed(int a_Food, double a_Saturation);
369 
371  void AddFoodExhaustion(double a_Exhaustion);
372 
374  bool IsEating(void) const { return m_EatingFinishTick >= 0_tick; }
375 
377  bool IsFlying(void) const { return m_IsFlying; }
378 
380  bool IsInBed(void) const;
381 
383  bool IsLeftHanded() const;
384 
386  bool IsFishing(void) const { return m_IsFishing; }
387 
388  void SetIsFishing(bool a_IsFishing, UInt32 a_FloaterID = cEntity::INVALID_ID) { m_IsFishing = a_IsFishing; m_FloaterID = a_FloaterID; }
389 
390  UInt32 GetFloaterID(void) const { return m_FloaterID; }
391 
392  // tolua_end
393 
395  bool IsStanding() const;
396 
398  void TossItems(const cItems & a_Items);
399 
403  void SetIsInBed(bool a_IsInBed);
404 
406  void StartEating(void);
407 
409  void FinishEating(void);
410 
412  void AbortEating(void);
413 
414  virtual void KilledBy(TakeDamageInfo & a_TDI) override;
415 
416  virtual void Killed(const cEntity & a_Victim, eDamageType a_DamageType) override;
417 
418  void Respawn(void); // tolua_export
419 
420  void SetVisible( bool a_bVisible); // tolua_export
421 
423  void SaveToDisk(void);
424 
427  void LoadFromDisk();
428 
429  const AString & GetLoadedWorldName() const { return m_CurrentWorldName; }
430 
433  void OpenHorseInventory();
434 
437  void UseEquippedItem(short a_Damage = 1);
438 
442 
445  void UseItem(int a_SlotNumber, short a_Damage = 1);
446 
448  cItem & GetDraggingItem(void) {return m_DraggingItem; } // tolua_export
449 
451  void SetDraggingItem(const cItem & a_Item); // tolua_export
452 
453  // In UI windows, when inventory-painting:
455  void ClearInventoryPaintSlots(void);
456 
458  void AddInventoryPaintSlot(int a_SlotNum);
459 
461  const cSlotNums & GetInventoryPaintSlots(void) const;
462 
463  // tolua_begin
464 
466  double GetMaxSpeed(void) const;
467 
469  double GetNormalMaxSpeed(void) const { return m_NormalMaxSpeed; }
470 
472  double GetSprintingMaxSpeed(void) const { return m_SprintingMaxSpeed; }
473 
475  double GetFlyingMaxSpeed(void) const { return m_FlyingMaxSpeed; }
476 
478  void SetNormalMaxSpeed(double a_Speed);
479 
481  void SetSprintingMaxSpeed(double a_Speed);
482 
484  void SetFlyingMaxSpeed(double a_Speed);
485 
487  void SetCrouch(bool a_ShouldCrouch);
488 
490  void SetElytraFlight(bool a_ShouldElytraFly);
491 
493  void SetFlying(bool a_ShouldFly);
494 
496  void SetLeftHanded(bool a_IsLeftHanded);
497 
499  void SetSprint(bool a_ShouldSprint);
500 
502  void SetCanFly(bool a_CanFly);
503 
505  bool HasCustomName(void) const { return !m_CustomName.empty(); }
506 
508  const AString & GetCustomName(void) const { return m_CustomName; }
509 
512  void SetCustomName(const AString & a_CustomName);
513 
515  Vector3i GetLastBedPos(void) const { return m_RespawnPosition; }
516 
518  bool IsRespawnPointForced(void) const { return m_IsRespawnPointForced; }
519 
523  void SetBedPos(Vector3i a_Position);
524 
527  void SetBedPos(Vector3i a_Position, const cWorld & a_World);
528 
530  void SetRespawnPosition(Vector3i a_Position, const cWorld & a_World);
531 
532  // tolua_end
533 
534  // TODO lua export GetRespawnWorld
536 
538  void UpdateMovementStats(const Vector3d & a_DeltaPos, bool a_PreviousIsOnGround);
539 
541  bool DoesPlacingBlocksIntersectEntity(std::initializer_list<sSetBlock> a_Blocks) const;
542 
544  const cUUID & GetUUID(void) const; // Exported in ManualBindings.cpp
545 
546  // tolua_begin
547 
549  virtual bool CanFly(void) const { return m_IsFlightCapable; }
550 
552  void LoadRank(void);
553 
557  void SendBlocksAround(Vector3i a_BlockPos, int a_Range = 1);
558 
559  bool HasSkinPart(eSkinPart a_Part) const { return (m_SkinParts & a_Part) != 0; }
560  int GetSkinParts(void) const { return m_SkinParts; }
561  void SetSkinParts(int a_Parts);
562 
563  // tolua_end
564 
566  bool PlaceBlock(Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta);
567 
572  bool PlaceBlocks(std::initializer_list<sSetBlock> a_Blocks);
573 
578  void NotifyNearbyWolves(cPawn * a_Opponent, bool a_IsPlayerInvolved);
579 
584  float GetMiningProgressPerTick(BLOCKTYPE a_Block);
585 
590  bool CanInstantlyMine(BLOCKTYPE a_Block);
591 
594  void AddKnownItem(const cItem & a_Item);
595 
596  // cEntity overrides:
597  virtual cItem GetEquippedWeapon(void) const override { return m_Inventory.GetEquippedItem(); }
598  virtual cItem GetEquippedHelmet(void) const override { return m_Inventory.GetEquippedHelmet(); }
599  virtual cItem GetEquippedChestplate(void) const override { return m_Inventory.GetEquippedChestplate(); }
600  virtual cItem GetEquippedLeggings(void) const override { return m_Inventory.GetEquippedLeggings(); }
601  virtual cItem GetEquippedBoots(void) const override { return m_Inventory.GetEquippedBoots(); }
602  virtual cItem GetOffHandEquipedItem(void) const override { return m_Inventory.GetShieldSlot(); }
603  virtual bool IsCrouched(void) const override;
604  virtual bool IsOnGround(void) const override { return m_bTouchGround; }
605  virtual bool IsSprinting(void) const override;
606 
607 private:
608 
609  typedef std::vector<std::vector<AString> > AStringVectorVector;
610 
612  std::variant<BodyStanceCrouching, BodyStanceSleeping, BodyStanceSprinting, BodyStanceStanding, BodyStanceGliding> m_BodyStance;
613 
616 
619 
622 
626 
630 
631  // Message visuals:
634 
635  // Food-related variables:
638 
641 
644 
647 
650 
653 
656 
660 
663  std::string m_SpawnWorldName;
664 
667  std::string m_CurrentWorldName;
668 
670  std::string m_DefaultWorldPath;
671 
673 
676 
677  std::shared_ptr<cClientHandle> m_ClientHandle;
678 
680 
685 
690 
695 
698 
701 
703 
706 
709 
712 
715 
719 
721 
724 
728  unsigned int m_EnchantmentSeed;
729 
731 
733 
735 
738 
740 
743  unsigned int m_TicksUntilNextSave;
744 
746 
749 
751  std::set<UInt32> m_KnownRecipes;
752 
754  std::set<cItem, cItem::sItemCompare> m_KnownItems;
755 
757  void HandleFood(void);
758 
760  void HandleFloater(void);
761 
764  AString GetUUIDFileName(const cUUID & a_UUID);
765 
768  void FreezeInternal(const Vector3d & a_Location, bool a_ManuallyFrozen);
769 
771  float GetLiquidHeightPercent(NIBBLETYPE a_Meta);
772 
774  bool IsInsideWater();
775 
783  float GetDigSpeed(BLOCKTYPE a_Block);
784 
787  void AddKnownRecipe(UInt32 RecipeId);
788 
789  void TickFreezeCode();
790 
793  void RefreshRank();
794 
795  // cEntity overrides:
796  virtual void ApplyArmorDamage(int DamageBlocked) override;
797  virtual void BroadcastMovementUpdate(const cClientHandle * a_Exclude = nullptr) override;
798  virtual bool DoTakeDamage(TakeDamageInfo & TDI) override;
799  virtual float GetEnchantmentBlastKnockbackReduction() override;
800  virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk &) override { UNUSED(a_Dt); }
801  virtual bool IsElytraFlying(void) const override;
802  virtual bool IsInvisible() const override;
803  virtual bool IsRclking(void) const override { return IsEating() || IsChargingBow(); }
804  virtual void OnAddToWorld(cWorld & a_World) override;
805  virtual void OnDetach() override;
806  virtual void OnRemoveFromWorld(cWorld & a_World) override;
807  virtual void SpawnOn(cClientHandle & a_Client) override;
808  virtual void Tick(std::chrono::milliseconds a_Dt, cChunk & a_Chunk) override;
809 
810 } ; // tolua_export
cPlayer::CalcLevelFromXp
static int CalcLevelFromXp(int a_CurrentXp)
Inverse of XpForLevel Ref: https://minecraft.gamepedia.com/XP values are as per this with pre-calcula...
Definition: Player.cpp:184
cPlayer::SendMessagePrivateMsg
void SendMessagePrivateMsg(const AString &a_Message, const AString &a_Sender)
Definition: Player.cpp:1236
cPlayer::m_ClientHandle
std::shared_ptr< cClientHandle > m_ClientHandle
Definition: Player.h:677
cPlayer::DoTakeDamage
virtual bool DoTakeDamage(TakeDamageInfo &TDI) override
Makes this entity take damage specified in the a_TDI.
Definition: Player.cpp:2881
cPlayer::SetIsInBed
void SetIsInBed(bool a_IsInBed)
Sets a player's in-bed state.
Definition: Player.cpp:496
cClientHandle
Definition: ClientHandle.h:49
cPlayer::AbortEating
void AbortEating(void)
Aborts the current eating operation.
Definition: Player.cpp:551
cPlayer::GetEyePosition
Vector3d GetEyePosition(void) const
Definition: Player.cpp:1001
cPlayer::m_DraggingItem
cItem m_DraggingItem
The item being dragged by the cursor while in a UI window.
Definition: Player.h:675
cPlayer::GetLastBedPos
Vector3i GetLastBedPos(void) const
Gets the player's potential respawn position (named LastBedPos for compatibility reasons).
Definition: Player.h:515
cPlayer::TeleportToCoords
virtual void TeleportToCoords(double a_PosX, double a_PosY, double a_PosZ) override
Teleports to the coordinates specified.
Definition: Player.cpp:1404
cPlayer::IsRespawnPointForced
bool IsRespawnPointForced(void) const
Returns if the respawn point is unconditionally used.
Definition: Player.h:518
cPlayer::GetEffectiveGameMode
eGameMode GetEffectiveGameMode(void) const
Returns the current effective gamemode (inherited gamemode is resolved before returning)
Definition: Player.cpp:1531
cPlayer::GetOffHandEquipedItem
virtual cItem GetOffHandEquipedItem(void) const override
Returns the currently offhand equipped item; empty item if none.
Definition: Player.h:602
cUUID
Definition: UUID.h:10
cPlayer::m_Restrictions
AStringVector m_Restrictions
All the restrictions that this player has, based on their rank.
Definition: Player.h:621
cPlayer::m_InventoryWindow
cWindow * m_InventoryWindow
Definition: Player.h:655
cPlayer::SendMessageInfo
void SendMessageInfo(const AString &a_Message)
Definition: Player.cpp:1191
cPlayer::SetSprintingMaxSpeed
void SetSprintingMaxSpeed(double a_Speed)
Sets the sprinting relative maximum speed.
Definition: Player.cpp:626
cPlayer::GetUUID
const cUUID & GetUUID(void) const
Returns the UUID that has been read from the client, or nil if not available.
Definition: Player.cpp:2431
cCompositeChat
Container for a single chat message composed of multiple functional parts.
Definition: CompositeChat.h:33
cPlayer::GetEnchantmentBlastKnockbackReduction
virtual float GetEnchantmentBlastKnockbackReduction() override
Returns explosion knock back reduction percent from blast protection level.
Definition: Player.cpp:2932
cPlayer::m_KnownRecipes
std::set< UInt32 > m_KnownRecipes
List on known recipes as Ids.
Definition: Player.h:751
cPlayer::BodyStanceCrouching
Tag representing a sneaking pose.
Definition: Player.h:35
cPlayer::SendAboveActionBarMessage
void SendAboveActionBarMessage(const AString &a_Message)
Definition: Player.cpp:1272
cPlayer::LoadFromDisk
void LoadFromDisk()
Loads the player data from the save file.
Definition: Player.cpp:1803
cPlayer::GetThrowSpeed
Vector3d GetThrowSpeed(double a_SpeedCoeff) const
Returns the initial speed vector of a throw, with a 3D length of a_SpeedCoeff.
Definition: Player.cpp:1517
cPlayer::m_RespawnPosition
Vector3i m_RespawnPosition
The player's potential respawn position, initialised to world spawn by default.
Definition: Player.h:659
cPlayer::XpForLevel
static int XpForLevel(int a_Level)
Calculates the amount of XP needed for a given level Ref: https://minecraft.gamepedia....
Definition: Player.cpp:215
cPlayer::SetTouchGround
void SetTouchGround(bool a_bTouchGround)
Definition: Player.cpp:351
cPlayer::GetEnchantmentRandomProvider
MTRand GetEnchantmentRandomProvider()
Get a copy of the PRNG for enchanting related generation, don't use this for other purposes.
Definition: Player.cpp:1567
cPlayer::IsCrouched
virtual bool IsCrouched(void) const override
Definition: Player.cpp:2949
cPlayer::SetFoodExhaustionLevel
void SetFoodExhaustionLevel(double a_FoodExhaustionLevel)
Definition: Player.cpp:414
cPlayer::PlaceBlocks
bool PlaceBlocks(std::initializer_list< sSetBlock > a_Blocks)
Calls the block placement hooks and places the blocks in the world.
Definition: Player.cpp:2449
cInventory
This class represents the player's inventory The slots are divided into three areas:
Definition: Inventory.h:32
cPlayer::m_IsManuallyFrozen
bool m_IsManuallyFrozen
Was the player frozen manually by a plugin or automatically by the server?
Definition: Player.h:711
cPlayer::GetCustomName
const AString & GetCustomName(void) const
Returns the custom name of this player.
Definition: Player.h:508
cInventory::GetEquippedItem
const cItem & GetEquippedItem(void) const
Returns current equiped item.
Definition: Inventory.cpp:463
cPlayer::m_SplitRestrictions
AStringVectorVector m_SplitRestrictions
All the restrictions that this player has, based on their rank, split into individual dot-delimited p...
Definition: Player.h:629
cWindow
Represents a UI window.
Definition: Window.h:53
StatisticsManager
Class that manages the statistics and achievements of a single player.
Definition: StatisticsManager.h:32
cPlayer::m_CurrentXp
int m_CurrentXp
Definition: Player.h:727
cPlayer::SpawnOn
virtual void SpawnOn(cClientHandle &a_Client) override
Descendants override this function to send a command to the specified client to spawn the entity on t...
Definition: Player.cpp:3137
cPlayer::GetIP
AString GetIP(void) const
Definition: Player.cpp:1070
cPlayer::SetRespawnPosition
void SetRespawnPosition(Vector3i a_Position, const cWorld &a_World)
Sets the player's forced respawn position and world.
Definition: Player.cpp:806
cPlayer::CanMobsTarget
bool CanMobsTarget(void) const
Returns true if the player can be targeted by Mobs.
Definition: Player.cpp:1061
cPlayer::SetTeam
void SetTeam(cTeam *a_Team)
Sets the player team, nullptr if none.
Definition: Player.cpp:1079
cPlayer::AddKnownRecipe
void AddKnownRecipe(UInt32 RecipeId)
Add the recipe Id to the known recipes.
Definition: Player.cpp:2734
cPlayer::GetEquippedChestplate
virtual cItem GetEquippedChestplate(void) const override
Returns the currently equipped chestplate; empty item if none.
Definition: Player.h:599
cPlayer::ApplyArmorDamage
virtual void ApplyArmorDamage(int DamageBlocked) override
Applies damage to the armor after the armor blocked the given amount.
Definition: Player.cpp:2848
cPlayer::GetPlayerListName
AString GetPlayerListName(void) const
Returns the name that is used in the playerlist.
Definition: Player.cpp:1685
cPlayer::MAX_FOOD_LEVEL
static const int MAX_FOOD_LEVEL
Definition: Player.h:87
cPlayer::GetEnderChestContents
cItemGrid & GetEnderChestContents(void)
Gets the contents of the player's associated enderchest.
Definition: Player.h:160
cPlayer::GetPermissions
const AStringVector & GetPermissions(void) const
Returns all the permissions that the player has assigned to them.
Definition: Player.h:315
cPlayer::PermissionMatches
static bool PermissionMatches(const AStringVector &a_Permission, const AStringVector &a_Template)
Returns true iff a_Permission matches the a_Template.
Definition: Player.cpp:1622
cPlayer::GetPrefix
AString GetPrefix(void) const
Returns the player name prefix, may contain @ format directives.
Definition: Player.cpp:1667
cPlayer::GetInventoryPaintSlots
const cSlotNums & GetInventoryPaintSlots(void) const
Returns the list of slots currently stored for inventory painting.
Definition: Player.cpp:581
cPlayer::Tick
virtual void Tick(std::chrono::milliseconds a_Dt, cChunk &a_Chunk) override
Definition: Player.cpp:3157
cPlayer::m_Stats
StatisticsManager m_Stats
Definition: Player.h:739
cPlayer::GetLiquidHeightPercent
float GetLiquidHeightPercent(NIBBLETYPE a_Meta)
Returns how high the liquid is in percent.
Definition: Player.cpp:2565
cPlayer::GetInventory
cInventory & GetInventory(void)
Definition: Player.h:156
cPlayer::IsOnGround
virtual bool IsOnGround(void) const override
Returns whether the entity is on ground or not.
Definition: Player.h:604
cPlayer::GetFoodExhaustionLevel
double GetFoodExhaustionLevel(void) const
Definition: Player.h:357
cPlayer::m_SkinParts
int m_SkinParts
Displayed skin part bit mask.
Definition: Player.h:748
cPlayer::m_CurrentWorldName
std::string m_CurrentWorldName
The name of the world which the player currently resides in.
Definition: Player.h:667
cPlayer::GetColor
AString GetColor(void) const
Returns the full color code to use for this player, based on their rank.
Definition: Player.cpp:1651
cPlayer::HandlePhysics
virtual void HandlePhysics(std::chrono::milliseconds a_Dt, cChunk &) override
Handles the physics of the entity - updates position based on speed, updates speed based on environme...
Definition: Player.h:800
cPlayer::m_IsFlying
bool m_IsFlying
Definition: Player.h:702
cPlayer::IsElytraFlying
virtual bool IsElytraFlying(void) const override
Definition: Player.cpp:2967
cPlayer::~cPlayer
virtual ~cPlayer() override
Definition: Player.cpp:155
CLASS_PROTODEF
#define CLASS_PROTODEF(classname)
Definition: Entity.h:13
cPlayer::SendMessageFailure
void SendMessageFailure(const AString &a_Message)
Definition: Player.cpp:1200
UInt32
unsigned int UInt32
Definition: Globals.h:154
cPlayer::OnAddToWorld
virtual void OnAddToWorld(cWorld &a_World) override
Called when the entity is added to a world.
Definition: Player.cpp:2985
cPlayer::OnLoseSpectated
void OnLoseSpectated()
Called when spectation stops, because the player crouched or when the entity we're spectating gets re...
Definition: Player.cpp:173
cPlayer::PlaceBlock
bool PlaceBlock(Vector3i a_Position, BLOCKTYPE a_BlockType, NIBBLETYPE a_BlockMeta)
Attempts to place the block in the world with a call to PlaceBlocks.
Definition: Player.cpp:2440
cPlayer::SetNormalMaxSpeed
void SetNormalMaxSpeed(double a_Speed)
Sets the normal relative maximum speed.
Definition: Player.cpp:611
cPlayer::FinishChargingBow
int FinishChargingBow(void)
Finishes charging the current bow.
Definition: Player.cpp:324
eSkinPart
eSkinPart
Definition: Defines.h:214
cPlayer::IsInBed
bool IsInBed(void) const
Returns true if a player is sleeping in a bed.
Definition: Player.cpp:451
cPlayer::TossHeldItem
void TossHeldItem(char a_Amount=1)
tosses the item held in hand (when in UI windows)
Definition: Player.cpp:1764
cPlayer::m_SplitPermissions
AStringVectorVector m_SplitPermissions
All the permissions that this player has, based on their rank, split into individual dot-delimited pa...
Definition: Player.h:625
eChatType
eChatType
Definition: Defines.h:148
cPlayer::m_Inventory
cInventory m_Inventory
Stores the player's inventory, consisting of crafting grid, hotbar, and main slots.
Definition: Player.h:649
cPlayer::m_IsFlightCapable
bool m_IsFlightCapable
If this is true the player can fly.
Definition: Player.h:700
cPlayer::GetWindow
cWindow * GetWindow(void)
Definition: Player.h:262
cPlayer::BodyStanceStanding::BodyStanceStanding
BodyStanceStanding(cPlayer &a_Player)
Definition: Player.cpp:98
cPlayer::UseItem
void UseItem(int a_SlotNumber, short a_Damage=1)
Damage the item in a_SlotNumber by a_Damage, possibly less if the equipped item is enchanted.
Definition: Player.cpp:2063
cPlayer::CanFly
virtual bool CanFly(void) const
Returns wheter the player can fly or not.
Definition: Player.h:549
cPlayer::SendSystemMessage
void SendSystemMessage(const AString &a_Message)
Definition: Player.cpp:1263
cPlayer::CanInstantlyMine
bool CanInstantlyMine(BLOCKTYPE a_Block)
Given tool, enchantments, status effects, and world position returns whether a_Block would be instant...
Definition: Player.cpp:2696
cPlayer::GetRestrictions
const AStringVector & GetRestrictions(void) const
Returns all the restrictions that the player has assigned to them.
Definition: Player.h:318
NIBBLETYPE
unsigned char NIBBLETYPE
The datatype used by nibbledata (meta, light, skylight)
Definition: ChunkDef.h:44
cPlayer::m_CurrentWindow
cWindow * m_CurrentWindow
Definition: Player.h:654
cPlayer::TossEquippedItem
void TossEquippedItem(char a_Amount=1)
tosses the item in the selected hotbar slot
Definition: Player.cpp:1720
cPlayer::SetLeftHanded
void SetLeftHanded(bool a_IsLeftHanded)
Sets the dominant hand of the player.
Definition: Player.cpp:719
cPlayer::GetTeam
const cTeam * GetTeam(void) const
Returns the associated team, nullptr if none.
Definition: Player.h:243
cSlotNums
std::vector< int > cSlotNums
List of slot numbers, used for inventory-painting.
Definition: Defines.h:9
cPlayer::m_Rank
AString m_Rank
The name of the rank assigned to this player.
Definition: Player.h:615
cEntity::m_IsFireproof
bool m_IsFireproof
Whether the entity is capable of taking fire or lava damage.
Definition: Entity.h:630
eGameMode
eGameMode
Definition: Defines.h:124
cPlayer::m_FoodLevel
int m_FoodLevel
Represents the food bar, one point equals half a "drumstick".
Definition: Player.h:637
cPlayer::SetCustomName
void SetCustomName(const AString &a_CustomName)
Sets the custom name of this player.
Definition: Player.cpp:763
cPlayer::IsRclking
virtual bool IsRclking(void) const override
Definition: Player.h:803
cPlayer::m_IsRespawnPointForced
bool m_IsRespawnPointForced
Whether we unconditionally respawn to m_RespawnPosition, or check if a bed is unobstructed and availa...
Definition: Player.h:714
cPlayer::SendMessage
void SendMessage(const AString &a_Message)
Definition: Player.cpp:1182
cPlayer::BodyStanceSprinting
Tag representing a sprinting pose.
Definition: Player.h:48
cPlayer::GetStatistics
StatisticsManager & GetStatistics()
Return the associated statistic and achievement manager.
Definition: Player.h:237
cPlayer::SetCurrentExperience
bool SetCurrentExperience(int a_XpTotal)
Sets the experience total Returns true on success "should" really only be called at init or player de...
Definition: Player.cpp:259
cPlayer::LoadRank
void LoadRank(void)
(Re)loads the rank and permissions from the cRankManager and sends a permission level update to the c...
Definition: Player.cpp:2312
cPlayer::AwardAchievement
void AwardAchievement(CustomStatistic a_Ach)
Awards the player an achievement.
Definition: Player.cpp:1372
cPlayer::BodyStanceGliding::BodyStanceGliding
BodyStanceGliding(cPlayer &a_Player)
Definition: Player.cpp:107
cPlayer::IsSprinting
virtual bool IsSprinting(void) const override
Definition: Player.cpp:2958
cPlayer::SetFlyingMaxSpeed
void SetFlyingMaxSpeed(double a_Speed)
Sets the flying relative maximum speed.
Definition: Player.cpp:641
cPlayer::IsInsideWater
bool IsInsideWater()
Checks if the player is inside of water.
Definition: Player.cpp:2578
cPlayer::CancelChargingBow
void CancelChargingBow(void)
Cancels the current bow charging.
Definition: Player.cpp:339
cPlayer::IsFlying
bool IsFlying(void) const
Returns true if the player is currently flying.
Definition: Player.h:377
cPlayer::IsGameModeCreative
bool IsGameModeCreative(void) const
Returns true if the player is in Creative mode, either explicitly, or by inheriting from current worl...
Definition: Player.cpp:1025
cPlayer::GetTeam
cTeam * GetTeam(void)
Returns the associated team, nullptr if none.
Definition: Player.h:240
cPlayer::DeltaExperience
int DeltaExperience(int a_Xp_delta)
Definition: Player.cpp:279
cPlayer::HandleFood
void HandleFood(void)
Called in each tick to handle food-related processing.
Definition: Player.cpp:2116
cPlayer::Killed
virtual void Killed(const cEntity &a_Victim, eDamageType a_DamageType) override
Called when the entity kills another entity.
Definition: Player.cpp:896
cPlayer::GetInventory
const cInventory & GetInventory(void) const
Definition: Player.h:157
cPlayer::GetEyeHeight
double GetEyeHeight(void) const
Definition: Player.cpp:992
cPlayer::m_MsgPrefix
AString m_MsgPrefix
Definition: Player.h:632
cPlayer::IsFireproof
virtual bool IsFireproof() const override
Returns true if the player is fireproof Stops players burning in creative or spectator modes.
Definition: Player.h:225
cPlayer::GetFoodTickTimer
int GetFoodTickTimer(void) const
Definition: Player.h:356
cWorld
Definition: World.h:47
cPlayer::IsFrozen
bool IsFrozen()
Is the player frozen?
Definition: Player.cpp:1432
cPlayer::SaveToDisk
void SaveToDisk(void)
Saves all player data, such as inventory, to JSON.
Definition: Player.cpp:1933
cPlayer::AddKnownItem
void AddKnownItem(const cItem &a_Item)
Adds an Item to the list of known items.
Definition: Player.cpp:2708
cPlayer::SendMessageRaw
void SendMessageRaw(const AString &a_MessageRaw, eChatType a_Type=eChatType::ctChatBox)
Definition: Player.cpp:1254
cPlayer::IsClimbing
bool IsClimbing(void) const
Returns whether the player is climbing (ladders, vines etc.)
Definition: Player.cpp:2191
cPlayer::m_KnownItems
std::set< cItem, cItem::sItemCompare > m_KnownItems
List of known items as Ids.
Definition: Player.h:754
cPlayer::SetVisible
void SetVisible(bool a_bVisible)
Definition: Player.cpp:1549
cPlayer::TickFreezeCode
void TickFreezeCode()
Definition: Player.cpp:2749
cPlayer::IsGameModeSurvival
bool IsGameModeSurvival(void) const
Returns true if the player is in Survival mode, either explicitly, or by inheriting from current worl...
Definition: Player.cpp:1034
cPlayer::m_Team
cTeam * m_Team
Definition: Player.h:734
cPlayer::BodyStanceGliding
Tag representing a swimming or elytra flying pose.
Definition: Player.h:59
cPlayer::UseEquippedItem
void UseEquippedItem(short a_Damage=1)
Damage the player's equipped item by a_Damage, possibly less if the equipped item is enchanted.
Definition: Player.cpp:2033
cPlayer::m_EnchantmentSeed
unsigned int m_EnchantmentSeed
Definition: Player.h:728
cPlayer::m_IsLeftHanded
bool m_IsLeftHanded
Whether the player is left-handed, or right-handed.
Definition: Player.h:708
cPlayer::KilledBy
virtual void KilledBy(TakeDamageInfo &a_TDI) override
Called when the health drops below zero.
Definition: Player.cpp:855
cPlayer::BodyStanceSleeping
Tag representing a sleeping pose.
Definition: Player.h:42
cPlayer::GetEquippedHelmet
virtual cItem GetEquippedHelmet(void) const override
Returns the currently equipped helmet; empty item if none.
Definition: Player.h:598
cPlayer::GetWindow
const cWindow * GetWindow(void) const
Definition: Player.h:263
cInventory::GetShieldSlot
const cItem & GetShieldSlot() const
Returns current item in shield slot.
Definition: Inventory.cpp:454
cPawn::cPawn
cPawn(eEntityType a_EntityType, float a_Width, float a_Height)
Definition: Pawn.cpp:18
cPlayer::m_IsVisible
bool m_IsVisible
Definition: Player.h:720
cPlayer::GetFlyingMaxSpeed
double GetFlyingMaxSpeed(void) const
Gets the flying relative maximum speed.
Definition: Player.h:475
cPlayer::SetCanFly
void SetCanFly(bool a_CanFly)
If true the player can fly even when he's not in creative.
Definition: Player.cpp:748
cPlayer::FinishEating
void FinishEating(void)
Finishes eating the currently equipped item.
Definition: Player.cpp:527
cPlayer::SetElytraFlight
void SetElytraFlight(bool a_ShouldElytraFly)
Starts or stops elytra flight, if our current body stance permits, broadcasting the state change.
Definition: Player.cpp:682
cPlayer::GetEquippedItem
const cItem & GetEquippedItem(void) const
Definition: Player.h:162
cPlayer::FreezeInternal
void FreezeInternal(const Vector3d &a_Location, bool a_ManuallyFrozen)
Pins the player to a_Location until Unfreeze() is called.
Definition: Player.cpp:2530
cItem
Definition: Item.h:36
cPlayer::m_DefaultWorldPath
std::string m_DefaultWorldPath
The save path of the default world.
Definition: Player.h:670
cPlayer::GetUUIDFileName
AString GetUUIDFileName(const cUUID &a_UUID)
Returns the filename for the player data based on the UUID given.
Definition: Player.cpp:2514
cPlayer::SetDraggingItem
void SetDraggingItem(const cItem &a_Item)
In UI windows, set the item that the player is dragging.
Definition: Player.cpp:1707
cPlayer::m_IsFishing
bool m_IsFishing
Definition: Player.h:697
cPlayer::HasPermission
bool HasPermission(const AString &a_Permission) const
Definition: Player.cpp:1586
cItemHandler::eDurabilityLostAction
eDurabilityLostAction
Actions that may cause durability of an item may be lost, where the magnitude of the loss depends on ...
Definition: ItemHandler.h:30
cPlayer::m_InventoryPaintSlots
cSlotNums m_InventoryPaintSlots
Definition: Player.h:679
cPlayer::m_GameMode
eGameMode m_GameMode
Definition: Player.h:672
cPlayer::m_SprintingMaxSpeed
double m_SprintingMaxSpeed
Max speed, relative to the game default max speed, when sprinting.
Definition: Player.h:689
cPlayer::GetMaxSpeed
double GetMaxSpeed(void) const
Returns the current relative maximum speed (takes current sprinting / flying state into account)
Definition: Player.cpp:591
cPlayer::UpdateTeam
cTeam * UpdateTeam(void)
Forces the player to query the scoreboard for his team.
Definition: Player.cpp:1103
cPlayer::Respawn
void Respawn(void)
Definition: Player.cpp:936
cPlayer::SendMessageSuccess
void SendMessageSuccess(const AString &a_Message)
Definition: Player.cpp:1209
Pawn.h
cPlayer::m_CustomName
AString m_CustomName
Definition: Player.h:745
cPlayer::m_Spectating
cEntity * m_Spectating
The entity that this player is spectating, nullptr if none.
Definition: Player.h:737
cPlayer::AStringVectorVector
std::vector< std::vector< AString > > AStringVectorVector
Definition: Player.h:609
cPlayer::SetSprint
void SetSprint(bool a_ShouldSprint)
Starts or stops sprinting, if our current body stance permits, broadcasting the state change.
Definition: Player.cpp:729
cPlayer::AddFoodExhaustion
void AddFoodExhaustion(double a_Exhaustion)
Adds the specified exhaustion to m_FoodExhaustion.
Definition: Player.cpp:439
cPlayer::m_FoodSaturationLevel
double m_FoodSaturationLevel
"Overcharge" for the m_FoodLevel; is depleted before m_FoodLevel
Definition: Player.h:640
cPlayer::IsGameModeSpectator
bool IsGameModeSpectator(void) const
Returns true if the player is in Spectator mode, either explicitly, or by inheriting from current wor...
Definition: Player.cpp:1052
cPlayer::BodyStanceCrouching::BodyStanceCrouching
BodyStanceCrouching(cPlayer &a_Player)
Definition: Player.cpp:80
cPlayer::DoesPlacingBlocksIntersectEntity
bool DoesPlacingBlocksIntersectEntity(std::initializer_list< sSetBlock > a_Blocks) const
Whether placing the given blocks would intersect any entitiy.
Definition: Player.cpp:2366
cPlayer::SetFoodTickTimer
void SetFoodTickTimer(int a_FoodTickTimer)
Definition: Player.cpp:405
cPlayer::SendBlocksAround
void SendBlocksAround(Vector3i a_BlockPos, int a_Range=1)
Sends the block in the specified range around the specified coord to the client as a block change pac...
Definition: Player.cpp:2325
cPlayer::BroadcastMovementUpdate
virtual void BroadcastMovementUpdate(const cClientHandle *a_Exclude=nullptr) override
Updates clients of changes in the entity.
Definition: Player.cpp:2862
cPlayer::m_BodyStance
std::variant< BodyStanceCrouching, BodyStanceSleeping, BodyStanceSprinting, BodyStanceStanding, BodyStanceGliding > m_BodyStance
The current body stance the player has adopted.
Definition: Player.h:612
cPlayer::Freeze
void Freeze(const Vector3d &a_Location)
Prevent the player from moving and lock him into a_Location.
Definition: Player.cpp:1423
cPlayer::Feed
bool Feed(int a_Food, double a_Saturation)
Adds to FoodLevel and FoodSaturationLevel, returns true if any food has been consumed,...
Definition: Player.cpp:423
cPlayer::HasSkinPart
bool HasSkinPart(eSkinPart a_Part) const
Definition: Player.h:559
cPlayer::IsChargingBow
bool IsChargingBow(void) const
Returns true if the player is currently charging the bow.
Definition: Player.h:151
cTickTime
std::chrono::duration< signed int, std::ratio_multiply< std::chrono::milliseconds::period, std::ratio< 50 > >> cTickTime
Definition: Globals.h:361
cPlayer::MAX_HEALTH
static const int MAX_HEALTH
Definition: Player.h:85
cPlayer::GetFoodSaturationLevel
double GetFoodSaturationLevel(void) const
Definition: Player.h:355
cPlayer::OnRemoveFromWorld
virtual void OnRemoveFromWorld(cWorld &a_World) override
Called when the entity is removed from a world.
Definition: Player.cpp:3075
cPlayer::HasCustomName
bool HasCustomName(void) const
Returns true if the player has a custom name.
Definition: Player.h:505
cPlayer::BodyStanceGliding::TicksElytraFlying
cTickTime TicksElytraFlying
Definition: Player.h:63
cItems
This class bridges a vector of cItem for safe access via Lua.
Definition: Item.h:213
cPlayer::m_BowCharge
int m_BowCharge
Definition: Player.h:730
cTeam
Definition: Scoreboard.h:125
cPlayer::GetSprintingMaxSpeed
double GetSprintingMaxSpeed(void) const
Gets the sprinting relative maximum speed.
Definition: Player.h:472
cPlayer::AddInventoryPaintSlot
void AddInventoryPaintSlot(int a_SlotNum)
Adds a slot to the list for inventory painting.
Definition: Player.cpp:571
cPlayer::IsEating
bool IsEating(void) const
Returns true if the player is currently in the process of eating the currently equipped item.
Definition: Player.h:374
cEntity::INVALID_ID
static const UInt32 INVALID_ID
Special ID that is considered an "invalid value", signifying no entity.
Definition: Entity.h:128
cPlayer::OnDetach
virtual void OnDetach() override
Called when this entity dismounts from m_AttachedTo.
Definition: Player.cpp:3036
cPlayer::GetRespawnWorld
cWorld * GetRespawnWorld()
Definition: Player.cpp:817
cInventory::GetEquippedBoots
const cItem & GetEquippedBoots(void) const
Definition: Inventory.h:179
cPlayer::m_FloaterID
UInt32 m_FloaterID
Definition: Player.h:732
cInventory::GetEquippedChestplate
const cItem & GetEquippedChestplate(void) const
Definition: Inventory.h:177
BLOCKTYPE
unsigned char BLOCKTYPE
The datatype used by blockdata.
Definition: ChunkDef.h:41
cPlayer::TossItems
void TossItems(const cItems &a_Items)
Tosses a list of items.
Definition: Player.cpp:478
cPlayer::m_SpawnWorldName
std::string m_SpawnWorldName
The name of the world which the player respawns in upon death.
Definition: Player.h:663
cPlayer::CloseWindowIfID
void CloseWindowIfID(char a_WindowID, bool a_CanRefuse=true)
Closes the current window if it matches the specified ID, resets current window to m_InventoryWindow.
Definition: Player.cpp:1169
cPlayer::IsFishing
bool IsFishing(void) const
Returns true if the player has thrown out a floater.
Definition: Player.h:386
cPlayer::IsSatiated
bool IsSatiated(void) const
Returns true if the player is satiated, i.
Definition: Player.h:360
cPlayer::GetLoadedWorldName
const AString & GetLoadedWorldName() const
Definition: Player.h:429
cPlayer::SetCrouch
void SetCrouch(bool a_ShouldCrouch)
Starts or stops crouching, if our current body stance permits, broadcasting the state change.
Definition: Player.cpp:656
cPlayer::m_LifetimeTotalXp
int m_LifetimeTotalXp
Player Xp level.
Definition: Player.h:726
cPlayer::m_EnderChestContents
cItemGrid m_EnderChestContents
An item grid that stores the player specific enderchest contents.
Definition: Player.h:652
cPlayer::GetXpLifetimeTotal
int GetXpLifetimeTotal(void)
Gets the experience total - XpTotal for score on death.
Definition: Player.h:114
cPlayer::GetXpPercentage
float GetXpPercentage(void) const
Gets the experience bar percentage - XpP.
Definition: Player.cpp:246
cPlayer::SetSkinParts
void SetSkinParts(int a_Parts)
Definition: Player.cpp:2504
cPlayer::TossPickup
void TossPickup(const cItem &a_Item)
tosses a pickup newly created from a_Item
Definition: Player.cpp:1791
cPlayer::m_IsFrozen
bool m_IsFrozen
If true, we are locking m_Position to m_FrozenPosition.
Definition: Player.h:705
cPlayer::IsGameModeAdventure
bool IsGameModeAdventure(void) const
Returns true if the player is in Adventure mode, either explicitly, or by inheriting from current wor...
Definition: Player.cpp:1043
cPlayer::Unfreeze
void Unfreeze()
Cancels Freeze(...) and allows the player to move naturally.
Definition: Player.cpp:1441
cPlayer::GetClientHandle
cClientHandle * GetClientHandle(void) const
Definition: Player.h:276
cPlayer::SendRotation
void SendRotation(double a_YawDegrees, double a_PitchDegrees)
Sends the "look" packet to the player, forcing them to set their rotation to the specified values.
Definition: Player.cpp:1460
cPlayer::SetBedPos
void SetBedPos(Vector3i a_Position)
Sets the player's bed position to the specified position.
Definition: Player.cpp:786
cPlayer::GetSuffix
AString GetSuffix(void) const
Returns the player name suffix, may contain @ format directives.
Definition: Player.cpp:1676
cPlayer::GetCurrentXp
int GetCurrentXp(void)
Gets the current experience.
Definition: Player.h:117
cInventory::GetEquippedLeggings
const cItem & GetEquippedLeggings(void) const
Definition: Inventory.h:178
cPlayer::m_MsgSuffix
AString m_MsgSuffix
Definition: Player.h:632
cPlayer::GetDigSpeed
float GetDigSpeed(BLOCKTYPE a_Block)
Returns the dig speed using the current tool on the block a_Block.
Definition: Player.cpp:2607
cPlayer::IsLeftHanded
bool IsLeftHanded() const
Returns true if the player's left hand is dominant.
Definition: Player.cpp:460
cPlayer::SetIsFishing
void SetIsFishing(bool a_IsFishing, UInt32 a_FloaterID=cEntity::INVALID_ID)
Definition: Player.h:388
cPlayer::ReplaceOneEquippedItemTossRest
void ReplaceOneEquippedItemTossRest(const cItem &)
Removes one item from the the current equipped item stack, and attempts to add the specified item sta...
Definition: Player.cpp:1745
cPlayer::GetFloaterID
UInt32 GetFloaterID(void) const
Definition: Player.h:390
cChunk
Definition: Chunk.h:35
cPlayer::UpdateMovementStats
void UpdateMovementStats(const Vector3d &a_DeltaPos, bool a_PreviousIsOnGround)
Update movement-related statistics.
Definition: Player.cpp:2216
cPlayer::SpectateEntity
void SpectateEntity(cEntity *a_Target)
Spectates the target entity.
Definition: Player.cpp:1471
cPlayer::PermuteEnchantmentSeed
void PermuteEnchantmentSeed()
Permute the seed for enchanting related PRNGs, don't use this for other purposes.
Definition: Player.cpp:1576
cPlayer::m_FoodExhaustionLevel
double m_FoodExhaustionLevel
A "buffer" which adds up hunger before it is substracted from m_FoodSaturationLevel or m_FoodLevel.
Definition: Player.h:646
cInventory::GetEquippedHelmet
const cItem & GetEquippedHelmet(void) const
Definition: Inventory.h:176
cPlayer::GetEquippedLeggings
virtual cItem GetEquippedLeggings(void) const override
Returns the currently equipped leggings; empty item if none.
Definition: Player.h:600
cPlayer::IsStanding
bool IsStanding() const
Returns true if a player is standing normally, that is, in a neutral pose.
Definition: Player.cpp:469
cEntity
Definition: Entity.h:75
cPlayer::GetXpLevel
int GetXpLevel(void) const
Gets the current level - XpLevel.
Definition: Player.cpp:237
cPlayer::m_MsgNameColorCode
AString m_MsgNameColorCode
Definition: Player.h:633
CustomStatistic
CustomStatistic
Definition: CustomStatistics.h:4
cPlayer
Definition: Player.h:27
cItemGrid
Definition: ItemGrid.h:19
cPlayer::Heal
virtual void Heal(int a_Health) override
Heals the player by the specified amount of HPs (positive only); sends health update.
Definition: Player.cpp:369
cPlayer::m_TicksUntilNextSave
unsigned int m_TicksUntilNextSave
How long till the player's inventory will be saved Default save interval is #defined in PLAYER_INVENT...
Definition: Player.h:743
cPlayer::ClearInventoryPaintSlots
void ClearInventoryPaintSlots(void)
Clears the list of slots that are being inventory-painted.
Definition: Player.cpp:561
cPawn
Definition: Pawn.h:15
cTickTimeLong
std::chrono::duration< signed long long int, cTickTime::period > cTickTimeLong
Definition: Globals.h:364
cPlayer::m_FoodTickTimer
int m_FoodTickTimer
Count-up to the healing or damaging action, based on m_FoodLevel.
Definition: Player.h:643
cPlayer::NotifyNearbyWolves
void NotifyNearbyWolves(cPawn *a_Opponent, bool a_IsPlayerInvolved)
Notify nearby wolves that the player or one of the player's wolves took damage or did damage to an en...
Definition: Player.cpp:831
cPlayer::BodyStanceSleeping::BodyStanceSleeping
BodyStanceSleeping(cPlayer &a_Player)
Definition: Player.cpp:89
UNUSED
#define UNUSED
Definition: Globals.h:72
cPlayer::BodyStanceStanding
Tag representing the neutral stance.
Definition: Player.h:53
eDamageType
eDamageType
Damage type, used in the TakeDamageInfo structure and related functions.
Definition: Defines.h:243
cPlayer::StartEating
void StartEating(void)
Starts eating the currently equipped item.
Definition: Player.cpp:514
cPlayer::ForceSetSpeed
void ForceSetSpeed(const Vector3d &a_Speed)
Forces the player to move in the given direction.
Definition: Player.cpp:1540
cPlayer::SetFoodLevel
void SetFoodLevel(int a_FoodLevel)
Definition: Player.cpp:379
cPlayer::RefreshRank
void RefreshRank()
(Re)loads the rank and permissions from the cRankManager.
Definition: Player.cpp:2807
cPlayer::m_FlyingMaxSpeed
double m_FlyingMaxSpeed
Max speed, relative to the game default flying max speed, when flying.
Definition: Player.h:694
cPlayer::SetGameMode
void SetGameMode(eGameMode a_GameMode)
Sets the gamemode for the player.
Definition: Player.cpp:1308
cPlayer::StartChargingBow
void StartChargingBow(void)
Starts charging the equipped bow.
Definition: Player.cpp:312
ctChatBox
@ ctChatBox
Definition: Defines.h:150
cPlayer::m_IsTeleporting
bool m_IsTeleporting
Flag used by food handling system to determine whether a teleport has just happened.
Definition: Player.h:718
cPlayer::m_NormalMaxSpeed
double m_NormalMaxSpeed
Max speed, relative to the game default.
Definition: Player.h:684
cPlayer::GetEquippedWeapon
virtual cItem GetEquippedWeapon(void) const override
Returns the curently equipped weapon; empty item if none.
Definition: Player.h:597
cPlayer::SendMessageWarning
void SendMessageWarning(const AString &a_Message)
Definition: Player.cpp:1218
AString
std::string AString
Definition: StringUtils.h:11
cPlayer::m_EatingFinishTick
cTickTimeLong m_EatingFinishTick
The world tick in which eating will be finished.
Definition: Player.h:723
cRandomWrapper
Class to wrap any random engine to provide a more convenient interface.
Definition: FastRandom.h:57
cPlayer::GetName
const AString & GetName(void) const
Definition: Player.cpp:1299
cPlayer::UpdateCapabilities
void UpdateCapabilities()
Updates player's capabilities - flying, visibility, etc.
Definition: Player.cpp:1346
Vector3< double >
cPawn::m_bTouchGround
bool m_bTouchGround
Definition: Pawn.h:105
cPlayer::CloseWindow
void CloseWindow(bool a_CanRefuse=true)
Closes the current window, resets current window to m_InventoryWindow.
Definition: Player.cpp:1144
cPlayer::GetKnownRecipes
const std::set< UInt32 > & GetKnownRecipes() const
Gets the set of IDs for recipes this player has discovered.
Definition: Player.cpp:206
TakeDamageInfo
Definition: Entity.h:59
cPlayer::cPlayer
cPlayer(const std::shared_ptr< cClientHandle > &a_Client)
Definition: Player.cpp:117
cPlayer::GetThrowStartPos
Vector3d GetThrowStartPos(void) const
Returns the position where projectiles thrown by this player should start, player eye position + adju...
Definition: Player.cpp:1501
cPlayer::OpenHorseInventory
void OpenHorseInventory()
Opens the inventory of any tame horse the player is riding.
Definition: Player.cpp:1904
cPlayer::GetMiningProgressPerTick
float GetMiningProgressPerTick(BLOCKTYPE a_Block)
Returns the progress mined per tick for the block a_Block as a fraction (1 would be completely mined)...
Definition: Player.cpp:2673
cPlayer::GetEquippedBoots
virtual cItem GetEquippedBoots(void) const override
Returns the currently equipped boots; empty item if none.
Definition: Player.h:601
cPlayer::SendMessageFatal
void SendMessageFatal(const AString &a_Message)
Definition: Player.cpp:1227
cPlayer::GetGameMode
eGameMode GetGameMode(void) const
Returns the current gamemode.
Definition: Player.h:199
cPlayer::IsInvisible
virtual bool IsInvisible() const override
Definition: Player.cpp:2976
cPlayer::GetDraggingItem
cItem & GetDraggingItem(void)
In UI windows, get the item that the player is dragging.
Definition: Player.h:448
cPlayer::m_IsChargingBow
bool m_IsChargingBow
Definition: Player.h:696
cPlayer::OpenWindow
void OpenWindow(cWindow &a_Window)
Opens the specified window; closes the current one first using CloseWindow()
Definition: Player.cpp:1123
cPlayer::SetFlying
void SetFlying(bool a_ShouldFly)
Starts or stops flying, broadcasting the state change.
Definition: Player.cpp:700
cPlayer::SetFoodSaturationLevel
void SetFoodSaturationLevel(double a_FoodSaturationLevel)
Definition: Player.cpp:396
cPlayer::GetSkinParts
int GetSkinParts(void) const
Definition: Player.h:560
cPlayer::GetFoodLevel
int GetFoodLevel(void) const
Definition: Player.h:354
cPlayer::m_Permissions
AStringVector m_Permissions
All the permissions that this player has, based on their rank.
Definition: Player.h:618
AStringVector
std::vector< AString > AStringVector
Definition: StringUtils.h:12
cPlayer::HandleFloater
void HandleFloater(void)
Called in each tick if the player is fishing to make sure the floater dissapears when the player does...
Definition: Player.cpp:2172
cPlayer::GetNormalMaxSpeed
double GetNormalMaxSpeed(void) const
Gets the normal relative maximum speed.
Definition: Player.h:469