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 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_DYNAMICOBJECT_H
19#define TRINITYCORE_DYNAMICOBJECT_H
20
21#include "Object.h"
22#include "GridObject.h"
23#include "MapObject.h"
24
25class Unit;
26class Aura;
27class SpellInfo;
28
30{
31 DYNAMIC_OBJECT_PORTAL = 0x0, // unused
34};
35
36class TC_GAME_API DynamicObject : public WorldObject, public GridObject<DynamicObject>, public MapObject
37{
38 public:
39 DynamicObject(bool isWorldObject);
41
42 void AddToWorld() override;
43 void RemoveFromWorld() override;
44
45 bool CreateDynamicObject(ObjectGuid::LowType guidlow, Unit* caster, SpellInfo const* spell, Position const& pos, float radius, DynamicObjectType type);
46 void Update(uint32 p_time) override;
47 void Remove();
48 void SetDuration(int32 newDuration);
49 int32 GetDuration() const;
50 void Delay(int32 delaytime);
51 void SetAura(Aura* aura);
52 void RemoveAura();
53 void SetCasterViewpoint();
54 void RemoveCasterViewpoint();
55 Unit* GetCaster() const { return _caster; }
56 uint32 GetFaction() const override;
57 void BindToCaster();
58 void UnbindFromCaster();
60 SpellInfo const* GetSpellInfo() const;
62 ObjectGuid GetOwnerGUID() const override { return GetCasterGUID(); }
63 float GetRadius() const { return GetFloatValue(DYNAMICOBJECT_RADIUS); }
64
65 protected:
69 int32 _duration; // for non-aura dynobjects
71};
72#endif
#define TC_GAME_API
Definition: Define.h:114
int32_t int32
Definition: Define.h:129
uint32_t uint32
Definition: Define.h:133
DynamicObjectType
Definition: DynamicObject.h:30
@ DYNAMIC_OBJECT_PORTAL
Definition: DynamicObject.h:31
@ DYNAMIC_OBJECT_FARSIGHT_FOCUS
Definition: DynamicObject.h:33
@ DYNAMIC_OBJECT_AREA_SPELL
Definition: DynamicObject.h:32
@ DYNAMICOBJECT_RADIUS
Definition: UpdateFields.h:413
@ DYNAMICOBJECT_CASTER
Definition: UpdateFields.h:410
@ DYNAMICOBJECT_SPELLID
Definition: UpdateFields.h:412
Unit * GetCaster() const
Definition: DynamicObject.h:55
ObjectGuid GetOwnerGUID() const override
Definition: DynamicObject.h:62
uint32 GetSpellId() const
Definition: DynamicObject.h:59
ObjectGuid GetCasterGUID() const
Definition: DynamicObject.h:61
Aura * _removedAura
Definition: DynamicObject.h:67
float GetRadius() const
Definition: DynamicObject.h:63
uint32 LowType
Definition: ObjectGuid.h:134
uint32 GetUInt32Value(uint16 index) const
Definition: Object.cpp:250
float GetFloatValue(uint16 index) const
Definition: Object.cpp:262
ObjectGuid GetGuidValue(uint16 index) const
Definition: Object.cpp:282
Definition: Unit.h:769
void AddToWorld() override
Definition: Object.cpp:1053
void RemoveFromWorld() override
Definition: Object.cpp:1059
virtual uint32 GetFaction() const =0
virtual void Update(uint32)
Definition: Object.h:342
Definition: wmo.h:161
void Remove(Player *p)