TrinityCore
Loading...
Searching...
No Matches
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
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
@ DYNAMIC_OBJECT_PORTAL
@ DYNAMIC_OBJECT_FARSIGHT_FOCUS
@ DYNAMIC_OBJECT_AREA_SPELL
@ DYNAMICOBJECT_RADIUS
@ DYNAMICOBJECT_CASTER
@ DYNAMICOBJECT_SPELLID
Unit * GetCaster() const
ObjectGuid GetOwnerGUID() const override
uint32 GetSpellId() const
ObjectGuid GetCasterGUID() const
Aura * _removedAura
float GetRadius() const
uint32 LowType
Definition ObjectGuid.h:142
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:249
float GetFloatValue(uint16 index) const
Definition Object.cpp:261
ObjectGuid GetGuidValue(uint16 index) const
Definition Object.cpp:281
Definition Unit.h:769
void AddToWorld() override
Definition Object.cpp:1060
void RemoveFromWorld() override
Definition Object.cpp:1066
virtual uint32 GetFaction() const =0
virtual void Update(uint32 diff)
Definition Object.cpp:960