Advertisement
Guest User

Untitled

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