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
struct MovementInfo::TransportInfo transport
float GetPositionY() const
Definition: Position.h:105
Position pos
Definition: Object.h:290

+ Here is the caller graph for this function:

float WorldObject::GetTransOffsetZ ( ) const
inline
MovementInfo m_movementInfo
Definition: Object.h:612
struct MovementInfo::TransportInfo transport
float GetPositionZ() const
Definition: Position.h:106
Position pos
Definition: Object.h:290

+ Here is the caller graph for this function:

Transport* WorldObject::GetTransport ( ) const
inline
602 { return m_transport; }
Transport * m_transport
Definition: Object.h:630

+ Here is the caller graph for this function:

int8 WorldObject::GetTransSeat ( ) const
inline
608 { return m_movementInfo.transport.seat; }
MovementInfo m_movementInfo
Definition: Object.h:612
struct MovementInfo::TransportInfo transport
int8 seat
Definition: Object.h:291

+ Here is the caller graph for this function:

uint32 WorldObject::GetTransTime ( ) const
inline
607 { return m_movementInfo.transport.time; }
MovementInfo m_movementInfo
Definition: Object.h:612
struct MovementInfo::TransportInfo transport
uint32 time
Definition: Object.h:292
float WorldObject::GetVisibilityRange ( ) const
1913 {
1914  if (isActiveObject() && !ToPlayer())
1915  return MAX_VISIBILITY_DISTANCE;
1916  else
1917  return GetMap()->GetVisibilityRange();
1918 }
Map * GetMap() const
Definition: Object.h:543
Player * ToPlayer()
Definition: Object.h:191
bool isActiveObject() const
Definition: Object.h:581
float GetVisibilityRange() const
Definition: Map.h:290
#define MAX_VISIBILITY_DISTANCE
Definition: Object.h:38

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

std::set<uint32> const& WorldObject::GetWorldMapAreaSwaps ( ) const
inline
467 { return _worldMapAreaSwaps; }
std::set< uint32 > _worldMapAreaSwaps
Definition: Object.h:651

+ Here is the caller graph for this function:

void WorldObject::GetZoneAndAreaId ( uint32 zoneid,
uint32 areaid 
) const
1536 {
1538 }
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid, float x, float y, float z) const
Definition: Map.cpp:2481
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:

uint32 WorldObject::GetZoneId ( ) const
1526 {
1528 }
float m_positionY
Definition: Position.h:53
float m_positionX
Definition: Position.h:52
float m_positionZ
Definition: Position.h:54
uint32 GetZoneId(float x, float y, float z) const
Definition: Map.cpp:2471
Map const * GetBaseMap() const
Definition: Object.cpp:2199

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

ZoneScript* WorldObject::GetZoneScript ( ) const
inline
551 { return m_zoneScript; }
ZoneScript * m_zoneScript
Definition: Object.h:627

+ Here is the caller graph for this function:

bool WorldObject::HasInPhaseList ( uint32  phase)
2804 {
2805  return _phases.find(phase) != _phases.end();
2806 }
std::set< uint32 > _phases
Definition: Object.h:649

+ Here is the caller graph for this function:

bool WorldObject::isActiveObject ( ) const
inline
581 { return m_isActive; }
bool m_isActive
Definition: Object.h:625

+ Here is the caller graph for this function:

virtual bool WorldObject::IsAlwaysDetectableFor ( WorldObject const ) const
inlineprotectedvirtual

Reimplemented in Unit.

642 { return false; }

+ Here is the caller graph for this function:

virtual bool WorldObject::IsAlwaysVisibleFor ( WorldObject const ) const
inlineprotectedvirtual

Reimplemented in Unit, and GameObject.

639 { return false; }

+ Here is the caller graph for this function:

bool WorldObject::isInBack ( WorldObject const target,
float  arc = float(M_PI) 
) const
1795 {
1796  return !HasInArc(2 * float(M_PI) - arc, target);
1797 }
#define M_PI
Definition: Common.h:163
bool HasInArc(float arcangle, Position const *pos, float border=2.0f) const
Definition: Position.cpp:129

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::IsInBetween ( WorldObject const obj1,
WorldObject const obj2,
float  size = 0 
) const
1770 {
1771  if (!obj1 || !obj2)
1772  return false;
1773 
1774  float dist = GetExactDist2d(obj1->GetPositionX(), obj1->GetPositionY());
1775 
1776  // not using sqrt() for performance
1777  if ((dist * dist) >= obj1->GetExactDist2dSq(obj2->GetPositionX(), obj2->GetPositionY()))
1778  return false;
1779 
1780  if (!size)
1781  size = GetObjectSize() / 2;
1782 
1783  float angle = obj1->GetAngle(obj2);
1784 
1785  // not using sqrt() for performance
1786  return (size * size) >= GetExactDist2dSq(obj1->GetPositionX() + std::cos(angle) * dist, obj1->GetPositionY() + std::sin(angle) * dist);
1787 }
float GetExactDist2dSq(float x, float y) const
Definition: Position.h:132
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:

bool WorldObject::isInFront ( WorldObject const target,
float  arc = float(M_PI) 
) const
1790 {
1791  return HasInArc(arc, target);
1792 }
bool HasInArc(float arcangle, Position const *pos, float border=2.0f) const
Definition: Position.cpp:129

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::IsInMap ( WorldObject const obj) const
1632 {
1633  if (obj)
1634  return IsInWorld() && obj->IsInWorld() && (GetMap() == obj->GetMap());
1635  return false;
1636 }
Map * GetMap() const
Definition: Object.h:543
bool IsInWorld() const
Definition: Object.h:100

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::IsInPhase ( uint32  phase) const
inline
462 { return _phases.find(phase) != _phases.end(); }
std::set< uint32 > _phases
Definition: Object.h:649

+ Here is the caller graph for this function:

bool WorldObject::IsInPhase ( WorldObject const obj) const
2938 {
2939  // PhaseId 169 is the default fallback phase
2940  if (_phases.empty() && obj->GetPhases().empty())
2941  return true;
2942 
2943  if (_phases.empty() && obj->IsInPhase(DEFAULT_PHASE))
2944  return true;
2945 
2946  if (obj->GetPhases().empty() && IsInPhase(DEFAULT_PHASE))
2947  return true;
2948 
2949  if (GetTypeId() == TYPEID_PLAYER && ToPlayer()->IsGameMaster())
2950  return true;
2951 
2952  return Trinity::Containers::Intersects(_phases.begin(), _phases.end(), obj->GetPhases().begin(), obj->GetPhases().end());
2953 }
std::set< uint32 > _phases
Definition: Object.h:649
#define DEFAULT_PHASE
Definition: Object.h:50
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
bool IsInPhase(uint32 phase) const
Definition: Object.h:462
bool Intersects(Iterator1 first1, Iterator1 last1, Iterator2 first2, Iterator2 last2)
Definition: Containers.h:133
Definition: ObjectGuid.h:33

+ Here is the call graph for this function:

bool WorldObject::IsInRange ( WorldObject const obj,
float  minRange,
float  maxRange,
bool  is3D = true 
) const
1704 {
1705  float dx = GetPositionX() - obj->GetPositionX();
1706  float dy = GetPositionY() - obj->GetPositionY();
1707  float distsq = dx*dx + dy*dy;
1708  if (is3D)
1709  {
1710  float dz = GetPositionZ() - obj->GetPositionZ();
1711  distsq += dz*dz;
1712  }
1713 
1714  float sizefactor = GetObjectSize() + obj->GetObjectSize();
1715 
1716  // check only for real range
1717  if (minRange > 0.0f)
1718  {
1719  float mindist = minRange + sizefactor;
1720  if (distsq < mindist * mindist)
1721  return false;
1722  }
1723 
1724  float maxdist = maxRange + sizefactor;
1725  return distsq < maxdist * maxdist;
1726 }
float GetPositionY() const
Definition: Position.h:105
float GetPositionZ() const
Definition: Position.h:106
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:

bool WorldObject::IsInRange2d ( float  x,
float  y,
float  minRange,
float  maxRange 
) const
1729 {
1730  float dx = GetPositionX() - x;
1731  float dy = GetPositionY() - y;
1732  float distsq = dx*dx + dy*dy;
1733 
1734  float sizefactor = GetObjectSize();
1735 
1736  // check only for real range
1737  if (minRange > 0.0f)
1738  {
1739  float mindist = minRange + sizefactor;
1740  if (distsq < mindist * mindist)
1741  return false;
1742  }
1743 
1744  float maxdist = maxRange + sizefactor;
1745  return distsq < maxdist * maxdist;
1746 }
float GetPositionY() const
Definition: Position.h:105
G3D::int16 y
Definition: Vector2int16.h:38
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:

bool WorldObject::IsInRange3d ( float  x,
float  y,
float  z,
float  minRange,
float  maxRange 
) const
1749 {
1750  float dx = GetPositionX() - x;
1751  float dy = GetPositionY() - y;
1752  float dz = GetPositionZ() - z;
1753  float distsq = dx*dx + dy*dy + dz*dz;
1754 
1755  float sizefactor = GetObjectSize();
1756 
1757  // check only for real range
1758  if (minRange > 0.0f)
1759  {
1760  float mindist = minRange + sizefactor;
1761  if (distsq < mindist * mindist)
1762  return false;
1763  }
1764 
1765  float maxdist = maxRange + sizefactor;
1766  return distsq < maxdist * maxdist;
1767 }
float GetPositionY() const
Definition: Position.h:105
G3D::int16 z
Definition: Vector3int16.h:46
float GetPositionZ() const
Definition: Position.h:106
G3D::int16 y
Definition: Vector2int16.h:38
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:

bool WorldObject::IsInTerrainSwap ( uint32  terrainSwap) const
inline
464 { return _terrainSwaps.find(terrainSwap) != _terrainSwaps.end(); }
std::set< uint32 > _terrainSwaps
Definition: Object.h:650
virtual bool WorldObject::IsInvisibleDueToDespawn ( ) const
inlineprotectedvirtual

Reimplemented in GameObject, and Creature.

640 { return false; }

+ Here is the caller graph for this function:

bool WorldObject::isNeedNotify ( uint16  f) const
inline
575 { return (m_notifyflags & f) != 0; }
uint16 m_notifyflags
Definition: Object.h:654

+ Here is the caller graph for this function:

virtual bool WorldObject::IsNeverVisible ( ) const
inlineprotectedvirtual

Reimplemented in GameObject.

638 { return !IsInWorld(); }
bool IsInWorld() const
Definition: Object.h:100

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::IsPermanentWorldObject ( ) const
inline
584 { return m_isWorldObject; }
const bool m_isWorldObject
Definition: Object.h:626

+ Here is the caller graph for this function:

bool WorldObject::IsSelfOrInSameMap ( WorldObject const obj) const
1625 {
1626  if (this == obj)
1627  return true;
1628  return IsInMap(obj);
1629 }
bool IsInMap(WorldObject const *obj) const
Definition: Object.cpp:1631

+ Here is the call graph for this function:

bool WorldObject::IsWithinDist ( WorldObject const obj,
float  dist2compare,
bool  is3D = true 
) const
1659 {
1660  return obj && _IsWithinDist(obj, dist2compare, is3D);
1661 }
virtual bool _IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D) const
Definition: Object.cpp:1554

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::IsWithinDist2d ( float  x,
float  y,
float  dist 
) const
1649 {
1650  return IsInDist2d(x, y, dist + GetObjectSize());
1651 }
G3D::int16 y
Definition: Vector2int16.h:38
bool IsInDist2d(float x, float y, float dist) const
Definition: Position.h:185
G3D::int16 x
Definition: Vector2int16.h:37
float GetObjectSize() const
Definition: Object.cpp:2656

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::IsWithinDist2d ( Position const pos,
float  dist 
) const
1654 {
1655  return IsInDist2d(pos, dist + GetObjectSize());
1656 }
bool IsInDist2d(float x, float y, float dist) const
Definition: Position.h:185
float GetObjectSize() const
Definition: Object.cpp:2656

+ Here is the call graph for this function:

bool WorldObject::IsWithinDist3d ( float  x,
float  y,
float  z,
float  dist 
) const
1639 {
1640  return IsInDist(x, y, z, dist + GetObjectSize());
1641 }
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37
float GetObjectSize() const
Definition: Object.cpp:2656
bool IsInDist(float x, float y, float z, float dist) const
Definition: Position.h:195

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::IsWithinDist3d ( Position const pos,
float  dist 
) const
1644 {
1645  return IsInDist(pos, dist + GetObjectSize());
1646 }
float GetObjectSize() const
Definition: Object.cpp:2656
bool IsInDist(float x, float y, float z, float dist) const
Definition: Position.h:195

+ Here is the call graph for this function:

bool WorldObject::IsWithinDistInMap ( WorldObject const obj,
float  dist2compare,
bool  is3D = true 
) const
1664 {
1665  return obj && IsInMap(obj) && IsInPhase(obj) && _IsWithinDist(obj, dist2compare, is3D);
1666 }
virtual bool _IsWithinDist(WorldObject const *obj, float dist2compare, bool is3D) const
Definition: Object.cpp:1554
bool IsInMap(WorldObject const *obj) const
Definition: Object.cpp:1631
bool IsInPhase(uint32 phase) const
Definition: Object.h:462

+ Here is the call graph for this function:

bool WorldObject::IsWithinLOS ( float  x,
float  y,
float  z 
) const
1669 {
1670  /*float x, y, z;
1671  GetPosition(x, y, z);
1672  VMAP::IVMapManager* vMapManager = VMAP::VMapFactory::createOrGetVMapManager();
1673  return vMapManager->isInLineOfSight(GetMapId(), x, y, z+2.0f, ox, oy, oz+2.0f);*/
1674  if (IsInWorld())
1675  return GetMap()->isInLineOfSight(GetPositionX(), GetPositionY(), GetPositionZ()+2.f, ox, oy, oz+2.f, GetPhaseMask());
1676 
1677  return true;
1678 }
Map * GetMap() const
Definition: Object.h:543
uint32 GetPhaseMask() const
Definition: Object.h:461
bool isInLineOfSight(float x1, float y1, float z1, float x2, float y2, float z2, uint32 phasemask) const
Definition: Map.cpp:2590
float GetPositionY() const
Definition: Position.h:105
float GetPositionZ() const
Definition: Position.h:106
bool IsInWorld() const
Definition: Object.h:100
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::IsWithinLOSInMap ( WorldObject const obj) const
1585 {
1586  if (!IsInMap(obj))
1587  return false;
1588 
1589  float ox, oy, oz;
1590  obj->GetPosition(ox, oy, oz);
1591  return IsWithinLOS(ox, oy, oz);
1592 }
bool IsWithinLOS(float x, float y, float z) const
Definition: Object.cpp:1668
bool IsInMap(WorldObject const *obj) const
Definition: Object.cpp:1631

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::IsWorldObject ( ) const
1463 {
1464  if (m_isWorldObject)
1465  return true;
1466 
1467  if (ToCreature() && ToCreature()->m_isTempWorldObject)
1468  return true;
1469 
1470  return false;
1471 }
const bool m_isWorldObject
Definition: Object.h:626
Creature * ToCreature()
Definition: Object.h:194

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::MovePosition ( Position pos,
float  dist,
float  angle 
)
2662 {
2663  angle += GetOrientation();
2664  float destx, desty, destz, ground, floor;
2665  destx = pos.m_positionX + dist * std::cos(angle);
2666  desty = pos.m_positionY + dist * std::sin(angle);
2667 
2668  // Prevent invalid coordinates here, position is unchanged
2669  if (!Trinity::IsValidMapCoord(destx, desty, pos.m_positionZ))
2670  {
2671  TC_LOG_FATAL("misc", "WorldObject::MovePosition: Object (Entry: %u %s) has invalid coordinates X: %f and Y: %f were passed!",
2672  GetEntry(), GetGUID().ToString().c_str(), destx, desty);
2673  return;
2674  }
2675 
2676  ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
2677  floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
2678  destz = std::fabs(ground - pos.m_positionZ) <= std::fabs(floor - pos.m_positionZ) ? ground : floor;
2679 
2680  float step = dist/10.0f;
2681 
2682  for (uint8 j = 0; j < 10; ++j)
2683  {
2684  // do not allow too big z changes
2685  if (std::fabs(pos.m_positionZ - destz) > 6)
2686  {
2687  destx -= step * std::cos(angle);
2688  desty -= step * std::sin(angle);
2689  ground = GetMap()->GetHeight(GetPhaseMask(), destx, desty, MAX_HEIGHT, true);
2690  floor = GetMap()->GetHeight(GetPhaseMask(), destx, desty, pos.m_positionZ, true);
2691  destz = std::fabs(ground - pos.m_positionZ) <= std::fabs(floor - pos.m_positionZ) ? ground : floor;
2692  }
2693  // we have correct destz now
2694  else
2695  {
2696  pos.Relocate(destx, desty, destz);
2697  break;
2698  }
2699  }
2700 
2705 }
Map * GetMap() const
Definition: Object.h:543
float m_positionY
Definition: Position.h:53
void SetOrientation(float orientation)
Definition: Position.h:99
static Vector3int16 floor(const Vector3 &v)
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.cpp:2314
float m_positionX
Definition: Position.h:52
float GetOrientation() const
Definition: Position.h:107
void Relocate(float x, float y)
Definition: Position.h:67
uint32 GetPhaseMask() const
Definition: Object.h:461
bool IsValidMapCoord(float c)
Definition: GridDefines.h:218
std::string ToString() const
Definition: Position.cpp:160
float m_positionZ
Definition: Position.h:54
void NormalizeMapCoord(float &c)
Definition: GridDefines.h:210
ObjectGuid const & GetGUID() const
Definition: Object.h:105
#define TC_LOG_FATAL(filterType__,...)
Definition: Log.h:210
uint8_t uint8
Definition: Define.h:152
uint32 GetEntry() const
Definition: Object.h:107
#define MAX_HEIGHT
Definition: Map.h:247
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:

