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

#include <Object.h>

Public Member Functions

virtual ~WorldObject ()
 
virtual void Update (uint32)
 
virtual void RemoveFromWorld () override
 
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
 
virtual void AddToWorld ()
 
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 Attributes

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
 

Protected Member Functions

 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

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
 

Private Member Functions

virtual bool _IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D) const
 
bool CanNeverSee (WorldObject const *obj) const
 
virtual bool CanAlwaysSee (WorldObject const *) const
 
bool CanDetect (WorldObject const *obj, bool ignoreStealth, bool checkAlert=false) const
 
bool CanDetectInvisibilityOf (WorldObject const *obj) const
 
bool CanDetectStealthOf (WorldObject const *obj, bool checkAlert=false) const
 

Private Attributes

Mapm_currMap
 
uint32 m_InstanceId
 
uint32 m_phaseMask
 
std::set< uint32_phases
 
std::set< uint32_terrainSwaps
 
std::set< uint32_worldMapAreaSwaps
 
int32 _dbPhase
 
uint16 m_notifyflags
 
uint16 m_executed_notifies
 

Additional Inherited Members

- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Constructor & Destructor Documentation

WorldObject::WorldObject ( bool  isWorldObject)
explicitprotected
1446 m_name(""), m_isActive(false), m_isWorldObject(isWorldObject), m_zoneScript(NULL),
1449 {
1452 }
const bool m_isWorldObject
Definition: Object.h:626
Map * m_currMap
Definition: Object.h:644
std::string m_name
Definition: Object.h:624
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:538
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:383
arena_t NULL
Definition: jemalloc_internal.h:624
uint32 m_InstanceId
Definition: Object.h:647
Definition: SharedDefines.h:1749
uint16 m_notifyflags
Definition: Object.h:654
Definition: SharedDefines.h:1750
int32 _dbPhase
Definition: Object.h:652
WorldLocation(uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
Definition: Position.h:231
ZoneScript * m_zoneScript
Definition: Object.h:627
Definition: Object.h:66
bool m_isActive
Definition: Object.h:625
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:539
Transport * m_transport
Definition: Object.h:630
uint32 m_phaseMask
Definition: Object.h:648
Definition: SharedDefines.h:1742
uint16 m_executed_notifies
Definition: Object.h:655
uint32 LastUsedScriptID
Definition: Object.h:599

+ Here is the call graph for this function:

WorldObject::~WorldObject ( )
virtual
68 {
69  // this may happen because there are many !create/delete
70  if (IsWorldObject() && m_currMap)
71  {
72  if (GetTypeId() == TYPEID_CORPSE)
73  {
74  TC_LOG_FATAL("misc", "WorldObject::~WorldObject Corpse Type: %d (%s) deleted but still in map!!",
75  ToCorpse()->GetType(), GetGUID().ToString().c_str());
76  ABORT();
77  }
78  ResetMap();
79  }
80 }
virtual void ResetMap()
Definition: Object.cpp:2187
Map * m_currMap
Definition: Object.h:644
Definition: ObjectGuid.h:36
bool IsWorldObject() const
Definition: Object.cpp:1462
TypeID GetTypeId() const
Definition: Object.h:113
std::string ToString() const
Definition: Position.cpp:160
Corpse * ToCorpse()
Definition: Object.h:203
ObjectGuid const & GetGUID() const
Definition: Object.h:105
#define TC_LOG_FATAL(filterType__,...)
Definition: Log.h:210
#define ABORT
Definition: Errors.h:56

+ Here is the call graph for this function:

Member Function Documentation

bool WorldObject::_IsWithinDist ( WorldObject const obj,
float  dist2compare,
bool  is3D 
) const
privatevirtual

Reimplemented in GameObject.

1555 {
1556  float sizefactor = GetObjectSize() + obj->GetObjectSize();
1557  float maxdist = dist2compare + sizefactor;
1558 
1559  if (GetTransport() && obj->GetTransport() && obj->GetTransport()->GetGUID() == GetTransport()->GetGUID())
1560  {
1561  float dtx = m_movementInfo.transport.pos.m_positionX - obj->m_movementInfo.transport.pos.m_positionX;
1562  float dty = m_movementInfo.transport.pos.m_positionY - obj->m_movementInfo.transport.pos.m_positionY;
1563  float disttsq = dtx * dtx + dty * dty;
1564  if (is3D)
1565  {
1566  float dtz = m_movementInfo.transport.pos.m_positionZ - obj->m_movementInfo.transport.pos.m_positionZ;
1567  disttsq += dtz * dtz;
1568  }
1569  return disttsq < (maxdist * maxdist);
1570  }
1571 
1572  float dx = GetPositionX() - obj->GetPositionX();
1573  float dy = GetPositionY() - obj->GetPositionY();
1574  float distsq = dx*dx + dy*dy;
1575  if (is3D)
1576  {
1577  float dz = GetPositionZ() - obj->GetPositionZ();
1578  distsq += dz*dz;
1579  }
1580 
1581  return distsq < maxdist * maxdist;
1582 }
float m_positionY
Definition: Position.h:53
MovementInfo m_movementInfo
Definition: Object.h:612
float m_positionX
Definition: Position.h:52
struct MovementInfo::TransportInfo transport
float GetPositionY() const
Definition: Position.h:105
float GetPositionZ() const
Definition: Position.h:106
float m_positionZ
Definition: Position.h:54
Position pos
Definition: Object.h:290
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Transport * GetTransport() const
Definition: Object.h:602
float GetPositionX() const
Definition: Position.h:104
float GetObjectSize() const
Definition: Object.cpp:2656

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::AddObjectToRemoveList ( )
2206 {
2208 
2209  Map* map = FindMap();
2210  if (!map)
2211  {
2212  TC_LOG_ERROR("misc", "Object (Entry: %u %s) at attempt add to move list not have valid map (Id: %u).", GetEntry(), GetGUID().ToString().c_str(), GetMapId());
2213  return;
2214  }
2215 
2216  map->AddObjectToRemoveList(this);
2217 }
uint32 * m_uint32Values
Definition: Object.h:235
void AddObjectToRemoveList(WorldObject *obj)
Definition: Map.cpp:2804
Map * FindMap() const
Definition: Object.h:544
std::string ToString() const
Definition: Position.cpp:160
uint32 GetMapId() const
Definition: Position.h:254
Definition: Map.h:259
ObjectGuid const & GetGUID() const
Definition: Object.h:105
#define ASSERT
Definition: Errors.h:55
uint32 GetEntry() const
Definition: Object.h:107
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::AddToNotify ( uint16  f)
inline
574 { m_notifyflags |= f;}
uint16 m_notifyflags
Definition: Object.h:654

+ Here is the caller graph for this function:

void WorldObject::AddToObjectUpdate ( )
overridevirtual

Implements Object.

3093 {
3094  GetMap()->AddUpdateObject(this);
3095 }
Map * GetMap() const
Definition: Object.h:543
void AddUpdateObject(Object *obj)
Definition: Map.h:567

+ Here is the call graph for this function:

void WorldObject::BuildUpdate ( UpdateDataMapType data_map)
overridevirtual

Reimplemented from Object.

Reimplemented in Transport.

3079 {
3081  Cell cell(p);
3082  cell.SetNoCreate();
3083  WorldObjectChangeAccumulator notifier(*this, data_map);
3085  Map& map = *GetMap();
3086  //we must build packets for all visible players
3087  cell.Visit(p, player_notifier, map, *this, GetVisibilityRange());
3088 
3089  ClearUpdateMask(false);
3090 }
void ClearUpdateMask(bool remove)
Definition: Object.cpp:829
Definition: TypeContainerVisitor.h:32
Map * GetMap() const
Definition: Object.h:543
Definition: Object.cpp:3008
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
float GetVisibilityRange() const
Definition: Object.cpp:1912
float GetPositionY() const
Definition: Position.h:105
Definition: Map.h:259
Definition: Cell.h:49
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

virtual bool WorldObject::CanAlwaysSee ( WorldObject const ) const
inlineprivatevirtual

Reimplemented in Creature.

659 { return false; }

+ Here is the caller graph for this function:

bool WorldObject::CanDetect ( WorldObject const obj,
bool  ignoreStealth,
bool  checkAlert = false 
) const
private
2024 {
2025  const WorldObject* seer = this;
2026 
2027  // Pets don't have detection, they use the detection of their masters
2028  if (Unit const* thisUnit = ToUnit())
2029  if (Unit* controller = thisUnit->GetCharmerOrOwner())
2030  seer = controller;
2031 
2032  if (obj->IsAlwaysDetectableFor(seer))
2033  return true;
2034 
2035  if (!ignoreStealth && !seer->CanDetectInvisibilityOf(obj))
2036  return false;
2037 
2038  if (!ignoreStealth && !seer->CanDetectStealthOf(obj, checkAlert))
2039  return false;
2040 
2041  return true;
2042 }
Definition: Object.h:423
Unit * GetCharmerOrOwner() const
Definition: Unit.cpp:7627
bool CanDetectStealthOf(WorldObject const *obj, bool checkAlert=false) const
Definition: Object.cpp:2068
Definition: Unit.h:1305
bool CanDetectInvisibilityOf(WorldObject const *obj) const
Definition: Object.cpp:2044
Unit * ToUnit()
Definition: Object.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::CanDetectInvisibilityOf ( WorldObject const obj) const
private
2045 {
2046  uint32 mask = obj->m_invisibility.GetFlags() & m_invisibilityDetect.GetFlags();
2047 
2048  // Check for not detected types
2049  if (mask != obj->m_invisibility.GetFlags())
2050  return false;
2051 
2052  for (uint32 i = 0; i < TOTAL_INVISIBILITY_TYPES; ++i)
2053  {
2054  if (!(mask & (1 << i)))
2055  continue;
2056 
2057  int32 objInvisibilityValue = obj->m_invisibility.GetValue(InvisibilityType(i));
2058  int32 ownInvisibilityDetectValue = m_invisibilityDetect.GetValue(InvisibilityType(i));
2059 
2060  // Too low value to detect
2061  if (ownInvisibilityDetectValue < objInvisibilityValue)
2062  return false;
2063  }
2064 
2065  return true;
2066 }
T_FLAGS GetFlags() const
Definition: Object.h:377
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition: Object.h:536
InvisibilityType
Definition: SharedDefines.h:1695
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Definition: SharedDefines.h:1736
T_VALUES GetValue(FLAG_TYPE flag) const
Definition: Object.h:382

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::CanDetectStealthOf ( WorldObject const obj,
bool  checkAlert = false 
) const
private
2069 {
2070  // Combat reach is the minimal distance (both in front and behind),
2071  // and it is also used in the range calculation.
2072  // One stealth point increases the visibility range by 0.3 yard.
2073 
2074  if (!obj->m_stealth.GetFlags())
2075  return true;
2076 
2077  float distance = GetExactDist(obj);
2078  float combatReach = 0.0f;
2079 
2080  Unit const* unit = ToUnit();
2081  if (unit)
2082  combatReach = unit->GetCombatReach();
2083 
2084  if (distance < combatReach)
2085  return true;
2086 
2087  if (!HasInArc(float(M_PI), obj))
2088  return false;
2089 
2090  GameObject const* go = ToGameObject();
2091  for (uint32 i = 0; i < TOTAL_STEALTH_TYPES; ++i)
2092  {
2093  if (!(obj->m_stealth.GetFlags() & (1 << i)))
2094  continue;
2095 
2097  return true;
2098 
2099  // Starting points
2100  int32 detectionValue = 30;
2101 
2102  // Level difference: 5 point / level, starting from level 1.
2103  // There may be spells for this and the starting points too, but
2104  // not in the DBCs of the client.
2105  detectionValue += int32(getLevelForTarget(obj) - 1) * 5;
2106 
2107  // Apply modifiers
2108  detectionValue += m_stealthDetect.GetValue(StealthType(i));
2109  if (go)
2110  if (Unit* owner = go->GetOwner())
2111  detectionValue -= int32(owner->getLevelForTarget(this) - 1) * 5;
2112 
2113  detectionValue -= obj->m_stealth.GetValue(StealthType(i));
2114 
2115  // Calculate max distance
2116  float visibilityRange = float(detectionValue) * 0.3f + combatReach;
2117 
2118  // If this unit is an NPC then player detect range doesn't apply
2119  if (unit && unit->GetTypeId() == TYPEID_PLAYER && visibilityRange > MAX_PLAYER_STEALTH_DETECT_RANGE)
2120  visibilityRange = MAX_PLAYER_STEALTH_DETECT_RANGE;
2121 
2122  // When checking for alert state, look 8% further, and then 1.5 yards more than that.
2123  if (checkAlert)
2124  visibilityRange += (visibilityRange * 0.08f) + 1.5f;
2125 
2126  // If checking for alert, and creature's visibility range is greater than aggro distance, No alert
2127  Unit const* tunit = obj->ToUnit();
2128  if (checkAlert && unit && unit->ToCreature() && visibilityRange >= unit->ToCreature()->GetAttackDistance(tunit) + unit->ToCreature()->m_CombatDistance)
2129  return false;
2130 
2131  if (distance > visibilityRange)
2132  return false;
2133  }
2134 
2135  return true;
2136 }
Unit * GetOwner() const
Definition: GameObject.cpp:1009
bool HasAuraTypeWithMiscvalue(AuraType auratype, int32 miscvalue) const
Definition: Unit.cpp:4261
#define M_PI
Definition: Common.h:163
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition: Object.h:533
GameObject * ToGameObject()
Definition: Object.h:200
double distance(double x, double y)
Definition: g3dmath.h:731
virtual uint8 getLevelForTarget(WorldObject const *) const
Definition: Object.h:517
float GetCombatReach() const
Definition: Unit.h:1361
TypeID GetTypeId() const
Definition: Object.h:113
float GetAttackDistance(Unit const *player) const
Definition: Creature.cpp:1586
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
Definition: GameObject.h:880
bool HasInArc(float arcangle, Position const *pos, float border=2.0f) const
Definition: Position.cpp:129
StealthType
Definition: SharedDefines.h:1687
#define MAX_PLAYER_STEALTH_DETECT_RANGE
Definition: Unit.h:1301
Definition: ObjectGuid.h:33
Creature * ToCreature()
Definition: Object.h:194
float GetExactDist(float x, float y, float z) const
Definition: Position.h:157
int32_t int32
Definition: g3dmath.h:167
Definition: SpellAuraDefines.h:288
T_VALUES GetValue(FLAG_TYPE flag) const
Definition: Object.h:382
Definition: SharedDefines.h:1692
Definition: Unit.h:1305
float m_CombatDistance
Definition: Creature.h:704
Unit * ToUnit()
Definition: Object.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::CanNeverSee ( WorldObject const obj) const
private
2019 {
2020  return GetMap() != obj->GetMap() || !IsInPhase(obj);
2021 }
Map * GetMap() const
Definition: Object.h:543
bool IsInPhase(uint32 phase) const
Definition: Object.h:462

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::CanSeeOrDetect ( WorldObject const obj,
bool  ignoreStealth = false,
bool  distanceCheck = false,
bool  checkAlert = false 
) const
1941 {
1942  if (this == obj)
1943  return true;
1944 
1945  if (obj->IsNeverVisible() || CanNeverSee(obj))
1946  return false;
1947 
1948  if (obj->IsAlwaysVisibleFor(this) || CanAlwaysSee(obj))
1949  return true;
1950 
1951  bool corpseVisibility = false;
1952  if (distanceCheck)
1953  {
1954  bool corpseCheck = false;
1955  if (Player const* thisPlayer = ToPlayer())
1956  {
1957  if (thisPlayer->isDead() && thisPlayer->GetHealth() > 0 && // Cheap way to check for ghost state
1959  {
1960  if (Corpse* corpse = thisPlayer->GetCorpse())
1961  {
1962  corpseCheck = true;
1963  if (corpse->IsWithinDist(thisPlayer, GetSightRange(obj), false))
1964  if (corpse->IsWithinDist(obj, GetSightRange(obj), false))
1965  corpseVisibility = true;
1966  }
1967  }
1968  }
1969 
1970  WorldObject const* viewpoint = this;
1971  if (Player const* player = this->ToPlayer())
1972  viewpoint = player->GetViewpoint();
1973 
1974  if (!viewpoint)
1975  viewpoint = this;
1976 
1977  if (!corpseCheck && !viewpoint->IsWithinDist(obj, GetSightRange(obj), false))
1978  return false;
1979  }
1980 
1981  // GM visibility off or hidden NPC
1982  if (!obj->m_serverSideVisibility.GetValue(SERVERSIDE_VISIBILITY_GM))
1983  {
1984  // Stop checking other things for GMs
1986  return true;
1987  }
1988  else
1989  return m_serverSideVisibilityDetect.GetValue(SERVERSIDE_VISIBILITY_GM) >= obj->m_serverSideVisibility.GetValue(SERVERSIDE_VISIBILITY_GM);
1990 
1991  // Ghost players, Spirit Healers, and some other NPCs
1992  if (!corpseVisibility && !(obj->m_serverSideVisibility.GetValue(SERVERSIDE_VISIBILITY_GHOST) & m_serverSideVisibilityDetect.GetValue(SERVERSIDE_VISIBILITY_GHOST)))
1993  {
1994  // Alive players can see dead players in some cases, but other objects can't do that
1995  if (Player const* thisPlayer = ToPlayer())
1996  {
1997  if (Player const* objPlayer = obj->ToPlayer())
1998  {
1999  if (thisPlayer->GetTeam() != objPlayer->GetTeam() || !thisPlayer->IsGroupVisibleFor(objPlayer))
2000  return false;
2001  }
2002  else
2003  return false;
2004  }
2005  else
2006  return false;
2007  }
2008 
2009  if (obj->IsInvisibleDueToDespawn())
2010  return false;
2011 
2012  if (!CanDetect(obj, ignoreStealth, checkAlert))
2013  return false;
2014 
2015  return true;
2016 }
Definition: Corpse.h:49
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:538
bool CanNeverSee(WorldObject const *obj) const
Definition: Object.cpp:2018
Definition: Object.h:423
Player * ToPlayer()
Definition: Object.h:191
Definition: SharedDefines.h:1750
Definition: SharedDefines.h:1741
bool IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D=true) const
Definition: Object.cpp:1658
float GetSightRange(WorldObject const *target=NULL) const
Definition: Object.cpp:1920
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:539
bool CanDetect(WorldObject const *obj, bool ignoreStealth, bool checkAlert=false) const
Definition: Object.cpp:2023
virtual bool CanAlwaysSee(WorldObject const *) const
Definition: Object.h:659
Definition: SharedDefines.h:1742
T_VALUES GetValue(FLAG_TYPE flag) const
Definition: Object.h:382

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::CleanupsBeforeDelete ( bool  finalCleanup = true)
virtual

Reimplemented in Unit, GameObject, and Transport.

1507 {
1508  if (IsInWorld())
1509  RemoveFromWorld();
1510 
1511  if (Transport* transport = GetTransport())
1512  transport->RemovePassenger(this);
1513 }
Definition: Transport.h:28
virtual void RemoveFromWorld() override
Definition: Object.cpp:1515
Transport * GetTransport() const
Definition: Object.h:602
bool IsInWorld() const
Definition: Object.h:100

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::ClearPhases ( bool  update = false)
2928 {
2929  _phases.clear();
2930 
2932 
2933  if (update && IsInWorld())
2935 }
std::set< uint32 > _phases
Definition: Object.h:649
void RebuildTerrainSwaps()
Definition: Object.cpp:3109
virtual void UpdateObjectVisibility(bool forced=true)
Definition: Object.cpp:3001
bool IsInWorld() const
Definition: Object.h:100

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::CopyPhaseFrom ( WorldObject obj,
bool  update = false 
)
2916 {
2917  if (!obj)
2918  return;
2919 
2920  for (uint32 phase : obj->GetPhases())
2921  SetInPhase(phase, false, true);
2922 
2923  if (update && IsInWorld())
2925 }
virtual bool SetInPhase(uint32 id, bool update, bool apply)
Definition: Object.cpp:2879
uint32_t uint32
Definition: Define.h:150
std::set< uint32 > const & GetPhases() const
Definition: Object.h:465
virtual void UpdateObjectVisibility(bool forced=true)
Definition: Object.cpp:3001
bool IsInWorld() const
Definition: Object.h:100

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::DestroyForNearbyPlayers ( )
Todo:
this is for puppet
2975 {
2976  if (!IsInWorld())
2977  return;
2978 
2979  std::list<Player*> targets;
2983  for (std::list<Player*>::const_iterator iter = targets.begin(); iter != targets.end(); ++iter)
2984  {
2985  Player* player = (*iter);
2986 
2987  if (player == this)
2988  continue;
2989 
2990  if (!player->HaveAtClient(this))
2991  continue;
2992 
2993  if (isType(TYPEMASK_UNIT) && ToUnit()->GetCharmerGUID() == player->GetGUID())
2994  continue;
2995 
2996  DestroyForPlayer(player);
2997  player->m_clientGUIDs.erase(GetGUID());
2998  }
2999 }
Definition: GridNotifiers.h:1188
virtual void DestroyForPlayer(Player *target) const
Definition: Object.cpp:283
void VisitNearbyWorldObject(float const &radius, NOTIFIER &notifier) const
Definition: Object.h:589
bool isType(uint16 mask) const
Definition: Object.h:114
float GetVisibilityRange() const
Definition: Object.cpp:1912
ObjectGuid GetCharmerGUID() const
Definition: Unit.h:1704
Definition: GridNotifiers.h:510
Definition: ObjectGuid.h:49
ObjectGuid const & GetGUID() const
Definition: Object.h:105
bool IsInWorld() const
Definition: Object.h:100
T check(T value)
Definition: format.h:305
Unit * ToUnit()
Definition: Object.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Map* WorldObject::FindMap ( ) const
inline
544 { return m_currMap; }
Map * m_currMap
Definition: Object.h:644

+ Here is the caller graph for this function:

Creature * WorldObject::FindNearestCreature ( uint32  entry,
float  range,
bool  alive = true 
) const
2444 {
2445  Creature* creature = NULL;
2446  Trinity::NearestCreatureEntryWithLiveStateInObjectRangeCheck checker(*this, entry, alive, range);
2448  VisitNearbyObject(range, searcher);
2449  return creature;
2450 }
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
Definition: GridNotifiers.h:444
void VisitNearbyObject(float const &radius, NOTIFIER &notifier) const
Definition: Object.h:587

+ Here is the call graph for this function:

GameObject * WorldObject::FindNearestGameObject ( uint32  entry,
float  range 
) const
2453 {
2454  GameObject* go = NULL;
2455  Trinity::NearestGameObjectEntryInObjectRangeCheck checker(*this, entry, range);
2457  VisitNearbyGridObject(range, searcher);
2458  return go;
2459 }
Definition: GridNotifiers.h:323
arena_t NULL
Definition: jemalloc_internal.h:624
void VisitNearbyGridObject(float const &radius, NOTIFIER &notifier) const
Definition: Object.h:588
Definition: GameObject.h:880

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GameObject * WorldObject::FindNearestGameObjectOfType ( GameobjectTypes  type,
float  range 
) const
2462 {
2463  GameObject* go = NULL;
2464  Trinity::NearestGameObjectTypeInObjectRangeCheck checker(*this, type, range);
2466  VisitNearbyGridObject(range, searcher);
2467  return go;
2468 }
Definition: GridNotifiers.h:323
arena_t NULL
Definition: jemalloc_internal.h:624
void VisitNearbyGridObject(float const &radius, NOTIFIER &notifier) const
Definition: Object.h:588
Definition: GameObject.h:880

+ Here is the call graph for this function:

virtual uint16 WorldObject::GetAIAnimKitId ( ) const
inlinevirtual

Reimplemented in Unit, and GameObject.

619 { return 0; }
uint32 WorldObject::GetAreaId ( ) const
1531 {
1533 }
uint32 GetAreaId(float x, float y, float z, bool *isOutdoors) const
Definition: Map.cpp:2426
float m_positionY
Definition: Position.h:53
float m_positionX
Definition: Position.h:52
float m_positionZ
Definition: Position.h:54
Map const * GetBaseMap() const
Definition: Object.cpp:2199

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Map const * WorldObject::GetBaseMap ( ) const
2200 {
2201  ASSERT(m_currMap);
2202  return m_currMap->GetParent();
2203 }
Map * m_currMap
Definition: Object.h:644
#define ASSERT
Definition: Errors.h:55
Map const * GetParent() const
Definition: Map.h:333

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::GetClosePoint ( float &  x,
float &  y,
float &  z,
float  size,
float  distance2d = 0,
float  angle = 0 
) const
2624 {
2625  // angle calculated from current orientation
2626  GetNearPoint(NULL, x, y, z, size, distance2d, GetOrientation() + angle);
2627 }
arena_t NULL
Definition: jemalloc_internal.h:624
float GetOrientation() const
Definition: Position.h:107
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37
void GetNearPoint(WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle) const
Definition: Object.cpp:2587

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::GetContactPoint ( WorldObject const obj,
float &  x,
float &  y,
float &  z,
float  distance2d = CONTACT_DISTANCE 
) const
2651 {
2652  // angle to face `obj` to `this` using distance includes size of `obj`
2653  GetNearPoint(obj, x, y, z, obj->GetObjectSize(), distance2d, GetAngle(obj));
2654 }
G3D::int16 z
Definition: Vector3int16.h:46
float GetAngle(Position const *pos) const
Definition: Position.cpp:63
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37
void GetNearPoint(WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle) const
Definition: Object.cpp:2587

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::GetCreatureListWithEntryInGrid ( std::list< Creature * > &  lList,
uint32  uiEntry,
float  fMaxSearchRange 
) const
2484 {
2486  Cell cell(pair);
2487  cell.SetNoCreate();
2488 
2489  Trinity::AllCreaturesOfEntryInRange check(this, entry, maxSearchRange);
2492 
2493  cell.Visit(pair, visitor, *(this->GetMap()), *this, maxSearchRange);
2494 }
Definition: TypeContainerVisitor.h:32
Map * GetMap() const
Definition: Object.h:543
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
Definition: TypeContainer.h:86
float GetPositionY() const
Definition: Position.h:105
Definition: GridNotifiers.h:459
Definition: GridNotifiers.h:1265
Definition: Cell.h:49
T check(T value)
Definition: format.h:305
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 WorldObject::GetDBPhase ( ) const
inline
468 { return _dbPhase; }
int32 _dbPhase
Definition: Object.h:652

+ Here is the caller graph for this function:

float WorldObject::GetDistance ( WorldObject const obj) const
1595 {
1596  float d = GetExactDist(obj) - GetObjectSize() - obj->GetObjectSize();
1597  return d > 0.0f ? d : 0.0f;
1598 }
float GetExactDist(float x, float y, float z) const
Definition: Position.h:157
float GetObjectSize() const
Definition: Object.cpp:2656

+ Here is the call graph for this function:

float WorldObject::GetDistance ( Position const pos) const
1601 {
1602  float d = GetExactDist(&pos) - GetObjectSize();
1603  return d > 0.0f ? d : 0.0f;
1604 }
float GetExactDist(float x, float y, float z) const
Definition: Position.h:157
float GetObjectSize() const
Definition: Object.cpp:2656

+ Here is the call graph for this function:

float WorldObject::GetDistance ( float  x,
float  y,
float  z 
) const
1607 {
1608  float d = GetExactDist(x, y, z) - GetObjectSize();
1609  return d > 0.0f ? d : 0.0f;
1610 }
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
float GetExactDist(float x, float y, float z) const
Definition: Position.h:157
G3D::int16 x
Definition: Vector2int16.h:37
float GetObjectSize() const
Definition: Object.cpp:2656

+ Here is the call graph for this function:

float WorldObject::GetDistance2d ( WorldObject const obj) const
1613 {
1614  float d = GetExactDist2d(obj) - GetObjectSize() - obj->GetObjectSize();
1615  return d > 0.0f ? d : 0.0f;
1616 }
float GetExactDist2d(const float x, const float y) const
Definition: Position.h:137
float GetObjectSize() const
Definition: Object.cpp:2656

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float WorldObject::GetDistance2d ( float  x,
float  y 
) const
1619 {
1620  float d = GetExactDist2d(x, y) - GetObjectSize();
1621  return d > 0.0f ? d : 0.0f;
1622 }
float GetExactDist2d(const float x, const float y) const
Definition: Position.h:137
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37
float GetObjectSize() const
Definition: Object.cpp:2656

+ Here is the call graph for this function:

bool WorldObject::GetDistanceOrder ( WorldObject const obj1,
WorldObject const obj2,
bool  is3D = true 
) const
1681 {
1682  float dx1 = GetPositionX() - obj1->GetPositionX();
1683  float dy1 = GetPositionY() - obj1->GetPositionY();
1684  float distsq1 = dx1*dx1 + dy1*dy1;
1685  if (is3D)
1686  {
1687  float dz1 = GetPositionZ() - obj1->GetPositionZ();
1688  distsq1 += dz1*dz1;
1689  }
1690 
1691  float dx2 = GetPositionX() - obj2->GetPositionX();
1692  float dy2 = GetPositionY() - obj2->GetPositionY();
1693  float distsq2 = dx2*dx2 + dy2*dy2;
1694  if (is3D)
1695  {
1696  float dz2 = GetPositionZ() - obj2->GetPositionZ();
1697  distsq2 += dz2*dz2;
1698  }
1699 
1700  return distsq1 < distsq2;
1701 }
float GetPositionY() const
Definition: Position.h:105
float GetPositionZ() const
Definition: Position.h:106
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float WorldObject::GetDistanceZ ( WorldObject const obj) const
1547 {
1548  float dz = std::fabs(GetPositionZ() - obj->GetPositionZ());
1549  float sizefactor = GetObjectSize() + obj->GetObjectSize();
1550  float dist = dz - sizefactor;
1551  return (dist > 0 ? dist : 0);
1552 }
float GetPositionZ() const
Definition: Position.h:106
float GetObjectSize() const
Definition: Object.cpp:2656

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Position WorldObject::GetFirstCollisionPosition ( float  dist,
float  angle 
)
2637 {
2638  Position pos = GetPosition();
2639  MovePositionToFirstCollision(pos, dist, angle);
2640  return pos;
2641 }
Position GetPosition() const
Definition: Position.h:124
void MovePositionToFirstCollision(Position &pos, float dist, float angle)
Definition: Object.cpp:2733
Definition: Position.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::GetGameObjectListWithEntryInGrid ( std::list< GameObject * > &  lList,
uint32  uiEntry,
float  fMaxSearchRange 
) const
2471 {
2473  Cell cell(pair);
2474  cell.SetNoCreate();
2475 
2476  Trinity::AllGameObjectsWithEntryInRange check(this, entry, maxSearchRange);
2479 
2480  cell.Visit(pair, visitor, *(this->GetMap()), *this, maxSearchRange);
2481 }
Definition: GridNotifiers.h:338
Definition: TypeContainerVisitor.h:32
Map * GetMap() const
Definition: Object.h:543
CellCoord ComputeCellCoord(float x, float y)
Definition: GridDefines.h:193
Definition: GridNotifiers.h:1248
Definition: TypeContainer.h:86
float GetPositionY() const
Definition: Position.h:105
Definition: Cell.h:49
T check(T value)
Definition: format.h:305
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float WorldObject::GetGridActivationRange ( ) const
1903 {
1904  if (ToPlayer())
1905  return GetMap()->GetVisibilityRange();
1906  else if (ToCreature())
1907  return ToCreature()->m_SightDistance;
1908  else
1909  return 0.0f;
1910 }
Map * GetMap() const
Definition: Object.h:543
Player * ToPlayer()
Definition: Object.h:191
float GetVisibilityRange() const
Definition: Map.h:290
Creature * ToCreature()
Definition: Object.h:194
float m_SightDistance
Definition: Creature.h:704

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 WorldObject::GetInstanceId ( ) const
inline
451 { return m_InstanceId; }
uint32 m_InstanceId
Definition: Object.h:647

+ Here is the caller graph for this function:

InstanceScript * WorldObject::GetInstanceScript ( )
1541 {
1542  Map* map = GetMap();
1543  return map->IsDungeon() ? ((InstanceMap*)map)->GetInstanceScript() : NULL;
1544 }
Map * GetMap() const
Definition: Object.h:543
arena_t NULL
Definition: jemalloc_internal.h:624
bool IsDungeon() const
Definition: Map.h:395
Definition: Map.h:758
Definition: Map.h:259

+ Here is the call graph for this function:

virtual uint8 WorldObject::getLevelForTarget ( WorldObject const ) const
inlinevirtual

Reimplemented in Unit, GameObject, and Creature.

517 { return 1; }

+ Here is the caller graph for this function:

Map* WorldObject::GetMap ( ) const
inline
543 { ASSERT(m_currMap); return m_currMap; }
Map * m_currMap
Definition: Object.h:644
#define ASSERT
Definition: Errors.h:55
virtual uint16 WorldObject::GetMeleeAnimKitId ( ) const
inlinevirtual

Reimplemented in Unit.

621 { return 0; }
virtual uint16 WorldObject::GetMovementAnimKitId ( ) const
inlinevirtual

Reimplemented in Unit.

620 { return 0; }
std::string const& WorldObject::GetName ( ) const
inline
479 { return m_name; }
std::string m_name
Definition: Object.h:624

+ Here is the caller graph for this function:

virtual std::string const& WorldObject::GetNameForLocaleIdx ( LocaleConstant  ) const
inlinevirtual

Reimplemented in GameObject, and Creature.

482 { return m_name; }
std::string m_name
Definition: Object.h:624
void WorldObject::GetNearPoint ( WorldObject const searcher,
float &  x,
float &  y,
float &  z,
float  searcher_size,
float  distance2d,
float  absAngle 
) const
2588 {
2589  GetNearPoint2D(x, y, distance2d+searcher_size, absAngle);
2590  z = GetPositionZ();
2591  // Should "searcher" be used instead of "this" when updating z coordinate ?
2593 
2594  // if detection disabled, return first point
2595  if (!sWorld->getBoolConfig(CONFIG_DETECT_POS_COLLISION))
2596  return;
2597 
2598  // return if the point is already in LoS
2599  if (IsWithinLOS(x, y, z))
2600  return;
2601 
2602  // remember first point
2603  float first_x = x;
2604  float first_y = y;
2605  float first_z = z;
2606 
2607  // loop in a circle to look for a point in LoS using small steps
2608  for (float angle = float(M_PI) / 8; angle < float(M_PI) * 2; angle += float(M_PI) / 8)
2609  {
2610  GetNearPoint2D(x, y, distance2d + searcher_size, absAngle + angle);
2611  z = GetPositionZ();
2613  if (IsWithinLOS(x, y, z))
2614  return;
2615  }
2616 
2617  // still not in LoS, give up and return first position found
2618  x = first_x;
2619  y = first_y;
2620  z = first_z;
2621 }
#define M_PI
Definition: Common.h:163
void UpdateAllowedPositionZ(float x, float y, float &z) const
Definition: Object.cpp:1834
bool IsWithinLOS(float x, float y, float z) const
Definition: Object.cpp:1668
Definition: World.h:124
#define sWorld
Definition: World.h:887
G3D::int16 z
Definition: Vector3int16.h:46
float GetPositionZ() const
Definition: Position.h:106
G3D::int16 y
Definition: Vector2int16.h:38
void GetNearPoint2D(float &x, float &y, float distance, float absAngle) const
Definition: Object.cpp:2578
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::GetNearPoint2D ( float &  x,
float &  y,
float  distance,
float  absAngle 
) const
2579 {
2580  x = GetPositionX() + (GetObjectSize() + distance2d) * std::cos(absAngle);
2581  y = GetPositionY() + (GetObjectSize() + distance2d) * std::sin(absAngle);
2582 
2585 }
float GetPositionY() const
Definition: Position.h:105
G3D::int16 y
Definition: Vector2int16.h:38
void NormalizeMapCoord(float &c)
Definition: GridDefines.h:210
G3D::int16 x
Definition: Vector2int16.h:37
float GetPositionX() const
Definition: Position.h:104
float GetObjectSize() const
Definition: Object.cpp:2656

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Position WorldObject::GetNearPosition ( float  dist,
float  angle 
)
2630 {
2631  Position pos = GetPosition();
2632  MovePosition(pos, dist, angle);
2633  return pos;
2634 }
void MovePosition(Position &pos, float dist, float angle)
Definition: Object.cpp:2661
Position GetPosition() const
Definition: Position.h:124
Definition: Position.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint16 WorldObject::GetNotifyFlags ( ) const
inline
576 { return m_notifyflags; }
uint16 m_notifyflags
Definition: Object.h:654
float WorldObject::GetObjectSize ( ) const
2657 {
2659 }
#define DEFAULT_WORLD_OBJECT_SIZE
Definition: Object.h:44
Definition: UpdateFields.h:116
float * m_floatValues
Definition: Object.h:236
uint16 m_valuesCount
Definition: Object.h:245

+ Here is the caller graph for this function:

uint32 WorldObject::GetPhaseMask ( ) const
inline
461 { return m_phaseMask; }
uint32 m_phaseMask
Definition: Object.h:648

+ Here is the caller graph for this function:

std::set<uint32> const& WorldObject::GetPhases ( ) const
inline
465 { return _phases; }
std::set< uint32 > _phases
Definition: Object.h:649

+ Here is the caller graph for this function:

void WorldObject::GetPlayerListInGrid ( std::list< Player * > &  lList,
float  fMaxSearchRange 
) const
2497 {
2498  Trinity::AnyPlayerInObjectRangeCheck checker(this, maxSearchRange);
2499  Trinity::PlayerListSearcher<Trinity::AnyPlayerInObjectRangeCheck> searcher(this, playerList, checker);
2500  this->VisitNearbyWorldObject(maxSearchRange, searcher);
2501 }
Definition: GridNotifiers.h:1188
void VisitNearbyWorldObject(float const &radius, NOTIFIER &notifier) const
Definition: Object.h:589
Definition: GridNotifiers.h:510

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Position WorldObject::GetRandomNearPosition ( float  radius)
2644 {
2645  Position pos = GetPosition();
2646  MovePosition(pos, radius * (float)rand_norm(), (float)rand_norm() * static_cast<float>(2 * M_PI));
2647  return pos;
2648 }
void MovePosition(Position &pos, float dist, float angle)
Definition: Object.cpp:2661
#define M_PI
Definition: Common.h:163
Position GetPosition() const
Definition: Position.h:124
double rand_norm()
Definition: Random.cpp:69
Definition: Position.h:27

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::GetRandomPoint ( Position const srcPos,
float  distance,
float &  rand_x,
float &  rand_y,
float &  rand_z 
) const
1800 {
1801  if (!distance)
1802  {
1803  pos.GetPosition(rand_x, rand_y, rand_z);
1804  return;
1805  }
1806 
1807  // angle to face `obj` to `this`
1808  float angle = (float)rand_norm()*static_cast<float>(2*M_PI);
1809  float new_dist = (float)rand_norm()*static_cast<float>(distance);
1810 
1811  rand_x = pos.m_positionX + new_dist * std::cos(angle);
1812  rand_y = pos.m_positionY + new_dist * std::sin(angle);
1813  rand_z = pos.m_positionZ;
1814 
1817  UpdateGroundPositionZ(rand_x, rand_y, rand_z); // update to LOS height if available
1818 }
#define M_PI
Definition: Common.h:163
double distance(double x, double y)
Definition: g3dmath.h:731
void NormalizeMapCoord(float &c)
Definition: GridDefines.h:210
double rand_norm()
Definition: Random.cpp:69
void UpdateGroundPositionZ(float x, float y, float &z) const
Definition: Object.cpp:1827

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Position WorldObject::GetRandomPoint ( Position const srcPos,
float  distance 
) const
1821 {
1822  float x, y, z;
1823  GetRandomPoint(srcPos, distance, x, y, z);
1824  return Position(x, y, z, GetOrientation());
1825 }
double distance(double x, double y)
Definition: g3dmath.h:731
float GetOrientation() const
Definition: Position.h:107
void GetRandomPoint(Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
Definition: Object.cpp:1799
G3D::int16 z
Definition: Vector3int16.h:46
Position(float x=0, float y=0, float z=0, float o=0)
Definition: Position.h:29
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37

+ Here is the call graph for this function:

float WorldObject::GetSightRange ( WorldObject const target = NULL) const
1921 {
1922  if (ToUnit())
1923  {
1924  if (ToPlayer())
1925  {
1926  if (target && target->isActiveObject() && !target->ToPlayer())
1927  return MAX_VISIBILITY_DISTANCE;
1928  else
1929  return GetMap()->GetVisibilityRange();
1930  }
1931  else if (ToCreature())
1932  return ToCreature()->m_SightDistance;
1933  else
1934  return SIGHT_RANGE_UNIT;
1935  }
1936 
1937  return 0.0f;
1938 }
Map * GetMap() const
Definition: Object.h:543
#define SIGHT_RANGE_UNIT
Definition: Object.h:39
Player * ToPlayer()
Definition: Object.h:191
float GetVisibilityRange() const
Definition: Map.h:290
#define MAX_VISIBILITY_DISTANCE
Definition: Object.h:38
Creature * ToCreature()
Definition: Object.h:194
float m_SightDistance
Definition: Creature.h:704
Unit * ToUnit()
Definition: Object.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual float WorldObject::GetStationaryO ( ) const
inlinevirtual

Reimplemented in GameObject.

617 { return GetOrientation(); }
float GetOrientation() const
Definition: Position.h:107

+ Here is the call graph for this function:

virtual float WorldObject::GetStationaryX ( ) const
inlinevirtual

Reimplemented in GameObject.

614 { return GetPositionX(); }
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

virtual float WorldObject::GetStationaryY ( ) const
inlinevirtual

Reimplemented in GameObject.

615 { return GetPositionY(); }
float GetPositionY() const
Definition: Position.h:105

+ Here is the call graph for this function:

virtual float WorldObject::GetStationaryZ ( ) const
inlinevirtual

Reimplemented in GameObject.

616 { return GetPositionZ(); }
float GetPositionZ() const
Definition: Position.h:106

+ Here is the call graph for this function:

std::set<uint32> const& WorldObject::GetTerrainSwaps ( ) const
inline
466 { return _terrainSwaps; }
std::set< uint32 > _terrainSwaps
Definition: Object.h:650

+ Here is the caller graph for this function:

ObjectGuid WorldObject::GetTransGUID ( ) const
virtual

Reimplemented in Unit.

3103 {
3104  if (GetTransport())
3105  return GetTransport()->GetGUID();
3106  return ObjectGuid::Empty;
3107 }
static ObjectGuid const Empty
Definition: ObjectGuid.h:196
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Transport * GetTransport() const
Definition: Object.h:602

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float WorldObject::GetTransOffsetO ( ) const
inline
MovementInfo m_movementInfo
Definition: Object.h:612
struct MovementInfo::TransportInfo transport
float GetOrientation() const
Definition: Position.h:107
Position pos
Definition: Object.h:290

+ Here is the caller graph for this function:

float WorldObject::GetTransOffsetX ( ) const
inline
MovementInfo m_movementInfo
Definition: Object.h:612
struct MovementInfo::TransportInfo transport
Position pos
Definition: Object.h:290
float GetPositionX() const
Definition: Position.h:104

+ Here is the caller graph for this function:

float WorldObject::GetTransOffsetY ( ) const
inline
MovementInfo m_movementInfo
Definition: Object.h:612