private static async Task <bool> Land() { if (!MovementManager.IsFlying || MovementManager.IsSwimming) { return(true); } int ticks = 0; if (await CommonTasks.CanLand() == CanLandResult.Yes) { while (ticks < 100 && await CommonTasks.Land()) { if (!MovementManager.IsFlying) { break; } await Coroutine.Sleep(100); ticks++; } if (ticks >= 100) { Logging.WriteVerbose("Timeout whilst trying to land."); } } else { var closestObject = GameObjectManager.GameObjects.OrderBy(r => r.DistanceSqr(Core.Me.Location)).FirstOrDefault(); if (await CommonTasks.DescendTo(closestObject.Y) == DescendToResult.Success) { MovementManager.StopDescending(); Logging.WriteVerbose("Manual descend complete."); } } return(true); }
private async Task <bool> InteractWithNode() { StatusText = "Interacting with node"; var attempts = 0; while (attempts++ < 5 && !CanDoAbility(Ability.Gig) && Behaviors.ShouldContinue && Poi.Current.Unit.IsVisible && Poi.Current.Unit.IsValid) { var ticks = 0; while (MovementManager.IsFlying && !MovementManager.IsDiving && ticks++ < 5 && Behaviors.ShouldContinue && Poi.Current.Unit.IsVisible && Poi.Current.Unit.IsValid) { var ground = ExProfileBehavior.Me.Location.GetFloor(5); if (Math.Abs(ground.Y - ExProfileBehavior.Me.Location.Y) > float.Epsilon) { if (Navigator.PlayerMover is IFlightEnabledPlayerMover mover && !mover.IsLanding && !mover.IsTakingOff) { await CommonTasks.DescendTo(ground.Y); } } await Coroutine.Sleep(200); } Poi.Current.Unit.Interact(); if (await Coroutine.Wait(WindowDelay, () => CanDoAbility(Ability.Gig))) { break; } if (attempts == 1 && WindowDelay <= 3000 && await Coroutine.Wait(WindowDelay, () => CanDoAbility(Ability.Gig))) { break; } if (FreeRange) { Logger.Warn(Localization.ExGather_GatherWindow, attempts); continue; } Logger.Warn(Localization.ExGather_GatherWindow2, attempts); SetFallbackGatherSpot(Node.Location, true); await MoveToGatherSpot(); } if (!CanDoAbility(Ability.Gig)) { if (!FreeRange) { await MoveFromGatherSpot(); } OnResetCachedDone(); return(false); } interactedWithNode = true; Logger.Verbose( Localization.ExGather_GatherStart, Node.EnglishName, ExProfileBehavior.Me.CurrentGP, ExProfileBehavior.Me.MaxGP, WorldManager.EorzaTime.ToShortTimeString()); BlacklistCurrentNode(); return(true); }
public static async Task <bool> Unstuck() { await CommonTasks.DescendTo(0); return(true); }
private async Task <bool> InteractWithNode() { StatusText = "Interacting with node"; var attempts = 0; while (attempts++ < 5 && !GatheringManager.WindowOpen && Behaviors.ShouldContinue && Poi.Current.Unit.IsVisible && Poi.Current.Unit.IsValid) { var ticks = 0; while (MovementManager.IsFlying && !MovementManager.IsDiving && ticks++ < 5 && Behaviors.ShouldContinue && Poi.Current.Unit.IsVisible && Poi.Current.Unit.IsValid) { var ground = ExProfileBehavior.Me.Location.GetFloor(5); if (Math.Abs(ground.Y - ExProfileBehavior.Me.Location.Y) > float.Epsilon) { var mover = Navigator.PlayerMover as IFlightEnabledPlayerMover; if (mover != null && !mover.IsLanding && !mover.IsTakingOff) { await CommonTasks.DescendTo(ground.Y); } } await Coroutine.Sleep(200); } await Coroutine.Sleep(800); Poi.Current.Unit.Interact(); if (await Coroutine.Wait(WindowDelay, () => GatheringManager.WindowOpen)) { break; } if (attempts == 1 && WindowDelay <= 3000 && await Coroutine.Wait(WindowDelay, () => GatheringManager.WindowOpen)) { // wait double on first attempt if delay less than 2 seconds. break; } if (FreeRange) { Logger.Warn(Localization.Localization.ExGather_GatherWindow, attempts); continue; } Logger.Warn(Localization.Localization.ExGather_GatherWindow2, attempts); //SetFallbackGatherSpot(Node.Location, true); await MoveToGatherSpot(); } if (!GatheringManager.WindowOpen) { if (!FreeRange) { await MoveFromGatherSpot(); } OnResetCachedDone(); return(false); } interactedWithNode = true; Logger.Verbose( Localization.Localization.ExGather_GatherStart, Node.EnglishName, ExProfileBehavior.Me.CurrentGP, ExProfileBehavior.Me.MaxGP, WorldManager.EorzaTime.ToShortTimeString()); if (!this.Node.IsUnspoiled() && !this.Node.IsConcealed()) { BlacklistCurrentNode(); } if (!await ResolveGatherItem()) { await CloseGatheringWindow(); ResetInternal(); await Coroutine.Wait(2000, () => ExProfileBehavior.Me.InCombat || ActionManager.CanMount == 0); return(false); } CheckForGatherRotationOverride(); return(true); }