OregonCore  revision be9e804-git
Your Favourite TBC server
DynamicObject Class Reference

#include <DynamicObject.h>

+ Inheritance diagram for DynamicObject:

Public Types

typedef std::set< Unit * > AffectedSet
 

Public Member Functions

 DynamicObject (bool isWorldObject)
 
void AddToWorld () override
 
void RemoveFromWorld () override
 
bool CreateDynamicObject (uint32 guidlow, Unit *caster, uint32 spellId, uint32 effIndex, const Position &pos, int32 duration, float radius)
 
void Update (uint32 p_time) override
 
void Remove ()
 
uint32 GetSpellId () const
 
uint32 GetEffIndex () const
 
uint32 GetDuration () const
 
uint64 GetCasterGUID () const
 
UnitGetCaster () const
 
float GetRadius () const
 
bool IsAffecting (Unit *unit) const
 
void AddAffected (Unit *unit)
 
void RemoveAffected (Unit *unit)
 
void Delay (int32 delaytime)
 
void Say (const char *text, uint32 language, uint64 TargetGuid)
 
void Yell (const char *text, uint32 language, uint64 TargetGuid)
 
void TextEmote (const char *text, uint64 TargetGuid)
 
void Whisper (const char *text, uint64 receiver)
 
void Say (int32 textId, uint32 language, uint64 TargetGuid)
 
void Yell (int32 textId, uint32 language, uint64 TargetGuid)
 
void TextEmote (int32 textId, uint64 TargetGuid)
 
void Whisper (int32 textId, uint64 receiver)
 
- Public Member Functions inherited from WorldObject
 ~WorldObject () override
 
void _Create (uint32 guidlow, HighGuid guidhigh, uint32 phaseMask)
 
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)
 
float GetPositionZTarget (Position &pos, float destx, float desty)
 
Position GetRandomNearPosition (float radius)
 
void GetContactPoint (const WorldObject *obj, float &x, float &y, float &z, float distance2d=CONTACT_DISTANCE) const
 
virtual float GetObjectBoundingRadius () const
 
float GetObjectSize () const
 
void UpdateGroundPositionZ (float x, float y, float &z) const
 
void UpdateAllowedPositionZ (float x, float y, float &z) const
 
