TrinityCore
Object.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 _OBJECT_H
19#define _OBJECT_H
20
21#include "Common.h"
22#include "Duration.h"
23#include "Errors.h"
24#include "EventProcessor.h"
25#include "ModelIgnoreFlags.h"
26#include "MovementInfo.h"
27#include "ObjectDefines.h"
28#include "ObjectGuid.h"
29#include "Optional.h"
30#include "PhaseShift.h"
31#include "Position.h"
32#include "SharedDefines.h"
33#include "SpellDefines.h"
34#include "UpdateFields.h"
35#include <list>
36#include <unordered_map>
37
38class AreaTrigger;
39class Conversation;
40class Corpse;
41class Creature;
42class CreatureAI;
43class DynamicObject;
44class GameObject;
45class InstanceScript;
46class Map;
47class Object;
48class Player;
49class Scenario;
50class SceneObject;
51class SmoothPhasing;
52class Spell;
54class SpellEffectInfo;
55class SpellInfo;
56class TempSummon;
57class TransportBase;
58class Unit;
59class UpdateData;
60class WorldObject;
61class WorldPacket;
62class ZoneScript;
64struct Loot;
66struct QuaternionData;
67struct SpellPowerCost;
69
70namespace WorldPackets
71{
72 namespace CombatLog
73 {
75 }
76}
77
78typedef std::unordered_map<Player*, UpdateData> UpdateDataMapType;
79
81{
82 bool NoBirthAnim : 1;
83 bool EnablePortals : 1;
84 bool PlayHoverAnim : 1;
87 bool Stationary : 1;
88 bool CombatVictim : 1;
89 bool ServerTime : 1;
90 bool Vehicle : 1;
91 bool AnimKit : 1;
92 bool Rotation : 1;
93 bool AreaTrigger : 1;
94 bool GameObject : 1;
95 bool SmoothPhasing : 1;
96 bool ThisIsYou : 1;
97 bool SceneObject : 1;
98 bool ActivePlayer : 1;
99 bool Conversation : 1;
100
101 void Clear()
102 {
103 memset(this, 0, sizeof(CreateObjectBits));
104 }
105};
106
107namespace UF
108{
109 template<typename T>
111 {
112 return setter.SetValue(std::move(value));
113 }
114
115 template<typename T>
117 {
118 return setter.AddValue();
119 }
120
121 template<typename T>
123 {
124 return setter.InsertValue(index);
125 }
126
127 template<typename T>
129 {
130 setter.RemoveValue(index);
131 }
132
133 template<typename T>
135 {
136 setter.Clear();
137 }
138
139 template<typename T>
141 {
142 setter.RemoveValue();
143 }
144}
145
146float const DEFAULT_COLLISION_HEIGHT = 2.03128f; // Most common value in dbc
147
149{
150 public:
151 virtual ~Object();
152
153 bool IsInWorld() const { return m_inWorld; }
154
155 virtual void AddToWorld();
156 virtual void RemoveFromWorld();
157
158 static ObjectGuid GetGUID(Object const* o) { return o ? o->GetGUID() : ObjectGuid::Empty; }
159 ObjectGuid const& GetGUID() const { return m_guid; }
160 uint32 GetEntry() const { return m_objectData->EntryID; }
161 void SetEntry(uint32 entry) { SetUpdateFieldValue(m_values.ModifyValue(&Object::m_objectData).ModifyValue(&UF::ObjectData::EntryID), entry); }
162
163 float GetObjectScale() const { return m_objectData->Scale; }
164 virtual void SetObjectScale(float scale) { SetUpdateFieldValue(m_values.ModifyValue(&Object::m_objectData).ModifyValue(&UF::ObjectData::Scale), scale); }
165
166 uint32 GetDynamicFlags() const { return m_objectData->DynamicFlags; }
167 bool HasDynamicFlag(uint32 flag) const { return (*m_objectData->DynamicFlags & flag) != 0; }
168 void SetDynamicFlag(uint32 flag) { SetUpdateFieldFlagValue(m_values.ModifyValue(&Object::m_objectData).ModifyValue(&UF::ObjectData::DynamicFlags), flag); }
169 void RemoveDynamicFlag(uint32 flag) { RemoveUpdateFieldFlagValue(m_values.ModifyValue(&Object::m_objectData).ModifyValue(&UF::ObjectData::DynamicFlags), flag); }
171
172 TypeID GetTypeId() const { return m_objectTypeId; }
173 bool isType(uint16 mask) const { return (mask & m_objectType) != 0; }
174
175 virtual void BuildCreateUpdateBlockForPlayer(UpdateData* data, Player* target) const;
176 void SendUpdateToPlayer(Player* player);
177
178 void BuildValuesUpdateBlockForPlayer(UpdateData* data, Player const* target) const;
179 void BuildValuesUpdateBlockForPlayerWithFlag(UpdateData* data, UF::UpdateFieldFlag flags, Player const* target) const;
180 void BuildDestroyUpdateBlock(UpdateData* data) const;
181 void BuildOutOfRangeUpdateBlock(UpdateData* data) const;
182 ByteBuffer& PrepareValuesUpdateBuffer(UpdateData* data) const;
183
184 virtual void DestroyForPlayer(Player* target) const;
185 void SendOutOfRangeForPlayer(Player* target) const;
186
187 virtual void ClearUpdateMask(bool remove);
188
189 virtual std::string GetNameForLocaleIdx(LocaleConstant locale) const = 0;
190
191 virtual bool hasQuest(uint32 /* quest_id */) const { return false; }
192 virtual bool hasInvolvedQuest(uint32 /* quest_id */) const { return false; }
193 void SetIsNewObject(bool enable) { m_isNewObject = enable; }
194 bool IsDestroyedObject() const { return m_isDestroyedObject; }
195 void SetDestroyedObject(bool destroyed) { m_isDestroyedObject = destroyed; }
197 void BuildFieldsUpdate(Player*, UpdateDataMapType &) const;
198
199 inline bool IsPlayer() const { return GetTypeId() == TYPEID_PLAYER; }
200 static Player* ToPlayer(Object* o) { return o ? o->ToPlayer() : nullptr; }
201 static Player const* ToPlayer(Object const* o) { return o ? o->ToPlayer() : nullptr; }
202 Player* ToPlayer() { if (IsPlayer()) return reinterpret_cast<Player*>(this); else return nullptr; }
203 Player const* ToPlayer() const { if (IsPlayer()) return reinterpret_cast<Player const*>(this); else return nullptr; }
204
205 inline bool IsCreature() const { return GetTypeId() == TYPEID_UNIT; }
206 static Creature* ToCreature(Object* o) { return o ? o->ToCreature() : nullptr; }
207 static Creature const* ToCreature(Object const* o) { return o ? o->ToCreature() : nullptr; }
208 Creature* ToCreature() { if (IsCreature()) return reinterpret_cast<Creature*>(this); else return nullptr; }
209 Creature const* ToCreature() const { if (IsCreature()) return reinterpret_cast<Creature const*>(this); else return nullptr; }
210
211 inline bool IsUnit() const { return isType(TYPEMASK_UNIT); }
212 static Unit* ToUnit(Object* o) { return o ? o->ToUnit() : nullptr; }
213 static Unit const* ToUnit(Object const* o) { return o ? o->ToUnit() : nullptr; }
214 Unit* ToUnit() { if (IsUnit()) return reinterpret_cast<Unit*>(this); else return nullptr; }
215 Unit const* ToUnit() const { if (IsUnit()) return reinterpret_cast<Unit const*>(this); else return nullptr; }
216
217 inline bool IsGameObject() const { return GetTypeId() == TYPEID_GAMEOBJECT; }
218 static GameObject* ToGameObject(Object* o) { return o ? o->ToGameObject() : nullptr; }
219 static GameObject const* ToGameObject(Object const* o) { return o ? o->ToGameObject() : nullptr; }
220 GameObject* ToGameObject() { if (IsGameObject()) return reinterpret_cast<GameObject*>(this); else return nullptr; }
221 GameObject const* ToGameObject() const { if (IsGameObject()) return reinterpret_cast<GameObject const*>(this); else return nullptr; }
222
223 inline bool IsCorpse() const { return GetTypeId() == TYPEID_CORPSE; }
224 static Corpse* ToCorpse(Object* o) { return o ? o->ToCorpse() : nullptr; }
225 static Corpse const* ToCorpse(Object const* o) { return o ? o->ToCorpse() : nullptr; }
226 Corpse* ToCorpse() { if (IsCorpse()) return reinterpret_cast<Corpse*>(this); else return nullptr; }
227 Corpse const* ToCorpse() const { if (IsCorpse()) return reinterpret_cast<Corpse const*>(this); else return nullptr; }
228
229 inline bool IsDynObject() const { return GetTypeId() == TYPEID_DYNAMICOBJECT; }
230 static DynamicObject* ToDynObject(Object* o) { return o ? o->ToDynObject() : nullptr; }
231 static DynamicObject const* ToDynObject(Object const* o) { return o ? o->ToDynObject() : nullptr; }
232 DynamicObject* ToDynObject() { if (IsDynObject()) return reinterpret_cast<DynamicObject*>(this); else return nullptr; }
233 DynamicObject const* ToDynObject() const { if (IsDynObject()) return reinterpret_cast<DynamicObject const*>(this); else return nullptr; }
234
235 inline bool IsAreaTrigger() const { return GetTypeId() == TYPEID_AREATRIGGER; }
236 static AreaTrigger* ToAreaTrigger(Object* o) { return o ? o->ToAreaTrigger() : nullptr; }
237 static AreaTrigger const* ToAreaTrigger(Object const* o) { return o ? o->ToAreaTrigger() : nullptr; }
238 AreaTrigger* ToAreaTrigger() { if (IsAreaTrigger()) return reinterpret_cast<AreaTrigger*>(this); else return nullptr; }
239 AreaTrigger const* ToAreaTrigger() const { if (IsAreaTrigger()) return reinterpret_cast<AreaTrigger const*>(this); else return nullptr; }
240
241 inline bool IsSceneObject() const { return GetTypeId() == TYPEID_SCENEOBJECT; }
242 static SceneObject* ToSceneObject(Object* o) { return o ? o->ToSceneObject() : nullptr; }
243 static SceneObject const* ToSceneObject(Object const* o) { return o ? o->ToSceneObject() : nullptr; }
244 SceneObject* ToSceneObject() { if (IsSceneObject()) return reinterpret_cast<SceneObject*>(this); else return nullptr; }
245 SceneObject const* ToSceneObject() const { if (IsSceneObject()) return reinterpret_cast<SceneObject const*>(this); else return nullptr; }
246
247 inline bool IsConversation() const { return GetTypeId() == TYPEID_CONVERSATION; }
248 static Conversation* ToConversation(Object* o) { return o ? o->ToConversation() : nullptr; }
249 static Conversation const* ToConversation(Object const* o) { return o ? o->ToConversation() : nullptr; }
250 Conversation* ToConversation() { if (IsConversation()) return reinterpret_cast<Conversation*>(this); else return nullptr; }
251 Conversation const* ToConversation() const { if (IsConversation()) return reinterpret_cast<Conversation const*>(this); else return nullptr; }
252
255
256 template<typename T>
258 {
259 AddToObjectUpdateIfNeeded();
260 }
261
262 virtual std::string GetDebugInfo() const;
263
264 virtual Loot* GetLootForPlayer([[maybe_unused]] Player const* player) const { return nullptr; }
265
266 protected:
267 Object();
268
269 void _Create(ObjectGuid const& guid);
270
271 template<typename T>
273 {
274 if (UF::SetUpdateFieldValue(setter, std::move(value)))
275 AddToObjectUpdateIfNeeded();
276 }
277
278 template<typename T>
280 {
281 static_assert(std::is_integral<T>::value, "SetUpdateFieldFlagValue must be used with integral types");
282 SetUpdateFieldValue(setter, setter.GetValue() | flag);
283 }
284
285 template<typename T>
287 {
288 static_assert(std::is_integral<T>::value, "RemoveUpdateFieldFlagValue must be used with integral types");
289 SetUpdateFieldValue(setter, setter.GetValue() & ~flag);
290 }
291
292 template<typename T>
294 {
295 AddToObjectUpdateIfNeeded();
296 return UF::AddDynamicUpdateFieldValue(setter);
297 }
298
299 template<typename T>
301 {
302 AddToObjectUpdateIfNeeded();
303 return UF::InsertDynamicUpdateFieldValue(setter, index);
304 }
305
306 template<typename T>
308 {
309 AddToObjectUpdateIfNeeded();
311 }
312
313 template<typename T>
315 {
316 AddToObjectUpdateIfNeeded();
318 }
319
320 template<typename T>
322 {
323 AddToObjectUpdateIfNeeded();
325 }
326
327 // stat system helpers
328 template<typename T>
330 {
331 static_assert(std::is_arithmetic<T>::value, "SetUpdateFieldStatValue must be used with arithmetic types");
332 SetUpdateFieldValue(setter, std::max(value, T(0)));
333 }
334
335 template<typename T>
337 {
338 static_assert(std::is_arithmetic<T>::value, "SetUpdateFieldStatValue must be used with arithmetic types");
339
340 T value = setter.GetValue();
341 if (apply)
342 value += mod;
343 else
344 value -= mod;
345
346 SetUpdateFieldValue(setter, value);
347 }
348
349 template<typename T>
351 {
352 static_assert(std::is_arithmetic<T>::value, "SetUpdateFieldStatValue must be used with arithmetic types");
353
354 T value = setter.GetValue();
355
356 // don't want to include Util.h here
357 //ApplyPercentModFloatVar(value, percent, apply);
358 if (percent == -100.0f)
359 percent = -99.99f;
360 value *= (apply ? (100.0f + percent) / 100.0f : 100.0f / (100.0f + percent));
361
362 SetUpdateFieldValue(setter, value);
363 }
364
365 template<typename Action>
367 {
368 bool wasUpdatedBeforeAction = m_objectUpdated;
369 action();
370 if (m_objectUpdated && !wasUpdatedBeforeAction)
371 {
372 RemoveFromObjectUpdate();
373 m_objectUpdated = false;
374 }
375 }
376
377 void BuildMovementUpdate(ByteBuffer* data, CreateObjectBits flags, Player* target) const;
378 virtual UF::UpdateFieldFlag GetUpdateFieldFlagsFor(Player const* target) const;
379 virtual void BuildValuesCreate(ByteBuffer* data, Player const* target) const = 0;
380 virtual void BuildValuesUpdate(ByteBuffer* data, Player const* target) const = 0;
381
382 public:
383 virtual void BuildValuesUpdateWithFlag(ByteBuffer* data, UF::UpdateFieldFlag flags, Player const* target) const;
384
385 protected:
387
390
391 virtual bool AddToObjectUpdate() = 0;
392 virtual void RemoveFromObjectUpdate() = 0;
393 void AddToObjectUpdateIfNeeded();
394
396
397 private:
402
403 Object(Object const& right) = delete;
404 Object(Object&& right) = delete;
405 Object& operator=(Object const& right) = delete;
406 Object& operator=(Object&& right) = delete;
407};
408
409template <class T_VALUES, class T_FLAGS, class FLAG_TYPE, size_t ARRAY_SIZE>
411{
412 public:
413 static_assert(sizeof(T_FLAGS) * 8 > ARRAY_SIZE, "Fix T_FLAGS");
414
416 {
417 for (uint32 i = 0; i < ARRAY_SIZE; ++i)
418 m_values[i] = T_VALUES(0);
419 m_flags = T_FLAGS(0);
420 }
421
422 T_FLAGS GetFlags() const { return m_flags; }
423 bool HasFlag(FLAG_TYPE flag) const { return m_flags & (T_FLAGS(1) << flag); }
424 void AddFlag(FLAG_TYPE flag) { m_flags |= (T_FLAGS(1) << flag); }
425 void DelFlag(FLAG_TYPE flag) { m_flags &= ~(T_FLAGS(1) << flag); }
426
427 T_VALUES GetValue(FLAG_TYPE flag) const { return m_values[flag]; }
428 void SetValue(FLAG_TYPE flag, T_VALUES value) { m_values[flag] = value; }
429 void AddValue(FLAG_TYPE flag, T_VALUES value) { m_values[flag] += value; }
430
431 private:
432 T_VALUES m_values[ARRAY_SIZE];
433 T_FLAGS m_flags;
434};
435
437{
440
444
445 bool IgnorePhases = false;
448
455};
456
458{
461
463 Optional<bool> IsSpawned = true; // most searches should be for spawned objects only, to search for "any" just clear this field at call site
464
465 bool IgnorePhases = false;
468
472};
473
475{
476 protected:
477 explicit WorldObject(bool isWorldObject); //note: here it means if it is in grid object list or world object list
478 public:
479 virtual ~WorldObject();
480
481 virtual void Update(uint32 diff);
482
483 void AddToWorld() override;
484 void RemoveFromWorld() override;
485
486 void GetNearPoint2D(WorldObject const* searcher, float& x, float& y, float distance, float absAngle) const;
487 void GetNearPoint(WorldObject const* searcher, float& x, float& y, float& z, float distance2d, float absAngle) const;
488 void GetClosePoint(float& x, float& y, float& z, float size, float distance2d = 0, float relAngle = 0) const;
489 void MovePosition(Position &pos, float dist, float angle);
490 Position GetNearPosition(float dist, float angle);
491 void MovePositionToFirstCollision(Position &pos, float dist, float angle);
492 Position GetFirstCollisionPosition(float dist, float angle);
493 Position GetRandomNearPosition(float radius);
494 void GetContactPoint(WorldObject const* obj, float& x, float& y, float& z, float distance2d = CONTACT_DISTANCE) const;
495
496 virtual float GetCombatReach() const { return 0.0f; } // overridden (only) in Unit
497 void UpdateGroundPositionZ(float x, float y, float &z) const;
498 void UpdateAllowedPositionZ(float x, float y, float &z, float* groundZ = nullptr) const;
499
500 void GetRandomPoint(Position const& srcPos, float distance, float& rand_x, float& rand_y, float& rand_z) const;
501 Position GetRandomPoint(Position const& srcPos, float distance) const;
502
503 uint32 GetInstanceId() const { return m_InstanceId; }
504
505 PhaseShift& GetPhaseShift() { return _phaseShift; }
506 PhaseShift const& GetPhaseShift() const { return _phaseShift; }
507 PhaseShift& GetSuppressedPhaseShift() { return _suppressedPhaseShift; }
508 PhaseShift const& GetSuppressedPhaseShift() const { return _suppressedPhaseShift; }
509 bool InSamePhase(PhaseShift const& phaseShift) const
510 {
511 return GetPhaseShift().CanSee(phaseShift);
512 }
513 bool InSamePhase(WorldObject const* obj) const
514 {
515 return GetPhaseShift().CanSee(obj->GetPhaseShift());
516 }
517 static bool InSamePhase(WorldObject const* a, WorldObject const* b)
518 {
519 return a && b && a->InSamePhase(b);
520 }
521
522 int32 GetDBPhase() const { return _dbPhase; }
523
524 // if negative it is used as PhaseGroupId
525 void SetDBPhase(int32 p) { _dbPhase = p; }
526
527 uint32 GetZoneId() const { return m_zoneId; }
528 uint32 GetAreaId() const { return m_areaId; }
529 void GetZoneAndAreaId(uint32& zoneid, uint32& areaid) const { zoneid = m_zoneId, areaid = m_areaId; }
530 bool IsInWorldPvpZone() const;
531 bool IsOutdoors() const { return m_outdoors; }
532 ZLiquidStatus GetLiquidStatus() const { return m_liquidStatus; }
533
534 InstanceScript* GetInstanceScript() const;
535
536 std::string const& GetName() const { return m_name; }
537 void SetName(std::string newname) { m_name = std::move(newname); }
538
539 std::string GetNameForLocaleIdx(LocaleConstant /*locale*/) const override { return m_name; }
540
541 float GetDistance(WorldObject const* obj) const;
542 float GetDistance(Position const& pos) const;
543 float GetDistance(float x, float y, float z) const;
544 float GetDistance2d(WorldObject const* obj) const;
545 float GetDistance2d(float x, float y) const;
546 float GetDistanceZ(WorldObject const* obj) const;
547
548 bool IsSelfOrInSameMap(WorldObject const* obj) const;
549 bool IsInMap(WorldObject const* obj) const;
550 bool IsWithinDist3d(float x, float y, float z, float dist) const;
551 bool IsWithinDist3d(Position const* pos, float dist) const;
552 bool IsWithinDist2d(float x, float y, float dist) const;
553 bool IsWithinDist2d(Position const* pos, float dist) const;
554 // use only if you will sure about placing both object at same map
555 bool IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D = true, bool incOwnRadius = true, bool incTargetRadius = true) const;
556 bool IsWithinDistInMap(WorldObject const* obj, float dist2compare, bool is3D = true, bool incOwnRadius = true, bool incTargetRadius = true) const;
557 bool IsWithinLOS(float x, float y, float z, LineOfSightChecks checks = LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags = VMAP::ModelIgnoreFlags::Nothing) const;
558 bool IsWithinLOSInMap(WorldObject const* obj, LineOfSightChecks checks = LINEOFSIGHT_ALL_CHECKS, VMAP::ModelIgnoreFlags ignoreFlags = VMAP::ModelIgnoreFlags::Nothing) const;
559 Position GetHitSpherePointFor(Position const& dest) const;
560 void GetHitSpherePointFor(Position const& dest, float& x, float& y, float& z) const;
561 bool GetDistanceOrder(WorldObject const* obj1, WorldObject const* obj2, bool is3D = true) const;
562 bool IsInRange(WorldObject const* obj, float minRange, float maxRange, bool is3D = true) const;
563 bool IsInRange2d(float x, float y, float minRange, float maxRange) const;
564 bool IsInRange3d(float x, float y, float z, float minRange, float maxRange) const;
565 bool isInFront(WorldObject const* target, float arc = float(M_PI)) const;
566 bool isInBack(WorldObject const* target, float arc = float(M_PI)) const;
567
568 bool IsInBetween(Position const& pos1, Position const& pos2, float size = 0) const;
569 bool IsInBetween(WorldObject const* obj1, WorldObject const* obj2, float size = 0) const { return obj1 && obj2 && IsInBetween(obj1->GetPosition(), obj2->GetPosition(), size); }
570
571 virtual void CleanupsBeforeDelete(bool finalCleanup = true); // used in destructor or explicitly before mass creature delete to remove cross-references to already deleted units
572
573 virtual void SendMessageToSet(WorldPacket const* data, bool self) const;
574 virtual void SendMessageToSetInRange(WorldPacket const* data, float dist, bool self) const;
575 virtual void SendMessageToSet(WorldPacket const* data, Player const* skipped_rcvr) const;
576
577 void SendCombatLogMessage(WorldPackets::CombatLog::CombatLogServerPacket* combatLog) const;
578
579 virtual uint8 GetLevelForTarget(WorldObject const* /*target*/) const { return 1; }
580
581 void PlayDistanceSound(uint32 soundId, Player* target = nullptr);
582 void PlayDirectSound(uint32 soundId, Player* target = nullptr, uint32 broadcastTextId = 0);
583 void PlayDirectMusic(uint32 musicId, Player* target = nullptr);
584 void PlayObjectSound(int32 soundKitId, ObjectGuid targetObject, Player* target = nullptr, int32 broadcastTextId = 0);
585
586 void AddObjectToRemoveList();
587
588 float GetGridActivationRange() const;
589 float GetVisibilityRange() const;
590 float GetSightRange(WorldObject const* target = nullptr) const;
591 bool CanSeeOrDetect(WorldObject const* obj, bool implicitDetect = false, bool distanceCheck = false, bool checkAlert = false) const;
592
595
598
601
602 virtual void SetMap(Map* map);
603 virtual void ResetMap();
604 Map* GetMap() const { ASSERT(m_currMap); return m_currMap; }
605 Map* FindMap() const { return m_currMap; }
606 //used to check all object's GetMap() calls when object is not in world!
607
608 void SetZoneScript();
609 ZoneScript* FindZoneScript() const;
610 ZoneScript* GetZoneScript() const { return m_zoneScript; }
611
612 Scenario* GetScenario() const;
613
614 TempSummon* SummonCreature(uint32 entry, Position const& pos, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime = 0s, uint32 vehId = 0, uint32 spellId = 0, ObjectGuid privateObjectOwner = ObjectGuid::Empty);
615 TempSummon* SummonCreature(uint32 entry, float x, float y, float z, float o = 0, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime = 0s, ObjectGuid privateObjectOwner = ObjectGuid::Empty);
616 TempSummon* SummonPersonalClone(Position const& pos, TempSummonType despawnType = TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime = 0s, uint32 vehId = 0, uint32 spellId = 0, Player* privateObjectOwner = nullptr);
617 GameObject* SummonGameObject(uint32 entry, Position const& pos, QuaternionData const& rot, Seconds respawnTime, GOSummonType summonType = GO_SUMMON_TIMED_OR_CORPSE_DESPAWN);
618 GameObject* SummonGameObject(uint32 entry, float x, float y, float z, float ang, QuaternionData const& rot, Seconds respawnTime, GOSummonType summonType = GO_SUMMON_TIMED_OR_CORPSE_DESPAWN);
619 Creature* SummonTrigger(float x, float y, float z, float ang, Milliseconds despawnTime, CreatureAI* (*GetAI)(Creature*) = nullptr);
620 void SummonCreatureGroup(uint8 group, std::list<TempSummon*>* list = nullptr);
621
622 Creature* FindNearestCreature(uint32 entry, float range, bool alive = true) const;
623 Creature* FindNearestCreatureWithOptions(float range, FindCreatureOptions const& options) const;
624 GameObject* FindNearestGameObject(uint32 entry, float range, bool spawnedOnly = true) const;
625 GameObject* FindNearestGameObjectWithOptions(float range, FindGameObjectOptions const& options) const;
626 GameObject* FindNearestUnspawnedGameObject(uint32 entry, float range) const;
627 GameObject* FindNearestGameObjectOfType(GameobjectTypes type, float range) const;
628 Player* SelectNearestPlayer(float range) const;
629
630 virtual ObjectGuid GetCreatorGUID() const = 0;
631 virtual ObjectGuid GetOwnerGUID() const = 0;
632 virtual ObjectGuid GetCharmerOrOwnerGUID() const { return GetOwnerGUID(); }
633 ObjectGuid GetCharmerOrOwnerOrOwnGUID() const;
634
635 Unit* GetOwner() const;
636 Unit* GetCharmerOrOwner() const;
637 Unit* GetCharmerOrOwnerOrSelf() const;
638 Player* GetCharmerOrOwnerPlayerOrPlayerItself() const;
639 Player* GetAffectingPlayer() const;
640
641 Player* GetSpellModOwner() const;
642 int32 CalculateSpellDamage(Unit const* target, SpellEffectInfo const& spellEffectInfo, int32 const* basePoints = nullptr, float* variance = nullptr, uint32 castItemId = 0, int32 itemLevel = -1) const;
643
644 // target dependent range checks
645 float GetSpellMaxRangeForTarget(Unit const* target, SpellInfo const* spellInfo) const;
646 float GetSpellMinRangeForTarget(Unit const* target, SpellInfo const* spellInfo) const;
647
648 double ApplyEffectModifiers(SpellInfo const* spellInfo, uint8 effIndex, double value) const;
649 int32 CalcSpellDuration(SpellInfo const* spellInfo, std::vector<SpellPowerCost> const* powerCosts) const;
650 int32 ModSpellDuration(SpellInfo const* spellInfo, WorldObject const* target, int32 duration, bool positive, uint32 effectMask) const;
651 void ModSpellCastTime(SpellInfo const* spellInfo, int32& castTime, Spell* spell = nullptr) const;
652 void ModSpellDurationTime(SpellInfo const* spellInfo, int32& durationTime, Spell* spell = nullptr) const;
653
654 virtual float MeleeSpellMissChance(Unit const* victim, WeaponAttackType attType, SpellInfo const* spellInfo) const;
655 virtual SpellMissInfo MeleeSpellHitResult(Unit* victim, SpellInfo const* spellInfo) const;
656 SpellMissInfo MagicSpellHitResult(Unit* victim, SpellInfo const* spellInfo) const;
657 SpellMissInfo SpellHitResult(Unit* victim, SpellInfo const* spellInfo, bool canReflect = false) const;
658 void SendSpellMiss(Unit* target, uint32 spellID, SpellMissInfo missInfo);
659
660 virtual uint32 GetFaction() const = 0;
661 virtual void SetFaction(uint32 /*faction*/) { }
662 FactionTemplateEntry const* GetFactionTemplateEntry() const;
663
664 ReputationRank GetReactionTo(WorldObject const* target) const;
665 static ReputationRank GetFactionReactionTo(FactionTemplateEntry const* factionTemplateEntry, WorldObject const* target);
666
667 bool IsHostileTo(WorldObject const* target) const;
668 bool IsHostileToPlayers() const;
669 bool IsFriendlyTo(WorldObject const* target) const;
670 bool IsNeutralToAll() const;
671
672 // CastSpell's third arg can be a variety of things - check out CastSpellExtraArgs' constructors!
673 SpellCastResult CastSpell(CastSpellTargetArg const& targets, uint32 spellId, CastSpellExtraArgs const& args = { });
674
675 void SendPlayOrphanSpellVisual(ObjectGuid const& target, uint32 spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false);
676 void SendPlayOrphanSpellVisual(Position const& targetLocation, uint32 spellVisualId, float travelSpeed, bool speedAsTime = false, bool withSourceOrientation = false);
677 void SendCancelOrphanSpellVisual(uint32 id);
678
679 bool IsValidAttackTarget(WorldObject const* target, SpellInfo const* bySpell = nullptr) const;
680 bool IsValidAssistTarget(WorldObject const* target, SpellInfo const* bySpell = nullptr) const;
681
682 Unit* GetMagicHitRedirectTarget(Unit* victim, SpellInfo const* spellInfo);
683
684 virtual uint32 GetCastSpellXSpellVisualId(SpellInfo const* spellInfo) const;
685
686 template <typename Container>
687 void GetGameObjectListWithEntryInGrid(Container& gameObjectContainer, uint32 entry, float maxSearchRange = 250.0f) const;
688
689 template <typename Container>
690 void GetGameObjectListWithOptionsInGrid(Container& gameObjectContainer, float maxSearchRange, FindGameObjectOptions const& options) const;
691
692 template <typename Container>
693 void GetCreatureListWithEntryInGrid(Container& creatureContainer, uint32 entry, float maxSearchRange = 250.0f) const;
694
695 template <typename Container>
696 void GetCreatureListWithOptionsInGrid(Container& creatureContainer, float maxSearchRange, FindCreatureOptions const& options) const;
697
698 template <typename Container>
699 void GetPlayerListInGrid(Container& playerContainer, float maxSearchRange, bool alive = true) const;
700
701 void DestroyForNearbyPlayers();
702 virtual void UpdateObjectVisibility(bool forced = true);
703 virtual void UpdateObjectVisibilityOnCreate() { UpdateObjectVisibility(true); }
704 virtual void UpdateObjectVisibilityOnDestroy() { DestroyForNearbyPlayers(); }
705 void UpdatePositionData();
706
707 void BuildUpdate(UpdateDataMapType&) override;
708 bool AddToObjectUpdate() override;
709 void RemoveFromObjectUpdate() override;
710
711 //relocation and visibility system functions
712 void AddToNotify(uint16 f) { m_notifyflags |= f;}
713 bool isNeedNotify(uint16 f) const { return (m_notifyflags & f) != 0; }
714 uint16 GetNotifyFlags() const { return m_notifyflags; }
715 void ResetAllNotifies() { m_notifyflags = 0; }
716
717 bool isActiveObject() const { return m_isActive; }
718 void setActive(bool isActiveObject);
719 bool IsFarVisible() const { return m_isFarVisible; }
720 void SetFarVisible(bool on);
721 bool IsVisibilityOverridden() const { return m_visibilityDistanceOverride.has_value(); }
722 void SetVisibilityDistanceOverride(VisibilityDistanceType type);
723 void SetWorldObject(bool apply);
724 bool IsPermanentWorldObject() const { return m_isWorldObject; }
725 bool IsWorldObject() const;
726
728
729 // Transports
730 TransportBase* GetTransport() const { return m_transport; }
731 float GetTransOffsetX() const { return m_movementInfo.transport.pos.GetPositionX(); }
732 float GetTransOffsetY() const { return m_movementInfo.transport.pos.GetPositionY(); }
733 float GetTransOffsetZ() const { return m_movementInfo.transport.pos.GetPositionZ(); }
734 float GetTransOffsetO() const { return m_movementInfo.transport.pos.GetOrientation(); }
735 Position const& GetTransOffset() const { return m_movementInfo.transport.pos; }
736 uint32 GetTransTime() const { return m_movementInfo.transport.time; }
737 int8 GetTransSeat() const { return m_movementInfo.transport.seat; }
738 virtual ObjectGuid GetTransGUID() const;
739 void SetTransport(TransportBase* t) { m_transport = t; }
740
742
743 virtual float GetStationaryX() const { return GetPositionX(); }
744 virtual float GetStationaryY() const { return GetPositionY(); }
745 virtual float GetStationaryZ() const { return GetPositionZ(); }
746 virtual float GetStationaryO() const { return GetOrientation(); }
747
748 float GetFloorZ() const;
749 virtual float GetCollisionHeight() const { return 0.0f; }
750
751 float GetMapWaterOrGroundLevel(float x, float y, float z, float* ground = nullptr) const;
752 float GetMapHeight(float x, float y, float z, bool vmap = true, float distanceToSearch = 50.0f) const; // DEFAULT_HEIGHT_SEARCH in map.h
753
754 std::string GetDebugInfo() const override;
755
756 // Event handler
758
759 virtual uint16 GetAIAnimKitId() const { return 0; }
760 virtual uint16 GetMovementAnimKitId() const { return 0; }
761 virtual uint16 GetMeleeAnimKitId() const { return 0; }
762
763 // Watcher
764 bool IsPrivateObject() const { return !_privateObjectOwner.IsEmpty(); }
765 ObjectGuid GetPrivateObjectOwner() const { return _privateObjectOwner; }
766 void SetPrivateObjectOwner(ObjectGuid const& owner) { _privateObjectOwner = owner; }
767 bool CheckPrivateObjectOwnerVisibility(WorldObject const* seer) const;
768
769 // Smooth Phasing
770 SmoothPhasing* GetOrCreateSmoothPhasing();
771 SmoothPhasing* GetSmoothPhasing() { return _smoothPhasing.get(); }
772 SmoothPhasing const* GetSmoothPhasing() const { return _smoothPhasing.get(); }
773
774 protected:
775 std::string m_name;
779 bool const m_isWorldObject;
781
782 // transports (gameobjects only)
784
785 virtual void ProcessPositionDataChanged(PositionFullTerrainStatus const& data);
791
792 //these functions are used mostly for Relocate() and Corpse/Player specific stuff...
793 //use them ONLY in LoadFromDB()/Create() funcs and nowhere else!
794 //mapId/instanceId should be set in SetMap() function!
795 void SetLocationMapId(uint32 _mapId) { m_mapId = _mapId; }
796 void SetLocationInstanceId(uint32 _instanceId) { m_InstanceId = _instanceId; }
797
798 virtual bool CanNeverSee(WorldObject const* obj) const;
799 virtual bool CanAlwaysSee([[maybe_unused]] WorldObject const* /*obj*/) const { return false; }
800 virtual bool IsNeverVisibleFor([[maybe_unused]] WorldObject const* seer, [[maybe_unused]] bool allowServersideObjects = false) const { return !IsInWorld() || IsDestroyedObject(); }
801 virtual bool IsAlwaysVisibleFor([[maybe_unused]] WorldObject const* seer) const { return false; }
802 virtual bool IsInvisibleDueToDespawn([[maybe_unused]] WorldObject const* seer) const { return false; }
803 //difference from IsAlwaysVisibleFor: 1. after distance check; 2. use owner or charmer as seer
804 virtual bool IsAlwaysDetectableFor([[maybe_unused]] WorldObject const* seer) const { return false; }
805 private:
806 Map* m_currMap; // current object's Map location
807
808 uint32 m_InstanceId; // in map copy with instance id
810 PhaseShift _suppressedPhaseShift; // contains phases for current area but not applied due to conditions
812
814
816
817 std::unique_ptr<SmoothPhasing> _smoothPhasing;
818
819 virtual bool _IsWithinDist(WorldObject const* obj, float dist2compare, bool is3D, bool incOwnRadius = true, bool incTargetRadius = true) const;
820
821 bool CanDetect(WorldObject const* obj, bool ignoreStealth, bool checkAlert = false) const;
822 bool CanDetectInvisibilityOf(WorldObject const* obj) const;
823 bool CanDetectStealthOf(WorldObject const* obj, bool checkAlert = false) const;
824};
825
826namespace Trinity
827{
828 // Binary predicate to sort WorldObjects based on the distance to a reference WorldObject
830 {
831 public:
832 ObjectDistanceOrderPred(WorldObject const* refObj, bool ascending = true) : _refObj(refObj), _ascending(ascending) { }
833
834 bool operator()(WorldObject const* left, WorldObject const* right) const
835 {
836 return _refObj->GetDistanceOrder(left, right) == _ascending;
837 }
838
839 private:
842 };
843}
844
845#endif
LocaleConstant
Definition: Common.h:48
#define M_PI
Definition: Common.h:115
#define TC_GAME_API
Definition: Define.h:124
uint8_t uint8
Definition: Define.h:145
int8_t int8
Definition: Define.h:141
int32_t int32
Definition: Define.h:139
uint16_t uint16
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:143
uint16 flags
Definition: DisableMgr.cpp:49
std::chrono::seconds Seconds
Seconds shorthand typedef.
Definition: Duration.h:32
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
std::string GetDebugInfo()
Definition: Errors.cpp:157
#define ASSERT
Definition: Errors.h:68
ZLiquidStatus
Definition: MapDefines.h:125
TempSummonType
Definition: ObjectDefines.h:62
@ TEMPSUMMON_MANUAL_DESPAWN
Definition: ObjectDefines.h:70
GOSummonType
Definition: ObjectDefines.h:82
@ GO_SUMMON_TIMED_OR_CORPSE_DESPAWN
Definition: ObjectDefines.h:83
#define CONTACT_DISTANCE
Definition: ObjectDefines.h:23
VisibilityDistanceType
Definition: ObjectDefines.h:50
TypeID
Definition: ObjectGuid.h:34
@ TYPEID_AREATRIGGER
Definition: ObjectGuid.h:46
@ TYPEID_DYNAMICOBJECT
Definition: ObjectGuid.h:44
@ TYPEID_GAMEOBJECT
Definition: ObjectGuid.h:43
@ TYPEID_UNIT
Definition: ObjectGuid.h:40
@ TYPEID_CORPSE
Definition: ObjectGuid.h:45
@ TYPEID_SCENEOBJECT
Definition: ObjectGuid.h:47
@ TYPEID_CONVERSATION
Definition: ObjectGuid.h:48
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
@ TYPEMASK_UNIT
Definition: ObjectGuid.h:60
float const DEFAULT_COLLISION_HEIGHT
Definition: Object.h:146
std::unordered_map< Player *, UpdateData > UpdateDataMapType
Definition: Object.h:78
std::optional< T > Optional
Optional helper class to wrap optional values within.
Definition: Optional.h:25
void GetCreatureListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
void GetCreatureListWithOptionsInGrid(Container &container, WorldObject *source, float maxSearchRange, FindCreatureOptions const &options)
void GetPlayerListInGrid(Container &container, WorldObject *source, float maxSearchRange, bool alive=true)
void GetGameObjectListWithEntryInGrid(Container &container, WorldObject *source, uint32 entry, float maxSearchRange)
GameobjectTypes
SpellMissInfo
WeaponAttackType
ReputationRank
LineOfSightChecks
@ LINEOFSIGHT_ALL_CHECKS
SpellCastResult
Action
Definition: Corpse.h:53
bool HasFlag(FLAG_TYPE flag) const
Definition: Object.h:423
void AddFlag(FLAG_TYPE flag)
Definition: Object.h:424
T_FLAGS GetFlags() const
Definition: Object.h:422
void DelFlag(FLAG_TYPE flag)
Definition: Object.h:425
T_VALUES GetValue(FLAG_TYPE flag) const
Definition: Object.h:427
T_VALUES m_values[ARRAY_SIZE]
Definition: Object.h:432
void AddValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:429
void SetValue(FLAG_TYPE flag, T_VALUES value)
Definition: Object.h:428
Definition: Map.h:187
static ObjectGuid const Empty
Definition: ObjectGuid.h:272
Definition: Object.h:149
void SetDynamicFlag(uint32 flag)
Definition: Object.h:168
Corpse * ToCorpse()
Definition: Object.h:226
Object(Object &&right)=delete
uint16 m_objectType
Definition: Object.h:386
static Creature * ToCreature(Object *o)
Definition: Object.h:206
static Player const * ToPlayer(Object const *o)
Definition: Object.h:201
Player const * ToPlayer() const
Definition: Object.h:203
bool IsPlayer() const
Definition: Object.h:199
float GetObjectScale() const
Definition: Object.h:163
static SceneObject const * ToSceneObject(Object const *o)
Definition: Object.h:243
void ClearDynamicUpdateFieldValues(UF::DynamicUpdateFieldSetter< T > setter)
Definition: Object.h:314
bool m_isNewObject
Definition: Object.h:400
DynamicObject * ToDynObject()
Definition: Object.h:232
static Unit * ToUnit(Object *o)
Definition: Object.h:212
Player * ToPlayer()
Definition: Object.h:202
bool IsDestroyedObject() const
Definition: Object.h:194
ObjectGuid m_guid
Definition: Object.h:398
UF::DynamicUpdateFieldSetter< T >::insert_result InsertDynamicUpdateFieldValue(UF::DynamicUpdateFieldSetter< T > setter, uint32 index)
Definition: Object.h:300
static GameObject * ToGameObject(Object *o)
Definition: Object.h:218
ObjectGuid const & GetGUID() const
Definition: Object.h:159
static Corpse const * ToCorpse(Object const *o)
Definition: Object.h:225
bool IsInWorld() const
Definition: Object.h:153
static Conversation * ToConversation(Object *o)
Definition: Object.h:248
UF::UpdateField< UF::ObjectData, 0, TYPEID_OBJECT > m_objectData
Definition: Object.h:254
SceneObject const * ToSceneObject() const
Definition: Object.h:245
virtual std::string GetNameForLocaleIdx(LocaleConstant locale) const =0
bool HasDynamicFlag(uint32 flag) const
Definition: Object.h:167
bool IsCorpse() const
Definition: Object.h:223
void RemoveUpdateFieldFlagValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
Definition: Object.h:286
Conversation * ToConversation()
Definition: Object.h:250
virtual bool hasQuest(uint32) const
Definition: Object.h:191
bool IsUnit() const
Definition: Object.h:211
TypeID GetTypeId() const
Definition: Object.h:172
SceneObject * ToSceneObject()
Definition: Object.h:244
bool m_isDestroyedObject
Definition: Object.h:401
static Conversation const * ToConversation(Object const *o)
Definition: Object.h:249
virtual bool AddToObjectUpdate()=0
UF::DynamicUpdateFieldSetter< T >::insert_result AddDynamicUpdateFieldValue(UF::DynamicUpdateFieldSetter< T > setter)
Definition: Object.h:293
CreateObjectBits m_updateFlag
Definition: Object.h:389
bool isType(uint16 mask) const
Definition: Object.h:173
Object & operator=(Object &&right)=delete
void SetUpdateFieldFlagValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type flag)
Definition: Object.h:279
virtual void BuildValuesCreate(ByteBuffer *data, Player const *target) const =0
Object & operator=(Object const &right)=delete
bool IsGameObject() const
Definition: Object.h:217
Conversation const * ToConversation() const
Definition: Object.h:251
AreaTrigger * ToAreaTrigger()
Definition: Object.h:238
void SetUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:272
GameObject * ToGameObject()
Definition: Object.h:220
static AreaTrigger const * ToAreaTrigger(Object const *o)
Definition: Object.h:237
GameObject const * ToGameObject() const
Definition: Object.h:221
Corpse const * ToCorpse() const
Definition: Object.h:227
Unit const * ToUnit() const
Definition: Object.h:215
void ReplaceAllDynamicFlags(uint32 flag)
Definition: Object.h:170
static DynamicObject const * ToDynObject(Object const *o)
Definition: Object.h:231
static GameObject const * ToGameObject(Object const *o)
Definition: Object.h:219
uint32 GetEntry() const
Definition: Object.h:160
virtual Loot * GetLootForPlayer(Player const *player) const
Definition: Object.h:264
uint32 GetDynamicFlags() const
Definition: Object.h:166
bool IsCreature() const
Definition: Object.h:205
bool IsConversation() const
Definition: Object.h:247
UF::UpdateFieldHolder m_values
Definition: Object.h:253
Creature * ToCreature()
Definition: Object.h:208
bool IsSceneObject() const
Definition: Object.h:241
void SetUpdateFieldStatValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type value)
Definition: Object.h:329
void RemoveDynamicFlag(uint32 flag)
Definition: Object.h:169
virtual void BuildValuesUpdate(ByteBuffer *data, Player const *target) const =0
void SetIsNewObject(bool enable)
Definition: Object.h:193
virtual void BuildUpdate(UpdateDataMapType &)
Definition: Object.h:196
void RemoveOptionalUpdateFieldValue(UF::OptionalUpdateFieldSetter< T > setter)
Definition: Object.h:321
static Unit const * ToUnit(Object const *o)
Definition: Object.h:213
static AreaTrigger * ToAreaTrigger(Object *o)
Definition: Object.h:236
void RemoveDynamicUpdateFieldValue(UF::DynamicUpdateFieldSetter< T > setter, uint32 index)
Definition: Object.h:307
static Creature const * ToCreature(Object const *o)
Definition: Object.h:207
virtual void RemoveFromObjectUpdate()=0
void DoWithSuppressingObjectUpdates(Action &&action)
Definition: Object.h:366
static Corpse * ToCorpse(Object *o)
Definition: Object.h:224
bool IsDynObject() const
Definition: Object.h:229
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:158
bool m_inWorld
Definition: Object.h:399
Creature const * ToCreature() const
Definition: Object.h:209
AreaTrigger const * ToAreaTrigger() const
Definition: Object.h:239
void SetEntry(uint32 entry)
Definition: Object.h:161
static SceneObject * ToSceneObject(Object *o)
Definition: Object.h:242
virtual void SetObjectScale(float scale)
Definition: Object.h:164
virtual bool hasInvolvedQuest(uint32) const
Definition: Object.h:192
void SetDestroyedObject(bool destroyed)
Definition: Object.h:195
void ForceUpdateFieldChange(UF::UpdateFieldSetter< T > const &)
Definition: Object.h:257
bool IsAreaTrigger() const
Definition: Object.h:235
Object(Object const &right)=delete
TypeID m_objectTypeId
Definition: Object.h:388
DynamicObject const * ToDynObject() const
Definition: Object.h:233
static DynamicObject * ToDynObject(Object *o)
Definition: Object.h:230
bool m_objectUpdated
Definition: Object.h:395
void ApplyModUpdateFieldValue(UF::UpdateFieldSetter< T > setter, typename UF::UpdateFieldSetter< T >::value_type mod, bool apply)
Definition: Object.h:336
static Player * ToPlayer(Object *o)
Definition: Object.h:200
void ApplyPercentModUpdateFieldValue(UF::UpdateFieldSetter< T > setter, float percent, bool apply)
Definition: Object.h:350
Unit * ToUnit()
Definition: Object.h:214
Definition: Spell.h:254
WorldObject const * _refObj
Definition: Object.h:840
ObjectDistanceOrderPred(WorldObject const *refObj, bool ascending=true)
Definition: Object.h:832
bool operator()(WorldObject const *left, WorldObject const *right) const
Definition: Object.h:834
Definition: Unit.h:622
int8 GetTransSeat() const
Definition: Object.h:737
bool InSamePhase(PhaseShift const &phaseShift) const
Definition: Object.h:509
float m_staticFloorZ
Definition: Object.h:788
virtual uint16 GetMeleeAnimKitId() const
Definition: Object.h:761
ZLiquidStatus m_liquidStatus
Definition: Object.h:790
PhaseShift const & GetSuppressedPhaseShift() const
Definition: Object.h:508
virtual uint16 GetMovementAnimKitId() const
Definition: Object.h:760
virtual bool IsInvisibleDueToDespawn(WorldObject const *seer) const
Definition: Object.h:802
Map * GetMap() const
Definition: Object.h:604
ZLiquidStatus GetLiquidStatus() const
Definition: Object.h:532
SmoothPhasing const * GetSmoothPhasing() const
Definition: Object.h:772
std::string m_name
Definition: Object.h:775
virtual ObjectGuid GetCreatorGUID() const =0
virtual float GetCollisionHeight() const
Definition: Object.h:749
virtual bool IsAlwaysVisibleFor(WorldObject const *seer) const
Definition: Object.h:801
Map * FindMap() const
Definition: Object.h:605
virtual float GetStationaryO() const
Definition: Object.h:746
bool isNeedNotify(uint16 f) const
Definition: Object.h:713
uint16 m_notifyflags
Definition: Object.h:813
virtual uint8 GetLevelForTarget(WorldObject const *) const
Definition: Object.h:579
virtual void UpdateObjectVisibilityOnDestroy()
Definition: Object.h:704
void ResetAllNotifies()
Definition: Object.h:715
void SetLocationInstanceId(uint32 _instanceId)
Definition: Object.h:796
uint32 m_InstanceId
Definition: Object.h:808
ObjectGuid GetPrivateObjectOwner() const
Definition: Object.h:765
uint32 m_areaId
Definition: Object.h:787
Position const & GetTransOffset() const
Definition: Object.h:735
virtual bool IsAlwaysDetectableFor(WorldObject const *seer) const
Definition: Object.h:804
bool IsVisibilityOverridden() const
Definition: Object.h:721
virtual ObjectGuid GetCharmerOrOwnerGUID() const
Definition: Object.h:632
float GetTransOffsetX() const
Definition: Object.h:731
uint32 LastUsedScriptID
Definition: Object.h:727
PhaseShift & GetPhaseShift()
Definition: Object.h:505
FlaggedValuesArray32< int32, uint64, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibility
Definition: Object.h:596
void SetLocationMapId(uint32 _mapId)
Definition: Object.h:795
ZoneScript * GetZoneScript() const
Definition: Object.h:610
bool IsPermanentWorldObject() const
Definition: Object.h:724
virtual void UpdateObjectVisibilityOnCreate()
Definition: Object.h:703
bool isActiveObject() const
Definition: Object.h:717
PhaseShift _phaseShift
Definition: Object.h:809
bool const m_isWorldObject
Definition: Object.h:779
TransportBase * GetTransport() const
Definition: Object.h:730
PhaseShift const & GetPhaseShift() const
Definition: Object.h:506
bool GetDistanceOrder(WorldObject const *obj1, WorldObject const *obj2, bool is3D=true) const
Definition: Object.cpp:1207
bool IsPrivateObject() const
Definition: Object.h:764
uint32 GetInstanceId() const
Definition: Object.h:503
FlaggedValuesArray32< int32, uint64, InvisibilityType, TOTAL_INVISIBILITY_TYPES > m_invisibilityDetect
Definition: Object.h:597
uint16 GetNotifyFlags() const
Definition: Object.h:714
bool IsOutdoors() const
Definition: Object.h:531
void SetPrivateObjectOwner(ObjectGuid const &owner)
Definition: Object.h:766
ZoneScript * m_zoneScript
Definition: Object.h:780
SmoothPhasing * GetSmoothPhasing()
Definition: Object.h:771
std::string GetNameForLocaleIdx(LocaleConstant) const override
Definition: Object.h:539
float GetTransOffsetY() const
Definition: Object.h:732
PhaseShift _suppressedPhaseShift
Definition: Object.h:810
virtual uint16 GetAIAnimKitId() const
Definition: Object.h:759
std::string const & GetName() const
Definition: Object.h:536
bool IsFarVisible() const
Definition: Object.h:719
virtual float GetStationaryX() const
Definition: Object.h:743
float GetTransOffsetZ() const
Definition: Object.h:733
int32 _dbPhase
Definition: Object.h:811
bool InSamePhase(WorldObject const *obj) const
Definition: Object.h:513
uint32 GetTransTime() const
Definition: Object.h:736
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealthDetect
Definition: Object.h:594
bool m_isActive
Definition: Object.h:776
PhaseShift & GetSuppressedPhaseShift()
Definition: Object.h:507
void SetName(std::string newname)
Definition: Object.h:537
void AddToNotify(uint16 f)
Definition: Object.h:712
bool m_outdoors
Definition: Object.h:789
std::unique_ptr< SmoothPhasing > _smoothPhasing
Definition: Object.h:817
EventProcessor m_Events
Definition: Object.h:757
TransportBase * m_transport
Definition: Object.h:783
FlaggedValuesArray32< int32, uint32, StealthType, TOTAL_STEALTH_TYPES > m_stealth
Definition: Object.h:593
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibilityDetect
Definition: Object.h:600
virtual uint32 GetFaction() const =0
static bool InSamePhase(WorldObject const *a, WorldObject const *b)
Definition: Object.h:517
Optional< float > m_visibilityDistanceOverride
Definition: Object.h:778
ObjectGuid _privateObjectOwner
Definition: Object.h:815
bool IsInBetween(WorldObject const *obj1, WorldObject const *obj2, float size=0) const
Definition: Object.h:569
uint32 GetAreaId() const
Definition: Object.h:528
float GetTransOffsetO() const
Definition: Object.h:734
virtual ObjectGuid GetOwnerGUID() const =0
uint32 GetZoneId() const
Definition: Object.h:527
MovementInfo m_movementInfo
Definition: Object.h:741
uint32 m_zoneId
Definition: Object.h:786
FlaggedValuesArray32< int32, uint32, ServerSideVisibilityType, TOTAL_SERVERSIDE_VISIBILITY_TYPES > m_serverSideVisibility
Definition: Object.h:599
bool m_isFarVisible
Definition: Object.h:777
void GetZoneAndAreaId(uint32 &zoneid, uint32 &areaid) const
Definition: Object.h:529
virtual bool IsNeverVisibleFor(WorldObject const *seer, bool allowServersideObjects=false) const
Definition: Object.h:800
virtual float GetStationaryY() const
Definition: Object.h:744
virtual void SetFaction(uint32)
Definition: Object.h:661
virtual float GetCombatReach() const
Definition: Object.h:496
virtual float GetStationaryZ() const
Definition: Object.h:745
void SetDBPhase(int32 p)
Definition: Object.h:525
Map * m_currMap
Definition: Object.h:806
virtual bool CanAlwaysSee(WorldObject const *) const
Definition: Object.h:799
int32 GetDBPhase() const
Definition: Object.h:522
void SetTransport(TransportBase *t)
Definition: Object.h:739
void apply(T *val)
Definition: ByteConverter.h:41
Definition: Object.h:108
constexpr std::size_t size()
Definition: UpdateField.h:796
DynamicUpdateFieldSetter< T >::insert_result AddDynamicUpdateFieldValue(DynamicUpdateFieldSetter< T > &setter)
Definition: Object.h:116
UpdateFieldFlag
Definition: UpdateField.h:34
void RemoveDynamicUpdateFieldValue(DynamicUpdateFieldSetter< T > &setter, uint32 index)
Definition: Object.h:128
void ClearDynamicUpdateFieldValues(DynamicUpdateFieldSetter< T > &setter)
Definition: Object.h:134
void RemoveOptionalUpdateFieldValue(OptionalUpdateFieldSetter< T > &setter)
Definition: Object.h:140
bool SetUpdateFieldValue(UpdateFieldSetter< T > &setter, typename UpdateFieldSetter< T >::value_type &&value)
Definition: Object.h:110
DynamicUpdateFieldSetter< T >::insert_result InsertDynamicUpdateFieldValue(DynamicUpdateFieldSetter< T > &setter, uint32 index)
Definition: Object.h:122
bool Rotation
Definition: Object.h:92
bool Stationary
Definition: Object.h:87
void Clear()
Definition: Object.h:101
bool MovementUpdate
Definition: Object.h:85
bool AnimKit
Definition: Object.h:91
bool Vehicle
Definition: Object.h:90
bool SceneObject
Definition: Object.h:97
bool PlayHoverAnim
Definition: Object.h:84
bool NoBirthAnim
Definition: Object.h:82
bool ThisIsYou
Definition: Object.h:96
bool ActivePlayer
Definition: Object.h:98
bool GameObject
Definition: Object.h:94
bool ServerTime
Definition: Object.h:89
bool CombatVictim
Definition: Object.h:88
bool AreaTrigger
Definition: Object.h:93
bool EnablePortals
Definition: Object.h:83
bool Conversation
Definition: Object.h:99
bool SmoothPhasing
Definition: Object.h:95
bool MovementTransport
Definition: Object.h:86
Optional< std::string_view > StringId
Definition: Object.h:439
Optional< ObjectGuid > CreatorGuid
Definition: Object.h:452
Optional< bool > IsSummon
Definition: Object.h:443
bool IgnoreNotOwnedPrivateObjects
Definition: Object.h:446
bool IgnorePrivateObjects
Definition: Object.h:447
Optional< uint32 > AuraSpellId
Definition: Object.h:449
Optional< ObjectGuid > PrivateObjectOwnerGuid
Definition: Object.h:454
Optional< uint32 > CreatureId
Definition: Object.h:438
Optional< ObjectGuid > DemonCreatorGuid
Definition: Object.h:453
Optional< bool > IsAlive
Definition: Object.h:441
Optional< bool > IsInCombat
Definition: Object.h:442
Optional< ObjectGuid > OwnerGuid
Definition: Object.h:450
Optional< ObjectGuid > CharmerGuid
Definition: Object.h:451
bool IgnoreNotOwnedPrivateObjects
Definition: Object.h:466
Optional< ObjectGuid > OwnerGuid
Definition: Object.h:469
Optional< std::string_view > StringId
Definition: Object.h:460
Optional< GameobjectTypes > GameObjectType
Definition: Object.h:471
Optional< uint32 > GameObjectId
Definition: Object.h:459
Optional< ObjectGuid > PrivateObjectOwnerGuid
Definition: Object.h:470
bool IgnorePrivateObjects
Definition: Object.h:467
Optional< bool > IsSummon
Definition: Object.h:462
Optional< bool > IsSpawned
Definition: Object.h:463
Definition: Loot.h:281
void GetPosition(float &x, float &y) const
Definition: Position.h:81
std::conditional_t< std::is_base_of_v< HasChangesMaskTag, T >, MutableFieldReference< T, true >, T & > insert_result
Definition: UpdateField.h:146
void RemoveValue(std::size_t index)
Definition: UpdateField.h:186
insert_result InsertValue(std::size_t index)
Definition: UpdateField.h:174
UpdateField< uint32, 0, 2 > DynamicFlags
Definition: UpdateFields.h:53
UpdateField< int32, 0, 1 > EntryID
Definition: UpdateFields.h:51
UpdateField< float, 0, 3 > Scale
Definition: UpdateFields.h:55
bool SetValue(T value)
Definition: UpdateField.h:105