using ImGuiNET;
using ImGuiNET;
using ILoveWomen.Common;
using System;
using System.Threading;
using System.Threading.Tasks;
namespace ILoveWomen.Modules
{
public class AutoClicker
{
private bool _enabled = false;
private float _cps = 10.0f;
private bool _randomization = false;
private CancellationTokenSource? _clickerTokenSource;
private Task? _clickerTask;
if (prevEnabled != _enabled)
{
if (_enabled)
StartClicker();
else
StopClicker();
}
ImGui.Spacing();
ImGui.Spacing();
while (!token.IsCancellationRequested)
{
if (_enabled && Utils.IsMinecraftFocused() &&
Utils.IsKeyPressed(Utils.VK_LBUTTON))
{
int baseDelay = (int)(1000 / _cps);
int delay = baseDelay;
if (_randomization)
{
int variation = (int)(baseDelay * 0.2);
delay = random.Next(baseDelay - variation, baseDelay +
variation);
}
Utils.mouse_event(Utils.MOUSEEVENTF_LEFTUP, 0, 0, 0, 0);
Utils.mouse_event(Utils.MOUSEEVENTF_LEFTDOWN, 0, 0, 0, 0);