Esempio n. 1
0
        public bool WalkTo(Coordinate loc, bool AbortIfUnsafe, int timeout, bool AllowDead)
        {
            if (loc.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates()) < 4.5f &&
                Math.Abs(loc.O) < PI / 8)
            {
                mover.Stop();
                return(true);
            }

            GSpellTimer   approachTimeout = new GSpellTimer(timeout, false);
            StuckDetecter sd     = new StuckDetecter(this, 1, 2);
            GSpellTimer   t      = new GSpellTimer(0);
            bool          doJump = random.Next(4) == 0;
            EasyMover     em     = null;

            do
            {
                UpdateMyPos();

                // Check for stuck
                if (sd.checkStuck())
                {
                    BoogieCore.Log(LogType.System, "Major stuck on approach. Giving up");
                    mover.Stop();
                    return(false);
                }


                double distance = loc.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates());
                bool   moved;
                if (distance < 8)
                {
                    moved = mover.moveTowardsFacing(loc, 4.5f, loc);
                }
                else
                {
                    if (em == null)
                    {
                        em = new EasyMover(this, new Location(loc), false, AbortIfUnsafe);
                    }
                    EasyMover.MoveResult mr = em.move();

                    moved = true;
                    if (mr != EasyMover.MoveResult.Moving)
                    {
                        moved = false;
                    }
                }

                if (!moved)
                {
                    mover.Stop();
                    BoogieCore.Log(LogType.System, "did not move");
                    return(true);
                }
            } while (!approachTimeout.IsReadySlow);
            mover.Stop();
            BoogieCore.Log(LogType.System, "Approach timed out");
            return(false);
        }
Esempio n. 2
0
 public MoveAlonger(PPather pather, Path path)
 {
     this.Me    = BoogieCore.Player;
     this.path  = path;
     this.world = pather.world;
     mover      = PPather.mover;
     sd         = new StuckDetecter(pather, 1, 2);
     prev       = null;
     current    = path.GetFirst();
     next       = path.GetSecond();
 }
Esempio n. 3
0
 public MoveAlonger(PPather pather, Path path)
 {
     this.Context = GContext.Main;
     this.Me      = Context.Me;
     this.path    = path;
     this.world   = PPather.world;
     mover        = PPather.mover;
     sd           = new StuckDetecter(pather, 1, 2);
     prev         = null;
     current      = path.GetFirst();
     next         = path.GetSecond();
 }
Esempio n. 4
0
 public MoveAlonger(PPather pather, Path path)
 {
     this.Me = BoogieCore.Player;
     this.path = path;
     this.world = pather.world;
     mover = PPather.mover;
     sd = new StuckDetecter(pather, 1, 2);
     prev = null;
     current = path.GetFirst();
     next = path.GetSecond();
 }
Esempio n. 5
0
        public bool Approach(BoogieBot.Common.Object monster, bool AbortIfUnsafe, int timeout)
        {
            BoogieCore.Log(LogType.System, "[Approach] 1");
            Coordinate loc    = monster.GetCoordinates();
            float      DistTo = loc.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates());

            BoogieCore.Log(LogType.System, "[Approach] Distance to object: {0}", DistTo);
            if (DistTo < 4.5f &&
                Math.Abs(loc.O) < PI / 8)
            {
                mover.Stop();
                return(true);
            }

            GSpellTimer   approachTimeout = new GSpellTimer(timeout, false);
            StuckDetecter sd              = new StuckDetecter(this, 1, 2);
            GSpellTimer   t               = new GSpellTimer(0);
            bool          doJump          = random.Next(4) == 0;
            EasyMover     em              = null;
            GSpellTimer   NewTargetUpdate = new GSpellTimer(1000);


            BoogieCore.Log(LogType.System, "[Approach] 2");
            do
            {
                BoogieCore.Log(LogType.System, "[Approach] 3");
                UpdateMyPos();
                BoogieCore.Log(LogType.System, "[Approach] 4");
                // Check for stuck
                if (sd.checkStuck())
                {
                    BoogieCore.Log(LogType.System, "[Approach] 5");
                    BoogieCore.Log(LogType.System, "Major stuck on approach. Giving up");
                    mover.Stop();
                    return(false);
                }
                double distance = monster.GetCoordinates().DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates());
                BoogieCore.Log(LogType.System, "[Approach] 6 - Dist = {0}", distance);
                bool moved;

                if (distance < 8)
                {
                    loc = monster.GetCoordinates();
                    BoogieCore.Log(LogType.System, "[Approach] 7");
                    moved = mover.moveTowardsFacing(loc, 4.5f, loc);
                    BoogieCore.Log(LogType.System, "[Approach] 8 {0}", moved);
                }
                else
                {
                    BoogieCore.Log(LogType.System, "[Approach] 9");
                    if (em == null)
                    {
                        loc = monster.GetCoordinates();
                        em  = new EasyMover(this, new Location(loc), false, AbortIfUnsafe);
                    }
                    BoogieCore.Log(LogType.System, "[Approach] 10");
                    EasyMover.MoveResult mr = em.move();
                    BoogieCore.Log(LogType.System, "[Approach] 11 {0}", mr);
                    moved = true;
                    if (mr != EasyMover.MoveResult.Moving)
                    {
                        moved = false;
                    }
                    BoogieCore.Log(LogType.System, "[Approach] 12");
                }
                BoogieCore.Log(LogType.System, "[Approach] 13");

                if (!moved)
                {
                    mover.Stop();
                    return(true);
                }
            } while (!approachTimeout.IsReadySlow);
            mover.Stop();
            BoogieCore.Log(LogType.System, "Approach timed out");
            return(false);
        }
Esempio n. 6
0
        public bool WalkTo(Coordinate loc, bool AbortIfUnsafe, int timeout, bool AllowDead)
        {
            if (loc.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates()) < 4.5f &&
                Math.Abs(loc.O) < PI / 8)
            {
                mover.Stop();
                return true;
            }

            GSpellTimer approachTimeout = new GSpellTimer(timeout, false);
            StuckDetecter sd = new StuckDetecter(this, 1, 2);
            GSpellTimer t = new GSpellTimer(0);
            bool doJump = random.Next(4) == 0;
            EasyMover em = null;
            do
            {
                UpdateMyPos();

                // Check for stuck
                if (sd.checkStuck())
                {
                    BoogieCore.Log(LogType.System, "Major stuck on approach. Giving up");
                    mover.Stop();
                    return false;
                }

                double distance = loc.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates());
                bool moved;
                if (distance < 8)
                {
                    moved = mover.moveTowardsFacing(loc, 4.5f, loc);
                }
                else
                {
                    if (em == null)
                        em = new EasyMover(this, new Location(loc), false, AbortIfUnsafe);
                    EasyMover.MoveResult mr = em.move();

                    moved = true;
                    if (mr != EasyMover.MoveResult.Moving)
                    {
                        moved = false;
                    }
                }

                if (!moved)
                {
                    mover.Stop();
                    BoogieCore.Log(LogType.System, "did not move");
                    return true;
                }

            } while (!approachTimeout.IsReadySlow );
            mover.Stop();
            BoogieCore.Log(LogType.System, "Approach timed out");
            return false;
        }
Esempio n. 7
0
        public bool Approach(BoogieBot.Common.Object monster, bool AbortIfUnsafe, int timeout)
        {
            BoogieCore.Log(LogType.System, "[Approach] 1");
            Coordinate loc = monster.GetCoordinates();
            float DistTo = loc.DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates());
            BoogieCore.Log(LogType.System, "[Approach] Distance to object: {0}", DistTo);
            if (DistTo < 4.5f &&
                Math.Abs(loc.O) < PI / 8)
            {
                mover.Stop();
                return true;
            }

            GSpellTimer approachTimeout = new GSpellTimer(timeout, false);
            StuckDetecter sd = new StuckDetecter(this, 1, 2);
            GSpellTimer t = new GSpellTimer(0);
            bool doJump = random.Next(4) == 0;
            EasyMover em = null;
            GSpellTimer NewTargetUpdate = new GSpellTimer(1000);

            BoogieCore.Log(LogType.System, "[Approach] 2");
            do
            {
                BoogieCore.Log(LogType.System, "[Approach] 3");
                UpdateMyPos();
                BoogieCore.Log(LogType.System, "[Approach] 4");
                // Check for stuck
                if (sd.checkStuck())
                {
                    BoogieCore.Log(LogType.System, "[Approach] 5");
                    BoogieCore.Log(LogType.System, "Major stuck on approach. Giving up");
                    mover.Stop();
                    return false;
                }
                double distance = monster.GetCoordinates().DistanceTo(BoogieCore.world.getPlayerObject().GetCoordinates());
                BoogieCore.Log(LogType.System, "[Approach] 6 - Dist = {0}", distance);
                bool moved;

                if (distance < 8)
                {
                    loc = monster.GetCoordinates();
                    BoogieCore.Log(LogType.System, "[Approach] 7");
                    moved = mover.moveTowardsFacing(loc, 4.5f, loc);
                    BoogieCore.Log(LogType.System, "[Approach] 8 {0}", moved);
                }
                else
                {
                    BoogieCore.Log(LogType.System, "[Approach] 9");
                    if (em == null)
                    {
                        loc = monster.GetCoordinates();
                        em = new EasyMover(this, new Location(loc), false, AbortIfUnsafe);
                    }
                    BoogieCore.Log(LogType.System, "[Approach] 10");
                    EasyMover.MoveResult mr = em.move();
                    BoogieCore.Log(LogType.System, "[Approach] 11 {0}", mr);
                    moved = true;
                    if (mr != EasyMover.MoveResult.Moving)
                    {
                        moved = false;
                    }
                    BoogieCore.Log(LogType.System, "[Approach] 12");
                }
                BoogieCore.Log(LogType.System, "[Approach] 13");

                if (!moved)
                {
                    mover.Stop();
                    return true;
                }

            } while (!approachTimeout.IsReadySlow);
            mover.Stop();
            BoogieCore.Log(LogType.System, "Approach timed out");
            return false;
        }