mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-16 07:30:42 +01:00
Core/Misc: don't allow FindNearestCreature() and FindNearestGameObject() searches to return the entity that called them. (#23437)
Closes #23334.
(cherry picked from commit 015870bfe1)
This commit is contained in:
@@ -797,7 +797,7 @@ namespace Trinity
|
||||
|
||||
bool operator()(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;
|
||||
@@ -1347,6 +1347,7 @@ namespace Trinity
|
||||
if (u->getDeathState() != DEAD
|
||||
&& u->GetEntry() == i_entry
|
||||
&& u->IsAlive() == i_alive
|
||||
&& u->GetGUID() != i_obj.GetGUID()
|
||||
&& i_obj.IsWithinDistInMap(u, i_range)
|
||||
&& u->CheckPrivateObjectOwnerVisibility(&i_obj))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user