Пример #1
0
 public static void OnFastWalk(FastWalkEventArgs e)
 {
     e.Blocked = true;//disallow this fastwalk
     Utility.PushColor(ConsoleColor.Red);
     Console.WriteLine("Client: {0}: Fast movement detected! (name={1})", e.NetState, e.NetState.Mobile.Name);
     Utility.PopColor();
 }
Пример #2
0
 public static void OnFastWalk(FastWalkEventArgs e)
 {
     e.Blocked = true;//disallow this fastwalk
     Utility.PushColor(ConsoleColor.Red);
     Console.WriteLine("Client: {0}: Fast movement detected! (name={1})", e.NetState, e.NetState.Mobile.Name);
     Utility.PopColor();
 }
Пример #3
0
        public static void OnFastWalk(FastWalkEventArgs e)
        {
            if (!m_Blocks.ContainsKey(e.NetState.Mobile))
            {
                m_Blocks.Add(e.NetState.Mobile, new List <DateTime>());
            }
            m_Blocks[e.NetState.Mobile].Add(DateTime.Now);

            if (ProtectionEnabled)
            {
                e.Blocked = true;                //disallow this fastwalk
                //Console.WriteLine("Client: {0}: Fast movement detected (name={1})", e.NetState, e.NetState.Mobile.Name);
            }

            try
            {
                List <DateTime> blocks = m_Blocks[e.NetState.Mobile];
                if (e.FastWalkCount > WarningThreshold &&
                    blocks.Count >= 2 &&                     // sanity check, shouldn't be possible to reach this point w/o Count >= 2
                    (blocks[blocks.Count - 1] - blocks[blocks.Count - 2]) > WarningCooldown)
                {
                    Console.WriteLine("FW Warning");
                }
            }
            catch (Exception ex)             // we can only exception if Mobile.FwdMaxSteps < 2 - make sure SecurityManagementConsole doesn't set it too low
            {
                LogHelper.LogException(ex);
                Console.WriteLine(ex);
            }
        }
Пример #4
0
		public static void OnDetected(FastWalkEventArgs e)
		{
			if (!(e.NetState.Mobile is PlayerMobile))
			{
				return;
			}

			PlayerMobile pm = (PlayerMobile)e.NetState.Mobile;

			Console.WriteLine("Client: {0}: Speed exploit detected: {1}", e.NetState, pm);

			if (CMOptions.DetectAction == SpeedhackAction.None)
			{
				return;
			}

			if (CMOptions.DetectAction.HasFlag(SpeedhackAction.Block))
			{
				e.Blocked = true;
			}

			if (CMOptions.DetectAction.HasFlag(SpeedhackAction.Warn))
			{
				NoticeDialogGump g =
					SuperGump.EnumerateInstances<NoticeDialogGump>(pm, true)
							 .FirstOrDefault(d => !d.IsDisposed && d.Title == "Speed Exploit Detection") ?? new NoticeDialogGump(pm)
							 {
								 CanClose = false,
								 CanDispose = false,
								 Width = 420,
								 Height = 420,
								 Modal = true,
								 BlockMovement = true,
								 Icon = 7000,
								 Title = "Speed Exploit Detection",
								 Html =
									 "You seem to be moving faster than the universe allows, that isn't a good thing!" +
									 "\nIf you defy the laws of physics, bad things can happen." +
									 "\nYou don't want to end up in a black hole, unable to return to the universe, do you?" +
									 "\nI didn't think so." + "\nPlay fair and disable any artificial speed exploits that you may be using.",
								 AcceptHandler = b =>
								 {
									 if (CMOptions.DetectAction.HasFlag(SpeedhackAction.Kick))
									 {
										 e.NetState.Dispose(true);
									 }
								 }
							 };

				g.Refresh(true);
			}
			else if (CMOptions.DetectAction.HasFlag(SpeedhackAction.Kick))
			{
				e.NetState.Dispose(true);
			}
		}
Пример #5
0
        public static void OnDetected(FastWalkEventArgs e)
        {
            if (!(e.NetState.Mobile is PlayerMobile))
            {
                return;
            }

            PlayerMobile pm = (PlayerMobile)e.NetState.Mobile;

            Console.WriteLine("Client: {0}: Speed exploit detected: {1}", e.NetState, pm);

            if (CMOptions.DetectAction == SpeedhackAction.None)
            {
                return;
            }

            if (CMOptions.DetectAction.HasFlag(SpeedhackAction.Block))
            {
                e.Blocked = true;
            }

            if (CMOptions.DetectAction.HasFlag(SpeedhackAction.Warn))
            {
                NoticeDialogGump g =
                    SuperGump.EnumerateInstances <NoticeDialogGump>(pm, true)
                    .FirstOrDefault(d => !d.IsDisposed && d.Title == "Speed Exploit Detection") ?? new NoticeDialogGump(pm)
                {
                    CanClose      = false,
                    CanDispose    = false,
                    Width         = 420,
                    Height        = 420,
                    Modal         = true,
                    BlockMovement = true,
                    Icon          = 7000,
                    Title         = "Speed Exploit Detection",
                    Html          =
                        "You seem to be moving faster than the universe allows, that isn't a good thing!" +
                        "\nIf you defy the laws of physics, bad things can happen." +
                        "\nYou don't want to end up in a black hole, unable to return to the universe, do you?" +
                        "\nI didn't think so." + "\nPlay fair and disable any artificial speed exploits that you may be using.",
                    AcceptHandler = b =>
                    {
                        if (CMOptions.DetectAction.HasFlag(SpeedhackAction.Kick))
                        {
                            e.NetState.Dispose(true);
                        }
                    }
                };

                g.Refresh(true);
            }
            else if (CMOptions.DetectAction.HasFlag(SpeedhackAction.Kick))
            {
                e.NetState.Dispose(true);
            }
        }
Пример #6
0
        public static void OnFastWalk( FastWalkEventArgs e )
        {
            Console.WriteLine( "Client: {0}: Fast movement detected (name={1})", e.NetState, e.NetState.Mobile.Name );

            if ( e.NetState.Mobile.Map == Map.Felucca )
                Server.Scripts.Commands.CommandHandlers.BroadcastMessage( AccessLevel.Counselor, 0x20, String.Format( "Fastwalk: {0}, {1}", DateTime.Now, e.NetState.Mobile.Name ) );

            try
            {
                using ( StreamWriter op = new StreamWriter( "log/Fastwalk.log", true ) )
                    op.WriteLine( "{0}\t{1}\t{2}\t{3}", DateTime.Now, e.NetState, e.NetState.Account.ToString(), e.NetState.Mobile.Name );
            }
            catch { }

            e.Blocked = true; //disallow this fastwalk
        }
Пример #7
0
        public static void OnFastWalk(FastWalkEventArgs e)
        {
            Mobile m = e.NetState.Mobile;

            e.Blocked = true;            //disallow this fastwalk
            if (TestCenter.Enabled)
            {
                e.NetState.Mobile.SendMessage("Please slow down!! ({0}) ({1} seconds)", m.MoveRecords.Count - Mobile.FwdMaxSteps, (m.EndQueue - DateTime.Now).TotalSeconds);
            }
            PublicOverheadMessage(e.NetState.Mobile, MessageType.Regular, 33, String.Format("[Fastwalk]: Speed Detected!!! ({0}) ({1} seconds)", m.MoveRecords.Count - Mobile.FwdMaxSteps, (m.EndQueue - DateTime.Now).TotalSeconds));

            if (m.MoveRecords.Count - Mobile.FwdMaxSteps >= 20)
            {
                e.NetState.Mobile.SendMessage("You have been kicked for excessive movement or network latency issues.  Please check your network connection, or third party software before logging in.");
                m.NetState.Dispose();
            }
        }
Пример #8
0
        public static void OnFastWalk(FastWalkEventArgs e)
        {
            Console.WriteLine("Client: {0}: Fast movement detected (name={1})", e.NetState, e.NetState.Mobile.Name);

            if (e.NetState.Mobile.Map == Map.Felucca)
            {
                Server.Scripts.Commands.CommandHandlers.BroadcastMessage(AccessLevel.Counselor, 0x20, String.Format("Fastwalk: {0}, {1}", DateTime.UtcNow, e.NetState.Mobile.Name));
            }

            try
            {
                using (StreamWriter op = new StreamWriter(Path.Combine(Core.Config.LogDirectory, "Fastwalk.log"), true))
                    op.WriteLine("{0}\t{1}\t{2}\t{3}", DateTime.UtcNow, e.NetState, e.NetState.Account.ToString(), e.NetState.Mobile.Name);
            }
            catch { }

            e.Blocked = true;             //disallow this fastwalk
        }
