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

Revision 102, 3.2 kB (checked in by yumileroy, 17 years ago)

[svn] Fixed copyright notices to comply with GPL.

Original author: w12x
Date: 2008-10-23 03:29:52-05:00

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