TrinityCore
DynamicObject Class Reference

#include <DynamicObject.h>

Classes

struct  ValuesUpdateForPlayerWithMaskSender
 

Public Member Functions

 DynamicObject (bool isWorldObject)
 
 ~DynamicObject ()
 
void BuildValuesUpdateForPlayerWithMask (UpdateData *data, UF::ObjectData::Mask const &requestedObjectMask, UF::DynamicObjectData::Mask const &requestedDynamicObjectMask, Player const *target) const
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
bool CreateDynamicObject (ObjectGuid::LowType guidlow, Unit *caster, SpellInfo const *spell, Position const &pos, float radius, DynamicObjectType type, SpellCastVisual spellVisual)
 
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 ()
 
void RemoveCasterViewpoint ()
 
UnitGetCaster () const
 
uint32 GetFaction () const override
 
void BindToCaster ()
 
void UnbindFromCaster ()
 
uint32 GetSpellId () const
 
SpellInfo const * GetSpellInfo () const
 
ObjectGuid GetCasterGUID () const
 
ObjectGuid GetOwnerGUID () const override
 
float GetRadius () const
 
- Public Member Functions inherited from WorldObject
virtual ~WorldObject ()
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
void GetNearPoint2D (WorldObject const *searcher, float &x, float &y, float distance, float absAngle) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float distance2d, float absAngle) const
 
void GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float relAngle=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
 
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 (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
 
bool IsInPhase (WorldObject const *obj) const
 
PhaseShiftGetPhaseShift ()
 
PhaseShift const & GetPhaseShift () const
 
PhaseShiftGetSuppressedPhaseShift ()
 
PhaseShift const & GetSuppressedPhaseShift () const
 
int32 GetDBPhase () const
 
void SetDBPhase (int32 p)
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
bool IsInWorldPvpZone () const
 
bool IsOutdoors () const
 
ZLiquidStatus GetLiquidStatus () const
 
InstanceScriptGetInstanceScript () const
 
std::string const & GetName () const
 
void SetName (std::string newname)
 
std::string GetNameForLocaleIdx (LocaleConstant) const override
 
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, bool incOwnRadius=true, bool incTargetRadius=true) const
 
bool IsWithinLOS (float x, float y, float z, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
 
bool IsWithinLOSInMap (WorldObject const *obj, LineOfSightChecks checks=LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags=VMAP::ModelIgnoreFlags::Nothing) const
 
Position GetHitSpherePointFor (Position const &dest) const
 
void GetHitSpherePointFor (Position const &dest, float &x, float &y, float &z) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=float(M_PI)) const
 
bool isInBack (WorldObject const *target, float arc=float(M_PI)) const
 
bool IsInBetween (Position const &pos1, Position const &pos2, float size=0) 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
 
void SendCombatLogMessage (WorldPackets::CombatLog::CombatLogServerPacket *combatLog) const
 
virtual uint8 GetLevelForTarget (WorldObject const *) const
 
void PlayDistanceSound (uint32 soundId, Player *target=nullptr)
 
void PlayDirectSound (uint32 soundId, Player *target=nullptr, uint32 broadcastTextId=0)
 
void PlayDirectMusic (uint32 musicId, Player *target=nullptr)
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (WorldObject const *target=nullptr) 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
 
void SetZoneScript ()
 
ZoneScriptFindZoneScript () const
 
ZoneScriptGetZoneScript () const
 
ScenarioGetScenario () const
 
