TrinityCore
Loading...
Searching...
No Matches
GameObject.h
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18#ifndef TRINITYCORE_GAMEOBJECT_H
19#define TRINITYCORE_GAMEOBJECT_H
20
21#include "Object.h"
22#include "GridObject.h"
23#include "GameObjectData.h"
24#include "MapObject.h"
25#include "SharedDefines.h"
26
27class GameObject;
28class GameObjectAI;
29class GameObjectModel;
31class Transport;
32class TransportBase;
33class Unit;
34struct Loot;
38
39namespace Vignettes
40{
41struct VignetteData;
42}
43
44// enum for GAMEOBJECT_TYPE_NEW_FLAG
45// values taken from world state
46enum class FlagState : uint8
47{
48 InBase = 1,
49 Taken,
50 Dropped,
52};
53
54namespace WorldPackets
55{
56 namespace Battleground
57 {
59 }
60}
61
62// Base class for GameObject type specific implementations
64{
65public:
67 {
68 public:
69 virtual ~CustomCommand();
70 virtual void Execute(GameObjectTypeBase& type) const = 0;
71 };
72
73 explicit GameObjectTypeBase(GameObject& owner) : _owner(owner) { }
74 virtual ~GameObjectTypeBase() = default;
75
76 virtual void Update([[maybe_unused]] uint32 diff) { }
77 virtual void OnStateChanged([[maybe_unused]] GOState oldState, [[maybe_unused]] GOState newState) { }
78 virtual void OnRelocated() { }
79 virtual bool IsNeverVisibleFor([[maybe_unused]] WorldObject const* seer, [[maybe_unused]] bool allowServersideObjects) const { return false; }
80 virtual void ActivateObject([[maybe_unused]] GameObjectActions action, [[maybe_unused]] int32 param, [[maybe_unused]] WorldObject* spellCaster = nullptr, [[maybe_unused]] uint32 spellId = 0, [[maybe_unused]] int32 effectIndex = -1) { }
81
82protected:
84};
85
86namespace GameObjectType
87{
89{
90public:
92
93 void Execute(GameObjectTypeBase& type) const override;
94
95private:
96 bool _on;
97};
98
100{
101public:
102 explicit SetNewFlagState(FlagState state, Player* player);
103
104 void Execute(GameObjectTypeBase& type) const override;
105
106private:
109};
110
112{
113public:
114 explicit SetControlZoneValue(Optional<uint32> value = { });
115
116 void Execute(GameObjectTypeBase& type) const override;
117
118private:
120};
121
122}
123
125{
126 //6 GAMEOBJECT_TYPE_TRAP
127 struct
128 {
131 //25 GAMEOBJECT_TYPE_FISHINGHOLE
132 struct
133 {
136 //29 GAMEOBJECT_TYPE_CONTROL_ZONE
137 struct
138 {
141 //33 GAMEOBJECT_TYPE_DESTRUCTIBLE_BUILDING
142 struct
143 {
147 //42 GAMEOBJECT_TYPE_CAPTURE_POINT
148 struct
149 {
154};
155
156// For containers: [GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY -> ...
157// For bobber: GO_NOT_READY ->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED-><deleted>
158// For door(closed):[GO_NOT_READY]->GO_READY (close)->GO_ACTIVATED (open) ->GO_JUST_DEACTIVATED->GO_READY(close) -> ...
159// For door(open): [GO_NOT_READY]->GO_READY (open) ->GO_ACTIVATED (close)->GO_JUST_DEACTIVATED->GO_READY(open) -> ...
161{
163 GO_READY, // can be ready but despawned, and then not possible activate until spawn
167
168// 5 sec for bobber catch
169#define FISHING_BOBBER_READY_TIME 5
170
171class TC_GAME_API GameObject : public WorldObject, public GridObject<GameObject>, public MapObject
172{
173 public:
174 explicit GameObject();
175 ~GameObject();
176
177 protected:
178 void BuildValuesCreate(UF::UpdateFieldFlag flags, ByteBuffer& data, Player const* target) const override;
179 void BuildValuesUpdate(UF::UpdateFieldFlag flags, ByteBuffer& data, Player const* target) const override;
180 void ClearValuesChangesMask() override;
181
182 public:
183 void BuildValuesUpdateForPlayerWithMask(UpdateData* data, UF::ObjectData::Mask const& requestedObjectMask,
184 UF::GameObjectData::Mask const& requestedGameObjectMask, Player const* target, bool ignoreNestedChangesMask) const;
185
186 struct ValuesUpdateForPlayerWithMaskSender // sender compatible with MessageDistDeliverer
187 {
188 explicit ValuesUpdateForPlayerWithMaskSender(GameObject const* owner) : Owner(owner), IgnoreNestedChangesMask(false) { }
189
194
195 void operator()(Player const* player) const;
196 };
197
198 void AddToWorld() override;
199 void RemoveFromWorld() override;
200 void CleanupsBeforeDelete(bool finalCleanup = true) override;
201
202 private:
203 bool Create(uint32 entry, Map* map, Position const& pos, QuaternionData const& rotation, uint32 animProgress, GOState goState, uint32 artKit, bool dynamic, ObjectGuid::LowType spawnid);
204 public:
205 static GameObject* CreateGameObject(uint32 entry, Map* map, Position const& pos, QuaternionData const& rotation, uint32 animProgress, GOState goState, uint32 artKit = 0);
206 static GameObject* CreateGameObjectFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap = true);
207
208 void Update(uint32 diff) override;
209 GameObjectTemplate const* GetGOInfo() const { return m_goInfo; }
210 GameObjectTemplateAddon const* GetTemplateAddon() const { return m_goTemplateAddon; }
211 GameObjectOverride const* GetGameObjectOverride() const;
212 GameObjectData const* GetGameObjectData() const { return m_goData; }
213 GameObjectValue const* GetGOValue() const { return &m_goValue; }
214
215 bool IsTransport() const;
216 bool IsDestructibleBuilding() const;
217
218 ObjectGuid::LowType GetSpawnId() const { return m_spawnId; }
219
220 // z_rot, y_rot, x_rot - rotation angles around z, y and x axes
221 void SetLocalRotationAngles(float z_rot, float y_rot, float x_rot);
222 void SetLocalRotation(float qx, float qy, float qz, float qw);
223 void SetParentRotation(QuaternionData const& rotation); // transforms(rotates) transport's path
224 QuaternionData const& GetLocalRotation() const { return m_localRotation; }
225 int64 GetPackedLocalRotation() const { return m_packedRotation; }
226
227 QuaternionData GetWorldRotation() const;
228
229 // overwrite WorldObject function for proper name localization
230 std::string GetNameForLocaleIdx(LocaleConstant locale) const override;
231
232 bool HasLabel(int32 gameobjectLabel) const;
233 std::span<int32 const> GetLabels() const;
234
235 void SaveToDB();
236 void SaveToDB(uint32 mapid, std::vector<Difficulty> const& spawnDifficulties);
237 bool LoadFromDB(ObjectGuid::LowType spawnId, Map* map, bool addToMap, bool = true); // arg4 is unused, only present to match the signature on Creature
238 static bool DeleteFromDB(ObjectGuid::LowType spawnId);
239
240 ObjectGuid GetCreatorGUID() const override { return m_gameObjectData->CreatedBy; }
242 {
243 // Owner already found and different than expected owner - remove object from old owner
244 if (!owner.IsEmpty() && !GetOwnerGUID().IsEmpty() && GetOwnerGUID() != owner)
245 {
246 ABORT();
247 }
248 m_spawnedByDefault = false; // all object with owner is despawned after delay
249 SetUpdateFieldValue(m_values.ModifyValue(&GameObject::m_gameObjectData).ModifyValue(&UF::GameObjectData::CreatedBy), owner);
250 }
251 ObjectGuid GetOwnerGUID() const override { return m_gameObjectData->CreatedBy; }
252
254 {
255 m_spawnedByDefault = false; // all summoned object is despawned after delay
256 m_spellId = id;
257 }
258 uint32 GetSpellId() const { return m_spellId;}
259
260 time_t GetRespawnTime() const { return m_respawnTime; }
261 time_t GetRespawnTimeEx() const;
262
263 void SetRespawnTime(int32 respawn);
264 void Respawn();
265 bool isSpawned() const
266 {
267 return m_respawnDelayTime == 0 ||
268 (m_respawnTime > 0 && !m_spawnedByDefault) ||
269 (m_respawnTime == 0 && m_spawnedByDefault);
270 }
271 bool isSpawnedByDefault() const { return m_spawnedByDefault; }
272 void SetSpawnedByDefault(bool b) { m_spawnedByDefault = b; }
273 uint32 GetRespawnDelay() const { return m_respawnDelayTime; }
274 void Refresh();
275 void DespawnOrUnsummon(Milliseconds delay = 0ms, Seconds forceRespawnTime = 0s);
276 void DespawnForPlayer(Player* seer, Seconds respawnTime);
277 void Delete();
278 void SendGameObjectDespawn();
279 Loot* GetFishLoot(Player* lootOwner);
280 Loot* GetFishLootJunk(Player* lootOwner);
281
282 bool HasFlag(GameObjectFlags flags) const { return (*m_gameObjectData->Flags & flags) != 0; }
283 void SetFlag(GameObjectFlags flags) { SetUpdateFieldFlagValue(m_values.ModifyValue(&GameObject::m_gameObjectData).ModifyValue(&UF::GameObjectData::Flags), flags); }
284 void RemoveFlag(GameObjectFlags flags) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&GameObject::m_gameObjectData).ModifyValue(&UF::GameObjectData::Flags), flags); }
285 void ReplaceAllFlags(GameObjectFlags flags) { SetUpdateFieldValue(m_values.ModifyValue(&GameObject::m_gameObjectData).ModifyValue(&UF::GameObjectData::Flags), flags); }
286
287 void SetLevel(uint32 level) { SetUpdateFieldValue(m_values.ModifyValue(&GameObject::m_gameObjectData).ModifyValue(&UF::GameObjectData::Level), level); }
288 GameobjectTypes GetGoType() const { return GameobjectTypes(*m_gameObjectData->TypeID); }
289 void SetGoType(GameobjectTypes type) { SetUpdateFieldValue(m_values.ModifyValue(&GameObject::m_gameObjectData).ModifyValue(&UF::GameObjectData::TypeID), type); }
290 GOState GetGoState() const { return GOState(*m_gameObjectData->State); }
291 void SetGoState(GOState state);
292 GOState GetGoStateFor(ObjectGuid const& viewer) const;
293 void SetGoStateFor(GOState state, Player const* viewer);
294 uint32 GetGoArtKit() const { return m_gameObjectData->ArtKit; }
295 void SetGoArtKit(uint32 artkit);
296 uint8 GetGoAnimProgress() const { return m_gameObjectData->PercentHealth; }
297 void SetGoAnimProgress(uint8 animprogress) { SetUpdateFieldValue(m_values.ModifyValue(&GameObject::m_gameObjectData).ModifyValue(&UF::GameObjectData::PercentHealth), animprogress); }
298 static void SetGoArtKit(uint32 artkit, GameObject* go, ObjectGuid::LowType lowguid = UI64LIT(0));
299
300 std::span<uint32 const> GetPauseTimes() const;
301 Optional<float> GetPathProgressForClient() const { return m_transportPathProgress; }
302 void SetPathProgressForClient(float progress);
303
304 void EnableCollision(bool enable);
305
306 void Use(Unit* user, bool ignoreCastInProgress = false);
307
308 LootState getLootState() const { return m_lootState; }
309 // Note: unit is only used when s = GO_ACTIVATED
310 void SetLootState(LootState s, Unit* unit = nullptr);
311
312 uint16 GetLootMode() const { return m_LootMode; }
313 bool HasLootMode(uint16 lootMode) const { return (m_LootMode & lootMode) != 0; }
314 void SetLootMode(uint16 lootMode) { m_LootMode = lootMode; }
315 void AddLootMode(uint16 lootMode) { m_LootMode |= lootMode; }
316 void RemoveLootMode(uint16 lootMode) { m_LootMode &= ~lootMode; }
317 void ResetLootMode() { m_LootMode = LOOT_MODE_DEFAULT; }
318 void ClearLoot();
319 bool IsFullyLooted() const;
320 void OnLootRelease(Player* looter);
321
322 void AddToSkillupList(ObjectGuid const& PlayerGuidLow) { m_SkillupList.insert(PlayerGuidLow); }
323 bool IsInSkillupList(ObjectGuid const& playerGuid) const
324 {
325 return m_SkillupList.count(playerGuid) > 0;
326 }
327 void ClearSkillupList() { m_SkillupList.clear(); }
328
329 void AddUniqueUse(Player* player);
330 void AddUse() { ++m_usetimes; }
331
332 uint32 GetUseCount() const { return m_usetimes; }
333 uint32 GetUniqueUseCount() const { return uint32(m_unique_users.size()); }
334
335 void SaveRespawnTime(uint32 forceDelay = 0);
336
337 std::unique_ptr<Loot> m_loot;
338 std::unordered_map<ObjectGuid, std::unique_ptr<Loot>> m_personalLoot;
339
340 GuidUnorderedSet const& GetTapList() const { return m_tapList; }
341 void SetTapList(GuidUnorderedSet tapList) { m_tapList = std::move(tapList); }
342 bool IsLootAllowedFor(Player const* player) const;
343 bool HasLootRecipient() const { return !m_tapList.empty(); }
344 Loot* GetLootForPlayer(Player const* /*player*/) const override;
345
346 GameObject* GetLinkedTrap();
347 void SetLinkedTrap(GameObject* linkedTrap) { m_linkedTrap = linkedTrap->GetGUID(); }
348
349 bool hasQuest(uint32 quest_id) const override;
350 bool hasInvolvedQuest(uint32 quest_id) const override;
351 bool HasConditionalInteraction() const;
352 bool CanActivateForPlayer(Player const* target) const;
353 bool ActivateToQuest(Player const* target) const;
354 void UseDoorOrButton(uint32 time_to_restore = 0, bool alternative = false, Unit* user = nullptr);
355 // 0 = use `gameobject`.`spawntimesecs`
356 void ResetDoorOrButton();
357 void ActivateObject(GameObjectActions action, int32 param, WorldObject* spellCaster = nullptr, uint32 spellId = 0, int32 effectIndex = -1);
358
359 void TriggeringLinkedGameObject(uint32 trapEntry, Unit* target);
360
361 bool IsNeverVisibleFor(WorldObject const* seer, bool allowServersideObjects) const override;
362 bool IsAlwaysVisibleFor(WorldObject const* seer) const override;
363 bool IsInvisibleDueToDespawn(WorldObject const* seer) const override;
364
365 uint8 GetLevelForTarget(WorldObject const* target) const override;
366
367 GameObject* LookupFishingHoleAround(float range);
368
369 void SendCustomAnim(uint32 anim);
370 bool IsInRange(float x, float y, float z, float radius) const;
371
372 void ModifyHealth(int32 change, WorldObject* attackerOrHealer = nullptr, uint32 spellId = 0);
373 // sets GameObject type 33 destruction flags and optionally default health for that state
374 void SetDestructibleState(GameObjectDestructibleState state, WorldObject* attackerOrHealer = nullptr, bool setHealth = false);
376 {
377 if ((*m_gameObjectData->Flags & GO_FLAG_DESTROYED))
379 if ((*m_gameObjectData->Flags & GO_FLAG_DAMAGED))
382 }
383
384 // There's many places not ready for dynamic spawns. This allows them to live on for now.
385 void SetRespawnCompatibilityMode(bool mode = true) { m_respawnCompatibilityMode = mode; }
386 bool GetRespawnCompatibilityMode() {return m_respawnCompatibilityMode; }
387
388 std::string const& GetAIName() const;
389 uint32 GetScriptId() const;
390 GameObjectAI* AI() const { return m_AI; }
391
392 void InheritStringIds(GameObject const* parent);
393 bool HasStringId(std::string_view id) const;
394 void SetScriptStringId(std::string id);
395 std::string_view GetStringId(StringIdType type) const { return m_stringIds[size_t(type)] ? std::string_view(*m_stringIds[size_t(type)]) : std::string_view(); }
396
397 SpawnTrackingStateData const* GetSpawnTrackingStateDataForPlayer(Player const* player) const override;
398
399 void SetDisplayId(uint32 displayid);
400 uint32 GetDisplayId() const { return m_gameObjectData->DisplayID; }
401 uint8 GetNameSetId() const;
402
403 uint32 GetFaction() const override { return m_gameObjectData->FactionTemplate; }
404 void SetFaction(uint32 faction) override { SetUpdateFieldValue(m_values.ModifyValue(&GameObject::m_gameObjectData).ModifyValue(&UF::GameObjectData::FactionTemplate), faction); }
405
406 std::unique_ptr<GameObjectModel> m_model;
407 Position GetRespawnPosition() const;
408
409 TransportBase* ToTransportBase() { return const_cast<TransportBase*>(const_cast<GameObject const*>(this)->ToTransportBase()); }
410 TransportBase const* ToTransportBase() const;
411
412 Transport* ToTransport() { return GetGoType() == GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT ? reinterpret_cast<Transport*>(this) : nullptr; }
413 Transport const* ToTransport() const { return GetGoType() == GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT ? reinterpret_cast<Transport const*>(this) : nullptr; }
414
415 Position const& GetStationaryPosition() const override { return m_stationaryPosition; }
416 void RelocateStationaryPosition(float x, float y, float z, float o) { m_stationaryPosition.Relocate(x, y, z, o); }
417 void RelocateStationaryPosition(Position const& pos) { m_stationaryPosition.Relocate(pos); }
418
419 void AfterRelocation();
420
421 float GetInteractionDistance() const;
422
423 void UpdateModelPosition();
424
425 bool IsAtInteractDistance(Position const& pos, float radius) const;
426 bool IsAtInteractDistance(Player const* player, SpellInfo const* spell = nullptr) const;
427
428 bool IsWithinDistInMap(Player const* player) const;
430
431 SpellInfo const* GetSpellForLock(Player const* player) const;
432
433 uint16 GetAIAnimKitId() const override { return _animKitId; }
434 void SetAnimKitId(uint16 animKitId, bool oneshot);
435
436 uint32 GetWorldEffectID() const { return _worldEffectID; }
437 void SetWorldEffectID(uint32 worldEffectID) { _worldEffectID = worldEffectID; }
438
439 Vignettes::VignetteData const* GetVignette() const { return m_vignette.get(); }
440 void SetVignette(uint32 vignetteId);
441
442 void SetSpellVisualId(int32 spellVisualId, ObjectGuid activatorGuid = ObjectGuid::Empty);
443 void AssaultCapturePoint(Player* player);
444 void UpdateCapturePoint();
445 bool CanInteractWithCapturePoint(Player const* target) const;
446 FlagState GetFlagState() const;
447 ObjectGuid const& GetFlagCarrierGUID() const;
448 time_t GetFlagTakenFromBaseTime() const;
449
450 GuidUnorderedSet const* GetInsidePlayers() const;
451
452 bool MeetsInteractCondition(Player const* user) const;
453
454 void AIM_Destroy();
455 bool AIM_Initialize();
456
457 std::string GetDebugInfo() const override;
458
459 void UpdateDynamicFlagsForNearbyPlayers();
460
461 void HandleCustomTypeCommand(GameObjectTypeBase::CustomCommand const& command) const;
462
464
465 TeamId GetControllingTeam() const;
466
467 protected:
468 void CreateModel();
469 void UpdateModel(); // updates model in case displayId were changed
471 time_t m_respawnTime; // (secs) time of next respawn (or despawn if GO have owner()),
472 uint32 m_respawnDelayTime; // (secs) if 0 then current GO state no dependent from timer
474 Seconds m_despawnRespawnTime; // override respawn time after delayed despawn
476 ObjectGuid m_lootStateUnitGUID; // GUID of the unit passed with SetLootState(LootState, Unit*)
479 time_t m_cooldownTime; // used as internal reaction delay time store (not state change reaction).
480 // For traps this: spell casting cooldown, for doors/buttons: reset time.
481 GOState m_prevGoState; // What state to set whenever resetting
482
484
485 ObjectGuid m_ritualOwnerGUID; // used for GAMEOBJECT_TYPE_RITUAL where GO is not summoned (no owner)
488
489 typedef std::map<uint32, ObjectGuid> ChairSlotAndUser;
491
496 std::unique_ptr<GameObjectTypeBase> m_goTypeImpl;
497 GameObjectValue m_goValue; // TODO: replace with m_goTypeImpl
498 std::array<std::string const*, 3> m_stringIds;
500
504
506 uint16 m_LootMode; // bitmask, default LOOT_MODE_DEFAULT, determines what loot will be lootable
507
509
510 private:
511 void RemoveFromOwner();
512 void SwitchDoorOrButton(bool activate, bool alternative = false);
513 void UpdatePackedRotation();
514
516 bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool /*is3D*/, bool /*incOwnRadius*/, bool /*incTargetRadius*/) const override
517 {
519 return IsInRange(obj->GetPositionX(), obj->GetPositionY(), obj->GetPositionZ(), dist2compare);
520 }
521
527
528 std::unique_ptr<Vignettes::VignetteData> m_vignette;
529
531 {
532 SystemTimePoint ValidUntil = SystemTimePoint::min();
534 bool Despawned = false;
535 };
536
537 std::unique_ptr<std::unordered_map<ObjectGuid, PerPlayerState>> m_perPlayerState;
538
539 std::unordered_map<ObjectGuid, PerPlayerState>& GetOrCreatePerPlayerStates();
540};
541#endif
LocaleConstant
Definition Common.h:51
#define TC_GAME_API
Definition Define.h:129
uint8_t uint8
Definition Define.h:156
int64_t int64
Definition Define.h:149
int32_t int32
Definition Define.h:150
#define UI64LIT(N)
Definition Define.h:139
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
uint16 flags
std::chrono::system_clock::time_point SystemTimePoint
Definition Duration.h:41
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition Duration.h:28
std::string GetDebugInfo()
Definition Errors.cpp:172
#define ABORT
Definition Errors.h:79
GameObjectActions
LootState
Definition GameObject.h:161
@ GO_ACTIVATED
Definition GameObject.h:164
@ GO_READY
Definition GameObject.h:163
@ GO_NOT_READY
Definition GameObject.h:162
@ GO_JUST_DEACTIVATED
Definition GameObject.h:165
FlagState
Definition GameObject.h:47
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition ObjectGuid.h:435
@ TYPEID_GAMEOBJECT
Definition ObjectGuid.h:46
std::set< ObjectGuid > GuidSet
Definition ObjectGuid.h:432
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition Optional.h:25
static void SaveToDB(QuestPool const &pool, CharacterDatabaseTransaction trans)
GameobjectTypes
@ GAMEOBJECT_TYPE_MAP_OBJ_TRANSPORT
StringIdType
GameObjectDestructibleState
@ GO_DESTRUCTIBLE_DESTROYED
@ GO_DESTRUCTIBLE_INTACT
@ GO_DESTRUCTIBLE_DAMAGED
@ LOOT_MODE_DEFAULT
GameObjectFlags
@ GO_FLAG_DESTROYED
@ GO_FLAG_DAMAGED
GOState
TriggerCastFlags
SpellTargetCheckTypes
Definition SpellInfo.h:80
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
virtual void Execute(GameObjectTypeBase &type) const =0
virtual void Update(uint32 diff)
Definition GameObject.h:76
virtual ~GameObjectTypeBase()=default
virtual void OnRelocated()
Definition GameObject.h:78
GameObjectTypeBase(GameObject &owner)
Definition GameObject.h:73
virtual void ActivateObject(GameObjectActions action, int32 param, WorldObject *spellCaster=nullptr, uint32 spellId=0, int32 effectIndex=-1)
Definition GameObject.h:80
virtual bool IsNeverVisibleFor(WorldObject const *seer, bool allowServersideObjects) const
Definition GameObject.h:79
virtual void OnStateChanged(GOState oldState, GOState newState)
Definition GameObject.h:77
GameObject & _owner
Definition GameObject.h:83
uint32 GetRespawnDelay() const
Definition GameObject.h:273
uint32 _worldEffectID
Definition GameObject.h:525
ObjectGuid GetOwnerGUID() const override
Definition GameObject.h:251
bool _IsWithinDist(WorldObject const *obj, float dist2compare, bool, bool, bool) const override
Object distance/size - overridden from Object::_IsWithinDist. Needs to take in account proper GO size...
Definition GameObject.h:516
GameObjectValue m_goValue
Definition GameObject.h:497
void AddLootMode(uint16 lootMode)
Definition GameObject.h:315
GameObjectTemplate const * GetGOInfo() const
Definition GameObject.h:209
GOState GetGoState() const
Definition GameObject.h:290
time_t m_respawnTime
Definition GameObject.h:471
time_t m_cooldownTime
Definition GameObject.h:479
void AddUse()
Definition GameObject.h:330
void RemoveFlag(GameObjectFlags flags)
Definition GameObject.h:284
uint32 GetGoArtKit() const
Definition GameObject.h:294
bool HasFlag(GameObjectFlags flags) const
Definition GameObject.h:282
GameObjectData const * m_goData
Definition GameObject.h:495
LootState getLootState() const
Definition GameObject.h:308
uint32 GetSpellId() const
Definition GameObject.h:258
uint8 GetGoAnimProgress() const
Definition GameObject.h:296
int64 m_packedRotation
Definition GameObject.h:501
Position m_stationaryPosition
Definition GameObject.h:503
QuaternionData const & GetLocalRotation() const
Definition GameObject.h:224
time_t m_restockTime
Definition GameObject.h:478
uint32 GetUniqueUseCount() const
Definition GameObject.h:333
void ReplaceAllFlags(GameObjectFlags flags)
Definition GameObject.h:285
uint32 GetFaction() const override
Definition GameObject.h:403
uint16 m_LootMode
Definition GameObject.h:506
std::unordered_map< ObjectGuid, std::unique_ptr< Loot > > m_personalLoot
Definition GameObject.h:338
void SetGoAnimProgress(uint8 animprogress)
Definition GameObject.h:297
ObjectGuid m_lootStateUnitGUID
Definition GameObject.h:476
bool isSpawned() const
Definition GameObject.h:265
void SetOwnerGUID(ObjectGuid owner)
Definition GameObject.h:241
bool isSpawnedByDefault() const
Definition GameObject.h:271
ChairSlotAndUser ChairListSlots
Definition GameObject.h:490
bool HasLootMode(uint16 lootMode) const
Definition GameObject.h:313
GameObjectValue const * GetGOValue() const
Definition GameObject.h:213
void SetFlag(GameObjectFlags flags)
Definition GameObject.h:283
uint16 GetAIAnimKitId() const override
Definition GameObject.h:433
uint32 m_spellId
Definition GameObject.h:470
std::array< std::string const *, 3 > m_stringIds
Definition GameObject.h:498
time_t GetRespawnTime() const
Definition GameObject.h:260
void SetWorldEffectID(uint32 worldEffectID)
Definition GameObject.h:437
bool HasLootRecipient() const
Definition GameObject.h:343
void AddToSkillupList(ObjectGuid const &PlayerGuidLow)
Definition GameObject.h:322
uint32 m_respawnDelayTime
Definition GameObject.h:472
GameObjectAI * AI() const
Definition GameObject.h:390
void ResetLootMode()
Definition GameObject.h:317
GuidSet m_unique_users
Definition GameObject.h:486
std::unique_ptr< Vignettes::VignetteData > m_vignette
Definition GameObject.h:528
void RemoveLootMode(uint16 lootMode)
Definition GameObject.h:316
void SetSpawnedByDefault(bool b)
Definition GameObject.h:272
bool IsInSkillupList(ObjectGuid const &playerGuid) const
Definition GameObject.h:323
void SetRespawnCompatibilityMode(bool mode=true)
Definition GameObject.h:385
GameobjectTypes GetGoType() const
Definition GameObject.h:288
Transport const * ToTransport() const
Definition GameObject.h:413
void SetGoType(GameobjectTypes type)
Definition GameObject.h:289
uint32 m_despawnDelay
Definition GameObject.h:473
Seconds m_despawnRespawnTime
Definition GameObject.h:474
QuaternionData m_localRotation
Definition GameObject.h:502
void SetLinkedTrap(GameObject *linkedTrap)
Definition GameObject.h:347
GameObjectData const * GetGameObjectData() const
Definition GameObject.h:212
bool m_respawnCompatibilityMode
Definition GameObject.h:523
GameObjectTemplateAddon const * m_goTemplateAddon
Definition GameObject.h:494
ObjectGuid::LowType GetSpawnId() const
Definition GameObject.h:218
Position const & GetStationaryPosition() const override
Definition GameObject.h:415
GuidUnorderedSet m_tapList
Definition GameObject.h:505
bool GetRespawnCompatibilityMode()
Definition GameObject.h:386
GameObjectAI * m_AI
Definition GameObject.h:522
uint32 GetDisplayId() const
Definition GameObject.h:400
int64 GetPackedLocalRotation() const
Definition GameObject.h:225
std::unique_ptr< Loot > m_loot
Definition GameObject.h:337
void SetLevel(uint32 level)
Definition GameObject.h:287
Optional< float > m_transportPathProgress
Definition GameObject.h:526
ObjectGuid GetCreatorGUID() const override
Definition GameObject.h:240
Optional< std::string > m_scriptStringId
Definition GameObject.h:499
GameObjectTemplateAddon const * GetTemplateAddon() const
Definition GameObject.h:210
void SetLootMode(uint16 lootMode)
Definition GameObject.h:314
uint32 GetUseCount() const
Definition GameObject.h:332
void RelocateStationaryPosition(float x, float y, float z, float o)
Definition GameObject.h:416
uint16 _animKitId
Definition GameObject.h:524
Optional< float > GetPathProgressForClient() const
Definition GameObject.h:301
GameObjectTemplate const * m_goInfo
Definition GameObject.h:493
GuidUnorderedSet const & GetTapList() const
Definition GameObject.h:340
ObjectGuid::LowType m_spawnId
For new or temporary gameobjects is 0 for saved it is lowguid.
Definition GameObject.h:492
std::map< uint32, ObjectGuid > ChairSlotAndUser
Definition GameObject.h:489
std::string_view GetStringId(StringIdType type) const
Definition GameObject.h:395
ObjectGuid m_linkedTrap
Definition GameObject.h:508
void RelocateStationaryPosition(Position const &pos)
Definition GameObject.h:417
uint16 GetLootMode() const
Definition GameObject.h:312
TransportBase * ToTransportBase()
Definition GameObject.h:409
Transport * ToTransport()
Definition GameObject.h:412
void ClearSkillupList()
Definition GameObject.h:327
bool m_spawnedByDefault
Definition GameObject.h:477
GameObjectDestructibleState GetDestructibleState() const
Definition GameObject.h:375
uint32 GetWorldEffectID() const
Definition GameObject.h:436
std::unique_ptr< std::unordered_map< ObjectGuid, PerPlayerState > > m_perPlayerState
Definition GameObject.h:537
LootState m_lootState
Definition GameObject.h:475
void SetTapList(GuidUnorderedSet tapList)
Definition GameObject.h:341
UF::UpdateField< UF::GameObjectData, int32(WowCS::EntityFragment::CGObject), TYPEID_GAMEOBJECT > m_gameObjectData
Definition GameObject.h:463
std::unique_ptr< GameObjectTypeBase > m_goTypeImpl
Definition GameObject.h:496
ObjectGuid m_ritualOwnerGUID
Definition GameObject.h:485
Vignettes::VignetteData const * GetVignette() const
Definition GameObject.h:439
std::unique_ptr< GameObjectModel > m_model
Definition GameObject.h:406
uint32 m_usetimes
Definition GameObject.h:487
void SetSpellId(uint32 id)
Definition GameObject.h:253
GOState m_prevGoState
Definition GameObject.h:481
void SetFaction(uint32 faction) override
Definition GameObject.h:404
GuidSet m_SkillupList
Definition GameObject.h:483
Definition Map.h:227
static ObjectGuid const Empty
Definition ObjectGuid.h:314
bool IsEmpty() const
Definition ObjectGuid.h:362
uint64 LowType
Definition ObjectGuid.h:321
Definition Unit.h:647
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:499
UpdateFieldFlag
Definition UpdateField.h:37
Optional< GOState > State
Definition GameObject.h:533
ValuesUpdateForPlayerWithMaskSender(GameObject const *owner)
Definition GameObject.h:188
Definition Loot.h:286
constexpr float GetPositionX() const
Definition Position.h:87
constexpr float GetPositionY() const
Definition Position.h:88
constexpr float GetPositionZ() const
Definition Position.h:89
UpdateField< uint32, 0, 12 > Flags
UpdateField< ObjectGuid, 0, 10 > CreatedBy
UpdateField< int32, 0, 21 > Level
UpdateField< uint8, 0, 18 > PercentHealth
UpdateField< int8, 0, 17 > TypeID
UpdateField< int32, 0, 15 > FactionTemplate
struct GameObjectValue::@194 Trap
TeamId LastTeamCapture
Definition GameObject.h:150
uint32 AssaultTimer
Definition GameObject.h:152
OPvPCapturePoint * OPvPObj
Definition GameObject.h:139
struct GameObjectValue::@197 Building
SpellTargetCheckTypes TargetSearcherCheckType
Definition GameObject.h:129
WorldPackets::Battleground::BattlegroundCapturePointState State
Definition GameObject.h:151
::DestructibleHitpoint const * DestructibleHitpoint
Definition GameObject.h:145
struct GameObjectValue::@196 ControlZone
struct GameObjectValue::@198 CapturePoint
struct GameObjectValue::@195 FishingHole