From 61c49b8faa931c6f3e6d5164d7ee54afb10d0d85 Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Fri, 11 Jun 2021 23:44:05 -0700 Subject: [PATCH] fix(core): Fixes OPL with stale header (#651) - [X] FIxes stale header/header args Closes #650 Closes #607 --- Projects/Server/Mobiles/Mobile.cs | 11 +++++------ Projects/Server/ObjectPropertyList.cs | 2 ++ Projects/UOContent/Skills/AnimalTaming.cs | 8 +++----- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/Projects/Server/Mobiles/Mobile.cs b/Projects/Server/Mobiles/Mobile.cs index 41ef6791c..dc49c0435 100644 --- a/Projects/Server/Mobiles/Mobile.cs +++ b/Projects/Server/Mobiles/Mobile.cs @@ -2986,8 +2986,8 @@ namespace Server } const int cacheLength = OutgoingMobilePackets.MobileMovingPacketCacheByteLength; - var width = OutgoingMobilePackets.MobileMovingPacketLength; - var height = OutgoingMobilePackets.MobileMovingPacketCacheHeight; + const int width = OutgoingMobilePackets.MobileMovingPacketLength; + const int height = OutgoingMobilePackets.MobileMovingPacketCacheHeight; var mobileMovingCache = stackalloc byte[cacheLength].AsSpan2D(height, width).InitializePackets(); @@ -3463,7 +3463,7 @@ namespace Server public virtual void AddNameProperties(ObjectPropertyList list) { - var name = Name ?? string.Empty; + var name = Name ?? ""; string prefix; @@ -8059,8 +8059,7 @@ namespace Server /// public virtual void OnSingleClick(Mobile from) { - if (Deleted || - AccessLevel == AccessLevel.Player && DisableHiddenSelfClick && Hidden && from == this) + if (Deleted || AccessLevel == AccessLevel.Player && DisableHiddenSelfClick && Hidden && from == this) { return; } @@ -8109,7 +8108,7 @@ namespace Server hue = Notoriety.GetHue(Notoriety.Compute(from, this)); } - var name = Name ?? string.Empty; + var name = Name ?? ""; var prefix = ""; diff --git a/Projects/Server/ObjectPropertyList.cs b/Projects/Server/ObjectPropertyList.cs index 5092e0173..369cfd2ef 100644 --- a/Projects/Server/ObjectPropertyList.cs +++ b/Projects/Server/ObjectPropertyList.cs @@ -58,6 +58,8 @@ namespace Server _position = 15; _hash = 0; _strings = 0; + Header = 0; + HeaderArgs = null; } public void Flush() diff --git a/Projects/UOContent/Skills/AnimalTaming.cs b/Projects/UOContent/Skills/AnimalTaming.cs index 5f3be9ef7..343a66508 100644 --- a/Projects/UOContent/Skills/AnimalTaming.cs +++ b/Projects/UOContent/Skills/AnimalTaming.cs @@ -38,9 +38,7 @@ namespace Server.SkillHandlers public static bool CheckMastery(Mobile tamer, BaseCreature creature) => SummonFamiliarSpell.Table.TryGetValue(tamer, out var bc) && bc is DarkWolfFamiliar familiar && - !familiar.Deleted && (creature is DireWolf || creature is GreyWolf || creature is TimberWolf || - creature is WhiteWolf || - creature is BakeKitsune); + !familiar.Deleted && creature is DireWolf or GreyWolf or TimberWolf or WhiteWolf or BakeKitsune; public static bool MustBeSubdued(BaseCreature bc) => bc.Owners.Count <= 0 && bc.SubdueBeforeTame && bc.Hits > bc.HitsMax / 10; @@ -115,13 +113,13 @@ namespace Server.SkillHandlers { from.RevealingAction(); - if (!(targeted is Mobile mobile)) + if (targeted is not Mobile mobile) { from.SendLocalizedMessage(502801); // You can't tame that! return; } - if (!(mobile is BaseCreature creature)) + if (mobile is not BaseCreature creature) { mobile.PrivateOverheadMessage( MessageType.Regular,