This commit is contained in:
darthsandmann
2016-10-16 21:53:15 +02:00
parent 0d10f8b9dc
commit c9f3117da1
412 changed files with 137942 additions and 0 deletions

View File

@ -0,0 +1,47 @@
var bot1ID = 0;
var bot2ID = 0;
function randomizer(los_nr){
return (Math.random() * (charge_data[los_nr]['startPreis'] - charge_data[los_nr]['minPreis']) + charge_data[los_nr]['minPreis']);
};
function buyBot(bot){
los_nr = document.getElementById('los_nr').value;
var bet = randomizer(los_nr);
if(charge_data[los_nr]['vkPreis'] < bet){
setBotButtonStyle(bot, 'buyAction');
var botname = 'Bot' + bot;
kaufen(botname);
}
};
function botStart(bot){
setBotButtonStyle(bot, 'active');
if(bot == 1){
bot1ID = setInterval(function(){buyBot(1)}, 1000);
}
else if(bot == 2){
bot2ID = setInterval(function(){buyBot(2)}, 1000);
}
else{
alert("Fehler beim Aktivieren eines Bots");
}
};
function botStop(bot){
setBotButtonStyle(bot, 'inactive');
if(bot == 1){
clearInterval(bot1ID);
bot1ID = 0;
}
else if(bot == 2){
clearInterval(bot2ID);
bot2ID = 0;
}
else{
alert("Fehler beim Aktivieren eines Bots");
}
};

View File

@ -0,0 +1,56 @@
function setBotButtonStyle(bot, style){
var htmlID = 0;
if(bot == 1){
if(style == 'active'){
document.getElementById('bot1Button').className = "botButtonActiveStyle";
document.getElementById('bot1Button').onclick = function onclick(event){ botStop(1);};
}
else if(style == 'inactive'){
document.getElementById('bot1Button').className = "botButtonInactiveStyle";
document.getElementById('bot1Button').onclick = function onclick(event){ botStart(1);};
}
else if(style == 'buyAction'){
document.getElementById('bot1Button').className = "botButtonBuyActionStyle";
setTimeout(function(){ botButtonStyleCheck() }, 500);
}
else{
alert("Fehler beim Stylen von Botbutton");
}
}
else if(bot == 2){
if(style == 'active'){
document.getElementById('bot2Button').className = "botButtonActiveStyle";
document.getElementById('bot2Button').onclick = function onclick(event){ botStop(2);};
}
else if(style == 'inactive'){
document.getElementById('bot2Button').className = "botButtonInactiveStyle";
document.getElementById('bot2Button').onclick = function onclick(event){ botStart(2);};
}
else if(style == 'buyAction'){
document.getElementById('bot2Button').className = "botButtonBuyActionStyle";
setTimeout(function(){ botButtonStyleCheck() }, 500);
}
else{
alert("Fehler beim Stylen von Botbutton");
}
}
else{
alert("Fehler Auswahl eines Botbuttons f<>r Styling");
}
};
function botButtonStyleCheck(){
if(bot1ID != 0){
setBotButtonStyle(1, 'active');
}
else{
setBotButtonStyle(1, 'inactive');
}
if(bot2ID !=0){
setBotButtonStyle(2, 'active');
}
else{
setBotButtonStyle(2, 'inactive');
}
};