OregonCore  revision fb2a440-git
Your Favourite TBC server
Corpse Class Reference

#include <Corpse.h>

+ Inheritance diagram for Corpse:

Public Member Functions

 Corpse (CorpseType type=CORPSE_BONES)
 
 ~Corpse () override
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
bool Create (uint32 guidlow, Map *map)
 
bool Create (uint32 guidlow, Player *owner, uint32 mapid, float x, float y, float z, float ang)
 
void SaveToDB ()
 
bool LoadCorpseFromDB (uint32 guid, Field *fields)
 
void DeleteBonesFromWorld ()
 
void DeleteFromDB ()
 
uint64 const & GetOwnerGUID () const
 
time_t const & GetGhostTime () const
 
void ResetGhostTime ()
 
CorpseType GetType () const
 
GridCoord const & GetGridCoord () const
 
void SetGridCoord (GridCoord const &grid)
 
void Say (const char *text, uint32 language, uint64 TargetGuid)
 
void Yell (const char *text, uint32 language, uint64 TargetGuid)
 
void TextEmote (const char *text, uint64 TargetGuid)
 
void Whisper (const char *text, uint64 receiver)
 
void Say (int32 textId, uint32 language, uint64 TargetGuid)
 
void Yell (int32 textId, uint32 language, uint64 TargetGuid)
 
void TextEmote (int32 textId, uint64 TargetGuid)
 
void Whisper (int32 textId, uint64 receiver)
 
bool IsExpired (time_t t) const
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
virtual void Update (uint32)
 
void _Create (uint32 guidlow, HighGuid guidhigh, uint32 phaseMask)
 
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)
 
float GetPositionZTarget (Position &pos, float destx, float desty)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (const WorldObject *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
virtual float GetObjectBoundingRadius () const
 
float GetObjectSize () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z) const
 
void GetRandomPoint (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
void GetRandomPoint (const Position &srcPos, float distance, Position &pos) const
 
float GetDistanceSqr (float x, float y, float z) const
 
bool HasInArc (float arcangle, const Position *pos) const
 
bool HasInArc (const float arcangle, const float x, const float y) const
 
uint32 GetInstanceId () const
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
uint32 GetPhaseMask () const
 
bool InSamePhase (uint32 phasemask) const
 
bool InSamePhase (WorldObject const *obj) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
InstanceDataGetInstanceData ()
 
const char * GetName () const
 
void SetName (const std::string &newname)
 
virtual const char * GetNameForLocaleIdx (int32) const
 
float GetDistance (const WorldObject *obj) const
 
float GetDistance (const Position &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (const WorldObject *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (const WorldObject *obj) const
 
bool IsInMap (const WorldObject *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) 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 (const WorldObject *obj) const
 
Position GetHitSpherePointFor (Position const &dest) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z) 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
 
virtual void CleanupsBeforeDelete ()
 
virtual void SendMessageToSet (WorldPacket *data, bool self)
 
virtual void SendMessageToSetInRange (WorldPacket *data, float dist, bool self)
 
virtual uint8 getLevelForTarget (WorldObject const *) const
 
void MonsterSay (const char *text, uint32 language, uint64 TargetGuid)
 
void MonsterYell (const char *text, uint32 language, uint64 TargetGuid)
 
void MonsterTextEmote (const char *text, uint64 TargetGuid, bool IsBossEmote=false)
 
void MonsterWhisper (const char *text, uint64 receiver, bool IsBossWhisper=false)
 
void MonsterSay (int32 textId, uint32 language, uint64 TargetGuid)
 
void MonsterYell (int32 textId, uint32 language, uint64 TargetGuid)
 
void MonsterTextEmote (int32 textId, uint64 TargetGuid, bool IsBossEmote=false)
 
void MonsterWhisper (int32 textId, uint64 receiver, bool IsBossWhisper=false)
 
void MonsterYellToZone (int32 textId, uint32 language, uint64 TargetGuid)
 
void BuildMonsterChat (WorldPacket *data, uint8 msgtype, char const *text, uint32 language, char const *name, uint64 TargetGuid) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=NULL)
 
void PlayDirectSound (uint32 sound_id, Player *target=NULL)
 
void SendObjectDeSpawnAnim (uint64 guid)
 
void SendObjectCustomAnim (uint64 guid, uint32 anim=0)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
virtual bool isValid () const
 
virtual bool IsNeverVisible () const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *) const
 
