gng
This commit is contained in:
+12
-17
@@ -1,35 +1,35 @@
|
||||
using Lithium;
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace Lua
|
||||
{
|
||||
internal static class RecoilEngine
|
||||
{
|
||||
// AA0077
|
||||
private const int VK_LBUTTON = 0x01;
|
||||
// AA0078
|
||||
private const int VK_RBUTTON = 0x02;
|
||||
|
||||
// AA0079
|
||||
[DllImport("user32.dll")]
|
||||
private static extern short GetAsyncKeyState(int vKey);
|
||||
|
||||
private static readonly Random _rng = new Random();
|
||||
// AA0080
|
||||
private static bool _jitterActive = false;
|
||||
// AA0081
|
||||
private static int _jitterStart = 0;
|
||||
// AA0082
|
||||
private static int _lastJitterEnd = 0;
|
||||
// AA0083
|
||||
private static double _remainderX, _remainderY;
|
||||
// AA0084
|
||||
private static double _jitterMultiplierX, _jitterMultiplierY;
|
||||
|
||||
// AA0085
|
||||
private static bool IsDown(int key)
|
||||
{
|
||||
return (GetAsyncKeyState(key) & 0x8000) != 0;
|
||||
}
|
||||
|
||||
public static void Start(MainWindow window)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
if (window.IsRecoilEnabled && Utils.IsPressed(VK_LBUTTON) && Utils.IsPressed(VK_RBUTTON))
|
||||
if (window.IsRecoilEnabled && IsDown(VK_LBUTTON) && IsDown(VK_RBUTTON))
|
||||
{
|
||||
HandleRecoilTick();
|
||||
}
|
||||
@@ -43,10 +43,9 @@ namespace Lua
|
||||
}
|
||||
}
|
||||
|
||||
// AA0086
|
||||
private static void HandleRecoilTick()
|
||||
{
|
||||
if (!Utils.IsPressed(VK_LBUTTON)) return;
|
||||
if (!IsDown(VK_LBUTTON)) return;
|
||||
|
||||
string setName = OperatorSets.CurrentSet;
|
||||
|
||||
@@ -58,7 +57,6 @@ namespace Lua
|
||||
ApplyRecoil(recoil);
|
||||
}
|
||||
|
||||
// AA0087
|
||||
private static void HandleJitter(int now)
|
||||
{
|
||||
if (!ConfigLoader.jitterEnabled) return;
|
||||
@@ -68,7 +66,6 @@ namespace Lua
|
||||
_jitterActive = true;
|
||||
_jitterStart = now;
|
||||
|
||||
// AA0088
|
||||
_jitterMultiplierX = (_rng.NextDouble() - 0.5) * 0.2;
|
||||
_jitterMultiplierY = (_rng.NextDouble() - 0.5) * 0.2;
|
||||
}
|
||||
@@ -81,7 +78,6 @@ namespace Lua
|
||||
}
|
||||
}
|
||||
|
||||
// AA0089
|
||||
private static void ApplyRecoil((double recoilX, double recoilY) recoil)
|
||||
{
|
||||
double moveX = recoil.recoilX;
|
||||
@@ -90,7 +86,6 @@ namespace Lua
|
||||
moveX += recoil.recoilX * _jitterMultiplierX;
|
||||
moveY += recoil.recoilY * _jitterMultiplierY;
|
||||
|
||||
// AA0090
|
||||
if (ConfigLoader.debitFlag1)
|
||||
{
|
||||
moveX *= 1.282;
|
||||
@@ -109,4 +104,4 @@ namespace Lua
|
||||
Utils.MoveMouse(ix, iy);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user