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