Advertisement
Thinkatron

Nitrotype Bot

Sep 23rd, 2016
2,091
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
jQuery 3.92 KB | None | 0 0
  1. // ==UserScript==
  2. // @name         Nitrotype
  3. // @namespace    http://tampermonkey.net/
  4. // @version      0.4
  5. // @description  An auto-typing bot for Nitrotype that evades bot-detection.
  6. // @author       Thinatron (Aaron McAnalley)
  7. // @match        https://www.nitrotype.com/race
  8. // @grant        none
  9. // @require      http://code.jquery.com/jquery-latest.js
  10. // ==/UserScript==
  11. window.wwdata = {};
  12. (function() {
  13.     'use strict';
  14.     var jjkklliioopp = false;
  15.     setTimeout(function() {
  16.     if (jjkklliioopp !== true){
  17.         location.reload();
  18.     }
  19.     }, 60000);
  20.    
  21.     var sentence;
  22.     Primus.prototype.transforms = function transforms(primus, connection, type, data, raw) {
  23.         var packet = { data: data },
  24.             fns = primus.transformers[type];
  25. console.log(data);
  26.         window.wwdata = data;
  27.         if (data.msg == 'status' && data.payload.hasOwnProperty('lesson')) {
  28.             console.log("lesson recieved");
  29.             sentence = data.payload.lesson;
  30.         } else if (data.msg == 'status' && data.payload.status == "racing") {
  31.             console.log("Begin recieved");
  32.             jjkklliioopp = true;
  33.             beginTyping();
  34.         } else {console.log('nope');}
  35.         //
  36.         // Iterate in series over the message transformers so we can allow optional
  37.         // asynchronous execution of message transformers which could for example
  38.         // retrieve additional data from the server, do extra decoding or even
  39.         // message validation.
  40.         //
  41.         (function transform(index, done) {
  42.             var transformer = fns[index++];
  43.  
  44.             if (!transformer) return done();
  45.  
  46.             if (1 === transformer.length) {
  47.                 if (false === transformer.call(connection, packet)) {
  48.                     //
  49.                     // When false is returned by an incoming transformer it means that's
  50.                     // being handled by the transformer and we should not emit the `data`
  51.                     // event.
  52.                     //
  53.                     return;
  54.                 }
  55.  
  56.                 return transform(index, done);
  57.             }
  58.  
  59.             transformer.call(connection, packet, function finished(err, arg) {
  60.                 if (err) return connection.emit('error', err);
  61.                 if (false === arg) return;
  62.  
  63.                 transform(index, done);
  64.             });
  65.         }(0, function done() {
  66.             //
  67.             // We always emit 2 arguments for the data event, the first argument is the
  68.             // parsed data and the second argument is the raw string that we received.
  69.             // This allows you, for example, to do some validation on the parsed data
  70.             // and then save the raw string in your database without the stringify
  71.             // overhead.
  72.             //
  73.             if ('incoming' === type) return connection.emit('data', packet.data, raw);
  74.  
  75.             connection._write(packet.data);
  76.         }));
  77.  
  78.         return this;
  79.     };
  80.     function beginTyping() {
  81.         var endInt;
  82.         var pos = 0;
  83.         setTimeout(function(){
  84.         endInt = setInterval(function() {
  85.             if (pos < sentence.length) {
  86.                 $(document.activeElement).trigger({ type : 'keypress', which : sentence.charCodeAt(pos) });
  87.                 console.log(sentence.charCodeAt(pos));
  88.                 switch (pos) {
  89.                     case 3:
  90.                     case 15:
  91.                     case 21:
  92.                     case 7:
  93.                     case 39:
  94.                         $(document.activeElement).trigger({ type : 'keypress', which : "k".charCodeAt(0) });
  95.                         break;
  96.                 }
  97.                 pos++;
  98.             } else {
  99.                 clearInterval(endInt);
  100.                 pos = 0;
  101.                 setTimeout(function() {location.reload();}, 3000);
  102.             }
  103.         }, Math.floor(Math.random() * (30) + 20));},1200);
  104.  
  105.  
  106.     }
  107.    
  108.    
  109. })();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement