Example #1
0
        internal static void TryUnstuck()
        {
            Logging.Write(LogType.Warning, "Stuck");
            Thread.Sleep(2000);
            MoveHelper.ReleaseKeys();
            if (_lastStuckTickcount + 5000 < Environment.TickCount)
            {
                Logging.Debug("Jump");
                MoveHelper.Forwards(true);
                MoveHelper.Jump();
                MoveHelper.Forwards(false);
                Thread.Sleep(1500);
            }
            else
            {
                Logging.Debug("Lets unstuck");
                MoveHelper.ReleaseKeys();
                if (_lastStuckDirection)
                {
                    MoveHelper.RotateLeft(true);
                }
                else
                {
                    MoveHelper.RotateRight(true);
                }

                _lastStuckDirection = !_lastStuckDirection;
                Thread.Sleep(500);
                MoveHelper.ReleaseKeys();
                MoveHelper.Forwards(true);
                Thread.Sleep(1000);
                MoveHelper.Forwards(false);
            }
            _lastStuckTickcount = Environment.TickCount;
        }
Example #2
0
 private static void TryUnstuck(int tickCount)
 {
     MountTimeOut.Reset();
     while (!IsMounted() && !MountTimeOut.IsReady)
     {
         if ((Environment.TickCount - tickCount) > 3000)
         {
             if (!ObjectManager.ShouldDefend)
             {
                 MoveHelper.RotateRight(true);
                 while ((Environment.TickCount - tickCount) < 3500)
                 {
                     Thread.Sleep(100);
                 }
                 Thread.Sleep(300);
                 MoveHelper.StopMove();
                 MoveHelper.Forwards(true);
                 if (ObjectManager.ShouldDefend)
                 {
                     MoveHelper.StopMove();
                     return;
                 }
                 MoveHelper.Jump(1000);
                 while ((Environment.TickCount - tickCount) < 9000)
                 {
                     Thread.Sleep(100);
                 }
                 MoveHelper.StopMove();
             }
             else
             {
                 return;
             }
         }
         if (!IsMounted())
         {
             Thread.Sleep(500);
             KeyHelper.SendKey("FMount");
             MountTimer.Reset();
             while (!MountTimer.IsReady && !IsMounted())
             {
                 if (ObjectManager.ShouldDefend || ObjectManager.MyPlayer.IsDead)
                 {
                     return;
                 }
                 Thread.Sleep(100);
             }
             Latency.Sleep(0);
         }
     }
     return;
 }
Example #3
0
        private static void MoveRandom()
        {
            int d = Ran.Next(4);

            if (d == 0 || d == 1)
            {
                MoveHelper.Forwards(true);
            }
            if (d == 1)
            {
                MoveHelper.StrafeRight(true);
            }
            if (d == 2 || d == 3)
            {
                MoveHelper.Backwards(true);
            }
            if (d == 3)
            {
                MoveHelper.StrafeLeft(true);
            }
        }
Example #4
0
 public void StopBotting(bool userStoppedIt)
 {
     CombatHandler.Stop();
     MouseHelper.ReleaseMouse();
     EnableItems();
     StopAfter.BotStopped();
     PeriodicRelogger.BotStopped();
     UpdateText(StartStopEngine, "Start botting");
     if (Engine.Running)
     {
         if (!userStoppedIt && LazySettings.SoundStop)
         {
             try
             {
                 if (File.Exists(LazySettings.OurDirectory + @"\falert.wav"))
                 {
                     _soundPlayer.SoundLocation = LazySettings.OurDirectory + @"\falert.wav";
                     _soundPlayer.Play();
                 }
             }
             catch
             {
                 //Empty
             }
         }
         if (LazySettings.UseCtm)
         {
             MoveHelper.Forwards(true);
             MoveHelper.Forwards(false);
         }
         MoveHelper.ReleaseKeys();
         Engine.StopEngine();
         EngineHandler.EngineStop();
         MoveHelper.ReleaseKeys();
         PluginManager.TerminatePulseThread();
         PluginManager.BotStop();
         Thread.Sleep(300);
         Logging.Write("Bot stopped");
     }
 }
Example #5
0
 internal static void HitTheNode(PGameObject nodeToHarvest)
 {
     Face.Reset();
     ToLongRun.Reset();
     _oldDis = FindNode.GetLocation(nodeToHarvest).DistanceToSelf;
     while (!ToLongRun.IsReady)
     {
         MoveHelper.Forwards(true);
         _distanceX =
             Math.Round(Math.Abs(FindNode.GetLocation(nodeToHarvest).Y - ObjectManager.MyPlayer.Location.Y));
         _distanceY =
             Math.Round(Math.Abs(FindNode.GetLocation(nodeToHarvest).X - ObjectManager.MyPlayer.Location.X));
         if (_distanceX <= 3 && _distanceY <= 3)
         {
             break;
         }
         if (Face.IsReady)
         {
             FindNode.GetLocation(nodeToHarvest).Face();
             Face.Reset();
         }
         Thread.Sleep(2);
         if (_oldDis < FindNode.GetLocation(nodeToHarvest).DistanceToSelf)
         {
             break;
         }
     }
     if (nodeToHarvest.Location.DistanceToSelf2D > 2.9)
     {
         if (nodeToHarvest.Location.DistanceToSelf2D > 2)
         {
             Thread.Sleep(150);
         }
         else if (nodeToHarvest.Location.DistanceToSelf2D > 1)
         {
             Thread.Sleep(100);
         }
     }
     MoveHelper.ReleaseKeys();
 }