void WorldObject::MovePositionToFirstCollision ( Position pos,
float  dist,
float  angle 
)
2734 {
2735  angle += GetOrientation();
2736  float destx, desty, destz;
2737  destx = pos.m_positionX + dist * std::cos(angle);
2738  desty = pos.m_positionY + dist * std::sin(angle);
2739 
2740  // Prevent invalid coordinates here, position is unchanged
2741  if (!Trinity::IsValidMapCoord(destx, desty))
2742  {
2743  TC_LOG_FATAL("misc", "WorldObject::MovePositionToFirstCollision invalid coordinates X: %f and Y: %f were passed!", destx, desty);
2744  return;
2745  }
2746 
2747  destz = NormalizeZforCollision(this, destx, desty, pos.GetPositionZ());
2748  bool col = VMAP::VMapFactory::createOrGetVMapManager()->getObjectHitPos(GetMapId(), pos.m_positionX, pos.m_positionY, pos.m_positionZ + 0.5f, destx, desty, destz + 0.5f, destx, desty, destz, -0.5f);
2749 
2750  // collision occured
2751  if (col)
2752  {
2753  // move back a bit
2754  destx -= CONTACT_DISTANCE * std::cos(angle);
2755  desty -= CONTACT_DISTANCE * std::sin(angle);
2756  dist = std::sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
2757  }
2758 
2759  // check dynamic collision
2760  col = GetMap()->getObjectHitPos(GetPhaseMask(), pos.m_positionX, pos.m_positionY, pos.m_positionZ + 0.5f, destx, desty, destz + 0.5f, destx, desty, destz, -0.5f);
2761 
2762  // Collided with a gameobject
2763  if (col)
2764  {
2765  destx -= CONTACT_DISTANCE * std::cos(angle);
2766  desty -= CONTACT_DISTANCE * std::sin(angle);
2767  dist = std::sqrt((pos.m_positionX - destx)*(pos.m_positionX - destx) + (pos.m_positionY - desty)*(pos.m_positionY - desty));
2768  }
2769 
2770  float step = dist / 10.0f;
2771 
2772  for (uint8 j = 0; j < 10; ++j)
2773  {
2774  // do not allow too big z changes
2775  if (std::fabs(pos.m_positionZ - destz) > 6.0f)
2776  {
2777  destx -= step * std::cos(angle);
2778  desty -= step * std::sin(angle);
2779  destz = NormalizeZforCollision(this, destx, desty, pos.GetPositionZ());
2780  }
2781  // we have correct destz now
2782  else
2783  {
2784  pos.Relocate(destx, desty, destz);
2785  break;
2786  }
2787  }
2788 
2791  pos.m_positionZ = NormalizeZforCollision(this, destx, desty, pos.GetPositionZ());
2793 }
Map * GetMap() const
Definition: Object.h:543
float m_positionY
Definition: Position.h:53
void SetOrientation(float orientation)
Definition: Position.h:99
float m_positionX
Definition: Position.h:52
virtual bool getObjectHitPos(unsigned int pMapId, float x1, float y1, float z1, float x2, float y2, float z2, float &rx, float &ry, float &rz, float pModifyDist)=0
float NormalizeZforCollision(WorldObject *obj, float x, float y, float z)
Definition: Object.cpp:2708
float GetOrientation() const
Definition: Position.h:107
void Relocate(float x, float y)
Definition: Position.h:67
uint32 GetPhaseMask() const
Definition: Object.h:461
bool IsValidMapCoord(float c)
Definition: GridDefines.h:218
bool getObjectHitPos(uint32 phasemask, float x1, float y1, float z1, float x2, float y2, float z2, float &rx, float &ry, float &rz, float modifyDist)
Definition: Map.cpp:2596
float GetPositionZ() const
Definition: Position.h:106
uint32 GetMapId() const
Definition: Position.h:254
float m_positionZ
Definition: Position.h:54
void NormalizeMapCoord(float &c)
Definition: GridDefines.h:210
#define TC_LOG_FATAL(filterType__,...)
Definition: Log.h:210
uint8_t uint8
Definition: Define.h:152
static IVMapManager * createOrGetVMapManager()
Definition: VMapFactory.cpp:28
#define CONTACT_DISTANCE
Definition: Object.h:33

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool WorldObject::NotifyExecuted ( uint16  f) const
inline
577 { return (m_executed_notifies & f) != 0; }
uint16 m_executed_notifies
Definition: Object.h:655
void WorldObject::PlayDirectSound ( uint32  sound_id,
Player target = NULL 
)
2967 {
2968  if (target)
2969  target->SendDirectMessage(WorldPackets::Misc::PlaySound(GetGUID(), sound_id).Write());
2970  else
2971  SendMessageToSet(WorldPackets::Misc::PlaySound(GetGUID(), sound_id).Write(), true);
2972 }
Definition: MiscPackets.h:601
ObjectGuid const & GetGUID() const
Definition: Object.h:105
virtual void SendMessageToSet(WorldPacket const *data, bool self)
Definition: Object.cpp:2144

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::PlayDistanceSound ( uint32  sound_id,
Player target = NULL 
)
2956 {
2958  data << uint32(sound_id);
2959  data << GetGUID();
2960  if (target)
2961  target->SendDirectMessage(&data);
2962  else
2963  SendMessageToSet(&data, true);
2964 }
Definition: Opcodes.h:1377
ObjectGuid const & GetGUID() const
Definition: Object.h:105
uint32_t uint32
Definition: g3dmath.h:168
virtual void SendMessageToSet(WorldPacket const *data, bool self)
Definition: Object.cpp:2144
Definition: WorldPacket.h:26

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::RebuildTerrainSwaps ( )
3110 {
3111  // Clear all terrain swaps, will be rebuilt below
3112  // Reason for this is, multiple phases can have the same terrain swap, we should not remove the swap if another phase still use it
3113  _terrainSwaps.clear();
3114 
3115  // Check all applied phases for terrain swap and add it only once
3116  for (uint32 phaseId : _phases)
3117  {
3118  if (std::vector<uint32> const* swaps = sObjectMgr->GetPhaseTerrainSwaps(phaseId))
3119  {
3120  for (uint32 const& swap : *swaps)
3121  {
3122  // only add terrain swaps for current map
3123  MapEntry const* mapEntry = sMapStore.LookupEntry(swap);
3124  if (!mapEntry || mapEntry->ParentMapID != int32(GetMapId()))
3125  continue;
3126 
3127  if (sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_TERRAIN_SWAP, swap, this))
3128  _terrainSwaps.insert(swap);
3129  }
3130  }
3131  }
3132 
3133  // get default terrain swaps, only for current map always
3134  if (std::vector<uint32> const* mapSwaps = sObjectMgr->GetDefaultTerrainSwaps(GetMapId()))
3135  for (uint32 const& swap : *mapSwaps)
3136  if (sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_TERRAIN_SWAP, swap, this))
3137  _terrainSwaps.insert(swap);
3138 
3139  // online players have a game client with world map display
3140  if (GetTypeId() == TYPEID_PLAYER)
3142 }
std::set< uint32 > _phases
Definition: Object.h:649
Definition: DBCStructure.h:830
Definition: ConditionMgr.h:152
#define sObjectMgr
Definition: ObjectMgr.h:1567
TypeID GetTypeId() const
Definition: Object.h:113
int32 ParentMapID
Definition: DBCStructure.h:850
std::set< uint32 > _terrainSwaps
Definition: Object.h:650
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
#define sConditionMgr
Definition: ConditionMgr.h:307
uint32 GetMapId() const
Definition: Position.h:254
Definition: ObjectGuid.h:33
DBCStorage< MapEntry > sMapStore(Mapfmt)
void RebuildWorldMapAreaSwaps()
Definition: Object.cpp:3144

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::RebuildWorldMapAreaSwaps ( )
3145 {
3146  // Clear all world map area swaps, will be rebuilt below
3147  _worldMapAreaSwaps.clear();
3148 
3149  // get ALL default terrain swaps, if we are using it (condition is true)
3150  // send the worldmaparea for it, to see swapped worldmaparea in client from other maps too, not just from our current
3151  TerrainPhaseInfo const& defaults = sObjectMgr->GetDefaultTerrainSwapStore();
3152  for (TerrainPhaseInfo::const_iterator itr = defaults.begin(); itr != defaults.end(); ++itr)
3153  for (uint32 const& swap : itr->second)
3154  if (std::vector<uint32> const* uiMapSwaps = sObjectMgr->GetTerrainWorldMaps(swap))
3155  if (sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_TERRAIN_SWAP, swap, this))
3156  for (uint32 worldMapAreaId : *uiMapSwaps)
3157  _worldMapAreaSwaps.insert(worldMapAreaId);
3158 
3159  // Check all applied phases for world map area swaps
3160  for (uint32 phaseId : _phases)
3161  if (std::vector<uint32> const* swaps = sObjectMgr->GetPhaseTerrainSwaps(phaseId))
3162  for (uint32 const& swap : *swaps)
3163  if (std::vector<uint32> const* uiMapSwaps = sObjectMgr->GetTerrainWorldMaps(swap))
3164  if (sConditionMgr->IsObjectMeetingNotGroupedConditions(CONDITION_SOURCE_TYPE_TERRAIN_SWAP, swap, this))
3165  for (uint32 worldMapAreaId : *uiMapSwaps)
3166  _worldMapAreaSwaps.insert(worldMapAreaId);
3167 }
std::set< uint32 > _worldMapAreaSwaps
Definition: Object.h:651
std::set< uint32 > _phases
Definition: Object.h:649
Definition: ConditionMgr.h:152
#define sObjectMgr
Definition: ObjectMgr.h:1567
std::unordered_map< uint32, std::vector< uint32 > > TerrainPhaseInfo
Definition: ObjectMgr.h:696
uint32_t uint32
Definition: Define.h:150
#define sConditionMgr
Definition: ConditionMgr.h:307

+ Here is the caller graph for this function:

void WorldObject::RemoveFromObjectUpdate ( )
overridevirtual

Implements Object.

3098 {
3099  GetMap()->RemoveUpdateObject(this);
3100 }
void RemoveUpdateObject(Object *obj)
Definition: Map.h:572
Map * GetMap() const
Definition: Object.h:543

+ Here is the call graph for this function:

void WorldObject::RemoveFromWorld ( )
overridevirtual

Reimplemented from Object.

Reimplemented in Unit, GameObject, Creature, Puppet, Minion, Corpse, Pet, TempSummon, DynamicObject, and AreaTrigger.

1516 {
1517  if (!IsInWorld())
1518  return;
1519 
1521 
1523 }
virtual void RemoveFromWorld()
Definition: Object.cpp:156
void DestroyForNearbyPlayers()
Definition: Object.cpp:2974
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::ResetAllNotifies ( )
inline
uint16 m_notifyflags
Definition: Object.h:654
uint16 m_executed_notifies
Definition: Object.h:655
void WorldObject::ResetMap ( )
virtual
2188 {
2189  ASSERT(m_currMap);
2190  ASSERT(!IsInWorld());
2191  if (IsWorldObject())
2193  m_currMap = NULL;
2194  //maybe not for corpse
2195  //m_mapId = 0;
2196  //m_InstanceId = 0;
2197 }
Map * m_currMap
Definition: Object.h:644
arena_t NULL
Definition: jemalloc_internal.h:624
bool IsWorldObject() const
Definition: Object.cpp:1462
void RemoveWorldObject(WorldObject *obj)
Definition: Map.h:428
#define ASSERT
Definition: Errors.h:55
bool IsInWorld() const
Definition: Object.h:100

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void WorldObject::SaveRespawnTime ( )
inlinevirtual

