root/trunk/src/game/DynamicObject.h @ 9

Revision 2, 3.1 kB (checked in by yumileroy, 17 years ago)

[svn] * Proper SVN structure

Original author: Neo2003
Date: 2008-10-02 16:23:55-05:00

Line 
1/*
2 * Copyright (C) 2005-2008 MaNGOS <http://www.mangosproject.org/>
3 *
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.
8 *
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.
13 *
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
17 */
18
19#ifndef MANGOSSERVER_DYNAMICOBJECT_H
20#define MANGOSSERVER_DYNAMICOBJECT_H
21
22#include "Object.h"
23
24class Unit;
25struct SpellEntry;
26
27class DynamicObject : public WorldObject
28{
29    public:
30        typedef std::set<Unit*> AffectedSet;
31        explicit DynamicObject();
32
33        void AddToWorld();
34        void RemoveFromWorld();
35
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;
50
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); }
59
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;
71};
72#endif
Note: See TracBrowser for help on using the browser.