AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
Corpse Class Reference

#include "Corpse.h"

Inheritance diagram for Corpse:
WorldObject GridObject< Corpse > Object WorldLocation Position

Public Member Functions

 Corpse (CorpseType type=CORPSE_BONES)
 
 ~Corpse () override
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void BuildValuesUpdate (uint8 updateType, ByteBuffer *data, Player *target) override
 
bool Create (ObjectGuid::LowType guidlow)
 
bool Create (ObjectGuid::LowType guidlow, Player *owner)
 
void SaveToDB ()
 
bool LoadCorpseFromDB (ObjectGuid::LowType guid, Field *fields)
 
void DeleteFromDB (CharacterDatabaseTransaction trans)
 
ObjectGuid GetOwnerGUID () const
 
time_t const & GetGhostTime () const
 
void ResetGhostTime ()
 
CorpseType GetType () const
 
CellCoord const & GetCellCoord () const
 
void SetCellCoord (CellCoord const &cellCoord)
 
bool IsExpired (time_t t) const
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
virtual void Update (uint32)
 
void _Create (ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle, Position const *startPos=nullptr) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle, float controlZ=0, Position const *startPos=nullptr) const
 
void GetVoidClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=0, float controlZ=0) const
 
bool GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0, WorldObject const *forWho=nullptr, bool force=false) const
 
void MovePosition (Position &pos, float dist, float angle, bool disableWarning=false)
 
Position GetNearPosition (float dist, float angle, bool disableWarning=false)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float startX, float startY, float startZ, float destX, float destY)
 
Position GetFirstCollisionPosition (float destX, float destY, float destZ)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius, bool disableWarning=false)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
void GetChargeContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
virtual float GetCombatReach () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z, float *groundZ=nullptr) const
 
void GetRandomPoint (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (const Position &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
uint32 GetPhaseMask () const
 
bool InSamePhase (WorldObject const *obj) const
 
bool InSamePhase (uint32 phasemask) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsOutdoors () const
 
LiquidData const & GetLiquidData () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string const &newname)
 
virtual std::string const & GetNameForLocaleIdx (LocaleConstant) const
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (const Position &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (const Position *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (const Position *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true, bool useBoundingRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS) const
 
bool IsWithinLOSInMap (WorldObject const *obj, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
Position GetHitSpherePointFor (Position const &dest, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z, Optional< float > collisionHeight={ }, Optional< float > combatReach={ }) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=M_PI) const
 
bool isInBack (WorldObject const *target, float arc=M_PI) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void CleanupsBeforeDelete (bool finalCleanup=true)
 
virtual void SendMessageToSet (WorldPacket const *data, bool self) const
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self) const
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr) const
 
virtual uint8 getLevelForTarget (WorldObject const *) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=nullptr)
 
void PlayDirectSound (uint32 sound_id, Player *target=nullptr)
 
void PlayRadiusSound (uint32 sound_id, float radius)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void PlayRadiusMusic (uint32 music_id, float radius)
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
virtual float GetSightRange (WorldObject const *target=nullptr) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlayMusic (uint32 Music, bool OnlySelf)
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
void SetZoneScript ()
 
void ClearZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime, bool checkTransport=true, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, bool setLevel=false, CreatureAI *(*GetAI)(Creature *)=nullptr)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=nullptr)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range, bool onlySpawned=false) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance=0) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetDeadCreatureListInGrid (std::list< Creature * > &lList, float maxSearchRange, bool alive=false) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true, bool fromUpdate=false)
 
void BuildUpdate (UpdateDataMapType &data_map, UpdatePlayerSet &player_set) override
 
void GetCreaturesWithEntryInRange (std::list< Creature * > &creatureList, float radius, uint32 entry)
 
void SetPositionDataUpdate ()
 
void UpdatePositionData ()
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
void RemoveFromNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
bool NotifyExecuted (uint16 f) const
 
void SetNotified (uint16 f)
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
bool IsFarVisible () const
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
bool IsInWintergrasp () const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
virtual ObjectGuid GetTransGUID () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
float GetMapWaterOrGroundLevel (float x, float y, float z, float *ground=nullptr) const
 
float GetMapHeight (float x, float y, float z, bool vmap=true, float distanceToSearch=50.0f) const
 
float GetFloorZ () const
 
