Exemplo 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);
        }
Exemplo n.º 2
0
 public UnitData(GUnit u)
 {
     unit          = u;
     guid          = u.GUID;
     movementSpeed = 0.0;
     oldLocation   = u.Location;
     lastSeen      = new GSpellTimer(120 * 1000);
     lastSeen.Reset();
 }
Exemplo n.º 3
0
        private void MyPather()
        {
            GSpellTimer taskTimer         = new GSpellTimer(300);
            GSpellTimer updateStatusTimer = new GSpellTimer(2000);
            GSpellTimer nothingToDoTimer  = new GSpellTimer(3 * 1000);
            bool        exit = false;
            GSpellTimer Tick = new GSpellTimer(100);

            do
            {
                if (RunState != WantedState)
                {
                    RunState = WantedState;
                }

                if (updateStatusTimer.IsReady)
                {
                    UpdateXP();
                    updateStatusTimer.Reset();
                }
                if (RunState == RunState_e.Stopped)
                {
                    //Context.Log("Stop wanted. Stopping glide");
                    //Context.KillAction("PPather wants to stop", false);
                    Thread.Sleep(500); // pause
                }
                else if (RunState == RunState_e.Paused)
                {
                    UpdateMyPos();
                    Thread.Sleep(100); // pause
                }
                else if (RunState == RunState_e.Running)
                {
                    UpdateMyPos();
                    if (Me.IsDead)
                    {
                        Thread.Sleep(1000);
                        GhostRun();
                        Thread.Sleep(1500);
                        if (Me.IsDead)
                        {
                            //!!!
                        }
                        else
                        {
                            //Rest();
                        }
                    }

                    Tick.Wait();
                    Thread.Sleep(10); // min sleep time
                    Tick.Reset();
                }
            } while (!exit);
        }
Exemplo n.º 4
0
 public void SetPathTimeout(int ms)
 {
     PathTimeout = new GSpellTimer(ms); // no path can be older than this
 }
Exemplo 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);
        }
Exemplo n.º 6
0
 public void SetPathTimeout(int ms)
 {
     PathTimeout = new GSpellTimer(ms); // no path can be older than this
 }
Exemplo n.º 7
0
        private void MyPather()
        {
            GSpellTimer taskTimer = new GSpellTimer(300);
            GSpellTimer updateStatusTimer = new GSpellTimer(2000);
            GSpellTimer nothingToDoTimer = new GSpellTimer(3 * 1000);
            bool exit = false;
            GSpellTimer Tick = new GSpellTimer(100);
            do
            {
                if (RunState != WantedState)
                {
                    RunState = WantedState;
                }

                if (updateStatusTimer.IsReady)
                {
                    UpdateXP();
                    updateStatusTimer.Reset();
                }
                if (RunState == RunState_e.Stopped)
                {
                    //Context.Log("Stop wanted. Stopping glide");
                    //Context.KillAction("PPather wants to stop", false);
                    Thread.Sleep(500); // pause
                }
                else if (RunState == RunState_e.Paused)
                {
                    UpdateMyPos();
                    Thread.Sleep(100); // pause
                }
                else if (RunState == RunState_e.Running)
                {
                    UpdateMyPos();
                    if (Me.IsDead)
                    {
                        Thread.Sleep(1000);
                        GhostRun();
                        Thread.Sleep(1500);
                        if (Me.IsDead)
                        {
                            //!!!
                        }
                        else
                        {
                            //Rest();
                        }
                    }

                    Tick.Wait();
                    Thread.Sleep(10); // min sleep time
                    Tick.Reset();
                }
            } while (!exit);
        }
Exemplo n.º 8
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;
        }
Exemplo n.º 9
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;
        }