virtual bool IsInvisibleDueToDespawn () const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (const WorldObject *target=NULL) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlaySound (uint32 Sound, bool OnlySelf)
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
Map const * GetBaseMap () const
 
void SetZoneScript ()
 
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0)
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0)
 
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)
 
GameObjectFindNearestGameObject (uint32 entry, float range)
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &gameobjectList, uint32 entry=GRID_SEARCH_ALL_ENTRIES, float maxSearchRange=250.0f) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &creatureList, uint32 entry=GRID_SEARCH_ALL_ENTRIES, float maxSearchRange=250.0f) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true)
 
virtual void UpdateObjectVisibilityOnCreate ()
 
void BuildUpdate (UpdateDataMapType &) 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 VisitNearbyWorldObject (const float &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyObject (float const &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyGridObject (float const &radius, NOTIFIER &notifier) const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
const bool & IsInWorld () const
 
const uint64GetGUID () const
 
uint32 GetGUIDLow () const
 
uint32 GetGUIDMid () const
 
uint32 GetGUIDHigh () const
 
PackedGuid const & GetPackGUID () const
 
ObjectGuid const & GetObjectGUID () const
 
std::string GetGuidStr () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
void SetObjectScale (float scale)
 
uint8 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
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
 
const int32GetInt32Value (uint16 index) const
 
const uint32GetUInt32Value (uint16 index) const
 
const uint64GetUInt64Value (uint16 index) const
 
const float & GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
ObjectGuid const & GetGuidValue (uint16 index) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, const 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 SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddUInt64Value (uint16 index, const uint64 &value)
 
bool RemoveUInt64Value (uint16 index, const uint64 &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 SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void ToggleFlag (uint16 index, uint8 offset, uint8 flag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
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)
 
bool LoadValues (const char *data)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void ForceValuesUpdateAtIndex (uint32)
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapid=MAPID_INVALID, float _x=0, float _y=0, float _z=0, float _o=0)
 
 WorldLocation (const WorldLocation &loc)
 
void WorldRelocate (const WorldLocation &loc)
 
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 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 >
bool IsInGrid () const
 
void AddToGrid (GridRefManager< Corpse > &m)
 
void RemoveFromGrid ()
 

Public Attributes

Loot loot
 
PlayerlootRecipient
 
bool lootForBody
 
- 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 m_groupLootTimer
 
uint64 lootingGroupLeaderGUID
 
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
 
GridCoord _gridCoord
 

Additional Inherited Members

- Static Public Member Functions inherited from WorldObject
static bool InSamePhase (WorldObject const *a, WorldObject const *b)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh)
 
void _LoadIntoDataField (const char *data, uint32 startOffset, uint32 count)
 
virtual void _SetUpdateBits (UpdateMask *updateMask, Player *target) const
 
virtual void _SetCreateBits (UpdateMask *updateMask, Player *target) const
 
void _BuildMovementUpdate (ByteBuffer *data, uint8 updateFlags) const
 
void _BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target) const
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
uint8 m_objectTypeId
 
uint8 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
uint32m_uint32Values_mirror
 
uint16 m_valuesCount
 
bool m_objectUpdated
 

Detailed Description

Definition at line 48 of file Corpse.h.

Constructor & Destructor Documentation

Corpse::Corpse ( CorpseType  type = CORPSE_BONES)
explicit
Corpse::~Corpse ( )
override

Definition at line 42 of file Corpse.cpp.

43 {
44 }

Member Function Documentation

void Corpse::AddToWorld ( )
overridevirtual

Reimplemented from Object.

Definition at line 46 of file Corpse.cpp.

References ObjectAccessor::AddObject(), Object::AddToWorld(), Oregon::Singleton< ObjectAccessor, Oregon::ClassLevelLockable< ObjectAccessor, ACE_Thread_Mutex > >::Instance(), and Object::IsInWorld().

Referenced by LoadHelper().

47 {
48  // Register the corpse for guid lookup
49  if (!IsInWorld())
51 
53 }
void AddObject(T *object)
const bool & IsInWorld() const
Definition: Object.h:135
virtual void AddToWorld()
Definition: Object.h:139
bool Corpse::Create ( uint32  guidlow,
Map map 
)

Definition at line 64 of file Corpse.cpp.

References Object::_Create(), HIGHGUID_CORPSE, and WorldObject::SetMap().

Referenced by ObjectAccessor::ConvertCorpseForPlayer(), and Player::CreateCorpse().

65 {
66  SetMap(map);
67  Object::_Create(guidlow, 0, HIGHGUID_CORPSE);
68  return true;
69 }
virtual void SetMap(Map *map)
Definition: Object.cpp:1954
void _Create(uint32 guidlow, uint32 entry, HighGuid guidhigh)
Definition: Object.cpp:125
bool Corpse::Create ( uint32  guidlow,
Player owner,
uint32  mapid,
float  x,
float  y,
float  z,
float  ang 
)

Definition at line 71 of file Corpse.cpp.

References WorldObject::_Create(), _gridCoord, ASSERT, Oregon::ComputeGridCoord(), CORPSE_FIELD_FACING, CORPSE_FIELD_OWNER, CORPSE_FIELD_POS_X, CORPSE_FIELD_POS_Y, CORPSE_FIELD_POS_Z, Object::GetGUID(), WorldObject::GetMap(), WorldObject::GetName(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), HIGHGUID_CORPSE, Position::IsPositionValid(), Position::Relocate(), Object::SetFloatValue(), WorldObject::SetMap(), Object::SetObjectScale(), Object::SetUInt64Value(), and sLog.

72 {
73  ASSERT(owner);
74 
75  Relocate(x, y, z, ang);
76 
77  if (!IsPositionValid())
78  {
79  sLog.outError("Corpse (guidlow %d, owner %s) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
80  guidlow, owner->GetName(), x, y);
81  return false;
82  }
83 
84  //we need to assign owner's map for corpse
85  //in other way we will get a crash in Corpse::SaveToDB()
86  SetMap(owner->GetMap());
87 
89 
90  SetObjectScale(1);
96 
98 
99  return true;
100 }
void _Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask)
Definition: Object.cpp:1162
Map * GetMap() const
Definition: Object.h:841
void SetObjectScale(float scale)
Definition: Object.h:205
virtual void SetMap(Map *map)
Definition: Object.cpp:1954
#define sLog
Log class singleton.
Definition: Log.h:187
void Relocate(float x, float y)
Definition: Position.h:65
uint32 GetPhaseMask() const
Definition: Object.h:694
float GetPositionY() const
Definition: Position.h:98
void SetUInt64Value(uint16 index, const uint64 &value)
Definition: Object.cpp:798
const char * GetName() const
Definition: Object.h:704
GridCoord _gridCoord
Definition: Corpse.h:135
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:859
#define ASSERT
Definition: Errors.h:29
bool IsPositionValid() const
Definition: Position.cpp:40
float GetPositionX() const
Definition: Position.h:97
const uint64 & GetGUID() const
Definition: Object.h:162
GridCoord ComputeGridCoord(float x, float y)
Definition: GridDefines.h:162
void Corpse::DeleteBonesFromWorld ( )

Definition at line 135 of file Corpse.cpp.

