vike256 / Unibot

All in one video game assistant tool that works with and without hardware. Has aim assist, autoshoot, rapid-fire, and recoil mitigation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Esp32

maropboia opened this issue · comments

#include <WiFi.h>
#include <BleMouse.h>

const char* ssid = "WIFI_NAME"; // Your WiFi credentials
const char* password = "WIFI_PASSWORD";

int port = 50123; // Port for communication
int x = 0;
int y = 0;
String cmd = "";
char symbols[] = "-,0123456789";
char code[] = "UNIBOTCYPHER";
bool encrypt = false;

void decryptCommand(String &command) {
// ... (decryption logic remains the same)
}

// Wemos R32 Pin Assignments:
#define RX_PIN 3
#define TX_PIN 1

WiFiServer server(port);
WiFiClient client;

BleMouse bleMouse; // BLE Mouse object

void setup() {
// Initialize Serial:
Serial.begin(115200);
delay(100);

// Start BLE Mouse Functionality:
bleMouse.begin();

// WiFi Setup (Specify Pins for R32):
WiFi.begin(ssid, password, 6, 5, 4, 2); // Channel 6, GPIOs 5 & 4 for SDA/SCL
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
}
server.begin();
}

void loop() {
if (!client || !client.connected()) {
client = server.available();
}

while (client.connected() && bleMouse.isConnected()) {
String cmd = client.readStringUntil('\r');

if (cmd.length() > 0) {
  if (cmd[0] == 'M') {
    decryptCommand(cmd);
    int commaIndex = cmd.indexOf(',');
    if (commaIndex != -1) {
      x = cmd.substring(1, commaIndex).toInt();
      y = cmd.substring(commaIndex + 1).toInt();
      bleMouse.move(x, y);  // Use bleMouse.move
    }
  } else if (cmd[0] == 'C') {
    int randomDelay = random(40, 80);
    bleMouse.click(MOUSE_LEFT);   // Use bleMouse.click
    delay(randomDelay);
  } else if (cmd[0] == 'B') {
    if (cmd[1] == '1') {
      bleMouse.press(MOUSE_LEFT);   // Use bleMouse.press
    } else if (cmd[1] == '0') {
      bleMouse.release(MOUSE_LEFT);  // Use bleMouse.release
    }
  }
  client.print("a\r\n");
  client.flush();
}

}
delay(1);
}