Advertisement
Guest User

Untitled

a guest
Aug 23rd, 2017
714
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 7.83 KB | None | 0 0
  1. /*
  2. * Procon's BustaBit Bot
  3. *
  4. * This version includes some (disabled by default) experiments.
  5. * Enabling 'useCrashAverage' will allow the script to try to determine a trend.
  6. * It will raise the multiplier accordingly.
  7. * The bot will take 4 rounds to generate the average, then, adjust it per game afterwards.
  8. *
  9. * Like the script? Consider donating me a few bits! :)
  10. *
  11. * Disclaimer: All rights are reserved for the original creator of this script.
  12. */
  13.  
  14. // Settings
  15. var baseBet = 100;
  16. // In bits
  17.  
  18. var baseMultiplier = 1.05;
  19. // Target multiplier: 1.13 recommended
  20.  
  21. var variableBase = false;
  22. // Enable variable mode (very experimental), read streakSecurity.
  23.  
  24. var streakSecurity = 50;
  25. // Number of loss-streak you wanna be safe for. Increasing this massively reduces the variableBase calculated. (1-loss = 20%, 2-loss = 5%, 3-loss = 1.25% of your maximum balance). Recommended: 2+
  26.  
  27. var maximumBet = 999999;
  28. // Maximum bet the bot will do (in bits).
  29.  
  30. var percentageOfTotal = 100;
  31. // Percentage of total balance to use when max loss is hit. (100 = 100%)
  32.  
  33. var useCrashAverage = false;
  34. // Enable editing current multiplier based on past 4 crash average. (Experimental!)
  35.  
  36. var highAverage = 1.80;
  37. // Average multiplier to use the highAverageMultiplier.
  38.  
  39. var highAverageMultiplier = 1.30;
  40. // Multiplier to use when crash average is above highAverage.
  41.  
  42. var BustaBit = true;
  43. // Enable when using BustaBit, disable when using CS:GO Crash. (Changed how the script grabs your username)
  44.  
  45. // Variables - Do not touch!
  46. var baseSatoshi = baseBet * 100; // Calculated
  47. var currentBet = baseSatoshi;
  48. var currentMultiplier = baseMultiplier;
  49. var currentGameID = -1;
  50. var firstGame = true;
  51. var lossStreak = 0;
  52. var coolingDown = false;
  53. var d = new Date();
  54. var startTime = d.getTime();
  55.  
  56. var takingBreak = false;
  57. var takeBreaks = false; // Broken, disabled
  58. var lowAverage = 1.45;
  59.  
  60. var tempCrash;
  61. var gameAverage;
  62. var currentGame = 0;
  63. var game1;
  64. var game2;
  65. var game3;
  66. var game4;
  67.  
  68. // Initialization
  69. console.log('====== Procon\'s BustaBit Bot ======');
  70. console.log('====== Re-coded by CurtisVL ======');
  71. if(BustaBit == true){
  72. console.log('My username is: ' + engine.getUsername());
  73. }
  74. else{
  75. console.log('My username is: ' + engine.getSteamID());
  76. }
  77. console.log('Starting balance: ' + (engine.getBalance() / 100).toFixed(2) + ' bits');
  78. var startingBalance = engine.getBalance();
  79.  
  80. if (variableBase) {
  81. console.warn('[WARN] Variable mode is enabled and not fully tested. Bot is resillient to ' + streakSecurity + '-loss streaks.');
  82. }
  83.  
  84. // On a game starting, place the bet.
  85. engine.on('game_starting', function(info) {
  86. console.log('====== New Game ======');
  87. console.log('[Bot] Game #' + info.game_id);
  88. currentGameID = info.game_id;
  89. if(game4 != null && useCrashAverage == true){
  90. gameAverage = (((game1 + game2) + (game3 + game4)) / 4);
  91. console.log("[Bot] Average crash: " + gameAverage + "x");
  92. }
  93. else{
  94. gameAverage = 0;
  95. }
  96.  
  97. if (coolingDown) {
  98. if (lossStreak == 0) {
  99. coolingDown = false;
  100. }
  101. else {
  102. lossStreak--;
  103. console.log('[Bot] Cooling down! Games remaining: ' + lossStreak);
  104. return;
  105. }
  106. }
  107.  
  108. if(gameAverage <= lowAverage && takeBreaks == true && game4 != null){
  109. takingBreak = true;
  110. console.log("Too low average. Taking a break this round!");
  111. }
  112. else{
  113. takingBreak = false;
  114. }
  115.  
  116. if (!firstGame) { // Display data only after first game played.
  117. console.log('[Stats] Session profit: ' + ((engine.getBalance() - startingBalance) / 100).toFixed(2) + ' bits in '+ Math.round(timeplaying) + ' minutes.');
  118. console.log('[Stats] Profit percentage: ' + (((engine.getBalance() / startingBalance) - 1) * 100).toFixed(2) + '%');
  119. }
  120.  
  121. if(firstGame == true){
  122. newdate = new Date();
  123. timeplaying = ((newdate.getTime() - startTime) / 1000) / 60;
  124. }
  125.  
  126. if (engine.lastGamePlay() == 'LOST' && !firstGame && takingBreak == false) { // If last game loss:
  127. lossStreak++;
  128. var totalLosses = 0; // Total satoshi lost.
  129. var lastLoss = currentBet; // Store our last bet.
  130. while (lastLoss >= baseSatoshi) { // Until we get down to base bet, add the previous losses.
  131. totalLosses += lastLoss;
  132. lastLoss /= 4;
  133. }
  134.  
  135. if (lossStreak > streakSecurity) { // If we're on a loss streak, wait a few games!
  136. coolingDown = true;
  137. return;
  138. }
  139.  
  140. currentBet *= 4; // Then multiply base bet by 4!
  141. currentMultiplier = 1 + (totalLosses / currentBet);
  142. }
  143. else { // Otherwise if win or first game:
  144. lossStreak = 0; // If it was a win, we reset the lossStreak.
  145. if (variableBase) { // If variable bet enabled.
  146. // Variable mode resists (currently) 1 loss, by making sure you have enough to cover the base and the 4x base bet.
  147. var divider = 100;
  148. for (i = 0; i < streakSecurity; i++) {
  149. divider += (100 * Math.pow(4, (i + 1)));
  150. }
  151.  
  152. newBaseBet = Math.min(Math.max(1, Math.floor((percentageOfTotal/100) * engine.getBalance() / divider)), maximumBet * 100); // In bits
  153. newBaseSatoshi = newBaseBet * 100;
  154.  
  155. if ((newBaseBet != baseBet) || (newBaseBet == 1)) {
  156. console.log('[Bot] Variable mode has changed base bet to: ' + newBaseBet + ' bits');
  157. baseBet = newBaseBet;
  158. baseSatoshi = newBaseSatoshi;
  159. }
  160. }
  161.  
  162. currentMultiplier = baseMultiplier;
  163.  
  164. if(lossStreak == 0 && useCrashAverage == true && gameAverage != 0){
  165. if(gameAverage < highAverage){
  166. currentMultiplier = baseMultiplier;
  167. }
  168. if(gameAverage >= highAverage){
  169. currentMultiplier = highAverageMultiplier;
  170. }
  171. }
  172.  
  173. // Update bet.
  174. currentBet = baseSatoshi; // in Satoshi
  175. }
  176.  
  177. // Message and set first game to false to be sure.
  178. console.log('[Bot] Betting ' + (currentBet / 100) + ' bits, cashing out at ' + currentMultiplier + 'x');
  179. firstGame = false;
  180.  
  181. if (currentBet <= engine.getBalance() && takingBreak == false) { // Ensure we have enough to bet
  182. if (currentBet > (maximumBet * 100)) { // Ensure you only bet the maximum.
  183. console.warn('[Warn] Bet size exceeds maximum bet, lowering bet to ' + (maximumBet * 100) + ' bits');
  184. currentBet = maximumBet;
  185. }
  186. engine.placeBet(currentBet, Math.round(currentMultiplier * 100), false);
  187. }
  188. else { // Otherwise insufficent funds...
  189. if (engine.getBalance() < 100) {
  190. console.error('[Bot] Insufficent funds to do anything... stopping');
  191. engine.stop();
  192. }
  193. else {
  194. console.warn('[Bot] Insufficent funds to bet ' + (currentBet / 100) + ' bits.');
  195. console.warn('[Bot] Resetting to 1 bit basebet');
  196. baseBet = 1;
  197. baseSatoshi = 100;
  198. }
  199. }
  200. });
  201.  
  202. //Game Started
  203. engine.on('game_started', function(data) {
  204. if (!firstGame) { console.log('[Bot] Game #' + currentGameID + ' has started!'); }
  205. });
  206.  
  207. //Cashed Out
  208. engine.on('cashed_out', function(data) {
  209. if(BustaBit == true){
  210. if (data.username == engine.getUsername()) {
  211. console.log('[Bot] Successfully cashed out at ' + (data.stopped_at / 100) + 'x');
  212. }
  213. }
  214. });
  215.  
  216. //Game Crash
  217. engine.on('game_crash', function(data) {
  218. if(BustaBit == false){
  219. if (data.username == engine.getSteamID()) {
  220. console.log('[Bot] Successfully cashed out at ' + (data.stopped_at / 100) + 'x');
  221. }
  222. }
  223.  
  224. if (!firstGame) { console.log('[Bot] Game crashed at ' + (data.game_crash / 100) + 'x'); }
  225. newdate = new Date();
  226. timeplaying = ((newdate.getTime() - startTime) / 1000) / 60;
  227. currentGame++;
  228. tempCrash = (data.game_crash / 100);
  229. if (tempCrash >= 2.0){
  230. tempCrash = 2.0;
  231. }
  232. if (currentGame == 1){
  233. game1 = tempCrash;
  234. }
  235. else if(currentGame == 2){
  236. game2 = tempCrash;
  237. }
  238. else if(currentGame == 3){
  239. game3 = tempCrash;
  240. }
  241. else if(currentGame == 4){
  242. game4 = tempCrash;
  243. }
  244. else if(currentGame >= 5){
  245. currentGame = 1;
  246. game1 = tempCrash;
  247. }
  248. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement