feat(Core/Eluna): Added new OnPetAddedToWorld() hook for Eluna. (#8084)

This commit is contained in:
UltraNix
2021-10-08 16:57:14 +02:00
committed by GitHub
parent 05dba4797c
commit 86084560e0
2 changed files with 12 additions and 0 deletions
@@ -239,6 +239,9 @@ void Creature::AddToWorld()
GetVehicleKit()->Install(); GetVehicleKit()->Install();
#ifdef ELUNA #ifdef ELUNA
sEluna->OnAddToWorld(this); sEluna->OnAddToWorld(this);
if (IsGuardian() && ToTempSummon() && ToTempSummon()->GetSummonerGUID().IsPlayer())
sEluna->OnPetAddedToWorld(ToTempSummon()->GetSummonerUnit()->ToPlayer(), this);
#endif #endif
} }
} }
+9
View File
@@ -35,6 +35,10 @@
#include "WorldPacket.h" #include "WorldPacket.h"
#include "WorldSession.h" #include "WorldSession.h"
#ifdef ELUNA
#include "LuaEngine.h"
#endif
Pet::Pet(Player* owner, PetType type) : Guardian(nullptr, owner ? owner->GetGUID() : ObjectGuid::Empty, true), Pet::Pet(Player* owner, PetType type) : Guardian(nullptr, owner ? owner->GetGUID() : ObjectGuid::Empty, true),
m_usedTalentCount(0), m_removed(false), m_owner(owner), m_usedTalentCount(0), m_removed(false), m_owner(owner),
m_happinessTimer(PET_LOSE_HAPPINES_INTERVAL), m_petType(type), m_duration(0), m_happinessTimer(PET_LOSE_HAPPINES_INTERVAL), m_petType(type), m_duration(0),
@@ -93,6 +97,11 @@ void Pet::AddToWorld()
GetCharmInfo()->SetIsFollowing(false); GetCharmInfo()->SetIsFollowing(false);
GetCharmInfo()->SetIsReturning(false); GetCharmInfo()->SetIsReturning(false);
} }
#ifdef ELUNA
if (GetOwnerGUID().IsPlayer())
sEluna->OnPetAddedToWorld(GetOwner(), this);
#endif
} }
void Pet::RemoveFromWorld() void Pet::RemoveFromWorld()