Пример #1
0
 public Location GetNextHotSpot()
 {
     if (Spots.Count == 0)
     {
         LazyHelpers.StopAll("Subprofile: " + Name + " does not have any spots");
     }
     if (Spots.Count == 1)
     {
         return(Spots[0]);
     }
     if (Order)
     {
         _currentHotSpotIndex++;
         if (_currentHotSpotIndex >= Spots.Count)
         {
             _currentHotSpotIndex = 0;
         }
     }
     else
     {
         _currentHotSpotIndex = _ran.Next(Spots.Count);
     }
     // Logging.Write("Index: " + _currentHotSpotIndex);
     if (_currentHotSpotIndex >= Spots.Count)
     {
         Logging.Write(LogType.Warning, "Could not find a valid spot - spot bot and load a valid profile");
         return(new Location(0, 0, 0));
     }
     return(Spots[_currentHotSpotIndex]);
 }
Пример #2
0
 public override void DoWork()
 {
     HelperFunctions.ResetRedMessage();
     if (!Mount.IsMounted())
     {
         Mount.MountUp();
         MoveHelper.Jump(3000);
     }
     LazyHelpers.StopAll("背包满了, 停止工作");
 }
Пример #3
0
 public override void DoWork()
 {
     HelperFunctions.ResetRedMessage();
     if (!Mount.IsMounted())
     {
         Mount.MountUp();
         MoveHelper.Jump(3000);
     }
     LazyHelpers.StopAll("Bags are full, stopping");
 }
Пример #4
0
        private void NavigatorLoop()
        {
            int stuck = 0;

            while (true)
            {
                double destinationDistance = _destination.Z != 0
                                                 ? _destination.DistanceToSelf
                                                 : _destination.DistanceToSelf2D;
                if (destinationDistance > _stopDistance)
                {
                    if (Stuck.IsStuck)
                    {
                        Unstuck.TryUnstuck(stuck < 2);
                        MoveHelper.ReleaseKeys();
                        stuck++;
                    }
                    if (StuckTimer.IsReady)
                    {
                        stuck = 0;
                    }
                    if (stuck > 6)
                    {
                        LazyHelpers.StopAll("Stuck more than 6 times in 5 min");
                    }
                    if (_destination.DistanceToSelf2D > 60)
                    {
                        HelperFunctions.Move3D(_destination, 30);
                    }
                    else if (_destination.DistanceToSelf2D > 30)
                    {
                        HelperFunctions.Move3D(_destination, 20);
                    }
                    else if (_destination.DistanceToSelf2D > 20)
                    {
                        HelperFunctions.Move3D(_destination, 8);
                    }
                    else
                    {
                        HelperFunctions.Move3D(_destination, 6);
                    }
                    KeyHelper.PressKey("Up");
                }
                else
                {
                    KeyHelper.PressKey("Up");
                    MoveHelper.ReleaseKeys();
                    KeyHelper.ReleaseKey("Up");
                }
                Thread.Sleep(150);
            }
// ReSharper disable FunctionNeverReturns
        }
Пример #5
0
 internal SubProfile GetSubProfile()
 {
     foreach (SubProfile subProfile in _subProfile)
     {
         if (ObjectManager.MyPlayer.Level <= subProfile.PlayerMaxLevel &&
             ObjectManager.MyPlayer.Level >= subProfile.PlayerMinLevel)
         {
             return(subProfile);
         }
     }
     LazyHelpers.StopAll("No more subprofiles"); //TODO!
     return(new SubProfile());
 }
Пример #6
0
        private static void TrySpiritRess()
        {
            PUnit spirit = FindSpiritHealer();

            if (spirit == null)
            {
                Thread.Sleep(8000);
                spirit = FindSpiritHealer();
                if (spirit == null)
                {
                    LazyHelpers.StopAll("Could not find spirit healer");
                }
            }
            ApproachPosFlying.Approach(spirit.Location, 15);
            spirit.Face();
            DoSpiritRess(spirit);
        }
Пример #7
0
 private static void DoSpiritRess(PUnit vUnit)
 {
     Log("Going to accept ress sickness");
     Ress(vUnit);
     Thread.Sleep(4000);
     if (ObjectManager.MyPlayer.IsDead || ObjectManager.MyPlayer.IsGhost)
     {
         Ress(vUnit);
     }
     if (ObjectManager.MyPlayer.IsDead || ObjectManager.MyPlayer.IsGhost)
     {
         Ress(vUnit);
     }
     if (!ObjectManager.MyPlayer.IsDead && !ObjectManager.MyPlayer.IsGhost)
     {
         return;
     }
     LazyHelpers.StopAll("Could not ress.");
 }
Пример #8
0
        private void NavigatorLoop()
        {
            int stuck = 0;

            while (true)
            {
                double destinationDistance = _destination.DistanceToSelf2D;
                if (Stuck.IsStuck && _stuckTimer.IsReady)
                {
                    Unstuck.TryUnstuck();
                    _stuckTimer.Reset();
                    stuck++;
                }
                if (StuckTimer.IsReady)
                {
                    stuck = 0;
                }
                if (stuck > 6)
                {
                    LazyHelpers.StopAll("Stuck more than 6 times in 5 min");
                }
                if (destinationDistance > _stopDistance)
                {
                    if (!_destination.IsFacing(0.2f))
                    {
                        _destination.Face();
                    }
                    KeyHelper.PressKey("Up");
                }
                else
                {
                    MoveHelper.ReleaseKeys();
                }
                Thread.Sleep(10);
            }
// ReSharper disable FunctionNeverReturns
        }
Пример #9
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);
        }
