AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
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 self) 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 PlayRadiusSound (uint32 sound_id, float radius)
 
void PlayDirectMusic (uint32 music_id, Player *target=nullptr)
 
void PlayRadiusMusic (uint32 music_id, float radius)
 
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. More...
 
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
 
void RemoveAllowedLooter (ObjectGuid guid)
 
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)
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target)
 
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 &)
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
bool IsPlayer () const
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
bool IsCreature () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
bool IsUnit () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
bool IsGameObject () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
bool IsCorpse () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
bool IsDynamicObject () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsItem () 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

Aura_aura
 
Aura_removedAura
 
Unit_caster
 
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
 
ZoneScriptm_zoneScript
 
uint32 _zoneId
 
uint32 _areaId
 
float _floorZ
 
bool _outdoors
 
LiquidData _liquidData
 
bool _updatePositionData
 
Transportm_transport
 
- 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)
 
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)
27 : WorldObject(isWorldObject), MovableMapObject(),
28 _aura(nullptr), _removedAura(nullptr), _caster(nullptr), _duration(0), _isViewpoint(false), _updateViewerVisibilityTimer(0)
29{
32
34
36}
@ DYNAMICOBJECT_END
Definition: UpdateFields.h:415
@ UPDATEFLAG_POSITION
Definition: UpdateData.h:47
@ UPDATEFLAG_LOWGUID
Definition: UpdateData.h:43
@ UPDATEFLAG_STATIONARY_POSITION
Definition: UpdateData.h:45
@ TYPEID_DYNAMICOBJECT
Definition: ObjectGuid.h:38
@ TYPEMASK_DYNAMICOBJECT
Definition: ObjectGuid.h:52
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:240
uint16 m_valuesCount
Definition: Object.h:254
uint16 m_updateFlag
Definition: Object.h:243
TypeID m_objectTypeId
Definition: Object.h:242
MovableMapObject()=default
Definition: Object.h:405

References DYNAMICOBJECT_END, Object::m_objectType, Object::m_objectTypeId, Object::m_updateFlag, Object::m_valuesCount, TYPEID_DYNAMICOBJECT, TYPEMASK_DYNAMICOBJECT, UPDATEFLAG_LOWGUID, UPDATEFLAG_POSITION, and UPDATEFLAG_STATIONARY_POSITION.

◆ ~DynamicObject()

DynamicObject::~DynamicObject ( )
override
39{
40 // make sure all references were properly removed
41 ASSERT(!_aura);
44 delete _removedAura;
45}
#define ASSERT
Definition: Errors.h:68

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

Member Function Documentation

◆ AddToWorld()

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

Reimplemented from Object.

61{
63 if (!IsInWorld())
64 {
66
68
70 }
71}
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:133
Definition: DynamicObject.h:35
void BindToCaster()
Definition: DynamicObject.cpp:267
bool IsInWorld() const
Definition: Object.h:104
ObjectGuid GetGUID() const
Definition: Object.h:110
Map * GetMap() const
Definition: Object.h:531
void AddToWorld() override
Definition: Object.cpp:1176
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:517

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

◆ BindToCaster()

void DynamicObject::BindToCaster ( )
268{
269 ASSERT(!_caster);
272 ASSERT(_caster->GetMap() == GetMap());
274}
Unit * GetUnit(WorldObject const &, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:202
ObjectGuid GetCasterGUID() const
Definition: DynamicObject.h:59
void _RegisterDynObject(DynamicObject *dynObj)
Definition: Unit.cpp:6089

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

Referenced by AddToWorld().

◆ CleanupsBeforeDelete()

void DynamicObject::CleanupsBeforeDelete ( bool  finalCleanup = true)
overridevirtual

Reimplemented from WorldObject.

48{
49 if (Transport* transport = GetTransport())
50 {
51 transport->RemovePassenger(this);
52 SetTransport(nullptr);
55 }
56
58}
@ MOVEMENTFLAG_ONTRANSPORT
Definition: UnitDefines.h:353
void RemoveMovementFlag(uint32 flag)
Definition: Object.h:333
struct MovementInfo::TransportInfo transport
void Reset()
Definition: Object.h:287
void SetTransport(Transport *t)
Definition: Object.h:607
Transport * GetTransport() const
Definition: Object.h:599
MovementInfo m_movementInfo
Definition: Object.h:609
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 
)
100{
101 SetMap(caster->GetMap());
102 Relocate(pos);
103 if (!IsPositionValid())
104 {
105 LOG_ERROR("dyobject", "DynamicObject (spell {}) not created. Suggested coordinates isn't valid (X: {} Y: {})", spellId, GetPositionX(), GetPositionY());
106 return false;
107 }
108
109 WorldObject::_Create(guidlow, HighGuid::DynamicObject, caster->GetPhaseMask());
110
112
113 SetEntry(spellId);
116
117 // The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden
118 // by client for most of the "ground patch" visual effect spells and a few "skyfall" ones like Hurricane.
119 // If any other value is used, the client will _always_ use the radius provided in DYNAMICOBJECT_RADIUS, but
120 // precompensation is necessary (eg radius *= 2) for many spells. Anyway, blizz sends 0x0001 for all the spells
121 // I saw sniffed...
126
127 if (!GetMap()->AddToMap(this, true))
128 {
129 // Returning false will cause the object to be deleted - remove from transport
130 return false;
131 }
132
133 if (IsWorldObject())
134 {
135 setActive(true);
136 }
137
138 return true;
139}
#define LOG_ERROR(filterType__,...)
Definition: Log.h:156
@ DYNAMICOBJECT_RADIUS
Definition: UpdateFields.h:413
@ DYNAMICOBJECT_CASTTIME
Definition: UpdateFields.h:414
@ DYNAMICOBJECT_CASTER
Definition: UpdateFields.h:410
@ DYNAMICOBJECT_SPELLID
Definition: UpdateFields.h:412
@ DYNAMICOBJECT_BYTES
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:109
void SetEntry(uint32 entry)
Definition: Object.h:113
virtual void SetObjectScale(float scale)
Definition: Object.h:116
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:650
uint32 GetPhaseMask() const
Definition: Object.h:446
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:2105
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)
214{
215 SetDuration(GetDuration() - delaytime);
216}
void SetDuration(int32 newDuration)
Definition: DynamicObject.cpp:205
int32 GetDuration() const
Definition: DynamicObject.cpp:197

References GetDuration(), and SetDuration().

◆ GetCaster()

◆ GetCasterGUID()

ObjectGuid DynamicObject::GetCasterGUID ( ) const
inline

◆ GetDuration()

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

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

Referenced by Delay(), and Update().

◆ GetOldFarsightGUID()

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

References _oldFarsightGUID.

◆ GetRadius()

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

References DYNAMICOBJECT_RADIUS, and Object::GetFloatValue().

Referenced by DynObjAura::FillTargetMap().

◆ GetSpellId()

uint32 DynamicObject::GetSpellId ( ) const
inline
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
inline
61{ return _isViewpoint; }

References _isViewpoint.

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

◆ Remove()

void DynamicObject::Remove ( )
188{
189 if (IsInWorld())
190 {
194 }
195}
void RemoveFromWorld() override
Definition: DynamicObject.cpp:73
void AddObjectToRemoveList()
Definition: Object.cpp:2149
void SendObjectDeSpawnAnim(ObjectGuid guid)
Definition: Object.cpp:2098

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

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

◆ RemoveAura()

void DynamicObject::RemoveAura ( )
225{
228 _aura = nullptr;
229 if (!_removedAura->IsRemoved())
231}
@ AURA_REMOVE_BY_DEFAULT
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 ( )
252{
253 if (Player* caster = _caster->ToPlayer())
254 {
255 caster->SetViewpoint(this, false);
256 _isViewpoint = false;
257
258 // Restore prev farsight viewpoint
259 if (Unit* farsightObject = ObjectAccessor::GetUnit(*caster, _oldFarsightGUID))
260 {
261 caster->SetViewpoint(farsightObject, true);
262 }
264 }
265}
Player * ToPlayer()
Definition: Object.h:198
void Clear()
Definition: ObjectGuid.h:138
Definition: Player.h:1064
Definition: Unit.h:630

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

Referenced by RemoveFromWorld().

