Facebook
From VNX5, 2 Years ago, written in JavaScript.
This paste is a reply to letterly just do it from paste it - view diff
Embed
Download Paste or View Raw
Hits: 91
  1. // **THIS SCRIPT IS NO LONGER SUPPORTED**
  2. // Use this instead: pastebin.com/WQRPj4bV
  3.  
  4.  
  5. // version 1.4.1
  6. // This is a small script I've been working on. It has several features, including bots, a pathfinder, texting, and an easy-to-use GUI with several settings.
  7.  
  8. // INSTALLATION:
  9. // 1. Copy this ENTIRE SCRIPT.
  10. // 2. Open cursors.io and make sure you are on the "Click to Begin" screen.
  11. // 3. Open inspect element then navigate to the "Console" tab.
  12. // 4. Paste the whole script in. It might take a few seconds.
  13. // 5. Press enter.
  14. // 6. Unless you know what you're doing, ignore the alerts that come up and don't change their values. You can only have a maximum of 2 bots on cursors.io.
  15. // 7. Wait until the popup that says they're connected, then you're good to go! Note that you must click to move. Some levels may kick you for doing so. By default moving DOES NOT CLICK, so you'll have to switch the pathfinder movement setting if you want to move.
  16.  
  17. // CONTROLS: (sorry mac users)
  18. //      Click: Move yourself and your bots to the specified location.
  19. //             You can only go AROUND walls, not THROUGH them.
  20. //        
  21. //      Shift + Click: Leave behind a bot at the specified location.
  22. //
  23. //      Alt + Click: Return an abandoned bot. You'll still have to click again to move it.
  24. //
  25. //      Ctrl + Click: Force yourself and your bots to move to the specified location.
  26. //                    The pathfinder will NOT work here.
  27. //
  28. //      Letters a-z (lowercase): Adds the specified character to your message. At the moment this will NOT show up.
  29. //
  30. //      Enter: Sends the typed in message. If you don't have any open bots, it will give an error.
  31. //
  32. //      NUMPAD1: Sets the moveMethod to 1 (Silent pathfinder)
  33. //
  34. //      NUMPAD2: Sets the moveMethod to 2 (Clicking pathfinder)
  35. //
  36. //      NUMPAD3: Sets the moveMethod to 3 (An unusable silent pathfinder (supposed to draw))
  37.  
  38.  
  39. // Below is the code for the script. Feel free to take it and change anything you'd like. If you've got any problems, join our discord server: discord.gg/WcDjD8w
  40.  
  41. var cps=100,
  42.     spamClicking = !1;
  43. function init(view, value, attr) {
  44.     function Class() {
  45.         attr.x = view.getUint16(value, true);
  46.         value += 2;
  47.         attr.y = view.getUint16(value, true);
  48.         value += 2;
  49.         attr.width = view.getUint16(value, true);
  50.         value += 2;
  51.         attr.height = view.getUint16(value, true);
  52.         value += 2;
  53.     }
  54.  
  55.     function done() {
  56.         var color = view.getUint32(value, true).toString(16);
  57.         for (; 6 > color.length;) {
  58.             color = "0" + color;
  59.         }
  60.         value += 4;
  61.         attr.color = "#" + color;
  62.     }
  63.     var name = view.getUint8(value);
  64.     value += 1;
  65.     attr.type = name;
  66.     switch (name) {
  67.         case 255:
  68.             break;
  69.         case 0:
  70.             attr.x = view.getUint16(value, true);
  71.             value += 2;
  72.             attr.y = view.getUint16(value, true);
  73.             value += 2;
  74.             attr.size = view.getUint8(value);
  75.             value += 1;
  76.             attr.isCentered = !!view.getUint8(value);
  77.             value += 1;
  78.             name = read(view, value);
  79.             attr.text = name[0];
  80.             value = name[1];
  81.             break;
  82.         case 1:
  83.             Class();
  84.             var py = !attr.color;
  85.             done();
  86.             break;
  87.             name = attr.x | 0;
  88.             var y = attr.y | 0;
  89.             var version = attr.width | 0;
  90.             var h = attr.height | 0;
  91.             if (py) {
  92.                 py = y;
  93.                 for (; py < y + h; ++py) {
  94.                     var info = name;
  95.                     for (; info < name + version; ++info) {
  96.                         ++tmp[info + 400 * py];
  97.                     }
  98.                 }
  99.             }
  100.             break;
  101.         case 2:
  102.             Class();
  103.             attr.isBad = !!view.getUint8(value);
  104.             value += 1;
  105.             break;
  106.         case 3:
  107.             Class();
  108.             attr.count = view.getUint16(value, true);
  109.             value += 2;
  110.             done();
  111.             break;
  112.         case 4:
  113.             Class();
  114.             attr.count = view.getUint16(value, true);
  115.             value += 2;
  116.             done();
  117.             break;
  118.         default:
  119.             throw Error("Unknown object type " + name);;
  120.     }
  121.     return value;
  122. }
  123.  
  124. function read(view, offset) {
  125.     var optsData = "";
  126.     var lo = 0;
  127.     var chunk = 0;
  128.     for (; 0 != (chunk = view.getUint8(offset)); ++offset) {
  129.         lo <<= 8;
  130.         lo |= chunk;
  131.         if (!(chunk & 128)) {
  132.             optsData += String.fromCharCode(lo);
  133.             lo = 0;
  134.         }
  135.     }
  136.     if (0 != lo) {
  137.         optsData += String.fromCharCode(lo);
  138.     }
  139.     return [optsData, offset + 1];
  140. }
  141.  
  142. function proc(data) {
  143.     var view = new DataView(data.buffer),
  144.         v, index, parts, x;
  145.     if (view.getUint8(0) == 1) {
  146.         var push = function(view, element) {
  147.             return element + 2 + 4 * view.getUint16(element, true)
  148.         };
  149.         index = view.getUint16(1, true);
  150.         index = push(view, 3 + 8 * index);
  151.         v = view.getUint16(index, true);
  152.         index += 2;
  153.         parts = 0;
  154.         for (; parts < v; parts++) {
  155.             x = view.getUint32(index, true);
  156.             item = 0;
  157.             a: for (; item < items.length; item++) {
  158.                 if (items[item].id == x) {
  159.                     items.splice(item, 1);
  160.                     break a;
  161.                 }
  162.             }
  163.             index += 4;
  164.         }
  165.         v = view.getUint16(index, true);
  166.         index += 2;
  167.         parts = 0;
  168.         for (; parts < v; parts++) {
  169.             a: {
  170.                 item = view.getUint32(index, true);x = 0;
  171.                 for (; x < items.length; x++) {
  172.                     if (items[x].id == item) {
  173.                         item = items[x];
  174.                         break a;
  175.                     }
  176.                 }
  177.                 item = {
  178.                     id: item
  179.                 };items.push(item);
  180.             }
  181.             index += 4;index = init(view, index, item);
  182.         }
  183.         return;
  184.     }
  185.     items = [];
  186.     head = [view.getUint16(1, true), view.getUint16(3, true)];
  187.     v = view.getUint16(5, true);
  188.     index = 7;
  189.     parts = 0;
  190.     for (; parts < v; parts++) {
  191.         item = {};
  192.         item.id = view.getUint32(index, true);
  193.         index += 4;
  194.         index = init(view, index, item);
  195.         if (item.x > 0) item.x--, item.width++;
  196.         if (item.y > 0) item.y--, item.height++;
  197.         if (item.x + item.width < 400) item.width++;
  198.         if (item.y + item.height < 300) item.height++;
  199.         items.push(item);
  200.     }
  201. }
  202.  
  203. var avoidGreenArea = false
  204. function dos(head) { // Pathfinder
  205.     var gridX = 400,
  206.         gridY = 300;
  207.     var grid = [];
  208.     visit = [];
  209.     for (var i = 0; i < gridY; i++) {
  210.         grid[i] = [];
  211.         visit[i] = [];
  212.         for (var j = 0; j < gridX; j++) grid[i][j] = 0, visit[i][j] = 0;
  213.     }
  214.     items.forEach(function(d) {
  215.         if ((d.type == 1) || (d.type == 2 && (d.isBad || avoidGreenArea)))
  216.             for (var j = 0; j < d.height; j++) {
  217.                 if (d.y+j<=299) for (var i = 0; i < d.width; i++) {
  218.                     if (d.x+i<=399) grid[d.y + j][d.x + i] = 3
  219.                 }
  220.             }
  221.     });
  222.     var bfs = [head],
  223.         bfs2 = [];
  224.     while (bfs.length) {
  225.         bfs.forEach(function(dat) {
  226.             var x = dat[0],
  227.                 y = dat[1];
  228.             if (grid[y][x] == 3) return;
  229.             grid[y][x] = 3;
  230.             for (var X = x + 1; X < gridX && !(grid[y][X] & 1); X++) {
  231.                 grid[y][X] |= 1;
  232.                 if (!visit[y][X]) {
  233.                     visit[y][X] = [x, y], bfs2.push([X, y]);
  234.                 }
  235.             }
  236.             for (var X = x - 1; X >= 0 && !(grid[y][X] & 1); X--) {
  237.                 grid[y][X] |= 1;
  238.                 if (!visit[y][X]) {
  239.                     visit[y][X] = [x, y], bfs2.push([X, y]);
  240.                 }
  241.             }
  242.             for (var Y = y + 1; Y < gridY && !(grid[Y][x] & 2); Y++) {
  243.                 grid[Y][x] |= 2;
  244.                 if (!visit[Y][x]) {
  245.                     visit[Y][x] = [x, y], bfs2.push([x, Y]);
  246.                 }
  247.             }
  248.             for (var Y = y - 1; Y >= 0 && !(grid[Y][x] & 2); Y--) {
  249.                 grid[Y][x] |= 2;
  250.                 if (!visit[Y][x]) {
  251.                     visit[Y][x] = [x, y], bfs2.push([x, Y]);
  252.                 }
  253.             }
  254.         });
  255.         bfs = bfs2;
  256.         bfs2 = [];
  257.     }
  258. }
  259. var tmp = WebSocket.prototype.send;
  260. WebSocket.prototype.send = function(x) {
  261.     WebSocket.prototype.send = tmp;
  262.     tmp = this;
  263.     this.send = function() {};
  264.     var t2 = this.onmessage;
  265.     this.onmessage = function(x) {
  266.         var msg = new Uint8Array(x.data);
  267.         if (msg[0] == 1 || msg[0] == 4) {
  268.             proc(msg);
  269.         }
  270.         return t2.call(this, x)
  271.     }
  272. }
  273. var ff = navigator.userAgent.indexOf("Chrome") == -1;
  274. var num_1 = prompt('1/2 WebSocket Location (where to connect. only change if you know what you\'re doing)', 'ws://157.245.226.69:2828'),
  275.     num_2 = 0,
  276.     num_3 = 1 * prompt('2/2 WebSocket Total (how many bots. only change if you know what you\'re doing.', 2);
  277. console.log(num_1);
  278. var pool = [],
  279.     cursors = [];
  280. if (!isNaN(parseInt(num_3))) {
  281.     alert('Result: Valid WebSocket total. Connecting bots...');
  282. } else alert('Result: Invalid WebSocket total.');
  283. if (!isNaN(parseInt(num_3))) {
  284.     for (var i = 0; i < num_3; i++) {
  285.         pool.push(new WebSocket(`${num_1}`)); // websocket
  286.     }
  287.     pool[num_3-1].onopen = function(x){alert('Result: All bots have been successfully connected.')};
  288. }
  289. var position = [];
  290. canvas.onclick = function(e) {
  291.     var xy = [(e.layerX - (ff ? canvas.offsetLeft : 0)) / 2 | 0, (e.layerY - (ff ? canvas.offsetTop : 0)) / 2 | 0];
  292.     position = [(e.layerX - (ff ? canvas.offsetLeft : 0)) / 2 | 0, (e.layerY - (ff ? canvas.offsetTop : 0)) / 2 | 0];
  293.     var mov = [];
  294.     if (e.altKey) {
  295.         if (cursors.length < 1) return;
  296.         for (ii=0;ii<cursors.length;ii++) {
  297.             pool.push(cursors.shift());
  298.         }
  299.        return;
  300.     }
  301.     if (window["items"] && !(xy[0] == head[0] && xy[1] == head[1]) && !e.ctrlKey) {
  302.         dos(head);
  303.         var xy2 = xy.slice(0);
  304.         while (visit[xy2[1]][xy2[0]]) {
  305.             mov.push(xy2);
  306.             xy2 = visit[xy2[1]][xy2[0]]
  307.         }
  308.         mov = mov.reverse();
  309.     } else mov.push(xy);
  310.     if (mov.length == 0) {
  311.         return;
  312.     }
  313.     if (!e.shiftKey) {
  314.         head = xy;
  315.         pool.forEach(function(x) {
  316.             move(x, mov)
  317.         });
  318.         move(tmp, mov);
  319.         var buf = new ArrayBuffer(9),
  320.             q = new DataView(buf);
  321.         q.setUint8(0, 2, 1);
  322.         q.setUint16(1, xy[0], 1);
  323.         q.setUint16(3, xy[1], 1);
  324.         q.setInt32(5, -1, 1);
  325.         return;
  326.     }
  327.     var buf = new ArrayBuffer(9),
  328.         q = new DataView(buf);
  329.     q.setUint8(0, 2, 1);
  330.     q.setUint16(1, xy[0], 1);
  331.     q.setUint16(3, xy[1], 1);
  332.     q.setInt32(5, -1, 1);
  333.     cursors.push(pool.pop());
  334.     cursors[cursors.length - 1].click = buf;
  335.     move(cursors[cursors.length - 1], mov);
  336. }
  337.  
  338. var fontSize = 2;
  339. var letterOffset = 0;
  340. var alphabet = new Array(200);
  341. var mainCursorWriting = true;
  342. var botWriting = true;
  343. var fontType = 'basic';
  344. alphabet[58]=[[0,0,0,1],[2,0,2,1]],alphabet[40]=[[0,2,1,0],[2,2,1,0]],alphabet[41]=[[0,0,1,2],[2,0,1,2]],alphabet[63]=[[1,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,1],[1,1,2,1]],alphabet[97]=[[2,0,0,0],[0,0,0,2],[0,2,2,2],[1,0,1,2]],alphabet[98]=[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0],[1,0,1,2]],alphabet[99]=[[2,2,2,0],[2,0,0,0],[0,0,0,2]],alphabet[100]=[[2,0,0,0],[0,0,0,1],[0,1,1,2],[1,2,2,1],[2,1,2,0]],alphabet[101]=[[2,2,2,0],[2,0,0,0],[0,0,0,2],[1,0,1,2]],alphabet[102]=[[2,0,0,0],[0,0,0,2],[1,0,1,2]],alphabet[103]=[[1,1,1,2],[1,2,2,2],[2,2,2,0],[2,0,0,0],[0,0,0,2]],alphabet[104]=[[0,0,2,0],[0,2,2,2],[1,0,1,2]],alphabet[105]=[[0,0,0,2],[0,1,2,1],[2,0,2,2]],alphabet[106]=[[0,0,0,2],[0,1,2,1],[2,0,2,1]],alphabet[107]=[[0,0,2,0],[1,0,0,2],[1,0,2,2]],alphabet[108]=[[0,0,2,0],[2,0,2,2]],alphabet[109]=[[0,0,2,0],[0,0,2,1],[2,1,0,2],[0,2,2,2]],alphabet[110]=[[0,0,2,0],[0,0,2,2],[0,2,2,2]],alphabet[111]=[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0]],alphabet[112]=[[2,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,0]],alphabet[113]=[[2,0,0,0],[0,0,0,2],[0,2,2,2],[2,2,2,0],[1,1,2,2]],alphabet[114]=[[2,0,0,0],[0,0,0,2],[0,2,1,2],[1,2,1,0],[1,1,2,2]],alphabet[115]=[[0,0,0,2],[1,0,1,2],[2,0,2,2],[0,0,1,0],[1,2,2,2]],alphabet[116]=[[0,0,0,2],[0,1,2,1]],alphabet[117]=[[0,0,2,0],[0,2,2,2],[2,0,2,2]],alphabet[118]=[[0,0,2,1],[0,2,2,1]],alphabet[119]=[[0,0,2,0],[0,2,2,2],[2,0,1,1],[2,2,1,1]],alphabet[120]=[[0,0,2,2],[2,0,0,2]],alphabet[121]=[[0,0,1,1],[0,2,1,1],[1,1,2,1]],alphabet[122]=[[0,0,0,2],[0,2,2,0],[2,0,2,2]],alphabet[48]=[[0,0,2,0],[2,0,2,2],[2,2,0,2],[0,2,0,0]],alphabet[49]=[[0,0,0,1],[0,1,2,1],[2,0,2,2]],alphabet[50]=[[0,0,0,2],[0,2,1,2],[1,2,1,0],[1,0,2,0],[2,0,2,2]],alphabet[51]=[[0,0,0,2],[0,2,2,2],[2,2,2,0],[1,0,1,2]],alphabet[52]=[[0,0,1,0],[1,0,1,2],[0,2,2,2]],alphabet[53]=[[0,2,0,0],[0,0,1,0],[1,0,1,2],[1,2,2,2],[2,2,2,0]],alphabet[54]=[[0,2,0,0],[0,0,2,0],[2,0,2,2],[2,2,1,2],[1,2,1,0]],alphabet[55]=[[0,0,0,2],[0,2,2,2],[1,1,1,2]],alphabet[56]=[[0,0,2,0],[2,0,2,2],[2,2,0,2],[0,2,0,0],[1,0,1,2]],alphabet[57]=[[2,0,2,2],[2,2,0,2],[0,2,0,0],[0,0,1,0],[1,0,1,2]];
  345. var message = '';
  346. var moveMethod = 1;
  347. function hkd(z) {
  348.     console.log(z);
  349.     switch(z.keyCode) {
  350.         case 8:
  351.         if (message.length <= 0) return;
  352.             z.preventDefault();
  353.             message = message.substring(0, message.length - 1);
  354.             break;
  355.     }
  356.  
  357.     // numpad keys
  358.     switch (z.code) {
  359.         case 'Numpad0':
  360.             spamClicking=!spamClicking
  361.             break;
  362.         case 'Numpad1':
  363.             moveMethod=1;
  364.             break;
  365.         case 'Numpad2':
  366.             moveMethod=2;
  367.             break;
  368.         case 'Numpad3':
  369.             moveMethod=3;
  370.             break;
  371.     }
  372.  
  373. }
  374.  
  375. function hkp(e) {
  376.     if ((e.keyCode >= 39 && e.keyCode <= 41) ||
  377.          e.keyCode == 44 || e.keyCode == 46 ||
  378.         (e.keyCode >= 48 && e.keyCode <= 59 && e.location == 0) ||
  379.         (e.keyCode >= 65 && e.keyCode <= 90) ||
  380.         (e.keyCode >= 97 && e.keyCode <= 122) ||
  381.          e.keyCode == 32 || e.keyCode == 63) {
  382.         message = message.concat(String.fromCharCode(e.keyCode));
  383.         return;
  384.     }
  385.     switch(e.keyCode) {
  386.         case 13:
  387.             drawWord(message.toLowerCase(), head[0], head[1]);
  388.             message = "";
  389.             e.preventDefault();
  390.             break;    
  391.         default:
  392.             return;
  393.     }
  394. }
  395.  
  396. var j=0;
  397. function drawLetter(a, x, y) {
  398.     var letter = alphabet[a];
  399.  
  400.     if (letter == null)
  401.         return;
  402.  
  403.     var g = new ArrayBuffer(9),
  404.         e = new DataView(g);
  405.  
  406.     for (var i = 0; i < letter.length; i++) {
  407.         e.setUint8(0, 3);
  408.         e.setUint16(1, x+alphabet[a][i][1]*fontSize, !0);
  409.         e.setUint16(3, y+alphabet[a][i][0]*fontSize, !0);
  410.         e.setUint16(5, x+alphabet[a][i][3]*fontSize, !0);
  411.         e.setUint16(7, y+alphabet[a][i][2]*fontSize, !0);
  412.         if (mainCursorWriting) {
  413.             if (j==0) WebSocket.prototype.send.call(tmp, g);
  414.             else if (botWriting) WebSocket.prototype.send.call(pool[j-1], g);
  415.             else WebSocket.prototype.send.call(tmp, g);
  416.         } else if (botWriting) {
  417.             if (j!=0) WebSocket.prototype.send.call(pool[j-1], g);
  418.             else if (mainCursorWriting) WebSocket.prototype.send.call(tmp, g);
  419.             else WebSocket.prototype.send.call(pool[j-1], g);
  420.         }
  421.         j++;
  422.         if (j>=(botWriting?pool.length:0)+(mainCursorWriting?1:0)) j=0;
  423.     }
  424. }
  425.  
  426. var timeout = 70,
  427.     wordIndex = 0;
  428. function drawWord(s, x, y) {
  429.     setTimeout(function () {
  430.         drawLetter(s.charCodeAt(0), x, y);
  431.         wordIndex++;
  432.         if (s.length > 0)
  433.             drawWord(s.substring(1, s.length), x+fontSize*3, y);
  434.         else {
  435.             wordIndex = 0;
  436.             letterOffset = 0;
  437.         }
  438.     }, timeout);
  439. }
  440.  
  441. document.onkeydown = hkd;
  442. document.onkeypress = hkp;
  443.  
  444. var pathfinderDelay = 0;
  445. function move(x, mov, type = moveMethod, i = 0) {
  446.     if (x.readyState != 1) return;
  447.     if (i == 0 && x) x.rdy = 0;
  448.     var buf = new ArrayBuffer(type==3?13:9),
  449.         q = new DataView(buf);
  450.     q.setUint8(0, type, 1);
  451.     if (type!==3 && i<mov.length) {
  452.         q.setUint16(1, mov[i][0], 1);
  453.         q.setUint16(3, mov[i][1], 1);
  454.         q.setInt32(5, -1, 1);
  455.     }
  456.     WebSocket.prototype.send.call(x, buf);
  457.     if (pathfinderDelay === 0) {
  458.         if (type!==3)for (i=0; i<mov.length;) {
  459.             if (x.readyState != 1) break;
  460.             if (i == 0 && x) x.rdy = 0;
  461.             q.setUint16(1, mov[i][0], 1);
  462.             q.setUint16(3, mov[i][1], 1);
  463.             WebSocket.prototype.send.call(x, buf);
  464.             i++;
  465.         }
  466.         q.setUint8(0, 2, 1),
  467.         q.setUint16(1, mov[mov.length-1][0], 1);
  468.         q.setUint16(3, mov[mov.length-1][1], 1),
  469.         q.setInt32(5, -1, 1);
  470.         WebSocket.prototype.send.call(x, buf);
  471.         if (x) x.rdy = 1;
  472.     } else {
  473.         setTimeout(function(){
  474.             move(x, mov, type, i+1);
  475.         }, pathfinderDelay)
  476.     }
  477.     x.rdy = 1;
  478. }
  479.  
  480. function returnAllBots() {
  481.     for (var i=0; i<cursors.length;) {
  482.         pool.push(cursors.shift());
  483.     }
  484. }
  485.  
  486. var disconnected = 0,
  487.     connected = 0,
  488.     disconnecting = 0,
  489.     connecting = 0;
  490.  
  491. function lop2() {
  492.     setInterval(function() {
  493.         disconnecting = 0, connecting = 0;
  494.         for (var i=0;i<pool.length;) {
  495.             if (pool[i].readyState == 1) {
  496.                 connecting++;
  497.             } else if (pool[i].readyState == 2 || pool[i].readyState == 3) {
  498.                 disconnecting++;
  499.             }; i++;
  500.         }; for (var i=0; i<cursors.length;) {
  501.             if (cursors[i].readyState == 1) {
  502.                 connecting++;
  503.             } else if (cursors[i].readyState == 2 || cursors[i].readyState == 3) {
  504.                 disconnecting++;
  505.             }; i++;
  506.         }
  507.     connected = connecting,
  508.     disconnected = disconnecting;
  509.     }, 200);
  510. }; lop2();
  511. var lop = setInterval(function() {
  512.     cursors.forEach(function(x) { // when you deploy a minion.
  513.         if (x) { // prevents error spam
  514.             if (x.rdy) { // if the bot has connected
  515.                 x.send(x.click);
  516.             }
  517.         }
  518.     });
  519. }, 1000 / cps);
  520.  
  521. setInterval(function() { // spam clicking/moving :D (new wall hack i guess) // doesn't work so far sry
  522.     pool.forEach(function(x) {
  523.         if (x && x.rdy && !!spamClicking) {
  524.             move(x, [head[0],head[1]], 2);
  525.         }
  526.     })
  527. }, 1000 / cps);
  528.  
  529. var darkTheme = true;
  530. document.body.style.cssText = "transition:1s;background-color:#000000;"
  531. canvas.style.backgroundColor = "#ffffff";
  532. noCursorLock.style.display = 'none';
  533. noCursorLock.checked = true;
  534. noDrawings.style.display = 'none';
  535. noCursorLock.parentElement.style.display = 'none';
  536. noDrawings.parentElement.style.display = 'none';
  537. var elementdisplay = document.createElement("CANVAS");
  538. document.body.appendChild(elementdisplay);
  539. var moreScripts = document.getElementsByTagName('a')[0];
  540. moreScripts.href = '';
  541. moreScripts.style.display = 'none';
  542. var advertisement = document.getElementsByTagName('div')[4];
  543. advertisement.style.display = 'none';
  544. var outline = document.getElementsByTagName('div')[1];
  545. outline.style.border = '5px solid #000000';
  546. outline.style.borderStyle = 'collapse';
  547. outline.style.margin = '20px auto 0px';
  548. var outline2 = document.getElementsByTagName('div')[3];
  549. outline2.style.fontSize = '0px';
  550. outline2.style.transition = '1s';
  551. var display = document.getElementsByTagName('canvas')[1];
  552. display.style.cssText = "background-color:#ffffff;width:800px;margin-left:calc(50% - 405px);margin-right:calc(50% - 405px);margin-top:0px;height:192px;border:5px solid #000000;border-style:collapse;";
  553. var dpl = display.getContext('2d');
  554. display.width = 800,
  555. display.height = 192;
  556. dpl.font = '12px NovaSquare';
  557. dpl.lineWidth = 2.5;
  558. display.onmousemove = function(e) { // for like buttons and stuff
  559.     var xy = [(e.layerX - (ff ? canvas.offsetLeft : 0)) | 0, (e.layerY - (ff ? canvas.offsetTop : 0)) | 0];
  560.     if ((xy[0] >= 249 && xy[0] <= 266) && (xy[1] >= 65 && xy[1] <= 80)) { // decrease pathfinder delay
  561.         display.style.cursor = 'pointer';
  562.     } else if ((xy[0] >= 302 && xy[0] <= 318) && (xy[1] >= 65 && xy[1] <= 80)) { // increase pathfinder delay
  563.         display.style.cursor = 'pointer';
  564.     } else if ((xy[0] >= 10 && xy[0] <= 133) && (xy[1] >= 122 && xy[1] <= 136)) { // return all bots
  565.         display.style.cursor = 'pointer';
  566.     } else if ((xy[0] >= 450 && xy[0] <= 468) && (xy[1] >= 95 && xy[1] <= 107)) { // decrease text delay
  567.         display.style.cursor = 'pointer';
  568.     } else if ((xy[0] >= 514 && xy[0] <= 532) && (xy[1] >= 95 && xy[1] <= 107)) { // increase text delay
  569.         display.style.cursor = 'pointer';
  570.     } else if ((xy[0] >= 609 && xy[0] <= 701) && (xy[1] >= 82 && xy[1] <= 97)) { // toggle dark theme
  571.         display.style.cursor = 'pointer';
  572.     } else if ((xy[0] >= 279 && xy[0] <= 326) && (xy[1] >= 82 && xy[1] <= 97)) { // toggle pathfinder mode
  573.         display.style.cursor = 'pointer';
  574.     } else if ((xy[0] >= 280 && xy[0] <= 316) && (xy[1] >= 97 && xy[1] <= 107)) { // toggle avoid exits
  575.         display.style.cursor = 'pointer';
  576.     } else display.style.cursor = 'auto';
  577. }
  578.  
  579. display.onmousedown = function(e) { // for like buttons and stuff
  580.     var xy = [(e.layerX - (ff ? canvas.offsetLeft : 0)) | 0, (e.layerY - (ff ? canvas.offsetTop : 0)) | 0];
  581.     if ((xy[0] >= 249 && xy[0] <= 266) && (xy[1] >= 65 && xy[1] <= 80)) { // decrease pathfinder delay
  582.         display.style.cursor = 'pointer';
  583.         pathfinderDelay -= 5;
  584.         if (pathfinderDelay < 0) pathfinderDelay = 0;
  585.     } else if ((xy[0] >= 302 && xy[0] <= 318) && (xy[1] >= 65 && xy[1] <= 80)) { // increase pathfinder delay
  586.         display.style.cursor = 'pointer';
  587.         pathfinderDelay += 5;
  588.         if (pathfinderDelay > 250) pathfinderDelay = 250;
  589.     } else if ((xy[0] >= 10 && xy[0] <= 133) && (xy[1] >= 122 && xy[1] <= 136)) { // return all bots
  590.         display.style.cursor = 'pointer';
  591.         returnAllBots();
  592.     } else if ((xy[0] >= 450 && xy[0] <= 468) && (xy[1] >= 95 && xy[1] <= 107)) { // decrease text delay
  593.         display.style.cursor = 'pointer';
  594.         timeout -= 10;
  595.         if (timeout < 25) timeout = 25;
  596.     } else if ((xy[0] >= 514 && xy[0] <= 532) && (xy[1] >= 95 && xy[1] <= 107)) { // increase text delay
  597.         display.style.cursor = 'pointer';
  598.         timeout += 10;
  599.         if (timeout > 750) timeout = 750;
  600.     } else if ((xy[0] >= 609 && xy[0] <= 701) && (xy[1] >= 82 && xy[1] <= 93)) { // toggle dark theme
  601.         display.style.cursor = 'pointer';
  602.         darkTheme=!darkTheme;
  603.         if (darkTheme == false) {
  604.             document.body.style.backgroundColor = '#ffffff';
  605.         }
  606.         else if (darkTheme == true) {
  607.             document.body.style.backgroundColor = '#000000';
  608.         }
  609.     } else if ((xy[0] >= 279 && xy[0] <= 326) && (xy[1] >= 82 && xy[1] <= 93)) { // toggle pathfinder mode
  610.         display.style.cursor = 'pointer';
  611.         moveMethod==2?moveMethod=1:moveMethod=2;
  612.     } else if ((xy[0] >= 280 && xy[0] <= 316) && (xy[1] >= 95 && xy[1] <= 107)) { // toggle avoid exits
  613.         display.style.cursor = 'pointer';
  614.         avoidGreenArea=!avoidGreenArea
  615.     } else display.style.cursor = 'auto';
  616. }
  617. function updateDisplay() {
  618.     dpl.save();
  619.     dpl.clearRect(0,0,800,192);
  620.  
  621.     // message display
  622.     dpl.lineWidth = 2.5;
  623.     dpl.font = '18px NovaSquare';
  624.     dpl.fillStyle = '#ffffff';
  625.     dpl.globalAlpha = 0.5;
  626.     dpl.strokeText('Message: '+message,10,28);
  627.     dpl.strokeRect(5,38,790,2.5);
  628.     dpl.globalAlpha = 1;
  629.     dpl.fillText('Message: '+message,10,28);
  630.     dpl.fillRect(5,38,790,2.5);
  631.  
  632.     // title display
  633.     dpl.font = '16px NovaSquare';
  634.     dpl.globalAlpha = 0.5;
  635.     dpl.strokeText('Bots',10,58);
  636.     dpl.strokeText('Pathfinder',210,58);
  637.     dpl.strokeText('Text',410,58);
  638.     dpl.strokeText('Miscellanious',610,58);
  639.     dpl.globalAlpha = 1;
  640.     dpl.fillText('Bots',10,58);
  641.     dpl.fillText('Pathfinder',210,58);
  642.     dpl.fillText('Text',410,58);
  643.     dpl.fillText('Miscellanious',610,58);
  644.  
  645.     // bots display
  646.     dpl.font = '12px NovaSquare';
  647.     dpl.globalAlpha = 0.5;
  648.     dpl.strokeText('Ready: '+pool.length,10,78);
  649.     dpl.strokeText('Deployed: '+cursors.length,10,92);
  650.     dpl.strokeText('Disconnected: '+disconnected,10,106);
  651.     dpl.strokeText('Connected: '+connected,10,120);
  652.     dpl.strokeText('[Return All Deployed]',10,134);
  653.     dpl.globalAlpha = 1;
  654.     dpl.fillText('Ready: '+pool.length,10,78);
  655.     dpl.fillText('Deployed: '+cursors.length,10,92);
  656.     dpl.fillText('Disconnected: '+disconnected,10,106);
  657.     dpl.fillText('Connected: '+connected,10,120);
  658.     dpl.fillText('[Return All Deployed]',10,134);
  659.  
  660.     // pathfinder display
  661.     dpl.font = '12px NovaSquare';
  662.     dpl.globalAlpha = 0.5;
  663.     dpl.strokeText('Delay: [<] '+pathfinderDelay+'ms [>]',210,78);
  664.     dpl.strokeText('Movement: '+(moveMethod==1?'[Normal]':moveMethod==2?'[Clicks]':'[?????]'),210,92);
  665.     dpl.strokeText('Avoid exits: ['+avoidGreenArea+']',210,106);
  666.     dpl.globalAlpha = 1;
  667.     dpl.fillText('Delay: [<] '+pathfinderDelay+'ms [>]',210,78);
  668.     dpl.fillText('Movement: '+(moveMethod==1?'[Normal]':moveMethod==2?'[Clicks]':'[?????]'),210,92);
  669.     dpl.fillText('Avoid exits: ['+avoidGreenArea+']',210,106);
  670.  
  671.     // text display
  672.     dpl.font = '12px NovaSquare';
  673.     dpl.globalAlpha = 0.5;
  674.     dpl.strokeText('Font: '+fontType,410,78);
  675.     dpl.strokeText('Size: '+fontSize,410,92);
  676.     dpl.strokeText('Delay: [<] '+timeout+'ms [>]',410,106);
  677.     dpl.globalAlpha = 1;
  678.     dpl.fillText('Font: '+fontType,410,78);
  679.     dpl.fillText('Size: '+fontSize,410,92);
  680.     dpl.fillText('Delay: [<] '+timeout+'ms [>]',410,106);
  681.  
  682.     // misc display
  683.     dpl.font = '12px NovaSquare';
  684.     dpl.globalAlpha = 0.5;
  685.     dpl.strokeText('Spam Clicking Rate: '+cps+'cps',610,78);
  686.     dpl.strokeText('[Change Theme]',610,92);
  687.     dpl.globalAlpha = 1;
  688.     dpl.fillText('Spam Clicking Rate: '+cps+'cps',610,78);
  689.     dpl.fillText('[Change Theme]',610,92);
  690.  
  691.     // credit display
  692.     dpl.font = '12px NovaSquare';
  693.     dpl.globalAlpha = 0.5;
  694.     dpl.strokeText('Created by 8y8x',790 - dpl.measureText('Created by 8y8x').width,168);
  695.     dpl.strokeText('Special thanks to cledis',790 - dpl.measureText('Special thanks to cledis').width,182);
  696.     dpl.globalAlpha = 1;
  697.     dpl.fillText('Created by 8y8x',790 - dpl.measureText('Created by 8y8x').width,168);
  698.     dpl.fillText('Special thanks to cledis',790 - dpl.measureText('Special thanks to cledis').width,182);
  699.  
  700.     dpl.restore();
  701.     requestAnimationFrame(updateDisplay);
  702. }
  703.  
  704. requestAnimationFrame(updateDisplay);
  705.  
  706.