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

#include <DynamicObject.h>

Public Member Functions

 DynamicObject (bool isWorldObject)
 
 ~DynamicObject ()
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
bool CreateDynamicObject (ObjectGuid::LowType guidlow, Unit *caster, SpellInfo const *spell, 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 ()
 
void RemoveCasterViewpoint ()
 
UnitGetCaster () const
 
void BindToCaster ()
 
void UnbindFromCaster ()
 
uint32 GetSpellId () const
 
ObjectGuid GetCasterGUID () const
 
float GetRadius () const
 
- Public Member Functions inherited from WorldObject
virtual ~WorldObject ()
 
void GetNearPoint2D (float &x, float &y, float distance, float absAngle) const
 
void GetNearPoint (WorldObject const *searcher, float &x, float &y, float &z, float searcher_size, float distance2d, float absAngle) const
 
void GetClosePoint (float &x, float &y, float &z, float size, float distance2d=0, float angle=0) const
 
void MovePosition (Position &pos, float dist, float angle)
 
Position GetNearPosition (float dist, float angle)
 
void MovePositionToFirstCollision (Position &pos, float dist, float angle)
 
Position GetFirstCollisionPosition (float dist, float angle)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (WorldObject const *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
float GetObjectSize () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z) const
 
void GetRandomPoint (Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
Position GetRandomPoint (Position const &srcPos, float distance) const
 
uint32 GetInstanceId () const
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
virtual bool SetInPhase (uint32 id, bool update, bool apply)
 
void CopyPhaseFrom (WorldObject *obj, bool update=false)
 
void UpdateAreaPhase ()
 
void ClearPhases (bool update=false)
 
void RebuildTerrainSwaps ()
 
void RebuildWorldMapAreaSwaps ()
 
bool HasInPhaseList (uint32 phase)
 
uint32 GetPhaseMask () const
 
bool IsInPhase (uint32 phase) const
 
bool IsInPhase (WorldObject const *obj) const
 
bool IsInTerrainSwap (uint32 terrainSwap) const
 
std::set< uint32 > constGetPhases () const
 
std::set< uint32 > constGetTerrainSwaps () const
 
std::set< uint32 > constGetWorldMapAreaSwaps () const
 
int32 GetDBPhase () const
 
void SetDBPhase (int32 p)
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
void GetZoneAndAreaId (uint32 &zoneid, uint32 &areaid) const
 
InstanceScriptGetInstanceScript ()
 
std::string constGetName () const
 
void SetName (std::string const &newname)
 
virtual std::string constGetNameForLocaleIdx (LocaleConstant) const
 
float GetDistance (WorldObject const *obj) const
 
float GetDistance (Position const &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (WorldObject const *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (WorldObject const *obj) const
 
bool IsSelfOrInSameMap (WorldObject const *obj) const
 
bool IsInMap (WorldObject const *obj) const
 
bool IsWithinDist3d (float x, float y, float z, float dist) const
 
bool IsWithinDist3d (Position const *pos, float dist) const
 
bool IsWithinDist2d (float x, float y, float dist) const
 
bool IsWithinDist2d (Position const *pos, float dist) const
 
bool IsWithinDist (WorldObject const *obj, float dist2compare, bool is3D=true) const
 
bool IsWithinDistInMap (WorldObject const *obj, float dist2compare, bool is3D=true) const
 
bool IsWithinLOS (float x, float y, float z) const
 
bool IsWithinLOSInMap (WorldObject const *obj) const
 
bool GetDistanceOrder (WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
 
bool IsInRange (WorldObject const *obj, float minRange, float maxRange, bool is3D=true) const
 
bool IsInRange2d (float x, float y, float minRange, float maxRange) const
 
bool IsInRange3d (float x, float y, float z, float minRange, float maxRange) const
 
bool isInFront (WorldObject const *target, float arc=float(M_PI)) const
 
bool isInBack (WorldObject const *target, float arc=float(M_PI)) const
 
bool IsInBetween (WorldObject const *obj1, WorldObject const *obj2, float size=0) const
 
virtual void CleanupsBeforeDelete (bool finalCleanup=true)
 
virtual void SendMessageToSet (WorldPacket const *data, bool self)
 
virtual void SendMessageToSetInRange (WorldPacket const *data, float dist, bool self)
 
virtual void SendMessageToSet (WorldPacket const *data, Player const *skipped_rcvr)
 
virtual uint8 getLevelForTarget (WorldObject const *) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=NULL)
 
void PlayDirectSound (uint32 sound_id, Player *target=NULL)
 
void SendObjectDeSpawnAnim (ObjectGuid guid)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (WorldObject const *target=NULL) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
Map constGetBaseMap () const
 
void SetZoneScript ()
 
ZoneScriptGetZoneScript () const
 
TempSummonSummonCreature (uint32 id, Position const &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0) const
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang=0, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0) const
 
GameObjectSummonGameObject (uint32 entry, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 respawnTime)
 
CreatureSummonTrigger (float x, float y, float z, float ang, uint32 dur, CreatureAI *(*GetAI)(Creature *)=NULL)
 
void SummonCreatureGroup (uint8 group, std::list< TempSummon * > *list=NULL)
 
CreatureFindNearestCreature (uint32 entry, float range, bool alive=true) const
 
GameObjectFindNearestGameObject (uint32 entry, float range) const
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &lList, uint32 uiEntry, float fMaxSearchRange) const
 
void GetPlayerListInGrid (std::list< Player * > &lList, float fMaxSearchRange) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true)
 
void BuildUpdate (UpdateDataMapType &) override
 
void AddToObjectUpdate () override
 
void RemoveFromObjectUpdate () override
 
void AddToNotify (uint16 f)
 
bool isNeedNotify (uint16 f) const
 
uint16 GetNotifyFlags () const
 
bool NotifyExecuted (uint16 f) const
 
void SetNotified (uint16 f)
 
void ResetAllNotifies ()
 
bool isActiveObject () const
 
void setActive (bool isActiveObject)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
template<class NOTIFIER >
void VisitNearbyObject (float const &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyGridObject (float const &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyWorldObject (float const &radius, NOTIFIER &notifier) const
 
TransportGetTransport () const
 
float GetTransOffsetX () const
 
float GetTransOffsetY () const
 
float GetTransOffsetZ () const
 
float GetTransOffsetO () const
 
uint32 GetTransTime () const
 
int8 GetTransSeat () const
 
virtual ObjectGuid GetTransGUID () const
 
void SetTransport (Transport *t)
 
virtual float GetStationaryX () const
 
virtual float GetStationaryY () const
 
virtual float GetStationaryZ () const
 
virtual float GetStationaryO () const
 
virtual uint16 GetAIAnimKitId () const
 
virtual uint16 GetMovementAnimKitId () const
 
virtual uint16 GetMeleeAnimKitId () const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
bool IsInWorld () const
 
ObjectGuid constGetGUID () const
 
PackedGuid constGetPackGUID () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
virtual void SetObjectScale (float scale)
 
TypeID GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
virtual void DestroyForPlayer (Player *target) const
 
int32 GetInt32Value (uint16 index) const
 
uint32 GetUInt32Value (uint16 index) const
 
uint64 GetUInt64Value (uint16 index) const
 
float GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
ObjectGuid constGetGuidValue (uint16 index) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void UpdateUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, uint64 value)
 
void SetFloatValue (uint16 index, float value)
 
void SetByteValue (uint16 index, uint8 offset, uint8 value)
 
void SetUInt16Value (uint16 index, uint8 offset, uint16 value)
 
void SetGuidValue (uint16 index, ObjectGuid const &value)
 
void SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddGuidValue (uint16 index, ObjectGuid const &value)
 
bool RemoveGuidValue (uint16 index, ObjectGuid const &value)
 
void ApplyModUInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModInt32Value (uint16 index, int32 val, bool apply)
 
void ApplyModUInt16Value (uint16 index, uint8 offset, int16 val, bool apply)
 
void ApplyModPositiveFloatValue (uint16 index, float val, bool apply)
 
void ApplyModSignedFloatValue (uint16 index, float val, bool apply)
 
void ApplyPercentModFloatValue (uint16 index, float val, bool apply)
 
void SetFlag (uint16 index, uint32 newFlag)
 
void RemoveFlag (uint16 index, uint32 oldFlag)
 
void ToggleFlag (uint16 index, uint32 flag)
 
bool HasFlag (uint16 index, uint32 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
void SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void ToggleByteFlag (uint16 index, uint8 offset, uint8 flag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void SetFlag64 (uint16 index, uint64 newFlag)
 
void RemoveFlag64 (uint16 index, uint64 oldFlag)
 
void ToggleFlag64 (uint16 index, uint64 flag)
 
bool HasFlag64 (uint16 index, uint64 flag) const
 
void ApplyModFlag64 (uint16 index, uint64 flag, bool apply)
 
std::vector< uint32 > constGetDynamicValues (uint16 index) const
 
void AddDynamicValue (uint16 index, uint32 value)
 
void RemoveDynamicValue (uint16 index, uint32 value)
 
void ClearDynamicValue (uint16 index)
 
void SetDynamicValue (uint16 index, uint8 offset, uint32 value)
 
void ClearUpdateMask (bool remove)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void SetFieldNotifyFlag (uint16 flag)
 
void RemoveFieldNotifyFlag (uint16 flag)
 
void ForceValuesUpdateAtIndex (uint32)
 
PlayerToPlayer ()
 
Player constToPlayer () const
 
CreatureToCreature ()
 
Creature constToCreature () const
 
UnitToUnit ()
 
Unit constToUnit () const
 
GameObjectToGameObject ()
 
GameObject constToGameObject () const
 
CorpseToCorpse ()
 
Corpse constToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject constToDynObject () const
 
AreaTriggerToAreaTrigger ()
 
AreaTrigger constToAreaTrigger () const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
 WorldLocation (WorldLocation const &loc)
 
void WorldRelocate (WorldLocation const &loc)
 
void WorldRelocate (uint32 mapId=MAPID_INVALID, float x=0.f, float y=0.f, float z=0.f, float o=0.f)
 
WorldLocation GetWorldLocation () const
 
uint32 GetMapId () const
 
- Public Member Functions inherited from Position
 Position (float x=0, float y=0, float z=0, float o=0)
 
 Position (Position const &loc)
 
bool operator== (Position const &a)
 
bool operator!= (Position const &a)
 
void Relocate (float x, float y)
 
void Relocate (float x, float y, float z)
 
void Relocate (float x, float y, float z, float orientation)
 
void Relocate (Position const &pos)
 
void Relocate (Position const *pos)
 
void Relocate (G3D::Vector3 const &pos)
 
void RelocateOffset (Position const &offset)
 
void SetOrientation (float orientation)
 
float GetPositionX () const
 
float GetPositionY () const
 
float GetPositionZ () const
 
float GetOrientation () const
 
void GetPosition (float &x, float &y) const
 
void GetPosition (float &x, float &y, float &z) const
 
void GetPosition (float &x, float &y, float &z, float &o) const
 
Position GetPosition () const
 
Position::PositionXYStreamer PositionXYStream ()
 
Position::PositionXYZStreamer PositionXYZStream ()
 
Position::PositionXYZOStreamer PositionXYZOStream ()
 
bool IsPositionValid () const
 
float GetExactDist2dSq (float x, float y) const
 
float GetExactDist2d (const float x, const float y) const
 
float GetExactDist2dSq (Position const *pos) const
 
float GetExactDist2d (Position const *pos) const
 
float GetExactDistSq (float x, float y, float z) const
 
float GetExactDist (float x, float y, float z) const
 
float GetExactDistSq (Position const *pos) const
 
float GetExactDist (Position const *pos) const
 
void GetPositionOffsetTo (Position const &endPos, Position &retOffset) const
 
Position GetPositionWithOffset (Position const &offset) const
 
float GetAngle (Position const *pos) const
 
float GetAngle (float x, float y) const
 
float GetRelativeAngle (Position const *pos) const
 
float GetRelativeAngle (float x, float y) const
 
void GetSinCos (float x, float y, float &vsin, float &vcos) const
 
bool IsInDist2d (float x, float y, float dist) const
 
bool IsInDist2d (Position const *pos, float dist) const
 
bool IsInDist (float x, float y, float z, float dist) const
 
bool IsInDist (Position const *pos, float dist) const
 
bool IsWithinBox (const Position &center, float xradius, float yradius, float zradius) const
 
bool HasInArc (float arcangle, Position const *pos, float border=2.0f) const
 
bool HasInLine (Position const *pos, float width) const
 
std::string ToString () const
 
- Public Member Functions inherited from GridObject< DynamicObject >
virtual ~GridObject ()
 
bool IsInGrid () const
 
void AddToGrid (GridRefManager< DynamicObject > &m)
 
void RemoveFromGrid ()
 

Protected Attributes

Aura_aura
 
Aura_removedAura
 
Unit_caster
 
int32 _duration
 
bool _isViewpoint
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
Transportm_transport
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
TypeID m_objectTypeId
 
uint32 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
std::vector< uint32 > * _dynamicValues
 
UpdateMask _changesMask
 
UpdateMask _dynamicChangesMask
 
UpdateMask_dynamicChangesArrayMask
 
uint16 m_valuesCount
 
uint16 _dynamicValuesCount
 
uint16 _fieldNotifyFlags
 
bool m_objectUpdated
 

Additional Inherited Members

- Static Public Member Functions inherited from Position
static float NormalizeOrientation (float o)
 
- Public Attributes inherited from WorldObject
FlaggedValuesArray32< int32,
uint32, StealthType,
TOTAL_STEALTH_TYPES
m_stealth
 
FlaggedValuesArray32< int32,
uint32, StealthType,
TOTAL_STEALTH_TYPES
m_stealthDetect
 
FlaggedValuesArray32< int32,
uint32, InvisibilityType,
TOTAL_INVISIBILITY_TYPES
m_invisibility
 
FlaggedValuesArray32< int32,
uint32, InvisibilityType,
TOTAL_INVISIBILITY_TYPES
m_invisibilityDetect
 
FlaggedValuesArray32< int32,
uint32,
ServerSideVisibilityType,
TOTAL_SERVERSIDE_VISIBILITY_TYPES
m_serverSideVisibility
 
FlaggedValuesArray32< int32,
uint32,
ServerSideVisibilityType,
TOTAL_SERVERSIDE_VISIBILITY_TYPES
m_serverSideVisibilityDetect
 
uint32 LastUsedScriptID
 
MovementInfo m_movementInfo
 
- Public Attributes inherited from WorldLocation
uint32 m_mapId
 
- Public Attributes inherited from Position
float m_positionX
 
float m_positionY
 
float m_positionZ
 
- Protected Member Functions inherited from WorldObject
 WorldObject (bool isWorldObject)
 
void SetLocationMapId (uint32 _mapId)
 
void SetLocationInstanceId (uint32 _instanceId)
 
virtual bool IsNeverVisible () const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *) const
 
virtual bool IsInvisibleDueToDespawn () const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (ObjectGuid const &guid)
 
std::string _ConcatFields (uint16 startIndex, uint16 size) const
 
void _LoadIntoDataField (std::string const &data, uint32 startOffset, uint32 count)
 
uint32 GetUpdateFieldData (Player const *target, uint32 *&flags) const
 
uint32 GetDynamicUpdateFieldData (Player const *target, uint32 *&flags) const
 
void BuildMovementUpdate (ByteBuffer *data, uint32 flags) const
 
virtual void BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
virtual void BuildDynamicValuesUpdate (uint8 updatetype, ByteBuffer *data, Player *target) const
 
void AddToObjectUpdateIfNeeded ()
 
- Protected Member Functions inherited from MapObject
 MapObject ()
 

Constructor & Destructor Documentation

DynamicObject::DynamicObject ( bool  isWorldObject)
30  : WorldObject(isWorldObject),
32 {
35 
37 
40 }
Unit * _caster
Definition: DynamicObject.h:64
Definition: UpdateFields.h:350
Aura * _removedAura
Definition: DynamicObject.h:63
uint16 _dynamicValuesCount
Definition: Object.h:246
Aura * _aura
Definition: DynamicObject.h:62
arena_t NULL
Definition: jemalloc_internal.h:624
Definition: UpdateFields.h:345
uint16 m_objectType
Definition: Object.h:227
TypeID m_objectTypeId
Definition: Object.h:229
bool _isViewpoint
Definition: DynamicObject.h:66
WorldObject(bool isWorldObject)
Definition: Object.cpp:1445
uint16 m_valuesCount
Definition: Object.h:245
Definition: UpdateData.h:43
Definition: ObjectGuid.h:35
uint32 m_updateFlag
Definition: Object.h:230
int32 _duration
Definition: DynamicObject.h:65
Definition: ObjectGuid.h:52
DynamicObject::~DynamicObject ( )
43 {
44  // make sure all references were properly removed
45  ASSERT(!_aura);
46  ASSERT(!_caster);
48  delete _removedAura;
49 }
Unit * _caster
Definition: DynamicObject.h:64
Aura * _removedAura
Definition: DynamicObject.h:63
Aura * _aura
Definition: DynamicObject.h:62
bool _isViewpoint
Definition: DynamicObject.h:66
#define ASSERT
Definition: Errors.h:55

Member Function Documentation

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

Reimplemented from Object.

52 {
54  if (!IsInWorld())
55  {
58  BindToCaster();
59  }
60 }
bool Insert(KEY_TYPE const &handle, SPECIFIC_TYPE *obj)
Definition: TypeContainer.h:119
Map * GetMap() const
Definition: Object.h:543
void BindToCaster()
Definition: DynamicObject.cpp:225
Definition: DynamicObject.h:35
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:466
virtual void AddToWorld()
Definition: Object.cpp:142
ObjectGuid const & GetGUID() const
Definition: Object.h:105
bool IsInWorld() const
Definition: Object.h:100

+ Here is the call graph for this function:

void DynamicObject::BindToCaster ( )
226 {
227  ASSERT(!_caster);
229  ASSERT(_caster);
230  ASSERT(_caster->GetMap() == GetMap());
232 }
Unit * _caster
Definition: DynamicObject.h:64
TC_GAME_API Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition: ObjectAccessor.cpp:163
Map * GetMap() const
Definition: Object.h:543
void _RegisterDynObject(DynamicObject *dynObj)
Definition: Unit.cpp:4692
ObjectGuid GetCasterGUID() const
Definition: DynamicObject.h:58
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

bool DynamicObject::CreateDynamicObject ( ObjectGuid::LowType  guidlow,
Unit caster,
SpellInfo const spell,
Position const pos,
float  radius,
DynamicObjectType  type 
)
84 {
85  SetMap(caster->GetMap());
86  Relocate(pos);
87  if (!IsPositionValid())
88  {
89  TC_LOG_ERROR("misc", "DynamicObject (spell %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spell->Id, GetPositionX(), GetPositionY());
90  return false;
91  }
92 
93  WorldObject::_Create(ObjectGuid::Create<HighGuid::DynamicObject>(GetMapId(), spell->Id, guidlow));
94  SetPhaseMask(caster->GetPhaseMask(), false);
95 
96  SetEntry(spell->Id);
97  SetObjectScale(1.0f);
99  SetUInt32Value(DYNAMICOBJECT_BYTES, spell->GetSpellVisual(GetMap()->GetDifficultyID()) | (type << 28));
103 
104  if (IsWorldObject())
105  setActive(true); //must before add to map to be put in world container
106 
107  Transport* transport = caster->GetTransport();
108  if (transport)
109  {
110  float x, y, z, o;
111  pos.GetPosition(x, y, z, o);
112  transport->CalculatePassengerOffset(x, y, z, &o);
113  m_movementInfo.transport.pos.Relocate(x, y, z, o);
114 
115  // This object must be added to transport before adding to map for the client to properly display it
116  transport->AddPassenger(this);
117  }
118 
119  if (!GetMap()->AddToMap(this))
120  {
121  // Returning false will cause the object to be deleted - remove from transport
122  if (transport)
123  transport->RemovePassenger(this);
124  return false;
125  }
126 
127  return true;
128 }
Definition: UpdateFields.h:342
virtual void SetPhaseMask(uint32 newPhaseMask, bool update)
Definition: Object.cpp:2795
void _Create(ObjectGuid const &guid)
Definition: Object.cpp:125
Map * GetMap() const
Definition: Object.h:543
Definition: UpdateFields.h:341
MovementInfo m_movementInfo
Definition: Object.h:612
void setActive(bool isActiveObject)
Definition: Object.cpp:1473
Definition: UpdateFields.h:340
virtual void SetMap(Map *map)
Definition: Object.cpp:2169
uint32 getMSTime()
Definition: Timer.h:24
void AddPassenger(WorldObject *passenger)
Definition: Transport.cpp:237
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:996
Definition: Transport.h:28
bool IsWorldObject() const
Definition: Object.cpp:1462
Definition: UpdateFields.h:343
void SetGuidValue(uint16 index, ObjectGuid const &value)
Definition: Object.cpp:1120
void SetEntry(uint32 entry)
Definition: Object.h:108
struct MovementInfo::TransportInfo transport
Definition: UpdateFields.h:344
void RemovePassenger(WorldObject *passenger)
Definition: Transport.cpp:253
void Relocate(float x, float y)
Definition: Position.h:67
uint32 GetPhaseMask() const
Definition: Object.h:461
float GetPositionY() const
Definition: Position.h:105
G3D::int16 z
Definition: Vector3int16.h:46
G3D::int16 y
Definition: Vector2int16.h:38
uint32 GetMapId() const
Definition: Position.h:254
Position pos
Definition: Object.h:290
ObjectGuid const & GetGUID() const
Definition: Object.h:105
Transport * GetTransport() const
Definition: Object.h:602
void CalculatePassengerOffset(float &x, float &y, float &z, float *o=NULL) const override
This method transforms supplied global coordinates into local offsets.
Definition: Transport.h:78
virtual void SetObjectScale(float scale)
Definition: Object.h:111
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:1067
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:207
bool IsPositionValid() const
Definition: Position.cpp:40
G3D::int16 x
Definition: Vector2int16.h:37
float GetPositionX() const
Definition: Position.h:104

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void DynamicObject::Delay ( int32  delaytime)
188 {
189  SetDuration(GetDuration() - delaytime);
190 }
void SetDuration(int32 newDuration)
Definition: DynamicObject.cpp:179
int32 GetDuration() const
Definition: DynamicObject.cpp:171

+ Here is the call graph for this function:

Unit* DynamicObject::GetCaster ( ) const
inline
54 { return _caster; }
Unit * _caster
Definition: DynamicObject.h:64

+ Here is the caller graph for this function:

ObjectGuid DynamicObject::GetCasterGUID ( ) const
inline
Definition: UpdateFields.h:340
ObjectGuid const & GetGuidValue(uint16 index) const
Definition: Object.cpp:332

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

int32 DynamicObject::GetDuration ( ) const
172 {
173  if (!_aura)
174  return _duration;
175  else
176  return _aura->GetDuration();
177 }
Aura * _aura
Definition: DynamicObject.h:62
int32 GetDuration() const
Definition: SpellAuras.h:163
int32 _duration
Definition: DynamicObject.h:65

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

float DynamicObject::GetRadius ( ) const
inline
Definition: UpdateFields.h:343
float GetFloatValue(uint16 index) const
Definition: Object.cpp:312

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

uint32 DynamicObject::GetSpellId ( ) const
inline
Definition: UpdateFields.h:342
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void DynamicObject::Remove ( )
162 {
163  if (IsInWorld())
164  {
166  RemoveFromWorld();
168  }
169 }
void SendObjectDeSpawnAnim(ObjectGuid guid)
Definition: Object.cpp:2162
void AddObjectToRemoveList()
Definition: Object.cpp:2205
ObjectGuid const & GetGUID() const
Definition: Object.h:105
bool IsInWorld() const
Definition: Object.h:100
void RemoveFromWorld() override
Definition: DynamicObject.cpp:62

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void DynamicObject::RemoveAura ( )
199 {
202  _aura = NULL;
203  if (!_removedAura->IsRemoved())
205 }
Aura * _removedAura
Definition: DynamicObject.h:63
Aura * _aura
Definition: DynamicObject.h:62
arena_t NULL
Definition: jemalloc_internal.h:624
bool IsRemoved() const
Definition: SpellAuras.h:201
void _Remove(AuraRemoveMode removeMode)
Definition: SpellAuras.cpp:511
#define ASSERT
Definition: Errors.h:55
Definition: Unit.h:451

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void DynamicObject::RemoveCasterViewpoint ( )
217 {
218  if (Player* caster = _caster->ToPlayer())
219  {
220  caster->SetViewpoint(this, false);
221  _isViewpoint = false;
222  }
223 }
Unit * _caster
Definition: DynamicObject.h:64
Player * ToPlayer()
Definition: Object.h:191
bool _isViewpoint
Definition: DynamicObject.h:66

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

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

Reimplemented from WorldObject.

63 {
65  if (IsInWorld())
66  {
67  if (_isViewpoint)
69 
70  if (_aura)
71  RemoveAura();
72 
73  // dynobj could get removed in Aura::RemoveAura
74  if (!IsInWorld())
75  return;
76 
80  }
81 }
Map * GetMap() const
Definition: Object.h:543
Aura * _aura
Definition: DynamicObject.h:62
void UnbindFromCaster()
Definition: DynamicObject.cpp:234
Definition: DynamicObject.h:35
void RemoveAura()
Definition: DynamicObject.cpp:198
virtual void RemoveFromWorld() override
Definition: Object.cpp:1515
MapStoredObjectTypesContainer & GetObjectsStore()
Definition: Map.h:466
ObjectGuid const & GetGUID() const
Definition: Object.h:105
bool _isViewpoint
Definition: DynamicObject.h:66
bool Remove(KEY_TYPE const &handle)
Definition: TypeContainer.h:125
bool IsInWorld() const
Definition: Object.h:100
void RemoveCasterViewpoint()
Definition: DynamicObject.cpp:216

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void DynamicObject::SetAura ( Aura aura)
193 {
194  ASSERT(!_aura && aura);
195  _aura = aura;
196 }
Aura * _aura
Definition: DynamicObject.h:62
#define ASSERT
Definition: Errors.h:55

+ Here is the caller graph for this function:

void DynamicObject::SetCasterViewpoint ( )
208 {
209  if (Player* caster = _caster->ToPlayer())
210  {
211  caster->SetViewpoint(this, true);
212  _isViewpoint = true;
213  }
214 }
Unit * _caster
Definition: DynamicObject.h:64
Player * ToPlayer()
Definition: Object.h:191
bool _isViewpoint
Definition: DynamicObject.h:66

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void DynamicObject::SetDuration ( int32  newDuration)
180 {
181  if (!_aura)
182  _duration = newDuration;
183  else
184  _aura->SetDuration(newDuration);
185 }
Aura * _aura
Definition: DynamicObject.h:62
void SetDuration(int32 duration, bool withMods=false)
Definition: SpellAuras.cpp:806
int32 _duration
Definition: DynamicObject.h:65

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void DynamicObject::UnbindFromCaster ( )
235 {
236  ASSERT(_caster);
238  _caster = NULL;
239 }
Unit * _caster
Definition: DynamicObject.h:64
arena_t NULL
Definition: jemalloc_internal.h:624
void _UnregisterDynObject(DynamicObject *dynObj)
Definition: Unit.cpp:4697
#define ASSERT
Definition: Errors.h:55

+ Here is the call graph for this function:

+ Here is the caller graph for this function:

void DynamicObject::Update ( uint32  p_time)
overridevirtual

Reimplemented from WorldObject.

131 {
132  // caster has to be always available and in the same map
133  ASSERT(_caster);
134  ASSERT(_caster->GetMap() == GetMap());
135 
136  bool expired = false;
137 
138  if (_aura)
139  {
140  if (!_aura->IsRemoved())
141  _aura->UpdateOwner(p_time, this);
142 
143  // _aura may be set to null in Aura::UpdateOwner call
144  if (_aura && (_aura->IsRemoved() || _aura->IsExpired()))
145  expired = true;
146  }
147  else
148  {
149  if (GetDuration() > int32(p_time))
150  _duration -= p_time;
151  else
152  expired = true;
153  }
154 
155  if (expired)
156  Remove();
157  else
158  sScriptMgr->OnDynamicObjectUpdate(this, p_time);
159 }
Unit * _caster
Definition: DynamicObject.h:64
Map * GetMap() const
Definition: Object.h:543
Aura * _aura
Definition: DynamicObject.h:62
int32 GetDuration() const
Definition: DynamicObject.cpp:171
bool IsRemoved() const
Definition: SpellAuras.h:201
void Remove()
Definition: DynamicObject.cpp:161
bool IsExpired() const
Definition: SpellAuras.h:167
int32_t int32
Definition: g3dmath.h:167
#define ASSERT
Definition: Errors.h:55
#define sScriptMgr
Definition: ScriptMgr.h:837
int32 _duration
Definition: DynamicObject.h:65
void UpdateOwner(uint32 diff, WorldObject *owner)
Definition: SpellAuras.cpp:692

+ Here is the call graph for this function:

Member Data Documentation

Aura* DynamicObject::_aura
protected
Unit* DynamicObject::_caster
protected
int32 DynamicObject::_duration
protected
bool DynamicObject::_isViewpoint
protected
Aura* DynamicObject::_removedAura
protected

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