TempSummonSummonCreature (uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
 
TempSummonSummonCreature (uint32 entry, float x, float y, float z, float o=0, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
 
TempSummonSummonPersonalClone (Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, Player *privateObjectOwner=nullptr)
 
GameObjectSummonGameObject (uint32 entry, Position const &pos, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, QuaternionData const &rot, Seconds respawnTime, GOSummonType summonType=GO_SUMMON_TIMED_OR_CORPSE_DESPAWN)
 
CreatureSummonTrigger (float x, float y, float z, float ang, Milliseconds despawnTime, 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 spawnedOnly=true) const
 
GameObjectFindNearestUnspawnedGameObject (uint32 entry, float range) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
PlayerSelectNearestPlayer (float distance) const
 
virtual ObjectGuid GetCharmerOrOwnerGUID () const
 
ObjectGuid GetCharmerOrOwnerOrOwnGUID () const
 
UnitGetOwner () const
 
UnitGetCharmerOrOwner () const
 
UnitGetCharmerOrOwnerOrSelf () const
 
PlayerGetCharmerOrOwnerPlayerOrPlayerItself () const
 
PlayerGetAffectingPlayer () const
 
PlayerGetSpellModOwner () const
 
int32 CalculateSpellDamage (Unit const *target, SpellEffectInfo const &spellEffectInfo, int32 const *basePoints=nullptr, float *variance=nullptr, uint32 castItemId=0, int32 itemLevel=-1) const
 
float GetSpellMaxRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float GetSpellMinRangeForTarget (Unit const *target, SpellInfo const *spellInfo) const
 
float ApplyEffectModifiers (SpellInfo const *spellInfo, uint8 effIndex, float value) const
 
int32 CalcSpellDuration (SpellInfo const *spellInfo) const
 
int32 ModSpellDuration (SpellInfo const *spellInfo, WorldObject const *target, int32 duration, bool positive, uint32 effectMask) const
 
void ModSpellCastTime (SpellInfo const *spellInfo, int32 &castTime, Spell *spell=nullptr) const
 
void ModSpellDurationTime (SpellInfo const *spellInfo, int32 &durationTime, Spell *spell=nullptr) const
 
virtual float MeleeSpellMissChance (Unit const *victim, WeaponAttackType attType, SpellInfo const *spellInfo) const
 
virtual SpellMissInfo MeleeSpellHitResult (Unit *victim, SpellInfo const *spellInfo) const
 
SpellMissInfo MagicSpellHitResult (Unit *victim, SpellInfo const *spellInfo) const
 
SpellMissInfo SpellHitResult (Unit *victim, SpellInfo const *spellInfo, bool canReflect=false) const
 
void SendSpellMiss (Unit *target, uint32 spellID, SpellMissInfo missInfo)
 
virtual void SetFaction (uint32)
 
FactionTemplateEntry const * GetFactionTemplateEntry () const
 
ReputationRank GetReactionTo (WorldObject const *target) const
 
bool IsHostileTo (WorldObject const *target) const
 
bool IsHostileToPlayers () const
 
bool IsFriendlyTo (WorldObject const *target) const
 
bool IsNeutralToAll () const
 
SpellCastResult CastSpell (CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
 
void SendPlayOrphanSpellVisual (ObjectGuid const &target, uint32 spellVisualId, float travelSpeed, bool speedAsTime=false, bool withSourceOrientation=false)
 
void SendPlayOrphanSpellVisual (Position const &targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime=false, bool withSourceOrientation=false)
 
void SendCancelOrphanSpellVisual (uint32 id)
 
void SendPlaySpellVisual (WorldObject *target, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime=false)
 
void SendPlaySpellVisual (Position const &targetPosition, float o, uint32 spellVisualId, uint16 missReason, uint16 reflectStatus, float travelSpeed, bool speedAsTime=false)
 
void SendCancelSpellVisual (uint32 id)
 
void SendPlaySpellVisualKit (uint32 id, uint32 type, uint32 duration) const
 
void SendCancelSpellVisualKit (uint32 id)
 
bool IsValidAttackTarget (WorldObject const *target, SpellInfo const *bySpell=nullptr) const
 
bool IsValidAssistTarget (WorldObject const *target, SpellInfo const *bySpell=nullptr) const
 
UnitGetMagicHitRedirectTarget (Unit *victim, SpellInfo const *spellInfo)
 
virtual uint32 GetCastSpellXSpellVisualId (SpellInfo const *spellInfo) const
 
template<typename Container >
void GetGameObjectListWithEntryInGrid (Container &gameObjectContainer, uint32 entry, float maxSearchRange=250.0f) const
 
template<typename Container >
void GetCreatureListWithEntryInGrid (Container &creatureContainer, uint32 entry, float maxSearchRange=250.0f) const
 
template<typename Container >
void GetPlayerListInGrid (Container &playerContainer, float maxSearchRange, bool alive=true) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true)
 
virtual void UpdateObjectVisibilityOnCreate ()
 
virtual void UpdateObjectVisibilityOnDestroy ()
 
void UpdatePositionData ()
 
void BuildUpdate (UpdateDataMapType &) override
 
bool AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
bool IsFarVisible () const
 
void SetFarVisible (bool on)
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
TransportBaseGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
Position const & GetTransOffset () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
virtual ObjectGuid GetTransGUID () const
 
void SetTransport (TransportBase *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
float GetFloorZ () const
 
virtual float GetCollisionHeight () 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
 
std::string GetDebugInfo () const override
 
virtual uint16 GetAIAnimKitId () const
 
virtual uint16 GetMovementAnimKitId () const
 
virtual uint16 GetMeleeAnimKitId () const
 
bool IsPrivateObject () const
 
ObjectGuid GetPrivateObjectOwner () const
 
void SetPrivateObjectOwner (ObjectGuid const &owner)
 
bool CheckPrivateObjectOwnerVisibility (WorldObject const *seer) const
 
SmoothPhasingGetOrCreateSmoothPhasing ()
 
SmoothPhasingGetSmoothPhasing ()
 
SmoothPhasing const * GetSmoothPhasing () const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid const & GetGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
uint32 GetDynamicFlags () const
 
bool HasDynamicFlag (uint32 flag) const
 
void SetDynamicFlag (uint32 flag)
 
void RemoveDynamicFlag (uint32 flag)
 
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 const *target) const
 
void BuildValuesUpdateBlockForPlayerWithFlag (UpdateData *data, UF::UpdateFieldFlag flags, Player const *target) const
 
void BuildDestroyUpdateBlock (UpdateData *data) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
ByteBuffer PrepareValuesUpdateBuffer () const
 
virtual void DestroyForPlayer (Player *target) const
 
void SendOutOfRangeForPlayer (Player *target) const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void SetIsNewObject (bool enable)
 
bool IsDestroyedObject () const
 
void SetDestroyedObject (bool destroyed)
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
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 IsDynObject () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
bool IsAreaTrigger () const
 
AreaTriggerToAreaTrigger ()
 
AreaTrigger const * ToAreaTrigger () const
 
bool IsSceneObject () const
 
SceneObjectToSceneObject ()
 
SceneObject const * ToSceneObject () const
 
bool IsConversation () const
 
ConversationToConversation ()
 
Conversation const * ToConversation () const
 
template<typename T >
void ForceUpdateFieldChange (UF::UpdateFieldSetter< T > const &)
 
virtual void BuildValuesUpdateWithFlag (ByteBuffer *data, UF::UpdateFieldFlag flags, Player const *target) 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 (WorldLocation const &loc)
 
void WorldRelocate (WorldLocation const *loc)
 
void WorldRelocate (uint32 mapId, Position const &pos)
 
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
 
std::string GetDebugInfo () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
bool operator== (Position const &a) const
 
bool operator!= (Position const &a) const
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float o)
 
void Relocate (Position const &pos)
 
void Relocate (Position const *pos)
 
void RelocateOffset (Position const &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Streamer< XY > PositionXYStream ()
 
ConstStreamer< XY > PositionXYStream () const
 
Streamer< XYZ > PositionXYZStream ()
 
ConstStreamer< XYZ > PositionXYZStream () const
 
Streamer< XYZO > PositionXYZOStream ()
 
ConstStreamer< XYZO > PositionXYZOStream () const
 
Streamer< PackedXYZ > PositionPackedXYZStream ()
 
ConstStreamer< PackedXYZ > PositionPackedXYZStream () const
 
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 (Position const &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAbsoluteAngle (float x, float y) const
 
float GetAbsoluteAngle (Position const &pos) const
 
float GetAbsoluteAngle (Position const *pos) const
 
float ToAbsoluteAngle (float relAngle) const
 
float ToRelativeAngle (float absAngle) const
 
float GetRelativeAngle (float x, float y) const
 
float GetRelativeAngle (Position const &pos) const
 
float GetRelativeAngle (Position const *pos) 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 IsInDist (Position const *pos, float dist) const
 
bool IsWithinBox (Position const &center, float xradius, float yradius, float zradius) const
 
bool IsWithinDoubleVerticalCylinder (Position const *center, float radius, float height) const
 
bool HasInArc (float arcangle, Position const *pos, float border=2.0f) const
 
bool HasInLine (Position const *pos, float objSize, float width) const
 
std::string ToString () const
 
- Public Member Functions inherited from GridObject< DynamicObject >
virtual ~GridObject ()
 
bool IsInGrid () const
 
void AddToGrid (GridRefManager< DynamicObject > &m)
 
void RemoveFromGrid ()
 

Public Attributes

UF::UpdateField< UF::DynamicObjectData, 0, TYPEID_DYNAMICOBJECTm_dynamicObjectData
 
- 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
 
EventProcessor m_Events
 
- Public Attributes inherited from Object
UF::UpdateFieldHolder m_values
 
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECTm_objectData
 
- 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

void BuildValuesCreate (ByteBuffer *data, Player const *target) const override
 
void BuildValuesUpdate (ByteBuffer *data, Player const *target) const override
 
void ClearUpdateMask (bool remove) override
 
- 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 CanNeverSee (WorldObject const *obj) const
 
virtual bool IsNeverVisibleFor (WorldObject const *) 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 _Create (ObjectGuid const &guid)
 
template<typename T >
void SetUpdateFieldValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
 
template<typename T >
void SetUpdateFieldFlagValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
 
template<typename T >
void RemoveUpdateFieldFlagValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
 
template<typename T >
UF::DynamicUpdateFieldSetter< T >::insert_result AddDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter)
 
template<typename T >
UF::DynamicUpdateFieldSetter< T >::insert_result InsertDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter, uint32 index)
 
template<typename T >
void RemoveDynamicUpdateFieldValue (UF::DynamicUpdateFieldSetter< T > setter, uint32 index)
 
template<typename T >
void ClearDynamicUpdateFieldValues (UF::DynamicUpdateFieldSetter< T > setter)
 
template<typename T >
void RemoveOptionalUpdateFieldValue (UF::OptionalUpdateFieldSetter< T > setter)
 
template<typename T >
void SetUpdateFieldStatValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
 
template<typename T >
void ApplyModUpdateFieldValue (UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type mod, bool apply)
 
template<typename T >
void ApplyPercentModUpdateFieldValue (UF::UpdateFieldSetter< T > setter, float percent, bool apply)
 
template<typename Action >
void DoWithSuppressingObjectUpdates (Action &&action)
 
void BuildMovementUpdate (ByteBuffer *data, CreateObjectBits flags, Player *target) const
 
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor (Player const *target) const
 
void AddToObjectUpdateIfNeeded ()
 
- Protected Member Functions inherited from MapObject
 MapObject ()
 

Protected Attributes

Aura_aura
 
Aura_removedAura
 
Unit_caster
 
int32 _duration
 
bool _isViewpoint
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
bool m_isFarVisible
 
Optional< float > m_visibilityDistanceOverride
 
bool const m_isWorldObject
 
ZoneScriptm_zoneScript
 
TransportBasem_transport
 
uint32 m_zoneId
 
uint32 m_areaId
 
float m_staticFloorZ
 
bool m_outdoors
 
ZLiquidStatus m_liquidStatus
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
CreateObjectBits m_updateFlag
 
bool m_objectUpdated
 

Additional Inherited Members

- Static Public Member Functions inherited from WorldObject
static bool InSamePhase (WorldObject const *a, WorldObject const *b)
 
static ReputationRank GetFactionReactionTo (FactionTemplateEntry const *factionTemplateEntry, WorldObject const *target)
 
- Static Public Member Functions inherited from Object
static ObjectGuid GetGUID (Object const *o)
 
static PlayerToPlayer (Object *o)
 
static Player const * ToPlayer (Object const *o)
 
static CreatureToCreature (Object *o)
 
static Creature const * ToCreature (Object const *o)
 
static UnitToUnit (Object *o)
 
static Unit const * ToUnit (Object const *o)
 
static GameObjectToGameObject (Object *o)
 
static GameObject const * ToGameObject (Object const *o)
 
static CorpseToCorpse (Object *o)
 
static Corpse const * ToCorpse (Object const *o)
 
static DynamicObjectToDynObject (Object *o)
 
static DynamicObject const * ToDynObject (Object const *o)
 
static AreaTriggerToAreaTrigger (Object *o)
 
static AreaTrigger const * ToAreaTrigger (Object const *o)
 
static SceneObjectToSceneObject (Object *o)
 
static SceneObject const * ToSceneObject (Object const *o)
 
static ConversationToConversation (Object *o)
 
static Conversation const * ToConversation (Object const *o)
 
- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 

Constructor & Destructor Documentation

◆ DynamicObject()

DynamicObject::DynamicObject ( bool  isWorldObject)
34  : WorldObject(isWorldObject),
35  _aura(nullptr), _removedAura(nullptr), _caster(nullptr), _duration(0), _isViewpoint(false)
36 {
39 
40  m_updateFlag.Stationary = true;
41 }
Unit * _caster
Definition: DynamicObject.h:90
Aura * _removedAura
Definition: DynamicObject.h:89
CreateObjectBits m_updateFlag
Definition: Object.h:385
Aura * _aura
Definition: DynamicObject.h:88
uint16 m_objectType
Definition: Object.h:382
TypeID m_objectTypeId
Definition: Object.h:384
bool _isViewpoint
Definition: DynamicObject.h:92
WorldObject(bool isWorldObject)
Definition: Object.cpp:824
Definition: ObjectGuid.h:43
bool Stationary
Definition: Object.h:85
int32 _duration
Definition: DynamicObject.h:91
Definition: ObjectGuid.h:63

◆ ~DynamicObject()

DynamicObject::~DynamicObject ( )
44 {
45  // make sure all references were properly removed
46  ASSERT(!_aura);
47  ASSERT(!_caster);
49  delete _removedAura;
50 }
Unit * _caster
Definition: DynamicObject.h:90
Aura * _removedAura
Definition: DynamicObject.h:89
Aura * _aura
Definition: DynamicObject.h:88
bool _isViewpoint
Definition: DynamicObject.h:92
#define ASSERT
Definition: Errors.h:68

Member Function Documentation

◆ AddToWorld()

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

Reimplemented from Object.

53 {
55  if (!IsInWorld())
56  {
59  BindToCaster();
60  }
61 }
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:116
bool IsInWorld() const
Definition: Object.h:151
void BindToCaster()
Definition: DynamicObject.cpp:234
Map * GetMap() const
Definition: Object.h:555
void AddToWorld() override
Definition: Object.cpp:919
Definition: DynamicObject.h:36
ObjectGuid const & GetGUID() const
Definition: Object.h:157
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:493
+ Here is the call graph for this function:

◆ BindToCaster()

void DynamicObject::BindToCaster ( )
235 {
236  ASSERT(!_caster);
238  ASSERT(_caster);
239  ASSERT(_caster->GetMap() == GetMap());
241 }
Unit * _caster
Definition: DynamicObject.h:90
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:206
Map * GetMap() const
Definition: Object.h:555
void _RegisterDynObject(DynamicObject *dynObj)
Definition: Unit.cpp:5006
#define ASSERT
Definition: Errors.h:68
ObjectGuid GetCasterGUID() const
Definition: DynamicObject.h:81
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ BuildValuesCreate()

void DynamicObject::BuildValuesCreate ( ByteBuffer data,
Player const *  target 
) const
overrideprotectedvirtual

Implements Object.

256 {
258  std::size_t sizePos = data->wpos();
259  *data << uint32(0);
260  *data << uint8(flags);
261  m_objectData->WriteCreate(*data, flags, this, target);
262  m_dynamicObjectData->WriteCreate(*data, flags, this, target);
263  data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
264 }
size_t wpos() const
Definition: ByteBuffer.h:412
uint16 flags
Definition: DisableMgr.cpp:49
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:252
uint32_t uint32
Definition: Define.h:143
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const
Definition: Object.cpp:736
uint8_t uint8
Definition: Define.h:145
UF::UpdateField< UF::DynamicObjectData, 0, TYPEID_DYNAMICOBJECT > m_dynamicObjectData
Definition: DynamicObject.h:85
UpdateFieldFlag
Definition: UpdateField.h:33
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:220
+ Here is the call graph for this function:

◆ BuildValuesUpdate()

void DynamicObject::BuildValuesUpdate ( ByteBuffer data,
Player const *  target 
) const
overrideprotectedvirtual

Implements Object.

267 {
269  std::size_t sizePos = data->wpos();
270  *data << uint32(0);
272 
274  m_objectData->WriteUpdate(*data, flags, this, target);
275 
277  m_dynamicObjectData->WriteUpdate(*data, flags, this, target);
278 
279  data->put<uint32>(sizePos, data->wpos() - sizePos - 4);
280 }
size_t wpos() const
Definition: ByteBuffer.h:412
uint16 flags
Definition: DisableMgr.cpp:49
uint32 GetChangedObjectTypeMask() const
Definition: UpdateField.h:670
bool HasChanged(uint32 index) const
Definition: UpdateField.h:675
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:252
uint32_t uint32
Definition: Define.h:143
Definition: ObjectGuid.h:34
virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const *target) const
Definition: Object.cpp:736
Definition: ObjectGuid.h:43
UF::UpdateField< UF::DynamicObjectData, 0, TYPEID_DYNAMICOBJECT > m_dynamicObjectData
Definition: DynamicObject.h:85
UF::UpdateFieldHolder m_values
Definition: Object.h:251
UpdateFieldFlag
Definition: UpdateField.h:33
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:220
+ Here is the call graph for this function:

◆ BuildValuesUpdateForPlayerWithMask()

void DynamicObject::BuildValuesUpdateForPlayerWithMask ( UpdateData data,
UF::ObjectData::Mask const &  requestedObjectMask,
UF::DynamicObjectData::Mask const &  requestedDynamicObjectMask,
Player const *  target 
) const
284 {
286  if (requestedObjectMask.IsAnySet())
287  valuesMask.Set(TYPEID_OBJECT);
288 
289  if (requestedDynamicObjectMask.IsAnySet())
290  valuesMask.Set(TYPEID_DYNAMICOBJECT);
291 
293  std::size_t sizePos = buffer.wpos();
294  buffer << uint32(0);
295  buffer << uint32(valuesMask.GetBlock(0));
296 
297  if (valuesMask[TYPEID_OBJECT])
298  m_objectData->WriteUpdate(buffer, requestedObjectMask, true, this, target);
299 
300  if (valuesMask[TYPEID_DYNAMICOBJECT])
301  m_dynamicObjectData->WriteUpdate(buffer, requestedDynamicObjectMask, true, this, target);
302 
303  buffer.put<uint32>(sizePos, buffer.wpos() - sizePos - 4);
304 
305  data->AddUpdateBlock(buffer);
306 }
size_t wpos() const
Definition: ByteBuffer.h:412
Definition: ByteBuffer.h:61
void AddUpdateBlock(ByteBuffer const &block)
Definition: UpdateData.cpp:40
uint32 GetBlock(uint32 index) const
Definition: UpdateMask.h:53
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:252
void Set(uint32 index)
Definition: UpdateMask.h:84
uint32_t uint32
Definition: Define.h:143
ByteBuffer PrepareValuesUpdateBuffer() const
Definition: Object.cpp:233
Definition: ObjectGuid.h:34
Definition: ObjectGuid.h:43
UF::UpdateField< UF::DynamicObjectData, 0, TYPEID_DYNAMICOBJECT > m_dynamicObjectData
Definition: DynamicObject.h:85
void put(std::size_t pos, T value)
Definition: ByteBuffer.h:220
+ Here is the call graph for this function:

