Advertisement
Guest User

Untitled

a guest
May 25th, 2019
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.82 KB | None | 0 0
  1. setTimeout(function() {
  2. "use strict";
  3.  
  4. window.botServer='SmartBots-esaelyt.codeanyapp.com:8081';
  5.  
  6. window.bot = {x:0, y:0, ip:null, byteLength:0};
  7. WebSocket.prototype.Asend = WebSocket.prototype.send;
  8. WebSocket.prototype.send = function(arrayBuffer) {
  9. this.Asend(arrayBuffer);
  10. var dataView = new DataView(arrayBuffer);
  11. if(dataView.byteLength === 21) {
  12. if(dataView.getUint8(0) === 16) {
  13. bot.x = dataView.getFloat64(1, true);
  14. bot.y = dataView.getFloat64(9, true);
  15. bot.byteLength = dataView.byteLengthsocket
  16. }
  17. };
  18. if(dataView.byteLength === 13) {
  19. if(dataView.getUint8(0) === 16) {
  20. bot.x = dataView.getInt32(1, true);
  21. bot.y = dataView.getInt32(5, true);
  22. bot.byteLength = dataView.byteLength
  23. }
  24. };
  25. if(dataView.byteLength === 5 || dataView.byteLength < 4) {
  26. if(dataView.getUint8(0) === 16) {
  27. bot.x = dataView.getInt16(1, true);
  28. bot.y = dataView.getInt16(3, true);
  29. bot.byteLength = dataView.byteLength
  30. }
  31. };
  32. if(this.url !== null) {
  33. bot.ip = this.url;
  34. console.log(bot.ip)
  35. }
  36. };
  37. if(window.botServer) {//Olaf4Snow customization. Added window.botServer line.
  38. var socket = io.connect('ws://' + window.botServer);
  39. } else {
  40. var socket = io.connect("ws://127.0.0.1:8081"); // <---- localhost:8081 // 127.0.0.1:8081 // if u want to use on vps ? UrVpsIp:8081
  41. }
  42. document.addEventListener("keydown", function(keyboardEvent) {
  43. if(keyboardEvent.key) {//Olaf4Snow customization. Added support for keyboardEvent.key
  44. switch(keyboardEvent.key) {
  45. case "e":
  46. socket.emit("split");
  47. break;
  48. case "r":
  49. socket.emit("eject");
  50. break;
  51. case "z":
  52. socket.emit("spam");
  53. break;
  54. }
  55. //Olaf4Snow customization.
  56. } else {
  57. var keyCharacterValue = keyboardEvent.keyCode || keyboardEvent.which;
  58. switch(keyCharacterValue) {
  59. case 69://Olaf4Snow customization. Was 69 ("E").
  60. socket.emit("split");
  61. break;
  62. case 82://Olaf4Snow customization. Was 82 ("R").
  63. socket.emit("eject");
  64. break;
  65. case 67://Olaf4Snow customization. Was 67 ("C").
  66. socket.emit("spam");
  67. break
  68. }
  69. }
  70. });
  71. setInterval(function() {
  72. socket.emit("movement", {x:bot.x, y:bot.y, byteLength:bot.byteLength})
  73. }, 100);
  74. setTimeout(function() {
  75. $( "#overlays" ).after( "<div style='box-shadow: 0px 0px 20px black;z-index:9999999; background-color: #0036FF; -moz-opacity: 0.4; -khtml-opacity: 0.4; opacity: 0.7; zoom: 1; width: 350px; top: 10px; left: 10px; display: block; position: absolute; text-align: center; font-size: 15px; color: #ffffff; font-family: castellar;border: 2px solid #0c31d4;'> <div style='color:#ffffff; display: inline; -moz-opacity:1; -khtml-opacity: 1; opacity:1;font-size: 22px; filter:alpha(opacity=100); padding: 10px;'><a>SmartBots</a></div> <div style=' color:#ffffff; display: inline; -moz-opacity:1; -khtml-opacity: 1; opacity:1; filter:alpha(opacity=100); padding: 10px;'><br>Bots Online: <a id='minionCount'>0</a> / 250</div><button id='start-bots' style='display: block;border-radius: 5px;border: 2px solid #6495ED;background-color: green;height: 50px;width: 120px;margin: auto;text-align: center;'>Start Bots</button><button id='stop-bots' style='display:none;border-radius: 5px;border: 2px solid #6495ED;background-color: red;height: 50px;width: 120px;margin: auto;text-align: center;'>Stop Bots</button></div>" );
  76. document.getElementById("start-bots").onclick = function() {
  77. socket.emit("start", {ip:bot.ip!== null?bot.ip:0, origin:location.origin})
  78. document.getElementById("start-bots").style.display = "none";//Olaf4Snow customization. Added bot "stop" button.
  79. document.getElementById("stop-bots").style.display = "inline-block";//Olaf4Snow customization. Added bot "stop" button.
  80. }
  81. document.getElementById("stop-bots").onclick = function() {//Olaf4Snow customization. Added bot "stop" button.
  82. socket.emit("stop")
  83. document.getElementById("stop-bots").style.display = "none";
  84. document.getElementById("start-bots").style.display = "inline-block";
  85. }
  86. }, 2000);
  87. socket.on("botCount", function(botCount) {
  88. $("#minionCount").html(botCount)
  89.  
  90. })
  91. }, 200)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement