// Bustabit Special Bot
// By: Spiocha & MartinG
// Version 2
// A martingale that pauses and continues when the game crashes above certain thresholds
/******************/
var baseBet = 2;
var multiplier = 3;
var cashout = 1.22;
var pauseThreshold = 10; // when game crashes above this, betting pauses
var continueThreshold = 2; // when paused and the game crashes above this, betting resumes
var pauseAfterNLosses = 10;
var pauseForMGames = 5;
/******************/
baseBet = Math.round(baseBet) * 100;
cashout = Math.round(cashout * 100);
pauseThreshold = Math.round(pauseThreshold * 100);
continueThreshold = Math.round(continueThreshold * 100);
var currentGameData;
var lastCrash = cashout;
var lostLast = false;
var paused = false;
var bet = baseBet;
var pauseLossStreak = 0;
var pausedFor = 0;
engine.on('game_started', function(data) {
currentGameData = data;
});
engine.on('game_starting', function(info) {
console.log(lastCrash, pauseThreshold);
if(lastCrash >= pauseThreshold) {
paused = true;
console.log("Pausing Betting");
return;
}
if(paused) {
if(lastCrash >= continueThreshold) {
console.log("Continuing Betting");
lastCrash = cashout;
paused = false;
} else {
console.log("Betting Is Paused");
return;
}
}
/********************/
if(pausedFor > 0) {
pausedFor++;
if(pausedFor <= pauseForMGames) {
console.log("Paused " + pausedFor + " of " + pauseForMGames + " games");
return;
} else {
console.log("Resuming");
pausedFor = 0;
pauseLossStreak = 0;
}
}
if(pauseLossStreak >= pauseAfterNLosses) {
console.log("Pausing for 1 of " + pauseForMGames + " games");
pausedFor = 1;
return;
}
/********************/
if(lastCrash >= cashout) {
bet = baseBet;
} else {
bet = bet * multiplier;
}
console.log("Betting " + Math.round(bet/100));
engine.placeBet(Math.round(bet), cashout);
});
engine.on('game_crash', function(data) {
lastCrash = data.game_crash;
if (!currentGameData || !currentGameData.hasOwnProperty(engine.getUsername())) {
return;
};
lostLast = engine.lastGamePlay() == 'LOST';
/********************/
if(!lostLast) {
pauseLossStreak = 0;
} else {
pauseLossStreak++;
}
/********************/
});