◆ ClearUpdateMask()

void DynamicObject::ClearUpdateMask ( bool  remove)
overrideprotectedvirtual

Reimplemented from Object.

320 {
322  Object::ClearUpdateMask(remove);
323 }
virtual void ClearUpdateMask(bool remove)
Definition: Object.cpp:756
void ClearChangesMask(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:664
UF::UpdateField< UF::DynamicObjectData, 0, TYPEID_DYNAMICOBJECT > m_dynamicObjectData
Definition: DynamicObject.h:85
UF::UpdateFieldHolder m_values
Definition: Object.h:251
+ Here is the call graph for this function:

◆ CreateDynamicObject()

bool DynamicObject::CreateDynamicObject ( ObjectGuid::LowType  guidlow,
Unit caster,
SpellInfo const *  spell,
Position const &  pos,
float  radius,
DynamicObjectType  type,
SpellCastVisual  spellVisual 
)
85 {
86  SetMap(caster->GetMap());
87  Relocate(pos);
88  if (!IsPositionValid())
89  {
90  TC_LOG_ERROR("misc", "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spell->Id, GetPositionX(), GetPositionY());
91  return false;
92  }
93 
94  WorldObject::_Create(ObjectGuid::Create<HighGuid::DynamicObject>(GetMapId(), spell->Id, guidlow));
96 
98  SetZoneScript();
99 
100  SetEntry(spell->Id);
101  SetObjectScale(1.0f);
102  auto dynamicObjectData = m_values.ModifyValue(&DynamicObject::m_dynamicObjectData);
103  SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::Caster), caster->GetGUID());
104  SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::Type), type);
106  SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::SpellVisual).ModifyValue(&UF::SpellCastVisual::ScriptVisualID), spellVisual.ScriptVisualID);
107  SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::SpellID), spell->Id);
108  SetUpdateFieldValue(dynamicObjectData.ModifyValue(&UF::DynamicObjectData::Radius), radius);
110 
111  if (IsWorldObject())
112  setActive(true); //must before add to map to be put in world container
113 
114  TransportBase* transport = caster->GetTransport();
115  if (transport)
116  {
117  float x, y, z, o;
118  pos.GetPosition(x, y, z, o);
119  transport->CalculatePassengerOffset(x, y, z, &o);
120  m_movementInfo.transport.pos.Relocate(x, y, z, o);
121 
122  // This object must be added to transport before adding to map for the client to properly display it
123  transport->AddPassenger(this);
124  }
125 
126  if (!GetMap()->AddToMap(this))
127  {
128  // Returning false will cause the object to be deleted - remove from transport
129  if (transport)
130  transport->RemovePassenger(this);
131  return false;
132  }
133 
134  return true;
135 }
virtual void CalculatePassengerOffset(float &x, float &y, float &z, float *o=nullptr) const =0
This method transforms supplied global coordinates into local offsets.
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:116
bool IsWorldObject() const
Definition: Object.cpp:841
MovementInfo m_movementInfo
Definition: Object.h:690
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:156
void setActive(bool isActiveObject)
Definition: Object.cpp:852
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:185
MutableFieldReference< T, false > ModifyValue(UpdateField< T, BlockBit, Bit >(Derived::*field))
Definition: UpdateField.h:657
virtual void SetMap(Map *map)
Definition: Object.cpp:1698
void UpdatePositionData()
Definition: Object.cpp:901
static void InheritPhaseShift(WorldObject *target, WorldObject const *source)
Definition: PhasingHandler.cpp:256
uint32 GetGameTimeMS()
Definition: GameTime.cpp:44
int32 ScriptVisualID
Definition: UpdateFields.h:213
void SetEntry(uint32 entry)
Definition: Object.h:159
virtual TransportBase * RemovePassenger(WorldObject *passenger)=0
struct MovementInfo::TransportInfo transport
Definition: VehicleDefines.h:153
UpdateField< uint8, 0, 2 > Type
Definition: UpdateFields.h:823
float GetPositionY() const
Definition: Position.h:78
Map * GetMap() const
Definition: Object.h:555
void Relocate(float x, float y)
Definition: Position.h:64
UpdateField< int32, 0, 4 > SpellID
Definition: UpdateFields.h:825
bool AddToMap(T *)
Definition: Map.cpp:745
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:268
UpdateField< uint32, 0, 6 > CastTime
Definition: UpdateFields.h:827
uint32 ScriptVisualID
Definition: SpellDefines.h:487
int32 SpellXSpellVisualID
Definition: UpdateFields.h:212
Position pos
Definition: MovementInfo.h:51
float GetPositionX() const
Definition: Position.h:77
uint32 GetMapId() const
Definition: Position.h:186
virtual void SetObjectScale(float scale)
Definition: Object.h:162
void SetZoneScript()
Definition: Object.cpp:1913
UpdateField< ObjectGuid, 0, 1 > Caster
Definition: UpdateFields.h:822
uint32 SpellXSpellVisualID
Definition: SpellDefines.h:486
virtual void AddPassenger(WorldObject *passenger)=0
UF::UpdateField< UF::DynamicObjectData, 0, TYPEID_DYNAMICOBJECT > m_dynamicObjectData
Definition: DynamicObject.h:85
UF::UpdateFieldHolder m_values
Definition: Object.h:251
bool IsPositionValid() const
Definition: Position.cpp:42
UpdateField< float, 0, 5 > Radius
Definition: UpdateFields.h:826
TransportBase * GetTransport() const
Definition: Object.h:679
UpdateField< UF::SpellCastVisual, 0, 3 > SpellVisual
Definition: UpdateFields.h:824
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Delay()

void DynamicObject::Delay ( int32  delaytime)
191 {
192  SetDuration(GetDuration() - delaytime);
193 }
void SetDuration(int32 newDuration)
Definition: DynamicObject.cpp:182
int32 GetDuration() const
Definition: DynamicObject.cpp:174
+ Here is the call graph for this function:

◆ GetCaster()

Unit* DynamicObject::GetCaster ( ) const
inline
75 { return _caster; }
Unit * _caster
Definition: DynamicObject.h:90
+ Here is the caller graph for this function:

◆ GetCasterGUID()

ObjectGuid DynamicObject::GetCasterGUID ( ) const
inline
81 { return m_dynamicObjectData->Caster; }
UF::UpdateField< UF::DynamicObjectData, 0, TYPEID_DYNAMICOBJECT > m_dynamicObjectData
Definition: DynamicObject.h:85
+ Here is the caller graph for this function:

◆ GetDuration()

int32 DynamicObject::GetDuration ( ) const
175 {
176  if (!_aura)
177  return _duration;
178  else
179  return _aura->GetDuration();
180 }
int32 GetDuration() const
Definition: SpellAuras.h:176
Aura * _aura
Definition: DynamicObject.h:88
int32 _duration
Definition: DynamicObject.h:91
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetFaction()

uint32 DynamicObject::GetFaction ( ) const
overridevirtual

