Advertisement
Guest User

yobit auto-gambler

a guest
Jun 1st, 2017
40
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. /* yobit dice game autoplayer - only tested in chrome */
  3. /* inject into browser dev console */
  4. /* use betmachine.bet('0.00001'); to start the betting process */
  5. /* use betmachine.stop(); to end it. */
  6.  
  7. var betmachine = {};
  8.  
  9. //config vars
  10. betmachine.maxlosses = 15; //
  11. betmachine.whichButton = 1; // 1 = bet low, 2 = bet high.
  12.  
  13. //system vars
  14. betmachine.started = false;
  15. betmachine.running = false;
  16. betmachine.origamount = 0;
  17. betmachine.origTotal = 0;
  18. betmachine.currentTotal = 0;
  19. betmachine.totalDifference = 0;
  20. betmachine.winCount = 0;
  21. betmachine.loseCount = 0;
  22. betmachine.prevWinLoss = '';
  23. betmachine.failureCount = 0;
  24.  
  25. betmachine.stop = function() {
  26.   betmachine.running = false;
  27.   betmachine.started = false;
  28. };
  29.  
  30. betmachine.getTotal = function() {
  31.     return parseFloat($('body > div.wrapper > main > div > div.center_box > div > div.overview > div > div.create_new > table > tbody > tr > td:nth-child(1) > div > div > a > span').text().match(/-?(?:\d+(?:\.\d*)?|\.\d+)/)[0]);  
  32. };
  33.  
  34. betmachine.clearTable = function() {
  35.     var dice_table = $($.fn.dataTable.tables()[1]).DataTable();
  36.     dice_table.rows().remove().draw();
  37. };
  38.  
  39. betmachine.reloadPage = function() {
  40.     window.location = window.location;//+'?wc='+betmachine.winCount+'&lc='+betmachine.loseCount+'&ot='+betmachine.origTotal;
  41. };
  42.  
  43. betmachine.getCurrentWinLossAmount = function() {
  44.     return $('#DataTables_Table_0 > tbody > tr:nth-child(1) > td.green').text();
  45. };
  46.  
  47. betmachine.checkReturn = function(amount,next) {
  48.   if ((betmachine.getCurrentWinLossAmount()[0] == '-') && betmachine.prevWinLoss == betmachine.getCurrentWinLossAmount()) {
  49.     //shit hasn't updated, possible problem.
  50.     //wait 10 seconds for update and try again.
  51.     betmachine.failureCount++;
  52.     if (betmachine.failureCount > 3) {
  53.       betmachine.stop();
  54.       return false;
  55.     } else {
  56.       setTimeout(function(){
  57.         next--;
  58.         betmachine.checkReturn(amount,next);
  59.       },5000);
  60.     }
  61.   } else {
  62.     betmachine.currentTotal = betmachine.getTotal();
  63.     betmachine.totalDifference = betmachine.currentTotal - betmachine.origTotal;
  64.     if (betmachine.getCurrentWinLossAmount()[0] == '+') {
  65.       // betmachine.whichButton = 1;
  66.       betmachine.winCount++;
  67.       betmachine.loseCount = 0;
  68.       var message = (betmachine.currentTotal >= betmachine.origTotal) ? 'YOU ARE UP OR AHEAD: '+betmachine.totalDifference : 'YOU ARE DOWN: '+betmachine.totalDifference;
  69.       console.log('WON! #'+betmachine.winCount+' ::: BETTING AGAIN :::' + message);
  70.       betmachine.prevWinLoss = betmachine.getCurrentWinLossAmount();
  71.       /*      
  72.       //reload page after x amount of wins.
  73.       if (betmachine.winCount > 20) {
  74.         betmachine.reloadPage();
  75.       }
  76.       */
  77.       setTimeout(function(){
  78.         if ($('#DataTables_Table_0 > tbody > tr:nth-child(1) > td.green').text() === "") {
  79.           console.log('SHITS FUCKED, RESTARTING BEFORE BIG LOSSES');
  80.           window.location = window.location;
  81.         }
  82.        
  83. //        betmachine.clearTable();
  84.         if (betmachine.running) betmachine.bet(betmachine.origamount,0);
  85.       },Math.ceil(Math.random()*2000)+5000);
  86.     } else {
  87.       betmachine.loseCount++;
  88.       var message = (betmachine.currentTotal >= betmachine.origTotal) ? 'YOU ARE UP OR AHEAD: '+betmachine.totalDifference : 'YOU ARE DOWN: '+betmachine.totalDifference;
  89.       setTimeout(function(){        
  90.         // if (next >= 5)
  91.         //   betmachine.whichButton = 2;
  92.         if (next < betmachine.maxlosses) {
  93.           next++;
  94.           console.log('LOST! #'+betmachine.loseCount+' trying again:'+next+' ::: '+message);
  95.           //betmachine.whichButton = (next>=Math.floor(betmachine.maxlosses/2)) ? 2:1;
  96.           var betamount = (amount*2) + betmachine.origamount;
  97.           if ((next+1) > 3) betamount -= betmachine.origamount;
  98.           console.log('next amount: ',betmachine.origamount,next,betamount);
  99.           if (betmachine.running) betmachine.bet(betamount,next);
  100.         } else {
  101.           console.log('AW SHIT LOST TOO MANY! #'+betmachine.loseCount);
  102.                
  103.           if (betmachine.running) {
  104.             betmachine.stop();
  105.             // betmachine.reloadPage();
  106.           }
  107.             //betmachine.bet(betmachine.origamount,0);
  108.           //betmachine.clearTable();
  109.         }
  110.       },2000);//(2000*next)+4000);
  111.     }
  112.   }
  113.  
  114. };
  115. betmachine.bet = function(amount,next=0) {
  116.   if (!betmachine.started) {
  117.     betmachine.started = true;
  118.     betmachine.running = true;
  119.     betmachine.origamount = amount;
  120.     betmachine.origTotal = betmachine.getTotal();
  121.     betmachine.currentTotal = betmachine.origTotal;
  122.     betmachine.totalDifference = 0;
  123.   }
  124.   if (!betmachine.running) {
  125.     console.log('closing it down');
  126.     return false;
  127.   }
  128.   document.title = '['+betmachine.winCount+']/['+betmachine.loseCount+']:['+betmachine.totalDifference+']';
  129.   var addamount = 0;
  130.   // if (next === 0 && Math.ceil(Math.random()*2) == 1) addamount = amount; //randomly double initial bet for fun.
  131.   $('.poles .bet').val(amount+addamount);
  132.  
  133.   console.log('pressing: '+betmachine.whichButton);
  134.   $('body > div.wrapper > main > div > div.center_box > div > div.overview > div > div.create_new > table > tbody > tr > td:nth-child(4) > input:nth-child('+betmachine.whichButton+')').click();
  135.  
  136.   if (betmachine.running)
  137.     setTimeout(function(){betmachine.checkReturn(amount,next)},2000);
  138. };
  139.  
  140. /*
  141. //if using a browser extension to auto inject the javascript you can have the plugin automagically restart betting.
  142. if (!document.getElementById('trade_market')) {
  143.   setTimeout(function(){window.location = window.location;},5000);
  144. } else {
  145.   $(function(){
  146.     setTimeout(function(){
  147.       betmachine.bet(0.2);
  148.     },4000);
  149.   });
  150. }
  151. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement