Project SkyFire Core
SkyFire 5.4.8 server core API documentation
Loading...
Searching...
No Matches
GameObject.h
Go to the documentation of this file.
1/*
2* This file is part of Project SkyFire https://www.projectskyfire.org.
3* See LICENSE.md file for Copyright information
4*/
5
6#ifndef SKYFIRESERVER_GAMEOBJECT_H
7#define SKYFIRESERVER_GAMEOBJECT_H
8
9#include "Common.h"
10#include "DatabaseEnv.h"
11#include "LootMgr.h"
12#include "Object.h"
13#include "SharedDefines.h"
14#include "Unit.h"
15
16class GameObjectAI;
17class Group;
18class Transport;
19
20#define MAX_GAMEOBJECT_QUEST_ITEMS 6
21
22// from `gameobject_template`
24{
28 std::string name;
29 std::string IconName;
30 std::string castBarCaption;
31 std::string unk1;
34 float size;
37 union // different GO types have different data field
38 {
39 //0 GAMEOBJECT_TYPE_DOOR
40 struct
41 {
42 uint32 startOpen; //0 used client side to determine GO_ACTIVATED means open/closed
43 uint32 lockId; //1 -> Lock.dbc
44 uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000
45 uint32 noDamageImmune; //3 break opening whenever you recieve damage?
46 uint32 openTextID; //4 can be used to replace castBarCaption?
50 //1 GAMEOBJECT_TYPE_BUTTON
51 struct
52 {
53 uint32 startOpen; //0
54 uint32 lockId; //1 -> Lock.dbc
55 uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000
57 uint32 noDamageImmune; //4 isBattlegroundObject
59 uint32 openTextID; //6 can be used to replace castBarCaption?
63 //2 GAMEOBJECT_TYPE_QUESTGIVER
64 struct
65 {
66 uint32 lockId; //0 -> Lock.dbc
72 uint32 openTextID; //6 can be used to replace castBarCaption?
73 uint32 losOK; //7
74 uint32 allowMounted; //8 Is usable while on mount/vehicle. (0/1)
75 uint32 large; //9
77 //3 GAMEOBJECT_TYPE_CHEST
78 struct
79 {
80 uint32 lockId; //0 -> Lock.dbc
84 uint32 minSuccessOpens; //4 Deprecated, pre 3.0 was used for mining nodes but since WotLK all mining nodes are usable once and grant all loot with a single use
85 uint32 maxSuccessOpens; //5 Deprecated, pre 3.0 was used for mining nodes but since WotLK all mining nodes are usable once and grant all loot with a single use
86 uint32 eventId; //6 lootedEvent
88 uint32 questId; //8 not used currently but store quest required for GO activation for player
90 uint32 losOK; //10
94 uint32 openTextID; //14 can be used to replace castBarCaption?
98 //4 GAMEOBJECT_TYPE_BINDER - empty
99 //5 GAMEOBJECT_TYPE_GENERIC
100 struct
101 {
105 uint32 large; //3
109 //6 GAMEOBJECT_TYPE_TRAP
110 struct
111 {
112 uint32 lockId; //0 -> Lock.dbc
113 uint32 level; //1
114 uint32 radius; //2 radius for trap activation
116 uint32 type; //4 0 trap with no despawn after cast. 1 trap despawns after cast. 2 bomb casts on spawn.
117 uint32 cooldown; //5 time in secs
120 uint32 serverOnly; //8
122 uint32 large; //10
124 uint32 openTextID; //12 can be used to replace castBarCaption?
125 uint32 closeTextID; //13
128 //7 GAMEOBJECT_TYPE_CHAIR
129 struct
130 {
136 //8 GAMEOBJECT_TYPE_SPELL_FOCUS
137 struct
138 {
142 uint32 serverOnly; //3
144 uint32 large; //5
147 //9 GAMEOBJECT_TYPE_TEXT
148 struct
149 {
153 uint32 allowMounted; //3 Is usable while on mount/vehicle. (0/1)
155 //10 GAMEOBJECT_TYPE_GOOBER
156 struct
157 {
158 uint32 lockId; //0 -> Lock.dbc
160 uint32 eventId; //2
162 uint32 customAnim; //4
163 uint32 consumable; //5
164 uint32 cooldown; //6
166 uint32 language; //8
168 uint32 spellId; //10
170 uint32 linkedTrapId; //12
171 uint32 large; //13
172 uint32 openTextID; //14 can be used to replace castBarCaption?
173 uint32 closeTextID; //15
174 uint32 losOK; //16 isBattlegroundObject
175 uint32 allowMounted; //17 Is usable while on mount/vehicle. (0/1)
177 uint32 gossipID; //19
180 //11 GAMEOBJECT_TYPE_TRANSPORT
181 struct
182 {
184 uint32 startOpen; //1
185 uint32 autoCloseTime; //2 secs till autoclose = autoCloseTime / 0x10000
189 //12 GAMEOBJECT_TYPE_AREADAMAGE
190 struct
191 {
192 uint32 lockId; //0
193 uint32 radius; //1
197 uint32 autoCloseTime; //5 secs till autoclose = autoCloseTime / 0x10000
198 uint32 openTextID; //6
201 //13 GAMEOBJECT_TYPE_CAMERA
202 struct
203 {
204 uint32 lockId; //0 -> Lock.dbc
207 uint32 openTextID; //3 can be used to replace castBarCaption?
209 //14 GAMEOBJECT_TYPE_MAPOBJECT - empty
210 //15 GAMEOBJECT_TYPE_MO_TRANSPORT
211 struct
212 {
223 //16 GAMEOBJECT_TYPE_DUELFLAG - empty
224 //17 GAMEOBJECT_TYPE_FISHINGNODE - empty
225 //18 GAMEOBJECT_TYPE_SUMMONING_RITUAL
226 struct
227 {
229 uint32 spellId; //1
237 //19 GAMEOBJECT_TYPE_MAILBOX - empty
238 //20 GAMEOBJECT_TYPE_DONOTUSE - empty
239 //21 GAMEOBJECT_TYPE_GUARDPOST
240 struct
241 {
245 //22 GAMEOBJECT_TYPE_SPELLCASTER
246 struct
247 {
248 uint32 spellId; //0
249 uint32 charges; //1
251 uint32 allowMounted; //3 Is usable while on mount/vehicle. (0/1)
252 uint32 large; //4
254 //23 GAMEOBJECT_TYPE_MEETINGSTONE
255 struct
256 {
261 //24 GAMEOBJECT_TYPE_FLAGSTAND
262 struct
263 {
264 uint32 lockId; //0
266 uint32 radius; //2
270 uint32 openTextID; //6
271 uint32 losOK; //7
273 //25 GAMEOBJECT_TYPE_FISHINGHOLE
274 struct
275 {
276 uint32 radius; //0 how close bobber must land for sending loot
277 uint32 lootId; //1
280 uint32 lockId; //4 -> Lock.dbc; possibly 1628 for all?
282 //26 GAMEOBJECT_TYPE_FLAGDROP
283 struct
284 {
285 uint32 lockId; //0
286 uint32 eventID; //1
289 uint32 openTextID; //4
291 //27 GAMEOBJECT_TYPE_MINI_GAME
292 struct
293 {
296 //29 GAMEOBJECT_TYPE_CAPTURE_POINT
297 struct
298 {
299 uint32 radius; //0
317 uint32 large; //18
318 uint32 highlight; //19
322 //30 GAMEOBJECT_TYPE_AURA_GENERATOR
323 struct
324 {
325 uint32 startOpen; //0
326 uint32 radius; //1
331 uint32 serverOnly; //6
333 //31 GAMEOBJECT_TYPE_DUNGEON_DIFFICULTY
334 struct
335 {
336 uint32 mapID; //0
339 //32 GAMEOBJECT_TYPE_BARBER_CHAIR
340 struct
341 {
345 //33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
346 struct
347 {
373 //34 GAMEOBJECT_TYPE_GUILDBANK - empty
374 //35 GAMEOBJECT_TYPE_TRAPDOOR
375 struct
376 {
378 uint32 startOpen; // 1
381
382 // not use for specific field access (only for output with loop by all filed), also this determinate max union size
383 struct
384 {
387 };
388
389 std::string AIName;
391
392 // helpers
393 bool IsDespawnAtAction() const
394 {
395 switch (type)
396 {
397 case GAMEOBJECT_TYPE_CHEST: return chest.consumable;
398 case GAMEOBJECT_TYPE_GOOBER: return goober.consumable;
399 default: return false;
400 }
401 }
402
403 bool IsUsableMounted() const
404 {
405 switch (type)
406 {
407 case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.allowMounted;
408 case GAMEOBJECT_TYPE_TEXT: return text.allowMounted;
409 case GAMEOBJECT_TYPE_GOOBER: return goober.allowMounted;
410 case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.allowMounted;
411 default: return false;
412 }
413 }
414
416 {
417 switch (type)
418 {
419 case GAMEOBJECT_TYPE_DOOR: return door.lockId;
420 case GAMEOBJECT_TYPE_BUTTON: return button.lockId;
421 case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.lockId;
422 case GAMEOBJECT_TYPE_CHEST: return chest.lockId;
423 case GAMEOBJECT_TYPE_TRAP: return trap.lockId;
424 case GAMEOBJECT_TYPE_GOOBER: return goober.lockId;
425 case GAMEOBJECT_TYPE_AREADAMAGE: return areadamage.lockId;
426 case GAMEOBJECT_TYPE_CAMERA: return camera.lockId;
427 case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.lockId;
428 case GAMEOBJECT_TYPE_FISHINGHOLE:return fishinghole.lockId;
429 case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.lockId;
430 default: return 0;
431 }
432 }
433
434 bool GetDespawnPossibility() const // despawn at targeting of cast?
435 {
436 switch (type)
437 {
438 case GAMEOBJECT_TYPE_DOOR: return door.noDamageImmune;
439 case GAMEOBJECT_TYPE_BUTTON: return button.noDamageImmune;
440 case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.noDamageImmune;
441 case GAMEOBJECT_TYPE_GOOBER: return goober.noDamageImmune;
442 case GAMEOBJECT_TYPE_FLAGSTAND: return flagstand.noDamageImmune;
443 case GAMEOBJECT_TYPE_FLAGDROP: return flagdrop.noDamageImmune;
444 default: return true;
445 }
446 }
447
448 uint32 GetCharges() const // despawn at uses amount
449 {
450 switch (type)
451 {
452 //case GAMEOBJECT_TYPE_TRAP: return trap.charges;
453 case GAMEOBJECT_TYPE_GUARDPOST: return guardpost.charges;
454 case GAMEOBJECT_TYPE_SPELLCASTER: return spellcaster.charges;
455 default: return 0;
456 }
457 }
458
460 {
461 switch (type)
462 {
463 case GAMEOBJECT_TYPE_CHEST: return chest.linkedTrapId;
464 case GAMEOBJECT_TYPE_SPELL_FOCUS: return spellFocus.linkedTrapId;
465 case GAMEOBJECT_TYPE_GOOBER: return goober.linkedTrapId;
466 default: return 0;
467 }
468 }
469
471 {
473 switch (type)
474 {
475 case GAMEOBJECT_TYPE_DOOR: autoCloseTime = door.autoCloseTime; break;
476 case GAMEOBJECT_TYPE_BUTTON: autoCloseTime = button.autoCloseTime; break;
477 case GAMEOBJECT_TYPE_TRAP: autoCloseTime = trap.autoCloseTime; break;
478 case GAMEOBJECT_TYPE_GOOBER: autoCloseTime = goober.autoCloseTime; break;
479 case GAMEOBJECT_TYPE_TRANSPORT: autoCloseTime = transport.autoCloseTime; break;
480 case GAMEOBJECT_TYPE_AREADAMAGE: autoCloseTime = areadamage.autoCloseTime; break;
481 default: break;
482 }
483 return autoCloseTime / IN_MILLISECONDS; // prior to 3.0.3, conversion was / 0x10000;
484 }
485
487 {
488 switch (type)
489 {
490 case GAMEOBJECT_TYPE_CHEST: return chest.lootId;
491 case GAMEOBJECT_TYPE_FISHINGHOLE: return fishinghole.lootId;
492 default: return 0;
493 }
494 }
495
497 {
498 switch (type)
499 {
500 case GAMEOBJECT_TYPE_QUESTGIVER: return questgiver.gossipID;
501 case GAMEOBJECT_TYPE_GOOBER: return goober.gossipID;
502 default: return 0;
503 }
504 }
505
507 {
508 switch (type)
509 {
510 case GAMEOBJECT_TYPE_GOOBER: return goober.eventId;
511 case GAMEOBJECT_TYPE_CHEST: return chest.eventId;
512 case GAMEOBJECT_TYPE_CAMERA: return camera.eventID;
513 default: return 0;
514 }
515 }
516
517 uint32 GetCooldown() const // Cooldown preventing goober and traps to cast spell
518 {
519 switch (type)
520 {
521 case GAMEOBJECT_TYPE_TRAP: return trap.cooldown;
522 case GAMEOBJECT_TYPE_GOOBER: return goober.cooldown;
523 default: return 0;
524 }
525 }
526};
527
528// Benchmarked: Faster than std::map (insert/find)
530
531class OPvPCapturePoint;
532struct TransportAnimation;
533
535{
536 //11 GAMEOBJECT_TYPE_TRANSPORT
537 struct
538 {
549 //25 GAMEOBJECT_TYPE_FISHINGHOLE
550 struct
551 {
554 //29 GAMEOBJECT_TYPE_CAPTURE_POINT
555 struct
556 {
559 //33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
560 struct
561 {
565};
566
572
573// client side GO show states
574enum class GOState
575{
576 GO_STATE_ACTIVE = 0, // show in world as used and not reset (closed door open)
577 GO_STATE_READY = 1, // show in world as ready (closed door close)
578 GO_STATE_ACTIVE_ALTERNATIVE = 2, // show in world as used in alt way and not reset (closed door open by cannon fire)
579 GO_STATE_PREPARE_TRANSPORT = 24, // legacy name, transport active/start frame
581 GO_STATE_TRANSPORT_STOPPED = 25 // first transport stop frame
582};
583
584// from `gameobject`
609
610// For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
611// For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
612// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
613// For door(open): [GO_NOT_READY]->GO_READY (open) ->GO_ACTIVATED (close)->GO_JUST_DEACTIVATED->GO_READY(open) -> ...
614enum class LootState
615{
617 GO_READY, // can be ready but despawned, and then not possible activate until spawn
620};
621
622class Unit;
623class GameObjectModel;
624
625// 5 sec for bobber catch
626#define FISHING_BOBBER_READY_TIME 5
627
628class GameObject : public WorldObject, public GridObject<GameObject>, public MapObject
629{
630public:
631 explicit GameObject();
632 ~GameObject();
633
634 void BuildValuesUpdate(uint8 updatetype, ByteBuffer* data, Player* target) const OVERRIDE;
635
636 void AddToWorld() OVERRIDE;
638 void CleanupsBeforeDelete(bool finalCleanup = true) OVERRIDE;
639
640 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, GOState go_state, uint32 artKit = 0);
641 void Update(uint32 p_time) OVERRIDE;
642 static GameObject* GetGameObject(WorldObject& object, uint64 guid);
643 GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
644 GameObjectData const* GetGOData() const { return m_goData; }
645 GameObjectValue const* GetGOValue() const { return &m_goValue; }
646
647 bool IsTransport() const;
648 bool IsDynTransport() const;
649 bool IsDestructibleBuilding() const;
650
652
653 void UpdateRotationFields(float rotation2 = 0.0f, float rotation3 = 0.0f);
655
656 // overwrite WorldObject function for proper name localization
657 std::string const& GetNameForLocaleIdx(LocaleConstant locale_idx) const OVERRIDE;
658
659 void SaveToDB();
660 void SaveToDB(uint32 mapid, uint32 spawnMask);
661 bool LoadFromDB(uint32 guid, Map* map) { return LoadGameObjectFromDB(guid, map, false); }
662 bool LoadGameObjectFromDB(uint32 guid, Map* map, bool addToMap = true);
663 void DeleteFromDB();
664
666 {
667 // SPELL_FOCUS GOs (Basic Campfire 29784): player CREATED_BY + CREATE_OBJECT2 crashes 5.4.8 client.
669 owner = 0;
670
671 // Owner already found and different than expected owner - remove object from old owner
672 if (owner && GetOwnerGUID() && GetOwnerGUID() != owner)
673 {
674 ASSERT(false);
675 }
676 m_spawnedByDefault = false; // all object with owner is despawned after delay
678 }
680 Unit* GetOwner() const;
681
683 {
684 m_spawnedByDefault = false; // all summoned object is despawned after delay
685 m_spellId = id;
686 }
687 uint32 GetSpellId() const { return m_spellId; }
688
689 time_t GetRespawnTime() const { return m_respawnTime; }
690 time_t GetRespawnTimeEx() const
691 {
692 time_t now = time(NULL);
693 if (m_respawnTime > now)
694 return m_respawnTime;
695 else
696 return now;
697 }
698
699 void SetRespawnTime(int32 respawn)
700 {
701 m_respawnTime = respawn > 0 ? time(NULL) + respawn : 0;
702 m_respawnDelayTime = respawn > 0 ? respawn : 0;
703 }
704 void Respawn();
705 bool isSpawned() const
706 {
707 return m_respawnDelayTime == 0 ||
710 }
711 bool isSpawnedByDefault() const { return m_spawnedByDefault; }
714 void Refresh();
715 void Delete();
716 void getFishLoot(Loot* loot, Player* loot_owner);
718 void SetGoState(GOState state);
722 uint32 GetTransportPathProgress() const { return m_goValue.Transport.PathProgress; }
723 void SetTransportPathProgress(uint32 pathProgress);
724 void SetLegacyTransportTravelTime(uint32 travelTime);
728 std::vector<uint32> const* GetPauseTimes() const;
731 void SetGoArtKit(uint8 artkit);
735 static void SetGoArtKit(uint8 artkit, GameObject* go, uint32 lowguid = 0);
736 bool SetPhased(uint32 id, bool update, bool apply) OVERRIDE;
737 void SetPhaseMask(uint32 newPhaseMask, bool update) OVERRIDE;
738 void EnableCollision(bool enable);
739
740 void Use(Unit* user);
741
743 // Note: unit is only used when s = GO_ACTIVATED
744 void SetLootState(LootState s, Unit* unit = NULL);
745
746 uint16 GetLootMode() const { return m_LootMode; }
747 bool HasLootMode(uint16 lootMode) const { return m_LootMode & lootMode; }
748 void SetLootMode(uint16 lootMode) { m_LootMode = lootMode; }
749 void AddLootMode(uint16 lootMode) { m_LootMode |= lootMode; }
750 void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
752
753 void AddToSkillupList(uint32 PlayerGuidLow) { m_SkillupList.push_back(PlayerGuidLow); }
754 bool IsInSkillupList(uint32 PlayerGuidLow) const
755 {
756 for (std::list<uint32>::const_iterator i = m_SkillupList.begin(); i != m_SkillupList.end(); ++i)
757 if (*i == PlayerGuidLow)
758 return true;
759
760 return false;
761 }
762 void ClearSkillupList() { m_SkillupList.clear(); }
763
764 void AddUniqueUse(Player* player);
765 void AddUse() { ++m_usetimes; }
766
767 uint32 GetUseCount() const { return m_usetimes; }
768 uint32 GetUniqueUseCount() const { return m_unique_users.size(); }
769
771
773
774 Player* GetLootRecipient() const;
776 void SetLootRecipient(Unit* unit);
777 bool IsLootAllowedFor(Player const* player) const;
779 uint32 m_groupLootTimer; // (msecs)timer used for group loot
780 uint32 lootingGroupLowGUID; // used to find group which is looting
781
782 bool hasQuest(uint32 quest_id) const OVERRIDE;
783 bool hasInvolvedQuest(uint32 quest_id) const OVERRIDE;
784 bool ActivateToQuest(Player* target) const;
785 void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false, Unit* user = NULL);
786 // 0 = use `gameobject`.`spawntimesecs`
787 void ResetDoorOrButton();
788
789 void TriggeringLinkedGameObject(uint32 trapEntry, Unit* target);
790
791 bool IsAlwaysVisibleFor(WorldObject const* seer) const OVERRIDE;
793
795 {
796 if (Unit* owner = GetOwner())
797 return owner->getLevelForTarget(target);
798
799 return 1;
800 }
801
803
804 void CastSpell(Unit* target, uint32 spell);
805 void SendCustomAnim(uint32 anim);
806 bool IsInRange(float x, float y, float z, float radius) const;
807
808 void ModifyHealth(int32 change, Unit* attackerOrHealer = NULL, uint32 spellId = 0);
809 // sets GameObject type 33 destruction flags and optionally default health for that state
810 void SetDestructibleState(GameObjectDestructibleState state, Player* eventInvoker = NULL, bool setHealth = false);
819
820 void EventInform(uint32 eventId);
821
822 uint64 GetRotation() const { return m_rotation; }
823 virtual uint32 GetScriptId() const { return GetGOInfo()->ScriptId; }
824 GameObjectAI* AI() const { return m_AI; }
825
826 std::string GetAIName() const;
827 void SetDisplayId(uint32 displayid);
829
831 void GetRespawnPosition(float& x, float& y, float& z, float* ori = NULL) const;
832
833 Transport* ToTransport() { if (IS_MO_TRANSPORT_GUID(GetGUID())) return reinterpret_cast<Transport*>(this); else return NULL; }
834 Transport const* ToTransport() const { if (IS_MO_TRANSPORT_GUID(GetGUID())) return reinterpret_cast<Transport const*>(this); else return NULL; }
835
836 float GetStationaryX() const OVERRIDE { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionX(); return GetPositionX(); }
837 float GetStationaryY() const OVERRIDE { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionY(); return GetPositionY(); }
838 float GetStationaryZ() const OVERRIDE { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetPositionZ(); return GetPositionZ(); }
839 float GetStationaryO() const OVERRIDE { if (GetGOInfo()->type != GAMEOBJECT_TYPE_MO_TRANSPORT) return m_stationaryPosition.GetOrientation(); return GetOrientation(); }
840
841 void UpdateModelPosition();
842
844protected:
845 bool AIM_Initialize();
847 void UpdateModel(); // updates model in case displayId were changed
850 void HandleLegacyTransportStateChange(GOState oldState, GOState newState);
851 void SetLegacyTransportStopped(bool stopped);
855 time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()),
856 uint32 m_respawnDelayTime; // (secs) if 0 then current GO state no dependent from timer
859 time_t m_cooldownTime; // used as internal reaction delay time store (not state change reaction).
860 // For traps this: spell casting cooldown, for doors/buttons: reset time.
861 std::list<uint32> m_SkillupList;
862
863 Player* m_ritualOwner; // used for GAMEOBJECT_TYPE_SUMMONING_RITUAL where GO is not summoned (no owner)
864 std::set<uint64> m_unique_users;
866
867 typedef std::map<uint32, uint64> ChairSlotAndUser;
869
874 std::vector<uint32> m_transportPauseTimes;
875
878
881 uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
882private:
883 void RemoveFromOwner();
884 void SwitchDoorOrButton(bool activate, bool alternative = false);
885
887 bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool /*is3D*/) const OVERRIDE
888 {
890 return IsInRange(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare);
891 }
893};
894#endif
LocaleConstant
Definition Common.h:138
@ IN_MILLISECONDS
Definition Common.h:125
std::vector< std::string > StringVector
Definition Common.h:163
std::int32_t int32
Definition Define.h:73
std::uint8_t uint8
Definition Define.h:79
std::uint32_t uint32
Definition Define.h:77
#define OVERRIDE
Definition Define.h:60
std::uint64_t uint64
Definition Define.h:76
std::uint16_t uint16
Definition Define.h:78
static constexpr LootState GO_READY
static constexpr GOState GO_STATE_ACTIVE_ALTERNATIVE
static constexpr LootState GO_NOT_READY
static constexpr LootState GO_JUST_DEACTIVATED
static constexpr GOState GO_STATE_ACTIVE
static constexpr GOState GO_STATE_READY
static constexpr LootState GO_ACTIVATED
#define ASSERT
Definition Errors.h:29
LootState
Definition GameObject.h:615
UNORDERED_MAP< uint32, GameObjectTemplate > GameObjectTemplateContainer
Definition GameObject.h:529
#define MAX_GAMEOBJECT_QUEST_ITEMS
Definition GameObject.h:20
GOState
Definition GameObject.h:575
@ GO_STATE_TRANSPORT_ACTIVE
Definition GameObject.h:580
@ GO_STATE_PREPARE_TRANSPORT
Definition GameObject.h:579
@ GO_STATE_TRANSPORT_STOPPED
Definition GameObject.h:581
bool IS_MO_TRANSPORT_GUID(uint64 guid)
bool IS_PLAYER_GUID(uint64 guid)
GameobjectTypes
@ GAMEOBJECT_TYPE_CAMERA
@ GAMEOBJECT_TYPE_BUTTON
@ GAMEOBJECT_TYPE_SPELL_FOCUS
@ GAMEOBJECT_TYPE_MO_TRANSPORT
@ GAMEOBJECT_TYPE_TRANSPORT
@ GAMEOBJECT_TYPE_TRAP
@ GAMEOBJECT_TYPE_CHEST
@ GAMEOBJECT_TYPE_FISHINGHOLE
@ GAMEOBJECT_TYPE_FLAGDROP
@ GAMEOBJECT_TYPE_QUESTGIVER
@ GAMEOBJECT_TYPE_SPELLCASTER
@ GAMEOBJECT_TYPE_FLAGSTAND
@ GAMEOBJECT_TYPE_TEXT
@ GAMEOBJECT_TYPE_AREADAMAGE
@ GAMEOBJECT_TYPE_GOOBER
@ GAMEOBJECT_TYPE_DOOR
@ GAMEOBJECT_TYPE_GUARDPOST
#define MAX_GAMEOBJECT_DATA
GameObjectDestructibleState
@ GO_DESTRUCTIBLE_DESTROYED
@ GO_DESTRUCTIBLE_INTACT
@ GO_DESTRUCTIBLE_DAMAGED
@ LOOT_MODE_DEFAULT
@ GO_FLAG_DESTROYED
@ GO_FLAG_DAMAGED
#define UNORDERED_MAP
@ GAMEOBJECT_FIELD_PERCENT_HEALTH
@ GAMEOBJECT_FIELD_DISPLAY_ID
@ GAMEOBJECT_FIELD_CREATED_BY
@ GAMEOBJECT_FIELD_STATE_SPELL_VISUAL_ID
@ GAMEOBJECT_FIELD_FLAGS
std::vector< uint32 > m_transportPauseTimes
Definition GameObject.h:874
uint32 GetRespawnDelay() const
Definition GameObject.h:713
void SetGoState(GOState state)
Unit * GetOwner() const
Player * m_ritualOwner
Definition GameObject.h:863
void UpdateLegacyTransportPathProgress()
GameObjectValue m_goValue
Definition GameObject.h:873
std::string const & GetNameForLocaleIdx(LocaleConstant locale_idx) const OVERRIDE
void AddLootMode(uint16 lootMode)
Definition GameObject.h:749
GameObjectTemplate const * GetGOInfo() const
Definition GameObject.h:643
uint32 GetTransportPathProgress() const
Definition GameObject.h:722
uint32 GetDBTableGUIDLow() const
Definition GameObject.h:651
GOState GetGoState() const
Definition GameObject.h:717
time_t m_respawnTime
Definition GameObject.h:855
void DeleteFromDB()
time_t m_cooldownTime
Definition GameObject.h:859
void AddUse()
Definition GameObject.h:765
void RemoveFromWorld() OVERRIDE
void SetGoArtKit(uint8 artkit)
GameObjectData const * m_goData
Definition GameObject.h:872
LootState getLootState() const
Definition GameObject.h:742
uint32 GetSpellId() const
Definition GameObject.h:687
bool IsAlwaysVisibleFor(WorldObject const *seer) const OVERRIDE
void SetOwnerGUID(uint64 owner)
Definition GameObject.h:665
uint8 GetGoAnimProgress() const
Definition GameObject.h:732
uint64 GetOwnerGUID() const
Definition GameObject.h:679
Position m_stationaryPosition
Definition GameObject.h:877
float GetStationaryY() const OVERRIDE
Definition GameObject.h:837
bool IsInvisibleDueToDespawn() const OVERRIDE
void UseDoorOrButton(uint32 time_to_restore=0, bool alternative=false, Unit *user=NULL)
void Delete()
bool hasInvolvedQuest(uint32 quest_id) const OVERRIDE
void UpdateWorldRotationField()
Group * GetLootRecipientGroup() const
uint32 GetUniqueUseCount() const
Definition GameObject.h:768
void UpdateRotationFields(float rotation2=0.0f, float rotation3=0.0f)
void SetGameobjectTransparence(uint8 transparency)
Definition GameObject.h:734
uint16 m_LootMode
Definition GameObject.h:881
void EnableCollision(bool enable)
uint8 GetGoArtKit() const
Definition GameObject.h:730
void SetGoAnimProgress(uint8 animprogress)
Definition GameObject.h:733
uint32 m_DBTableGuid
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition GameObject.h:870
void AddToSkillupList(uint32 PlayerGuidLow)
Definition GameObject.h:753
bool isSpawned() const
Definition GameObject.h:705
void InitializeLegacyTransport()
bool isSpawnedByDefault() const
Definition GameObject.h:711
ChairSlotAndUser ChairListSlots
Definition GameObject.h:868
uint32 GetTransportPeriod() const
bool HasLootMode(uint16 lootMode) const
Definition GameObject.h:747
void MarkLegacyTransportPathProgressChanged()
GameObjectData const * GetGOData() const
Definition GameObject.h:644
GameObjectValue const * GetGOValue() const
Definition GameObject.h:645
Player * GetLootRecipient() const
GameObjectModel * CreateModel()
uint32 m_spellId
Definition GameObject.h:854
bool _IsWithinDist(WorldObject const *obj, float dist2compare, bool) const OVERRIDE
Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size...
Definition GameObject.h:887
time_t GetRespawnTime() const
Definition GameObject.h:689
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, GOState go_state, uint32 artKit=0)
bool HasLootRecipient() const
Definition GameObject.h:778
void CleanupsBeforeDelete(bool finalCleanup=true) OVERRIDE
uint32 m_respawnDelayTime
Definition GameObject.h:856
GameObjectAI * AI() const
Definition GameObject.h:824
void ResetLootMode()
Definition GameObject.h:751
void SetLegacyTransportTravelTime(uint32 travelTime)
void SetLegacyTransportStopped(bool stopped)
bool IsInRange(float x, float y, float z, float radius) const
void RemoveLootMode(uint16 lootMode)
Definition GameObject.h:750
static GameObject * GetGameObject(WorldObject &object, uint64 guid)
void SetRespawnTime(int32 respawn)
Definition GameObject.h:699
void SetSpawnedByDefault(bool b)
Definition GameObject.h:712
void TriggeringLinkedGameObject(uint32 trapEntry, Unit *target)
GameobjectTypes GetGoType() const
Definition GameObject.h:719
Transport const * ToTransport() const
Definition GameObject.h:834
uint64 m_rotation
Definition GameObject.h:876
void SetGoType(GameobjectTypes type)
Definition GameObject.h:720
void StartLegacyTransportToFirstStop(uint32 travelTime)
bool LoadGameObjectFromDB(uint32 guid, Map *map, bool addToMap=true)
bool ActivateToQuest(Player *target) const
void SetTransportPathProgress(uint32 pathProgress)
void AddToWorld() OVERRIDE
void StopLegacyTransportAtInitialStop()
void SetPhaseMask(uint32 newPhaseMask, bool update) OVERRIDE
bool AIM_Initialize()
uint8 getLevelForTarget(WorldObject const *target) const OVERRIDE
Definition GameObject.h:794
void RemoveFromOwner()
void HandleLegacyTransportStateChange(GOState oldState, GOState newState)
void SaveRespawnTime() OVERRIDE
void SendCustomAnim(uint32 anim)
void Refresh()
time_t GetRespawnTimeEx() const
Definition GameObject.h:690
void SetLootRecipient(Unit *unit)
GameObjectAI * m_AI
Definition GameObject.h:892
uint32 GetDisplayId() const
Definition GameObject.h:828
GameObjectModel * m_model
Definition GameObject.h:830
void ResetDoorOrButton()
void EventInform(uint32 eventId)
virtual uint32 GetScriptId() const
Definition GameObject.h:823
void UpdateModelPosition()
bool SetPhased(uint32 id, bool update, bool apply) OVERRIDE
void Update(uint32 p_time) OVERRIDE
float GetStationaryZ() const OVERRIDE
Definition GameObject.h:838
void SetLootMode(uint16 lootMode)
Definition GameObject.h:748
GameObject * LookupFishingHoleAround(float range)
void BuildValuesUpdate(uint8 updatetype, ByteBuffer *data, Player *target) const OVERRIDE
uint32 GetUseCount() const
Definition GameObject.h:767
uint64 GetRotation() const
Definition GameObject.h:822
void SetDisplayId(uint32 displayid)
GameObjectTemplate const * m_goInfo
Definition GameObject.h:871
uint32 GetGOStateValue(GOState state)
std::string GetAIName() const
void SetLootState(LootState s, Unit *unit=NULL)
float GetStationaryO() const OVERRIDE
Definition GameObject.h:839
uint32 m_groupLootTimer
Definition GameObject.h:779
bool LoadFromDB(uint32 guid, Map *map)
Definition GameObject.h:661
void StopLegacyTransportAtCurrentProgress()
void SetDestructibleState(GameObjectDestructibleState state, Player *eventInvoker=NULL, bool setHealth=false)
void UpdateModel()
void Use(Unit *user)
bool IsDynTransport() const
void SwitchDoorOrButton(bool activate, bool alternative=false)
uint32 m_lootRecipientGroup
Definition GameObject.h:880
bool IsDestructibleBuilding() const
std::list< uint32 > m_SkillupList
Definition GameObject.h:861
void CastSpell(Unit *target, uint32 spell)
void SaveToDB()
void ModifyHealth(int32 change, Unit *attackerOrHealer=NULL, uint32 spellId=0)
uint16 GetLootMode() const
Definition GameObject.h:746
std::set< uint64 > m_unique_users
Definition GameObject.h:864
void getFishLoot(Loot *loot, Player *loot_owner)
Transport * ToTransport()
Definition GameObject.h:833
uint64 m_lootRecipient
Definition GameObject.h:879
void ClearSkillupList()
Definition GameObject.h:762
uint32 lootingGroupLowGUID
Definition GameObject.h:780
bool m_spawnedByDefault
Definition GameObject.h:858
void SetGoHealth(uint8 health)
Definition GameObject.h:729
void GetRespawnPosition(float &x, float &y, float &z, float *ori=NULL) const
uint32 GetLegacyTransportTargetProgress(GOState state) const
GameObjectDestructibleState GetDestructibleState() const
Definition GameObject.h:811
bool IsLootAllowedFor(Player const *player) const
LootState m_lootState
Definition GameObject.h:857
void AddUniqueUse(Player *player)
bool hasQuest(uint32 quest_id) const OVERRIDE
bool IsInSkillupList(uint32 PlayerGuidLow) const
Definition GameObject.h:754
float GetStationaryX() const OVERRIDE
Definition GameObject.h:836
uint32 m_usetimes
Definition GameObject.h:865
void SetSpellId(uint32 id)
Definition GameObject.h:682
std::vector< uint32 > const * GetPauseTimes() const
bool IsTransport() const
std::map< uint32, uint64 > ChairSlotAndUser
Definition GameObject.h:867
Definition Group.h:147
Definition Map.h:238
MapObject()
Definition Object.h:593
friend class Map
Definition Object.h:589
uint8 GetByteValue(uint16 index, uint8 offset) const
Definition Object.cpp:343
void SetByteValue(uint16 index, uint8 offset, uint8 value)
Definition Object.cpp:1158
uint64 GetGUID() const
Definition Object.h:119
uint32 GetUInt32Value(uint16 index) const
Definition Object.cpp:325
uint64 GetUInt64Value(uint16 index) const
Definition Object.cpp:331
bool HasFlag(uint16 index, uint32 flag) const
Definition Object.cpp:1309
void SetUInt64Value(uint16 index, uint64 value)
Definition Object.cpp:1079
Definition Unit.h:1367
WorldObject(bool isWorldObject)
Definition Object.cpp:1514
uint32 phaseGroup
Definition GameObject.h:593
int32 spawntimesecs
Definition GameObject.h:602
uint32 animprogress
Definition GameObject.h:603
GOState go_state
Definition GameObject.h:604
StringVector CastBarCaption
Definition GameObject.h:570
StringVector Name
Definition GameObject.h:569
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@114312050106372302366137106154036240136321221160 barberChair
uint32 questItems[MAX_GAMEOBJECT_QUEST_ITEMS]
Definition GameObject.h:35
uint32 GetAutoCloseTime() const
Definition GameObject.h:470
uint32 data[MAX_GAMEOBJECT_DATA]
Definition GameObject.h:385
uint32 debuildingTimeSecs
Definition GameObject.h:364
std::string AIName
Definition GameObject.h:389
uint32 GetGossipMenuId() const
Definition GameObject.h:496
bool IsUsableMounted() const
Definition GameObject.h:403
std::string unk1
Definition GameObject.h:31
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@076042223047135343272115231235004103107103052206 raw
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@305170115206217123075252230002031012374050120223 _generic
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@253305212064111242104116123236360243075266147175 flagstand
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@152130076372303155010023156377005036224346144151 camera
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@154136051106040324176270267211357174344063050360 chest
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@006357112111137007236202170023313137143054376130 meetingstone
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@133216107201365043142154201341232071301300107152 transport
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@123226111052016276351151304242210263221014374335 miniGame
bool IsDespawnAtAction() const
Definition GameObject.h:393
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@320106322155335070244355001342376316375133154215 guardpost
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@076241013146174060203322361030304357327036335177 spellFocus
uint32 GetCharges() const
Definition GameObject.h:448
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@155125343144143170177322306114162367114353163373 capturePoint
uint32 GetEventScriptId() const
Definition GameObject.h:506
uint32 GetCooldown() const
Definition GameObject.h:517
bool GetDespawnPossibility() const
Definition GameObject.h:434
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@334327144355150311317234223372371064337023010042 trap
uint32 GetLinkedGameObjectEntry() const
Definition GameObject.h:459
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@105243172300324111262263021120111346345123061033 summoningRitual
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@316034272062200025205312222263007157266267301257 chair
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@243266127071011160240350104214013054067132104252 fishinghole
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@372164005374162031007145203130116023353076041117 text
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@110054372326320106132141070072073073207136033072 areadamage
std::string name
Definition GameObject.h:28
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@355120113310341064010230330064160137211072063155 auraGenerator
uint32 chestRestockTime
Definition GameObject.h:82
uint32 creditProxyCreature
Definition GameObject.h:349
uint32 casterTargetSpellTargets
Definition GameObject.h:233
uint32 ritualNoTargetCheck
Definition GameObject.h:235
std::string castBarCaption
Definition GameObject.h:30
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@315077355127077256043020131262337362171234125061 spellcaster
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@041347154150020206261150105351300331163012356113 flagdrop
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@030154355127376377116310314155367165157323234200 door
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@373071171166305347132053276077134300330265313251 trapDoor
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@051373074222356223242007054322075203035261000330 dungeonDifficulty
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@240010171105306235035040051230330371375266145364 building
uint32 GetLockId() const
Definition GameObject.h:415
std::string IconName
Definition GameObject.h:29
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@316212233253022127367165230227137227160036113140 moTransport
uint32 ignoredByPathing
Definition GameObject.h:48
uint32 destroyedDisplayId
Definition GameObject.h:358
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@336001126101306307066053364273045317014372227110 questgiver
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@336060043160212225074214221232260020127013174055 goober
uint32 WorldStateSetsState
Definition GameObject.h:178
uint32 GetLootId() const
Definition GameObject.h:486
struct GameObjectTemplate::@046065176235271051340241126110345143267101032070::@035305233304037036156142147071371001131016202245 button
float GetPositionZ() const
Definition Object.h:330
float GetOrientation() const
Definition Object.h:331
float GetPositionX() const
Definition Object.h:328
float GetPositionY() const
Definition Object.h:329
OPvPCapturePoint * OPvPObj
Definition GameObject.h:557
struct GameObjectValue::@066256034265023241167237377333252073230363372212 Building
uint32 StateChangeTime
Definition GameObject.h:542
uint32 StateChangeProgress
Definition GameObject.h:544
struct GameObjectValue::@350066061234367104023065253003102330370272142167 FishingHole
uint32 PathProgress
Definition GameObject.h:539
TransportAnimation const * AnimationInfo
Definition GameObject.h:540
struct GameObjectValue::@025075162376101103170270322056027246243136234264 CapturePoint
bool WaitingAtPathStart
Definition GameObject.h:546
uint32 HoldProgress
Definition GameObject.h:545
uint32 StateChangeEndTime
Definition GameObject.h:543