TrinityCore
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Modules Pages
DynamicObject.h
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2008-2016 TrinityCore <http://www.trinitycore.org/>
3  * Copyright (C) 2005-2009 MaNGOS <http://getmangos.com/>
4  *
5  * This program is free software; you can redistribute it and/or modify it
6  * under the terms of the GNU General Public License as published by the
7  * Free Software Foundation; either version 2 of the License, or (at your
8  * option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful, but WITHOUT
11  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13  * more details.
14  *
15  * You should have received a copy of the GNU General Public License along
16  * with this program. If not, see <http://www.gnu.org/licenses/>.
17  */
18 
19 #ifndef TRINITYCORE_DYNAMICOBJECT_H
20 #define TRINITYCORE_DYNAMICOBJECT_H
21 
22 #include "Object.h"
23 
24 class Unit;
25 class Aura;
26 class SpellInfo;
27 
29 {
30  DYNAMIC_OBJECT_PORTAL = 0x0, // unused
33 };
34 
35 class TC_GAME_API DynamicObject : public WorldObject, public GridObject<DynamicObject>, public MapObject
36 {
37  public:
38  DynamicObject(bool isWorldObject);
39  ~DynamicObject();
40 
41  void AddToWorld() override;
42  void RemoveFromWorld() override;
43 
44  bool CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type);
45  void Update(uint32 p_time) override;
46  void Remove();
47  void SetDuration(int32 newDuration);
48  int32 GetDuration() const;
49  void Delay(int32 delaytime);
50  void SetAura(Aura* aura);
51  void RemoveAura();
52  void SetCasterViewpoint();
53  void RemoveCasterViewpoint();
54  Unit* GetCaster() const { return _caster; }
55  void BindToCaster();
56  void UnbindFromCaster();
59  float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
60 
61  protected:
65  int32 _duration; // for non-aura dynobjects
67 };
68 #endif
bool Remove(ContainerUnorderedMap< SPECIFIC_TYPE, KEY_TYPE > &elements, KEY_TYPE const &handle, SPECIFIC_TYPE *)
Definition: TypeContainerFunctions.h:104
Definition: UpdateFields.h:342
uint32 GetSpellId() const
Definition: DynamicObject.h:57
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:300
Unit * _caster
Definition: DynamicObject.h:64
Definition: SpellInfo.h:326
Aura * _removedAura
Definition: DynamicObject.h:63
Definition: UpdateFields.h:340
Definition: Object.h:355
DynamicObjectType
Definition: DynamicObject.h:28
Aura * _aura
Definition: DynamicObject.h:62
Definition: Object.h:423
Definition: UpdateFields.h:343
uint64 LowType
Definition: ObjectGuid.h:199
Definition: DynamicObject.h:35
Definition: DynamicObject.h:31
Definition: Object.h:398
virtual void RemoveFromWorld() override
Definition: Object.cpp:1515
float GetFloatValue(uint16 index) const
Definition: Object.cpp:312
int32_t int32
Definition: Define.h:146
uint32_t uint32
Definition: Define.h:150
ObjectGuid const & GetGuidValue(uint16 index) const
Definition: Object.cpp:332
ObjectGuid GetCasterGUID() const
Definition: DynamicObject.h:58
virtual void AddToWorld()
Definition: Object.cpp:142
bool _isViewpoint
Definition: DynamicObject.h:66
#define TC_GAME_API
Definition: Define.h:134
float GetRadius() const
Definition: DynamicObject.h:59
Definition: Position.h:27
Definition: DynamicObject.h:32
Definition: ObjectGuid.h:189
Unit * GetCaster() const
Definition: DynamicObject.h:54
Definition: SpellAuras.h:116
Definition: Unit.h:1305
Definition: DynamicObject.h:30
void Update(uint32 diff)
Definition: WeatherMgr.cpp:150
int32 _duration
Definition: DynamicObject.h:65