34#include <boost/container/small_vector.hpp>
39m_timer(0ms), m_lifetime(0ms), m_canFollowOwner(true)
205 if (summoner && summoner->
IsPlayer())
213 if (summonedData->CreatureIDVisibleToSummoner)
232 if (!unitSummoner->m_SummonSlot[slot].IsEmpty() && unitSummoner->m_SummonSlot[slot] !=
GetGUID())
235 if (oldSummon && oldSummon->
IsSummon())
238 unitSummoner->m_SummonSlot[slot] =
GetGUID();
245 uint8 level = std::clamp<int32>(unitSummoner->GetLevel(), minLevel, maxLevel);
282 boost::container::small_vector<WorldObject*, 2> objectsToUpdate;
283 objectsToUpdate.push_back(
this);
290 objectsToUpdate.push_back(original);
299 boost::container::small_vector<WorldObject*, 2> objectsToUpdate;
300 objectsToUpdate.push_back(
this);
311 objectsToUpdate.push_back(original);
352 if (owner->GetTypeId() ==
TYPEID_UNIT && owner->ToCreature()->IsAIEnabled())
353 owner->ToCreature()->AI()->SummonedCreatureDespawn(
this);
355 owner->ToGameObject()->AI()->SummonedCreatureDespawn(
this);
374 for (
ObjectGuid& summonSlot : owner->m_SummonSlot)
390 auto totemSlot = std::find_if(totemBegin, totemEnd, [&](
ObjectGuid const& otherTotemGuid)
392 return otherTotemGuid ==
GetGUID();
396 if (totemSlot == totemEnd)
400 if (totemSlot == totemEnd)
401 totemSlot = std::find_if(totemBegin, totemEnd, [](
ObjectGuid const& otherTotemGuid) {
return otherTotemGuid.
IsEmpty(); });
405 if (totemSlot == totemEnd)
406 totemSlot = std::find_if(totemBegin, totemEnd, [&](
ObjectGuid const& otherTotemGuid) {
return GetEntry() == otherTotemGuid.
GetEntry(); });
409 if (totemSlot == totemEnd)
426 if (!otherSummonSpell)
437 for (
int32 otherTotemId : otherSummonSpell->
Totem)
438 if (otherTotemId && myTotemId == otherTotemId)
446 std::stringstream sstr;
450 <<
"Timer: " <<
GetTimer().count() <<
"ms";
455 :
TempSummon(properties, owner, isWorldObject), m_owner(owner)
514 std::stringstream sstr;
522, m_bonusSpellDamage(0)
559 std::stringstream sstr;
565 :
Minion(properties, owner, false)
@ SummonFromBattlePetJournal
std::chrono::milliseconds Milliseconds
Milliseconds shorthand typedef.
#define ASSERT_NOTNULL(pointer)
#define TC_LOG_ERROR(filterType__, message__,...)
@ 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
@ UNIT_NPC_FLAG_WILD_BATTLE_PET
@ UNIT_MASK_CONTROLABLE_GUARDIAN
virtual void JustSummoned(Creature *)
virtual void IsSummonedBy(WorldObject *)
void setDeathState(DeathState s) override
void Update(uint32 time) override
uint32 m_spells[MAX_CREATURE_SPELLS]
void SetReactState(ReactStates st)
void RemoveFromWorld() override
std::string GetDebugInfo() const override
static bool IsTotemCategoryCompatibleWith(uint32 itemTotemCategoryId, uint32 requiredTotemCategoryId, bool requireAllTotems=true)
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 *)
GameObjectAI * AI() const
void InitSummon(WorldObject *summoner) override
Guardian(SummonPropertiesEntry const *properties, Unit *owner, bool isWorldObject)
void InitStats(WorldObject *summoner, Milliseconds duration) override
bool InitStatsForLevel(uint8 level)
float m_statFromOwner[MAX_STATS]
std::string GetDebugInfo() const override
Creature * GetCreature(ObjectGuid const &guid)
std::string GetDebugInfo() const override
void setDeathState(DeathState s) override
void RemoveFromWorld() override
void InitStats(WorldObject *summoner, Milliseconds duration) override
bool IsGuardianPet() const
Minion(SummonPropertiesEntry const *properties, Unit *owner, bool isWorldObject)
std::string ToString() const
static CreatureModel const * ChooseDisplayId(CreatureTemplate const *cinfo, CreatureData const *data=nullptr)
static Creature * ToCreature(Object *o)
static Unit * ToUnit(Object *o)
static GameObject * ToGameObject(Object *o)
ObjectGuid const & GetGUID() const
static ObjectGuid GetGUID(Object const *o)
static Player * ToPlayer(Object *o)
void Remove(PetSaveMode mode, bool returnreagent=false)
void CharmSpellInitialize()
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
std::array< uint16, MAX_SPELL_TOTEMS > TotemCategory
WorldObject * GetSummoner() const
void UpdateObjectVisibilityOnDestroy() override
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
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
void SetMinion(Minion *minion, bool apply)
ObjectGuid GetDemonCreatorGUID() const
void SetMinionGUID(ObjectGuid guid)
UF::UpdateField< UF::UnitData, 0, TYPEID_UNIT > m_unitData
std::array< ObjectGuid, MAX_SUMMON_SLOT > m_SummonSlot
std::unique_ptr< CharmInfo > m_charmInfo
void SetFaction(uint32 faction) override
ObjectGuid GetCharmedGUID() const
void RemoveNpcFlag(NPCFlags flags)
TempSummon * ToTempSummon()
bool m_ControlledByPlayer
ObjectGuid GetMinionGUID() const
uint32 GetFaction() const override
void SetLevel(uint8 lvl, bool sendUpdate=true)
CharmInfo * InitCharmInfo()
uint32 HasUnitTypeMask(uint32 mask) const
bool SetCharmedBy(Unit *charmer, CharmType type, AuraApplication const *aurApp=nullptr)
void SetPetGUID(ObjectGuid guid)
void SetCreatorGUID(ObjectGuid creator)
SmoothPhasing * GetSmoothPhasing()
void AddObjectToRemoveList()
float GetVisibilityRange() const
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)
Optional< ObjectGuid > ReplaceObject
EnumFlag< SummonPropertiesFlags > GetFlags() const