fix: Cleans up core code (#1187)

**Only one functional change**
* Fixes a bug in LogFactory where `Warning` is being logged as `Information`

Non-functional changes:
* Updates/Fixes copyright headers
* Removes namespace scopes for core files.

View with [whitespace off](https://github.com/modernuo/ModernUO/pull/1187/files?w=1).
This commit is contained in:
Kamron Batman 2022-10-10 21:47:08 -07:00 • committed by GitHub
parent 0138d40bda
commit f268d5d4e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
262 changed files with 28527 additions and 28646 deletions

View file

@ -1,6 +1,6 @@
/*************************************************************************
* ModernUO *
* Copyright 2019-2020 - ModernUO Development Team *
* Copyright 2019-2022 - ModernUO Development Team *
* Email: hi@modernuo.com *
* File: Movement.cs *
* *
@ -13,95 +13,94 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>. *
*************************************************************************/
namespace Server.Movement
namespace Server.Movement;
public static class Movement
{
public static class Movement
// Movement implementation algorithm
public static IMovementImpl Impl { get; set; }
public static int WalkFootDelay { get; set; } = 400;
public static int RunFootDelay { get; set; } = 200;
public static int WalkMountDelay { get; set; } = 200;
public static int RunMountDelay { get; set; } = 100;
public static bool EnableFastwalkPrevention { get; set; } = true;
public static AccessLevel FastwalkExemptionLevel { get; set; } = AccessLevel.Counselor;
// If this is changed during runtime, then the steps array needs resizing.
public static int MaxSteps { get; private set; } = 3;
public static void Configure()
{
// Movement implementation algorithm
public static IMovementImpl Impl { get; set; }
public static int WalkFootDelay { get; set; } = 400;
public static int RunFootDelay { get; set; } = 200;
public static int WalkMountDelay { get; set; } = 200;
public static int RunMountDelay { get; set; } = 100;
public static bool EnableFastwalkPrevention { get; set; } = true;
public static AccessLevel FastwalkExemptionLevel { get; set; } = AccessLevel.Counselor;
// If this is changed during runtime, then the steps array needs resizing.
public static int MaxSteps { get; private set; } = 3;
public static void Configure()
{
EnableFastwalkPrevention = ServerConfiguration.GetOrUpdateSetting("movement.enableFastWalkPrevention", EnableFastwalkPrevention);
MaxSteps = ServerConfiguration.GetOrUpdateSetting("movement.maxSteps", MaxSteps);
FastwalkExemptionLevel = ServerConfiguration.GetOrUpdateSetting("movement.fastwalkExemptionLevel", FastwalkExemptionLevel);
WalkFootDelay = ServerConfiguration.GetOrUpdateSetting("movement.delay.walkFoot", WalkFootDelay);
RunFootDelay = ServerConfiguration.GetOrUpdateSetting("movement.delay.runFoot", RunFootDelay);
WalkMountDelay = ServerConfiguration.GetOrUpdateSetting("movement.delay.walkMount", WalkMountDelay);
RunMountDelay = ServerConfiguration.GetOrUpdateSetting("movement.delay.runMount", RunMountDelay);
}
public static bool CheckMovement(Mobile m, Direction d, out int newZ)
{
if (Impl != null)
{
return Impl.CheckMovement(m, d, out newZ);
}
newZ = m.Z;
return false;
}
public static bool CheckMovement(Mobile m, Map map, Point3D loc, Direction d, out int newZ)
{
if (Impl != null)
{
return Impl.CheckMovement(m, map, loc, d, out newZ);
}
newZ = m.Z;
return false;
}
public static void Offset(Direction d, ref int x, ref int y)
{
switch (d & Direction.Mask)
{
case Direction.North:
--y;
break;
case Direction.South:
++y;
break;
case Direction.West:
--x;
break;
case Direction.East:
++x;
break;
case Direction.Right:
++x;
--y;
break;
case Direction.Left:
--x;
++y;
break;
case Direction.Down:
++x;
++y;
break;
case Direction.Up:
--x;
--y;
break;
}
}
EnableFastwalkPrevention = ServerConfiguration.GetOrUpdateSetting("movement.enableFastWalkPrevention", EnableFastwalkPrevention);
MaxSteps = ServerConfiguration.GetOrUpdateSetting("movement.maxSteps", MaxSteps);
FastwalkExemptionLevel = ServerConfiguration.GetOrUpdateSetting("movement.fastwalkExemptionLevel", FastwalkExemptionLevel);
WalkFootDelay = ServerConfiguration.GetOrUpdateSetting("movement.delay.walkFoot", WalkFootDelay);
RunFootDelay = ServerConfiguration.GetOrUpdateSetting("movement.delay.runFoot", RunFootDelay);
WalkMountDelay = ServerConfiguration.GetOrUpdateSetting("movement.delay.walkMount", WalkMountDelay);
RunMountDelay = ServerConfiguration.GetOrUpdateSetting("movement.delay.runMount", RunMountDelay);
}
public interface IMovementImpl
public static bool CheckMovement(Mobile m, Direction d, out int newZ)
{
bool CheckMovement(Mobile m, Direction d, out int newZ);
bool CheckMovement(Mobile m, Map map, Point3D loc, Direction d, out int newZ);
if (Impl != null)
{
return Impl.CheckMovement(m, d, out newZ);
}
newZ = m.Z;
return false;
}
public static bool CheckMovement(Mobile m, Map map, Point3D loc, Direction d, out int newZ)
{
if (Impl != null)
{
return Impl.CheckMovement(m, map, loc, d, out newZ);
}
newZ = m.Z;
return false;
}
public static void Offset(Direction d, ref int x, ref int y)
{
switch (d & Direction.Mask)
{
case Direction.North:
--y;
break;
case Direction.South:
++y;
break;
case Direction.West:
--x;
break;
case Direction.East:
++x;
break;
case Direction.Right:
++x;
--y;
break;
case Direction.Left:
--x;
++y;
break;
case Direction.Down:
++x;
++y;
break;
case Direction.Up:
--x;
--y;
break;
}
}
}
public interface IMovementImpl
{
bool CheckMovement(Mobile m, Direction d, out int newZ);
bool CheckMovement(Mobile m, Map map, Point3D loc, Direction d, out int newZ);
}