[8449] Deprecate healing/damage item mods and merge internal data in to spell power.
[getmangos.git] / src / game / GameObject.h
blob11d9b316003cf9ebeeb63434ef98ae2be1335acf
1 /*
2 * Copyright (C) 2005-2009 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_GAMEOBJECT_H
20 #define MANGOSSERVER_GAMEOBJECT_H
22 #include "Common.h"
23 #include "SharedDefines.h"
24 #include "Object.h"
25 #include "LootMgr.h"
26 #include "Database/DatabaseEnv.h"
28 // 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
29 #if defined( __GNUC__ )
30 #pragma pack(1)
31 #else
32 #pragma pack(push,1)
33 #endif
35 // from `gameobject_template`
36 struct GameObjectInfo
38 uint32 id;
39 uint32 type;
40 uint32 displayId;
41 char *name;
42 char *IconName;
43 char *castBarCaption;
44 char *unk1;
45 uint32 faction;
46 uint32 flags;
47 float size;
48 uint32 questItems[4];
49 union // different GO types have different data field
51 //0 GAMEOBJECT_TYPE_DOOR
52 struct
54 uint32 startOpen; //0 used client side to determine GO_ACTIVATED means open/closed
55 uint32 lockId; //1 -> Lock.dbc
56 uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000
57 uint32 noDamageImmune; //3 break opening whenever you recieve damage?
58 uint32 openTextID; //4 can be used to replace castBarCaption?
59 uint32 closeTextID; //5
60 uint32 ignoredByPathing; //6
61 } door;
62 //1 GAMEOBJECT_TYPE_BUTTON
63 struct
65 uint32 startOpen; //0
66 uint32 lockId; //1 -> Lock.dbc
67 uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000
68 uint32 linkedTrap; //3
69 uint32 noDamageImmune; //4 isBattlegroundObject
70 uint32 large; //5
71 uint32 openTextID; //6 can be used to replace castBarCaption?
72 uint32 closeTextID; //7
73 uint32 losOK; //8
74 } button;
75 //2 GAMEOBJECT_TYPE_QUESTGIVER
76 struct
78 uint32 lockId; //0 -> Lock.dbc
79 uint32 questList; //1
80 uint32 pageMaterial; //2
81 uint32 gossipID; //3
82 uint32 customAnim; //4
83 uint32 noDamageImmune; //5
84 uint32 openTextID; //6 can be used to replace castBarCaption?
85 uint32 losOK; //7
86 uint32 allowMounted; //8
87 uint32 large; //9
88 } questgiver;
89 //3 GAMEOBJECT_TYPE_CHEST
90 struct
92 uint32 lockId; //0 -> Lock.dbc
93 uint32 lootId; //1
94 uint32 chestRestockTime; //2
95 uint32 consumable; //3
96 uint32 minSuccessOpens; //4
97 uint32 maxSuccessOpens; //5
98 uint32 eventId; //6 lootedEvent
99 uint32 linkedTrapId; //7
100 uint32 questId; //8 not used currently but store quest required for GO activation for player
101 uint32 level; //9
102 uint32 losOK; //10
103 uint32 leaveLoot; //11
104 uint32 notInCombat; //12
105 uint32 logLoot; //13
106 uint32 openTextID; //14 can be used to replace castBarCaption?
107 uint32 groupLootRules; //15
108 uint32 floatingTooltip; //16
109 } chest;
110 //4 GAMEOBJECT_TYPE_BINDER - empty
111 //5 GAMEOBJECT_TYPE_GENERIC
112 struct
114 uint32 floatingTooltip; //0
115 uint32 highlight; //1
116 uint32 serverOnly; //2
117 uint32 large; //3
118 uint32 floatOnWater; //4
119 uint32 questID; //5
120 } _generic;
121 //6 GAMEOBJECT_TYPE_TRAP
122 struct
124 uint32 lockId; //0 -> Lock.dbc
125 uint32 level; //1
126 uint32 radius; //2 radius for trap activation
127 uint32 spellId; //3
128 uint32 charges; //4 need respawn (if > 0)
129 uint32 cooldown; //5 time in secs
130 uint32 autoCloseTime; //6
131 uint32 startDelay; //7
132 uint32 serverOnly; //8
133 uint32 stealthed; //9
134 uint32 large; //10
135 uint32 stealthAffected; //11
136 uint32 openTextID; //12 can be used to replace castBarCaption?
137 uint32 closeTextID; //13
138 uint32 ignoreTotems; //14
139 } trap;
140 //7 GAMEOBJECT_TYPE_CHAIR
141 struct
143 uint32 slots; //0
144 uint32 height; //1
145 uint32 onlyCreatorUse; //2
146 uint32 triggeredEvent; //3
147 } chair;
148 //8 GAMEOBJECT_TYPE_SPELL_FOCUS
149 struct
151 uint32 focusId; //0
152 uint32 dist; //1
153 uint32 linkedTrapId; //2
154 uint32 serverOnly; //3
155 uint32 questID; //4
156 uint32 large; //5
157 uint32 floatingTooltip; //6
158 } spellFocus;
159 //9 GAMEOBJECT_TYPE_TEXT
160 struct
162 uint32 pageID; //0
163 uint32 language; //1
164 uint32 pageMaterial; //2
165 uint32 allowMounted; //3
166 } text;
167 //10 GAMEOBJECT_TYPE_GOOBER
168 struct
170 uint32 lockId; //0 -> Lock.dbc
171 uint32 questId; //1
172 uint32 eventId; //2
173 uint32 autoCloseTime; //3
174 uint32 customAnim; //4
175 uint32 consumable; //5
176 uint32 cooldown; //6
177 uint32 pageId; //7
178 uint32 language; //8
179 uint32 pageMaterial; //9
180 uint32 spellId; //10
181 uint32 noDamageImmune; //11
182 uint32 linkedTrapId; //12
183 uint32 large; //13
184 uint32 openTextID; //14 can be used to replace castBarCaption?
185 uint32 closeTextID; //15
186 uint32 losOK; //16 isBattlegroundObject
187 uint32 allowMounted; //17
188 uint32 floatingTooltip; //18
189 uint32 gossipID; //19
190 uint32 WorldStateSetsState; //20
191 } goober;
192 //11 GAMEOBJECT_TYPE_TRANSPORT
193 struct
195 uint32 pause; //0
196 uint32 startOpen; //1
197 uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000
198 uint32 pause1EventID; //3
199 uint32 pause2EventID; //4
200 } transport;
201 //12 GAMEOBJECT_TYPE_AREADAMAGE
202 struct
204 uint32 lockId; //0
205 uint32 radius; //1
206 uint32 damageMin; //2
207 uint32 damageMax; //3
208 uint32 damageSchool; //4
209 uint32 autoCloseTime; //5 secs till autoclose = autoCloseTime / 0x10000
210 uint32 openTextID; //6
211 uint32 closeTextID; //7
212 } areadamage;
213 //13 GAMEOBJECT_TYPE_CAMERA
214 struct
216 uint32 lockId; //0 -> Lock.dbc
217 uint32 cinematicId; //1
218 uint32 eventID; //2
219 uint32 openTextID; //3 can be used to replace castBarCaption?
220 } camera;
221 //14 GAMEOBJECT_TYPE_MAPOBJECT - empty
222 //15 GAMEOBJECT_TYPE_MO_TRANSPORT
223 struct
225 uint32 taxiPathId; //0
226 uint32 moveSpeed; //1
227 uint32 accelRate; //2
228 uint32 startEventID; //3
229 uint32 stopEventID; //4
230 uint32 transportPhysics; //5
231 uint32 mapID; //6
232 uint32 worldState1; //7
233 } moTransport;
234 //16 GAMEOBJECT_TYPE_DUELFLAG - empty
235 //17 GAMEOBJECT_TYPE_FISHINGNODE - empty
236 //18 GAMEOBJECT_TYPE_SUMMONING_RITUAL
237 struct
239 uint32 reqParticipants; //0
240 uint32 spellId; //1
241 uint32 animSpell; //2
242 uint32 ritualPersistent; //3
243 uint32 casterTargetSpell; //4
244 uint32 casterTargetSpellTargets; //5
245 uint32 castersGrouped; //6
246 uint32 ritualNoTargetCheck; //7
247 } summoningRitual;
248 //19 GAMEOBJECT_TYPE_MAILBOX - empty
249 //20 GAMEOBJECT_TYPE_DONOTUSE - empty
250 //21 GAMEOBJECT_TYPE_GUARDPOST
251 struct
253 uint32 creatureID; //0
254 uint32 charges; //1
255 } guardpost;
256 //22 GAMEOBJECT_TYPE_SPELLCASTER
257 struct
259 uint32 spellId; //0
260 uint32 charges; //1
261 uint32 partyOnly; //2
262 uint32 allowMounted; //3
263 uint32 large; //4
264 } spellcaster;
265 //23 GAMEOBJECT_TYPE_MEETINGSTONE
266 struct
268 uint32 minLevel; //0
269 uint32 maxLevel; //1
270 uint32 areaID; //2
271 } meetingstone;
272 //24 GAMEOBJECT_TYPE_FLAGSTAND
273 struct
275 uint32 lockId; //0
276 uint32 pickupSpell; //1
277 uint32 radius; //2
278 uint32 returnAura; //3
279 uint32 returnSpell; //4
280 uint32 noDamageImmune; //5
281 uint32 openTextID; //6
282 uint32 losOK; //7
283 } flagstand;
284 //25 GAMEOBJECT_TYPE_FISHINGHOLE // not implemented yet
285 struct
287 uint32 radius; //0 how close bobber must land for sending loot
288 uint32 lootId; //1
289 uint32 minSuccessOpens; //2
290 uint32 maxSuccessOpens; //3
291 uint32 lockId; //4 -> Lock.dbc; possibly 1628 for all?
292 } fishinghole;
293 //26 GAMEOBJECT_TYPE_FLAGDROP
294 struct
296 uint32 lockId; //0
297 uint32 eventID; //1
298 uint32 pickupSpell; //2
299 uint32 noDamageImmune; //3
300 uint32 openTextID; //4
301 } flagdrop;
302 //27 GAMEOBJECT_TYPE_MINI_GAME
303 struct
305 uint32 gameType; //0
306 } miniGame;
307 //29 GAMEOBJECT_TYPE_CAPTURE_POINT
308 struct
310 uint32 radius; //0
311 uint32 spell; //1
312 uint32 worldState1; //2
313 uint32 worldstate2; //3
314 uint32 winEventID1; //4
315 uint32 winEventID2; //5
316 uint32 contestedEventID1; //6
317 uint32 contestedEventID2; //7
318 uint32 progressEventID1; //8
319 uint32 progressEventID2; //9
320 uint32 neutralEventID1; //10
321 uint32 neutralEventID2; //11
322 uint32 neutralPercent; //12
323 uint32 worldstate3; //13
324 uint32 minSuperiority; //14
325 uint32 maxSuperiority; //15
326 uint32 minTime; //16
327 uint32 maxTime; //17
328 uint32 large; //18
329 uint32 highlight; //19
330 uint32 startingValue; //20
331 uint32 unidirectional; //21
332 } capturePoint;
333 //30 GAMEOBJECT_TYPE_AURA_GENERATOR
334 struct
336 uint32 startOpen; //0
337 uint32 radius; //1
338 uint32 auraID1; //2
339 uint32 conditionID1; //3
340 uint32 auraID2; //4
341 uint32 conditionID2; //5
342 uint32 serverOnly; //6
343 } auraGenerator;
344 //31 GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY
345 struct
347 uint32 mapID; //0
348 uint32 difficulty; //1
349 } dungeonDifficulty;
350 //32 GAMEOBJECT_TYPE_BARBER_CHAIR
351 struct
353 uint32 chairheight; //0
354 uint32 heightOffset; //1
355 } barberChair;
356 //33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
357 struct
359 uint32 intactNumHits; //0
360 uint32 creditProxyCreature; //1
361 uint32 empty1; //2
362 uint32 intactEvent; //3
363 uint32 empty2; //4
364 uint32 damagedNumHits; //5
365 uint32 empty3; //6
366 uint32 empty4; //7
367 uint32 empty5; //8
368 uint32 damagedEvent; //9
369 uint32 empty6; //10
370 uint32 empty7; //11
371 uint32 empty8; //12
372 uint32 empty9; //13
373 uint32 destroyedEvent; //14
374 uint32 empty10; //15
375 uint32 debuildingTimeSecs; //16
376 uint32 empty11; //17
377 uint32 destructibleData; //18
378 uint32 rebuildingEvent; //19
379 uint32 empty12; //20
380 uint32 empty13; //21
381 uint32 damageEvent; //22
382 uint32 empty14; //23
383 } destructibleBuilding;
384 //34 GAMEOBJECT_TYPE_GUILDBANK - empty
385 //35 GAMEOBJECT_TYPE_TRAPDOOR
386 struct
388 uint32 whenToPause; // 0
389 uint32 startOpen; // 1
390 uint32 autoClose; // 2
391 } trapDoor;
393 // not use for specific field access (only for output with loop by all filed), also this determinate max union size
394 struct
396 uint32 data[24];
397 } raw;
399 uint32 ScriptId;
401 // helpers
402 bool IsDespawnAtAction() const
404 switch(type)
406 case GAMEOBJECT_TYPE_CHEST: return chest.consumable;
407 case GAMEOBJECT_TYPE_GOOBER: return goober.consumable;
408 default: return false;
412 uint32 GetLockId() const
414 switch(type)
416 case GAMEOBJECT_TYPE_DOOR: return door.lockId;
417 case GAMEOBJECT_TYPE_BUTTON: return button.lockId;
418 case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.lockId;
419 case GAMEOBJECT_TYPE_CHEST: return chest.lockId;
420 case GAMEOBJECT_TYPE_TRAP: return trap.lockId;
421 case GAMEOBJECT_TYPE_GOOBER: return goober.lockId;
422 case GAMEOBJECT_TYPE_AREADAMAGE: return areadamage.lockId;
423 case GAMEOBJECT_TYPE_CAMERA: return camera.lockId;
424 case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.lockId;
425 case GAMEOBJECT_TYPE_FISHINGHOLE:return fishinghole.lockId;
426 case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.lockId;
427 default: return 0;
431 bool GetDespawnPossibility() const // despawn at targeting of cast?
433 switch(type)
435 case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune;
436 case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune;
437 case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.noDamageImmune;
438 case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune;
439 case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.noDamageImmune;
440 case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.noDamageImmune;
441 default: return true;
445 uint32 GetCharges() const // despawn at uses amount
447 switch(type)
449 case GAMEOBJECT_TYPE_TRAP: return trap.charges;
450 case GAMEOBJECT_TYPE_GUARDPOST: return guardpost.charges;
451 case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.charges;
452 default: return 0;
456 uint32 GetLinkedGameObjectEntry() const
458 switch(type)
460 case GAMEOBJECT_TYPE_CHEST: return chest.linkedTrapId;
461 case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.linkedTrapId;
462 case GAMEOBJECT_TYPE_GOOBER: return goober.linkedTrapId;
463 default: return 0;
467 uint32 GetAutoCloseTime() const
469 uint32 autoCloseTime = 0;
470 switch(type)
472 case GAMEOBJECT_TYPE_DOOR: autoCloseTime = door.autoCloseTime; break;
473 case GAMEOBJECT_TYPE_BUTTON: autoCloseTime = button.autoCloseTime; break;
474 case GAMEOBJECT_TYPE_TRAP: autoCloseTime = trap.autoCloseTime; break;
475 case GAMEOBJECT_TYPE_GOOBER: autoCloseTime = goober.autoCloseTime; break;
476 case GAMEOBJECT_TYPE_TRANSPORT: autoCloseTime = transport.autoCloseTime; break;
477 case GAMEOBJECT_TYPE_AREADAMAGE: autoCloseTime = areadamage.autoCloseTime; break;
478 default: break;
480 return autoCloseTime / 0x10000;
483 uint32 GetLootId() const
485 switch(type)
487 case GAMEOBJECT_TYPE_CHEST: return chest.lootId;
488 case GAMEOBJECT_TYPE_FISHINGHOLE: return fishinghole.lootId;
489 default: return 0;
494 // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
495 #if defined( __GNUC__ )
496 #pragma pack()
497 #else
498 #pragma pack(pop)
499 #endif
501 struct GameObjectLocale
503 std::vector<std::string> Name;
504 std::vector<std::string> CastBarCaption;
507 // client side GO show states
508 enum GOState
510 GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open)
511 GO_STATE_READY = 1, // show in world as ready (closed door close)
512 GO_STATE_ACTIVE_ALTERNATIVE = 2 // show in world as used in alt way and not reset (closed door open by cannon fire)
515 #define MAX_GO_STATE 3
517 // from `gameobject`
518 struct GameObjectData
520 uint32 id; // entry in gamobject_template
521 uint16 mapid;
522 uint16 phaseMask;
523 float posX;
524 float posY;
525 float posZ;
526 float orientation;
527 float rotation0;
528 float rotation1;
529 float rotation2;
530 float rotation3;
531 int32 spawntimesecs;
532 uint32 animprogress;
533 GOState go_state;
534 uint8 spawnMask;
537 // For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
538 // For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
539 // For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
540 // For door(open): [GO_NOT_READY]->GO_READY (open) ->GO_ACTIVATED (close)->GO_JUST_DEACTIVATED->GO_READY(open) -> ...
541 enum LootState
543 GO_NOT_READY = 0,
544 GO_READY, // can be ready but despawned, and then not possible activate until spawn
545 GO_ACTIVATED,
546 GO_JUST_DEACTIVATED
549 class Unit;
551 // 5 sec for bobber catch
552 #define FISHING_BOBBER_READY_TIME 5
554 class MANGOS_DLL_SPEC GameObject : public WorldObject
556 public:
557 explicit GameObject();
558 ~GameObject();
560 void AddToWorld();
561 void RemoveFromWorld();
562 void CleanupsBeforeDelete();
564 bool Create(uint32 guidlow, uint32 name_id, Map *map, uint32 phaseMask, float x, float y, float z, float ang, float rotation0, float rotation1, float rotation2, float rotation3, uint32 animprogress, GOState go_state);
565 void Update(uint32 p_time);
566 GameObjectInfo const* GetGOInfo() const;
568 bool IsTransport() const;
570 uint32 GetDBTableGUIDLow() const { return m_DBTableGuid; }
572 void UpdateRotationFields(float rotation2 = 0.0f, float rotation3 = 0.0f);
574 void Say(int32 textId, uint32 language, uint64 TargetGuid) { MonsterSay(textId,language,TargetGuid); }
575 void Yell(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYell(textId,language,TargetGuid); }
576 void TextEmote(int32 textId, uint64 TargetGuid) { MonsterTextEmote(textId,TargetGuid); }
577 void Whisper(int32 textId, uint64 receiver) { MonsterWhisper(textId,receiver); }
578 void YellToZone(int32 textId, uint32 language, uint64 TargetGuid) { MonsterYellToZone(textId,language,TargetGuid); }
580 // overwrite WorldObject function for proper name localization
581 const char* GetNameForLocaleIdx(int32 locale_idx) const;
583 void SaveToDB();
584 void SaveToDB(uint32 mapid, uint8 spawnMask, uint32 phaseMask);
585 bool LoadFromDB(uint32 guid, Map *map);
586 void DeleteFromDB();
588 void SetOwnerGUID(uint64 owner)
590 m_spawnedByDefault = false; // all object with owner is despawned after delay
591 SetUInt64Value(OBJECT_FIELD_CREATED_BY, owner);
593 uint64 GetOwnerGUID() const { return GetUInt64Value(OBJECT_FIELD_CREATED_BY); }
594 Unit* GetOwner() const;
596 void SetSpellId(uint32 id)
598 m_spawnedByDefault = false; // all summoned object is despawned after delay
599 m_spellId = id;
601 uint32 GetSpellId() const { return m_spellId;}
603 time_t GetRespawnTime() const { return m_respawnTime; }
604 time_t GetRespawnTimeEx() const
606 time_t now = time(NULL);
607 if(m_respawnTime > now)
608 return m_respawnTime;
609 else
610 return now;
613 void SetRespawnTime(int32 respawn)
615 m_respawnTime = respawn > 0 ? time(NULL) + respawn : 0;
616 m_respawnDelayTime = respawn > 0 ? respawn : 0;
618 void Respawn();
619 bool isSpawned() const
621 return m_respawnDelayTime == 0 ||
622 (m_respawnTime > 0 && !m_spawnedByDefault) ||
623 (m_respawnTime == 0 && m_spawnedByDefault);
625 bool isSpawnedByDefault() const { return m_spawnedByDefault; }
626 uint32 GetRespawnDelay() const { return m_respawnDelayTime; }
627 void Refresh();
628 void Delete();
629 void getFishLoot(Loot *loot, Player* loot_owner);
630 GameobjectTypes GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1, 1)); }
631 void SetGoType(GameobjectTypes type) { SetByteValue(GAMEOBJECT_BYTES_1, 1, type); }
632 GOState GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1, 0)); }
633 void SetGoState(GOState state) { SetByteValue(GAMEOBJECT_BYTES_1, 0, state); }
634 uint8 GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1, 2); }
635 void SetGoArtKit(uint8 artkit) { SetByteValue(GAMEOBJECT_BYTES_1, 2, artkit); }
636 uint8 GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1, 3); }
637 void SetGoAnimProgress(uint8 animprogress) { SetByteValue(GAMEOBJECT_BYTES_1, 3, animprogress); }
639 void Use(Unit* user);
641 LootState getLootState() const { return m_lootState; }
642 void SetLootState(LootState s) { m_lootState = s; }
644 void AddToSkillupList(uint32 PlayerGuidLow) { m_SkillupList.push_back(PlayerGuidLow); }
645 bool IsInSkillupList(uint32 PlayerGuidLow) const
647 for (std::list<uint32>::const_iterator i = m_SkillupList.begin(); i != m_SkillupList.end(); ++i)
648 if (*i == PlayerGuidLow) return true;
649 return false;
651 void ClearSkillupList() { m_SkillupList.clear(); }
653 void AddUniqueUse(Player* player);
654 void AddUse() { ++m_usetimes; }
656 uint32 GetUseCount() const { return m_usetimes; }
657 uint32 GetUniqueUseCount() const { return m_unique_users.size(); }
659 void SaveRespawnTime();
661 Loot loot;
663 bool hasQuest(uint32 quest_id) const;
664 bool hasInvolvedQuest(uint32 quest_id) const;
665 bool ActivateToQuest(Player *pTarget) const;
666 void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false);
667 // 0 = use `gameobject`.`spawntimesecs`
668 void ResetDoorOrButton();
671 void TriggeringLinkedGameObject( uint32 trapEntry, Unit* target);
673 bool isVisibleForInState(Player const* u, WorldObject const* viewPoint, bool inVisibleList) const;
675 GameObject* LookupFishingHoleAround(float range);
677 GridReference<GameObject> &GetGridRef() { return m_gridRef; }
679 bool isActiveObject() const { return false; }
680 uint64 GetRotation() const { return m_rotation; }
681 protected:
682 uint32 m_spellId;
683 time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()),
684 uint32 m_respawnDelayTime; // (secs) if 0 then current GO state no dependent from timer
685 LootState m_lootState;
686 bool m_spawnedByDefault;
687 time_t m_cooldownTime; // used as internal reaction delay time store (not state change reaction).
688 // For traps this: spell casting cooldown, for doors/buttons: reset time.
689 std::list<uint32> m_SkillupList;
691 std::set<uint32> m_unique_users;
692 uint32 m_usetimes;
694 uint32 m_DBTableGuid; ///< For new or temporary gameobjects is 0 for saved it is lowguid
695 GameObjectInfo const* m_goInfo;
696 uint64 m_rotation;
697 private:
698 void SwitchDoorOrButton(bool activate, bool alternative = false);
700 GridReference<GameObject> m_gridRef;
702 #endif