Reimplemented in GameObject, and Creature.

524 { }
void WorldObject::SendMessageToSet ( WorldPacket const data,
bool  self 
)
virtual
2145 {
2146  if (IsInWorld())
2148 }
float GetVisibilityRange() const
Definition: Object.cpp:1912
virtual void SendMessageToSetInRange(WorldPacket const *data, float dist, bool self)
Definition: Object.cpp:2150
bool IsInWorld() const
Definition: Object.h:100

+ Here is the call graph for this function:

void WorldObject::SendMessageToSet ( WorldPacket const data,
Player const skipped_rcvr 
)
virtual
2157 {
2158  Trinity::MessageDistDeliverer notifier(this, data, GetVisibilityRange(), false, skipped_rcvr);
2160 }
void VisitNearbyWorldObject(float const &radius, NOTIFIER &notifier) const
Definition: Object.h:589
float GetVisibilityRange() const
Definition: Object.cpp:1912
Definition: GridNotifiers.h:126

+ Here is the call graph for this function:

void WorldObject::SendMessageToSetInRange ( WorldPacket const data,
float  dist,
bool  self 
)
virtual
2151 {
2152  Trinity::MessageDistDeliverer notifier(this, data, dist);
2153  VisitNearbyWorldObject(dist, notifier);
2154 }
void VisitNearbyWorldObject(float const &radius, NOTIFIER &notifier) const
Definition: Object.h:589
Definition: GridNotifiers.h:126

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::SendObjectDeSpawnAnim ( ObjectGuid  guid)
2163 {
2165  packet.ObjectGUID = guid;
2166  SendMessageToSet(packet.Write(), true);
2167 }
Definition: GameObjectPackets.h:50
WorldPacket const * Write() override
Definition: GameObjectPackets.cpp:30
ObjectGuid ObjectGUID
Definition: GameObjectPackets.h:57
virtual void SendMessageToSet(WorldPacket const *data, bool self)
Definition: Object.cpp:2144

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::setActive ( bool  isActiveObject)
1474 {
1475  if (m_isActive == on)
1476  return;
1477 
1478  if (GetTypeId() == TYPEID_PLAYER)
1479  return;
1480 
1481  m_isActive = on;
1482 
1483  if (!IsInWorld())
1484  return;
1485 
1486  Map* map = FindMap();
1487  if (!map)
1488  return;
1489 
1490  if (on)
1491  {
1492  if (GetTypeId() == TYPEID_UNIT)
1493  map->AddToActive(this->ToCreature());
1494  else if (GetTypeId() == TYPEID_DYNAMICOBJECT)
1495  map->AddToActive((DynamicObject*)this);
1496  }
1497  else
1498  {
1499  if (GetTypeId() == TYPEID_UNIT)
1500  map->RemoveFromActive(this->ToCreature());
1501  else if (GetTypeId() == TYPEID_DYNAMICOBJECT)
1502  map->RemoveFromActive((DynamicObject*)this);
1503  }
1504 }
Definition: ObjectGuid.h:32
void RemoveFromActive(T *obj)
Definition: Map.cpp:2992
Definition: DynamicObject.h:35
TypeID GetTypeId() const
Definition: Object.h:113
Map * FindMap() const
Definition: Object.h:544
bool m_isActive
Definition: Object.h:625
Definition: Map.h:259
Definition: ObjectGuid.h:33
Creature * ToCreature()
Definition: Object.h:194
void AddToActive(T *obj)
Definition: Map.cpp:2958
bool IsInWorld() const
Definition: Object.h:100
Definition: ObjectGuid.h:35

+ Here is the call graph for this function:

void WorldObject::SetDBPhase ( int32  p)
inline
471 { _dbPhase = p; }
int32 _dbPhase
Definition: Object.h:652

+ Here is the caller graph for this function:

bool WorldObject::SetInPhase ( uint32  id,
bool  update,
bool  apply 
)
virtual

Reimplemented in Unit, and GameObject.

2880 {
2881  if (id)
2882  {
2883  if (apply)
2884  {
2885  if (HasInPhaseList(id)) // do not run the updates if we are already in this phase
2886  return false;
2887 
2888  _phases.insert(id);
2889  }
2890  else
2891  {
2892  // if area phase passes the condition we should not remove it (ie: if remove called from aura remove)
2893  // this however breaks the .mod phase command, you wont be able to remove any area based phases with it
2894  if (std::vector<PhaseInfoStruct> const* phases = sObjectMgr->GetPhasesForArea(GetAreaId()))
2895  for (PhaseInfoStruct const& phase : *phases)
2896  if (id == phase.Id)
2897  if (sConditionMgr->IsObjectMeetToConditions(this, phase.Conditions))
2898  return false;
2899 
2900  if (!HasInPhaseList(id)) // do not run the updates if we are not in this phase
2901  return false;
2902 
2903  _phases.erase(id);
2904  }
2905  }
2906 
2908 
2909  if (update && IsInWorld())
2911 
2912  return true;
2913 }
std::set< uint32 > _phases
Definition: Object.h:649
Definition: ObjectMgr.h:690
void apply(T *val)
Definition: ByteConverter.h:41
#define sObjectMgr
Definition: ObjectMgr.h:1567
void RebuildTerrainSwaps()
Definition: Object.cpp:3109
#define sConditionMgr
Definition: ConditionMgr.h:307
uint32 GetAreaId() const
Definition: Object.cpp:1530
bool HasInPhaseList(uint32 phase)
Definition: Object.cpp:2803
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::SetLocationInstanceId ( uint32  _instanceId)
inlineprotected
636 { m_InstanceId = _instanceId; }
uint32 m_InstanceId
Definition: Object.h:647

+ Here is the caller graph for this function:

void WorldObject::SetLocationMapId ( uint32  _mapId)
inlineprotected
635 { m_mapId = _mapId; }
uint32 m_mapId
Definition: Position.h:256

+ Here is the caller graph for this function:

void WorldObject::SetMap ( Map map)
virtual
2170 {
2171  ASSERT(map);
2172  ASSERT(!IsInWorld());
2173  if (m_currMap == map) // command add npc: first create, than loadfromdb
2174  return;
2175  if (m_currMap)
2176  {
2177  TC_LOG_FATAL("misc", "WorldObject::SetMap: obj %u new map %u %u, old map %u %u", (uint32)GetTypeId(), map->GetId(), map->GetInstanceId(), m_currMap->GetId(), m_currMap->GetInstanceId());
2178  ABORT();
2179  }
2180  m_currMap = map;
2181  m_mapId = map->GetId();
2182  m_InstanceId = map->GetInstanceId();
2183  if (IsWorldObject())
2184  m_currMap->AddWorldObject(this);
2185 }
Map * m_currMap
Definition: Object.h:644
bool IsWorldObject() const
Definition: Object.cpp:1462
uint32 m_InstanceId
Definition: Object.h:647
uint32 GetId(void) const
Definition: Map.h:325
TypeID GetTypeId() const
Definition: Object.h:113
uint32 m_mapId
Definition: Position.h:256
uint32_t uint32
Definition: Define.h:150
#define TC_LOG_FATAL(filterType__,...)
Definition: Log.h:210
#define ABORT
Definition: Errors.h:56
#define ASSERT
Definition: Errors.h:55
void AddWorldObject(WorldObject *obj)
Definition: Map.h:427
bool IsInWorld() const
Definition: Object.h:100
uint32 GetInstanceId() const
Definition: Map.h:368

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::SetName ( std::string const newname)
inline
480 { m_name=newname; }
std::string m_name
Definition: Object.h:624

