[Core / Fix] Fixed an issue if charmed creatures was created by spell they wouldn't disappear if owner was too far away from it.

Lets take quest Taming the beast for example, Once beast was tamed and player was too far away from the creature it would still appear as a pet and cause issues.
This commit is contained in:
talamortis
2018-11-30 00:27:32 +00:00
parent 50aace0e52
commit a9b981d619
@@ -577,6 +577,12 @@ void Creature::Update(uint32 diff)
SelectVictim(); SelectVictim();
} }
Unit* owner = GetCharmerOrOwner();
if (IsCharmed() && !IsWithinDistInMap(owner, GetMap()->GetVisibilityRange()))
{
RemoveCharmAuras();
}
if (!IsInEvadeMode() && IsAIEnabled) if (!IsInEvadeMode() && IsAIEnabled)
{ {
// do not allow the AI to be changed during update // do not allow the AI to be changed during update