Try this. This will make throttling activate almost immediately after suspicious packet, so speed boost achieved with speedhack will be so low that it will be totally negligible.
Can raise CPU utilization somewhat though.
Code:
#region Fastwalk Prevention
private static bool FastwalkPrevention = true; // Is fastwalk prevention enabled?
private static TimeSpan FastwalkThreshold = TimeSpan.FromSeconds( 0.095 );
private DateTime m_NextMovementTime;
public virtual bool UsesFastwalkPrevention{ get{ return ( AccessLevel < AccessLevel.GameMaster ); } }
public virtual TimeSpan ComputeMovementSpeed( Direction dir )
{
if ( (dir & Direction.Mask) != (this.Direction & Direction.Mask) )
return TimeSpan.Zero;
bool running = ( (dir & Direction.Running) != 0 );
bool onHorse = ( this.Mount != null );
if ( onHorse )
return ( running ? TimeSpan.FromSeconds( 0.1 ) : TimeSpan.FromSeconds( 0.2 ) ) - TimeSpan.FromSeconds( 0.005 );
return ( running ? TimeSpan.FromSeconds( 0.2 ) : TimeSpan.FromSeconds( 0.4 ) ) - TimeSpan.FromSeconds( 0.005 );
}
public static bool MovementThrottle_Callback( NetState ns )
{
PlayerMobile pm = ns.Mobile as PlayerMobile;
if ( pm == null || !pm.UsesFastwalkPrevention )
return true;
if ( pm.m_NextMovementTime == DateTime.MinValue )
{
// has not yet moved
pm.m_NextMovementTime = DateTime.Now;
return true;
}
TimeSpan ts = pm.m_NextMovementTime - DateTime.Now;
if ( ts < TimeSpan.Zero )
{
// been a while since we've last moved
pm.m_NextMovementTime = DateTime.Now;
return true;
}
return ( ts < FastwalkThreshold );
}
#endregion