Есть скриптик один (бот) для одного сайта-рулетки. Мне нужно сделать так, чтобы при ставке в 1000 бот останавливался. Как это сделать?
Ниже сам скрипт.
var maxstrike =15;
var stoploss = 50;// %
var min = 49;
var max = 95;
//--------------------------
var minbet = 5;
var balance = parseFloat(document.getElementsByClassName("Numbers HighlightedText UserBalance")[0].innerText);
var basebet;
var profit = parseFloat($('#LastBetInfoProfit').html());
var bet;
var betid;
var chance = 93;
var startbalance = balance;
var sbalance = balance;
var tick = 0;
var betting = true;
var maxbet = startbalance*stoploss/100;
var b;
var i = 0;
b = balance*stoploss/100;
while(i<maxstrike){
b/=4;
i++;
}
basebet = b;
if(basebet < minbet) basebet = minbet;
bet = basebet;
document.getElementById('BetSizeInput').value = (bet).toFixed(8);
document.getElementById('BetChanceInput').value = chance;
$('#BetLowButton').click();
balance = parseFloat(document.getElementsByClassName("Numbers HighlightedText UserBalance")[0].innerText);
profit = parseFloat($('#LastBetInfoProfit').html());
startbalance = balance;
console.log('Game started at balance ',(balance).toFixed(8));
setInterval("roll()", 1000);
function roll(){
tick+=1;
if (betting && tick >=15 || betid != parseFloat($('#LastBetInfoSecret').html())){
betid = parseFloat($('#LastBetInfoSecret').html());
profit = parseFloat($('#LastBetInfoProfit').html());
balance = parseFloat(document.getElementsByClassName("Numbers HighlightedText UserBalance")[0].innerText);
if(profit < 0){
if(balance-bet*4 > startbalance*stoploss/100)bet*=4;
else if(balance-bet*2 > startbalance*stoploss/100)bet*=2;
}else{
if(balance > startbalance){
i = 0;
b = balance*stoploss/100;
while(i<maxstrike){
b/=4;
i++;
}
basebet = b;
if(basebet < minbet) basebet = minbet;
bet = basebet;
console.log('Current balance ',(balance).toFixed(8),' profit ',(balance-startbalance).toFixed(8),
' Session profit ',(balance-sbalance).toFixed(8),' ',(100*(balance-sbalance)/sbalance).toFixed(2),'%');
startbalance = balance;
maxbet = startbalance*stoploss/100;
}
}
chance = (Math.random() * (max - min) + min).toFixed(2);
if(betting && bet <= maxbet){
document.getElementById('BetSizeInput').value = (bet).toFixed(8);
document.getElementById('BetChanceInput').value = chance;
if(Math.random() < 0.5){
$('#BetLowButton').click();
}else{
$('#BetHighButton').click();
}
tick = 0;
}else{
betting = false;
console.log('Game stopped at balance ',(balance).toFixed(8),' Loss ',(startbalance - balance).toFixed(8));
}
}
}