// [BITSLER BOT V1.2] by thizk
//
// changelog v1.2:
// - seprate stop profit - stake
//
// changelog v1.1:
// - add option "restart bet on stake"
// - fix stake and profit calculation
//
// changelog v1.0:
// - start or stop button
// - chance % change
// - hi or lo betting
// - zigzag betting
// - profit or stake limitation
// - user interface
// - auto change seeds
// - increase bet on lose
if($('#aside-container').is(":visible") != false){
$('#close-chat').trigger('click');
}
$("#column-right").append('\
');
var _bet,_chance,_onlost,_mode, _auto, _stopprofit, _stopstake, _start = false, _stake, _profit,_betting, _task, _seeds,_restart;
function startDice(){
_mode = document.getElementById('_mode').value;
_bet = parseFloat(document.getElementById('_bet').value);
_profit = parseFloat(document.getElementById('_profit').value);
_stake = parseFloat(document.getElementById('_stake').value);
_stake = -_stake;
_chance = parseFloat(document.getElementById('_chance').value);
_onlost = parseFloat(document.getElementById('_onlost').value);
_stopprofit = document.getElementById('_stopprofit').checked;
_stopstake = document.getElementById('_stopstake').checked;
_auto = document.getElementById('_auto').checked;
_restart = document.getElementById('_restart').checked;
_betting = 0;
if(_mode != 'h' && _mode != 'l' && _mode != 'z'){
alert("Bet Mode incorrect!");
return;
}
_start = !_start;
if(_start != true){
$('#_start').text("START");
_betting = 0;
clearInterval(_task);
clearInterval(_seeds);
return;
}else{
$('#_start').text("STOP");
}
if($("#updated_condition").text().indexOf('>') !== -1 && _mode == 'l'){
$("#updated_condition").trigger('click');
}
else if($("#updated_condition").text().indexOf('<') !== -1 && _mode == 'h'){
$("#updated_condition").trigger('click');
}
//
$('#amount').val(_bet.toFixed(8));
//
$("#editable-chance").trigger('click');
$("#editable-chance-field").val(_chance);
$("#editable-chance-field").trigger('focusout');
if(_auto){
// CHANGE
change_seeds();
// SET TASK
_seeds = setInterval(function() {
change_seeds();
console.log("CHANGE SEED TASK = " + _seeds.toString());
}, Math.round(Math.random() * (600000 - 300000) + 300000));
}
_betting = _bet;
//
$('#btn-bet-dice').trigger('click');
}
function increaseOnLost(bet, percent){
return parseFloat(bet) + ((parseFloat(bet)*percent)/100);
}
//
$('#history-my-bets-dice').unbind();
$('#history-my-bets-dice').bind("DOMSubtreeModified",function(event){
if( $(event.currentTarget) )
{
clearInterval(_task);
var bet , x, balance;
if(_start)
{
balance = parseFloat(document.getElementById('balances-lg').innerText);
if( balance<= 0 || parseFloat($('#amount').val()) > balance){
startDice();
return;
}
x = ($('#history-my-bets-dice tr td:last-child span')[0].innerText.indexOf('+') != 0 ) ? false : true;
_betting = parseFloat(_betting) + parseFloat($('#history-my-bets-dice tr td:last-child span')[0].innerText);
if(x != true) {
if(_onlost > 0){
bet = increaseOnLost($('#amount').val(), _onlost);
$('#amount').val(bet.toFixed(8));
}
}else {
$('#amount').val(_bet.toFixed(8));
}
if(_stopprofit){
if(_betting >= _profit){
startDice();
alert("PROFIT REACHED!");
return;
}
}
if(_stopstake){
if( _betting <= _stake ){
startDice();
alert("STAKE REACHED!");
return;
}
}
else {
if(_betting <= _stake){
if( _restart ){
clearInterval(_task);
_betting = 0;
$('#amount').val(_bet.toFixed(8));
}else{
startDice();
alert("STAKE REACHED!");
return;
}
}
}
_task = setInterval(function(){
if(!_start){
clearInterval(_task);
clearInterval(_seeds);
return;
}
if(_mode == 'z'){
$("#updated_condition").trigger('click');
}
$('#btn-bet-dice').trigger('click');
}, 1000)
}
}
});