Core/Objects: Units possessing another ones must use the detection of the latter

Port From (https://github.com/TrinityCore/TrinityCore/commit/74645553be9213e366a62c6967db1d9933f3d7a7)
This commit is contained in:
hondacrx
2022-05-29 16:22:01 -04:00
parent 988dc2b99c
commit d0c767cfdf
+13 -3
View File
@@ -1243,13 +1243,23 @@ namespace Game.Entities
{
WorldObject seer = this;
// If a unit is possessing another one, it uses the detection of the latter
// Pets don't have detection, they use the detection of their masters
Unit thisUnit = ToUnit();
if (thisUnit != null)
{
Unit controller = thisUnit.GetCharmerOrOwner();
if (controller != null)
seer = controller;
if (thisUnit.IsPossessing())
{
Unit charmed = thisUnit.GetCharmed();
if (charmed != null)
seer = charmed;
}
else
{
Unit controller = thisUnit.GetCharmerOrOwner();
if (controller != null)
seer = controller;
}
}
if (obj.IsAlwaysDetectableFor(seer))