TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
Corpse Class Reference

#include <Corpse.h>

Public Member Functions

 Corpse (CorpseType type=CORPSE_BONES)
 
 ~Corpse ()
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
bool Create (ObjectGuid::LowType guidlow, Map *map)
 
bool Create (ObjectGuid::LowType guidlow, Player *owner)
 
void SaveToDB ()
 
bool LoadCorpseFromDB (ObjectGuid::LowType guid, Field *fields)
 
void DeleteFromDB (SQLTransaction &trans)
 
ObjectGuid GetOwnerGUID () const
 
time_t constGetGhostTime () const
 
void ResetGhostTime ()
 
CorpseType GetType () const
 
CellCoord constGetCellCoord () const
 
void SetCellCoord (CellCoord const &cellCoord)
 
bool IsExpired (time_t t) const
 
- Public Member Functions inherited from WorldObject
virtual ~WorldObject ()
 
virtual void Update (uint32)
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle) const
 
void GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z) const
 
void GetRandomPoint (Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (Position const &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
virtual bool SetInPhase (uint32 id, bool update, bool apply)
 
void CopyPhaseFrom (WorldObject *obj, bool update=false)
 
void UpdateAreaPhase ()
 
void ClearPhases (bool update=false)
 
void RebuildTerrainSwaps ()
 
void RebuildWorldMapAreaSwaps ()
 
bool HasInPhaseList (uint32 phase)
 
uint32 GetPhaseMask () const
 
bool IsInPhase (uint32 phase) const
 
bool IsInPhase (WorldObject const *obj) const
 
bool IsInTerrainSwap (uint32 terrainSwap) const
 
std::set< uint32 > constGetPhases () const
 
std::set< uint32 > constGetTerrainSwaps () const
 
std::set< uint32 > constGetWorldMapAreaSwaps () const
 
int32 GetDBPhase () const
 
void SetDBPhase (int32 p)
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
InstanceScriptGetInstanceScript ()
 
std::string constGetName () const
 
void SetName (std::string const &newname)
 
virtual std::string constGetNameForLocaleIdx (LocaleConstant) const
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (Position const &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 (Position const *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (Position const *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true) const
 
bool IsWithinLOS (float x, float y, float z) const
 
bool IsWithinLOSInMap (WorldObject const *obj) 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=float(M_PI)) const
 
bool isInBack (WorldObject const *target, float arc=float(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)
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self)
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr)
 
virtual uint8 getLevelForTarget (WorldObject const *) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=NULL)
 
void PlayDirectSound (uint32 sound_id, Player *target=NULL)
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (WorldObject const *target=NULL) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
Map constGetBaseMap () const
 
void SetZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0) const
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, CreatureAI *(*GetAI)(Creature *)=NULL)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=NULL)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetPlayerListInGrid (std::list< Player * > &lList, float fMaxSearchRange) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true)
 
void BuildUpdate (UpdateDataMapType &) override
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (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)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
template<class NOTIFIER >
void VisitNearbyObject (float const &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyGridObject (float const &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyWorldObject (float const &radius, NOTIFIER &notifier) 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
 
virtual uint16 GetAIAnimKitId () const
 
virtual uint16 GetMovementAnimKitId () const
 
virtual uint16 GetMeleeAnimKitId () const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid constGetGUID () const
 
PackedGuid constGetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
virtual void DestroyForPlayer (Player *target) 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 constGetGuidValue (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 SetGuidValue (uint16 index, ObjectGuid const &value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid const &value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid const &value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt16Value (uint16 index, uint8 offset, int16 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)
 
void ToggleByteFlag (uint16 index, uint8 offset, uint8 flag)
 
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)
 
std::vector< uint32 > constGetDynamicValues (uint16 index) const
 
void AddDynamicValue (uint16 index, uint32 value)
 
void RemoveDynamicValue (uint16 index, uint32 value)
 
void ClearDynamicValue (uint16 index)
 
void SetDynamicValue (uint16 index, uint8 offset, uint32 value)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
PlayerToPlayer ()
 
Player constToPlayer () const
 
CreatureToCreature ()
 
Creature constToCreature () const
 
UnitToUnit ()
 
Unit constToUnit () const
 
GameObjectToGameObject ()
 
GameObject constToGameObject () const
 
CorpseToCorpse ()
 
Corpse constToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject constToDynObject () const
 
AreaTriggerToAreaTrigger ()
 
AreaTrigger constToAreaTrigger () 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 (WorldLocation const &loc)
 
void WorldRelocate (WorldLocation const &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
WorldLocation GetWorldLocation () const
 
uint32 GetMapId () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
bool operator== (Position const &a)
 
bool operator!= (Position const &a)
 
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 (Position const &pos)
 
void Relocate (Position const *pos)
 
void Relocate (G3D::Vector3 const &pos)
 
void RelocateOffset (Position const &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::PositionXYStreamer PositionXYStream ()
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (float x, float y) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (Position const &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (Position const *pos) const
 
float GetAngle (float x, float y) const
 
float GetRelativeAngle (Position const *pos) const
 
float GetRelativeAngle (float x, float y) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (Position const *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (Position const *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, Position const *pos, float border=2.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 
- Public Member Functions inherited from GridObject< Corpse >
virtual ~GridObject ()
 
bool IsInGrid () const
 
void AddToGrid (GridRefManager< Corpse > &m)
 
void RemoveFromGrid ()
 

Static Public Member Functions

static void DeleteFromDB (ObjectGuid const &ownerGuid, SQLTransaction &trans)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Public Attributes

Loot loot
 
PlayerlootRecipient
 
bool lootForBody
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32,
uint32, StealthType,
TOTAL_STEALTH_TYPES
m_stealth
 
FlaggedValuesArray32< int32,
uint32, StealthType,
TOTAL_STEALTH_TYPES
m_stealthDetect
 
FlaggedValuesArray32< int32,
uint32, InvisibilityType,
TOTAL_INVISIBILITY_TYPES
m_invisibility
 
FlaggedValuesArray32< int32,
uint32, InvisibilityType,
TOTAL_INVISIBILITY_TYPES
m_invisibilityDetect
 
FlaggedValuesArray32< int32,
uint32,
ServerSideVisibilityType,
TOTAL_SERVERSIDE_VISIBILITY_TYPES
m_serverSideVisibility
 
FlaggedValuesArray32< int32,
uint32,
ServerSideVisibilityType,
TOTAL_SERVERSIDE_VISIBILITY_TYPES
m_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX
 
float m_positionY
 
float m_positionZ
 

Private Attributes

CorpseType m_type
 
time_t m_time
 
CellCoord _cellCoord
 

Additional Inherited Members

- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
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 const &guid)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
void _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
uint32 GetDynamicUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint32 flags) const
 
virtual void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
virtual void BuildDynamicValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
void AddToObjectUpdateIfNeeded ()
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint32 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
std::vector< uint32 > * _dynamicValues
 
UpdateMask _changesMask
 
UpdateMask _dynamicChangesMask
 
UpdateMask_dynamicChangesArrayMask
 
uint16 m_valuesCount
 
uint16 _dynamicValuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Constructor & Destructor Documentation

Corpse::Corpse ( CorpseType  type = CORPSE_BONES)
explicit
26  : WorldObject(type != CORPSE_BONES), m_type(type)
27 {
30 
32 
35 
36  m_time = time(NULL);
37 
38  lootForBody = false;
40 }
Definition: UpdateFields.h:369
Definition: UpdateFields.h:364
Definition: ObjectGuid.h:36
uint16 _dynamicValuesCount
Definition: Object.h:246
arena_t NULL
Definition: jemalloc_internal.h:624
bool lootForBody
Definition: Corpse.h:78
CorpseType m_type
Definition: Corpse.h:83
uint16 m_objectType
Definition: Object.h:227
TypeID m_objectTypeId
Definition: Object.h:229
Player * lootRecipient
Definition: Corpse.h:77
WorldObject(bool isWorldObject)
Definition: Object.cpp:1445
time_t m_time
Definition: Corpse.h:84
uint16 m_valuesCount
Definition: Object.h:245
Definition: UpdateData.h:43
Definition: ObjectGuid.h:53
uint32 m_updateFlag
Definition: Object.h:230
Definition: Corpse.h:29
Corpse::~Corpse ( )
42 { }

Member Function Documentation

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

Reimplemented from Object.

45 {
47  if (!IsInWorld())
49 
51 }
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:119
Definition: Corpse.h:49
Map * GetMap() const
Definition: Object.h:543
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:466
virtual void AddToWorld()
Definition: Object.cpp:142
ObjectGuid const & GetGUID() const
Definition: Object.h:105
bool IsInWorld() const
Definition: Object.h:100

+ Here is the call graph for this function:

bool Corpse::Create ( ObjectGuid::LowType  guidlow,
Map map 
)
63 {
64  Object::_Create(ObjectGuid::Create<HighGuid::Corpse>(map->GetId(), 0, guidlow));
65  return true;
66 }
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:125
uint32 GetId(void) const
Definition: Map.h:325

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool Corpse::Create ( ObjectGuid::LowType  guidlow,
Player owner 
)
69 {
70  ASSERT(owner);
71 
72  Relocate(owner->GetPositionX(), owner->GetPositionY(), owner->GetPositionZ(), owner->GetOrientation());
73 
74  if (!IsPositionValid())
75  {
76  TC_LOG_ERROR("entities.player", "Corpse (guidlow " UI64FMTD ", owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
77  guidlow, owner->GetName().c_str(), owner->GetPositionX(), owner->GetPositionY());
78  return false;
79  }
80 
81  Object::_Create(ObjectGuid::Create<HighGuid::Corpse>(GetMapId(), 0, guidlow));
82  SetPhaseMask(owner->GetPhaseMask(), false);
83 
84  SetObjectScale(1.0f);
85  SetGuidValue(CORPSE_FIELD_OWNER, owner->GetGUID());
86 
88 
89  CopyPhaseFrom(owner);
90 
91  return true;
92 }
virtual void SetPhaseMask(uint32 newPhaseMask, bool update)
Definition: Object.cpp:2795
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:125
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
void CopyPhaseFrom(WorldObject *obj, bool update=false)
Definition: Object.cpp:2915
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
CellCoord _cellCoord
Definition: Corpse.h:85
void Relocate(float x, float y)
Definition: Position.h:67
float GetPositionY() const
Definition: Position.h:105
#define UI64FMTD
Definition: Define.h:137
uint32 GetMapId() const
Definition: Position.h:254
virtual void SetObjectScale(float scale)
Definition: Object.h:111
#define ASSERT
Definition: Errors.h:55
Definition: UpdateFields.h:355
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool IsPositionValid() const
Definition: Position.cpp:40
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

void Corpse::DeleteFromDB ( SQLTransaction trans)
132 {
133  DeleteFromDB(GetOwnerGUID(), trans);
134 }
ObjectGuid GetOwnerGUID() const
Definition: Corpse.h:67
void DeleteFromDB(SQLTransaction &trans)
Definition: Corpse.cpp:131

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Corpse::DeleteFromDB ( ObjectGuid const ownerGuid,
SQLTransaction trans 
)
static
137 {
139  stmt->setUInt64(0, ownerGuid.GetCounter());
140  CharacterDatabase.ExecuteOrAppend(trans, stmt);
141 
143  stmt->setUInt64(0, ownerGuid.GetCounter());
144  CharacterDatabase.ExecuteOrAppend(trans, stmt);
145 }
void ExecuteOrAppend(SQLTransaction &trans, PreparedStatement *stmt)
Definition: DatabaseWorkerPool.h:236
Definition: CharacterDatabase.h:282
Definition: PreparedStatement.h:74
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
Definition: CharacterDatabase.h:286
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21

+ Here is the call graph for this function:

CellCoord const& Corpse::GetCellCoord ( ) const
inline
73 { return _cellCoord; }
CellCoord _cellCoord
Definition: Corpse.h:85

+ Here is the caller graph for this function:

time_t const& Corpse::GetGhostTime ( ) const
inline
69 { return m_time; }
time_t m_time
Definition: Corpse.h:84

+ Here is the caller graph for this function:

ObjectGuid Corpse::GetOwnerGUID ( ) const
inline
ObjectGuid const & GetGuidValue(uint16 index) const
Definition: Object.cpp:332
Definition: UpdateFields.h:355

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

CorpseType Corpse::GetType ( ) const
inline
71 { return m_type; }
CorpseType m_type
Definition: Corpse.h:83

+ Here is the caller graph for this function:

bool Corpse::IsExpired ( time_t  t) const
190 {
191  // Deleted character
192  if (!sWorld->GetCharacterInfo(GetOwnerGUID()))
193  return true;
194 
195  if (m_type == CORPSE_BONES)
196  return m_time < t - 60 * MINUTE;
197  else
198  return m_time < t - 3 * DAY;
199 }
ObjectGuid GetOwnerGUID() const
Definition: Corpse.h:67
#define sWorld
Definition: World.h:887
CorpseType m_type
Definition: Corpse.h:83
Definition: Common.h:97
Definition: Common.h:99
time_t m_time
Definition: Corpse.h:84
Definition: Corpse.h:29

+ Here is the call graph for this function:

bool Corpse::LoadCorpseFromDB ( ObjectGuid::LowType  guid,
Field fields 
)
148 {
149  // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14
150  // SELECT posX, posY, posZ, orientation, mapId, displayId, itemCache, bytes1, bytes2, flags, dynFlags, time, corpseType, instanceId, guid FROM corpse WHERE mapId = ? AND instanceId = ?
151 
152  float posX = fields[0].GetFloat();
153  float posY = fields[1].GetFloat();
154  float posZ = fields[2].GetFloat();
155  float o = fields[3].GetFloat();
156  uint32 mapId = fields[4].GetUInt16();
157 
158  Object::_Create(ObjectGuid::Create<HighGuid::Corpse>(mapId, 0, guid));
159 
160  SetObjectScale(1.0f);
161  SetUInt32Value(CORPSE_FIELD_DISPLAY_ID, fields[5].GetUInt32());
162  _LoadIntoDataField(fields[6].GetCString(), CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END);
163  SetUInt32Value(CORPSE_FIELD_BYTES_1, fields[7].GetUInt32());
164  SetUInt32Value(CORPSE_FIELD_BYTES_2, fields[8].GetUInt32());
165  SetUInt32Value(CORPSE_FIELD_FLAGS, fields[9].GetUInt8());
166  SetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS, fields[10].GetUInt8());
167  SetGuidValue(CORPSE_FIELD_OWNER, ObjectGuid::Create<HighGuid::Player>(fields[14].GetUInt64()));
168 
169  m_time = time_t(fields[11].GetUInt32());
170 
171  uint32 instanceId = fields[13].GetUInt32();
172 
173  // place
174  SetLocationInstanceId(instanceId);
175  SetLocationMapId(mapId);
176  Relocate(posX, posY, posZ, o);
177 
178  if (!IsPositionValid())
179  {
180  TC_LOG_ERROR("entities.player", "Corpse (%s, owner: %s) is not created, given coordinates are not valid (X: %f, Y: %f, Z: %f)",
181  GetGUID().ToString().c_str(), GetOwnerGUID().ToString().c_str(), posX, posY, posZ);
182  return false;
183  }
184 
186  return true;
187 }
Definition: UpdateFields.h:360
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:125
ObjectGuid GetOwnerGUID() const
Definition: Corpse.h:67
float GetFloat() const
Definition: Field.h:222
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
void SetLocationMapId(uint32 _mapId)
Definition: Object.h:635
Definition: UpdateFields.h:362
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
CellCoord _cellCoord
Definition: Corpse.h:85
void Relocate(float x, float y)
Definition: Position.h:67
float GetPositionY() const
Definition: Position.h:105
std::string ToString() const
Definition: Position.cpp:160
uint32_t uint32
Definition: Define.h:150
uint16 GetUInt16() const
Definition: Field.h:108
void SetLocationInstanceId(uint32 _instanceId)
Definition: Object.h:636
ObjectGuid const & GetGUID() const
Definition: Object.h:105
time_t m_time
Definition: Corpse.h:84
Definition: UpdateFields.h:358
Definition: UpdateFields.h:361
virtual void SetObjectScale(float scale)
Definition: Object.h:111
uint32 GetUInt32() const
Definition: Field.h:146
Definition: UpdateFields.h:355
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool IsPositionValid() const
Definition: Position.cpp:40
Definition: UpdateFields.h:359
float GetPositionX() const
Definition: Position.h:104
void _LoadIntoDataField(std::string const &data, uint32 startOffset, uint32 count)
Definition: Object.cpp:966
Definition: UpdateFields.h:357

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented from WorldObject.

54 {
56  if (IsInWorld())
58 
60 }
Definition: Corpse.h:49
Map * GetMap() const
Definition: Object.h:543
virtual void RemoveFromWorld() override
Definition: Object.cpp:1515
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:466
ObjectGuid const & GetGUID() const
Definition: Object.h:105
bool Remove(KEY_TYPE const &handle)
Definition: TypeContainer.h:125
bool IsInWorld() const
Definition: Object.h:100

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void Corpse::ResetGhostTime ( )
inline
70 { m_time = time(NULL); }
arena_t NULL
Definition: jemalloc_internal.h:624
time_t m_time
Definition: Corpse.h:84
void Corpse::SaveToDB ( )
95 {
96  // prevent DB data inconsistence problems and duplicates
98  DeleteFromDB(trans);
99 
100  uint16 index = 0;
102  stmt->setUInt64(index++, GetOwnerGUID().GetCounter()); // guid
103  stmt->setFloat (index++, GetPositionX()); // posX
104  stmt->setFloat (index++, GetPositionY()); // posY
105  stmt->setFloat (index++, GetPositionZ()); // posZ
106  stmt->setFloat (index++, GetOrientation()); // orientation
107  stmt->setUInt16(index++, GetMapId()); // mapId
108  stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_DISPLAY_ID)); // displayId
109  stmt->setString(index++, _ConcatFields(CORPSE_FIELD_ITEM, EQUIPMENT_SLOT_END)); // itemCache
110  stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_1)); // bytes1
111  stmt->setUInt32(index++, GetUInt32Value(CORPSE_FIELD_BYTES_2)); // bytes2
112  stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_FLAGS)); // flags
113  stmt->setUInt8 (index++, GetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS)); // dynFlags
114  stmt->setUInt32(index++, uint32(m_time)); // time
115  stmt->setUInt8 (index++, GetType()); // corpseType
116  stmt->setUInt32(index++, GetInstanceId()); // instanceId
117  trans->Append(stmt);
118 
119  for (uint32 phaseId : GetPhases())
120  {
121  index = 0;
123  stmt->setUInt64(index++, GetOwnerGUID().GetCounter()); // OwnerGuid
124  stmt->setUInt32(index++, phaseId); // PhaseId
125  trans->Append(stmt);
126  }
127 
129 }
Definition: UpdateFields.h:360
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
ObjectGuid GetOwnerGUID() const
Definition: Corpse.h:67
void setUInt8(const uint8 index, const uint8 value)
Definition: PreparedStatement.cpp:97
SQLTransaction BeginTransaction()
Begins an automanaged transaction pointer that will automatically rollback if not commited...
Definition: DatabaseWorkerPool.h:221
void setString(const uint8 index, const std::string &value)
Definition: PreparedStatement.cpp:187
Definition: UpdateFields.h:362
Definition: PreparedStatement.h:74
void DeleteFromDB(SQLTransaction &trans)
Definition: Corpse.cpp:131
CorpseType GetType() const
Definition: Corpse.h:71
void CommitTransaction(SQLTransaction transaction)
Definition: DatabaseWorkerPool.cpp:179
float GetOrientation() const
Definition: Position.h:107
Definition: CharacterDatabase.h:285
float GetPositionY() const
Definition: Position.h:105
void setUInt16(const uint8 index, const uint16 value)
Definition: PreparedStatement.cpp:106
uint32 GetInstanceId() const
Definition: Object.h:451
float GetPositionZ() const
Definition: Position.h:106
uint32_t uint32
Definition: Define.h:150
uint16_t uint16
Definition: Define.h:151
uint32 GetMapId() const
Definition: Position.h:254
Definition: CharacterDatabase.h:281
PreparedStatement * GetPreparedStatement(PreparedStatementIndex index)
Definition: DatabaseWorkerPool.h:263
void setUInt32(const uint8 index, const uint32 value)
Definition: PreparedStatement.cpp:115
std::set< uint32 > const & GetPhases() const
Definition: Object.h:465
time_t m_time
Definition: Corpse.h:84
Definition: UpdateFields.h:358
Definition: UpdateFields.h:361
std::string _ConcatFields(uint16 startIndex, uint16 size) const
Definition: Object.cpp:134
void setFloat(const uint8 index, const float value)
Definition: PreparedStatement.cpp:169
void setUInt64(const uint8 index, const uint64 value)
Definition: PreparedStatement.cpp:124
CharacterDatabaseWorkerPool CharacterDatabase
Accessor to the character database.
Definition: DatabaseEnv.cpp:21
uint32_t uint32
Definition: g3dmath.h:168
Definition: UpdateFields.h:359
float GetPositionX() const
Definition: Position.h:104
Definition: UpdateFields.h:357
std::shared_ptr< Transaction > SQLTransaction
Definition: Transaction.h:58

+ Here is the call graph for this function:

void Corpse::SetCellCoord ( CellCoord const cellCoord)
inline
74 { _cellCoord = cellCoord; }
CellCoord _cellCoord
Definition: Corpse.h:85

+ Here is the caller graph for this function:

Member Data Documentation

CellCoord Corpse::_cellCoord
private
Loot Corpse::loot
bool Corpse::lootForBody
Player* Corpse::lootRecipient
time_t Corpse::m_time
private
CorpseType Corpse::m_type
private

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