mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-13 09:17:18 +00:00
feat(Core/Unit): Implement GetCompanionPet() helper (#20819)
This commit is contained in:
@@ -9028,7 +9028,7 @@ bool Unit::HandleProcTriggerSpell(Unit* victim, uint32 damage, AuraEffect* trigg
|
||||
if (!victim)
|
||||
return false;
|
||||
|
||||
if (Creature* cr = ObjectAccessor::GetCreature(*this, m_SummonSlot[SUMMON_SLOT_MINIPET]))
|
||||
if (Creature* cr = GetCompanionPet())
|
||||
cr->CastSpell(victim, 50101, true);
|
||||
|
||||
return false;
|
||||
@@ -10663,6 +10663,11 @@ Guardian* Unit::GetGuardianPet() const
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Creature* Unit::GetCompanionPet() const
|
||||
{
|
||||
return ObjectAccessor::GetCreature(*this, m_SummonSlot[SUMMON_SLOT_MINIPET]);
|
||||
}
|
||||
|
||||
Unit* Unit::GetCharm() const
|
||||
{
|
||||
if (ObjectGuid charm_guid = GetCharmGUID())
|
||||
|
||||
@@ -1758,6 +1758,7 @@ public:
|
||||
// Pets, guardians, minions...
|
||||
[[nodiscard]] Guardian* GetGuardianPet() const;
|
||||
[[nodiscard]] Minion* GetFirstMinion() const;
|
||||
[[nodiscard]] Creature* GetCompanionPet() const;
|
||||
|
||||
Pet* CreateTamedPetFrom(Creature* creatureTarget, uint32 spell_id = 0);
|
||||
Pet* CreateTamedPetFrom(uint32 creatureEntry, uint32 spell_id = 0);
|
||||
|
||||
Reference in New Issue
Block a user