void GetRandomPoint (const Position &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
 
void GetRandomPoint (const Position &srcPos, float distance, Position &pos) const
 
float GetDistanceSqr (float x, float y, float z) const
 
bool HasInArc (float arcangle, const Position *pos) const
 
bool HasInArc (const float arcangle, const float x, const float y) const
 
uint32 GetInstanceId () const
 
virtual void SetPhaseMask (uint32 newPhaseMask, bool update)
 
uint32 GetPhaseMask () const
 
bool InSamePhase (uint32 phasemask) const
 
bool InSamePhase (WorldObject const *obj) const
 
uint32 GetZoneId () const
 
uint32 GetAreaId () const
 
InstanceDataGetInstanceData ()
 
const char * GetName () const
 
void SetName (const std::string &newname)
 
virtual const char * GetNameForLocaleIdx (int32) const
 
float GetDistance (const WorldObject *obj) const
 
float GetDistance (const Position &pos) const
 
float GetDistance (float x, float y, float z) const
 
float GetDistance2d (const WorldObject *obj) const
 
float GetDistance2d (float x, float y) const
 
float GetDistanceZ (const WorldObject *obj) const
 
bool IsInMap (const WorldObject *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) 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 (const WorldObject *obj) 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
 
virtual void CleanupsBeforeDelete ()
 
virtual void SendMessageToSet (WorldPacket *data, bool self)
 
virtual void SendMessageToSetInRange (WorldPacket *data, float dist, bool self)
 
virtual uint8 getLevelForTarget (WorldObject const *) const
 
void MonsterSay (const char *text, uint32 language, uint64 TargetGuid)
 
void MonsterYell (const char *text, uint32 language, uint64 TargetGuid)
 
void MonsterTextEmote (const char *text, uint64 TargetGuid, bool IsBossEmote=false)
 
void MonsterWhisper (const char *text, uint64 receiver, bool IsBossWhisper=false)
 
void MonsterSay (int32 textId, uint32 language, uint64 TargetGuid)
 
void MonsterYell (int32 textId, uint32 language, uint64 TargetGuid)
 
void MonsterTextEmote (int32 textId, uint64 TargetGuid, bool IsBossEmote=false)
 
void MonsterWhisper (int32 textId, uint64 receiver, bool IsBossWhisper=false)
 
void MonsterYellToZone (int32 textId, uint32 language, uint64 TargetGuid)
 
void BuildMonsterChat (WorldPacket *data, uint8 msgtype, char const *text, uint32 language, char const *name, uint64 TargetGuid) const
 
void PlayDistanceSound (uint32 sound_id, Player *target=NULL)
 
void PlayDirectSound (uint32 sound_id, Player *target=NULL)
 
void SendObjectDeSpawnAnim (uint64 guid)
 
void SendObjectCustomAnim (uint64 guid, uint32 anim=0)
 
virtual void SaveRespawnTime ()
 
void AddObjectToRemoveList ()
 
virtual bool isValid () const
 
virtual bool IsNeverVisible () const
 
virtual bool IsAlwaysVisibleFor (WorldObject const *) const
 
virtual bool IsInvisibleDueToDespawn () const
 
virtual bool IsAlwaysDetectableFor (WorldObject const *) const
 
float GetGridActivationRange () const
 
float GetVisibilityRange () const
 
float GetSightRange (const WorldObject *target=NULL) const
 
bool CanSeeOrDetect (WorldObject const *obj, bool ignoreStealth=false, bool distanceCheck=false, bool checkAlert=false) const
 
void SendPlaySound (uint32 Sound, bool OnlySelf)
 
virtual void SetMap (Map *map)
 
virtual void ResetMap ()
 
MapGetMap () const
 
MapFindMap () const
 
Map const * GetBaseMap () const
 
void SetZoneScript ()
 
TempSummonSummonCreature (uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0)
 
TempSummonSummonCreature (uint32 id, float x, float y, float z, float ang, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0)
 
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)
 
GameObjectFindNearestGameObject (uint32 entry, float range)
 
GameObjectFindNearestGameObjectOfType (GameobjectTypes type, float range) const
 
void GetGameObjectListWithEntryInGrid (std::list< GameObject * > &gameobjectList, uint32 entry=GRID_SEARCH_ALL_ENTRIES, float maxSearchRange=250.0f) const
 
void GetCreatureListWithEntryInGrid (std::list< Creature * > &creatureList, uint32 entry=GRID_SEARCH_ALL_ENTRIES, float maxSearchRange=250.0f) const
 
void DestroyForNearbyPlayers ()
 
virtual void UpdateObjectVisibility (bool forced=true)
 
virtual void UpdateObjectVisibilityOnCreate ()
 
void BuildUpdate (UpdateDataMapType &) 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)
 
bool IsVisibilityOverridden () const
 
void SetVisibilityDistanceOverride (VisibilityDistanceType type)
 
void SetWorldObject (bool apply)
 
bool IsPermanentWorldObject () const
 
bool IsWorldObject () const
 