Пример #10
0
        public override void DoWork()
        {
            FlyingEngine.Navigator.Stop();
            if (FlyingSettings.StopOnDeath)
            {
                LazyHelpers.StopAll("We died");
            }
            Logging.Write("Going to ress");
            FlyingEngine.UpdateStats(0, 0, 1);
            Location pos         = ObjectManager.MyPlayer.Location;
            Frame    frameByName = InterfaceHelper.GetFrameByName("StaticPopup1Button1");

            try
            {
                frameByName.LeftClick();
                Thread.Sleep(2000);
                frameByName.LeftClick();
                Thread.Sleep(3000);
                var maxTimeout = new Ticker(8000);
                if (!ObjectManager.MyPlayer.IsGhost && !maxTimeout.IsReady)
                {
                    frameByName.LeftClick();
                    Thread.Sleep(5000);
                }
            }
            catch
            {
            }
            if (FlyingSettings.FindCorpse && Mount.IsMounted())
            {
                KeyHelper.PressKey("Space");
                Thread.Sleep(20000);
                KeyHelper.ReleaseKey("Space");
                var toLong = new Ticker(150000);
                FlyingEngine.Navigator.SetDestination(new Location(pos.X, pos.Y, ObjectManager.MyPlayer.Location.Z));
                FlyingEngine.Navigator.Start();
                while (ObjectManager.MyPlayer.IsGhost)
                {
                    if (pos.DistanceToSelf2D < 20)
                    {
                        FlyingEngine.Navigator.Stop();
                        Logging.Write("Looks like we found our corpse");
                        DescentToCorpse();
                        Thread.Sleep(2000);
                        ApproachPosFlying.Approach(pos, 3);
                        frameByName.LeftClick();
                        var timeout = new Ticker(5000);
                        while (ObjectManager.MyPlayer.IsGhost && !timeout.IsReady)
                        {
                            Thread.Sleep(10);
                        }
                        break;
                    }
                    if (!Mount.IsMounted() && ObjectManager.MyPlayer.IsGhost)
                    {
                        Logging.Write("We are not mounted, cannot find corpse");
                        toLong.ForceReady();
                        break;
                    }
                    if (toLong.IsReady && ObjectManager.MyPlayer.IsGhost)
                    {
                        Logging.Write("We never found our corpse :(");
                        toLong.ForceReady();
                        break;
                    }
                }
            }
            else
            {
                TrySpiritRess();
            }
            FlyingEngine.Navigator.Stop();
            MoveHelper.ReleaseKeys();
            Thread.Sleep(1500);
            if (!ObjectManager.MyPlayer.IsAlive)
            {
                if (FlyingSettings.FindCorpse)
                {
                    Logging.Write("Could not find the corpse... trying to make it anyway");
                    InterfaceHelper.GetFrameByName("GhostFrame").LeftClick();
                    Thread.Sleep(5000);
                    TrySpiritRess();
                    if (!ObjectManager.MyPlayer.IsAlive)
                    {
                        LazyHelpers.StopAll("Could not ress :(");
                    }
                }
                else
                {
                    LazyHelpers.StopAll("Could not ress :(");
                }
            }
            Logging.Write("Ress worked :)");
            FlyingEngine.Navigator.Stop();
            if (ObjectManager.MyPlayer.HasBuff(15007) && FlyingSettings.WaitForRessSick)
            {
                Logging.Write("Waiting for ress sickness");
                Mount.MountUp();
                MoveHelper.Jump(6000);
                if (!Mount.IsMounted())
                {
                    Mount.MountUp();
                    MoveHelper.Jump(6000);
                }
                while (ObjectManager.MyPlayer.HasBuff(15007))
                {
                    Thread.Sleep(5000);
                }
            }
            else
            {
                CombatHandler.RunningAction();
            }
        }
Пример #11
0
        public static bool MountUp()
        {
            if (IsMounted())
            {
                return(true);
            }
            FlyingEngine.Navigator.Stop();
            MoveHelper.ReleaseKeys();
            if (ObjectManager.ShouldDefend)
            {
                return(false);
            }
            if (ObjectManager.MyPlayer.IsSwimming && !ObjectManager.MyPlayer.InVashjir)
            {
                Logging.Write("We got into the water, lets swim up and see if we can mount");
                MoveHelper.Jump(5000);
                Thread.Sleep(1000);
            }
            MoveHelper.ReleaseKeys();
            Latency.Sleep(ObjectManager.MyPlayer.IsInCombat ? 1000 : 500);
            KeyHelper.SendKey("FMount");
            MountTimer.Reset();
            while (!MountTimer.IsReady && !IsMounted())
            {
                if (ObjectManager.ShouldDefend)
                {
                    return(false);
                }
                Thread.Sleep(10);
            }
            Latency.Sleep(200);
            int tickCount = Environment.TickCount;

            if (ObjectManager.ShouldDefend)
            {
                return(false);
            }
            if (!IsMounted())
            {
                if (ObjectManager.ShouldDefend || ObjectManager.MyPlayer.IsDead)
                {
                    return(false);
                }
                TryUnstuck(tickCount);
            }
            if (Langs.MountCantMount(ObjectManager.MyPlayer.RedMessage))
            {
                LazyHelpers.StopAll("Cannot mount inside");
                HelperFunctions.ResetRedMessage();
            }
            if (ObjectManager.ShouldDefend || ObjectManager.MyPlayer.IsDead)
            {
                return(false);
            }
            if (!IsMounted())
            {
                Latency.Sleep(2500);
                if (!IsMounted())
                {
                    if (ObjectManager.ShouldDefend || ObjectManager.MyPlayer.IsDead)
                    {
                        return(false);
                    }
                    LazyHelpers.StopAll("Could not mount");
                    return(false);
                }
            }
            return(true);
        }