From 35af5962c2f98683aff00dbca0930bf170097b89 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:26:41 -0800 Subject: [PATCH] Fixes notoriety --- Projects/UOContent/Misc/Notoriety.cs | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/Projects/UOContent/Misc/Notoriety.cs b/Projects/UOContent/Misc/Notoriety.cs index 126b419d6..79d4a0750 100644 --- a/Projects/UOContent/Misc/Notoriety.cs +++ b/Projects/UOContent/Misc/Notoriety.cs @@ -63,20 +63,16 @@ public static bool Mobile_AllowBeneficial(Mobile from, Mobile target) return true; } - var bcFrom = from as BaseCreature; - var bcTarg = target as BaseCreature; - var pmFrom = from as PlayerMobile; - var pmTarg = target as PlayerMobile; - - if (pmFrom == null && bcFrom?.Summoned == true) + if (from.Region.IsPartOf() || target.Region.IsPartOf()) { - pmFrom = bcFrom.SummonMaster as PlayerMobile; + return false; } - if (pmTarg == null && bcTarg?.Summoned == true) - { - pmTarg = bcTarg.SummonMaster as PlayerMobile; - } + var bcFrom = from as BaseCreature; + var bcTarg = target as BaseCreature; + + var pmFrom = (bcFrom?.GetMaster() ?? from) as PlayerMobile; + var pmTarg = (bcTarg?.GetMaster() ?? target) as PlayerMobile; if (pmFrom != null && pmTarg != null) { @@ -117,11 +113,6 @@ public static bool Mobile_AllowBeneficial(Mobile from, Mobile target) return false; } - if (from.Region.IsPartOf() || target.Region.IsPartOf()) - { - return false; - } - var map = from.Map; var targetFaction = Faction.Find(target, true); @@ -136,7 +127,7 @@ public static bool Mobile_AllowBeneficial(Mobile from, Mobile target) return true; // In felucca, anything goes } - if (!from.Player) + if (pmFrom == null && !from.Player) { return true; // NPCs have no restrictions } @@ -146,7 +137,7 @@ public static bool Mobile_AllowBeneficial(Mobile from, Mobile target) return false; // Players cannot heal uncontrolled mobiles } - if (pmFrom?.Young == true && pmTarg?.Young != true) + if (pmFrom?.Young == true && pmTarg?.Young == false) { return false; // Young players cannot perform beneficial actions towards older players }