private async static Task <bool> FollowPath()
        {
            if (!AutoAnglerSettings.Instance.Poolfishing && !AutoAnglerBot.Instance.Profile.FishAtHotspot)
            {
                return(false);
            }

            if (!AutoAnglerBot.Instance.Profile.FishAtHotspot &&
                (BotPoi.Current.Type == PoiType.Harvest || LootTargeting.Instance.FirstObject != null))
            {
                return(false);
            }

            if (await CheckLootFrame())
            {
                return(true);
            }

            //  dks can refresh water walking while flying around.
            if (AutoAnglerSettings.Instance.UseWaterWalking &&
                Me.Class == WoWClass.DeathKnight &&
                !WaterWalking.IsActive &&
                await WaterWalking.Cast())
            {
                return(true);
            }

            var moveto = AutoAnglerBot.Instance.Profile.CurrentPoint;

            if (moveto == WoWPoint.Zero)
            {
                return(false);
            }

            if (AutoAnglerBot.Instance.Profile.FishAtHotspot && Navigator.AtLocation(moveto))
            {
                return(false);
            }

            float precision = Me.IsFlying ? AutoAnglerSettings.Instance.PathPrecision : 3;

            if (Me.Location.Distance(moveto) <= precision)
            {
                AutoAnglerBot.Instance.Profile.CycleToNextPoint();
            }

            if (AutoAnglerSettings.Instance.Fly)
            {
                if (!StyxWoW.Me.Mounted && Flightor.MountHelper.CanMount)
                {
                    var zenFlightAura = StyxWoW.Me.GetAuraByName("Zen Flight");
                    if (zenFlightAura != null)
                    {
                        zenFlightAura.TryCancelAura();
                        await CommonCoroutines.SleepForLagDuration();
                    }
                    Flightor.MountHelper.MountUp();
                    return(true);
                }

                Flightor.MoveTo(moveto);
            }
            else
            {
                if (!StyxWoW.Me.Mounted && Mount.ShouldMount(moveto) && Mount.CanMount())
                {
                    Mount.MountUp(() => moveto);
                }
                var result = Navigator.MoveTo(moveto);
                if (result != MoveResult.Failed && result != MoveResult.PathGenerationFailed)
                {
                    InactivityDetector.Reset();
                }
            }
            return(true);
        }
예제 #2
0
        public static async Task <bool> DoFishing()
        {
            if (AutoAnglerBot.Instance.Profile.FishAtHotspot && !Navigator.AtLocation(AutoAnglerBot.Instance.Profile.CurrentPoint))
            {
                return(false);
            }

            if (AutoAnglerSettings.Instance.Poolfishing &&
                BotPoi.Current.Type != PoiType.Harvest)
            {
                return(false);
            }

            if (await CheckLootFrame())
            {
                return(true);
            }

            // refresh water walking if needed
            if (!Me.Mounted && WaterWalking.CanCast &&
                !WaterWalking.IsActive &&
                await WaterWalking.Cast())
            {
                return(true);
            }

            if (AutoAnglerSettings.Instance.Poolfishing)
            {
                var pool = BotPoi.Current.AsObject as WoWGameObject;
                if (pool == null || !pool.IsValid)
                {
                    BotPoi.Clear();
                    return(false);
                }

                if (await MoveToPool(pool))
                {
                    return(true);
                }
            }

            if (await EquipPole())
            {
                return(true);
            }

            if (await EquipHat())
            {
                return(true);
            }

            if (await Applylure())
            {
                return(true);
            }

            if (await Applybait())
            {
                return(true);
            }

            if (!AutoAnglerSettings.Instance.Poolfishing &&
                AutoAnglerBot.Instance.ShouldFaceWaterNow)
            {
                AutoAnglerBot.Instance.ShouldFaceWaterNow = false;
                if (await FaceWater())
                {
                    return(true);
                }
            }

            if (Me.Mounted && await CommonCoroutines.Dismount("Fishing"))
            {
                return(true);
            }

            if (!await Coroutine.Wait(10000, () => !Me.IsFalling))
            {
                AutoAnglerBot.Log("Falling for 10 seconds; I don't think this will end good.");
                return(false);
            }

            if (Me.IsSwimming)
            {
                await JumpOnWaterSurface();
            }

            if (Me.IsMoving)
            {
                WoWMovement.MoveStop();
                if (!await Coroutine.Wait(4000, () => !Me.IsMoving))
                {
                    return(false);
                }
            }
            // Checks if we got a bite and recasts if needed.
            if (await CheckFishLine())
            {
                return(true);
            }

            return(false);
        }