Advertisement
Guest User

Untitled

a guest
Mar 28th, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 5.74 KB | None | 0 0
  1. #include <iostream>
  2. #include <windows.h>
  3. #include <ctime>
  4. #include <cmath>
  5. #include <thread>
  6. #include <random>
  7. #define write std::cout <<
  8. #define scan std::cin >>
  9.  
  10. int mousecoord_x_normalised = 0;
  11. int mousecoord_y_normalised = 0;
  12. int mousecoord_x = 0;
  13. int mousecoord_y = 0;
  14. int globaltoggle = 0;
  15.  
  16. void MouseCoordinatesRead()
  17. {
  18.     POINT save;
  19.     GetCursorPos(&save);
  20.     write '\n';
  21.     write "Coordinate X: "<<save.x;
  22.     mousecoord_x = save.x;
  23.     mousecoord_y = save.y;
  24.     write '\n';
  25.     write "Coordinate Y: " << save.y;
  26. }
  27. void MouseCoordinates()
  28. {
  29.     POINT save;
  30.     GetCursorPos(&save);
  31.     mousecoord_x = save.x;
  32.     mousecoord_y = save.y;
  33. }
  34.  
  35. void MouseCoordinatesNormalised()
  36. {
  37.     POINT save;
  38.     GetCursorPos(&save);
  39.     /*write '\n';
  40.     write "Coordinate X: "<<save.x;*/
  41.     mousecoord_x_normalised = ceil(save.x * 34.1328125);
  42.     mousecoord_y_normalised = ceil(save.y * 60.680555555555555555555555555556);
  43.     /*write '\n';
  44.     write "Coordinate Y: " << save.y;*/
  45. }
  46.  
  47. void KeyboardSetup(INPUT* buffer)
  48. {
  49.     buffer->type = INPUT_KEYBOARD;
  50.     buffer->ki.wScan = 0;
  51.     buffer->ki.time = 0;
  52.     buffer->ki.dwExtraInfo = 0;
  53. }
  54.  
  55. void KeyDown(INPUT* buffer, int selection)
  56. {
  57.     buffer->ki.wVk = (char)selection;
  58.     buffer->ki.dwFlags = 0;
  59.     SendInput(1, buffer, sizeof(INPUT));
  60. }
  61.  
  62. void KeyUp(INPUT* buffer, int selection)
  63. {
  64.     buffer->ki.wVk = (char)selection;
  65.     buffer->ki.dwFlags = KEYEVENTF_KEYUP;
  66.     SendInput(1, buffer, sizeof(INPUT));
  67. }
  68.  
  69. void SimulateKeyDown(int selection)
  70. {
  71.     INPUT buffer;
  72.     KeyboardSetup(&buffer);
  73.     KeyDown(&buffer, (char)selection);
  74. }
  75. void SimulateKeyUp(int selection)
  76. {
  77.     INPUT buffer;
  78.     KeyboardSetup(&buffer);
  79.     KeyUp(&buffer, (char)selection);
  80. }
  81.  
  82. void SimulateKeyPress(int selection)
  83. {
  84.     INPUT buffer;
  85.     KeyboardSetup(&buffer);
  86.     KeyDown(&buffer, selection-32);
  87.     KeyUp(&buffer, selection-32);
  88. }
  89.  
  90. void MouseSetup(INPUT* buffer)
  91. {
  92.     MouseCoordinatesNormalised();
  93.     buffer->type = INPUT_MOUSE;
  94.     buffer->mi.dx = (mousecoord_x_normalised);
  95.     buffer->mi.dy = (mousecoord_y_normalised );
  96.     buffer->mi.mouseData = 0;
  97.     buffer->mi.dwFlags = MOUSEEVENTF_ABSOLUTE;
  98.     buffer->mi.time = 0;
  99.     buffer->mi.dwExtraInfo = 0;
  100. }
  101.  
  102. void MouseMoveAbsolute(INPUT* buffer, int x, int y)
  103. {
  104.     buffer->mi.dx = (x );
  105.     buffer->mi.dy = (y );
  106.     buffer->mi.dwFlags = (MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_MOVE);
  107.  
  108.     SendInput(1, buffer, sizeof(INPUT));
  109. }
  110.  
  111. void MouseClick(INPUT* buffer)
  112. {
  113.     buffer->mi.dwFlags = (MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTDOWN);
  114.     SendInput(1, buffer, sizeof(INPUT));
  115.  
  116.  
  117.     buffer->mi.dwFlags = (MOUSEEVENTF_ABSOLUTE | MOUSEEVENTF_LEFTUP);
  118.     SendInput(1, buffer, sizeof(INPUT));
  119. }
  120.  
  121. void SimulateMove(int x, int y)
  122. {
  123.     INPUT buffer;
  124.     x = ceil(x * 34.1328125);
  125.     y = ceil(y * 60.680555555555555555555555555556);
  126.     MouseSetup(&buffer);
  127.     MouseMoveAbsolute(&buffer, x, y);
  128. }
  129. void SimulateClick()
  130. {
  131.     INPUT buffer;
  132.     MouseSetup(&buffer);
  133.     MouseClick(&buffer);
  134. }
  135.  
  136. void TestMouseCoordinates() {
  137.     POINT save;
  138.     for (int count = 0; count < 200; count++)
  139.     {
  140.         GetCursorPos(&save);
  141.         write "Coordinate X: "<<save.x;
  142.         write '\n';
  143.         write "Coordinate Y: "<<save.y;
  144.         SimulateMove(save.x, save.y);
  145.     }
  146. }
  147.  
  148. void GameTickWait(int amount_of_ticks)
  149. {
  150.     int amnt = amount_of_ticks * 600;
  151.     Sleep(amnt);
  152. }
  153.  
  154. void alchbot() {
  155.     Sleep(1000);
  156.     MouseCoordinatesNormalised();
  157.     int counter_click = 0;
  158.  
  159.     while (true) {
  160.  
  161.         int times = rand() % 150 + 50;
  162.         printf("\n\nHow many times: %d\n", times);
  163.         for (int x = 0; x < times; x++)
  164.         {
  165.             SimulateMove(1743, 580);
  166.             SimulateClick();
  167.             counter_click++;
  168.             int chance = rand() % 1000;
  169.             if (chance > 700)
  170.             {
  171.                 x--;
  172.                 printf("\nLucky proc!");
  173.             }
  174.  
  175.             int interval = rand() % 40 + 130;
  176.  
  177.  
  178.             printf(" Pause duration (ms): %d\n", interval);
  179.             SimulateMove(3, 3);
  180.             int smallpause = rand() % 1000;
  181.             if (smallpause < 150)
  182.             {
  183.                 Sleep(100);
  184.                 printf("\ntiny pause!\n");
  185.             }
  186.             Sleep(interval);
  187.         }
  188.         printf("\nNumber of clicks: %d\n", counter_click);
  189.         counter_click = 0;
  190.  
  191.         char yo[80];
  192.     }
  193. }
  194.  
  195. int globalrng = 1;
  196.  
  197. void alchhelper()
  198. {
  199.         //srand(time(NULL));
  200.         MouseCoordinates();
  201.         if (mousecoord_x > 1864 && mousecoord_x<1872 && mousecoord_y>835 && mousecoord_y<851)
  202.         {
  203.             write "\nCLICK!\n";
  204.             SimulateClick();
  205.         }
  206.  
  207.         std::mt19937 rng(std::random_device{}());
  208.         std::uniform_int_distribution<> dist(150, 200);
  209.  
  210.  
  211.  
  212.  
  213.         int interval = dist(rng) + globalrng;
  214.         if (interval > 195)
  215.         {
  216.             globalrng = 1;
  217.         }
  218.         int smallpauseduration = rand() % 600 + 50;
  219.         int smallpause = rand() % 1000;
  220.         if (smallpause > 250)
  221.         {
  222.             Sleep(smallpauseduration);
  223.             printf("\ntiny pause add: ");
  224.             write  "+ " << smallpauseduration;
  225.         }
  226.         Sleep(interval);
  227.         write "\nRegular pause: " << interval;
  228. }
  229.  
  230. int isKeyPressed(int x)
  231. {
  232.     int ispressed=GetAsyncKeyState(x);
  233.     if (ispressed == 0) {
  234.         return ispressed;
  235.     }
  236.     else return 1;
  237.  
  238. }
  239.  
  240. int leftrighttoggle()
  241. {
  242.     int on = isKeyPressed(0x25);
  243.     int off = isKeyPressed(0x27);
  244.  
  245.     if (on==1) {
  246.         return 1;
  247.     }
  248.     if (off == 1) {
  249.         return 0;
  250.     }
  251. }
  252.  
  253. void coordreader()
  254. {
  255.     while (1)
  256.     {
  257.         int toggle = globaltoggle;
  258.         if (toggle) {
  259.             system("cls");
  260.             MouseCoordinatesRead();
  261.             if (isKeyPressed(0x01)) {
  262.                 write "  CLICK!";
  263.                 Sleep(100);
  264.             }
  265.         }
  266.         Sleep(16);
  267.     }
  268. }
  269.  
  270. void improvedalchhelp()
  271. {
  272.     while (1)
  273.     {
  274.         if (globaltoggle)
  275.         {
  276.             alchhelper();
  277.         }
  278.     }
  279. }
  280.  
  281.  
  282.  
  283.  
  284. int main_t_one() {
  285.     while (1)
  286.     {
  287.         globaltoggle=leftrighttoggle();
  288.     }
  289.     return  0;
  290. }
  291.  
  292. void asynctimer()
  293. {
  294.     while (1) {
  295.         globalrng++;
  296.         globalrng = globalrng + (rand() % 15);
  297.         if (globalrng > 60) {
  298.             globalrng = 0;
  299.         }
  300.     }
  301. }
  302.  
  303.  
  304. int main(int argc, char* argv[])
  305. {
  306.     //https://docs.microsoft.com/en-us/windows/win32/inputdev/virtual-key-codes
  307.     std::thread t_one(main_t_one);
  308.     std::thread t_two (asynctimer);
  309.  
  310.     improvedalchhelp();
  311.  
  312.     return 0;
  313. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement