feat(Core/SAI): Add pet variable to SMART_TARGET_INVOKER_PARTY (#20804)

* feat(Core/SAI): Add pet variable to SMART_TARGET_INVOKER_PARTY

* closes https://github.com/azerothcore/azerothcore-wotlk/issues/15755

* mb
This commit is contained in:
Kitzunu
2024-12-01 17:57:39 +01:00
committed by GitHub
parent 9ff887d001
commit 490c90bdd7
3 changed files with 14 additions and 2 deletions

View File

@@ -3511,8 +3511,15 @@ void SmartScript::GetTargets(ObjectVector& targets, SmartScriptHolder const& e,
{
for (GroupReference* groupRef = group->GetFirstMember(); groupRef != nullptr; groupRef = groupRef->next())
if (Player* member = groupRef->GetSource())
{
if (member->IsInMap(player))
targets.push_back(member);
if (e.target.invokerParty.includePets)
if (Creature* pet = ObjectAccessor::GetCreatureOrPetOrVehicle(*member, member->GetPetGUID()))
if (pet->IsPet() && pet->IsInMap(player))
targets.push_back(pet);
}
}
// We still add the player to the list if there is no group. If we do
// this even if there is a group (thus the else-check), it will add the