@Droidz
Here a idea on how to get it working for aiming, i hope it helps.
public static class Vehicle
{
public static bool UseButton(int num = 1)
{
//PetActionButton1
Lua.RunMacroText("/click [overridebar][vehicleui][possessbar,@vehicle,exists]OverrideActionBarButton" + num + ";ActionButton" + num);
return true;
}
public static void Aim(WoWUnit unit, float precision = 0.5f, float agleDelta = 0f)
{
ClickToMove.CGPlayer_C__ClickToMove(unit.Position.X, unit.Position.Y, unit.Position.Z, unit.Guid, (int)ClickToMoveType.Move, precision);
Thread.Sleep(Usefuls.Latency * 2);
var dist = ObjectManager.Me.Position.DistanceTo2D(unit.Position);
var height = unit.Position.Z - ObjectManager.Me.Position.Z;
var angle = robotManager.Helpful.Math.GetAngle(dist, height);
var radians = robotManager.Helpful.Math.DegreeToRadian(angle + agleDelta);
AimAngle(radians);
}
static void AimAngle(float radians)
{
var minDelta = 0.035f; //~5 degree
var delta = radians - CurrentAngle;
int timeMs = 30;
var timer = new robotManager.Helpful.Timer(5 * 1000);
var delta2 = 0f;
do
{
if (delta > 0)
wManager.Wow.Helpers.Keybindings.PressKeybindings(wManager.Wow.Enums.Keybindings.PITCHUP, timeMs);
else if (delta < 0)
wManager.Wow.Helpers.Keybindings.PressKeybindings(wManager.Wow.Enums.Keybindings.PITCHDOWN, timeMs);
delta2 = radians - CurrentAngle;
if (System.Math.Abs(delta2) < minDelta)
return;
if (delta < 0 && delta2 >= 0)
return;
if (delta > 0 && delta2 <= 0)
return;
}
while (Conditions.InGameAndConnectedAndAliveAndProductStartedNotInPause && ObjectManager.Me.PlayerUsingVehicle && !timer.IsReady);
}
public static float CurrentAngle
{
get
{
return Lua.LuaDoString<float>("return VehicleAimGetAngle()");
}
}
}