References WorldObject::AddObjectToRemoveList(), ASSERT, CORPSE_BONES, ObjectAccessor::GetCorpse(), Object::GetGUID(), Object::GetGUIDLow(), GetType(), and sLog.

136 {
138  Corpse* corpse = ObjectAccessor::GetCorpse(*this, GetGUID());
139 
140  if (!corpse)
141  {
142  sLog.outError("Bones %u not found in world.", GetGUIDLow());
143  return;
144  }
145 
147 }
Definition: Corpse.h:48
#define sLog
Log class singleton.
Definition: Log.h:187
uint32 GetGUIDLow() const
Definition: Object.h:166
CorpseType GetType() const
Definition: Corpse.h:79
void AddObjectToRemoveList()
Definition: Object.cpp:1990
#define ASSERT
Definition: Errors.h:29
static Corpse * GetCorpse(WorldObject const &u, uint64 guid)
const uint64 & GetGUID() const
Definition: Object.h:162
void Corpse::DeleteFromDB ( )

Definition at line 149 of file Corpse.cpp.

References CharacterDatabase, CORPSE_BONES, Object::GetGUIDLow(), GetOwnerGUID(), GetType(), GUID_LOPART, and Database::PExecute().

Referenced by ObjectAccessor::ConvertCorpseForPlayer(), and SaveToDB().

