From 79e33b6a4a89555a409b9dee69c5a9f24677f0db Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 22 Dec 2021 20:16:49 -0500 Subject: [PATCH] Core/Misc: don't allow FindNearestCreature() and FindNearestGameObject() searches to return the entity that called them. Port From (https://github.com/TrinityCore/TrinityCore/commit/2bcfc6680c899ac4e94d71c7b864379ce69f9654) --- Source/Game/Maps/GridNotifiers.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Source/Game/Maps/GridNotifiers.cs b/Source/Game/Maps/GridNotifiers.cs index 7d6fbf9fe..376bb1987 100644 --- a/Source/Game/Maps/GridNotifiers.cs +++ b/Source/Game/Maps/GridNotifiers.cs @@ -2351,7 +2351,7 @@ namespace Game.Maps public bool Invoke(Creature u) { - if (u.GetDeathState() != DeathState.Dead && u.GetEntry() == i_entry && u.IsAlive() == i_alive && i_obj.IsWithinDistInMap(u, i_range) && u.CheckPrivateObjectOwnerVisibility(i_obj)) + if (u.GetDeathState() != DeathState.Dead && u.GetEntry() == i_entry && u.IsAlive() == i_alive && u.GetGUID() != i_obj.GetGUID() && i_obj.IsWithinDistInMap(u, i_range) && u.CheckPrivateObjectOwnerVisibility(i_obj)) { i_range = i_obj.GetDistance(u); // use found unit range as new range limit for next check return true; @@ -2740,7 +2740,7 @@ namespace Game.Maps public bool Invoke(GameObject go) { - if (go.GetEntry() == i_entry && i_obj.IsWithinDistInMap(go, i_range)) + if (go.GetEntry() == i_entry && go.GetGUID() != i_obj.GetGUID() && i_obj.IsWithinDistInMap(go, i_range)) { i_range = i_obj.GetDistance(go); // use found GO range as new range limit for next check return true;