template<class NOTIFIER >
void VisitNearbyWorldObject (const float &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyObject (float const &radius, NOTIFIER &notifier) const
 
template<class NOTIFIER >
void VisitNearbyGridObject (float const &radius, NOTIFIER &notifier) const
 
- Public Member Functions inherited from Object
virtual ~Object ()
 
const bool & IsInWorld () const
 
uint64 GetGUID () const
 
uint32 GetGUIDLow () const
 
uint32 GetGUIDMid () const
 
uint32 GetGUIDHigh () const
 
PackedGuid const & GetPackGUID () const
 
ObjectGuid const & GetObjectGUID () const
 
std::string GetGuidStr () const
 
uint32 GetEntry () const
 
void SetEntry (uint32 entry)
 
float GetObjectScale () const
 
void SetObjectScale (float scale)
 
uint8 GetTypeId () const
 
bool isType (uint16 mask) const
 
virtual void BuildCreateUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void SendUpdateToPlayer (Player *player)
 
void BuildValuesUpdateBlockForPlayer (UpdateData *data, Player *target) const
 
void BuildOutOfRangeUpdateBlock (UpdateData *data) const
 
void BuildMovementUpdateBlock (UpdateData *data, uint32 flags=0) const
 
virtual void DestroyForPlayer (Player *target, bool onDeath=false) const
 
const int32GetInt32Value (uint16 index) const
 
const uint32GetUInt32Value (uint16 index) const
 
const uint64GetUInt64Value (uint16 index) const
 
const float & GetFloatValue (uint16 index) const
 
uint8 GetByteValue (uint16 index, uint8 offset) const
 
ObjectGuid const & GetGuidValue (uint16 index) const
 
uint16 GetUInt16Value (uint16 index, uint8 offset) const
 
void SetInt32Value (uint16 index, int32 value)
 
void SetUInt32Value (uint16 index, uint32 value)
 
void SetUInt64Value (uint16 index, const 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 SetStatFloatValue (uint16 index, float value)
 
void SetStatInt32Value (uint16 index, int32 value)
 
bool AddUInt64Value (uint16 index, const uint64 &value)
 
bool RemoveUInt64Value (uint16 index, const uint64 &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 SetByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void RemoveByteFlag (uint16 index, uint8 offset, uint8 newFlag)
 
void ToggleFlag (uint16 index, uint8 offset, uint8 flag)
 
bool HasByteFlag (uint16 index, uint8 offset, uint8 flag) const
 
void ApplyModFlag (uint16 index, uint32 flag, bool apply)
 
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)
 
bool LoadValues (const char *data)
 
uint16 GetValuesCount () const
 
virtual bool hasQuest (uint32) const
 
virtual bool hasInvolvedQuest (uint32) const
 
void BuildFieldsUpdate (Player *, UpdateDataMapType &) const
 
void ForceValuesUpdateAtIndex (uint32)
 
PlayerToPlayer ()
 
Player const * ToPlayer () const
 
CreatureToCreature ()
 
Creature const * ToCreature () const
 
UnitToUnit ()
 
Unit const * ToUnit () const
 
GameObjectToGameObject ()
 
GameObject const * ToGameObject () const
 
CorpseToCorpse ()
 
Corpse const * ToCorpse () const
 
DynamicObjectToDynObject ()
 
DynamicObject const * ToDynObject () const
 
- Public Member Functions inherited from WorldLocation
 WorldLocation (uint32 _mapid=MAPID_INVALID, float _x=0, float _y=0, float _z=0, float _o=0)
 
 WorldLocation (const WorldLocation &loc)
 
void WorldRelocate (const WorldLocation &loc)
 
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 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 >
bool IsInGrid () const
 
void AddToGrid (GridRefManager< DynamicObject > &m)
 
void RemoveFromGrid ()
 

Protected Attributes

uint64 m_casterGuid
 
uint32 m_spellId
 
uint32 m_effIndex
 
int32 m_aliveDuration
 
uint32 m_updateTimer
 
time_t m_nextThinkTime
 
float m_radius
 
AffectedSet m_affected
 
- Protected Attributes inherited from WorldObject
std::string m_name
 
bool m_isActive
 
const bool m_isWorldObject
 
ZoneScriptm_zoneScript
 
float m_visibilityDistanceOverride
 
- Protected Attributes inherited from Object
uint16 m_objectType
 
uint8 m_objectTypeId
 
uint8 m_updateFlag
 
union {
   int32 *   m_int32Values
 
   uint32 *   m_uint32Values
 
   float *   m_floatValues
 
}; 
 
uint32m_uint32Values_mirror
 
uint16 m_valuesCount
 
bool m_objectUpdated
 

Additional Inherited Members

- Static Public Member Functions inherited from WorldObject
static bool InSamePhase (WorldObject const *a, WorldObject const *b)
 
- 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 m_groupLootTimer
 
uint64 lootingGroupLeaderGUID
 
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)
 
- Protected Member Functions inherited from Object
 Object ()
 
void _InitValues ()
 
void _Create (uint32 guidlow, uint32 entry, HighGuid guidhigh)
 
void _LoadIntoDataField (const char *data, uint32 startOffset, uint32 count)
 
virtual void _SetUpdateBits (UpdateMask *updateMask, Player *target) const
 
virtual void _SetCreateBits (UpdateMask *updateMask, Player *target) const
 
void _BuildMovementUpdate (ByteBuffer *data, uint8 updateFlags) const
 
void _BuildValuesUpdate (uint8 updatetype, ByteBuffer *data, UpdateMask *updateMask, Player *target) const
 

Detailed Description

Definition at line 26 of file DynamicObject.h.

Member Typedef Documentation

typedef std::set<Unit*> DynamicObject::AffectedSet

Definition at line 29 of file DynamicObject.h.

Constructor & Destructor Documentation

Member Function Documentation

void DynamicObject::AddAffected ( Unit unit)
inline

Definition at line 63 of file DynamicObject.h.

References m_affected.

64  {
65  m_affected.insert(unit);
66  }
AffectedSet m_affected
void DynamicObject::AddToWorld ( )
overridevirtual

Reimplemented from Object.

Definition at line 42 of file DynamicObject.cpp.

References ObjectAccessor::AddObject(), Object::AddToWorld(), Oregon::Singleton< ObjectAccessor, Oregon::ClassLevelLockable< ObjectAccessor, ACE_Thread_Mutex > >::Instance(), and Object::IsInWorld().

43 {
44  // Register the dynamicObject for guid lookup
45  if (!IsInWorld())
46  {
49  }
50 }
void AddObject(T *object)
const bool & IsInWorld() const
Definition: Object.h:150
virtual void AddToWorld()
Definition: Object.h:154
bool DynamicObject::CreateDynamicObject ( uint32  guidlow,
Unit caster,
uint32  spellId,
uint32  effIndex,
const Position pos,
int32  duration,
float  radius 
)

Definition at line 72 of file DynamicObject.cpp.

References WorldObject::_Create(), DYNAMICOBJECT_BYTES, DYNAMICOBJECT_CASTER, DYNAMICOBJECT_CASTTIME, DYNAMICOBJECT_RADIUS, DYNAMICOBJECT_SPELLID, Object::GetGUID(), WorldObject::GetMap(), getMSTime(), WorldObject::GetPhaseMask(), Position::GetPositionX(), Position::GetPositionY(), HIGHGUID_DYNAMICOBJECT, Position::IsPositionValid(), WorldObject::IsWorldObject(), m_aliveDuration, m_casterGuid, m_effIndex, m_radius, m_spellId, m_updateTimer, Position::Relocate(), WorldObject::setActive(), Object::SetByteValue(), Object::SetEntry(), Object::SetFloatValue(), WorldObject::SetMap(), Object::SetObjectScale(), Object::SetUInt32Value(), Object::SetUInt64Value(), and sLog.

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

73 {
74  SetMap(caster->GetMap());
75  Relocate(pos);
76  if (!IsPositionValid())
77  {
78  sLog.outError("DynamicObject (spell %u eff %u) not created. Suggested coordinates isn't valid (X: %f Y: %f)", spellId, effIndex, GetPositionX(), GetPositionY());
79  return false;
80  }
81 
83 
84  SetEntry(spellId);
85  SetObjectScale(1);
87 
88  // The lower word of DYNAMICOBJECT_BYTES must be 0x0001. This value means that the visual radius will be overriden
89  // by client for most of the "ground patch" visual effect spells and a few "skyfall" ones like Hurricane.
90  // If any other value is used, the client will _always_ use the radius provided in DYNAMICOBJECT_RADIUS, but
91  // precompensation is necessary (eg radius *= 2) for many spells. Anyway, blizz sends 0x0001 for all the spells
92  // I saw sniffed...
93  SetByteValue(DYNAMICOBJECT_BYTES, 0, 0x00000001);
97 
98  if (IsWorldObject())
99  setActive(true); //must before add to map to be put in world container
100 
101  if (!GetMap()->AddToMap(this))
102  return false;
103 
104  m_aliveDuration = duration;
105  m_radius = radius;
106  m_effIndex = effIndex;
107  m_spellId = spellId;
108  m_casterGuid = caster->GetGUID();
109  m_updateTimer = 0;
110 
111  return true;
112 }
void _Create(uint32 guidlow, HighGuid guidhigh, uint32 phaseMask)
Definition: Object.cpp:1185
uint32 m_updateTimer
Map * GetMap() const
Definition: Object.h:817
void SetObjectScale(float scale)
Definition: Object.h:190
void setActive(bool isActiveObject)
Definition: Object.cpp:1122
virtual void SetMap(Map *map)
Definition: Object.cpp:1981
uint32 getMSTime()
Definition: Timer.h:32
#define sLog
Log class singleton.
Definition: Log.h:187
void SetUInt32Value(uint16 index, uint32 value)
Definition: Object.cpp:777
bool IsWorldObject() const
Definition: Object.cpp:1111
void SetEntry(uint32 entry)
Definition: Object.h:187
uint64 m_casterGuid
uint64 GetGUID() const
Definition: Object.h:177
void Relocate(float x, float y)
Definition: Position.h:65
uint32 GetPhaseMask() const
Definition: Object.h:670
float GetPositionY() const
Definition: Position.h:98
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition: Object.cpp:876
int32 m_aliveDuration
void SetUInt64Value(uint16 index, const uint64 &value)
Definition: Object.cpp:796
void SetFloatValue(uint16 index, float value)
Definition: Object.cpp:857
bool IsPositionValid() const
Definition: Position.cpp:40
float GetPositionX() const
Definition: Position.h:97
void DynamicObject::Delay ( int32  delaytime)

Definition at line 165 of file DynamicObject.cpp.

References m_affected, m_aliveDuration, m_effIndex, and m_spellId.

Referenced by Spell::DelayedChannel(), and RemoveAffected().

166 {
167  m_aliveDuration -= delaytime;
168  for (AffectedSet::iterator iunit = m_affected.begin(); iunit != m_affected.end(); ++iunit)
169  if (*iunit)
170  (*iunit)->DelayAura(m_spellId, m_effIndex, delaytime);
171 }
AffectedSet m_affected
int32 m_aliveDuration
Unit * DynamicObject::GetCaster ( ) const

Definition at line 114 of file DynamicObject.cpp.

References GetCasterGUID(), and ObjectAccessor::GetUnit().

Referenced by GetCasterGUID(), RemoveFromWorld(), Update(), and Oregon::MessageDistDeliverer::Visit().

115 {
116  // can be not found in some cases
117  return ObjectAccessor::GetUnit(*this, GetCasterGUID());
118 }
uint64 GetCasterGUID() const
Definition: DynamicObject.h:50
static Unit * GetUnit(WorldObject const &, uint64 guid)
uint64 DynamicObject::GetCasterGUID ( ) const
inline

Definition at line 50 of file DynamicObject.h.

References GetCaster(), and m_casterGuid.

Referenced by GetCaster().

51  {
52  return m_casterGuid;
53  }
uint64 m_casterGuid
uint32 DynamicObject::GetDuration ( ) const
inline

Definition at line 46 of file DynamicObject.h.

References m_aliveDuration.

47  {
48  return m_aliveDuration;
49  }
int32 m_aliveDuration
uint32 DynamicObject::GetEffIndex ( ) const
inline

Definition at line 42 of file DynamicObject.h.

References m_effIndex.

Referenced by Unit::GetDynObject().

43  {
44  return m_effIndex;
45  }
float DynamicObject::GetRadius ( ) const
inline

Definition at line 55 of file DynamicObject.h.

References m_radius.

Referenced by Update(), and PersistentAreaAura::Update().

56  {
57  return m_radius;
58  }
uint32 DynamicObject::GetSpellId ( ) const
inline

Definition at line 38 of file DynamicObject.h.

References m_spellId.

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

39  {
40  return m_spellId;
41  }
bool DynamicObject::IsAffecting ( Unit unit) const
inline

Definition at line 59 of file DynamicObject.h.

References m_affected.

60  {
61  return m_affected.find(unit) != m_affected.end();
62  }
AffectedSet m_affected
void DynamicObject::Remove ( )

Definition at line 155 of file DynamicObject.cpp.

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

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

156 {
157  if (IsInWorld())
158  {
160  RemoveFromWorld();
162  }
163 }
uint64 GetGUID() const
Definition: Object.h:177
const bool & IsInWorld() const
Definition: Object.h:150
void AddObjectToRemoveList()
Definition: Object.cpp:2017
void SendObjectDeSpawnAnim(uint64 guid)
Definition: Object.cpp:1966
void RemoveFromWorld() override
void DynamicObject::RemoveAffected ( Unit unit)
inline

Definition at line 67 of file DynamicObject.h.

References Delay(), and m_affected.

Referenced by Aura::_RemoveAura().

68  {
69  m_affected.erase(unit);
70  }
AffectedSet m_affected
void DynamicObject::RemoveFromWorld ( )
overridevirtual

Reimplemented from WorldObject.

Definition at line 52 of file DynamicObject.cpp.

References GetCaster(), Oregon::Singleton< ObjectAccessor, Oregon::ClassLevelLockable< ObjectAccessor, ACE_Thread_Mutex > >::Instance(), Object::IsInWorld(), WorldObject::m_isWorldObject, WorldObject::RemoveFromWorld(), ObjectAccessor::RemoveObject(), sLog, and TYPEID_PLAYER.

Referenced by Remove().

53 {
54  // Remove the dynamicObject from the accessor
55  if (IsInWorld())
56  {
57  if (m_isWorldObject)
58  {
59  if (Unit* caster = GetCaster())
60  {
61  if (caster->GetTypeId() == TYPEID_PLAYER)
62  caster->ToPlayer()->SetViewpoint(this, false);
63  }
64  else
65  sLog.outError("Crash alert! DynamicObject::RemoveFromWorld cannot find viewpoint owner");
66  }
69  }
70 }
const bool m_isWorldObject
Definition: Object.h:896
Unit * GetCaster() const
#define sLog
Log class singleton.
Definition: Log.h:187
const bool & IsInWorld() const
Definition: Object.h:150
virtual void RemoveFromWorld() override
Definition: Object.cpp:1192
void RemoveObject(T *object)
Definition: Unit.h:908
void DynamicObject::Say ( const char *  text,
uint32  language,
uint64  TargetGuid 
)
inline

Definition at line 73 of file DynamicObject.h.

References WorldObject::MonsterSay().

74  {
75  MonsterSay(text, language, TargetGuid);
76  }
void MonsterSay(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1513
void DynamicObject::Say ( int32  textId,
uint32  language,
uint64  TargetGuid 
)
inline

Definition at line 89 of file DynamicObject.h.

References WorldObject::MonsterSay().

90  {
91  MonsterSay(textId, language, TargetGuid);
92  }
void MonsterSay(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1513
void DynamicObject::TextEmote ( const char *  text,
uint64  TargetGuid 
)
inline

Definition at line 81 of file DynamicObject.h.

References WorldObject::MonsterTextEmote().

82  {
83  MonsterTextEmote(text, TargetGuid);
84  }
void MonsterTextEmote(const char *text, uint64 TargetGuid, bool IsBossEmote=false)
Definition: Object.cpp:1527
void DynamicObject::TextEmote ( int32  textId,
uint64  TargetGuid 
)
inline

Definition at line 97 of file DynamicObject.h.

References WorldObject::MonsterTextEmote().

98  {
99  MonsterTextEmote(textId, TargetGuid);
100  }
void MonsterTextEmote(const char *text, uint64 TargetGuid, bool IsBossEmote=false)
Definition: Object.cpp:1527
void DynamicObject::Update ( uint32  p_time)
overridevirtual

Reimplemented from WorldObject.

Definition at line 120 of file DynamicObject.cpp.

References GetCaster(), Object::GetGUID(), GetRadius(), m_aliveDuration, m_effIndex, m_updateTimer, Remove(), Unit::RemoveDynObjectWithGUID(), and WorldObject::VisitNearbyObject().

121 {
122  // caster can be not in world at time dynamic object update, but dynamic object not yet deleted in Unit destructor
123  Unit* caster = GetCaster();
124  if (!caster)
125  {
126  Remove();
127  return;
128  }
129 
130  bool expired = false;
131 
132  if (m_aliveDuration > int32(p_time))
133  m_aliveDuration -= p_time;
134  else
135  expired = true;
136 
137  if (m_effIndex < 4)
138  {
139  if (m_updateTimer < p_time)
140  {
141  Oregon::DynamicObjectUpdater notifier(*this, caster);
142  VisitNearbyObject(GetRadius(), notifier);
143  m_updateTimer = 500; // is this official-like?
144  }
145  else m_updateTimer -= p_time;
146  }
147 
148  if (expired)
149  {
150  caster->RemoveDynObjectWithGUID(GetGUID());
151  Remove();
152  }
153 }
uint32 m_updateTimer
Unit * GetCaster() const
ACE_INT32 int32
Definition: Define.h:67
void VisitNearbyObject(float const &radius, NOTIFIER &notifier) const
Definition: Object.h:884
uint64 GetGUID() const
Definition: Object.h:177
int32 m_aliveDuration
float GetRadius() const
Definition: DynamicObject.h:55
void RemoveDynObjectWithGUID(uint64 guid)
Definition: Unit.h:1808
Definition: Unit.h:908
void DynamicObject::Whisper ( const char *  text,
uint64  receiver 
)
inline

Definition at line 85 of file DynamicObject.h.

References WorldObject::MonsterWhisper().

86  {
87  MonsterWhisper(text, receiver);
88  }
void MonsterWhisper(const char *text, uint64 receiver, bool IsBossWhisper=false)
Definition: Object.cpp:1534
void DynamicObject::Whisper ( int32  textId,
uint64  receiver 
)
inline

Definition at line 101 of file DynamicObject.h.

References WorldObject::MonsterWhisper().

102  {
103  MonsterWhisper(textId, receiver);
104  }
void MonsterWhisper(const char *text, uint64 receiver, bool IsBossWhisper=false)
Definition: Object.cpp:1534
void DynamicObject::Yell ( const char *  text,
uint32  language,
uint64  TargetGuid 
)
inline

Definition at line 77 of file DynamicObject.h.

References WorldObject::MonsterYell().

78  {
79  MonsterYell(text, language, TargetGuid);
80  }
void MonsterYell(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1520
void DynamicObject::Yell ( int32  textId,
uint32  language,
uint64  TargetGuid 
)
inline

Definition at line 93 of file DynamicObject.h.

References WorldObject::MonsterYell().

94  {
95  MonsterYell(textId, language, TargetGuid);
96  }
void MonsterYell(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1520

Member Data Documentation

AffectedSet DynamicObject::m_affected
protected

Definition at line 114 of file DynamicObject.h.

Referenced by AddAffected(), Delay(), IsAffecting(), and RemoveAffected().

int32 DynamicObject::m_aliveDuration
protected

Definition at line 110 of file DynamicObject.h.

Referenced by CreateDynamicObject(), Delay(), GetDuration(), and Update().

uint64 DynamicObject::m_casterGuid
protected

Definition at line 107 of file DynamicObject.h.

Referenced by CreateDynamicObject(), and GetCasterGUID().

uint32 DynamicObject::m_effIndex
protected

Definition at line 109 of file DynamicObject.h.

Referenced by CreateDynamicObject(), Delay(), GetEffIndex(), and Update().

time_t DynamicObject::m_nextThinkTime
protected

Definition at line 112 of file DynamicObject.h.

float DynamicObject::m_radius
protected

Definition at line 113 of file DynamicObject.h.

Referenced by CreateDynamicObject(), and GetRadius().

uint32 DynamicObject::m_spellId
protected

Definition at line 108 of file DynamicObject.h.

Referenced by CreateDynamicObject(), Delay(), and GetSpellId().

uint32 DynamicObject::m_updateTimer
protected

Definition at line 111 of file DynamicObject.h.

Referenced by CreateDynamicObject(), and Update().


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