150 {
151  if (GetType() == CORPSE_BONES)
152  // only specific bones
153  CharacterDatabase.PExecute("DELETE FROM corpse WHERE guid = '%d'", GetGUIDLow());
154  else
155  // all corpses (not bones)
156  CharacterDatabase.PExecute("DELETE FROM corpse WHERE player = '%d' AND corpse_type <> '0'", GUID_LOPART(GetOwnerGUID()));
157 }
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
uint32 GetGUIDLow() const
Definition: Object.h:166
CorpseType GetType() const
Definition: Corpse.h:79
bool PExecute(const char *format,...) ATTR_PRINTF(2
Definition: Database.cpp:441
uint64 const & GetOwnerGUID() const
Definition: Corpse.h:66
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
time_t const& Corpse::GetGhostTime ( ) const
inline

Definition at line 71 of file Corpse.h.

References m_time.

Referenced by Player::CalculateCorpseReclaimDelay(), and WorldSession::HandleCorpseReclaimOpcode().

72  {
73  return m_time;
74  }
time_t m_time
Definition: Corpse.h:134
GridCoord const& Corpse::GetGridCoord ( ) const
inline

Definition at line 84 of file Corpse.h.

References _gridCoord.

Referenced by ObjectAccessor::ConvertCorpseForPlayer().

85  {
86  return _gridCoord;
87  }
GridCoord _gridCoord
Definition: Corpse.h:135
uint64 const& Corpse::GetOwnerGUID ( ) const
inline
bool Corpse::IsExpired ( time_t  t) const

Definition at line 205 of file Corpse.cpp.

References CORPSE_BONES, DAY, m_time, m_type, and MINUTE.

Referenced by Whisper().

206 {
207  if (m_type == CORPSE_BONES)
208  return m_time < t - 60 * MINUTE;
209  else
210  return m_time < t - 3 * DAY;
211 }
CorpseType m_type
Definition: Corpse.h:133
Definition: Common.h:181
Definition: Common.h:179
time_t m_time
Definition: Corpse.h:134
bool Corpse::LoadCorpseFromDB ( uint32  guid,
Field fields 
)

Definition at line 159 of file Corpse.cpp.

References WorldObject::_Create(), _gridCoord, Object::_LoadIntoDataField(), Oregon::ComputeGridCoord(), 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, Object::GetGUIDLow(), GetOwnerGUID(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), GUID_LOPART, HIGHGUID_CORPSE, HIGHGUID_PLAYER, Position::IsPositionValid(), m_time, MAKE_NEW_GUID, Position::Relocate(), WorldObject::SetLocationInstanceId(), WorldObject::SetLocationMapId(), Object::SetObjectScale(), WorldObject::SetPhaseMask(), Object::SetUInt32Value(), Object::SetUInt64Value(), and sLog.

Referenced by ObjectMgr::LoadCorpses().

160 {
161  // 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
162  //SELECT position_x, position_y, position_z, orientation, map, displayId, itemCache, bytes1, bytes2, guild, flags, dynFlags, time, corpse_type, instance, guid, player FROM corpse WHERE corpse_type <> 0
163  float positionX = fields[0].GetFloat();
164  float positionY = fields[1].GetFloat();
165  float positionZ = fields[2].GetFloat();
166  float ort = fields[3].GetFloat();
167  uint32 mapid = fields[4].GetUInt32();
168 
169  // Initialize the datastores for this object
171 
172  SetObjectScale(1.0f);
173  SetUInt32Value(CORPSE_FIELD_DISPLAY_ID, fields[5].GetUInt32());
175  SetUInt32Value(CORPSE_FIELD_BYTES_1, fields[7].GetUInt32());
176  SetUInt32Value(CORPSE_FIELD_BYTES_2, fields[8].GetUInt32());
177  SetUInt32Value(CORPSE_FIELD_GUILD, fields[9].GetUInt32());
178  SetUInt32Value(CORPSE_FIELD_FLAGS, fields[10].GetUInt32());
179  SetUInt32Value(CORPSE_FIELD_DYNAMIC_FLAGS, fields[11].GetUInt32());
180  SetUInt64Value(CORPSE_FIELD_OWNER, MAKE_NEW_GUID(fields[16].GetUInt32(), 0, HIGHGUID_PLAYER));
181 
182  m_time = time_t(fields[12].GetUInt64());
183 
184  uint32 instanceid = fields[14].GetUInt32();
185 
186  uint32 phaseMask = fields[15].GetUInt32();
187 
188  // place
189  SetLocationInstanceId(instanceid);
190  SetLocationMapId(mapid);
191  SetPhaseMask(phaseMask, false);
192  Relocate(positionX, positionY, positionZ, ort);
193 
194  if (!IsPositionValid())
195  {
196  sLog.outError("Corpse (guidlow %d, owner %d) not created. Suggested coordinates isn't valid (X: %f Y: %f)",
198  return false;
199  }
200 
202  return true;
203 }
void _Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask)
Definition: Object.cpp:1162
virtual void SetPhaseMask(uint32 newPhaseMask, bool update)
Definition: Object.cpp:2536
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
void SetObjectScale(float scale)
Definition: Object.h:205
void _LoadIntoDataField(const char *data, uint32 startOffset, uint32 count)
Definition: Object.cpp:721
#define sLog
Log class singleton.
Definition: Log.h:187
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:779
void SetLocationMapId(uint32 _mapId)
Definition: Object.h:939
uint32 GetGUIDLow() const
Definition: Object.h:166
void Relocate(float x, float y)
Definition: Position.h:65
uint32 GetPhaseMask() const
Definition: Object.h:694
float GetPositionY() const
Definition: Position.h:98
#define MAKE_NEW_GUID(l, e, h)
Definition: ObjectGuid.h:80
void SetUInt64Value(uint16 index, const uint64 &value)
Definition: Object.cpp:798
GridCoord _gridCoord
Definition: Corpse.h:135
void SetLocationInstanceId(uint32 _instanceId)
Definition: Object.h:943
uint64 const & GetOwnerGUID() const
Definition: Corpse.h:66
time_t m_time
Definition: Corpse.h:134
bool IsPositionValid() const
Definition: Position.cpp:40
ACE_UINT32 uint32
Definition: Define.h:71
float GetPositionX() const
Definition: Position.h:97
GridCoord ComputeGridCoord(float x, float y)
Definition: GridDefines.h:162
void Corpse::RemoveFromWorld ( )
overridevirtual

Reimplemented from WorldObject.

Definition at line 55 of file Corpse.cpp.

References Oregon::Singleton< ObjectAccessor, Oregon::ClassLevelLockable< ObjectAccessor, ACE_Thread_Mutex > >::Instance(), Object::IsInWorld(), Object::RemoveFromWorld(), and ObjectAccessor::RemoveObject().

Referenced by ObjectAccessor::RemoveCorpse().

56 {
57  // Remove the corpse from the accessor
58  if (IsInWorld())
60 
62 }
virtual void RemoveFromWorld()
Definition: Object.h:151
const bool & IsInWorld() const
Definition: Object.h:135
void RemoveObject(T *object)
void Corpse::ResetGhostTime ( )
inline

Definition at line 75 of file Corpse.h.

References m_time.

Referenced by Player::BuildPlayerRepop().

76  {
77  m_time = time(NULL);
78  }
time_t m_time
Definition: Corpse.h:134
void Corpse::SaveToDB ( )

Definition at line 102 of file Corpse.cpp.

References Database::BeginTransaction(), CharacterDatabase, Database::CommitTransaction(), 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, Database::Execute(), Object::GetGUIDLow(), WorldObject::GetInstanceId(), WorldLocation::GetMapId(), Position::GetOrientation(), GetOwnerGUID(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetType(), Object::GetUInt32Value(), WorldObject::GetZoneId(), GUID_LOPART, and m_time.

Referenced by Player::CreateCorpse().

103 {
104  // prevent DB data inconsistance problems and duplicates
106  DeleteFromDB();
107 
108  std::ostringstream ss;
109  ss << "INSERT INTO corpse (guid,player,position_x,position_y,position_z,orientation,zone,map,displayId,itemCache,bytes1,bytes2,guild,flags,dynFlags,time,corpse_type,instance, phaseMask) VALUES ("
110  << GetGUIDLow() << ", "
111  << GUID_LOPART(GetOwnerGUID()) << ", "
112  << GetPositionX() << ", "
113  << GetPositionY() << ", "
114  << GetPositionZ() << ", "
115  << GetOrientation() << ", "
116  << GetZoneId() << ", "
117  << GetMapId() << ", "
119  for (uint16 i = 0; i < EQUIPMENT_SLOT_END; ++i)
120  ss << GetUInt32Value(CORPSE_FIELD_ITEM + i) << " ";
121  ss << "', "
127  << uint64(m_time) << ", "
128  << uint32(GetType()) << ", "
129  << int(GetInstanceId()) << ", "
130  << uint64(GetPhaseMask()) << ")";
131  CharacterDatabase.Execute(ss.str().c_str());
133 }
void DeleteFromDB()
Definition: Corpse.cpp:149
const uint32 & GetUInt32Value(uint16 index) const
Definition: Object.h:234
#define GUID_LOPART(x)
Definition: ObjectGuid.h:110
bool BeginTransaction()
Definition: Database.cpp:533
bool Execute(const char *sql)
Definition: Database.cpp:420
uint32 GetZoneId() const
Definition: Object.cpp:1179
uint32 GetGUIDLow() const
Definition: Object.h:166
bool CommitTransaction()
Definition: Database.cpp:551
CorpseType GetType() const
Definition: Corpse.h:79
float GetOrientation() const
Definition: Position.h:100
uint32 GetPhaseMask() const
Definition: Object.h:694
float GetPositionY() const
Definition: Position.h:98
uint32 GetInstanceId() const
Definition: Object.h:688
float GetPositionZ() const
Definition: Position.h:99
uint32 GetMapId() const
Definition: Object.h:591
ACE_UINT64 uint64
Definition: Define.h:70
uint64 const & GetOwnerGUID() const
Definition: Corpse.h:66
time_t m_time
Definition: Corpse.h:134
DatabaseType CharacterDatabase
Accessor to the character database.
Definition: Main.cpp:54
ACE_UINT16 uint16
Definition: Define.h:72
ACE_UINT32 uint32
Definition: Define.h:71
float GetPositionX() const
Definition: Position.h:97
void Corpse::Say ( const char *  text,
uint32  language,
uint64  TargetGuid 
)
inline

Definition at line 97 of file Corpse.h.

References WorldObject::MonsterSay().

98  {
99  MonsterSay(text, language, TargetGuid);
100  }
void MonsterSay(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1490
void Corpse::Say ( int32  textId,
uint32  language,
uint64  TargetGuid 
)
inline

Definition at line 113 of file Corpse.h.

References WorldObject::MonsterSay().

114  {
115  MonsterSay(textId, language, TargetGuid);
116  }
void MonsterSay(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1490
void Corpse::SetGridCoord ( GridCoord const &  grid)
inline

Definition at line 88 of file Corpse.h.

References _gridCoord.

Referenced by ObjectAccessor::ConvertCorpseForPlayer().

89  {
90  _gridCoord = grid;
91  }
GridCoord _gridCoord
Definition: Corpse.h:135
void Corpse::TextEmote ( const char *  text,
uint64  TargetGuid 
)
inline

Definition at line 105 of file Corpse.h.

References WorldObject::MonsterTextEmote().

106  {
107  MonsterTextEmote(text, TargetGuid);
108  }
void MonsterTextEmote(const char *text, uint64 TargetGuid, bool IsBossEmote=false)
Definition: Object.cpp:1504
void Corpse::TextEmote ( int32  textId,
uint64  TargetGuid 
)
inline

Definition at line 121 of file Corpse.h.

References WorldObject::MonsterTextEmote().

122  {
123  MonsterTextEmote(textId, TargetGuid);
124  }
void MonsterTextEmote(const char *text, uint64 TargetGuid, bool IsBossEmote=false)
Definition: Object.cpp:1504
void Corpse::Whisper ( const char *  text,
uint64  receiver 
)
inline

Definition at line 109 of file Corpse.h.

References WorldObject::MonsterWhisper().

110  {
111  MonsterWhisper(text, receiver);
112  }
void MonsterWhisper(const char *text, uint64 receiver, bool IsBossWhisper=false)
Definition: Object.cpp:1511
void Corpse::Whisper ( int32  textId,
uint64  receiver 
)
inline

Definition at line 125 of file Corpse.h.

References IsExpired(), and WorldObject::MonsterWhisper().

126  {
127  MonsterWhisper(textId, receiver);
128  }
void MonsterWhisper(const char *text, uint64 receiver, bool IsBossWhisper=false)
Definition: Object.cpp:1511
void Corpse::Yell ( const char *  text,
uint32  language,
uint64  TargetGuid 
)
inline

Definition at line 101 of file Corpse.h.

References WorldObject::MonsterYell().

102  {
103  MonsterYell(text, language, TargetGuid);
104  }
void MonsterYell(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1497
void Corpse::Yell ( int32  textId,
uint32  language,
uint64  TargetGuid 
)
inline

Definition at line 117 of file Corpse.h.

References WorldObject::MonsterYell().

118  {
119  MonsterYell(textId, language, TargetGuid);
120  }
void MonsterYell(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1497

Member Data Documentation

GridCoord Corpse::_gridCoord
private

Definition at line 135 of file Corpse.h.

Referenced by Create(), GetGridCoord(), LoadCorpseFromDB(), and SetGridCoord().

bool Corpse::lootForBody

Definition at line 95 of file Corpse.h.

Referenced by Corpse(), and Player::SendLoot().

Player* Corpse::lootRecipient

Definition at line 94 of file Corpse.h.

Referenced by Player::RemovedInsignia(), and Player::SendLoot().

time_t Corpse::m_time
private

Definition at line 134 of file Corpse.h.

Referenced by Corpse(), GetGhostTime(), IsExpired(), LoadCorpseFromDB(), ResetGhostTime(), and SaveToDB().

CorpseType Corpse::m_type
private

Definition at line 133 of file Corpse.h.

Referenced by GetType(), and IsExpired().


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