The formatting is a bit off.
$('body').append('
');
bconfig = {
maxBet: 0.0001024,
wait: 1,
toggleHilo: false,
alertMultiplier: 8
};
initialBalance = parseFloat($('#balance').html());
hilo = 'hi';
multiplier = 1;
startTime = new Date().getTime();
rollDice = function() {
if ($('#double_your_btc_bet_lose').html() !== '') {
$('#double_your_btc_2x').click();
multiplier++;
if (bconfig.toggleHilo) toggleHiLo();
} else {
setStartBet();
$('#double_your_btc_bet_win').html('');
var cmsg = {
lose: $('#double_your_btc_bet_lose').html(),
win: $('#double_your_btc_bet_win').html()
};
cmsg = JSON.stringify(cmsg);
}
if (multiplier > bconfig.alertMultiplier) {
if (window.confirm("You have already lost " + (Math.pow(2, (multiplier - 1)) - 1) + " and you are about to lose " + Math.pow(2, (multiplier - 1)) + ". Click 'cancel' to reset the bet amount to 1 or 'ok' to take the risk?")) {
} else {
$('#double_your_btc_min').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
multiplier = 1;
}
$('#double_your_btc_bet_' + hilo + '_button').click();
} else {
if (parseFloat($('#balance').html()) < (parseFloat($('#double_your_btc_stake').val()) * 2) ||
parseFloat($('#double_your_btc_stake').val()) > bconfig.maxBet) {
$('#double_your_btc_min').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
multiplier = 1;
}
$('#double_your_btc_bet_' + hilo + '_button').click();
}
// setTimeout(rollDice, (multiplier * bconfig.wait) + Math.round(Math.random() * 100));
};
toggleHiLo = function() {
if (hilo === 'hi') {
hilo = 'lo';
} else {
hilo = 'hi';
}
};
setStartBet = function() {
$('#double_your_btc_min').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
multiplier = 1;
// if ((Math.random() * 10) > 5) {
// } else {
// $('#double_your_btc_min').click();
// $('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
$('#double_your_btc_2x').click();
// multiplier = 2;
// }
}
currentMsg = '';
bChange = function(next) {
var cmsg = {
lose: $('#double_your_btc_bet_lose').html(),
win: $('#double_your_btc_bet_win').html()
};
cmsg = JSON.stringify(cmsg);
if (currentMsg !== cmsg) {
$('#balance_b').html($('#balance').html());
$('#roundwin_b').html((parseFloat($('#balance').html()) - initialBalance).toFixed(8));
$('#current_bet_b').html($('#double_your_btc_stake').val());
$('#time_b').html((Math.round(((new Date().getTime()) - startTime) / 1000) / 60 / 60).toFixed(2) + ' h');
currentMsg = cmsg;
next();
}
setTimeout(function() {
bChange(next);
}, bconfig.wait)
};
bChange(rollDice);