float GetMinHeightInWater () const
 Get the minimum height of a object that should be in water to start floating/swim. More...
 
virtual float GetCollisionHeight () const
 
virtual float GetCollisionWidth () const
 
virtual float GetCollisionRadius () const
 
void AddAllowedLooter (ObjectGuid guid)
 
void ResetAllowedLooters ()
 
void SetAllowedLooters (GuidUnorderedSet const looters)
 
bool HasAllowedLooter (ObjectGuid guid) const
 
GuidUnorderedSet const & GetAllowedLooters () const
 
void RemoveAllowedLooter (ObjectGuid guid)
 
std::string GetDebugInfo () const override
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
virtual void AddToWorld ()
 
virtual void RemoveFromWorld ()
 
ObjectGuid GetGUID () const
 
PackedGuid const & GetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
virtual uint32 GetDynamicFlags () const
 
bool HasDynamicFlag (uint32 flag) const
 
virtual void SetDynamicFlag (uint32 flag)
 
virtual void RemoveDynamicFlag (uint32 flag)
 
virtual void ReplaceAllDynamicFlags (uint32 flag)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target)
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target)
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid GetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetInt16Value (uint16 index, uint8 offset, int16 value)
 
void SetGuidValue (uint16 index, ObjectGuid value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt64Value (uint16 index, int32 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
virtual void BuildUpdate (UpdateDataMapType &, UpdatePlayerSet &)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &)
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynamicObject () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsItem () const
 
virtual std::string GetDebugInfo () const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (uint32 mapId, Position const &position)
 
void WorldRelocate (const WorldLocation &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
void SetMapId (uint32 mapId)
 
uint32 GetMapId () const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z) const
 
void GetWorldLocation (uint32 &mapId, float &x, float &y, float &z, float &o) const
 
void GetWorldLocation (WorldLocation *location) const
 
WorldLocation GetWorldLocation () const
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
 Position (Position &&)=default
 
Positionoperator= (const Position &)=default
 
Positionoperator= (Position &&)=default
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a)
 
 operator G3D::Vector3 () const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (const Position &pos)
 
void Relocate (const Position *pos)
 
void RelocatePolarOffset (float angle, float dist, float z=0.0f)
 
void RelocateOffset (const Position &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (const float x, const float y) const
 
float GetExactDist2dSq (Position const &pos) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2d (Position const &pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDistSq (Position const &pos) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDist (Position const &pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (const Position &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (const Position *pos) const
 
float GetAngle (float x, float y) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float GetRelativeAngle (const Position *pos) const
 
float GetRelativeAngle (float x, float y) const
 
float ToAbsoluteAngle (float relAngle) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (const Position *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (const Position *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, const Position *pos, float targetRadius=0.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 
- Public Member Functions inherited from GridObject< Corpse >
bool IsInGrid () const
 
void AddToGrid (GridRefMgr< Corpse > &m)
 
void RemoveFromGrid ()
 

Static Public Member Functions

static void DeleteFromDB (ObjectGuid const ownerGuid, CharacterDatabaseTransaction trans)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

Loot loot
 
PlayerlootRecipient
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
 
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
 
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
 
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
ElunaEventProcessor * elunaEvents
 
- Public Attributes inherited from Object
DataMap CustomData
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX = 0
 
float m_positionY = 0
 
float m_positionZ = 0
 
float m_orientation = 0
 

Private Attributes

CorpseType m_type
 
time_t m_time
 
CellCoord _cellCoord
 

Additional Inherited Members

- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
virtual void ProcessPositionDataChanged (PositionFullTerrainStatus const &data)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsNeverVisible () const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *) const
 
virtual bool IsInvisibleDueToDespawn () const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
 
virtual void BuildValuesUpdate (uint8 updateType, ByteBuffer *data, Player *target)
 
virtual void AddToObjectUpdate ()=0
 
virtual void RemoveFromObjectUpdate ()=0
 
void AddToObjectUpdateIfNeeded ()
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
bool m_isFarVisible
 
Optional< float > m_visibilityDistanceOverride
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint16 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
UpdateMask _changesMask
 
uint16 m_valuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Detailed Description

Constructor & Destructor Documentation

◆ Corpse()

Corpse::Corpse ( CorpseType  type = CORPSE_BONES)
explicit
29 : WorldObject(type != CORPSE_BONES), m_type(type)
30{
35 m_time = GameTime::GetGameTime().count();
36 lootRecipient = nullptr;
37}
@ CORPSE_BONES
Definition: Corpse.h:28
@ UPDATEFLAG_POSITION
Definition: UpdateData.h:47
@ UPDATEFLAG_LOWGUID
Definition: UpdateData.h:43
@ UPDATEFLAG_STATIONARY_POSITION
Definition: UpdateData.h:45
@ CORPSE_END
Definition: UpdateFields.h:430
@ TYPEID_CORPSE
Definition: ObjectGuid.h:39
@ TYPEMASK_CORPSE
Definition: ObjectGuid.h:53
Seconds GetGameTime()
Definition: GameTime.cpp:38
Player * lootRecipient
Definition: Corpse.h:78
CorpseType m_type
Definition: Corpse.h:83
time_t m_time
Definition: Corpse.h:84
uint16 m_objectType
Definition: Object.h:240
uint16 m_valuesCount
Definition: Object.h:254
uint16 m_updateFlag
Definition: Object.h:243
TypeID m_objectTypeId
Definition: Object.h:242
Definition: Object.h:405

References CORPSE_END, GameTime::GetGameTime(), lootRecipient, Object::m_objectType, Object::m_objectTypeId, m_time, Object::m_updateFlag, Object::m_valuesCount, TYPEID_CORPSE, TYPEMASK_CORPSE, UPDATEFLAG_LOWGUID, UPDATEFLAG_POSITION, and UPDATEFLAG_STATIONARY_POSITION.

◆ ~Corpse()

Corpse::~Corpse ( )
override
40{
41}

Member Function Documentation

◆ AddToWorld()

void Corpse::AddToWorld ( )
overridevirtual
  • Register the corpse for guid lookup

Reimplemented from Object.

44{
46 if (!IsInWorld())
48
50}
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:132
Definition: Corpse.h:49
bool IsInWorld() const
Definition: Object.h:104
virtual void AddToWorld()
Definition: Object.cpp:152
ObjectGuid GetGUID() const
Definition: Object.h:110
Map * GetMap() const
Definition: Object.h:531
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:515

References Object::AddToWorld(), Object::GetGUID(), WorldObject::GetMap(), Map::GetObjectsStore(), TypeUnorderedMapContainer< OBJECT_TYPES, KEY_TYPE >::Insert(), and Object::IsInWorld().

◆ BuildValuesUpdate()

void Corpse::BuildValuesUpdate ( uint8  updateType,
ByteBuffer data,
Player target 
)
overridevirtual

Reimplemented from Object.

201{
202 if (!target)
203 return;
204
205 ByteBuffer fieldBuffer;
206 UpdateMask updateMask;
207 updateMask.SetCount(m_valuesCount);
208
209 uint32* flags = nullptr;
210 uint32 visibleFlag = GetUpdateFieldData(target, flags);
211
212 for (uint16 index = 0; index < m_valuesCount; ++index)
213 {
214 if (_fieldNotifyFlags & flags[index] || ((updateType == UPDATETYPE_VALUES ? _changesMask.GetBit(index) : m_uint32Values[index]) && (flags[index] & visibleFlag)))
215 {
216 updateMask.SetBit(index);
217
218 if (index == CORPSE_FIELD_BYTES_1 || index == CORPSE_FIELD_BYTES_2)
219 {
221 if (owner && owner != target && sWorld->getBoolConfig(CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP) && owner->IsInRaidWith(target) && owner->GetTeamId() != target->GetTeamId())
222 {
223 uint32 playerBytes = target->GetUInt32Value(PLAYER_BYTES);
224 uint32 playerBytes2 = target->GetUInt32Value(PLAYER_BYTES_2);
225
226 uint8 race = target->getRace();
227 uint8 skin = (uint8)(playerBytes);
228 uint8 face = (uint8)(playerBytes >> 8);
229 uint8 hairstyle = (uint8)(playerBytes >> 16);
230 uint8 haircolor = (uint8)(playerBytes >> 24);
231 uint8 facialhair = (uint8)(playerBytes2);
232
233 uint32 corpseBytes1 = ((0x00) | (race << 8) | (target->GetByteValue(PLAYER_BYTES_3, 0) << 16) | (skin << 24));
234 uint32 corpseBytes2 = ((face) | (hairstyle << 8) | (haircolor << 16) | (facialhair << 24));
235
236 if (index == CORPSE_FIELD_BYTES_1)
237 {
238 fieldBuffer << corpseBytes1;
239 }
240 else
241 {
242 fieldBuffer << corpseBytes2;
243 }
244 }
245 else
246 {
247 fieldBuffer << m_uint32Values[index];
248 }
249 }
250 else
251 {
252 fieldBuffer << m_uint32Values[index];
253 }
254 }
255 }
256
257 *data << uint8(updateMask.GetBlockCount());
258 updateMask.AppendToPacket(data);
259 data->append(fieldBuffer);
260}
std::uint8_t uint8
Definition: Define.h:109
std::uint32_t uint32
Definition: Define.h:107
std::uint16_t uint16
Definition: Define.h:108
@ CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP
Definition: IWorld.h:75
@ UPDATETYPE_VALUES
Definition: UpdateData.h:28
@ CORPSE_FIELD_BYTES_2
Definition: UpdateFields.h:425
@ CORPSE_FIELD_BYTES_1
Definition: UpdateFields.h:424
@ PLAYER_BYTES_3
Definition: UpdateFields.h:183
@ PLAYER_BYTES_2
Definition: UpdateFields.h:182
@ PLAYER_BYTES
Definition: UpdateFields.h:181
#define sWorld
Definition: World.h:443
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:220
ObjectGuid GetOwnerGUID() const
Definition: Corpse.h:68
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition: Object.cpp:323
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305
uint16 _fieldNotifyFlags
Definition: Object.h:256
uint32 GetUpdateFieldData(Player const *target, uint32 *&flags) const
Definition: Object.cpp:559
UpdateMask _changesMask
Definition: Object.h:252
uint32 * m_uint32Values
Definition: Object.h:248
Definition: UpdateMask.h:25
uint32 GetBlockCount() const
Definition: UpdateMask.h:62
bool GetBit(uint32 index) const
Definition: UpdateMask.h:47
void SetCount(uint32 valuesCount)
Definition: UpdateMask.h:65
void SetBit(uint32 index)
Definition: UpdateMask.h:45
void AppendToPacket(ByteBuffer *data)
Definition: UpdateMask.h:49
Definition: Player.h:1064
TeamId GetTeamId(bool original=false) const
Definition: Player.h:2090
uint8 getRace(bool original=false) const
Definition: Unit.cpp:20993
bool IsInRaidWith(Unit const *unit) const
Definition: Unit.cpp:18784
Definition: ByteBuffer.h:70
void append(T value)
Definition: ByteBuffer.h:129

References Object::_changesMask, Object::_fieldNotifyFlags, ByteBuffer::append(), UpdateMask::AppendToPacket(), CONFIG_ALLOW_TWO_SIDE_INTERACTION_GROUP, CORPSE_FIELD_BYTES_1, CORPSE_FIELD_BYTES_2, UpdateMask::GetBit(), UpdateMask::GetBlockCount(), Object::GetByteValue(), GetOwnerGUID(), ObjectAccessor::GetPlayer(), Unit::getRace(), Player::GetTeamId(), Object::GetUInt32Value(), Object::GetUpdateFieldData(), Unit::IsInRaidWith(), Object::m_uint32Values, Object::m_valuesCount, PLAYER_BYTES, PLAYER_BYTES_2, PLAYER_BYTES_3, UpdateMask::SetBit(), UpdateMask::SetCount(), sWorld, and UPDATETYPE_VALUES.

◆ Create() [1/2]

bool Corpse::Create ( ObjectGuid::LowType  guidlow)
62{
63 Object::_Create(guidlow, 0, HighGuid::Corpse);
64 return true;
65}
void _Create(ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
Definition: Object.cpp:134

References Object::_Create().

Referenced by Map::ConvertCorpseToBones(), and Player::CreateCorpse().

◆ Create() [2/2]

bool Corpse::Create ( ObjectGuid::LowType  guidlow,
Player owner 
)
68{
69 ASSERT(owner);
70
71 Relocate(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ(), owner->GetOrientation());
72
73 if (!IsPositionValid())
74 {
75 LOG_ERROR("entities.player", "Corpse (guidlow {}, owner {}) not created. Suggested coordinates isn't valid (X: {} Y: {})",
76 guidlow, owner->GetName(), owner->GetPositionX(), owner->GetPositionY());
77 return false;
78 }
79
80 WorldObject::_Create(guidlow, HighGuid::Corpse, owner->GetPhaseMask());
81
84
86
87 return true;
88}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:157
#define ASSERT
Definition: Errors.h:68
@ CORPSE_FIELD_OWNER
Definition: UpdateFields.h:420
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:190
CellCoord _cellCoord
Definition: Corpse.h:85
void SetGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:723
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:109
virtual void SetObjectScale(float scale)
Definition: Object.h:116
uint32 GetPhaseMask() const
Definition: Object.h:446
void _Create(ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
Definition: Object.cpp:1139
std::string const & GetName() const
Definition: Object.h:458
float GetPositionZ() const
Definition: Position.h:118
float GetOrientation() const
Definition: Position.h:119
bool IsPositionValid() const
Definition: Position.cpp:175
float GetPositionX() const
Definition: Position.h:116
float GetPositionY() const
Definition: Position.h:117
void Relocate(float x, float y)
Definition: Position.h:72

References _cellCoord, WorldObject::_Create(), ASSERT, Acore::ComputeCellCoord(), CORPSE_FIELD_OWNER, Object::GetGUID(), WorldObject::GetName(), Position::GetOrientation(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Position::IsPositionValid(), LOG_ERROR, Position::Relocate(), Object::SetGuidValue(), and Object::SetObjectScale().

◆ DeleteFromDB() [1/2]

void Corpse::DeleteFromDB ( CharacterDatabaseTransaction  trans)
120{
121 DeleteFromDB(GetOwnerGUID(), trans);
122}
void DeleteFromDB(CharacterDatabaseTransaction trans)
Definition: Corpse.cpp:119

References DeleteFromDB(), and GetOwnerGUID().

Referenced by Map::ConvertCorpseToBones(), DeleteFromDB(), Player::DeleteFromDB(), Player::OfflineResurrect(), Player::RemoveCorpse(), and SaveToDB().

◆ DeleteFromDB() [2/2]

void Corpse::DeleteFromDB ( ObjectGuid const  ownerGuid,
CharacterDatabaseTransaction  trans 
)
static
125{
127 stmt->SetData(0, ownerGuid.GetCounter());
128 CharacterDatabase.ExecuteOrAppend(trans, stmt);
129}
DatabaseWorkerPool< CharacterDatabaseConnection > CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
@ CHAR_DEL_CORPSE
Definition: CharacterDatabase.h:246
Definition: PreparedStatement.h:157
Acore::Types::is_default< T > SetData(const uint8 index, T value)
Definition: PreparedStatement.h:77

References CHAR_DEL_CORPSE, CharacterDatabase, ObjectGuid::GetCounter(), and PreparedStatementBase::SetData().

◆ GetCellCoord()

CellCoord const & Corpse::GetCellCoord ( ) const
inline

◆ GetGhostTime()

time_t const & Corpse::GetGhostTime ( ) const
inline

◆ GetOwnerGUID()

ObjectGuid Corpse::GetOwnerGUID ( ) const
inline

◆ GetType()

◆ IsExpired()

bool Corpse::IsExpired ( time_t  t) const
184{
185 // Deleted character
186 if (!sCharacterCache->GetCharacterCacheByGuid(GetOwnerGUID()))
187 return true;
188
189 if (m_type == CORPSE_BONES)
190 return m_time < t - 60 * MINUTE;
191 else
192 return m_time < t - 3 * DAY;
193}
constexpr auto DAY
Definition: Common.h:49
constexpr auto MINUTE
Definition: Common.h:47
#define sCharacterCache
Definition: CharacterCache.h:83

References CORPSE_BONES, DAY, GetOwnerGUID(), m_time, m_type, MINUTE, and sCharacterCache.

◆ LoadCorpseFromDB()

bool Corpse::LoadCorpseFromDB ( ObjectGuid::LowType  guid,
Field fields 
)
132{
133 ObjectGuid::LowType ownerGuid = fields[16].Get<uint32>();
134
135 // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
136 // SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, guildId, flags, dynFlags, time, corpseType, instanceId, phaseMask, guid FROM corpse WHERE mapId = ? AND instanceId = ?
137 float posX = fields[0].Get<float>();
138 float posY = fields[1].Get<float>();
139 float posZ = fields[2].Get<float>();
140 float o = fields[3].Get<float>();
141 uint32 mapId = fields[4].Get<uint16>();
142
143 Object::_Create(guid, 0, HighGuid::Corpse);
144
145 SetObjectScale(1.0f);
146 SetUInt32Value(CORPSE_FIELD_DISPLAY_ID, fields[5].Get<uint32>());
147
148 if (!_LoadIntoDataField(fields[6].Get<std::string>(), CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END))
149 {
150 LOG_ERROR("entities.player", "Corpse ({}, owner: {}) is not created, given equipment info is not valid ('{}')",
151 GetGUID().ToString(), GetOwnerGUID().ToString(), fields[6].Get<std::string>());
152 }
153
154 SetUInt32Value(CORPSE_FIELD_BYTES_1, fields[7].Get<uint32>());
155 SetUInt32Value(CORPSE_FIELD_BYTES_2, fields[8].Get<uint32>());
156 SetUInt32Value(CORPSE_FIELD_GUILD, fields[9].Get<uint32>());
157 SetUInt32Value(CORPSE_FIELD_FLAGS, fields[10].Get<uint8>());
158 SetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS, fields[11].Get<uint8>());
159 SetGuidValue(CORPSE_FIELD_OWNER, ObjectGuid::Create<HighGuid::Player>(ownerGuid));
160
161 m_time = time_t(fields[12].Get<uint32>());
162
163 uint32 instanceId = fields[14].Get<uint32>();
164 uint32 phaseMask = fields[15].Get<uint32>();
165
166 // place
167 SetLocationInstanceId(instanceId);
168 SetLocationMapId(mapId);
169 SetPhaseMask(phaseMask, false);
170 Relocate(posX, posY, posZ, o);
171
172 if (!IsPositionValid())
173 {
174 LOG_ERROR("entities.player", "Corpse ( {}, owner: {}) is not created, given coordinates are not valid (X: {}, Y: {}, Z: {})",
175 GetGUID().ToString(), GetOwnerGUID().ToString(), posX, posY, posZ);
176 return false;
177 }
178
180 return true;
181}
@ EQUIPMENT_SLOT_END
Definition: Player.h:694
@ CORPSE_FIELD_FLAGS
Definition: UpdateFields.h:427
@ CORPSE_FIELD_DISPLAY_ID
Definition: UpdateFields.h:422
@ CORPSE_FIELD_ITEM
Definition: UpdateFields.h:423
@ CORPSE_FIELD_GUILD
Definition: UpdateFields.h:426
@ CORPSE_FIELD_DYNAMIC_FLAGS
Definition: UpdateFields.h:428
std::enable_if_t< std::is_arithmetic_v< T >, T > Get() const
Definition: Field.h:112
bool _LoadIntoDataField(std::string const &data, uint32 startOffset, uint32 count)
Definition: Object.cpp:612
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
virtual void SetPhaseMask(uint32 newPhaseMask, bool update)
Definition: Object.cpp:2875
void SetLocationInstanceId(uint32 _instanceId)
Definition: Object.h:660
void SetLocationMapId(uint32 _mapId)
Definition: Object.h:659
uint32 LowType
Definition: ObjectGuid.h:122
std::string ToString() const
Definition: Position.cpp:51

References _cellCoord, Object::_Create(), Object::_LoadIntoDataField(), Acore::ComputeCellCoord(), CORPSE_FIELD_BYTES_1, CORPSE_FIELD_BYTES_2, CORPSE_FIELD_DISPLAY_ID, CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_FIELD_FLAGS, CORPSE_FIELD_GUILD, CORPSE_FIELD_ITEM, CORPSE_FIELD_OWNER, EQUIPMENT_SLOT_END, Field::Get(), Object::GetGUID(), GetOwnerGUID(), Position::GetPositionX(), Position::GetPositionY(), Position::IsPositionValid(), LOG_ERROR, m_time, Position::Relocate(), Object::SetGuidValue(), WorldObject::SetLocationInstanceId(), WorldObject::SetLocationMapId(), Object::SetObjectScale(), WorldObject::SetPhaseMask(), Object::SetUInt32Value(), and Position::ToString().

Referenced by Map::LoadCorpseData().

◆ RemoveFromWorld()

void Corpse::RemoveFromWorld ( )
overridevirtual
  • Remove the corpse from the accessor

Reimplemented from Object.

53{
55 if (IsInWorld())
57
59}
bool Remove(KEY_TYPE const &handle)
Definition: TypeContainer.h:138
void RemoveFromWorld() override
Definition: Object.cpp:1182

References Object::GetGUID(), WorldObject::GetMap(), Map::GetObjectsStore(), Object::IsInWorld(), TypeUnorderedMapContainer< OBJECT_TYPES, KEY_TYPE >::Remove(), and WorldObject::RemoveFromWorld().

Referenced by Player::RemoveCorpse(), Map::RemoveCorpse(), and Map::UnloadAll().

◆ ResetGhostTime()

void Corpse::ResetGhostTime ( )
196{
197 m_time = GameTime::GetGameTime().count();
198}

References GameTime::GetGameTime(), and m_time.

Referenced by Player::BuildPlayerRepop().

◆ SaveToDB()

void Corpse::SaveToDB ( )
91{
92 // prevent DB data inconsistence problems and duplicates
93 CharacterDatabaseTransaction trans = CharacterDatabase.BeginTransaction();
94 DeleteFromDB(trans);
95
97 stmt->SetData(0, GetOwnerGUID().GetCounter()); // guid
98 stmt->SetData (1, GetPositionX()); // posX
99 stmt->SetData (2, GetPositionY()); // posY
100 stmt->SetData (3, GetPositionZ()); // posZ
101 stmt->SetData (4, GetOrientation()); // orientation
102 stmt->SetData(5, GetMapId()); // mapId
103 stmt->SetData(6, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId
105 stmt->SetData(8, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1
106 stmt->SetData(9, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2
107 stmt->SetData(10, GetUInt32Value(CORPSE_FIELD_GUILD)); // guildId
108 stmt->SetData (11, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags
109 stmt->SetData (12, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags
110 stmt->SetData(13, uint32(m_time)); // time
111 stmt->SetData (14, GetType()); // corpseType
112 stmt->SetData(15, GetInstanceId()); // instanceId
113 stmt->SetData(16, GetPhaseMask()); // phaseMask
114 trans->Append(stmt);
115
116 CharacterDatabase.CommitTransaction(trans);
117}
SQLTransaction< CharacterDatabaseConnection > CharacterDatabaseTransaction
Definition: DatabaseEnvFwd.h:69
@ CHAR_INS_CORPSE
Definition: CharacterDatabase.h:245
CorpseType GetType() const
Definition: Corpse.h:72
std::string _ConcatFields(uint16 startIndex, uint16 size) const
Definition: Object.cpp:144
uint32 GetInstanceId() const
Definition: Object.h:443
uint32 GetMapId() const
Definition: Position.h:275

References Object::_ConcatFields(), CHAR_INS_CORPSE, CharacterDatabase, CORPSE_FIELD_BYTES_1, CORPSE_FIELD_BYTES_2, CORPSE_FIELD_DISPLAY_ID, CORPSE_FIELD_DYNAMIC_FLAGS, CORPSE_FIELD_FLAGS, CORPSE_FIELD_GUILD, CORPSE_FIELD_ITEM, DeleteFromDB(), EQUIPMENT_SLOT_END, WorldObject::GetInstanceId(), WorldLocation::GetMapId(), Position::GetOrientation(), GetOwnerGUID(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetType(), Object::GetUInt32Value(), m_time, and PreparedStatementBase::SetData().

Referenced by Player::CreateCorpse().

◆ SetCellCoord()

void Corpse::SetCellCoord ( CellCoord const &  cellCoord)
inline
75{ _cellCoord = cellCoord; }

References _cellCoord.

Referenced by Map::ConvertCorpseToBones().

Member Data Documentation

◆ _cellCoord

CellCoord Corpse::_cellCoord
private

◆ loot

◆ lootRecipient

Player* Corpse::lootRecipient

◆ m_time

time_t Corpse::m_time
private

◆ m_type

CorpseType Corpse::m_type
private

Referenced by GetType(), and IsExpired().