[BugFix] Remove detection of client pets from Sense[Summoned|Undead|Animal] spells (#1601)

* Remove detection of client pets from Sense[Summoned|Undead|Animal]

* Use IsPetOwnerClient() function instead of individual checks

* Add option to exclude client pets from GetClosestMobByBodyType

* Add parameter

Co-authored-by: Noudess <noudess@gmail.com>
This commit is contained in:
Paul Coene
2021-10-14 10:52:29 -04:00
committed by GitHub
parent 6a962f2591
commit cef873f793
3 changed files with 7 additions and 3 deletions
+5 -1
View File
@@ -5146,7 +5146,7 @@ void EntityList::ExpeditionWarning(uint32 minutes_left)
safe_delete(outapp);
}
Mob *EntityList::GetClosestMobByBodyType(Mob *sender, bodyType BodyType)
Mob *EntityList::GetClosestMobByBodyType(Mob *sender, bodyType BodyType, bool skip_client_pets)
{
if (!sender)
@@ -5163,6 +5163,10 @@ Mob *EntityList::GetClosestMobByBodyType(Mob *sender, bodyType BodyType)
if (CurrentMob->GetBodyType() != BodyType)
continue;
// Do not detect client pets
if (skip_client_pets && CurrentMob->IsPet() && CurrentMob->IsPetOwnerClient())
continue;
CurrentDistance = ((CurrentMob->GetY() - sender->GetY()) * (CurrentMob->GetY() - sender->GetY())) +
((CurrentMob->GetX() - sender->GetX()) * (CurrentMob->GetX() - sender->GetX()));