+ Here is the caller graph for this function:

void WorldObject::SetNotified ( uint16  f)
inline
578 { m_executed_notifies |= f;}
uint16 m_executed_notifies
Definition: Object.h:655
void WorldObject::SetPhaseMask ( uint32  newPhaseMask,
bool  update 
)
virtual
2796 {
2797  m_phaseMask = newPhaseMask;
2798 
2799  if (update && IsInWorld())
2801 }
virtual void UpdateObjectVisibility(bool forced=true)
Definition: Object.cpp:3001
uint32 m_phaseMask
Definition: Object.h:648
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::SetTransport ( Transport t)
inline
610 { m_transport = t; }
Transport * m_transport
Definition: Object.h:630

+ Here is the caller graph for this function:

void WorldObject::SetWorldObject ( bool  apply)
1455 {
1456  if (!IsInWorld())
1457  return;
1458 
1459  GetMap()->AddObjectToSwitchList(this, on);
1460 }
Map * GetMap() const
Definition: Object.h:543
void AddObjectToSwitchList(WorldObject *obj, bool on)
Definition: Map.cpp:2814
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::SetZoneScript ( )
2331 {
2332  if (Map* map = FindMap())
2333  {
2334  if (map->IsDungeon())
2335  m_zoneScript = (ZoneScript*)((InstanceMap*)map)->GetInstanceScript();
2336  else if (!map->IsBattlegroundOrArena())
2337  {
2338  if (Battlefield* bf = sBattlefieldMgr->GetBattlefieldToZoneId(GetZoneId()))
2339  m_zoneScript = bf;
2340  else
2341  m_zoneScript = sOutdoorPvPMgr->GetZoneScript(GetZoneId());
2342  }
2343  }
2344 }
#define sOutdoorPvPMgr
Definition: OutdoorPvPMgr.h:105
uint32 GetZoneId() const
Definition: Object.cpp:1525
Definition: Map.h:758
Definition: ZoneScript.h:26
ZoneScript * m_zoneScript
Definition: Object.h:627
Map * FindMap() const
Definition: Object.h:544
Definition: Battlefield.h:196
Definition: Map.h:259
#define sBattlefieldMgr
Definition: BattlefieldMgr.h:67

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

TempSummon * WorldObject::SummonCreature ( uint32  id,
Position const pos,
TempSummonType  spwtype = TEMPSUMMON_MANUAL_DESPAWN,
uint32  despwtime = 0,
uint32  vehId = 0 
) const
2347 {
2348  if (Map* map = FindMap())
2349  {
2350  if (TempSummon* summon = map->SummonCreature(entry, pos, NULL, duration, isType(TYPEMASK_UNIT) ? (Unit*)this : NULL))
2351  {
2352  summon->SetTempSummonType(spwtype);
2353  return summon;
2354  }
2355  }
2356 
2357  return NULL;
2358 }
Definition: TemporarySummon.h:40
bool isType(uint16 mask) const
Definition: Object.h:114
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: ObjectGuid.h:49
Map * FindMap() const
Definition: Object.h:544
Definition: Map.h:259
Definition: Unit.h:1305
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346

+ Here is the call graph for this function:

TempSummon * WorldObject::SummonCreature ( uint32  id,
float  x,
float  y,
float  z,
float  ang = 0,
TempSummonType  spwtype = TEMPSUMMON_MANUAL_DESPAWN,
uint32  despwtime = 0 
) const
2361 {
2362  if (!x && !y && !z)
2363  {
2365  ang = GetOrientation();
2366  }
2367  Position pos;
2368  pos.Relocate(x, y, z, ang);
2369  return SummonCreature(id, pos, spwtype, despwtime, 0);
2370 }
float GetOrientation() const
Definition: Position.h:107
void Relocate(float x, float y)
Definition: Position.h:67
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
Definition: Position.h:27
G3D::int16 x
Definition: Vector2int16.h:37
float GetObjectSize() const
Definition: Object.cpp:2656
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346
void GetClosePoint(float &x, float &y, float &z, float size, float distance2d=0, float angle=0) const
Definition: Object.cpp:2623

+ Here is the call graph for this function:

void WorldObject::SummonCreatureGroup ( uint8  group,
std::list< TempSummon * > *  list = NULL 
)

Summons group of creatures. Should be called only by instances of Creature and GameObject classes.

Parameters
groupId of group to summon.
listList to store pointers to summoned creatures.
2430 {
2431  ASSERT((GetTypeId() == TYPEID_GAMEOBJECT || GetTypeId() == TYPEID_UNIT) && "Only GOs and creatures can summon npc groups!");
2432 
2433  std::vector<TempSummonData> const* data = sObjectMgr->GetSummonGroup(GetEntry(), GetTypeId() == TYPEID_GAMEOBJECT ? SUMMONER_TYPE_GAMEOBJECT : SUMMONER_TYPE_CREATURE, group);
2434  if (!data)
2435  return;
2436 
2437  for (std::vector<TempSummonData>::const_iterator itr = data->begin(); itr != data->end(); ++itr)
2438  if (TempSummon* summon = SummonCreature(itr->entry, itr->pos, itr->type, itr->time))
2439  if (list)
2440  list->push_back(summon);
2441 }
Definition: TemporarySummon.h:40
Definition: ObjectGuid.h:32
Definition: TemporarySummon.h:27
#define sObjectMgr
Definition: ObjectMgr.h:1567
TypeID GetTypeId() const
Definition: Object.h:113
Definition: ObjectGuid.h:34
#define ASSERT
Definition: Errors.h:55
Definition: TemporarySummon.h:26
uint32 GetEntry() const
Definition: Object.h:107
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

