2 * Copyright (C) 2005-2013 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
23 #include "SharedDefines.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__ )
35 // from `gameobject_template`
49 union // different GO types have different data field
51 //0 GAMEOBJECT_TYPE_DOOR
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 / IN_MILLISECONDS (previous was 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
62 //1 GAMEOBJECT_TYPE_BUTTON
66 uint32 lockId
; //1 -> Lock.dbc
67 uint32 autoCloseTime
; //2 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000)
68 uint32 linkedTrapId
; //3
69 uint32 noDamageImmune
; //4 isBattlegroundObject
71 uint32 openTextID
; //6 can be used to replace castBarCaption?
72 uint32 closeTextID
; //7
75 //2 GAMEOBJECT_TYPE_QUESTGIVER
78 uint32 lockId
; //0 -> Lock.dbc
80 uint32 pageMaterial
; //2
82 uint32 customAnim
; //4
83 uint32 noDamageImmune
; //5
84 uint32 openTextID
; //6 can be used to replace castBarCaption?
86 uint32 allowMounted
; //8
89 //3 GAMEOBJECT_TYPE_CHEST
92 uint32 lockId
; //0 -> Lock.dbc
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
103 uint32 leaveLoot
; //11
104 uint32 notInCombat
; //12
106 uint32 openTextID
; //14 can be used to replace castBarCaption?
107 uint32 groupLootRules
; //15
108 uint32 floatingTooltip
; //16
110 //4 GAMEOBJECT_TYPE_BINDER - empty
111 //5 GAMEOBJECT_TYPE_GENERIC
114 uint32 floatingTooltip
; //0
115 uint32 highlight
; //1
116 uint32 serverOnly
; //2
118 uint32 floatOnWater
; //4
121 //6 GAMEOBJECT_TYPE_TRAP
124 uint32 lockId
; //0 -> Lock.dbc
126 uint32 radius
; //2 radius for trap activation
128 uint32 charges
; //4 need respawn (if > 0)
129 uint32 cooldown
; //5 time in secs
130 uint32 autoCloseTime
; //6 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000)
131 uint32 startDelay
; //7
132 uint32 serverOnly
; //8
133 uint32 stealthed
; //9
135 uint32 stealthAffected
; //11
136 uint32 openTextID
; //12 can be used to replace castBarCaption?
137 uint32 closeTextID
; //13
138 uint32 ignoreTotems
; //14
140 //7 GAMEOBJECT_TYPE_CHAIR
145 uint32 onlyCreatorUse
; //2
146 uint32 triggeredEvent
; //3
148 //8 GAMEOBJECT_TYPE_SPELL_FOCUS
153 uint32 linkedTrapId
; //2
154 uint32 serverOnly
; //3
157 uint32 floatingTooltip
; //6
159 //9 GAMEOBJECT_TYPE_TEXT
164 uint32 pageMaterial
; //2
165 uint32 allowMounted
; //3
167 //10 GAMEOBJECT_TYPE_GOOBER
170 uint32 lockId
; //0 -> Lock.dbc
173 uint32 autoCloseTime
; //3 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000)
174 uint32 customAnim
; //4
175 uint32 consumable
; //5
179 uint32 pageMaterial
; //9
181 uint32 noDamageImmune
; //11
182 uint32 linkedTrapId
; //12
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
192 //11 GAMEOBJECT_TYPE_TRANSPORT
196 uint32 startOpen
; //1
197 uint32 autoCloseTime
; //2 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000)
198 uint32 pause1EventID
; //3
199 uint32 pause2EventID
; //4
201 //12 GAMEOBJECT_TYPE_AREADAMAGE
206 uint32 damageMin
; //2
207 uint32 damageMax
; //3
208 uint32 damageSchool
; //4
209 uint32 autoCloseTime
; //5 secs till autoclose = autoCloseTime / IN_MILLISECONDS (previous was 0x10000)
210 uint32 openTextID
; //6
211 uint32 closeTextID
; //7
213 //13 GAMEOBJECT_TYPE_CAMERA
216 uint32 lockId
; //0 -> Lock.dbc
217 uint32 cinematicId
; //1
219 uint32 openTextID
; //3 can be used to replace castBarCaption?
221 //14 GAMEOBJECT_TYPE_MAPOBJECT - empty
222 //15 GAMEOBJECT_TYPE_MO_TRANSPORT
225 uint32 taxiPathId
; //0
226 uint32 moveSpeed
; //1
227 uint32 accelRate
; //2
228 uint32 startEventID
; //3
229 uint32 stopEventID
; //4
230 uint32 transportPhysics
; //5
232 uint32 worldState1
; //7
234 //16 GAMEOBJECT_TYPE_DUELFLAG - empty
235 //17 GAMEOBJECT_TYPE_FISHINGNODE - empty
236 //18 GAMEOBJECT_TYPE_SUMMONING_RITUAL
239 uint32 reqParticipants
; //0
241 uint32 animSpell
; //2
242 uint32 ritualPersistent
; //3
243 uint32 casterTargetSpell
; //4
244 uint32 casterTargetSpellTargets
; //5
245 uint32 castersGrouped
; //6
246 uint32 ritualNoTargetCheck
; //7
248 //19 GAMEOBJECT_TYPE_MAILBOX - empty
249 //20 GAMEOBJECT_TYPE_DONOTUSE - empty
250 //21 GAMEOBJECT_TYPE_GUARDPOST
253 uint32 creatureID
; //0
256 //22 GAMEOBJECT_TYPE_SPELLCASTER
261 uint32 partyOnly
; //2
262 uint32 allowMounted
; //3
265 //23 GAMEOBJECT_TYPE_MEETINGSTONE
272 //24 GAMEOBJECT_TYPE_FLAGSTAND
276 uint32 pickupSpell
; //1
278 uint32 returnAura
; //3
279 uint32 returnSpell
; //4
280 uint32 noDamageImmune
; //5
281 uint32 openTextID
; //6
284 //25 GAMEOBJECT_TYPE_FISHINGHOLE
287 uint32 radius
; //0 how close bobber must land for sending loot
289 uint32 minSuccessOpens
; //2
290 uint32 maxSuccessOpens
; //3
291 uint32 lockId
; //4 -> Lock.dbc; possibly 1628 for all?
293 //26 GAMEOBJECT_TYPE_FLAGDROP
298 uint32 pickupSpell
; //2
299 uint32 noDamageImmune
; //3
300 uint32 openTextID
; //4
302 //27 GAMEOBJECT_TYPE_MINI_GAME
307 //29 GAMEOBJECT_TYPE_CAPTURE_POINT
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
329 uint32 highlight
; //19
330 uint32 startingValue
; //20
331 uint32 unidirectional
; //21
333 //30 GAMEOBJECT_TYPE_AURA_GENERATOR
336 uint32 startOpen
; //0
339 uint32 conditionID1
; //3
341 uint32 conditionID2
; //5
342 uint32 serverOnly
; //6
344 //31 GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY
348 uint32 difficulty
; //1
350 //32 GAMEOBJECT_TYPE_BARBER_CHAIR
353 uint32 chairheight
; //0
354 uint32 heightOffset
; //1
356 //33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
359 uint32 intactNumHits
; //0
360 uint32 creditProxyCreature
; //1
362 uint32 intactEvent
; //3
364 uint32 damagedNumHits
; //5
368 uint32 damagedEvent
; //9
373 uint32 destroyedEvent
; //14
375 uint32 debuildingTimeSecs
; //16
377 uint32 destructibleData
; //18
378 uint32 rebuildingEvent
; //19
381 uint32 damageEvent
; //22
383 } destructibleBuilding
;
384 //34 GAMEOBJECT_TYPE_GUILDBANK - empty
385 //35 GAMEOBJECT_TYPE_TRAPDOOR
388 uint32 whenToPause
; // 0
389 uint32 startOpen
; // 1
390 uint32 autoClose
; // 2
393 // not use for specific field access (only for output with loop by all filed), also this determinate max union size
406 bool IsDespawnAtAction() const
410 case GAMEOBJECT_TYPE_CHEST
: return chest
.consumable
;
411 case GAMEOBJECT_TYPE_GOOBER
: return goober
.consumable
;
412 default: return false;
416 uint32
GetLockId() const
420 case GAMEOBJECT_TYPE_DOOR
: return door
.lockId
;
421 case GAMEOBJECT_TYPE_BUTTON
: return button
.lockId
;
422 case GAMEOBJECT_TYPE_QUESTGIVER
: return questgiver
.lockId
;
423 case GAMEOBJECT_TYPE_CHEST
: return chest
.lockId
;
424 case GAMEOBJECT_TYPE_TRAP
: return trap
.lockId
;
425 case GAMEOBJECT_TYPE_GOOBER
: return goober
.lockId
;
426 case GAMEOBJECT_TYPE_AREADAMAGE
: return areadamage
.lockId
;
427 case GAMEOBJECT_TYPE_CAMERA
: return camera
.lockId
;
428 case GAMEOBJECT_TYPE_FLAGSTAND
: return flagstand
.lockId
;
429 case GAMEOBJECT_TYPE_FISHINGHOLE
: return fishinghole
.lockId
;
430 case GAMEOBJECT_TYPE_FLAGDROP
: return flagdrop
.lockId
;
435 bool GetDespawnPossibility() const // despawn at targeting of cast?
439 case GAMEOBJECT_TYPE_DOOR
: return door
.noDamageImmune
;
440 case GAMEOBJECT_TYPE_BUTTON
: return button
.noDamageImmune
;
441 case GAMEOBJECT_TYPE_QUESTGIVER
: return questgiver
.noDamageImmune
;
442 case GAMEOBJECT_TYPE_GOOBER
: return goober
.noDamageImmune
;
443 case GAMEOBJECT_TYPE_FLAGSTAND
: return flagstand
.noDamageImmune
;
444 case GAMEOBJECT_TYPE_FLAGDROP
: return flagdrop
.noDamageImmune
;
445 default: return true;
449 uint32
GetCharges() const // despawn at uses amount
453 case GAMEOBJECT_TYPE_TRAP
: return trap
.charges
;
454 case GAMEOBJECT_TYPE_GUARDPOST
: return guardpost
.charges
;
455 case GAMEOBJECT_TYPE_SPELLCASTER
: return spellcaster
.charges
;
460 uint32
GetCooldown() const // not triggering at detection target or use until coolodwn expire
464 case GAMEOBJECT_TYPE_TRAP
: return trap
.cooldown
;
465 case GAMEOBJECT_TYPE_GOOBER
: return goober
.cooldown
;
470 uint32
GetLinkedGameObjectEntry() const
474 case GAMEOBJECT_TYPE_BUTTON
: return button
.linkedTrapId
;
475 case GAMEOBJECT_TYPE_CHEST
: return chest
.linkedTrapId
;
476 case GAMEOBJECT_TYPE_SPELL_FOCUS
: return spellFocus
.linkedTrapId
;
477 case GAMEOBJECT_TYPE_GOOBER
: return goober
.linkedTrapId
;
482 uint32
GetAutoCloseTime() const
484 uint32 autoCloseTime
= 0;
487 case GAMEOBJECT_TYPE_DOOR
: autoCloseTime
= door
.autoCloseTime
; break;
488 case GAMEOBJECT_TYPE_BUTTON
: autoCloseTime
= button
.autoCloseTime
; break;
489 case GAMEOBJECT_TYPE_TRAP
: autoCloseTime
= trap
.autoCloseTime
; break;
490 case GAMEOBJECT_TYPE_GOOBER
: autoCloseTime
= goober
.autoCloseTime
; break;
491 case GAMEOBJECT_TYPE_TRANSPORT
: autoCloseTime
= transport
.autoCloseTime
; break;
492 case GAMEOBJECT_TYPE_AREADAMAGE
: autoCloseTime
= areadamage
.autoCloseTime
; break;
495 return autoCloseTime
/ IN_MILLISECONDS
; // prior to 3.0.3, conversion was / 0x10000;
498 uint32
GetLootId() const
502 case GAMEOBJECT_TYPE_CHEST
: return chest
.lootId
;
503 case GAMEOBJECT_TYPE_FISHINGHOLE
: return fishinghole
.lootId
;
508 uint32
GetGossipMenuId() const
512 case GAMEOBJECT_TYPE_QUESTGIVER
: return questgiver
.gossipID
;
513 case GAMEOBJECT_TYPE_GOOBER
: return goober
.gossipID
;
518 uint32
GetEventScriptId() const
522 case GAMEOBJECT_TYPE_GOOBER
: return goober
.eventId
;
523 case GAMEOBJECT_TYPE_CHEST
: return chest
.eventId
;
524 case GAMEOBJECT_TYPE_CAMERA
: return camera
.eventID
;
530 // GCC have alternative #pragma pack() syntax and old gcc version not support pack(pop), also any gcc version not support it at some platform
531 #if defined( __GNUC__ )
537 struct GameObjectLocale
539 std::vector
<std::string
> Name
;
540 std::vector
<std::string
> CastBarCaption
;
543 // client side GO show states
546 GO_STATE_ACTIVE
= 0, // show in world as used and not reset (closed door open)
547 GO_STATE_READY
= 1, // show in world as ready (closed door close)
548 GO_STATE_ACTIVE_ALTERNATIVE
= 2 // show in world as used in alt way and not reset (closed door open by cannon fire)
551 #define MAX_GO_STATE 3
553 struct QuaternionData
557 QuaternionData() : x(0.f
), y(0.f
), z(0.f
), w(0.f
) {}
558 QuaternionData(float X
, float Y
, float Z
, float W
) : x(X
), y(Y
), z(Z
), w(W
) {}
560 bool isUnit() const { return fabs(x
* x
+ y
* y
+ z
* z
+ w
* w
- 1.f
) < 1e-5;}
564 struct GameObjectData
566 uint32 id
; // entry in gamobject_template
573 QuaternionData rotation
;
580 // from `gameobject_addon`
581 struct GameObjectDataAddon
584 QuaternionData path_rotation
;
587 // For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
588 // For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
589 // For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
590 // For door(open): [GO_NOT_READY]->GO_READY (open) ->GO_ACTIVATED (close)->GO_JUST_DEACTIVATED->GO_READY(open) -> ...
594 GO_READY
, // can be ready but despawned, and then not possible activate until spawn
599 enum CapturePointState
601 CAPTURE_STATE_NEUTRAL
= 0,
602 CAPTURE_STATE_PROGRESS_ALLIANCE
,
603 CAPTURE_STATE_PROGRESS_HORDE
,
604 CAPTURE_STATE_CONTEST_ALLIANCE
,
605 CAPTURE_STATE_CONTEST_HORDE
,
606 CAPTURE_STATE_WIN_ALLIANCE
,
607 CAPTURE_STATE_WIN_HORDE
610 enum CapturePointSlider
612 CAPTURE_SLIDER_ALLIANCE
= 100, // full alliance
613 CAPTURE_SLIDER_HORDE
= 0, // full horde
614 CAPTURE_SLIDER_MIDDLE
= 50 // middle
618 struct GameObjectDisplayInfoEntry
;
620 // 5 sec for bobber catch
621 #define FISHING_BOBBER_READY_TIME 5
623 #define GO_ANIMPROGRESS_DEFAULT 0xFF
625 class MANGOS_DLL_SPEC GameObject
: public WorldObject
628 explicit GameObject();
631 void AddToWorld() override
;
632 void RemoveFromWorld() override
;
634 bool Create(uint32 guidlow
, uint32 name_id
, Map
* map
, uint32 phaseMask
, float x
, float y
, float z
, float ang
,
635 QuaternionData rotation
= QuaternionData(), uint8 animprogress
= GO_ANIMPROGRESS_DEFAULT
, GOState go_state
= GO_STATE_READY
);
636 void Update(uint32 update_diff
, uint32 p_time
) override
;
637 GameObjectInfo
const* GetGOInfo() const;
639 bool IsTransport() const;
641 bool HasStaticDBSpawnData() const; // listed in `gameobject` table and have fixed in DB guid
643 // z_rot, y_rot, x_rot - rotation angles around z, y and x axes
644 void SetWorldRotationAngles(float z_rot
, float y_rot
, float x_rot
);
645 void SetWorldRotation(float qx
, float qy
, float qz
, float qw
);
646 void SetTransportPathRotation(QuaternionData rotation
); // transforms(rotates) transport's path
647 int64
GetPackedWorldRotation() const { return m_packedRotation
; }
649 // overwrite WorldObject function for proper name localization
650 const char* GetNameForLocaleIdx(int32 locale_idx
) const override
;
653 void SaveToDB(uint32 mapid
, uint8 spawnMask
, uint32 phaseMask
);
654 bool LoadFromDB(uint32 guid
, Map
* map
);
657 void SetOwnerGuid(ObjectGuid ownerGuid
)
659 m_spawnedByDefault
= false; // all object with owner is despawned after delay
660 SetGuidValue(OBJECT_FIELD_CREATED_BY
, ownerGuid
);
662 ObjectGuid
const& GetOwnerGuid() const { return GetGuidValue(OBJECT_FIELD_CREATED_BY
); }
663 Unit
* GetOwner() const;
665 void SetSpellId(uint32 id
)
667 m_spawnedByDefault
= false; // all summoned object is despawned after delay
670 uint32
GetSpellId() const { return m_spellId
;}
672 time_t GetRespawnTime() const { return m_respawnTime
; }
673 time_t GetRespawnTimeEx() const
675 time_t now
= time(NULL
);
676 if (m_respawnTime
> now
)
677 return m_respawnTime
;
682 void SetRespawnTime(time_t respawn
)
684 m_respawnTime
= respawn
> 0 ? time(NULL
) + respawn
: 0;
685 m_respawnDelayTime
= respawn
> 0 ? uint32(respawn
) : 0;
688 bool isSpawned() const
690 return m_respawnDelayTime
== 0 ||
691 (m_respawnTime
> 0 && !m_spawnedByDefault
) ||
692 (m_respawnTime
== 0 && m_spawnedByDefault
);
694 bool isSpawnedByDefault() const { return m_spawnedByDefault
; }
695 uint32
GetRespawnDelay() const { return m_respawnDelayTime
; }
699 // Functions spawn/remove gameobject with DB guid in all loaded map copies (if point grid loaded in map)
700 static void AddToRemoveListInMaps(uint32 db_guid
, GameObjectData
const* data
);
701 static void SpawnInMaps(uint32 db_guid
, GameObjectData
const* data
);
703 GameobjectTypes
GetGoType() const { return GameobjectTypes(GetByteValue(GAMEOBJECT_BYTES_1
, 1)); }
704 void SetGoType(GameobjectTypes type
) { SetByteValue(GAMEOBJECT_BYTES_1
, 1, type
); }
705 GOState
GetGoState() const { return GOState(GetByteValue(GAMEOBJECT_BYTES_1
, 0)); }
706 void SetGoState(GOState state
) { SetByteValue(GAMEOBJECT_BYTES_1
, 0, state
); }
707 uint8
GetGoArtKit() const { return GetByteValue(GAMEOBJECT_BYTES_1
, 2); }
708 void SetGoArtKit(uint8 artkit
) { SetByteValue(GAMEOBJECT_BYTES_1
, 2, artkit
); }
709 uint8
GetGoAnimProgress() const { return GetByteValue(GAMEOBJECT_BYTES_1
, 3); }
710 void SetGoAnimProgress(uint8 animprogress
) { SetByteValue(GAMEOBJECT_BYTES_1
, 3, animprogress
); }
711 uint32
GetDisplayId() const { return GetUInt32Value(GAMEOBJECT_DISPLAYID
); }
712 void SetDisplayId(uint32 modelId
);
714 float GetObjectBoundingRadius() const override
; // overwrite WorldObject version
716 void Use(Unit
* user
);
718 LootState
getLootState() const { return m_lootState
; }
719 void SetLootState(LootState s
) { m_lootState
= s
; }
721 void AddToSkillupList(Player
* player
);
722 bool IsInSkillupList(Player
* player
) const;
723 void ClearSkillupList() { m_SkillupSet
.clear(); }
724 void ClearAllUsesData()
729 m_UniqueUsers
.clear();
732 void AddUniqueUse(Player
* player
);
733 void AddUse() { ++m_useTimes
; }
735 uint32
GetUseCount() const { return m_useTimes
; }
736 uint32
GetUniqueUseCount() const { return m_UniqueUsers
.size(); }
738 void SaveRespawnTime() override
;
742 void getFishLoot(Loot
* loot
, Player
* loot_owner
);
743 void StartGroupLoot(Group
* group
, uint32 timer
) override
;
745 ObjectGuid
GetLootRecipientGuid() const { return m_lootRecipientGuid
; }
746 uint32
GetLootGroupRecipientId() const { return m_lootGroupRecipientId
; }
747 Player
* GetLootRecipient() const; // use group cases as prefered
748 Group
* GetGroupLootRecipient() const;
749 bool HasLootRecipient() const { return m_lootGroupRecipientId
|| !m_lootRecipientGuid
.IsEmpty(); }
750 bool IsGroupLootRecipient() const { return m_lootGroupRecipientId
; }
751 void SetLootRecipient(Unit
* pUnit
);
752 Player
* GetOriginalLootRecipient() const; // ignore group changes/etc, not for looting
754 bool HasQuest(uint32 quest_id
) const override
;
755 bool HasInvolvedQuest(uint32 quest_id
) const override
;
756 bool ActivateToQuest(Player
* pTarget
) const;
757 void UseDoorOrButton(uint32 time_to_restore
= 0, bool alternative
= false);
758 // 0 = use `gameobject`.`spawntimesecs`
759 void ResetDoorOrButton();
761 bool IsHostileTo(Unit
const* unit
) const override
;
762 bool IsFriendlyTo(Unit
const* unit
) const override
;
764 void SummonLinkedTrapIfAny();
765 void TriggerLinkedGameObject(Unit
* target
);
767 bool isVisibleForInState(Player
const* u
, WorldObject
const* viewPoint
, bool inVisibleList
) const override
;
769 GameObject
* LookupFishingHoleAround(float range
);
771 void SetCapturePointSlider(float value
);
772 float GetCapturePointSlider() const { return m_captureSlider
; }
774 GridReference
<GameObject
>& GetGridRef() { return m_gridRef
; }
778 time_t m_respawnTime
; // (secs) time of next respawn (or despawn if GO have owner()),
779 uint32 m_respawnDelayTime
; // (secs) if 0 then current GO state no dependent from timer
780 LootState m_lootState
;
781 bool m_spawnedByDefault
;
782 time_t m_cooldownTime
; // used as internal reaction delay time store (not state change reaction).
783 // For traps/goober this: spell casting cooldown, for doors/buttons: reset time.
785 uint32 m_captureTimer
; // (msecs) timer used for capture points
786 float m_captureSlider
; // capture point slider value in range of [0..100]
787 CapturePointState m_captureState
;
789 GuidSet m_SkillupSet
; // players that already have skill-up at GO use
791 uint32 m_useTimes
; // amount uses/charges triggered
793 // collected only for GAMEOBJECT_TYPE_SUMMONING_RITUAL
794 ObjectGuid m_firstUser
; // first GO user, in most used cases owner, but in some cases no, for example non-summoned multi-use GAMEOBJECT_TYPE_SUMMONING_RITUAL
795 GuidSet m_UniqueUsers
; // all players who use item, some items activated after specific amount unique uses
797 GameObjectInfo
const* m_goInfo
;
798 GameObjectDisplayInfoEntry
const* m_displayInfo
;
799 int64 m_packedRotation
;
800 QuaternionData m_worldRotation
;
803 uint32 m_groupLootTimer
; // (msecs)timer used for group loot
804 uint32 m_groupLootId
; // used to find group which is looting
805 void StopGroupLoot() override
;
806 ObjectGuid m_lootRecipientGuid
; // player who will have rights for looting if m_lootGroupRecipient==0 or group disbanded
807 uint32 m_lootGroupRecipientId
; // group who will have rights for looting if set and exist
810 void SwitchDoorOrButton(bool activate
, bool alternative
= false);
811 void TickCapturePoint();
813 GridReference
<GameObject
> m_gridRef
;