ModernUO/Projects/UOContent/Misc/Fastwalk.cs
Kamron Batman 369a27b800
Replacing Networking (#271)
- [X] Removing Kestrel & Libuv
- [X] Cleaning up NetState
- [X] Removing System.IO.Pipelines
- [X] Cleaning up packet reading
- [X] Adds a maximum of 5000 sockets (configurable) to prevent OOM
- [X] Replaces the AsyncState with a thread-safe wrapped boolean called NetworkState
- [X] Removes Parallel.ForEach (no perf gain)
- [X] Removes custom houses compression on another thread
- [X] Test high load scenarios

Bumps release version
2020-10-20 20:55:19 -07:00

36 lines
1.3 KiB
C#

using System;
namespace Server.Misc
{
// This fastwalk detection is no longer required
// As of B36 PlayerMobile implements movement packet throttling which more reliably controls movement speeds
public static class Fastwalk
{
private static readonly int MaxSteps = 4; // Maximum number of queued steps until fastwalk is detected
private static readonly bool Enabled = false; // Is fastwalk detection enabled?
private static readonly bool UOTDOverride = false; // Should UO:TD clients not be checked for fastwalk?
private static readonly AccessLevel
AccessOverride = AccessLevel.GameMaster; // Anyone with this or higher access level is not checked for fastwalk
public static void Initialize()
{
Mobile.FwdMaxSteps = MaxSteps;
Mobile.FwdEnabled = Enabled;
Mobile.FwdUOTDOverride = UOTDOverride;
Mobile.FwdAccessOverride = AccessOverride;
if (Enabled)
{
EventSink.FastWalk += OnFastWalk;
}
}
public static void OnFastWalk(FastWalkEventArgs e)
{
e.Blocked = true; // disallow this fastwalk
var state = e.NetState;
state.WriteConsole("Fast movement detected (name={0})", state.Mobile.Name);
}
}
}