Implements WorldObject.

229 {
230  ASSERT(_caster);
231  return _caster->GetFaction();
232 }
uint32 GetFaction() const override
Definition: Unit.h:972
Unit * _caster
Definition: DynamicObject.h:90
#define ASSERT
Definition: Errors.h:68
+ Here is the call graph for this function:

◆ GetOwnerGUID()

ObjectGuid DynamicObject::GetOwnerGUID ( ) const
inlineoverridevirtual

Implements WorldObject.

82 { return GetCasterGUID(); }
ObjectGuid GetCasterGUID() const
Definition: DynamicObject.h:81

◆ GetRadius()

float DynamicObject::GetRadius ( ) const
inline
83 { return m_dynamicObjectData->Radius; }
UF::UpdateField< UF::DynamicObjectData, 0, TYPEID_DYNAMICOBJECT > m_dynamicObjectData
Definition: DynamicObject.h:85
+ Here is the caller graph for this function:

◆ GetSpellId()

uint32 DynamicObject::GetSpellId ( ) const
inline
79 { return m_dynamicObjectData->SpellID; }
UF::UpdateField< UF::DynamicObjectData, 0, TYPEID_DYNAMICOBJECT > m_dynamicObjectData
Definition: DynamicObject.h:85
+ Here is the caller graph for this function:

◆ GetSpellInfo()

SpellInfo const * DynamicObject::GetSpellInfo ( ) const
251 {
252  return sSpellMgr->GetSpellInfo(GetSpellId(), GetMap()->GetDifficultyID());
253 }
Difficulty GetDifficultyID() const
Definition: Map.h:401
uint32 GetSpellId() const
Definition: DynamicObject.h:79
Map * GetMap() const
Definition: Object.h:555
#define sSpellMgr
Definition: SpellMgr.h:825
+ Here is the call graph for this function:

◆ Remove()

void DynamicObject::Remove ( )
169 {
170  if (IsInWorld())
172 }
bool IsInWorld() const
Definition: Object.h:151
void AddObjectToRemoveList()
Definition: Object.cpp:1728
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveAura()

void DynamicObject::RemoveAura ( )
202 {
205  _aura = nullptr;
206  if (!_removedAura->IsRemoved())
208 }
Aura * _removedAura
Definition: DynamicObject.h:89
Aura * _aura
Definition: DynamicObject.h:88
void _Remove(AuraRemoveMode removeMode)
Definition: SpellAuras.cpp:592
bool IsRemoved() const
Definition: SpellAuras.h:208
#define ASSERT
Definition: Errors.h:68
Definition: SpellAuraDefines.h:65
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveCasterViewpoint()

void DynamicObject::RemoveCasterViewpoint ( )
220 {
221  if (Player* caster = _caster->ToPlayer())
222  {
223  caster->SetViewpoint(this, false);
224  _isViewpoint = false;
225  }
226 }
static Player * ToPlayer(Object *o)
Definition: Object.h:198
Unit * _caster
Definition: DynamicObject.h:90
bool _isViewpoint
Definition: DynamicObject.h:92
Definition: Player.h:1131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ RemoveFromWorld()

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

