AzerothCore 3.3.5a
OpenSource WoW Emulator
No Matches
DynamicObject Class Reference

#include "DynamicObject.h"

Inheritance diagram for DynamicObject:
WorldObject GridObject< DynamicObject > MovableMapObject Object WorldLocation Position

Public Member Functions

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

Protected Attributes

int32 _duration
bool _isViewpoint
uint32 _updateViewerVisibilityTimer
ObjectGuid _oldFarsightGUID
- Protected Attributes inherited from WorldObject
std::string m_name
bool m_isActive
bool m_isFarVisible
Optional< float > m_visibilityDistanceOverride
const bool m_isWorldObject
uint32 _zoneId
uint32 _areaId
float _floorZ
bool _outdoors
LiquidData _liquidData
bool _updatePositionData
- Protected Attributes inherited from Object
uint16 m_objectType
TypeID m_objectTypeId
uint16 m_updateFlag
union {
   int32 *   m_int32Values
   uint32 *   m_uint32Values
   float *   m_floatValues
UpdateMask _changesMask
uint16 m_valuesCount
uint16 _fieldNotifyFlags
bool m_objectUpdated

Additional Inherited Members

- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealth
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPESm_stealthDetect
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibility
FlaggedValuesArray32< int32, uint32, InvisibilityType, TOTAL_INVISIBILITY_TYPESm_invisibilityDetect
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibility
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPESm_serverSideVisibilityDetect
uint32 LastUsedScriptID
MovementInfo m_movementInfo
ElunaEventProcessor * elunaEvents
- Public Attributes inherited from Object
DataMap CustomData
- Public Attributes inherited from WorldLocation
uint32 m_mapId
- Public Attributes inherited from Position
float m_positionX = 0
float m_positionY = 0
float m_positionZ = 0
float m_orientation = 0
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
virtual void ProcessPositionDataChanged (PositionFullTerrainStatus const &data)
void SetLocationMapId (uint32 _mapId)
void SetLocationInstanceId (uint32 _instanceId)
virtual bool IsNeverVisible () const
virtual bool IsAlwaysVisibleFor (WorldObject const *) const
virtual bool IsInvisibleDueToDespawn () const
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
- Protected Member Functions inherited from Object
 Object ()
void _InitValues ()
void _Create (ObjectGuid::LowType guidlow, uint32 entry, HighGuid guidhigh)
std::string _ConcatFields (uint16 startIndex, uint16 size) const
bool _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
void BuildMovementUpdate (ByteBuffer *data, uint16 flags) const
virtual void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
virtual void AddToObjectUpdate ()=0
virtual void RemoveFromObjectUpdate ()=0
void AddToObjectUpdateIfNeeded ()
- Protected Member Functions inherited from MovableMapObject
 MovableMapObject ()=default

Detailed Description

Constructor & Destructor Documentation

◆ DynamicObject()

DynamicObject::DynamicObject ( bool  isWorldObject)
29 : WorldObject(isWorldObject), MovableMapObject(),
30 _aura(nullptr), _removedAura(nullptr), _caster(nullptr), _duration(0), _isViewpoint(false), _updateViewerVisibilityTimer(0)
Definition: ObjectGuid.h:40
Definition: ObjectGuid.h:54
Definition: UpdateData.h:47
Definition: UpdateData.h:43
Definition: UpdateData.h:45
Definition: UpdateFields.h:415
Unit * _caster
Definition: DynamicObject.h:68
int32 _duration
Definition: DynamicObject.h:69
Aura * _removedAura
Definition: DynamicObject.h:67
bool _isViewpoint
Definition: DynamicObject.h:70
Aura * _aura
Definition: DynamicObject.h:66
uint32 _updateViewerVisibilityTimer
Definition: DynamicObject.h:71
uint16 m_objectType
Definition: Object.h:228
uint16 m_valuesCount
Definition: Object.h:242
uint16 m_updateFlag
Definition: Object.h:231
TypeID m_objectTypeId
Definition: Object.h:230
Definition: Object.h:393


◆ ~DynamicObject()

DynamicObject::~DynamicObject ( )
42 // make sure all references were properly removed
43 ASSERT(!_aura);
46 delete _removedAura;
#define ASSERT
Definition: Errors.h:68

References _aura, _caster, _isViewpoint, _removedAura, and ASSERT.

Member Function Documentation

◆ AddToWorld()

void DynamicObject::AddToWorld ( )
  • Register the dynamicObject for guid lookup and for caster

Reimplemented from Object.

65 if (!IsInWorld())
66 {
72 }
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:135
Definition: DynamicObject.h:35
void BindToCaster()
Definition: DynamicObject.cpp:269
bool IsInWorld() const
Definition: Object.h:101
ObjectGuid GetGUID() const
Definition: Object.h:107
Map * GetMap() const
Definition: Object.h:517
void AddToWorld() override
Definition: Object.cpp:1176
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:515

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

◆ BindToCaster()

void DynamicObject::BindToCaster ( )
271 ASSERT(!_caster);
274 ASSERT(_caster->GetMap() == GetMap());
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:204
ObjectGuid GetCasterGUID() const
Definition: DynamicObject.h:59
void _RegisterDynObject(DynamicObject *dynObj)
Definition: Unit.cpp:6030

References _caster, Unit::_RegisterDynObject(), ASSERT, GetCasterGUID(), WorldObject::GetMap(), and ObjectAccessor::GetUnit().

Referenced by AddToWorld().

◆ CleanupsBeforeDelete()

void DynamicObject::CleanupsBeforeDelete ( bool  finalCleanup = true)

Reimplemented from WorldObject.

51 if (Transport* transport = GetTransport())
52 {
53 transport->RemovePassenger(this);
54 SetTransport(nullptr);
57 }
Definition: Unit.h:561
void RemoveMovementFlag(uint32 flag)
Definition: Object.h:321
struct MovementInfo::TransportInfo transport
void Reset()
Definition: Object.h:275
void SetTransport(Transport *t)
Definition: Object.h:593
Transport * GetTransport() const
Definition: Object.h:585
MovementInfo m_movementInfo
Definition: Object.h:595
virtual void CleanupsBeforeDelete(bool finalCleanup=true)
Definition: Object.cpp:1133
Definition: Transport.h:29

References WorldObject::CleanupsBeforeDelete(), WorldObject::GetTransport(), WorldObject::m_movementInfo, MOVEMENTFLAG_ONTRANSPORT, MovementInfo::RemoveMovementFlag(), MovementInfo::TransportInfo::Reset(), WorldObject::SetTransport(), and MovementInfo::transport.

◆ CreateDynamicObject()

bool DynamicObject::CreateDynamicObject ( ObjectGuid::LowType  guidlow,
Unit caster,
uint32  spellId,
Position const &  pos,
float  radius,
DynamicObjectType  type 
103 SetMap(caster->GetMap());
104 Relocate(pos);
105 if (!IsPositionValid())
106 {
107 LOG_ERROR("dyobject", "DynamicObject (spell {}) not created. Suggested coordinates isn't valid (X: {} Y: {})", spellId, GetPositionX(), GetPositionY());
108 return false;
109 }
111 WorldObject::_Create(guidlow, HighGuid::DynamicObject, caster->GetPhaseMask());
115 SetEntry(spellId);
119 // The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden
120 // by client for most of the "ground patch" visual effect spells and a few "skyfall" ones like Hurricane.
121 // If any other value is used, the client will _always_ use the radius provided in DYNAMICOBJECT_RADIUS, but
122 // precompensation is necessary (eg radius *= 2) for many spells. Anyway, blizz sends 0x0001 for all the spells
123 // I saw sniffed...
129 if (!GetMap()->AddToMap(this, true))
130 {
131 // Returning false will cause the object to be deleted - remove from transport
132 return false;
133 }
135 if (IsWorldObject())
136 {
137 setActive(true);
138 }
140 return true;
#define LOG_ERROR(filterType__,...)
Definition: Log.h:159
Definition: UpdateFields.h:413
Definition: UpdateFields.h:414
Definition: UpdateFields.h:410
Definition: UpdateFields.h:412
Definition: UpdateFields.h:411
Milliseconds GetGameTimeMS()
Definition: GameTime.cpp:43
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:750
void SetGuidValue(uint16 index, ObjectGuid value)
Definition: Object.cpp:723
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:737
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
void SetEntry(uint32 entry)
Definition: Object.h:110
virtual void SetObjectScale(float scale)
Definition: Object.h:113
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
uint32 GetPhaseMask() const
Definition: Object.h:434
bool IsWorldObject() const
Definition: Object.cpp:1074
void _Create(ObjectGuid::LowType guidlow, HighGuid guidhigh, uint32 phaseMask)
Definition: Object.cpp:1139
void setActive(bool isActiveObject)
Definition: Object.cpp:1085
virtual void SetMap(Map *map)
Definition: Object.cpp:2071
void UpdatePositionData()
Definition: Object.cpp:1154
bool IsPositionValid() const
Definition: Position.cpp:175
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
void Relocate(float x, float y)
Definition: Position.h:73

References WorldObject::_Create(), DYNAMICOBJECT_BYTES, DYNAMICOBJECT_CASTER, DYNAMICOBJECT_CASTTIME, DYNAMICOBJECT_RADIUS, DYNAMICOBJECT_SPELLID, GameTime::GetGameTimeMS(), Object::GetGUID(), WorldObject::GetMap(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), Position::IsPositionValid(), WorldObject::IsWorldObject(), LOG_ERROR, Position::Relocate(), WorldObject::setActive(), Object::SetByteValue(), Object::SetEntry(), Object::SetFloatValue(), Object::SetGuidValue(), WorldObject::SetMap(), Object::SetObjectScale(), Object::SetUInt32Value(), and WorldObject::UpdatePositionData().

Referenced by Spell::EffectAddFarsight(), and Spell::EffectPersistentAA().

◆ Delay()

void DynamicObject::Delay ( int32  delaytime)
217 SetDuration(GetDuration() - delaytime);
void SetDuration(int32 newDuration)
Definition: DynamicObject.cpp:207
int32 GetDuration() const
Definition: DynamicObject.cpp:199

References GetDuration(), and SetDuration().

◆ GetCaster()

◆ GetCasterGUID()

ObjectGuid DynamicObject::GetCasterGUID ( ) const

◆ GetDuration()

int32 DynamicObject::GetDuration ( ) const
201 if (!_aura)
202 return _duration;
203 else
204 return _aura->GetDuration();
int32 GetDuration() const
Definition: SpellAuras.h:133

References _aura, _duration, and Aura::GetDuration().

Referenced by Delay(), and Update().

◆ GetOldFarsightGUID()

ObjectGuid const & DynamicObject::GetOldFarsightGUID ( ) const
63{ return _oldFarsightGUID; }
ObjectGuid _oldFarsightGUID
Definition: DynamicObject.h:72

References _oldFarsightGUID.

◆ GetRadius()

float DynamicObject::GetRadius ( ) const
float GetFloatValue(uint16 index) const
Definition: Object.cpp:317

References DYNAMICOBJECT_RADIUS, and Object::GetFloatValue().

Referenced by DynObjAura::FillTargetMap().

◆ GetSpellId()

uint32 DynamicObject::GetSpellId ( ) const
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:305

References DYNAMICOBJECT_SPELLID, and Object::GetUInt32Value().

Referenced by MotionTransport::DelayedTeleportTransport(), Unit::GetDynObject(), and Unit::RemoveDynObject().

◆ IsViewpoint()

bool DynamicObject::IsViewpoint ( ) const
61{ return _isViewpoint; }

References _isViewpoint.

Referenced by Acore::MessageDistDeliverer::Visit().

◆ Remove()

void DynamicObject::Remove ( )
191 if (IsInWorld())
192 {
196 }
void RemoveFromWorld() override
Definition: DynamicObject.cpp:75
void AddObjectToRemoveList()
Definition: Object.cpp:2115
void SendObjectDeSpawnAnim(ObjectGuid guid)
Definition: Object.cpp:2064

References WorldObject::AddObjectToRemoveList(), Object::GetGUID(), Object::IsInWorld(), RemoveFromWorld(), and WorldObject::SendObjectDeSpawnAnim().

Referenced by Unit::RemoveDynObject(), and Update().

◆ RemoveAura()

void DynamicObject::RemoveAura ( )
230 _aura = nullptr;
231 if (!_removedAura->IsRemoved())
Definition: SpellAuraDefines.h:392
bool IsRemoved() const
Definition: SpellAuras.h:161
void _Remove(AuraRemoveMode removeMode)
Definition: SpellAuras.cpp:574

References _aura, Aura::_Remove(), _removedAura, ASSERT, AURA_REMOVE_BY_DEFAULT, and Aura::IsRemoved().

Referenced by RemoveFromWorld().

◆ RemoveCasterViewpoint()

void DynamicObject::RemoveCasterViewpoint ( )
255 if (Player* caster = _caster->ToPlayer())
256 {
257 caster->SetViewpoint(this, false);
258 _isViewpoint = false;
260 // Restore prev farsight viewpoint
261 if (Unit* farsightObject = ObjectAccessor::GetUnit(*caster, _oldFarsightGUID))
262 {
263 caster->SetViewpoint(farsightObject, true);
264 }
266 }
Player * ToPlayer()
Definition: Object.h:195
void Clear()
Definition: ObjectGuid.h:140
Definition: Player.h:1046
Definition: Unit.h:1290

References _caster, _isViewpoint, _oldFarsightGUID, ObjectGuid::Clear(), ObjectAccessor::GetUnit(), and Object::ToPlayer().

Referenced by RemoveFromWorld().

◆ RemoveFromWorld()

void DynamicObject::RemoveFromWorld ( )
  • Remove the dynamicObject from the accessor and from all lists of objects in world

Reimplemented from Object.

78 if (IsInWorld())
79 {
80 if (_isViewpoint)
83 if (_aura)
84 RemoveAura();
86 // dynobj could get removed in Aura::RemoveAura
87 if (!IsInWorld())
88 return;
92 if (Transport* transport = GetTransport())
93 transport->RemovePassenger(this, true);
98 }
bool Remove(KEY_TYPE const &handle)
Definition: TypeContainer.h:141
void UnbindFromCaster()
Definition: DynamicObject.cpp:278
void RemoveCasterViewpoint()
Definition: DynamicObject.cpp:253
void RemoveAura()
Definition: DynamicObject.cpp:226
void RemoveFromWorld() override
Definition: Object.cpp:1182

References _aura, _isViewpoint, Object::GetGUID(), WorldObject::GetMap(), Map::GetObjectsStore(), WorldObject::GetTransport(), Object::IsInWorld(), TypeUnorderedMapContainer< OBJECT_TYPES, KEY_TYPE >::Remove(), RemoveAura(), RemoveCasterViewpoint(), WorldObject::RemoveFromWorld(), and UnbindFromCaster().

Referenced by Remove().

◆ SetAura()

void DynamicObject::SetAura ( Aura aura)
222 ASSERT(!_aura && aura);
223 _aura = aura;

References _aura, and ASSERT.

Referenced by DynObjAura::DynObjAura().

◆ SetCasterViewpoint()

void DynamicObject::SetCasterViewpoint ( bool  updateViewerVisibility)
237 if (Player* caster = _caster->ToPlayer())
238 {
239 // Remove old farsight viewpoint
240 if (Unit* farsightObject = ObjectAccessor::GetUnit(*caster, caster->GetGuidValue(PLAYER_FARSIGHT)))
241 {
242 _oldFarsightGUID = caster->GetGuidValue(PLAYER_FARSIGHT);
243 caster->SetViewpoint(farsightObject, false);
244 }
246 caster->SetViewpoint(this, true);
247 _isViewpoint = true;
248 }
250 _updateViewerVisibilityTimer = updateViewerVisibility ? 100 : 0;
Definition: UpdateFields.h:334

References _caster, _isViewpoint, _oldFarsightGUID, _updateViewerVisibilityTimer, ObjectAccessor::GetUnit(), PLAYER_FARSIGHT, and Object::ToPlayer().

Referenced by Spell::EffectAddFarsight().

◆ SetDuration()

void DynamicObject::SetDuration ( int32  newDuration)
209 if (!_aura)
210 _duration = newDuration;
211 else
212 _aura->SetDuration(newDuration);
void SetDuration(int32 duration, bool withMods=false)
Definition: SpellAuras.cpp:882

References _aura, _duration, and Aura::SetDuration().

Referenced by Delay(), and Spell::EffectAddFarsight().

◆ UnbindFromCaster()

void DynamicObject::UnbindFromCaster ( )
282 _caster = nullptr;
void _UnregisterDynObject(DynamicObject *dynObj)
Definition: Unit.cpp:6035

References _caster, Unit::_UnregisterDynObject(), and ASSERT.

Referenced by RemoveFromWorld().

◆ Update()

void DynamicObject::Update ( uint32  p_time)

Reimplemented from WorldObject.

145 // caster has to be always available and in the same map
147 ASSERT(_caster->GetMap() == GetMap());
149 bool expired = false;
151 if (_aura)
152 {
153 if (!_aura->IsRemoved())
154 _aura->UpdateOwner(p_time, this);
156 // _aura may be set to null in Aura::UpdateOwner call
157 if (_aura && (_aura->IsRemoved() || _aura->IsExpired()))
158 expired = true;
159 }
160 else
161 {
162 if (GetDuration() > int32(p_time))
163 _duration -= p_time;
164 else
165 expired = true;
166 }
168 if (expired)
169 Remove();
170 else
171 {
173 {
174 if (_updateViewerVisibilityTimer <= p_time)
175 {
178 if (Player* playerCaster = _caster->ToPlayer())
179 playerCaster->UpdateVisibilityForPlayer();
180 }
181 else
183 }
185 sScriptMgr->OnDynamicObjectUpdate(this, p_time);
186 }
std::int32_t int32
Definition: Define.h:104
#define sScriptMgr
Definition: ScriptMgr.h:2702
void Remove()
Definition: DynamicObject.cpp:189
void UpdateOwner(uint32 diff, WorldObject *owner)
Definition: SpellAuras.cpp:770
bool IsExpired() const
Definition: SpellAuras.h:138

References _aura, _caster, _duration, _updateViewerVisibilityTimer, ASSERT, GetDuration(), WorldObject::GetMap(), Aura::IsExpired(), Aura::IsRemoved(), Remove(), sScriptMgr, Object::ToPlayer(), and Aura::UpdateOwner().

Member Data Documentation

◆ _aura

Aura* DynamicObject::_aura

◆ _caster

◆ _duration

int32 DynamicObject::_duration

Referenced by GetDuration(), SetDuration(), and Update().

◆ _isViewpoint

bool DynamicObject::_isViewpoint

◆ _oldFarsightGUID

ObjectGuid DynamicObject::_oldFarsightGUID

◆ _removedAura

Aura* DynamicObject::_removedAura

Referenced by RemoveAura(), and ~DynamicObject().

◆ _updateViewerVisibilityTimer

uint32 DynamicObject::_updateViewerVisibilityTimer

Referenced by SetCasterViewpoint(), and Update().