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
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 SetLevel(level);
247 }
248 }
249
250 uint32 faction = m_Properties->Faction;
251 if (summoner && m_Properties->GetFlags().HasFlag(SummonPropertiesFlags::UseSummonerFaction)) // TODO: Determine priority between faction and flag
252 faction = summoner->GetFaction();
253
254 if (faction)
255 SetFaction(faction);
256
259}
260
262{
263 if (summoner)
264 {
265 if (summoner->GetTypeId() == TYPEID_UNIT)
266 {
267 if (summoner->ToCreature()->IsAIEnabled())
268 summoner->ToCreature()->AI()->JustSummoned(this);
269 }
270 else if (summoner->GetTypeId() == TYPEID_GAMEOBJECT)
271 {
272 if (summoner->ToGameObject()->AI())
273 summoner->ToGameObject()->AI()->JustSummoned(this);
274 }
275 if (IsAIEnabled())
276 AI()->IsSummonedBy(summoner);
277 }
278}
279
281{
282 boost::container::small_vector<WorldObject*, 2> objectsToUpdate;
283 objectsToUpdate.push_back(this);
284
285 if (SmoothPhasing const* smoothPhasing = GetSmoothPhasing())
286 {
287 SmoothPhasingInfo const* infoForSeer = smoothPhasing->GetInfoForSeer(GetDemonCreatorGUID());
288 if (infoForSeer && infoForSeer->ReplaceObject && smoothPhasing->IsReplacing(*infoForSeer->ReplaceObject))
289 if (WorldObject* original = ObjectAccessor::GetWorldObject(*this, *infoForSeer->ReplaceObject))
290 objectsToUpdate.push_back(original);
291 }
292
293 Trinity::VisibleChangesNotifier notifier({ objectsToUpdate.data(), objectsToUpdate.data() + objectsToUpdate.size() });
295}
296
298{
299 boost::container::small_vector<WorldObject*, 2> objectsToUpdate;
300 objectsToUpdate.push_back(this);
301
302 WorldObject* original = nullptr;
303 if (SmoothPhasing const* smoothPhasing = GetSmoothPhasing())
304 {
305 SmoothPhasingInfo const* infoForSeer = smoothPhasing->GetInfoForSeer(GetDemonCreatorGUID());
306 if (infoForSeer && infoForSeer->ReplaceObject && smoothPhasing->IsReplacing(*infoForSeer->ReplaceObject))
307 original = ObjectAccessor::GetWorldObject(*this, *infoForSeer->ReplaceObject);
308
309 if (original)
310 {
311 objectsToUpdate.push_back(original);
312
313 // disable replacement without removing - it is still needed for next step (visibility update)
314 if (SmoothPhasing* originalSmoothPhasing = original->GetSmoothPhasing())
315 originalSmoothPhasing->DisableReplacementForSeer(GetDemonCreatorGUID());
316 }
317 }
318
319 Trinity::VisibleChangesNotifier notifier({ objectsToUpdate.data(), objectsToUpdate.data() + objectsToUpdate.size() });
321
322 if (original) // original is only != nullptr when it was replaced
323 if (SmoothPhasing* originalSmoothPhasing = original->GetSmoothPhasing())
324 originalSmoothPhasing->ClearViewerDependentInfo(GetDemonCreatorGUID());
325}
326
328{
329 m_type = type;
330}
331
333{
334 if (msTime)
335 {
337
339 return;
340 }
341
342 //ASSERT(!IsPet());
343 if (IsPet())
344 {
346 ASSERT(!IsInWorld());
347 return;
348 }
349
350 if (WorldObject * owner = GetSummoner())
351 {
352 if (owner->GetTypeId() == TYPEID_UNIT && owner->ToCreature()->IsAIEnabled())
353 owner->ToCreature()->AI()->SummonedCreatureDespawn(this);
354 else if (owner->GetTypeId() == TYPEID_GAMEOBJECT && owner->ToGameObject()->AI())
355 owner->ToGameObject()->AI()->SummonedCreatureDespawn(this);
356 }
357
359}
360
362{
364 return true;
365}
366
368{
369 if (!IsInWorld())
370 return;
371
372 if (m_Properties && m_Properties->Slot != 0)
373 if (Unit* owner = GetSummonerUnit())
374 for (ObjectGuid& summonSlot : owner->m_SummonSlot)
375 if (summonSlot == GetGUID())
376 summonSlot.Clear();
377
378 //if (GetOwnerGUID())
379 // TC_LOG_ERROR("entities.unit", "Unit {} has owner guid when removed from world", GetEntry());
380
382}
383
384std::ptrdiff_t TempSummon::FindUsableTotemSlot(Unit const* summoner) const
385{
386 auto totemBegin = summoner->m_SummonSlot.begin() + SUMMON_SLOT_TOTEM;
387 auto totemEnd = summoner->m_SummonSlot.begin() + MAX_TOTEM_SLOT;
388
389 // first try exact guid match
390 auto totemSlot = std::find_if(totemBegin, totemEnd, [&](ObjectGuid const& otherTotemGuid)
391 {
392 return otherTotemGuid == GetGUID();
393 });
394
395 // then a slot that shares totem category with this new summon
396 if (totemSlot == totemEnd)
397 totemSlot = std::find_if(totemBegin, totemEnd, [&](ObjectGuid const& otherTotemGuid) { return IsSharingTotemSlotWith(otherTotemGuid); });
398
399 // any empty slot...?
400 if (totemSlot == totemEnd)
401 totemSlot = std::find_if(totemBegin, totemEnd, [](ObjectGuid const& otherTotemGuid) { return otherTotemGuid.IsEmpty(); });
402
403 // if no usable slot was found, try used slot by a summon with the same creature id
404 // we must not despawn unrelated summons
405 if (totemSlot == totemEnd)
406 totemSlot = std::find_if(totemBegin, totemEnd, [&](ObjectGuid const& otherTotemGuid) { return GetEntry() == otherTotemGuid.GetEntry(); });
407
408 // if no slot was found, this summon gets no slot and will not be stored in m_SummonSlot
409 if (totemSlot == totemEnd)
410 return 0;
411
412 return totemSlot - summoner->m_SummonSlot.begin();
413}
414
416{
417 Creature const* otherSummon = GetMap()->GetCreature(objectGuid);
418 if (!otherSummon)
419 return false;
420
421 SpellInfo const* mySummonSpell = sSpellMgr->GetSpellInfo(m_unitData->CreatedBySpell, DIFFICULTY_NONE);
422 if (!mySummonSpell)
423 return false;
424
425 SpellInfo const* otherSummonSpell = sSpellMgr->GetSpellInfo(otherSummon->m_unitData->CreatedBySpell, DIFFICULTY_NONE);
426 if (!otherSummonSpell)
427 return false;
428
429 for (uint16 myTotemCategory : mySummonSpell->TotemCategory)
430 if (myTotemCategory)
431 for (uint16 otherTotemCategory : otherSummonSpell->TotemCategory)
432 if (otherTotemCategory && DB2Manager::IsTotemCategoryCompatibleWith(myTotemCategory, otherTotemCategory, false))
433 return true;
434
435 for (int32 myTotemId : mySummonSpell->Totem)
436 if (myTotemId)
437 for (int32 otherTotemId : otherSummonSpell->Totem)
438 if (otherTotemId && myTotemId == otherTotemId)
439 return true;
440
441 return false;
442}
443
444std::string TempSummon::GetDebugInfo() const
445{
446 std::stringstream sstr;
447 sstr << Creature::GetDebugInfo() << "\n"
448 << std::boolalpha
449 << "TempSummonType: " << std::to_string(GetSummonType()) << " Summoner: " << GetSummonerGUID().ToString()
450 << "Timer: " << GetTimer().count() << "ms";
451 return sstr.str();
452}
453
454Minion::Minion(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject)
455 : TempSummon(properties, owner, isWorldObject), m_owner(owner)
456{
462}
463
465{
466 TempSummon::InitStats(summoner, duration);
467
469
471 SetFaction(GetOwner()->GetFaction()); // TODO: Is this correct? Overwrite the use of SummonPropertiesFlags::UseSummonerFaction
472
473 GetOwner()->SetMinion(this, true);
474}
475
477{
478 if (!IsInWorld())
479 return;
480
481 GetOwner()->SetMinion(this, false);
483}
484
486{
488 if (s != JUST_DIED || !IsGuardianPet())
489 return;
490
491 Unit* owner = GetOwner();
492 if (!owner || owner->GetTypeId() != TYPEID_PLAYER || owner->GetMinionGUID() != GetGUID())
493 return;
494
495 for (Unit* controlled : owner->m_Controlled)
496 {
497 if (controlled->GetEntry() == GetEntry() && controlled->IsAlive())
498 {
499 owner->SetMinionGUID(controlled->GetGUID());
500 owner->SetPetGUID(controlled->GetGUID());
501 owner->ToPlayer()->CharmSpellInitialize();
502 break;
503 }
504 }
505}
506
508{
510}
511
512std::string Minion::GetDebugInfo() const
513{
514 std::stringstream sstr;
515 sstr << TempSummon::GetDebugInfo() << "\n"
516 << std::boolalpha
517 << "Owner: " << (GetOwner() ? GetOwner()->GetGUID().ToString() : "");
518 return sstr.str();
519}
520
521Guardian::Guardian(SummonPropertiesEntry const* properties, Unit* owner, bool isWorldObject) : Minion(properties, owner, isWorldObject)
522, m_bonusSpellDamage(0)
523{
524 memset(m_statFromOwner, 0, sizeof(float)*MAX_STATS);
526 if (properties && (SummonTitle(properties->Title) == SummonTitle::Pet || properties->Control == SUMMON_CATEGORY_PET))
527 {
530 }
531}
532
534{
535 Minion::InitStats(summoner, duration);
536
537 InitStatsForLevel(GetLevel()); // level is already initialized in TempSummon::InitStats, so use that
538
540 m_charmInfo->InitCharmCreateSpells();
541
543}
544
546{
547 TempSummon::InitSummon(summoner);
548
550 && GetOwner()->GetMinionGUID() == GetGUID()
551 && !GetOwner()->GetCharmedGUID())
552 {
554 }
555}
556
557std::string Guardian::GetDebugInfo() const
558{
559 std::stringstream sstr;
560 sstr << Minion::GetDebugInfo();
561 return sstr.str();
562}
563
564Puppet::Puppet(SummonPropertiesEntry const* properties, Unit* owner)
565 : Minion(properties, owner, false) //maybe true?
566{
569}
570
572{
573 Minion::InitStats(summoner, duration);
575}
576
578{
579 Minion::InitSummon(summoner);
581 ABORT();
582}
583
585{
586 Minion::Update(time);
587 //check if caster is channelling?
588 if (IsInWorld())
589 {
590 if (!IsAlive())
591 {
592 UnSummon();
594 }
595 }
596}
@ CHARM_TYPE_POSSESS
Definition: CharmInfo.h:71
@ DIFFICULTY_NONE
Definition: DBCEnums.h:919
uint8_t uint8
Definition: Define.h:144
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__, message__,...)
Definition: Log.h:188
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:44
@ TYPEID_UNIT
Definition: ObjectGuid.h:41
@ TYPEID_PLAYER
Definition: ObjectGuid.h:42
#define sObjectMgr
Definition: ObjectMgr.h:1979
#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:856
@ REACT_PASSIVE
Definition: UnitDefines.h:534
@ REACT_AGGRESSIVE
Definition: UnitDefines.h:536
@ UNIT_NPC_FLAG_WILD_BATTLE_PET
Definition: UnitDefines.h:350
@ UNIT_MASK_PUPPET
Definition: Unit.h:357
@ UNIT_MASK_CONTROLABLE_GUARDIAN
Definition: Unit.h:359
@ UNIT_MASK_SUMMON
Definition: Unit.h:351
@ UNIT_MASK_GUARDIAN
Definition: Unit.h:353
@ UNIT_MASK_MINION
Definition: Unit.h:352
DeathState
Definition: Unit.h:246
@ CORPSE
Definition: Unit.h:249
@ DEAD
Definition: Unit.h:250
@ JUST_DIED
Definition: Unit.h:248
virtual void JustSummoned(Creature *)
Definition: CreatureAI.h:111
virtual void IsSummonedBy(WorldObject *)
Definition: CreatureAI.h:112
bool IsTrigger() const
Definition: Creature.h:115
void setDeathState(DeathState s) override
Definition: Creature.cpp:2175
void Update(uint32 time) override
Definition: Creature.cpp:736
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition: Creature.h:305
void SetReactState(ReactStates st)
Definition: Creature.h:162
void RemoveFromWorld() override
Definition: Creature.cpp:357
CreatureAI * AI() const
Definition: Creature.h:216
std::string GetDebugInfo() const override
Definition: Creature.cpp:3703
static bool IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId, bool requireAllTotems=true)
Definition: DB2Stores.cpp:3063
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:380
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:839
float m_statFromOwner[MAX_STATS]
std::string GetDebugInfo() const override
Creature * GetCreature(ObjectGuid const &guid)
Definition: Map.cpp:3518
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:321
std::string ToString() const
Definition: ObjectGuid.cpp:777
uint32 GetEntry() const
Definition: ObjectGuid.h:293
void Clear()
Definition: ObjectGuid.h:288
static CreatureModel const * ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
Definition: ObjectMgr.cpp:1609
static Creature * ToCreature(Object *o)
Definition: Object.h:220
bool IsPlayer() const
Definition: Object.h:213
static Unit * ToUnit(Object *o)
Definition: Object.h:226
static GameObject * ToGameObject(Object *o)
Definition: Object.h:232
ObjectGuid const & GetGUID() const
Definition: Object.h:161
bool IsInWorld() const
Definition: Object.h:155
TypeID GetTypeId() const
Definition: Object.h:174
uint32 GetEntry() const
Definition: Object.h:162
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:160
static Player * ToPlayer(Object *o)
Definition: Object.h:214
Unit * ToUnit()
Definition: Object.h:228
void Remove(PetSaveMode mode, bool returnreagent=false)
Definition: Pet.cpp:711
void CharmSpellInitialize()
Definition: Player.cpp:22140
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:388
std::array< uint16, MAX_SPELL_TOTEMS > TotemCategory
Definition: SpellInfo.h:389
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:628
void SetMinion(Minion *minion, bool apply)
Definition: Unit.cpp:6126
Pet * ToPet()
Definition: Unit.h:1775
ObjectGuid GetDemonCreatorGUID() const
Definition: Unit.h:1190
void SetMinionGUID(ObjectGuid guid)
Definition: Unit.h:1183
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
Definition: Unit.h:1839
std::array< ObjectGuid, MAX_SUMMON_SLOT > m_SummonSlot
Definition: Unit.h:1475
std::unique_ptr< CharmInfo > m_charmInfo
Definition: Unit.h:1928
void SetFaction(uint32 faction) override
Definition: Unit.h:865
bool IsPet() const
Definition: Unit.h:744
ObjectGuid GetCharmedGUID() const
Definition: Unit.h:1198
bool IsAlive() const
Definition: Unit.h:1172
DeathState m_deathState
Definition: Unit.h:1882
uint32 m_unitTypeMask
Definition: Unit.h:1939
void RemoveNpcFlag(NPCFlags flags)
Definition: Unit.h:989
TempSummon * ToTempSummon()
Definition: Unit.h:1781
ControlList m_Controlled
Definition: Unit.h:1219
bool m_ControlledByPlayer
Definition: Unit.h:1873
bool IsAIEnabled() const
Definition: Unit.h:659
ObjectGuid GetMinionGUID() const
Definition: Unit.h:1182
bool IsSummon() const
Definition: Unit.h:742
uint32 GetFaction() const override
Definition: Unit.h:864
void SetLevel(uint8 lvl, bool sendUpdate=true)
Definition: Unit.cpp:9632
CharmInfo * InitCharmInfo()
Definition: Unit.cpp:10051
uint32 HasUnitTypeMask(uint32 mask) const
Definition: Unit.h:740
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
Definition: Unit.cpp:11445
void SetPetGUID(ObjectGuid guid)
Definition: Unit.h:1185
void SetCreatorGUID(ObjectGuid creator)
Definition: Unit.h:1181
uint8 GetLevel() const
Definition: Unit.h:750
bool IsInCombat() const
Definition: Unit.h:1049
Map * GetMap() const
Definition: Object.h:625
SmoothPhasing * GetSmoothPhasing()
Definition: Object.h:794
void AddObjectToRemoveList()
Definition: Object.cpp:1838
EventProcessor m_Events
Definition: Object.h:780
float GetVisibilityRange() const
Definition: Object.cpp:1461
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:441
Optional< ObjectGuid > ReplaceObject
Definition: SmoothPhasing.h:29
EnumFlag< SummonPropertiesFlags > GetFlags() const