private async Task <bool> MainCoroutine() { var activeMover = WoWMovement.ActiveMover; if (activeMover == null) { return(false); } var immediateDestination = FindImmediateDestination(); // Arrived at destination? if (AtLocation(activeMover.Location, immediateDestination)) { var completionMessage = string.Format("Arrived at destination '{0}'", RoughDestination.Name); // Land if we need to... // NB: The act of landing may cause us to exceed the ArrivalTolerance specified. if (Land && Me.Mounted) { await UtilityCoroutine.LandAndDismount(string.Format("Landing at destination '{0}'", RoughDestination.Name)); BehaviorDone(completionMessage); return(true); } // Done... BehaviorDone(completionMessage); return(false); } // Do not run FlyTo when there is a PoI set... if (BotPoi.Current.Type != PoiType.None) { await Coroutine.Sleep(TimeSpan.FromSeconds(10)); QBCLog.DeveloperInfo("FlyTo temporarily suspended due to {0}", BotPoi.Current); return(true); } // Move closer to destination... var parameters = new FlyToParameters(immediateDestination) { CheckIndoors = !IgnoreIndoors }; if (MinHeight.HasValue) { parameters.MinHeight = MinHeight.Value; } Flightor.MoveTo(parameters); return(true); }
protected override async Task <bool> Main() { var immediateDestination = FindImmediateDestination(); if (AtLocation(Core.Player.Location, immediateDestination)) { var completionMessage = $"Arrived at destination {RoughDestination.Name}"; if (Land) { Log("Landing at destination {0}", RoughDestination.Name); var landed = await CommonTasks.Land(); if (landed) { if (Dismount) { ActionManager.Dismount(); } BehaviorDone(completionMessage); return(true); } Log("Failed to land at {0}", immediateDestination); return(false); } BehaviorDone(completionMessage); return(false); } var parameters = new FlyToParameters(immediateDestination) { CheckIndoors = !IgnoreIndoors }; if (MinHeight > 0) { parameters.MinHeight = MinHeight; } await CommonTasks.MountUp(); await CommonTasks.TakeOff(); Flightor.MoveTo(parameters); return(true); }
internal static async Task <bool> FlightorMove(Vector3 loc) { var moving = MoveResult.GeneratingPath; var target = new FlyToParameters(loc); while (!(moving == MoveResult.Done || moving == MoveResult.ReachedDestination || moving == MoveResult.Failed || moving == MoveResult.Failure || moving == MoveResult.PathGenerationFailed)) { moving = Flightor.MoveTo(target); await Coroutine.Yield(); } Navigator.PlayerMover.MoveStop(); return(moving == MoveResult.ReachedDestination); }
internal static async Task <bool> FlightorMove(FateData fate) { if (fate == null) { return(false); } var moving = MoveResult.GeneratingPath; var target = new FlyToParameters(fate.Location); while ((!(moving == MoveResult.Done || moving == MoveResult.ReachedDestination || moving == MoveResult.Failed || moving == MoveResult.Failure || moving == MoveResult.PathGenerationFailed)) && FateManager.ActiveFates.Any(i => i.Id == fate.Id && i.IsValid)) { moving = Flightor.MoveTo(target); await Coroutine.Yield(); } Navigator.PlayerMover.MoveStop(); return(moving == MoveResult.ReachedDestination); }
private static async Task <bool> TryFlightor(Vector3 destination, float?distanceTolerance) { // If a toon can't fly, skip this... // NB: Although Flightor will fall back to Navigator, there are side-effects. // Flightor will mount even if UseMount is disabled. So, if we don't want to mount // we don't want to even try Flightor; otherwise, unexpected side-effects can ensue. // TODO: There used to be a CanNavigateWithin check here, which is hard to replace. // Possibly make flightor's MoveTo return something to indicate whether it fails. FlyToParameters flyToParams = new FlyToParameters(destination) { MinHeight = 15f, CheckIndoors = true, }; if (distanceTolerance.HasValue) { flyToParams.GroundNavParameters.DistanceTolerance = distanceTolerance.Value; } Flightor.MoveTo(flyToParams); return(true); }
// End of B Tree #region FlightMovement private static async Task <bool> FlyTo(Vector3 destination, bool land = false, bool dismount = false, bool ignoreIndoors = true, float minHeight = 0f) { if (destination == Vector3.Zero) { return(false); } if (Core.Me.InCombat) { return(false); } while (!Core.Me.IsDead) { if (InPosition(destination)) { await StopMovement(); break; } if (CommonBehaviors.IsLoading) { await CommonTasks.HandleLoading(); break; } if (!Core.Me.IsMounted && Core.Me.Location.Distance(destination) > CharacterSettings.Instance.MountDistance) { await CommonTasks.SummonFlyingMount(); await Coroutine.Sleep(500); } var parameters = new FlyToParameters(destination) { CheckIndoors = !ignoreIndoors }; if (MovementManager.IsDiving) { parameters.CheckIndoors = false; } if (minHeight > 0) { parameters.MinHeight = minHeight; } Flightor.MoveTo(parameters); await Coroutine.Yield(); } if (!MovementManager.IsDiving && MovementManager.IsFlying && land) { await Land(); await Coroutine.Sleep(500); } if (Core.Me.IsMounted && dismount) { await Dismount(); await Coroutine.Sleep(500); } Flightor.Clear(); return(true); }