Advertisement
E187

Untitled

Jul 4th, 2020
393
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var config = {
  2.   settings: { type: 'noop', label: 'Wager & Payout Settings' },
  3.   wager: { value: 77700, type: 'balance', label: 'wager' },
  4.   payout: { value: 1.17, type: 'multiplier', label: 'payout' },
  5.   increments: { value: 100000, type: 'balance', label: 'add each time for recover' },
  6.   maxbet: { value: 1277700, type: 'balance', label: 'max bet' },
  7.   stopLossWarning: { type: 'noop', label: 'Stop Loss Settings' },
  8.   stopOnHighBalance: { value: 100000000, type: 'balance', label: 'Stop if BR above' },
  9.   stopOnLowBalance: { value: 0.1, type: 'multiplier', label: 'Stop if BR below X' },
  10.   warning1: { type: 'noop', label: 'Pauses bets if X consecutive busts happens' },
  11.   pauseOnXlosses: { value: 3, type: 'multiplier', label: 'Pause after X losses' },
  12.   warning2: { type: 'noop', label: 'Resume betting after X consecutive games above X' },
  13.   resumeOnXGames: { value: 3, type: 'multiplier', label: 'Resume after X rounds' },
  14.   resumeOnXGamesAboveMP: { value: 1.17, type: 'multiplier', label: 'above X payout' },
  15. };
  16.  
  17. var currentBet = config.wager.value;
  18.  
  19. let peakBalance = userInfo.balance;
  20. let lastWager = 0;
  21. let lastMP = 0;
  22.  
  23. let isRecovering = false;
  24. let isPaused = false;
  25.  
  26. let losses = 0;
  27. let skips = 0;
  28.  
  29. engine.bet(roundBit(currentBet), config.payout.value);
  30.    
  31. engine.on('GAME_STARTING', onGameStarted);
  32. engine.on('GAME_ENDED', onGameEnded);
  33.    
  34.   function onGameStarted() {
  35.    
  36.     /* if our balance is larger than stopOnHighBalance or smaller than stopOnLowBalance we don't give a shit, kill this thing */
  37.     if ((userInfo.balance >= config.stopOnHighBalance.value) || (userInfo.balance <= config.stopOnLowBalance.value))
  38.         return;
  39.  
  40.  
  41.     /* not doing anything when we are paused */
  42.     if (isPaused) return;
  43.  
  44.     if (isRecovering) {
  45.         /* if we are recovering, we add 1000 to each bet */
  46.         lastWager += config.increments.value;
  47.         /* but we will never go beyond maxbet */
  48.         lastWager = (lastWager > config.maxbet.value) ? config.maxbet.value : lastWager;
  49.         /* make our bet */
  50.         makeBet(lastWager, config.payout.value);
  51.     } else {
  52.         /* if we are not recovering we flatbet our base */
  53.         makeBet(config.wager.value, config.payout.value);
  54.     }
  55.  
  56.   }
  57.    
  58.   function onGameEnded() {
  59.     let lastGame = engine.history.first();
  60.  
  61.     /* if we are paused and a game has ended, we skipped */
  62.     /* our condition to unpause is when the last n games of history had a bust higher than configured */
  63.     if (isPaused) {
  64.         /* see how many of the previous games were above the configured multiplier */
  65.         let nGames = engine.history.slice(0, config.resumeOnXGames.value).filter(g => { return g.bust >= config.resumeOnXGamesAboveMP.value }).length;
  66.  
  67.         /* if they all were, we can unpause */
  68.         if (nGames == config.resumeOnXGames.value) {
  69.             isPaused = false;
  70.             losses = 0; /* reset our counter so we don't pause again after 1 loss */
  71.             log('AutoPause disabled. Resuming betting')
  72.           }
  73.     }
  74.    
  75.     /* if we did not play, we have nothing else to take care of */
  76.     if (!lastGame.wager) return;
  77.    
  78.     /* if we won the game and cashed out */
  79.     if (lastGame.cashedAt) {
  80.         losses = 0; /* reset our losses counter */
  81.        
  82.         /* display our win in log */
  83.         let profit = Math.round((lastGame.wager * lastGame.cashedAt - lastGame.wager) / 100)
  84.         log('we won', profit, 'bits');
  85.     } else {
  86.         /* we lost, lets count our losses */
  87.         losses++;
  88.  
  89.         /* if we lost equal or greater amounts than pauseOnXlosses we want to pause */
  90.         if (losses >= config.pauseOnXlosses.value) {
  91.             isPaused = true;
  92.             log('we lost', losses, 'times. Pause...');
  93.         }
  94.         else {
  95.             isPaused = false;
  96.             log('we lost', losses, 'times.');
  97.         }
  98.     }
  99.    
  100.     /* check if we recovered or are at peak balance */
  101.     if (userInfo.balance >= peakBalance) {
  102.         peakBalance = userInfo.balance;
  103.         isRecovering = false;
  104.     } else isRecovering = true;
  105. }
  106.  
  107. function makeBet(wager, payout) {
  108.     lastWager = wager;
  109.     lastMP = payout;
  110.  
  111.     engine.bet(wager, payout);
  112.     log("placing a bet for", wager / 100, "on", payout);
  113. }
  114.  
  115. function roundBit(bet) {
  116.   return Math.round(bet / 100) * 100;
  117. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement