Exemplo n.º 1
0
		private static void Path( Mobile from, IPoint3D p, PathAlgorithm alg, string name, int zOffset )
		{
			m_OverrideAlgorithm = alg;

			long start = DateTime.Now.Ticks;
			MovementPath path = new MovementPath( from, new Point3D( p ) );
			long end = DateTime.Now.Ticks;
			double len = Math.Round( (end-start) / 10000.0, 2 );

			if ( !path.Success )
			{
				from.SendMessage( "{0} path failed: {1}ms", name, len );
			}
			else
			{
				from.SendMessage( "{0} path success: {1}ms", name, len );

				int x = from.X;
				int y = from.Y;
				int z = from.Z;

				for ( int i = 0; i < path.Directions.Length; ++i )
				{
					Movement.Movement.Offset( path.Directions[i], ref x, ref y );

					new RecallRune().MoveToWorld( new Point3D( x, y, z+zOffset ), from.Map );
				}
			}
		}
Exemplo n.º 2
0
        public static void Path_OnTarget( Mobile from, object obj )
        {
            IPoint3D p = obj as IPoint3D;

            if ( p == null )
                return;

            Spells.SpellHelper.GetSurfaceTop( ref p );

            Path( from, p, FastAStarAlgorithm.Instance, "Fast", 0 );
            Path( from, p, SlowAStarAlgorithm.Instance, "Slow", 2 );
            m_OverrideAlgorithm = null;

            /*MovementPath path = new MovementPath( from, new Point3D( p ) );

            if ( !path.Success )
            {
                from.SendMessage( "No path to there could be found." );
            }
            else
            {
                //for ( int i = 0; i < path.Directions.Length; ++i )
                //	Timer.DelayCall( TimeSpan.FromSeconds( 0.1 + (i * 0.3) ), new TimerStateCallback( Pathfind ), new object[]{ from, path.Directions[i] } );
                int x = from.X;
                int y = from.Y;
                int z = from.Z;

                for ( int i = 0; i < path.Directions.Length; ++i )
                {
                    Movement.Movement.Offset( path.Directions[i], ref x, ref y );

                    new Items.RecallRune().MoveToWorld( new Point3D( x, y, z ), from.Map );
                }
            }*/
        }
Exemplo n.º 3
0
        public static void Path_OnTarget( Mobile from, object obj )
        {
            IPoint3D p = obj as IPoint3D;

            if ( p == null )
                return;

            Spells.SpellHelper.GetSurfaceTop( ref p );

            //Path( from, p, FastAStarAlgorithm.Instance, "Fast", 0 );
            Path( from, p, SlowAStarAlgorithm.Instance, "Slow", 2 );
            Path( from, p, StupidNPCPathing.Instance, "Stupid", 0 );
            m_OverrideAlgorithm = null;
        }
Exemplo n.º 4
0
        public static void EscapePath_OnTarget( Mobile from, object obj )
        {
            IPoint3D p = obj as IPoint3D;

            if ( p == null )
                return;

            Spells.SpellHelper.GetSurfaceTop( ref p );

            Path( from, p, FastAStarEscapeAlgorithm.Instance, "Fast", 0 );
            m_OverrideAlgorithm = null;
        }