GameObject * WorldObject::SummonGameObject ( uint32  entry,
float  x,
float  y,
float  z,
float  ang,
float  rotation0,
float  rotation1,
float  rotation2,
float  rotation3,
uint32  respawnTime 
)
2373 {
2374  if (!IsInWorld())
2375  return NULL;
2376 
2377  GameObjectTemplate const* goinfo = sObjectMgr->GetGameObjectTemplate(entry);
2378  if (!goinfo)
2379  {
2380  TC_LOG_ERROR("sql.sql", "Gameobject template %u not found in database!", entry);
2381  return NULL;
2382  }
2383 
2384  Map* map = GetMap();
2385  GameObject* go = new GameObject();
2386  if (!go->Create(map->GenerateLowGuid<HighGuid::GameObject>(), entry, map, GetPhaseMask(), x, y, z, ang, rotation0, rotation1, rotation2, rotation3, 100, GO_STATE_READY))
2387  {
2388  delete go;
2389  return NULL;
2390  }
2391 
2392  go->CopyPhaseFrom(this);
2393 
2394  go->SetRespawnTime(respawnTime);
2395  if (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT) //not sure how to handle this
2396  ToUnit()->AddGameObject(go);
2397  else
2398  go->SetSpawnedByDefault(false);
2399 
2400  map->AddToMap(go);
2401  return go;
2402 }
Map * GetMap() const
Definition: Object.h:543
Definition: GameObject.h:34
Definition: ObjectGuid.h:32
arena_t NULL
Definition: jemalloc_internal.h:624
void CopyPhaseFrom(WorldObject *obj, bool update=false)
Definition: Object.cpp:2915
void SetRespawnTime(int32 respawn)
Definition: GameObject.h:945
#define sObjectMgr
Definition: ObjectMgr.h:1567
TypeID GetTypeId() const
Definition: Object.h:113
uint32 GetPhaseMask() const
Definition: Object.h:461
G3D::int16 z
Definition: Vector3int16.h:46
void SetSpawnedByDefault(bool b)
Definition: GameObject.h:958
bool AddToMap(T *)
Definition: Map.cpp:566
G3D::int16 y
Definition: Vector2int16.h:38
Definition: GameObject.h:880
void AddGameObject(GameObject *gameObj)
Definition: Unit.cpp:4747
Definition: Map.h:259
Definition: GameObject.h:823
Definition: ObjectGuid.h:33
bool Create(ObjectGuid::LowType guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state, uint32 artKit=0)
Definition: GameObject.cpp:173
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
G3D::int16 x
Definition: Vector2int16.h:37
ObjectGuid::LowType GenerateLowGuid()
Definition: Map.h:561
bool IsInWorld() const
Definition: Object.h:100
Unit * ToUnit()
Definition: Object.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Creature * WorldObject::SummonTrigger ( float  x,
float  y,
float  z,
float  ang,
uint32  dur,
CreatureAI *(*)(Creature *)  GetAI = NULL 
)
2405 {
2406  TempSummonType summonType = (duration == 0) ? TEMPSUMMON_DEAD_DESPAWN : TEMPSUMMON_TIMED_DESPAWN;
2407  Creature* summon = SummonCreature(WORLD_TRIGGER, x, y, z, ang, summonType, duration);
2408  if (!summon)
2409  return NULL;
2410 
2411  //summon->SetName(GetName());
2412  if (GetTypeId() == TYPEID_PLAYER || GetTypeId() == TYPEID_UNIT)
2413  {
2414  summon->setFaction(((Unit*)this)->getFaction());
2415  summon->SetLevel(((Unit*)this)->getLevel());
2416  }
2417 
2418  if (GetAI)
2419  summon->AIM_Initialize(GetAI(summon));
2420  return summon;
2421 }
#define WORLD_TRIGGER
Definition: Unit.h:33
Definition: ObjectGuid.h:32
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: Creature.h:467
Definition: Object.h:60
TempSummonType
Definition: Object.h:52
bool AIM_Initialize(CreatureAI *ai=NULL)
Definition: Creature.cpp:796
void setFaction(uint32 faction)
Definition: Unit.h:1467
TypeID GetTypeId() const
Definition: Object.h:113
void SetLevel(uint8 lvl)
Definition: Unit.cpp:11523
Definition: Object.h:56
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
Definition: ObjectGuid.h:33
G3D::int16 x
Definition: Vector2int16.h:37
Definition: Unit.h:1305
TempSummon * SummonCreature(uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
Definition: Object.cpp:2346

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

virtual void WorldObject::Update ( uint32  )
inlinevirtual

Reimplemented in Unit, GameObject, Creature, Puppet, Pet, TempSummon, DynamicObject, Totem, Transport, and AreaTrigger.

430 { }

+ Here is the caller graph for this function:

void WorldObject::UpdateAllowedPositionZ ( float  x,
float  y,
float &  z 
) const
1835 {
1836  // TODO: Allow transports to be part of dynamic vmap tree
1837  if (GetTransport())
1838  return;
1839 
1840  switch (GetTypeId())
1841  {
1842  case TYPEID_UNIT:
1843  {
1844  // non fly unit don't must be in air
1845  // non swim unit must be at ground (mostly speedup, because it don't must be in water and water level check less fast
1846  if (!ToCreature()->CanFly())
1847  {
1848  bool canSwim = ToCreature()->CanSwim();
1849  float ground_z = z;
1850  float max_z = canSwim
1851  ? GetMap()->GetWaterOrGroundLevel(x, y, z, &ground_z, !ToUnit()->HasAuraType(SPELL_AURA_WATER_WALK))
1852  : ((ground_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z, true)));
1853  if (max_z > INVALID_HEIGHT)
1854  {
1855  if (z > max_z)
1856  z = max_z;
1857  else if (z < ground_z)
1858  z = ground_z;
1859  }
1860  }
1861  else
1862  {
1863  float ground_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z, true);
1864  if (z < ground_z)
1865  z = ground_z;
1866  }
1867  break;
1868  }
1869  case TYPEID_PLAYER:
1870  {
1871  // for server controlled moves playr work same as creature (but it can always swim)
1872  if (!ToPlayer()->CanFly())
1873  {
1874  float ground_z = z;
1875  float max_z = GetMap()->GetWaterOrGroundLevel(x, y, z, &ground_z, !ToUnit()->HasAuraType(SPELL_AURA_WATER_WALK));
1876  if (max_z > INVALID_HEIGHT)
1877  {
1878  if (z > max_z)
1879  z = max_z;
1880  else if (z < ground_z)
1881  z = ground_z;
1882  }
1883  }
1884  else
1885  {
1886  float ground_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z, true);
1887  if (z < ground_z)
1888  z = ground_z;
1889  }
1890  break;
1891  }
1892  default:
1893  {
1894  float ground_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z, true);
1895  if (ground_z > INVALID_HEIGHT)
1896  z = ground_z;
1897  break;
1898  }
1899  }
1900 }
Definition: SpellAuraDefines.h:164
Map * GetMap() const
Definition: Object.h:543
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.cpp:2314
Definition: ObjectGuid.h:32
float GetWaterOrGroundLevel(float x, float y, float z, float *ground=NULL, bool swim=false) const
Definition: Map.cpp:2296
bool CanSwim() const
Definition: Creature.h:499
Player * ToPlayer()
Definition: Object.h:191
TypeID GetTypeId() const
Definition: Object.h:113
uint32 GetPhaseMask() const
Definition: Object.h:461
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
Transport * GetTransport() const
Definition: Object.h:602
Definition: ObjectGuid.h:33
Creature * ToCreature()
Definition: Object.h:194
G3D::int16 x
Definition: Vector2int16.h:37
#define INVALID_HEIGHT
Definition: Map.h:248
Unit * ToUnit()
Definition: Object.h:197

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::UpdateAreaPhase ( )
2811 {
2812  bool updateNeeded = false;
2813  PhaseInfo const& phases = sObjectMgr->GetAreaPhases();
2814  for (PhaseInfo::const_iterator itr = phases.begin(); itr != phases.end(); ++itr)
2815  {
2816  uint32 areaId = itr->first;
2817  for (PhaseInfoStruct const& phase : itr->second)
2818  {
2819  if (areaId == GetAreaId())
2820  {
2821  if (sConditionMgr->IsObjectMeetToConditions(this, phase.Conditions))
2822  {
2823  // add new phase if condition passed, true if it wasnt added before
2824  bool up = SetInPhase(phase.Id, false, true);
2825  if (!updateNeeded && up)
2826  updateNeeded = true;
2827  }
2828  else
2829  {
2830  // condition failed, remove phase, true if there was something removed
2831  bool up = SetInPhase(phase.Id, false, false);
2832  if (!updateNeeded && up)
2833  updateNeeded = true;
2834  }
2835  }
2836  else
2837  {
2838  // not in area, remove phase, true if there was something removed
2839  bool up = SetInPhase(phase.Id, false, false);
2840  if (!updateNeeded && up)
2841  updateNeeded = true;
2842  }
2843  }
2844  }
2845 
2846  // do not remove a phase if it would be removed by an area but we have the same phase from an aura
2847  if (Unit* unit = ToUnit())
2848  {
2849  Unit::AuraEffectList const& auraPhaseList = unit->GetAuraEffectsByType(SPELL_AURA_PHASE);
2850  for (Unit::AuraEffectList::const_iterator itr = auraPhaseList.begin(); itr != auraPhaseList.end(); ++itr)
2851  {
2852  uint32 phase = uint32((*itr)->GetMiscValueB());
2853  bool up = SetInPhase(phase, false, true);
2854  if (!updateNeeded && up)
2855  updateNeeded = true;
2856  }
2857  Unit::AuraEffectList const& auraPhaseGroupList = unit->GetAuraEffectsByType(SPELL_AURA_PHASE_GROUP);
2858  for (Unit::AuraEffectList::const_iterator itr = auraPhaseGroupList.begin(); itr != auraPhaseGroupList.end(); ++itr)
2859  {
2860  bool up = false;
2861  uint32 phaseGroup = uint32((*itr)->GetMiscValueB());
2862  std::set<uint32> const& phaseIDs = sDB2Manager.GetPhasesForGroup(phaseGroup);
2863  for (uint32 phase : phaseIDs)
2864  up = SetInPhase(phase, false, true);
2865  if (!updateNeeded && up)
2866  updateNeeded = true;
2867  }
2868  }
2869 
2870  // only update visibility and send packets if there was a change in the phase list
2871  if (updateNeeded && GetTypeId() == TYPEID_PLAYER && IsInWorld())
2872  ToPlayer()->GetSession()->SendSetPhaseShift(GetPhases(), GetTerrainSwaps(), GetWorldMapAreaSwaps());
2873 
2874  // only update visibilty once, to prevent objects appearing for a moment while adding in multiple phases
2875  if (updateNeeded && IsInWorld())
2877 }
#define sDB2Manager
Definition: DB2Stores.h:224
Definition: SpellAuraDefines.h:386
std::unordered_map< uint32, std::vector< PhaseInfoStruct > > PhaseInfo
Definition: ObjectMgr.h:698
std::list< AuraEffect * > AuraEffectList
Definition: Unit.h:1322
std::set< uint32 > const & GetTerrainSwaps() const
Definition: Object.h:466
Definition: ObjectMgr.h:690
uint32 Id
Definition: ObjectMgr.h:692
#define sObjectMgr
Definition: ObjectMgr.h:1567
Player * ToPlayer()
Definition: Object.h:191
Definition: SpellAuraDefines.h:321
TypeID GetTypeId() const
Definition: Object.h:113
virtual bool SetInPhase(uint32 id, bool update, bool apply)
Definition: Object.cpp:2879
std::set< uint32 > const & GetWorldMapAreaSwaps() const
Definition: Object.h:467
uint32_t uint32
Definition: Define.h:150
#define sConditionMgr
Definition: ConditionMgr.h:307
uint32 GetAreaId() const
Definition: Object.cpp:1530
ConditionContainer Conditions
Definition: ObjectMgr.h:693
std::set< uint32 > const & GetPhases() const
Definition: Object.h:465
Definition: ObjectGuid.h:33
virtual void UpdateObjectVisibility(bool forced=true)
Definition: Object.cpp:3001
uint32_t uint32
Definition: g3dmath.h:168
bool IsInWorld() const
Definition: Object.h:100
Definition: Unit.h:1305
Unit * ToUnit()
Definition: Object.h:197

