[6982] Implemented gmlevel-based command security
[getmangos.git] / src / game / DynamicObject.h
blob9662397d2431d44f96c99c661029cbeb2ed6ea97
1 /*
2 * Copyright (C) 2005-2008 MaNGOS <http://getmangos.com/>
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation; either version 2 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program; if not, write to the Free Software
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
19 #ifndef MANGOSSERVER_DYNAMICOBJECT_H
20 #define MANGOSSERVER_DYNAMICOBJECT_H
22 #include "Object.h"
24 class Unit;
25 struct SpellEntry;
27 class DynamicObject : public WorldObject
29 public:
30 typedef std::set<Unit*> AffectedSet;
31 explicit DynamicObject();
33 void AddToWorld();
34 void RemoveFromWorld();
36 bool Create(uint32 guidlow, Unit *caster, uint32 spellId, uint32 effIndex, float x, float y, float z, int32 duration, float radius);
37 void Update(uint32 p_time);
38 void Delete();
39 uint32 GetSpellId() const { return m_spellId; }
40 uint32 GetEffIndex() const { return m_effIndex; }
41 uint32 GetDuration() const { return m_aliveDuration; }
42 uint64 GetCasterGUID() const { return m_casterGuid; }
43 Unit* GetCaster() const;
44 float GetRadius() const { return m_radius; }
45 bool IsAffecting(Unit *unit) const { return m_affected.find(unit) != m_affected.end(); }
46 void AddAffected(Unit *unit) { m_affected.insert(unit); }
47 void RemoveAffected(Unit *unit) { m_affected.erase(unit); }
48 void Delay(int32 delaytime);
49 bool isVisibleForInState(Player const* u, bool inVisibleList) const;
51 void Say(const char* text, uint32 language, uint64 TargetGuid) { MonsterSay(text,language,TargetGuid); }
52 void Yell(const char* text, uint32 language, uint64 TargetGuid) { MonsterYell(text,language,TargetGuid); }
53 void TextEmote(const char* text, uint64 TargetGuid) { MonsterTextEmote(text,TargetGuid); }
54 void Whisper(const char* text, uint64 receiver) { MonsterWhisper(text,receiver); }
55 void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); }
56 void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); }
57 void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); }
58 void Whisper(int32 textId,uint64 receiver) { MonsterWhisper(textId,receiver); }
60 GridReference<DynamicObject> &GetGridRef() { return m_gridRef; }
61 protected:
62 uint64 m_casterGuid;
63 uint32 m_spellId;
64 uint32 m_effIndex;
65 int32 m_aliveDuration;
66 time_t m_nextThinkTime;
67 float m_radius;
68 AffectedSet m_affected;
69 private:
70 GridReference<DynamicObject> m_gridRef;
72 #endif