Пример #9
0
 public static void OnFastWalk(FastWalkEventArgs e)
 {
     e.Blocked = true; // disallow this fastwalk
     Console.WriteLine("Client: {0}: Fast movement detected (name={1})", e.NetState, e.NetState.Mobile.Name);
 }
Пример #10
0
 public static void OnFastWalk(FastWalkEventArgs e)
 {
     e.Blocked = true;//disallow this fastwalk
     Console.WriteLine("Client: {0}: Fast movement detected (name={1})", e.NetState, e.NetState.Mobile.Name);
 }
Пример #11
0
        public virtual bool Move( Direction d )
        {
            if ( m_Deleted )
                return false;

            Map map = m_Map;

            if ( map == null )
                return false;

            BankBox box = FindBankNoCreate();

            if ( box != null && box.Opened )
                box.Close();

            Point3D newLocation = Location;
            Point3D oldLocation = newLocation;

            if ( ( m_Direction & Direction.Mask ) == ( d & Direction.Mask ) )
            {
                // We are actually moving (not just a direction change)

                if ( m_Spell != null && !m_Spell.OnCasterMoving( d ) )
                    return false;

                if ( m_Paralyzed || m_Frozen )
                {
                    SendLocalizedMessage( 500111 ); // You are frozen and can not move.

                    return false;
                }

                int newZ;

                if ( CheckMovement( d, out newZ ) )
                {
                    int x = m_Location.X, y = m_Location.Y;
                    int oldX = x, oldY = y;
                    int oldZ = m_Location.Z;

                    switch ( d & Direction.Mask )
                    {
                        case Direction.North:
                            --y;
                            break;
                        case Direction.Right:
                            ++x;
                            --y;
                            break;
                        case Direction.East:
                            ++x;
                            break;
                        case Direction.Down:
                            ++x;
                            ++y;
                            break;
                        case Direction.South:
                            ++y;
                            break;
                        case Direction.Left:
                            --x;
                            ++y;
                            break;
                        case Direction.West:
                            --x;
                            break;
                        case Direction.Up:
                            --x;
                            --y;
                            break;
                    }

                    newLocation.X = x;
                    newLocation.Y = y;
                    newLocation.Z = newZ;

                    m_Pushing = false;

                    var objectsAtOldPoint = map.GetObjectsAtWorldPoint( new Point2D( oldX, oldY ) ).ToArray();

                    foreach ( var m in objectsAtOldPoint.OfType<Mobile>() )
                    {
                        if ( m != this && ( m.Z + 15 ) > oldZ && ( oldZ + 15 ) > m.Z && !m.OnMoveOff( this ) )
                            return false;
                    }

                    foreach ( var item in objectsAtOldPoint.OfType<Item>() )
                    {
                        if ( ( item.Z == oldZ || ( ( item.Z + item.ItemData.Height ) >= oldZ && ( oldZ + 15 ) > item.Z ) ) && !item.OnMoveOff( this ) )
                            return false;
                    }

                    var objectsAtNewPoint = map.GetObjectsAtWorldPoint( new Point2D( x, y ) ).ToArray();

                    foreach ( var m in objectsAtNewPoint.OfType<Mobile>() )
                    {
                        if ( ( m.Z + 15 ) > newZ && ( newZ + 15 ) > m.Z && !m.OnMoveOver( this ) )
                            return false;
                    }

                    foreach ( var item in objectsAtNewPoint.OfType<Item>() )
                    {
                        if ( item.AtWorldPoint( x, y ) && ( item.Z == newZ || ( ( item.Z + item.ItemData.Height ) >= newZ && ( newZ + 15 ) > item.Z ) ) && !item.OnMoveOver( this ) )
                            return false;
                    }

                    if ( !Region.CanMove( this, d, newLocation, oldLocation, map ) )
                        return false;

                    if ( !InternalOnMove( d ) )
                        return false;

                    if ( m_FwdEnabled && m_Client != null && m_AccessLevel < m_FwdAccessOverride )
                    {
                        if ( m_MoveRecords == null )
                            m_MoveRecords = new Queue<MovementRecord>( 6 );

                        while ( m_MoveRecords.Count > 0 )
                        {
                            MovementRecord r = (MovementRecord) m_MoveRecords.Peek();

                            if ( r.Expired() )
                                m_MoveRecords.Dequeue();
                            else
                                break;
                        }

                        if ( m_MoveRecords.Count >= m_FwdMaxSteps )
                        {
                            FastWalkEventArgs fw = new FastWalkEventArgs( m_Client );
                            EventSink.Instance.InvokeFastWalk( fw );

                            if ( fw.Blocked )
                                return false;
                        }

                        TimeSpan delay = ComputeMovementSpeed( d );

                        DateTime end;

                        if ( m_MoveRecords.Count > 0 )
                            end = m_EndQueue + delay;
                        else
                            end = DateTime.Now + delay;

                        m_MoveRecords.Enqueue( MovementRecord.NewInstance( end ) );

                        m_EndQueue = end;
                    }

                    m_LastMoveTime = DateTime.Now;
                    newLocation = new Point3D( x, y, newZ );
                }
                else
                {
                    return false;
                }

                DisruptiveAction();
            }

            if ( m_Client != null )
                m_Client.Send( MovementAck.Instantiate( m_Client.Sequence, this ) );//new MovementAck( m_NetState.Sequence, this ) );

            SetLocation( newLocation, false );
            SetDirection( d );

            ArrayList moveList = new ArrayList();

            foreach ( object o in map.GetObjectsInRange( m_Location, Mobile.GlobalMaxUpdateRange ) )
            {
                if ( o == this )
                    continue;

                if ( o is Mobile )
                {
                    moveList.Add( o );
                }
                else if ( o is Item )
                {
                    Item item = (Item) o;

                    if ( item.HandlesOnMovement )
                        moveList.Add( item );
                }
            }

            Packet[] cache = m_MovingPacketCache;

            for ( int i = 0; i < cache.Length; ++i )
                Packet.Release( ref cache[i] );

            for ( int i = 0; i < moveList.Count; ++i )
            {
                object o = moveList[i];

                if ( o is Mobile )
                {
                    Mobile m = (Mobile) moveList[i];
                    GameClient ns = m.Client;

                    if ( ns != null && m.CanSee( this ) && m.InUpdateRange( this ) )
                    {
                        int noto = Notoriety.Compute( m, this );
                        Packet p = cache[noto];

                        if ( p == null )
                            p = cache[noto] = Packet.Acquire( GenericPackets.MobileMoving( this, noto ) );

                        ns.Send( p );
                    }

                    m.OnMovement( this, oldLocation );
                }
                else if ( o is Item )
                {
                    ( (Item) o ).OnMovement( this, oldLocation );
                }
            }

            for ( int i = 0; i < cache.Length; ++i )
                Packet.Release( ref cache[i] );

            if ( moveList.Count > 0 )
                moveList.Clear();

            OnAfterMove( oldLocation );
            return true;
        }
Пример #12
0
 public void InvokeFastWalk( FastWalkEventArgs e )
 {
     if ( FastWalk != null )
         FastWalk( e );
 }
Пример #13
0
		public static void OnFastWalk( FastWalkEventArgs e )
		{
			e.Blocked = true; //disallow this fastwalk
			//Console.WriteLine( "Client: {0}: Fast movement detected 2(name={1}) in jail system", e.NetState, e.NetState.Mobile.Name );

			if( warnspeedy )
				fWalkWarn( e.NetState.Mobile );
		}
Пример #14
0
 public static void OnFastWalk(FastWalkEventArgs e)
 {
     e.Blocked = true;            //disallow this fastwalk
     log.Warn(String.Format("Client: {0}: Fast movement detected (name={1})",
                            e.NetState, e.NetState.Mobile.Name));
 }
Пример #15
0
 public static void InvokeFastWalk(FastWalkEventArgs e) => FastWalk?.Invoke(e);