OregonCore  revision be9e804-git
Your Favourite TBC server
DynamicObject.h
Go to the documentation of this file.
1 /*
2  * This file is part of the OregonCore 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 <https://www.gnu.org/licenses/>.
16  */
17 
18 #ifndef OREGONCORE_DYNAMICOBJECT_H
19 #define OREGONCORE_DYNAMICOBJECT_H
20 
21 #include "Object.h"
22 
23 class Unit;
24 struct SpellEntry;
25 
26 class DynamicObject : public WorldObject, public GridObject<DynamicObject>
27 {
28  public:
29  typedef std::set<Unit*> AffectedSet;
30  explicit DynamicObject(bool isWorldObject);
31 
32  void AddToWorld() override;
33  void RemoveFromWorld() override;
34 
35  bool CreateDynamicObject(uint32 guidlow, Unit* caster, uint32 spellId, uint32 effIndex, const Position& pos, int32 duration, float radius);
36  void Update(uint32 p_time) override;
37  void Remove();
39  {
40  return m_spellId;
41  }
43  {
44  return m_effIndex;
45  }
47  {
48  return m_aliveDuration;
49  }
51  {
52  return m_casterGuid;
53  }
54  Unit* GetCaster() const;
55  float GetRadius() const
56  {
57  return m_radius;
58  }
59  bool IsAffecting(Unit* unit) const
60  {
61  return m_affected.find(unit) != m_affected.end();
62  }
63  void AddAffected(Unit* unit)
64  {
65  m_affected.insert(unit);
66  }
67  void RemoveAffected(Unit* unit)
68  {
69  m_affected.erase(unit);
70  }
71  void Delay(int32 delaytime);
72 
73  void Say(const char* text, uint32 language, uint64 TargetGuid)
74  {
75  MonsterSay(text, language, TargetGuid);
76  }
77  void Yell(const char* text, uint32 language, uint64 TargetGuid)
78  {
79  MonsterYell(text, language, TargetGuid);
80  }
81  void TextEmote(const char* text, uint64 TargetGuid)
82  {
83  MonsterTextEmote(text, TargetGuid);
84  }
85  void Whisper(const char* text, uint64 receiver)
86  {
87  MonsterWhisper(text, receiver);
88  }
89  void Say(int32 textId, uint32 language, uint64 TargetGuid)
90  {
91  MonsterSay(textId, language, TargetGuid);
92  }
93  void Yell(int32 textId, uint32 language, uint64 TargetGuid)
94  {
95  MonsterYell(textId, language, TargetGuid);
96  }
97  void TextEmote(int32 textId, uint64 TargetGuid)
98  {
99  MonsterTextEmote(textId, TargetGuid);
100  }
101  void Whisper(int32 textId, uint64 receiver)
102  {
103  MonsterWhisper(textId, receiver);
104  }
105 
106  protected:
113  float m_radius;
114  AffectedSet m_affected;
115 };
116 #endif
117 
AffectedSet m_affected
uint32 m_updateTimer
uint32 GetSpellId() const
Definition: DynamicObject.h:38
void Yell(const char *text, uint32 language, uint64 TargetGuid)
Definition: DynamicObject.h:77
uint32 GetDuration() const
Definition: DynamicObject.h:46
Unit * GetCaster() const
std::set< Unit * > AffectedSet
Definition: DynamicObject.h:29
void MonsterTextEmote(const char *text, uint64 TargetGuid, bool IsBossEmote=false)
Definition: Object.cpp:1527
void MonsterSay(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1513
void Say(int32 textId, uint32 language, uint64 TargetGuid)
Definition: DynamicObject.h:89
ACE_INT32 int32
Definition: Define.h:67
void MonsterYell(const char *text, uint32 language, uint64 TargetGuid)
Definition: Object.cpp:1520
void Yell(int32 textId, uint32 language, uint64 TargetGuid)
Definition: DynamicObject.h:93
void AddAffected(Unit *unit)
Definition: DynamicObject.h:63
uint64 m_casterGuid
void MonsterWhisper(const char *text, uint64 receiver, bool IsBossWhisper=false)
Definition: Object.cpp:1534
void Say(const char *text, uint32 language, uint64 TargetGuid)
Definition: DynamicObject.h:73
bool IsAffecting(Unit *unit) const
Definition: DynamicObject.h:59
void AddToWorld() override
bool CreateDynamicObject(uint32 guidlow, Unit *caster, uint32 spellId, uint32 effIndex, const Position &pos, int32 duration, float radius)
DynamicObject(bool isWorldObject)
void Update(uint32 p_time) override
int32 m_aliveDuration
void TextEmote(int32 textId, uint64 TargetGuid)
Definition: DynamicObject.h:97
void Whisper(const char *text, uint64 receiver)
Definition: DynamicObject.h:85
ACE_UINT64 uint64
Definition: Define.h:70
void Delay(int32 delaytime)
float GetRadius() const
Definition: DynamicObject.h:55
void Whisper(int32 textId, uint64 receiver)
uint64 GetCasterGUID() const
Definition: DynamicObject.h:50
time_t m_nextThinkTime
uint32 GetEffIndex() const
Definition: DynamicObject.h:42
void TextEmote(const char *text, uint64 TargetGuid)
Definition: DynamicObject.h:81
void RemoveFromWorld() override
ACE_UINT32 uint32
Definition: Define.h:71
Definition: Unit.h:908
void RemoveAffected(Unit *unit)
Definition: DynamicObject.h:67