TrinityCore
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
50{
52}
53
55{
56 if (WorldObject* summoner = GetSummoner())
57 return summoner->ToUnit();
58 return nullptr;
59}
60
62{
64}
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
197
198 if (summoner && summoner->IsPlayer())
199 {
200 if (IsTrigger() && m_spells[0])
202
203 if (CreatureSummonedData const* summonedData = sObjectMgr->GetCreatureSummonedData(GetEntry()))
204 {
205 m_creatureIdVisibleToSummoner = summonedData->CreatureIDVisibleToSummoner;
206 if (summonedData->CreatureIDVisibleToSummoner)
207 {
208 CreatureTemplate const* creatureTemplateVisibleToSummoner = ASSERT_NOTNULL(sObjectMgr->GetCreatureTemplate(*summonedData->CreatureIDVisibleToSummoner));
209 m_displayIdVisibleToSummoner = ObjectMgr::ChooseDisplayId(creatureTemplateVisibleToSummoner, nullptr)->CreatureDisplayID;
210 }
211 }
212 }
213
214 if (!m_Properties)
215 return;
216
217 if (Unit* unitSummoner = ToUnit(summoner))
218 {
219 std::ptrdiff_t slot = m_Properties->Slot;
220 if (slot == SUMMON_SLOT_ANY_TOTEM)
221 slot = FindUsableTotemSlot(unitSummoner);
222
223 if (slot != 0)
224 {
225 if (!unitSummoner->m_SummonSlot[slot].IsEmpty() && unitSummoner->m_SummonSlot[slot] != GetGUID())
226 {
227 Creature* oldSummon = GetMap()->GetCreature(unitSummoner->m_SummonSlot[slot]);
228 if (oldSummon && oldSummon->IsSummon())
229 oldSummon->ToTempSummon()->UnSummon();
230 }
231 unitSummoner->m_SummonSlot[slot] = GetGUID();
232 }
233
235 SetLevel(unitSummoner->GetLevel());
236 }
237
238 uint32 faction = m_Properties->Faction;
239 if (summoner && m_Properties->GetFlags().HasFlag(SummonPropertiesFlags::UseSummonerFaction)) // TODO: Determine priority between faction and flag
240 faction = summoner->GetFaction();
241
242 if (faction)
243 SetFaction(faction);
244
247}
248
250{
251 if (summoner)
252 {
253 if (summoner->GetTypeId() == TYPEID_UNIT)
254 {
255 if (summoner->ToCreature()->IsAIEnabled())
256 summoner->ToCreature()->AI()->JustSummoned(this);
257 }
258 else if (summoner->GetTypeId() == TYPEID_GAMEOBJECT)
259 {
260 if (summoner->ToGameObject()->AI())
261 summoner->ToGameObject()->AI()->JustSummoned(this);
262 }
263 if (IsAIEnabled())
264 AI()->IsSummonedBy(summoner);
265 }
266}
267
269{
270 boost::container::small_vector<WorldObject*, 2> objectsToUpdate;
271 objectsToUpdate.push_back(this);
272
273 if (SmoothPhasing const* smoothPhasing = GetSmoothPhasing())
274 {
275 SmoothPhasingInfo const* infoForSeer = smoothPhasing->GetInfoForSeer(GetDemonCreatorGUID());
276 if (infoForSeer && infoForSeer->ReplaceObject && smoothPhasing->IsReplacing(*infoForSeer->ReplaceObject))
277 if (WorldObject* original = ObjectAccessor::GetWorldObject(*this, *infoForSeer->ReplaceObject))
278 objectsToUpdate.push_back(original);
279 }
280
281 Trinity::VisibleChangesNotifier notifier({ objectsToUpdate.data(), objectsToUpdate.data() + objectsToUpdate.size() });
283}
284
286{
287 boost::container::small_vector<WorldObject*, 2> objectsToUpdate;
288 objectsToUpdate.push_back(this);
289
290 WorldObject* original = nullptr;
291 if (SmoothPhasing const* smoothPhasing = GetSmoothPhasing())
292 {
293 SmoothPhasingInfo const* infoForSeer = smoothPhasing->GetInfoForSeer(GetDemonCreatorGUID());
294 if (infoForSeer && infoForSeer->ReplaceObject && smoothPhasing->IsReplacing(*infoForSeer->ReplaceObject))
295 original = ObjectAccessor::GetWorldObject(*this, *infoForSeer->ReplaceObject);
296
297 if (original)
298 {
299 objectsToUpdate.push_back(original);
300
301 // disable replacement without removing - it is still needed for next step (visibility update)
302 if (SmoothPhasing* originalSmoothPhasing = original->GetSmoothPhasing())
303 originalSmoothPhasing->DisableReplacementForSeer(GetDemonCreatorGUID());
304 }
305 }
306
307 Trinity::VisibleChangesNotifier notifier({ objectsToUpdate.data(), objectsToUpdate.data() + objectsToUpdate.size() });
309
310 if (original) // original is only != nullptr when it was replaced
311 if (SmoothPhasing* originalSmoothPhasing = original->GetSmoothPhasing())
312 originalSmoothPhasing->ClearViewerDependentInfo(GetDemonCreatorGUID());
313}
314
316{
317 m_type = type;
318}
319
321{
322 if (msTime)
323 {
325
327 return;
328 }
329
330 //ASSERT(!IsPet());
331 if (IsPet())
332 {
334 ASSERT(!IsInWorld());
335 return;
336 }
337
338 if (WorldObject * owner = GetSummoner())
339 {
340 if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled())
341 owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
342 else if (owner->GetTypeId() == TYPEID_GAMEOBJECT && owner->ToGameObject()->AI())
343 owner->ToGameObject()->AI()->SummonedCreatureDespawn(this);
344 }
345
347}
348
350{
352 return true;
353}
354
356{
357 if (!IsInWorld())
358 return;
359
360 if (m_Properties && m_Properties->Slot != 0)
361 if (Unit* owner = GetSummonerUnit())
362 for (ObjectGuid& summonSlot : owner->m_SummonSlot)
363 if (summonSlot == GetGUID())
364 summonSlot.Clear();
365
366 //if (GetOwnerGUID())
367 // TC_LOG_ERROR("entities.unit", "Unit {} has owner guid when removed from world", GetEntry());
368
370}
371
372std::ptrdiff_t TempSummon::FindUsableTotemSlot(Unit const* summoner) const
373{
374 auto totemBegin = summoner->m_SummonSlot.begin() + SUMMON_SLOT_TOTEM;
375 auto totemEnd = summoner->m_SummonSlot.begin() + MAX_TOTEM_SLOT;
376
377 // first try exact guid match
378 auto totemSlot = std::find_if(totemBegin, totemEnd, [&](ObjectGuid const& otherTotemGuid)
379 {
380 return otherTotemGuid == GetGUID();
381 });
382
383 // then a slot that shares totem category with this new summon
384 if (totemSlot == totemEnd)
385 totemSlot = std::find_if(totemBegin, totemEnd, [&](ObjectGuid const& otherTotemGuid) { return IsSharingTotemSlotWith(otherTotemGuid); });
386
387 // any empty slot...?
388 if (totemSlot == totemEnd)
389 totemSlot = std::find_if(totemBegin, totemEnd, [](ObjectGuid const& otherTotemGuid) { return otherTotemGuid.IsEmpty(); });
390
391 // if no usable slot was found, try used slot by a summon with the same creature id
392 // we must not despawn unrelated summons
393 if (totemSlot == totemEnd)
394 totemSlot = std::find_if(totemBegin, totemEnd, [&](ObjectGuid const& otherTotemGuid) { return GetEntry() == otherTotemGuid.GetEntry(); });
395
396 // if no slot was found, this summon gets no slot and will not be stored in m_SummonSlot
397 if (totemSlot == totemEnd)
398 return 0;
399
400 return totemSlot - summoner->m_SummonSlot.begin();
401}
402
404{
405 Creature const* otherSummon = GetMap()->GetCreature(objectGuid);
406 if (!otherSummon)
407 return false;
408
409 SpellInfo const* mySummonSpell = sSpellMgr->GetSpellInfo(m_unitData->CreatedBySpell, DIFFICULTY_NONE);
410 if (!mySummonSpell)
411 return false;
412
413 SpellInfo const* otherSummonSpell = sSpellMgr->GetSpellInfo(otherSummon->m_unitData->CreatedBySpell, DIFFICULTY_NONE);
414 if (!otherSummonSpell)
415 return false;
416
417 for (uint16 myTotemCategory : mySummonSpell->TotemCategory)
418 if (myTotemCategory)
419 for (uint16 otherTotemCategory : otherSummonSpell->TotemCategory)
420 if (otherTotemCategory && DB2Manager::IsTotemCategoryCompatibleWith(myTotemCategory, otherTotemCategory, false))
421 return true;
422
423 for (int32 myTotemId : mySummonSpell->Totem)
424 if (myTotemId)
425 for (int32 otherTotemId : otherSummonSpell->Totem)
426 if (otherTotemId && myTotemId == otherTotemId)
427 return true;
428
429 return false;
430}
431
432std::string TempSummon::GetDebugInfo() const
433{
434 std::stringstream sstr;
435 sstr << Creature::GetDebugInfo() << "\n"
436 << std::boolalpha
437 << "TempSummonType: " << std::to_string(GetSummonType()) << " Summoner: " << GetSummonerGUID().ToString()
438 << "Timer: " << GetTimer().count() << "ms";
439 return sstr.str();
440}
441
442Minion::Minion(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject)
443 : TempSummon(properties, owner, isWorldObject), m_owner(owner)
444{
450}
451
453{
454 TempSummon::InitStats(summoner, duration);
455
457
459 SetFaction(GetOwner()->GetFaction()); // TODO: Is this correct? Overwrite the use of SummonPropertiesFlags::UseSummonerFaction
460
461 GetOwner()->SetMinion(this, true);
462}
463
465{
466 if (!IsInWorld())
467 return;
468
469 GetOwner()->SetMinion(this, false);
471}
472
474{
476 if (s != JUST_DIED || !IsGuardianPet())
477 return;
478
479 Unit* owner = GetOwner();
480 if (!owner || owner->GetTypeId() != TYPEID_PLAYER || owner->GetMinionGUID() != GetGUID())
481 return;
482
483 for (Unit* controlled : owner->m_Controlled)
484 {
485 if (controlled->GetEntry() == GetEntry() && controlled->IsAlive())
486 {
487 owner->SetMinionGUID(controlled->GetGUID());
488 owner->SetPetGUID(controlled->GetGUID());
489 owner->ToPlayer()->CharmSpellInitialize();
490 break;
491 }
492 }
493}
494
496{
498}
499
500std::string Minion::GetDebugInfo() const
501{
502 std::stringstream sstr;
503 sstr << TempSummon::GetDebugInfo() << "\n"
504 << std::boolalpha
505 << "Owner: " << (GetOwner() ? GetOwner()->GetGUID().ToString() : "");
506 return sstr.str();
507}
508
509Guardian::Guardian(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject) : Minion(properties, owner, isWorldObject)
510, m_bonusSpellDamage(0)
511{
512 memset(m_statFromOwner, 0, sizeof(float)*MAX_STATS);
514 if (properties && (SummonTitle(properties->Title) == SummonTitle::Pet || properties->Control == SUMMON_CATEGORY_PET))
515 {
518 }
519}
520
522{
523 Minion::InitStats(summoner, duration);
524
525 InitStatsForLevel(GetLevel()); // level is already initialized in TempSummon::InitStats, so use that
526
528 m_charmInfo->InitCharmCreateSpells();
529
531}
532
534{
535 TempSummon::InitSummon(summoner);
536
538 && GetOwner()->GetMinionGUID() == GetGUID()
539 && !GetOwner()->GetCharmedGUID())
540 {
542 }
543}
544
545std::string Guardian::GetDebugInfo() const
546{
547 std::stringstream sstr;
548 sstr << Minion::GetDebugInfo();
549 return sstr.str();
550}
551
552Puppet::Puppet(SummonPropertiesEntry const* properties, Unit* owner)
553 : Minion(properties, owner, false) //maybe true?
554{
557}
558
560{
561 Minion::InitStats(summoner, duration);
563}
564
566{
567 Minion::InitSummon(summoner);
569 ABORT();
570}
571
573{
574 Minion::Update(time);
575 //check if caster is channelling?
576 if (IsInWorld())
577 {
578 if (!IsAlive())
579 {
580 UnSummon();
582 }
583 }
584}
@ CHARM_TYPE_POSSESS
Definition: CharmInfo.h:71
@ DIFFICULTY_NONE
Definition: DBCEnums.h:874
int32_t int32
Definition: Define.h:138
uint64_t uint64
Definition: Define.h:141
uint16_t uint16
Definition: Define.h:143
uint32_t uint32
Definition: Define.h:142
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
Definition: Duration.h:29
#define ABORT
Definition: Errors.h:74
#define ASSERT_NOTNULL(pointer)
Definition: Errors.h:84
#define ASSERT
Definition: Errors.h:68
#define TC_LOG_ERROR(filterType__,...)
Definition: Log.h:165
TempSummonType
Definition: ObjectDefines.h:62
@ TEMPSUMMON_DEAD_DESPAWN
Definition: ObjectDefines.h:69
@ TEMPSUMMON_MANUAL_DESPAWN
Definition: ObjectDefines.h:70
@ TEMPSUMMON_TIMED_DESPAWN
Definition: ObjectDefines.h:65
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition: ObjectDefines.h:66
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
Definition: ObjectDefines.h:63
@ TEMPSUMMON_TIMED_OR_CORPSE_DESPAWN
Definition: ObjectDefines.h:64
@ TEMPSUMMON_CORPSE_DESPAWN
Definition: ObjectDefines.h:67
@ TEMPSUMMON_CORPSE_TIMED_DESPAWN
Definition: ObjectDefines.h:68
@ TYPEID_GAMEOBJECT
Definition: ObjectGuid.h:43
@ TYPEID_UNIT
Definition: ObjectGuid.h:40
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
#define sObjectMgr
Definition: ObjectMgr.h:1946
#define PET_FOLLOW_ANGLE
Definition: PetDefines.h:98
@ 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:849
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ REACT_AGGRESSIVE
Definition: UnitDefines.h:508
@ UNIT_NPC_FLAG_WILD_BATTLE_PET
Definition: UnitDefines.h:327
@ UNIT_MASK_PUPPET
Definition: Unit.h:356
@ UNIT_MASK_CONTROLABLE_GUARDIAN
Definition: Unit.h:358
@ UNIT_MASK_SUMMON
Definition: Unit.h:350
@ UNIT_MASK_GUARDIAN
Definition: Unit.h:352
@ UNIT_MASK_MINION
Definition: Unit.h:351
DeathState
Definition: Unit.h:245
@ CORPSE
Definition: Unit.h:248
@ DEAD
Definition: Unit.h:249
@ JUST_DIED
Definition: Unit.h:247
virtual void JustSummoned(Creature *)
Definition: CreatureAI.h:111
virtual void IsSummonedBy(WorldObject *)
Definition: CreatureAI.h:112
bool IsTrigger() const
Definition: Creature.h:113
void setDeathState(DeathState s) override
Definition: Creature.cpp:2197
void Update(uint32 time) override
Definition: Creature.cpp:709
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition: Creature.h:302
void SetReactState(ReactStates st)
Definition: Creature.h:160
void RemoveFromWorld() override
Definition: Creature.cpp:349
CreatureAI * AI() const
Definition: Creature.h:214
std::string GetDebugInfo() const override
Definition: Creature.cpp:3667
static bool IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId, bool requireAllTotems=true)
Definition: DB2Stores.cpp:2990
void AddEvent(BasicEvent *event, Milliseconds e_time, bool set_addtime=true)
Milliseconds CalculateTime(Milliseconds t_offset) const
bool Execute(uint64 e_time, uint32 p_time) override
virtual void JustSummoned(Creature *)
Definition: GameObjectAI.h:114
GameObjectAI * AI() const
Definition: GameObject.h:378
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:840
float m_statFromOwner[MAX_STATS]
std::string GetDebugInfo() const override
Creature * GetCreature(ObjectGuid const &guid)
Definition: Map.cpp:3479
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:319
std::string ToString() const
Definition: ObjectGuid.cpp:554
uint32 GetEntry() const
Definition: ObjectGuid.h:291
void Clear()
Definition: ObjectGuid.h:286
static CreatureModel const * ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
Definition: ObjectMgr.cpp:1616
static Creature * ToCreature(Object *o)
Definition: Object.h:219
bool IsPlayer() const
Definition: Object.h:212
static Unit * ToUnit(Object *o)
Definition: Object.h:225
static GameObject * ToGameObject(Object *o)
Definition: Object.h:231
ObjectGuid const & GetGUID() const
Definition: Object.h:160
bool IsInWorld() const
Definition: Object.h:154
TypeID GetTypeId() const
Definition: Object.h:173
uint32 GetEntry() const
Definition: Object.h:161
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:159
static Player * ToPlayer(Object *o)
Definition: Object.h:213
Unit * ToUnit()
Definition: Object.h:227
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition: Pet.cpp:712
void CharmSpellInitialize()
Definition: Player.cpp:21991
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:391
std::array< uint16, MAX_SPELL_TOTEMS > TotemCategory
Definition: SpellInfo.h:392
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:627
void SetMinion(Minion *minion, bool apply)
Definition: Unit.cpp:6062
Pet * ToPet()
Definition: Unit.h:1750
ObjectGuid GetDemonCreatorGUID() const
Definition: Unit.h:1182
void SetMinionGUID(ObjectGuid guid)
Definition: Unit.h:1175
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
Definition: Unit.h:1814
std::array< ObjectGuid, MAX_SUMMON_SLOT > m_SummonSlot
Definition: Unit.h:1460
std::unique_ptr< CharmInfo > m_charmInfo
Definition: Unit.h:1902
void SetFaction(uint32 faction) override
Definition: Unit.h:859
bool IsPet() const
Definition: Unit.h:740
ObjectGuid GetCharmedGUID() const
Definition: Unit.h:1190
bool IsAlive() const
Definition: Unit.h:1164
DeathState m_deathState
Definition: Unit.h:1857
uint32 m_unitTypeMask
Definition: Unit.h:1913
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:983
TempSummon * ToTempSummon()
Definition: Unit.h:1756
ControlList m_Controlled
Definition: Unit.h:1211
bool m_ControlledByPlayer
Definition: Unit.h:1848
bool IsAIEnabled() const
Definition: Unit.h:658
ObjectGuid GetMinionGUID() const
Definition: Unit.h:1174
bool IsSummon() const
Definition: Unit.h:738
uint32 GetFaction() const override
Definition: Unit.h:858
void SetLevel(uint8 lvl, bool sendUpdate=true)
Definition: Unit.cpp:9329
CharmInfo * InitCharmInfo()
Definition: Unit.cpp:9748
uint32 HasUnitTypeMask(uint32 mask) const
Definition: Unit.h:736
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition: Unit.cpp:11142
void SetPetGUID(ObjectGuid guid)
Definition: Unit.h:1177
void SetCreatorGUID(ObjectGuid creator)
Definition: Unit.h:1173
uint8 GetLevel() const
Definition: Unit.h:746
bool IsInCombat() const
Definition: Unit.h:1043
Map * GetMap() const
Definition: Object.h:624
SmoothPhasing * GetSmoothPhasing()
Definition: Object.h:791
void AddObjectToRemoveList()
Definition: Object.cpp:1824
EventProcessor m_Events
Definition: Object.h:777
float GetVisibilityRange() const
Definition: Object.cpp:1447
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, bool dont_load=true)
Definition: CellImpl.h:191
uint32 CreatureDisplayID
Definition: CreatureData.h:432
Optional< ObjectGuid > ReplaceObject
Definition: SmoothPhasing.h:29
EnumFlag< SummonPropertiesFlags > GetFlags() const