Example #6
0
        internal static void TryUnstuck(bool smallUnstuck)
        {
            Ticker face;

            Logging.Write(LogType.Warning, "Stuck");
            MoveRandom();
            Thread.Sleep(2000);
            MoveHelper.ReleaseKeys();
            if (!smallUnstuck)
            {
                int temp = new Random().Next(1, 3);
                if (temp != 2)
                {
                    MoveHelper.Jump(new Random().Next(2000, 4000));
                }
                else
                {
                    MoveHelper.Down(new Random().Next(1000, 2000));
                }
                MoveRandom();
                Thread.Sleep(1500);
                MoveHelper.ReleaseKeys();
                face = new Ticker(Convert.ToInt32(new Random().Next(50, 200) * Math.PI));
                MoveHelper.RotateRight(true);
                while (!face.IsReady)
                {
                    Thread.Sleep(10);
                }
                MoveHelper.RotateRight(false);
                MoveHelper.Forwards(true);
                Thread.Sleep(new Random().Next(2000, 4000));
                MoveHelper.Forwards(false);
            }
            MoveRandom();
            Thread.Sleep(2000);
            MoveHelper.ReleaseKeys();
            Logging.Write(LogType.Warning, "Done");
        }
Example #7
0
        public static bool MountUp()
        {
            if (IsMounted())
            {
                return(true);
            }
            if (ObjectManager.ShouldDefend)
            {
                return(false);
            }
            GrindingEngine.Navigator.Stop();
            MoveHelper.ReleaseKeys();
            Thread.Sleep(1000);
            KeyHelper.SendKey("GMount");
            int tickCount = Environment.TickCount;

            if (ObjectManager.ShouldDefend)
            {
                return(false);
            }
            while (!IsMounted())
            {
                if ((Environment.TickCount - tickCount) > 3000)
                {
                    if (!ObjectManager.ShouldDefend)
                    {
                        MoveHelper.RotateRight(true);
                        while ((Environment.TickCount - tickCount) < 3500)
                        {
                            Thread.Sleep(100);
                        }
                        MoveHelper.StopMove();
                        MoveHelper.Forwards(true);
                        if (ObjectManager.ShouldDefend)
                        {
                            MoveHelper.StopMove();
                            return(false);
                        }
                        MoveHelper.Jump(1000);
                        while ((Environment.TickCount - tickCount) < 9000)
                        {
                            Thread.Sleep(100);
                        }
                        MoveHelper.StopMove();
                    }
                    return(false);
                }
                Thread.Sleep(100);
            }
            if (Langs.MountCantMount(ObjectManager.MyPlayer.RedMessage))
            {
                ResetRedMessage();
                LazyHelpers.StopAll("Cannot mount inside, fix the profile");
            }
            if (!IsMounted())
            {
                Thread.Sleep(2500);
                if (!IsMounted())
                {
                    return(false);
                }
            }
            return(true);
        }
Example #8
0
        internal static bool GatherFishNode(PGameObject node)
        {
            if (_reLure == null)
            {
                _reLure = new Ticker(600000);
                _reLure.ForceReady();
            }
            FlyingEngine.Navigator.Stop();
            var combat = new StateCombat();
            int nearestIndexInPositionList =
                Location.GetClosestPositionInList(FlyingEngine.CurrentProfile.WaypointsNormal, node.Location);
            Location position = FlyingEngine.CurrentProfile.WaypointsNormal[nearestIndexInPositionList];

            if (!ApproachPosFlying.Approach(position, 5))
            {
                return(false);
            }
            node.Location.Face();
            if (Bobber() != null)
            {
                Logging.Write("Someone is fishing, break");
                return(false);
            }
            if (!CheckMobs(node))
            {
                return(false);
            }
            if (FlyingBlackList.IsBlacklisted(node))
            {
                ToldAboutNode.TellAbout("is blacklisted", node);
                return(false);
            }
            DescentToSchool(node);
            Mount.Dismount();
            var timeout      = new Ticker((FlyingSettings.MaxTimeAtSchool * 60) * 1000);
            var checkIfValid = new Ticker(8000);

            while (node.IsValid)
            {
                while (combat.NeedToRun)
                {
                    combat.DoWork();
                    timeout.Reset();
                }
                if (checkIfValid.IsReady)
                {
                    if (ObjectManager.GetObjects.FirstOrDefault(u => u.BaseAddress == node.BaseAddress) == null)
                    {
                        break;
                    }
                    checkIfValid.Reset();
                }
                if (FlyingSettings.Lure && _reLure.IsReady)
                {
                    KeyHelper.SendKey("Lure");
                    Thread.Sleep(3500);
                    _reLure.Reset();
                }
                if (timeout.IsReady)
                {
                    return(false);
                }
                if (ObjectManager.MyPlayer.IsSwimming)
                {
                    MoveHelper.Jump(1500);
                    Thread.Sleep(1000);
                    KeyHelper.SendKey("Waterwalk");
                    Thread.Sleep(2000);
                    MoveHelper.Jump(1500);
                    Thread.Sleep(1500);
                    if (ObjectManager.MyPlayer.IsSwimming)
                    {
                        return(false);
                    }
                }
                node.Location.Face();
                var timeout3 = new Ticker(4000);
                while (!timeout3.IsReady && (node.Location.DistanceToSelf2D < 14))
                {
                    MoveHelper.Backwards(true);
                    Thread.Sleep(20);
                }
                MoveHelper.ReleaseKeys();
                timeout3.Reset();
                node.Location.Face();
                while (!timeout3.IsReady && (node.Location.DistanceToSelf2D > 16))
                {
                    MoveHelper.Forwards(true);
                    Thread.Sleep(20);
                }
                MoveHelper.ReleaseKeys();
                KeyHelper.SendKey("Fishing");
                Thread.Sleep(1500);
                Fishing.FindBobberAndClick(FlyingSettings.WaitForLoot);
                Thread.Sleep(100);
            }
            return(true);
        }