protected override RunStatus Run(object context) { float?bestDirection = GetFaceWaterDirection(); if (bestDirection.HasValue && !WoWMathHelper.IsFacing(_me.Location, _me.Rotation, _me.Location.RayCast(bestDirection.Value, 10f), WoWMathHelper.DegreesToRadians(15))) { AutoAngler.Instance.Log("auto facing towards water"); _me.SetFacing(bestDirection.Value); } return(RunStatus.Failure); }
public async static Task <bool> FaceWater() { float?bestDirection = GetFaceWaterDirection(); if (bestDirection.HasValue && !WoWMathHelper.IsFacing(StyxWoW.Me.Location, StyxWoW.Me.Rotation, StyxWoW.Me.Location.RayCast(bestDirection.Value, 10f), WoWMathHelper.DegreesToRadians(15))) { AutoAnglerBot.Log("auto facing towards water"); Me.SetFacing(bestDirection.Value); } return(false); }
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); }
//if pool is between CurrentPoint and NextPoint then cycle to nextPoint public void CycleToNextIfBehind(WoWGameObject pool) { WoWPoint cp = CurrentPoint; WoWPoint point = GetNextWayPoint(); point = new WoWPoint(point.X - cp.X, point.Y - cp.Y, 0); point.Normalize(); float angle = WoWMathHelper.NormalizeRadian((float)Math.Atan2(point.Y, point.X - 1)); if (WoWMathHelper.IsFacing(CurrentPoint, angle, pool.Location) && CurrentPoint != WayPoints[WayPoints.Count - 1]) { CycleToNextPoint(); } }