From 7ddf2b1a8f99821ab940f9e7d02a020c3683af6d Mon Sep 17 00:00:00 2001 From: Kamron Batman <3953314+kamronbatman@users.noreply.github.com> Date: Fri, 4 Jun 2021 23:34:22 -0700 Subject: [PATCH] fix(core): Fixes regions (#642) --- Projects/Server/Regions/Region.cs | 15 ++++----------- Projects/UOContent/Regions/BaseRegion.cs | 1 - Projects/UOContent/Regions/GuardedRegion.cs | 1 - 3 files changed, 4 insertions(+), 13 deletions(-) diff --git a/Projects/Server/Regions/Region.cs b/Projects/Server/Regions/Region.cs index 7846c98e0..41e477482 100644 --- a/Projects/Server/Regions/Region.cs +++ b/Projects/Server/Regions/Region.cs @@ -133,6 +133,8 @@ namespace Server { Map = json.GetProperty("map", options, out Map map) ? map : null; Parent = json.GetProperty("parent", options, out string parent) ? Find(parent, Map) : null; + Name = json.GetProperty("name", options, out string name) ? name : null; + Dynamic = false; if (Parent == null) @@ -146,9 +148,7 @@ namespace Server Priority = Parent.Priority; } - Name = json.GetProperty("name", options, out string name) ? name : null; - - Priority = json.GetProperty("priority", options, out int priority) ? priority : 0; + Priority = json.GetProperty("priority", options, out int priority) ? priority : Priority; Area = json.GetProperty("rects", options, out List rects) ? rects.ToArray() @@ -230,15 +230,8 @@ namespace Server return 1; } - var thisPriority = Priority; var regPriority = reg.Priority; - - if (thisPriority != regPriority) - { - return regPriority - thisPriority; - } - - return reg.ChildLevel - ChildLevel; + return Priority != regPriority ? reg.Priority - Priority : reg.ChildLevel - ChildLevel; } // This is not optimized. Use sparingly diff --git a/Projects/UOContent/Regions/BaseRegion.cs b/Projects/UOContent/Regions/BaseRegion.cs index 82bf3ce2a..41e73a5cc 100644 --- a/Projects/UOContent/Regions/BaseRegion.cs +++ b/Projects/UOContent/Regions/BaseRegion.cs @@ -1,7 +1,6 @@ using System; using System.Collections.Generic; using System.Text.Json; -using Server.Buffers; using Server.Gumps; using Server.Json; using Server.Mobiles; diff --git a/Projects/UOContent/Regions/GuardedRegion.cs b/Projects/UOContent/Regions/GuardedRegion.cs index c779daf55..600acebb3 100644 --- a/Projects/UOContent/Regions/GuardedRegion.cs +++ b/Projects/UOContent/Regions/GuardedRegion.cs @@ -5,7 +5,6 @@ using System.Text.Json; using Server.Json; using Server.Logging; using Server.Mobiles; -using Server.Network; using Server.Utilities; namespace Server.Regions