private static async Task <bool> HandleDismount() { Navigator.Clear(); Flightor.Clear(); while (Me.Mounted) { if (Me.Location.Distance(s_targetLocation) > 5) { await Coroutine.Wait(20000, () => Flightor.MoveTo(s_targetLocation) == MoveResult.ReachedDestination); } else { await CommonCoroutines.LandAndDismount(null, true, s_targetLocation); await CommonCoroutines.StopMoving(); var _target = Me.CurrentTarget; if (_target != null) { Lua.DoString("StartAttack()"); } } //await Coroutine.Yield(); } return(true); }
internal static async Task <bool> FlyTo2(Vector3 loc) { var moving = MoveResult.GeneratingPath; while (!(moving == MoveResult.Done || moving == MoveResult.ReachedDestination || moving == MoveResult.Failed || moving == MoveResult.Failure || moving == MoveResult.PathGenerationFailed)) { moving = Flightor.MoveTo(loc, 100f, false); await Coroutine.Yield(); } Flightor.Clear(); MovementManager.MoveStop(); 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); }