From ed073a88ccbb1d482b46ac82aa8717269b12c8f8 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Tue, 26 Nov 2024 19:35:07 -0800 Subject: [PATCH] Adjusts harmful checks to match beneficial checks --- Projects/UOContent/Misc/Notoriety.cs | 48 ++++++++++++---------------- 1 file changed, 20 insertions(+), 28 deletions(-) diff --git a/Projects/UOContent/Misc/Notoriety.cs b/Projects/UOContent/Misc/Notoriety.cs index 3066f6335..72d2aa156 100644 --- a/Projects/UOContent/Misc/Notoriety.cs +++ b/Projects/UOContent/Misc/Notoriety.cs @@ -159,20 +159,16 @@ public static bool Mobile_AllowHarmful(Mobile from, Mobile target) return true; } - var bcFrom = from as BaseCreature; - var pmFrom = from as PlayerMobile; - var pmTarg = target as PlayerMobile; - var bcTarg = target as BaseCreature; - - 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) { @@ -208,11 +204,6 @@ public static bool Mobile_AllowHarmful(Mobile from, Mobile target) return false; } - if (from.Region.IsPartOf() || target.Region.IsPartOf()) - { - return false; - } - var map = from.Map; if ((map?.Rules & MapRules.HarmfulRestrictions) == 0) @@ -258,23 +249,24 @@ public static bool Mobile_AllowHarmful(Mobile from, Mobile target) public static Guild GetGuildFor(Guild def, Mobile m) { - var g = def; + if (m is not BaseCreature c || !c.Controlled || c.ControlMaster == null) + { + return def; + } + + c.DisplayGuildTitle = false; - if (m is BaseCreature c && c.Controlled && c.ControlMaster != null) + if (c.Map != Map.Internal && (Core.AOS || Guild.NewGuildSystem || c.ControlOrder is OrderType.Attack or OrderType.Guard)) { - c.DisplayGuildTitle = false; + return (Guild)(c.Guild = c.ControlMaster.Guild); + } - if (c.Map != Map.Internal && (Core.AOS || Guild.NewGuildSystem || c.ControlOrder is OrderType.Attack or OrderType.Guard)) - { - g = (Guild)(c.Guild = c.ControlMaster.Guild); - } - else if (c.Map == Map.Internal || c.ControlMaster.Guild == null) - { - g = (Guild)(c.Guild = null); - } + if (c.Map == Map.Internal || c.ControlMaster.Guild == null) + { + return (Guild)(c.Guild = null); } - return g; + return def; } public static int CorpseNotoriety(Mobile source, Corpse target)