+ Here is the call graph for this function:

void WorldObject::UpdateGroundPositionZ ( float  x,
float  y,
float &  z 
) const
1828 {
1829  float new_z = GetMap()->GetHeight(GetPhaseMask(), x, y, z + 2.0f, true);
1830  if (new_z > INVALID_HEIGHT)
1831  z = new_z + 0.05f; // just to be sure that we are not a few pixel under the surface
1832 }
Map * GetMap() const
Definition: Object.h:543
float GetHeight(float x, float y, float z, bool checkVMap=true, float maxSearchDist=DEFAULT_HEIGHT_SEARCH) const
Definition: Map.cpp:2314
uint32 GetPhaseMask() const
Definition: Object.h:461
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
G3D::int16 x
Definition: Vector2int16.h:37
#define INVALID_HEIGHT
Definition: Map.h:248

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void WorldObject::UpdateObjectVisibility ( bool  forced = true)
virtual

Reimplemented in Unit.

3002 {
3003  //updates object's visibility for nearby players
3004  Trinity::VisibleChangesNotifier notifier(*this);
3006 }
void VisitNearbyWorldObject(float const &radius, NOTIFIER &notifier) const
Definition: Object.h:589
float GetVisibilityRange() const
Definition: Object.cpp:1912
Definition: GridNotifiers.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class NOTIFIER >
void WorldObject::VisitNearbyGridObject ( float const radius,
NOTIFIER &  notifier 
) const
inline
588 { if (IsInWorld()) GetMap()->VisitGrid(GetPositionX(), GetPositionY(), radius, notifier); }
Map * GetMap() const
Definition: Object.h:543
float GetPositionY() const
Definition: Position.h:105
bool IsInWorld() const
Definition: Object.h:100
void VisitGrid(const float &x, const float &y, float radius, NOTIFIER &notifier)
Definition: Map.h:867
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class NOTIFIER >
void WorldObject::VisitNearbyObject ( float const radius,
NOTIFIER &  notifier 
) const
inline
587 { if (IsInWorld()) GetMap()->VisitAll(GetPositionX(), GetPositionY(), radius, notifier); }
Map * GetMap() const
Definition: Object.h:543
float GetPositionY() const
Definition: Position.h:105
void VisitAll(const float &x, const float &y, float radius, NOTIFIER &notifier)
Definition: Map.h:826
bool IsInWorld() const
Definition: Object.h:100
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

template<class NOTIFIER >
void WorldObject::VisitNearbyWorldObject ( float const radius,
NOTIFIER &  notifier 
) const
inline
589 { if (IsInWorld()) GetMap()->VisitWorld(GetPositionX(), GetPositionY(), radius, notifier); }
Map * GetMap() const
Definition: Object.h:543
float GetPositionY() const
Definition: Position.h:105
void VisitWorld(const float &x, const float &y, float radius, NOTIFIER &notifier)
Definition: Map.h:856
bool IsInWorld() const
Definition: Object.h:100
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

Member Data Documentation

int32 WorldObject::_dbPhase
private
std::set<uint32> WorldObject::_phases
private
std::set<uint32> WorldObject::_terrainSwaps
private
std::set<uint32> WorldObject::_worldMapAreaSwaps
private
uint32 WorldObject::LastUsedScriptID
Map* WorldObject::m_currMap
private
uint16 WorldObject::m_executed_notifies
private
uint32 WorldObject::m_InstanceId
private
bool WorldObject::m_isActive
protected
const bool WorldObject::m_isWorldObject
protected
MovementInfo WorldObject::m_movementInfo
std::string WorldObject::m_name
protected
uint16 WorldObject::m_notifyflags
private
uint32 WorldObject::m_phaseMask
private
Transport* WorldObject::m_transport
protected
ZoneScript* WorldObject::m_zoneScript
protected

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