◆ RemoveFromWorld()

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

Reimplemented from Object.

74{
76 if (IsInWorld())
77 {
78 if (_isViewpoint)
80
81 if (_aura)
82 RemoveAura();
83
84 // dynobj could get removed in Aura::RemoveAura
85 if (!IsInWorld())
86 return;
87
89
90 if (Transport* transport = GetTransport())
91 transport->RemovePassenger(this, true);
92
94
96 }
97}
bool Remove(KEY_TYPE const &handle)
Definition: TypeContainer.h:139
void UnbindFromCaster()
Definition: DynamicObject.cpp:276
void RemoveCasterViewpoint()
Definition: DynamicObject.cpp:251
void RemoveAura()
Definition: DynamicObject.cpp:224
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)
219{
220 ASSERT(!_aura && aura);
221 _aura = aura;
222}

References _aura, and ASSERT.

Referenced by DynObjAura::DynObjAura().

◆ SetCasterViewpoint()

void DynamicObject::SetCasterViewpoint ( bool  updateViewerVisibility)
234{
235 if (Player* caster = _caster->ToPlayer())
236 {
237 // Remove old farsight viewpoint
238 if (Unit* farsightObject = ObjectAccessor::GetUnit(*caster, caster->GetGuidValue(PLAYER_FARSIGHT)))
239 {
240 _oldFarsightGUID = caster->GetGuidValue(PLAYER_FARSIGHT);
241 caster->SetViewpoint(farsightObject, false);
242 }
243
244 caster->SetViewpoint(this, true);
245 _isViewpoint = true;
246 }
247
248 _updateViewerVisibilityTimer = updateViewerVisibility ? 100 : 0;
249}
@ PLAYER_FARSIGHT
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)
206{
207 if (!_aura)
208 _duration = newDuration;
209 else
210 _aura->SetDuration(newDuration);
211}
void SetDuration(int32 duration, bool withMods=false)
Definition: SpellAuras.cpp:868

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

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

◆ UnbindFromCaster()

void DynamicObject::UnbindFromCaster ( )
277{
280 _caster = nullptr;
281}
void _UnregisterDynObject(DynamicObject *dynObj)
Definition: Unit.cpp:6094

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

Referenced by RemoveFromWorld().

◆ Update()

void DynamicObject::Update ( uint32  p_time)
overridevirtual

Reimplemented from WorldObject.

142{
143 // caster has to be always available and in the same map
145 ASSERT(_caster->GetMap() == GetMap());
146
147 bool expired = false;
148
149 if (_aura)
150 {
151 if (!_aura->IsRemoved())
152 _aura->UpdateOwner(p_time, this);
153
154 // _aura may be set to null in Aura::UpdateOwner call
155 if (_aura && (_aura->IsRemoved() || _aura->IsExpired()))
156 expired = true;
157 }
158 else
159 {
160 if (GetDuration() > int32(p_time))
161 _duration -= p_time;
162 else
163 expired = true;
164 }
165
166 if (expired)
167 Remove();
168 else
169 {
171 {
172 if (_updateViewerVisibilityTimer <= p_time)
173 {
175
176 if (Player* playerCaster = _caster->ToPlayer())
177 playerCaster->UpdateVisibilityForPlayer();
178 }
179 else
181 }
182
183 sScriptMgr->OnDynamicObjectUpdate(this, p_time);
184 }
185}
std::int32_t int32
Definition: Define.h:103
#define sScriptMgr
Definition: ScriptMgr.h:708
void Remove()
Definition: DynamicObject.cpp:187
void UpdateOwner(uint32 diff, WorldObject *owner)
Definition: SpellAuras.cpp:756
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
protected

◆ _caster

◆ _duration

int32 DynamicObject::_duration
protected

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

◆ _isViewpoint

bool DynamicObject::_isViewpoint
protected

◆ _oldFarsightGUID

ObjectGuid DynamicObject::_oldFarsightGUID
protected

◆ _removedAura

Aura* DynamicObject::_removedAura
protected

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

◆ _updateViewerVisibilityTimer

uint32 DynamicObject::_updateViewerVisibilityTimer
protected

Referenced by SetCasterViewpoint(), and Update().