root/trunk/src/game/GameObject.h @ 215

Revision 145, 27.2 kB (checked in by yumileroy, 17 years ago)

[svn] Add function GameObject::CastSpell?. Used for hunter's trap and so.
Use original caster instead caster to check spell hit result.
Let spell triggers have the same faction as the summoner.
Fix the bug that trigger creatures attack enemy. (no need use civilian extra flag in the future, 128 is enough)
Fix shadow step.

Original author: megamage
Date: 2008-11-02 00:59:44-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_GAMEOBJECT_H
22#define TRINITYCORE_GAMEOBJECT_H
23
24#include "Common.h"
25#include "SharedDefines.h"
26#include "Object.h"
27#include "LootMgr.h"
28#include "Database/DatabaseEnv.h"
29
30// GCC have alternative #pragma pack(N) syntax and old gcc version not support pack(push,N), also any gcc version not support it at some platform
31#if defined( __GNUC__ )
32#pragma pack(1)
33#else
34#pragma pack(push,1)
35#endif
36
37// from `gameobject_template`
38struct GameObjectInfo
39{
40    uint32  id;
41    uint32  type;
42    uint32  displayId;
43    char   *name;
44    char   *castBarCaption;
45    uint32  faction;
46    uint32  flags;
47    float   size;
48    union                                                   // different GO types have different data field
49    {
50        //0 GAMEOBJECT_TYPE_DOOR
51        struct
52        {
53            uint32 startOpen;                               //0 used client side to determine GO_ACTIVATED means open/closed
54            uint32 lockId;                                  //1 -> Lock.dbc
55            uint32 autoCloseTime;                           //2 secs till autoclose = autoCloseTime / 0x10000
56            uint32 noDamageImmune;                          //3 break opening whenever you recieve damage?
57            uint32 openTextID;                              //4 can be used to replace castBarCaption?
58            uint32 closeTextID;                             //5
59        } door;
60        //1 GAMEOBJECT_TYPE_BUTTON
61        struct
62        {
63            uint32 startOpen;                               //0
64            uint32 lockId;                                  //1 -> Lock.dbc
65            uint32 autoCloseTime;                           //2 secs till autoclose = autoCloseTime / 0x10000
66            uint32 linkedTrap;                              //3
67            uint32 noDamageImmune;                          //4 isBattlegroundObject
68            uint32 large;                                   //5
69            uint32 openTextID;                              //6 can be used to replace castBarCaption?
70            uint32 closeTextID;                             //7
71            uint32 losOK;                                   //8
72        } button;
73        //2 GAMEOBJECT_TYPE_QUESTGIVER
74        struct
75        {
76            uint32 lockId;                                  //0 -> Lock.dbc
77            uint32 questList;                               //1
78            uint32 pageMaterial;                            //2
79            uint32 gossipID;                                //3
80            uint32 customAnim;                              //4
81            uint32 noDamageImmune;                          //5
82            uint32 openTextID;                              //6 can be used to replace castBarCaption?
83            uint32 losOK;                                   //7
84            uint32 allowMounted;                            //8
85            uint32 large;                                   //9
86        } questgiver;
87        //3 GAMEOBJECT_TYPE_CHEST
88        struct
89        {
90            uint32 lockId;                                  //0 -> Lock.dbc
91            uint32 lootId;                                  //1
92            uint32 chestRestockTime;                        //2
93            uint32 consumable;                              //3
94            uint32 minSuccessOpens;                         //4
95            uint32 maxSuccessOpens;                         //5
96            uint32 eventId;                                 //6 lootedEvent
97            uint32 linkedTrapId;                            //7
98            uint32 questId;                                 //8 not used currently but store quest required for GO activation for player
99            uint32 level;                                   //9
100            uint32 losOK;                                   //10
101            uint32 leaveLoot;                               //11
102            uint32 notInCombat;                             //12
103            uint32 logLoot;                                 //13
104            uint32 openTextID;                              //14 can be used to replace castBarCaption?
105            uint32 groupLootRules;                          //15
106        } chest;
107        //5 GAMEOBJECT_TYPE_GENERIC
108        struct
109        {
110            uint32 floatingTooltip;                         //0
111            uint32 highlight;                               //1
112            uint32 serverOnly;                              //2
113            uint32 large;                                   //3
114            uint32 floatOnWater;                            //4
115            uint32 questID;                                 //5
116        } _generic;
117        //6 GAMEOBJECT_TYPE_TRAP
118        struct
119        {
120            uint32 lockId;                                  //0 -> Lock.dbc
121            uint32 level;                                   //1
122            uint32 radius;                                  //2 radius for trap activation
123            uint32 spellId;                                 //3
124            uint32 charges;                                 //4 need respawn (if > 0)
125            uint32 cooldown;                                //5 time in secs
126            uint32 autoCloseTime;                           //6
127            uint32 startDelay;                              //7
128            uint32 serverOnly;                              //8
129            uint32 stealthed;                               //9
130            uint32 large;                                   //10
131            uint32 stealthAffected;                         //11
132            uint32 openTextID;                              //12 can be used to replace castBarCaption?
133            uint32 closeTextID;                             //13
134        } trap;
135        //7 GAMEOBJECT_TYPE_CHAIR
136        struct
137        {
138            uint32 slots;                                   //0
139            uint32 height;                                  //1
140            uint32 onlyCreatorUse;                          //2
141        } chair;
142        //8 GAMEOBJECT_TYPE_SPELL_FOCUS
143        struct
144        {
145            uint32 focusId;                                 //0
146            uint32 dist;                                    //1
147            uint32 linkedTrapId;                            //2
148            uint32 serverOnly;                              //3
149            uint32 questID;                                 //4
150            uint32 large;                                   //5
151        } spellFocus;
152        //9 GAMEOBJECT_TYPE_TEXT
153        struct
154        {
155            uint32 pageID;                                  //0
156            uint32 language;                                //1
157            uint32 pageMaterial;                            //2
158            uint32 allowMounted;                            //3
159        } text;
160        //10 GAMEOBJECT_TYPE_GOOBER
161        struct
162        {
163            uint32 lockId;                                  //0 -> Lock.dbc
164            uint32 questId;                                 //1
165            uint32 eventId;                                 //2
166            uint32 autoCloseTime;                           //3
167            uint32 customAnim;                              //4
168            uint32 consumable;                              //5
169            uint32 cooldown;                                //6
170            uint32 pageId;                                  //7
171            uint32 language;                                //8
172            uint32 pageMaterial;                            //9
173            uint32 spellId;                                 //10
174            uint32 noDamageImmune;                          //11
175            uint32 linkedTrapId;                            //12
176            uint32 large;                                   //13
177            uint32 openTextID;                              //14 can be used to replace castBarCaption?
178            uint32 closeTextID;                             //15
179            uint32 losOK;                                   //16 isBattlegroundObject
180            uint32 allowMounted;                            //17
181        } goober;
182        //11 GAMEOBJECT_TYPE_TRANSPORT
183        struct
184        {
185            uint32 pause;                                   //0
186            uint32 startOpen;                               //1
187            uint32 autoCloseTime;                           //2 secs till autoclose = autoCloseTime / 0x10000
188        } transport;
189        //12 GAMEOBJECT_TYPE_AREADAMAGE
190        struct
191        {
192            uint32 lockId;                                  //0
193            uint32 radius;                                  //1
194            uint32 damageMin;                               //2
195            uint32 damageMax;                               //3
196            uint32 damageSchool;                            //4
197            uint32 autoCloseTime;                           //5 secs till autoclose = autoCloseTime / 0x10000
198            uint32 openTextID;                              //6
199            uint32 closeTextID;                             //7
200        } areadamage;
201        //13 GAMEOBJECT_TYPE_CAMERA
202        struct
203        {
204            uint32 lockId;                                  //0 -> Lock.dbc
205            uint32 cinematicId;                             //1
206            uint32 eventID;                                 //2
207            uint32 openTextID;                              //3 can be used to replace castBarCaption?
208        } camera;
209        //15 GAMEOBJECT_TYPE_MO_TRANSPORT
210        struct
211        {
212            uint32 taxiPathId;                              //0
213            uint32 moveSpeed;                               //1
214            uint32 accelRate;                               //2
215            uint32 startEventID;                            //3
216            uint32 stopEventID;                             //4
217            uint32 transportPhysics;                        //5
218            uint32 mapID;                                   //6
219        } moTransport;
220        //17 GAMEOBJECT_TYPE_FISHINGNODE
221        struct
222        {
223            uint32 _data0;                                  //0
224            uint32 lootId;                                  //1
225        } fishnode;
226        //18 GAMEOBJECT_TYPE_SUMMONING_RITUAL
227        struct
228        {
229            uint32 reqParticipants;                         //0
230            uint32 spellId;                                 //1
231            uint32 animSpell;                               //2
232            uint32 ritualPersistent;                        //3
233            uint32 casterTargetSpell;                       //4
234            uint32 casterTargetSpellTargets;                //5
235            uint32 castersGrouped;                          //6
236            uint32 ritualNoTargetCheck;                     //7
237        } summoningRitual;
238        //20 GAMEOBJECT_TYPE_AUCTIONHOUSE
239        struct
240        {
241            uint32 actionHouseID;                           //0
242        } auctionhouse;
243        //21 GAMEOBJECT_TYPE_GUARDPOST
244        struct
245        {
246            uint32 creatureID;                              //0
247            uint32 charges;                                 //1
248        } guardpost;
249        //22 GAMEOBJECT_TYPE_SPELLCASTER
250        struct
251        {
252            uint32 spellId;                                 //0
253            uint32 charges;                                 //1
254            uint32 partyOnly;                               //2
255        } spellcaster;
256        //23 GAMEOBJECT_TYPE_MEETINGSTONE
257        struct
258        {
259            uint32 minLevel;                                //0
260            uint32 maxLevel;                                //1
261            uint32 areaID;                                  //2
262        } meetingstone;
263        //24 GAMEOBJECT_TYPE_FLAGSTAND
264        struct
265        {
266            uint32 lockId;                                  //0
267            uint32 pickupSpell;                             //1
268            uint32 radius;                                  //2
269            uint32 returnAura;                              //3
270            uint32 returnSpell;                             //4
271            uint32 noDamageImmune;                          //5
272            uint32 openTextID;                              //6
273            uint32 losOK;                                   //7
274        } flagstand;
275        //25 GAMEOBJECT_TYPE_FISHINGHOLE                    // not implemented yet
276        struct
277        {
278            uint32 radius;                                  //0 how close bobber must land for sending loot
279            uint32 lootId;                                  //1
280            uint32 minSuccessOpens;                         //2
281            uint32 maxSuccessOpens;                         //3
282            uint32 lockId;                                  //4 -> Lock.dbc; possibly 1628 for all?
283        } fishinghole;
284        //26 GAMEOBJECT_TYPE_FLAGDROP
285        struct
286        {
287            uint32 lockId;                                  //0
288            uint32 eventID;                                 //1
289            uint32 pickupSpell;                             //2
290            uint32 noDamageImmune;                          //3
291            uint32 openTextID;                              //4
292        } flagdrop;
293        //27 GAMEOBJECT_TYPE_MINI_GAME
294        struct
295        {
296            uint32 gameType;                                //0
297        } miniGame;
298        //29 GAMEOBJECT_TYPE_CAPTURE_POINT
299        struct
300        {
301            uint32 radius;                                  //0
302            uint32 spell;                                   //1
303            uint32 worldState1;                             //2
304            uint32 worldstate2;                             //3
305            uint32 winEventID1;                             //4
306            uint32 winEventID2;                             //5
307            uint32 contestedEventID1;                       //6
308            uint32 contestedEventID2;                       //7
309            uint32 progressEventID1;                        //8
310            uint32 progressEventID2;                        //9
311            uint32 neutralEventID1;                         //10
312            uint32 neutralEventID2;                         //11
313            uint32 neutralPercent;                          //12
314            uint32 worldstate3;                             //13
315            uint32 minSuperiority;                          //14
316            uint32 maxSuperiority;                          //15
317            uint32 minTime;                                 //16
318            uint32 maxTime;                                 //17
319            uint32 large;                                   //18
320            uint32 highlight;                               //19
321        } capturePoint;
322        //30 GAMEOBJECT_TYPE_AURA_GENERATOR
323        struct
324        {
325            uint32 startOpen;                               //0
326            uint32 radius;                                  //1
327            uint32 auraID1;                                 //2
328            uint32 conditionID1;                            //3
329            uint32 auraID2;                                 //4
330            uint32 conditionID2;                            //5
331            uint32 serverOnly;                              //6
332        } auraGenerator;
333        //31 GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY
334        struct
335        {
336            uint32 mapID;                                   //0
337            uint32 difficulty;                              //1
338        } dungeonDifficulty;
339        //32 GAMEOBJECT_TYPE_DO_NOT_USE_YET
340        struct
341        {
342            uint32 mapID;                                   //0
343            uint32 difficulty;                              //1
344        } doNotUseYet;
345        //33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
346        struct
347        {
348            uint32 dmgPctState1;                            //0
349            uint32 dmgPctState2;                            //1
350            uint32 state1Name;                              //2
351            uint32 state2Name;                              //3
352        } destructibleBuilding;
353
354        // not use for specific field access (only for output with loop by all filed), also this determinate max union size
355        struct                                              // GAMEOBJECT_TYPE_SPELLCASTER
356        {
357            uint32 data[24];
358        } raw;
359    };
360    char   *ScriptName;
361};
362
363struct GameObjectLocale
364{
365    std::vector<std::string> Name;
366    std::vector<std::string> CastBarCaption;
367};
368
369// from `gameobject`
370struct GameObjectData
371{
372    uint32 id;                                              // entry in gamobject_template
373    uint32 mapid;
374    float posX;
375    float posY;
376    float posZ;
377    float orientation;
378    float rotation0;
379    float rotation1;
380    float rotation2;
381    float rotation3;
382    int32  spawntimesecs;
383    uint32 animprogress;
384    uint32 go_state;
385    uint8 spawnMask;
386    uint32 ArtKit;
387};
388
389// GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
390#if defined( __GNUC__ )
391#pragma pack()
392#else
393#pragma pack(pop)
394#endif
395
396// For containers:  [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY        -> ...
397// For bobber:      GO_NOT_READY  ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
398// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
399// For door(open):  [GO_NOT_READY]->GO_READY (open) ->GO_ACTIVATED (close)->GO_JUST_DEACTIVATED->GO_READY(open)  -> ...
400enum LootState
401{
402    GO_NOT_READY = 0,
403    GO_READY,                                               // can be ready but despawned, and then not possible activate until spawn
404    GO_ACTIVATED,
405    GO_JUST_DEACTIVATED
406};
407
408class Unit;
409
410// 5 sec for bobber catch
411#define FISHING_BOBBER_READY_TIME 5
412
413class TRINITY_DLL_SPEC GameObject : public WorldObject
414{
415    public:
416        explicit GameObject();
417        ~GameObject();
418
419        void AddToWorld();
420        void RemoveFromWorld();
421
422        bool Create(uint32 guidlow, uint32 name_id, Map *map, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, uint32 go_state, uint32 ArtKit = 0);
423        void Update(uint32 p_time);
424        static GameObject* GetGameObject(WorldObject& object, uint64 guid);
425        GameObjectInfo const* GetGOInfo() const;
426
427        bool IsTransport() const;
428
429        void SetOwnerGUID(uint64 owner)
430        {
431            m_spawnedByDefault = false;                     // all object with owner is despawned after delay
432            SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner);
433        }
434        uint64 GetOwnerGUID() const { return GetUInt64Value(OBJECT_FIELD_CREATED_BY); }
435        Unit* GetOwner() const;
436
437        uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
438
439        void Say(const char* text, uint32 language, uint64 TargetGuid) { MonsterSay(text,language,TargetGuid); }
440        void Yell(const char* text, uint32 language, uint64 TargetGuid) { MonsterYell(text,language,TargetGuid); }
441        void TextEmote(const char* text, uint64 TargetGuid) { MonsterTextEmote(text,TargetGuid); }
442        void Whisper(const char* text,uint64 receiver) { MonsterWhisper(text,receiver); }
443        void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); }
444        void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); }
445        void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); }
446        void Whisper(int32 textId, uint64 receiver) { MonsterWhisper(textId,receiver); }
447
448        void SaveToDB();
449        void SaveToDB(uint32 mapid, uint8 spawnMask);
450        bool LoadFromDB(uint32 guid, Map *map);
451        void DeleteFromDB();
452        void SetLootState(LootState s) { m_lootState = s; }
453        static uint32 GetLootId(GameObjectInfo const* info);
454        uint32 GetLootId() const { return GetLootId(GetGOInfo()); }
455        uint32 GetLockId() const
456        {
457            switch(GetGoType())
458            {
459                case GAMEOBJECT_TYPE_DOOR:       return GetGOInfo()->door.lockId;
460                case GAMEOBJECT_TYPE_BUTTON:     return GetGOInfo()->button.lockId;
461                case GAMEOBJECT_TYPE_QUESTGIVER: return GetGOInfo()->questgiver.lockId;
462                case GAMEOBJECT_TYPE_CHEST:      return GetGOInfo()->chest.lockId;
463                case GAMEOBJECT_TYPE_TRAP:       return GetGOInfo()->trap.lockId;
464                case GAMEOBJECT_TYPE_GOOBER:     return GetGOInfo()->goober.lockId;
465                case GAMEOBJECT_TYPE_AREADAMAGE: return GetGOInfo()->areadamage.lockId;
466                case GAMEOBJECT_TYPE_CAMERA:     return GetGOInfo()->camera.lockId;
467                case GAMEOBJECT_TYPE_FLAGSTAND:  return GetGOInfo()->flagstand.lockId;
468                case GAMEOBJECT_TYPE_FISHINGHOLE:return GetGOInfo()->fishinghole.lockId;
469                case GAMEOBJECT_TYPE_FLAGDROP:   return GetGOInfo()->flagdrop.lockId;
470                default: return 0;
471            }
472        }
473
474        time_t GetRespawnTime() const { return m_respawnTime; }
475        time_t GetRespawnTimeEx() const
476        {
477            time_t now = time(NULL);
478            if(m_respawnTime > now)
479                return m_respawnTime;
480            else
481                return now;
482        }
483
484        void SetRespawnTime(int32 respawn)
485        {
486            m_respawnTime = respawn > 0 ? time(NULL) + respawn : 0;
487            m_respawnDelayTime = respawn > 0 ? respawn : 0;
488        }
489        void Respawn();
490        bool isSpawned() const
491        {
492            return m_respawnDelayTime == 0 ||
493                (m_respawnTime > 0 && !m_spawnedByDefault) ||
494                (m_respawnTime == 0 && m_spawnedByDefault);
495        }
496        bool isSpawnedByDefault() const { return m_spawnedByDefault; }
497        void SetSpawnedByDefault(bool b) { m_spawnedByDefault = b; }
498        uint32 GetRespawnDelay() const { return m_respawnDelayTime; }
499        void Refresh();
500        void Delete();
501        void SetSpellId(uint32 id) { m_spellId = id;}
502        uint32 GetSpellId() const { return m_spellId;}
503        void getFishLoot(Loot *loot);
504        GameobjectTypes GetGoType() const { return GameobjectTypes(GetUInt32Value(GAMEOBJECT_TYPE_ID)); }
505        void SetGoType(GameobjectTypes type) { SetUInt32Value(GAMEOBJECT_TYPE_ID, type); }
506        uint32 GetGoState() const { return GetUInt32Value(GAMEOBJECT_STATE); }
507        void SetGoState(uint32 state) { SetUInt32Value(GAMEOBJECT_STATE, state); }
508        uint32 GetGoArtKit() const { return GetUInt32Value(GAMEOBJECT_ARTKIT); }
509        void SetGoArtKit(uint32 artkit);
510        uint32 GetGoAnimProgress() const { return GetUInt32Value(GAMEOBJECT_ANIMPROGRESS); }
511        void SetGoAnimProgress(uint32 animprogress) { SetUInt32Value(GAMEOBJECT_ANIMPROGRESS, animprogress); }
512
513        void Use(Unit* user);
514
515        LootState getLootState() const { return m_lootState; }
516
517        void AddToSkillupList(uint32 PlayerGuidLow) { m_SkillupList.push_back(PlayerGuidLow); }
518        bool IsInSkillupList(uint32 PlayerGuidLow) const
519        {
520            for (std::list<uint32>::const_iterator i = m_SkillupList.begin(); i != m_SkillupList.end(); ++i)
521                if (*i == PlayerGuidLow) return true;
522            return false;
523        }
524        void ClearSkillupList() { m_SkillupList.clear(); }
525
526        void AddUniqueUse(Player* player);
527        void AddUse() { ++m_usetimes; }
528
529        uint32 GetUseCount() const { return m_usetimes; }
530        uint32 GetUniqueUseCount() const { return m_unique_users.size(); }
531
532        void SaveRespawnTime();
533
534        Loot        loot;
535
536        bool hasQuest(uint32 quest_id) const;
537        bool hasInvolvedQuest(uint32 quest_id) const;
538        bool ActivateToQuest(Player *pTarget) const;
539        void UseDoorOrButton(uint32 time_to_restore = 0);   // 0 = use `gameobject`.`spawntimesecs`
540
541        uint32 GetLinkedGameObjectEntry() const
542        {
543            switch(GetGoType())
544            {
545                case GAMEOBJECT_TYPE_CHEST:       return GetGOInfo()->chest.linkedTrapId;
546                case GAMEOBJECT_TYPE_SPELL_FOCUS: return GetGOInfo()->spellFocus.linkedTrapId;
547                case GAMEOBJECT_TYPE_GOOBER:      return GetGOInfo()->goober.linkedTrapId;
548                default: return 0;
549            }
550        }
551
552        uint32 GetAutoCloseTime() const
553        {
554            uint32 autoCloseTime = 0;
555            switch(GetGoType())
556            {
557                case GAMEOBJECT_TYPE_DOOR:          autoCloseTime = GetGOInfo()->door.autoCloseTime; break;
558                case GAMEOBJECT_TYPE_BUTTON:        autoCloseTime = GetGOInfo()->button.autoCloseTime; break;
559                case GAMEOBJECT_TYPE_TRAP:          autoCloseTime = GetGOInfo()->trap.autoCloseTime; break;
560                case GAMEOBJECT_TYPE_GOOBER:        autoCloseTime = GetGOInfo()->goober.autoCloseTime; break;
561                case GAMEOBJECT_TYPE_TRANSPORT:     autoCloseTime = GetGOInfo()->transport.autoCloseTime; break;
562                case GAMEOBJECT_TYPE_AREADAMAGE:    autoCloseTime = GetGOInfo()->areadamage.autoCloseTime; break;
563                default: break;
564            }
565            return autoCloseTime / 0x10000;
566        }
567
568        void TriggeringLinkedGameObject( uint32 trapEntry, Unit* target);
569
570        bool isVisibleForInState(Player const* u, bool inVisibleList) const;
571
572        GameObject* LookupFishingHoleAround(float range);
573
574        GridReference<GameObject> &GetGridRef() { return m_gridRef; }
575
576        void CastSpell(Unit *target, uint32 spell);
577    protected:
578        uint32      m_charges;                              // Spell charges for GAMEOBJECT_TYPE_SPELLCASTER (22)
579        uint32      m_spellId;
580        time_t      m_respawnTime;                          // (secs) time of next respawn (or despawn if GO have owner()),
581        uint32      m_respawnDelayTime;                     // (secs) if 0 then current GO state no dependent from timer
582        LootState   m_lootState;
583        bool        m_spawnedByDefault;
584        time_t      m_cooldownTime;                         // used as internal reaction delay time store (not state change reaction).
585                                                            // For traps this: spell casting cooldown, for doors/buttons: reset time.
586        std::list<uint32> m_SkillupList;
587
588        std::set<uint32> m_unique_users;
589        uint32 m_usetimes;
590
591        uint32 m_DBTableGuid;                               ///< For new or temporary gameobjects is 0 for saved it is lowguid
592        GameObjectInfo const* m_goInfo;
593    private:
594        void SwitchDoorOrButton(bool activate);
595
596        GridReference<GameObject> m_gridRef;
597};
598#endif
Note: See TracBrowser for help on using the browser.