Reimplemented from Object.

64 {
66  if (IsInWorld())
67  {
68  if (_isViewpoint)
70 
71  if (_aura)
72  RemoveAura();
73 
74  // dynobj could get removed in Aura::RemoveAura
75  if (!IsInWorld())
76  return;
77 
81  }
82 }
bool IsInWorld() const
Definition: Object.h:151
Aura * _aura
Definition: DynamicObject.h:88
void UnbindFromCaster()
Definition: DynamicObject.cpp:243
Map * GetMap() const
Definition: Object.h:555
Definition: DynamicObject.h:36
void RemoveAura()
Definition: DynamicObject.cpp:201
ObjectGuid const & GetGUID() const
Definition: Object.h:157
void RemoveFromWorld() override
Definition: Object.cpp:925
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:493
bool _isViewpoint
Definition: DynamicObject.h:92
bool Remove(KEY_TYPE const &handle)
Definition: TypeContainer.h:122
void RemoveCasterViewpoint()
Definition: DynamicObject.cpp:219
+ Here is the call graph for this function:

◆ SetAura()

void DynamicObject::SetAura ( Aura aura)
196 {
197  ASSERT(!_aura && aura);
198  _aura = aura;
199 }
Aura * _aura
Definition: DynamicObject.h:88
#define ASSERT
Definition: Errors.h:68
+ Here is the caller graph for this function:

◆ SetCasterViewpoint()

void DynamicObject::SetCasterViewpoint ( )
211 {
212  if (Player* caster = _caster->ToPlayer())
213  {
214  caster->SetViewpoint(this, true);
215  _isViewpoint = true;
216  }
217 }
static Player * ToPlayer(Object *o)
Definition: Object.h:198
Unit * _caster
Definition: DynamicObject.h:90
bool _isViewpoint
Definition: DynamicObject.h:92
Definition: Player.h:1131
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetDuration()

void DynamicObject::SetDuration ( int32  newDuration)
183 {
184  if (!_aura)
185  _duration = newDuration;
186  else
187  _aura->SetDuration(newDuration);
188 }
Aura * _aura
Definition: DynamicObject.h:88
void SetDuration(int32 duration, bool withMods=false)
Definition: SpellAuras.cpp:879
int32 _duration
Definition: DynamicObject.h:91
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ UnbindFromCaster()

void DynamicObject::UnbindFromCaster ( )
244 {
245  ASSERT(_caster);
247  _caster = nullptr;
248 }
Unit * _caster
Definition: DynamicObject.h:90
void _UnregisterDynObject(DynamicObject *dynObj)
Definition: Unit.cpp:5013
#define ASSERT
Definition: Errors.h:68
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Update()

void DynamicObject::Update ( uint32  p_time)
overridevirtual

Reimplemented from WorldObject.

138 {
139  // caster has to be always available and in the same map
140  ASSERT(_caster);
141  ASSERT(_caster->GetMap() == GetMap());
142 
143  bool expired = false;
144 
145  if (_aura)
146  {
147  if (!_aura->IsRemoved())
148  _aura->UpdateOwner(p_time, this);
149 
150  // _aura may be set to null in Aura::UpdateOwner call
151  if (_aura && (_aura->IsRemoved() || _aura->IsExpired()))
152  expired = true;
153  }
154  else
155  {
156  if (GetDuration() > int32(p_time))
157  _duration -= p_time;
158  else
159  expired = true;
160  }
161 
162  if (expired)
163  Remove();
164  else
165  sScriptMgr->OnDynamicObjectUpdate(this, p_time);
166 }
Unit * _caster
Definition: DynamicObject.h:90
Aura * _aura
Definition: DynamicObject.h:88
Map * GetMap() const
Definition: Object.h:555
bool IsExpired() const
Definition: SpellAuras.h:180
int32_t int32
Definition: Define.h:139
void Remove()
Definition: DynamicObject.cpp:168
bool IsRemoved() const
Definition: SpellAuras.h:208
#define ASSERT
Definition: Errors.h:68
#define sScriptMgr
Definition: ScriptMgr.h:1409
int32 GetDuration() const
Definition: DynamicObject.cpp:174
int32 _duration
Definition: DynamicObject.h:91
void UpdateOwner(uint32 diff, WorldObject *owner)
Definition: SpellAuras.cpp:760
+ Here is the call graph for this function:

Member Data Documentation

◆ _aura

Aura* DynamicObject::_aura
protected

◆ _caster

Unit* DynamicObject::_caster
protected

◆ _duration

int32 DynamicObject::_duration
protected

◆ _isViewpoint

bool DynamicObject::_isViewpoint
protected

◆ _removedAura

Aura* DynamicObject::_removedAura
protected

◆ m_dynamicObjectData

UF::UpdateField<UF::DynamicObjectData, 0, TYPEID_DYNAMICOBJECT> DynamicObject::m_dynamicObjectData

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