Advertisement
Guest User

Untitled

a guest
Mar 19th, 2019
112
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.67 KB | None | 0 0
  1. var config = {
  2. payout: {value: 3.5, type: 'multiplier'},
  3. stop: {value: 20000000, type: 'balance', label: 'stop if bet >'},
  4. };
  5.  
  6. let logsVar = {
  7. playedGamesStats: {
  8. games: 0,
  9. netProfit: 0,
  10. lastTimeStop: 0,
  11. maxLosingStreak: 0
  12. },
  13. userStats: {
  14. balance: userInfo.balance,
  15. profit: userInfo.profit
  16. },
  17. fibonacci: {
  18. lastVal: 0
  19. }
  20. };
  21.  
  22. log('Script is running..');
  23. log(`at start: userBalance: ${logsVar.userStats.balance / 100} | userProfit: ${logsVar.userStats.profit / 100}`);
  24.  
  25. let currentBet = 100;
  26. let losingStreak = 0;
  27.  
  28. // Always try to bet when script is started + start listeners
  29. engine.bet(roundBit(currentBet), config.payout.value);
  30. engine.on('GAME_STARTING', onGameStarted);
  31. engine.on('GAME_ENDED', onGameEnded);
  32.  
  33. const onWin = () => {
  34. losingStreak = 0;
  35. logsVar.playedGamesStats.netProfit += (config.payout.value * currentBet) - currentBet;
  36. logsVar.fibonacci.lastVal = 0;
  37. currentBet = 100;
  38. log('We won, so next bet will be', currentBet / 100, 'bits')
  39. };
  40.  
  41. const onLose = () => {
  42. const nextVal = currentBet + logsVar.fibonacci.lastVal;
  43.  
  44. losingStreak++;
  45. if (losingStreak > logsVar.playedGamesStats.maxLosingStreak)
  46. logsVar.playedGamesStats.maxLosingStreak = losingStreak;
  47. logsVar.playedGamesStats.netProfit -= currentBet;
  48. logsVar.fibonacci.lastVal = currentBet;
  49. currentBet = nextVal;
  50. log('We lost, so next bet will be', currentBet / 100, 'bits');
  51. };
  52.  
  53. const onStop = () => {
  54. log(`Was about to bet ${currentBet / 100}, which triggers the stop, start back with base bet value.`);
  55. log(`From the last stop, ${logsVar.playedGamesStats.lastTimeStop} games ago, we earned: ${logsVar.playedGamesStats.netProfit / 100} bits.`);
  56. log(`actual user account informations: userBalance: ${logsVar.userStats.balance / 100} | userProfit: ${logsVar.userStats.profit / 100}`);
  57. logsVar.playedGamesStats.lastTimeStop = 0;
  58. logsVar.fibonacci.lastVal = 0;
  59. currentBet = 100;
  60. };
  61.  
  62. function onGameStarted() {
  63. engine.bet(roundBit(currentBet), config.payout.value);
  64. }
  65.  
  66. function onGameEnded() {
  67. var lastGame = engine.history.first();
  68.  
  69. // If we wagered, it means we played
  70. if (lastGame.wager) {
  71. logsVar.playedGamesStats.games++;
  72. logsVar.playedGamesStats.lastTimeStop++;
  73. lastGame.cashedAt
  74. ? onWin()
  75. : onLose();
  76. }
  77. if (currentBet > config.stop.value)
  78. onStop();
  79. log(`Actual profit: ${logsVar.playedGamesStats.netProfit / 100} in ${logsVar.playedGamesStats.games} games played.`);
  80. log(`Highest losing streak with payout at ${config.payout.value} was: ${logsVar.playedGamesStats.maxLosingStreak}`);
  81. }
  82.  
  83. function roundBit(bet) {
  84. return Math.round(bet / 100) * 100;
  85. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement