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); }
private async Task <bool> MainCoroutine() { var activeMover = WoWMovement.ActiveMover; if (activeMover == null) { return(false); } var immediateDestination = FindImmediateDestination(); // If we've no way to reach destination, inform user and quit... if (!Flightor.CanFly && !Navigator.CanNavigateWithin(Me.Location, immediateDestination, (float)DefaultArrivalTolerance)) { QBCLog.Fatal("Toon doesn't have flying capability in this area, and there is no ground path to the destination." + " Please learn the flying skill appropriate for this area."); BehaviorDone(); return(false); } // 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... Flightor.MoveTo(immediateDestination, !IgnoreIndoors); return(true); }