Advertisement
Guest User

Untitled

a guest
Jun 28th, 2017
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.47 KB | None | 0 0
  1. // ==UserScript==
  2. // @name #1 CLONE
  3. // @version 1.0
  4. // @description Bots For Cellcraft.io
  5. // @require https://cdnjs.cloudflare.com/ajax/libs/socket.io/1.7.3/socket.io.min.js
  6. // @author TrapKilloYT
  7. // @match http://cellcraft.io/*
  8. // @match http://agar.bio/
  9. // @match http://agarios.org/*
  10. // @grant none
  11. // ==/UserScript==
  12. setTimeout(function() {
  13. window.Client = {
  14. ip: null,
  15. x: 0,
  16. y: 0,
  17. log: false,
  18. byteLength: 0
  19. };
  20. const cmd = io("ws://localhost:8081");//ws://TrapBot-killotrap265412.codeanyapp.com:8081
  21.  
  22. function KeyOf(letter){
  23. return letter.charCodeAt(0);
  24. }
  25.  
  26. window.addEventListener("keydown", (e) => {
  27. if(e.keyCode == KeyOf("E")){
  28. cmd.emit("split", true);
  29. }
  30. if(e.keyCode == KeyOf("R")){
  31. cmd.emit("eject", true);
  32. }
  33. });
  34.  
  35. cmd.on('count', function(count) {
  36. $('#botCount').html(count);
  37. });
  38.  
  39. cmd.on('origin', {
  40. "origin": location.origin
  41. });
  42.  
  43. _WebSocket = window.WebSocket;
  44. $("#canvas").after("<div style='box-shadow: 0px 0px 20px black;z-index:9999999; background-color: #000000; -moz-opacity: 0.4; -khtml-opacity: 0.4; opacity: 0.7; zoom: 1; width: 205px; top: 300px; left: 10px; display: block; position: absolute; text-align: center; font-size: 15px; color: #ffffff; font-family: Ubuntu;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>Trap Client</a></div> <div style=' color:#ffffff; display: inline; -moz-opacity:1; -khtml-opacity: 1; opacity:1; filter:alpha(opacity=100); padding: 10px;'><br>Minions: <a id='botCount'>Offline</a> </div><button id='start-Bots' style='display: block;border-radius: 5px;border: 2px solid #6495ED;background-color: #BCD2EE;height: 50px;width: 120px;margin: auto;text-align: center;'>StartBots </button><marquee>TrapKillo - Owner</marquee> </div>");
  45. function refer(master, slave, prop) {
  46. Object.defineProperty(master, prop, {
  47. get: function(){
  48. return slave[prop];
  49. },
  50. set: function(val) {
  51. slave[prop] = val;
  52. },
  53. enumerable: true,
  54. configurable: true
  55. });
  56. }
  57. window.WebSocket = function(url, protocols) {
  58. if (protocols === undefined) {
  59. protocols = [];
  60. }
  61. var ws = new _WebSocket(url, protocols);
  62. refer(this, ws, 'binaryType');
  63. refer(this, ws, 'bufferedAmount');
  64. refer(this, ws, 'extensions');
  65. refer(this, ws, 'protocol');
  66. refer(this, ws, 'readyState');
  67. refer(this, ws, 'url');
  68. this.send = function(data) {
  69. if(Client.log) console.log(new Uint8Array(data));
  70. let msg = new DataView(arguments[0]);
  71. if(msg.byteLength == 21){ // Most clones
  72. if(msg.getInt8(0, true) == 16){
  73. Client.x = msg.getFloat64(1, true);
  74. Client.y = msg.getFloat64(9, true);
  75. Client.byteLength = msg.byteLength;
  76. }
  77. } else {
  78. if(msg.byteLength == 13){ // Agar.re, agarioforums.io, (maybe) warlis.io
  79. if(msg.getUint8(0, true) == 16){
  80. Client.x = msg.getFloat64(1, true);
  81. Client.y = msg.getFloat64(5, true);
  82. Client.byteLength = msg.byteLength;
  83. }
  84. }
  85. }
  86. cmd.emit("clientPosition", {
  87. x: Client.x,
  88. y: Client.y,
  89. byteLength: Client.byteLength
  90. });
  91. return ws.send.call(ws, data);
  92. };
  93. this.close = function() {
  94. return ws.close.call(ws);
  95. };
  96. this.onopen = function(event) {};
  97. this.onclose = function(event) {};
  98. this.onerror = function(event) {};
  99. this.onmessage = function(event) {};
  100. ws.onopen = function(event) {
  101. if(this.url !== null) Client.ip = this.url;
  102. start = function() {
  103. cmd.emit("serverIP", {
  104. ip: Client.ip
  105. });
  106. };
  107. if (this.onopen) return this.onopen.call(ws, event);
  108. }.bind(this);
  109. ws.onmessage = function(event) {
  110. if (this.onmessage) return this.onmessage.call(ws, event);
  111. }.bind(this);
  112. ws.onclose = function(event) {
  113. if (this.onclose) return this.onclose.call(ws, event);
  114. }.bind(this);
  115. ws.onerror = function(event) {
  116. console.log("[CLIENT]: WebSocker Error");
  117. if (this.onerror) return this.onerror.call(ws, event);
  118. }.bind(this);
  119. };
  120. document.getElementById('start-Bots').onclick = function() {
  121. start();
  122. };
  123. window.WebSocket.prototype = _WebSocket;
  124. },3000);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement