TrinityCore
Loading...
Searching...
No Matches
TemporarySummon.cpp
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#include "TemporarySummon.h"
19#include "CellImpl.h"
20#include "CharmInfo.h"
21#include "CreatureAI.h"
22#include "DB2Stores.h"
23#include "GameObject.h"
24#include "GameObjectAI.h"
25#include "GridNotifiers.h"
26#include "Log.h"
27#include "Map.h"
28#include "ObjectAccessor.h"
29#include "ObjectMgr.h"
30#include "Pet.h"
31#include "Player.h"
32#include "SmoothPhasing.h"
33#include "SpellMgr.h"
34#include <boost/container/small_vector.hpp>
35#include <sstream>
36
37TempSummon::TempSummon(SummonPropertiesEntry const* properties, WorldObject* owner, bool isWorldObject) :
38Creature(isWorldObject), m_Properties(properties), m_type(TEMPSUMMON_MANUAL_DESPAWN),
39m_timer(0ms), m_lifetime(0ms), m_canFollowOwner(true)
40{
41 if (owner)
42 m_summonerGUID = owner->GetGUID();
43
45}
46
47TempSummon::~TempSummon() = default;
48
53
55{
56 if (WorldObject* summoner = GetSummoner())
57 return summoner->ToUnit();
58 return nullptr;
59}
60
65
67{
68 if (WorldObject* summoner = GetSummoner())
69 return summoner->ToGameObject();
70 return nullptr;
71}
72
74{
75 Creature::Update(diff);
76
77 if (m_deathState == DEAD)
78 {
79 UnSummon();
80 return;
81 }
82
83 Milliseconds msDiff = Milliseconds(diff);
84 switch (m_type)
85 {
88 break;
90 {
91 if (m_timer <= msDiff)
92 {
93 UnSummon();
94 return;
95 }
96
97 m_timer -= msDiff;
98 break;
99 }
101 {
102 if (!IsInCombat())
103 {
104 if (m_timer <= msDiff)
105 {
106 UnSummon();
107 return;
108 }
109
110 m_timer -= msDiff;
111 }
112 else if (m_timer != m_lifetime)
114
115 break;
116 }
117
119 {
120 if (m_deathState == CORPSE)
121 {
122 if (m_timer <= msDiff)
123 {
124 UnSummon();
125 return;
126 }
127
128 m_timer -= msDiff;
129 }
130 break;
131 }
133 {
134 // if m_deathState is DEAD, CORPSE was skipped
135 if (m_deathState == CORPSE)
136 {
137 UnSummon();
138 return;
139 }
140
141 break;
142 }
144 {
145 if (m_deathState == CORPSE)
146 {
147 UnSummon();
148 return;
149 }
150
151 if (!IsInCombat())
152 {
153 if (m_timer <= msDiff)
154 {
155 UnSummon();
156 return;
157 }
158 else
159 m_timer -= msDiff;
160 }
161 else if (m_timer != m_lifetime)
163 break;
164 }
166 {
167 if (!IsInCombat() && IsAlive())
168 {
169 if (m_timer <= msDiff)
170 {
171 UnSummon();
172 return;
173 }
174 else
175 m_timer -= msDiff;
176 }
177 else if (m_timer != m_lifetime)
179 break;
180 }
181 default:
182 UnSummon();
183 TC_LOG_ERROR("entities.unit", "Temporary summoned creature (entry: {}) have unknown type {} of ", GetEntry(), m_type);
184 break;
185 }
186}
187
189{
190 ASSERT(!IsPet());
191
192 m_timer = duration;
193 m_lifetime = duration;
194
196 {
197 if (duration <= 0s)
201 else
203 }
204
205 if (summoner && summoner->IsPlayer())
206 {
207 if (IsTrigger() && m_spells[0])
209
210 if (CreatureSummonedData const* summonedData = sObjectMgr->GetCreatureSummonedData(GetEntry()))
211 {
212 m_creatureIdVisibleToSummoner = summonedData->CreatureIDVisibleToSummoner;
213 if (summonedData->CreatureIDVisibleToSummoner)
214 {
215 CreatureTemplate const* creatureTemplateVisibleToSummoner = ASSERT_NOTNULL(sObjectMgr->GetCreatureTemplate(*summonedData->CreatureIDVisibleToSummoner));
216 m_displayIdVisibleToSummoner = ObjectMgr::ChooseDisplayId(creatureTemplateVisibleToSummoner, nullptr)->CreatureDisplayID;
217 }
218 }
219 }
220
221 if (!m_Properties)
222 return;
223
224 if (Unit* unitSummoner = ToUnit(summoner))
225 {
226 std::ptrdiff_t slot = m_Properties->Slot;
227 if (slot == SUMMON_SLOT_ANY_TOTEM)
228 slot = FindUsableTotemSlot(unitSummoner);
229
230 if (slot != 0)
231 {
232 if (!unitSummoner->m_SummonSlot[slot].IsEmpty() && unitSummoner->m_SummonSlot[slot] != GetGUID())
233 {
234 Creature* oldSummon = GetMap()->GetCreature(unitSummoner->m_SummonSlot[slot]);
235 if (oldSummon && oldSummon->IsSummon())
236 oldSummon->ToTempSummon()->UnSummon();
237 }
238 unitSummoner->m_SummonSlot[slot] = GetGUID();
239 }
240
242 {
243 int32 minLevel = m_unitData->ScalingLevelMin + m_unitData->ScalingLevelDelta;
244 int32 maxLevel = m_unitData->ScalingLevelMax + m_unitData->ScalingLevelDelta;
245 uint8 level = std::clamp<int32>(unitSummoner->GetLevel(), minLevel, maxLevel);
246 ApplyLevelScaling(unitSummoner->m_unitData->ContentTuningID, unitSummoner->m_unitData->ScalingLevelDelta);
247 SetLevel(level);
248 if (!IsGuardian())
249 {
253 }
254 }
255 }
256
257 uint32 faction = m_Properties->Faction;
258 if (summoner && m_Properties->GetFlags().HasFlag(SummonPropertiesFlags::UseSummonerFaction)) // TODO: Determine priority between faction and flag
259 faction = summoner->GetFaction();
260
261 if (faction)
262 SetFaction(faction);
263
266}
267
269{
270 if (summoner)
271 {
272 if (summoner->GetTypeId() == TYPEID_UNIT)
273 {
274 if (summoner->ToCreature()->IsAIEnabled())
275 summoner->ToCreature()->AI()->JustSummoned(this);
276 }
277 else if (summoner->GetTypeId() == TYPEID_GAMEOBJECT)
278 {
279 if (summoner->ToGameObject()->AI())
280 summoner->ToGameObject()->AI()->JustSummoned(this);
281 }
282 if (IsAIEnabled())
283 AI()->IsSummonedBy(summoner);
284 }
285}
286
288{
289 boost::container::small_vector<WorldObject*, 2> objectsToUpdate;
290 objectsToUpdate.push_back(this);
291
292 if (SmoothPhasing const* smoothPhasing = GetSmoothPhasing())
293 {
294 SmoothPhasingInfo const* infoForSeer = smoothPhasing->GetInfoForSeer(GetDemonCreatorGUID());
295 if (infoForSeer && infoForSeer->ReplaceObject && smoothPhasing->IsReplacing(*infoForSeer->ReplaceObject))
296 if (WorldObject* original = ObjectAccessor::GetWorldObject(*this, *infoForSeer->ReplaceObject))
297 objectsToUpdate.push_back(original);
298 }
299
300 Trinity::VisibleChangesNotifier notifier({ objectsToUpdate.data(), objectsToUpdate.data() + objectsToUpdate.size() });
302}
303
305{
306 boost::container::small_vector<WorldObject*, 2> objectsToUpdate;
307 objectsToUpdate.push_back(this);
308
309 WorldObject* original = nullptr;
310 if (SmoothPhasing const* smoothPhasing = GetSmoothPhasing())
311 {
312 SmoothPhasingInfo const* infoForSeer = smoothPhasing->GetInfoForSeer(GetDemonCreatorGUID());
313 if (infoForSeer && infoForSeer->ReplaceObject && smoothPhasing->IsReplacing(*infoForSeer->ReplaceObject))
314 original = ObjectAccessor::GetWorldObject(*this, *infoForSeer->ReplaceObject);
315
316 if (original)
317 {
318 objectsToUpdate.push_back(original);
319
320 // disable replacement without removing - it is still needed for next step (visibility update)
321 if (SmoothPhasing* originalSmoothPhasing = original->GetSmoothPhasing())
322 originalSmoothPhasing->DisableReplacementForSeer(GetDemonCreatorGUID());
323 }
324 }
325
326 Trinity::VisibleChangesNotifier notifier({ objectsToUpdate.data(), objectsToUpdate.data() + objectsToUpdate.size() });
328
329 if (original) // original is only != nullptr when it was replaced
330 if (SmoothPhasing* originalSmoothPhasing = original->GetSmoothPhasing())
331 originalSmoothPhasing->ClearViewerDependentInfo(GetDemonCreatorGUID());
332}
333
335{
336 m_type = type;
337}
338
340{
341 if (msTime)
342 {
344 return;
345 }
346
347 //ASSERT(!IsPet());
348 if (IsPet())
349 {
351 ASSERT(!IsInWorld());
352 return;
353 }
354
355 if (WorldObject * owner = GetSummoner())
356 {
357 if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled())
358 owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
359 else if (owner->GetTypeId() == TYPEID_GAMEOBJECT && owner->ToGameObject()->AI())
360 owner->ToGameObject()->AI()->SummonedCreatureDespawn(this);
361 }
362
364}
365
367{
368 if (!IsInWorld())
369 return;
370
371 if (m_Properties && m_Properties->Slot != 0)
372 if (Unit* owner = GetSummonerUnit())
373 for (ObjectGuid& summonSlot : owner->m_SummonSlot)
374 if (summonSlot == GetGUID())
375 summonSlot.Clear();
376
377 //if (GetOwnerGUID())
378 // TC_LOG_ERROR("entities.unit", "Unit {} has owner guid when removed from world", GetEntry());
379
381}
382
383std::ptrdiff_t TempSummon::FindUsableTotemSlot(Unit const* summoner) const
384{
385 auto totemBegin = summoner->m_SummonSlot.begin() + SUMMON_SLOT_TOTEM;
386 auto totemEnd = summoner->m_SummonSlot.begin() + MAX_TOTEM_SLOT;
387
388 // first try exact guid match
389 auto totemSlot = std::find_if(totemBegin, totemEnd, [&](ObjectGuid const& otherTotemGuid)
390 {
391 return otherTotemGuid == GetGUID();
392 });
393
394 // then a slot that shares totem category with this new summon
395 if (totemSlot == totemEnd)
396 totemSlot = std::find_if(totemBegin, totemEnd, [&](ObjectGuid const& otherTotemGuid) { return IsSharingTotemSlotWith(otherTotemGuid); });
397
398 // any empty slot...?
399 if (totemSlot == totemEnd)
400 totemSlot = std::find_if(totemBegin, totemEnd, [](ObjectGuid const& otherTotemGuid) { return otherTotemGuid.IsEmpty(); });
401
402 // if no usable slot was found, try used slot by a summon with the same creature id
403 // we must not despawn unrelated summons
404 if (totemSlot == totemEnd)
405 totemSlot = std::find_if(totemBegin, totemEnd, [&](ObjectGuid const& otherTotemGuid) { return GetEntry() == otherTotemGuid.GetEntry(); });
406
407 // if no slot was found, this summon gets no slot and will not be stored in m_SummonSlot
408 if (totemSlot == totemEnd)
409 return 0;
410
411 return totemSlot - summoner->m_SummonSlot.begin();
412}
413
415{
416 Creature const* otherSummon = GetMap()->GetCreature(objectGuid);
417 if (!otherSummon)
418 return false;
419
420 SpellInfo const* mySummonSpell = sSpellMgr->GetSpellInfo(m_unitData->CreatedBySpell, DIFFICULTY_NONE);
421 if (!mySummonSpell)
422 return false;
423
424 SpellInfo const* otherSummonSpell = sSpellMgr->GetSpellInfo(otherSummon->m_unitData->CreatedBySpell, DIFFICULTY_NONE);
425 if (!otherSummonSpell)
426 return false;
427
428 for (uint16 myTotemCategory : mySummonSpell->TotemCategory)
429 if (myTotemCategory)
430 for (uint16 otherTotemCategory : otherSummonSpell->TotemCategory)
431 if (otherTotemCategory && DB2Manager::IsTotemCategoryCompatibleWith(myTotemCategory, otherTotemCategory, false))
432 return true;
433
434 for (int32 myTotemId : mySummonSpell->Totem)
435 if (myTotemId)
436 for (int32 otherTotemId : otherSummonSpell->Totem)
437 if (otherTotemId && myTotemId == otherTotemId)
438 return true;
439
440 return false;
441}
442
443std::string TempSummon::GetDebugInfo() const
444{
445 std::stringstream sstr;
446 sstr << Creature::GetDebugInfo() << "\n"
447 << std::boolalpha
448 << "TempSummonType: " << std::to_string(GetSummonType()) << " Summoner: " << GetSummonerGUID().ToString()
449 << "Timer: " << GetTimer().count() << "ms";
450 return sstr.str();
451}
452
453Minion::Minion(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject)
454 : TempSummon(properties, owner, isWorldObject), m_owner(owner)
455{
461}
462
464{
465 TempSummon::InitStats(summoner, duration);
466
468
470 SetFaction(GetOwner()->GetFaction()); // TODO: Is this correct? Overwrite the use of SummonPropertiesFlags::UseSummonerFaction
471
472 GetOwner()->SetMinion(this, true);
473}
474
476{
477 if (!IsInWorld())
478 return;
479
480 GetOwner()->SetMinion(this, false);
482}
483
485{
487 if (s != JUST_DIED || !IsGuardianPet())
488 return;
489
490 Unit* owner = GetOwner();
491 if (!owner || owner->GetTypeId() != TYPEID_PLAYER || owner->GetMinionGUID() != GetGUID())
492 return;
493
494 for (Unit* controlled : owner->m_Controlled)
495 {
496 if (controlled->GetEntry() == GetEntry() && controlled->IsAlive())
497 {
498 owner->SetMinionGUID(controlled->GetGUID());
499 owner->SetPetGUID(controlled->GetGUID());
500 owner->ToPlayer()->CharmSpellInitialize();
501 break;
502 }
503 }
504}
505
507{
509}
510
511std::string Minion::GetDebugInfo() const
512{
513 std::stringstream sstr;
514 sstr << TempSummon::GetDebugInfo() << "\n"
515 << std::boolalpha
516 << "Owner: " << (GetOwner() ? GetOwner()->GetGUID().ToString() : "");
517 return sstr.str();
518}
519
520Guardian::Guardian(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject) : Minion(properties, owner, isWorldObject)
521, m_bonusSpellDamage(0)
522{
523 memset(m_statFromOwner, 0, sizeof(float)*MAX_STATS);
525 if (properties && (SummonTitle(properties->Title) == SummonTitle::Pet || properties->Control == SUMMON_CATEGORY_PET))
526 {
529 }
530}
531
533{
534 Minion::InitStats(summoner, duration);
535
536 InitStatsForLevel(GetLevel()); // level is already initialized in TempSummon::InitStats, so use that
537
539 m_charmInfo->InitCharmCreateSpells();
540
542}
543
545{
546 TempSummon::InitSummon(summoner);
547
549 && GetOwner()->GetMinionGUID() == GetGUID()
550 && !GetOwner()->GetCharmedGUID())
551 {
553 }
554}
555
556std::string Guardian::GetDebugInfo() const
557{
558 std::stringstream sstr;
559 sstr << Minion::GetDebugInfo();
560 return sstr.str();
561}
562
563Puppet::Puppet(SummonPropertiesEntry const* properties, Unit* owner)
564 : Minion(properties, owner, false) //maybe true?
565{
568}
569
571{
572 Minion::InitStats(summoner, duration);
574}
575
577{
578 Minion::InitSummon(summoner);
580 ABORT();
581}
582
584{
585 Minion::Update(time);
586 //check if caster is channelling?
587 if (IsInWorld())
588 {
589 if (!IsAlive())
590 {
591 UnSummon();
593 }
594 }
595}
@ CHARM_TYPE_POSSESS
Definition CharmInfo.h:70
@ DIFFICULTY_NONE
Definition DBCEnums.h:936
uint8_t uint8
Definition Define.h:156
int32_t int32
Definition Define.h:150
uint16_t uint16
Definition Define.h:155
uint32_t uint32
Definition Define.h:154
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition Duration.h:24
#define ABORT
Definition Errors.h:79
#define ASSERT_NOTNULL(pointer)
Definition Errors.h:74
#define ASSERT
Definition Errors.h:72
#define TC_LOG_ERROR(filterType__, message__,...)
Definition Log.h:182
TempSummonType
@ TEMPSUMMON_DEAD_DESPAWN
@ TEMPSUMMON_MANUAL_DESPAWN
@ TEMPSUMMON_TIMED_DESPAWN
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
@ TEMPSUMMON_CORPSE_DESPAWN
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
@ TYPEID_GAMEOBJECT
Definition ObjectGuid.h:46
@ TYPEID_UNIT
Definition ObjectGuid.h:43
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
#define sObjectMgr
Definition ObjectMgr.h:1873
#define PET_FOLLOW_ANGLE
Definition PetDefines.h:99
@ PET_SAVE_NOT_IN_SLOT
Definition PetDefines.h:48
#define MAX_STATS
SummonTitle
@ SUMMON_SLOT_ANY_TOTEM
@ SUMMON_SLOT_TOTEM
#define MAX_TOTEM_SLOT
@ SUMMON_CATEGORY_PET
#define sSpellMgr
Definition SpellMgr.h:812
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_NPC_FLAG_WILD_BATTLE_PET
@ UNIT_MASK_PUPPET
Definition Unit.h:376
@ UNIT_MASK_CONTROLABLE_GUARDIAN
Definition Unit.h:378
@ UNIT_MASK_SUMMON
Definition Unit.h:370
@ UNIT_MASK_GUARDIAN
Definition Unit.h:372
@ UNIT_MASK_MINION
Definition Unit.h:371
DeathState
Definition Unit.h:265
@ CORPSE
Definition Unit.h:268
@ DEAD
Definition Unit.h:269
@ JUST_DIED
Definition Unit.h:267
ObjectGuid const & GetGUID() const
Definition BaseEntity.h:163
bool IsInWorld() const
Definition BaseEntity.h:158
bool IsPlayer() const
Definition BaseEntity.h:173
TypeID GetTypeId() const
Definition BaseEntity.h:166
virtual void JustSummoned(Creature *)
Definition CreatureAI.h:113
virtual void IsSummonedBy(WorldObject *)
Definition CreatureAI.h:114
bool IsTrigger() const
Definition Creature.h:127
void UpdateLevelDependantStats()
void setDeathState(DeathState s) override
void Update(uint32 time) override
Definition Creature.cpp:750
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition Creature.h:332
void SetReactState(ReactStates st)
Definition Creature.h:180
void RemoveFromWorld() override
Definition Creature.cpp:364
void ApplyLevelScaling()
void UpdateAttackPowerAndDamage(bool ranged=false) override
CreatureAI * AI() const
Definition Creature.h:235
std::string GetDebugInfo() const override
static bool IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId, bool requireAllTotems=true)
void AddEventAtOffset(BasicEvent *event, Milliseconds offset)
virtual void JustSummoned(Creature *)
GameObjectAI * AI() const
Definition GameObject.h:390
void InitSummon(WorldObject *summoner) override
Guardian(SummonPropertiesEntry const *properties, Unit *owner, bool isWorldObject)
void InitStats(WorldObject *summoner, Milliseconds duration) override
bool InitStatsForLevel(uint8 level)
Definition Pet.cpp:847
float m_statFromOwner[MAX_STATS]
std::string GetDebugInfo() const override
Creature * GetCreature(ObjectGuid const &guid)
Definition Map.cpp:3578
float m_followAngle
std::string GetDebugInfo() const override
void setDeathState(DeathState s) override
void RemoveFromWorld() override
Unit * GetOwner() const
Unit *const m_owner
void InitStats(WorldObject *summoner, Milliseconds duration) override
bool IsGuardianPet() const
Minion(SummonPropertiesEntry const *properties, Unit *owner, bool isWorldObject)
bool IsEmpty() const
Definition ObjectGuid.h:362
std::string ToString() const
uint32 GetEntry() const
Definition ObjectGuid.h:334
static CreatureModel const * ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
Player * ToPlayer()
Definition Object.h:126
GameObject * ToGameObject()
Definition Object.h:131
uint32 GetEntry() const
Definition Object.h:89
Creature * ToCreature()
Definition Object.h:121
Unit * ToUnit()
Definition Object.h:116
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition Pet.cpp:711
void CharmSpellInitialize()
Definition Player.cpp:22530
void Update(uint32 time) override
Puppet(SummonPropertiesEntry const *properties, Unit *owner)
void InitSummon(WorldObject *summoner) override
void InitStats(WorldObject *summoner, Milliseconds duration) override
std::array< int32, MAX_SPELL_TOTEMS > Totem
Definition SpellInfo.h:397
std::array< uint16, MAX_SPELL_TOTEMS > TotemCategory
Definition SpellInfo.h:398
WorldObject * GetSummoner() const
void UpdateObjectVisibilityOnDestroy() override
Milliseconds m_timer
virtual void UnSummon(uint32 msTime=0)
TempSummonType GetSummonType() const
virtual void InitStats(WorldObject *summoner, Milliseconds duration)
bool IsSharingTotemSlotWith(ObjectGuid objectGuid) const
std::ptrdiff_t FindUsableTotemSlot(Unit const *summoner) const
ObjectGuid GetSummonerGUID() const
void SetTempSummonType(TempSummonType type)
void RemoveFromWorld() override
virtual void InitSummon(WorldObject *summoner)
SummonPropertiesEntry const *const m_Properties
Optional< uint32 > m_displayIdVisibleToSummoner
std::string GetDebugInfo() const override
GameObject * GetSummonerGameObject() const
ObjectGuid m_summonerGUID
TempSummonType m_type
Optional< uint32 > m_creatureIdVisibleToSummoner
void UpdateObjectVisibilityOnCreate() override
void Update(uint32 diff) override
Creature * GetSummonerCreatureBase() const
TempSummon(SummonPropertiesEntry const *properties, WorldObject *owner, bool isWorldObject)
Unit * GetSummonerUnit() const
Milliseconds GetTimer() const
virtual ~TempSummon()
Milliseconds m_lifetime
Definition Unit.h:647
void SetMinion(Minion *minion, bool apply)
Definition Unit.cpp:6266
Pet * ToPet()
Definition Unit.h:1838
ObjectGuid GetDemonCreatorGUID() const
Definition Unit.h:1223
void SetMinionGUID(ObjectGuid guid)
Definition Unit.h:1216
std::array< ObjectGuid, MAX_SUMMON_SLOT > m_SummonSlot
Definition Unit.h:1524
std::unique_ptr< CharmInfo > m_charmInfo
Definition Unit.h:1969
void SetFaction(uint32 faction) override
Definition Unit.h:887
bool IsPet() const
Definition Unit.h:763
ObjectGuid GetCharmedGUID() const
Definition Unit.h:1231
bool IsAlive() const
Definition Unit.h:1205
DeathState m_deathState
Definition Unit.h:1920
uint32 m_unitTypeMask
Definition Unit.h:1980
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:1013
TempSummon * ToTempSummon()
Definition Unit.h:1844
ControlList m_Controlled
Definition Unit.h:1252
bool m_ControlledByPlayer
Definition Unit.h:1912
bool IsAIEnabled() const
Definition Unit.h:678
ObjectGuid GetMinionGUID() const
Definition Unit.h:1215
bool IsSummon() const
Definition Unit.h:761
uint32 GetFaction() const override
Definition Unit.h:886
bool IsGuardian() const
Definition Unit.h:762
UF::UpdateField< UF::UnitData, int32(WowCS::EntityFragment::CGObject), TYPEID_UNIT > m_unitData
Definition Unit.h:1897
void SetLevel(uint8 lvl, bool sendUpdate=true)
Definition Unit.cpp:10019
CharmInfo * InitCharmInfo()
Definition Unit.cpp:10447
uint32 HasUnitTypeMask(uint32 mask) const
Definition Unit.h:759
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition Unit.cpp:11859
void SetPetGUID(ObjectGuid guid)
Definition Unit.h:1218
void SetCreatorGUID(ObjectGuid creator)
Definition Unit.h:1214
uint8 GetLevel() const
Definition Unit.h:769
bool IsInCombat() const
Definition Unit.h:1073
Map * GetMap() const
Definition Object.h:411
SmoothPhasing * GetSmoothPhasing()
Definition Object.h:575
void AddObjectToRemoveList()
Definition Object.cpp:1179
EventProcessor m_Events
Definition Object.h:561
float GetVisibilityRange() const
Definition Object.cpp:785
virtual uint32 GetFaction() const =0
TC_GAME_API WorldObject * GetWorldObject(WorldObject const &, ObjectGuid const &)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
static void VisitWorldObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:150
uint32 CreatureDisplayID
Optional< ObjectGuid > ReplaceObject
EnumFlag< SummonPropertiesFlags > GetFlags() const