private async Task <bool> UtilityCoroutine_MoveAndUseCatapult() { if (!Query.IsInVehicle() || !IsViable(SelectedCatapult)) { return(false); } // Move vehicle into position... if (!Navigator.AtLocation(CurrentTask.PositionForLaunch)) { Navigator.MoveTo(CurrentTask.PositionForLaunch); return(true); } // Adjust heading... if (!WoWMathHelper.IsFacing(WoWMovement.ActiveMover.Location, GetVehicleFacing(), CurrentTask.PositionToLand, WoWMathHelper.DegreesToRadians(0.5f))) { // Handle heading... double neededHeading = WoWMathHelper.CalculateNeededFacing(Me.Location, CurrentTask.PositionToLand); neededHeading = WoWMathHelper.NormalizeRadian((float)neededHeading); QBCLog.Info("Adjusting firing heading"); Me.SetFacing((float)neededHeading); await Coroutine.Sleep(200); return(true); } // Adjust azimuth... double currentAzimuth = WoWMathHelper.NormalizeRadian(Lua.GetReturnVal <float>("return VehicleAimGetAngle();", 0)); double neededAzimuth = NormalizeAngleToPi(CurrentTask.NeededAzimuth); double azimuthChangeRequired = neededAzimuth - currentAzimuth; if (Math.Abs(azimuthChangeRequired) >= 0.01) { QBCLog.Info("Adjusting firing azimuth"); // NB: VehicleAimIncrement() handles negative values of 'increment' correctly... Lua.DoString("VehicleAimIncrement({0})", azimuthChangeRequired); await Coroutine.Sleep(200); return(true); } // Fire.. QBCLog.Info("Firing Catapult"); Lua.DoString(Lua_LaunchCommand); await Coroutine.Wait(3000, () => !Query.IsInVehicle()); return(true); }
private static WoWPoint CalculatePointBehindTarget() { return (StyxWoW.Me.CurrentTarget.Location.RayCast( StyxWoW.Me.CurrentTarget.Rotation + WoWMathHelper.DegreesToRadians(150), 10f)); }
/// <summary> /// Calculates the point to move behind the targets location /// </summary> /// <returns>the WoWpoint location to move to</returns> private static WoWPoint CalculatePointBehindTarget() { return (Me.CurrentTarget.Location.RayCast( Me.CurrentTarget.Rotation + WoWMathHelper.DegreesToRadians(150), Spell.MeleeRange - 2f)); }