////////////Chrome/Safari -> CSGODOUBLE -> INSPECT -> CONSOLE -> PASTE -> SET VALUES -> ENTER ///////////// // // The Stat Tracking add-on allows users to see in detail exactly what and how their // bot is doing, even if they leave the bot by itself. It tracks Net Change in // balance, current and highest losing streaks, how many and in detail what kind of // losing streaks the bot encounters. This allows the user to see exactly where their // bot is losing and can help to find the right settings for them. // // If you would like to enable time stamps for your logs, open up the Chrome // console, and in the upper right, click on the “. . .” and go to settings. // Scroll down a bit and look for the enable time stamps option. ////////////CONFIG/////////// // PLEASE NOTE: If both maxBetAmountBeforeReset and failsafeDenominator are set to be a number that isn't 0 the program won't work! // // SET THESE VARIABLES! // // Set this to your min bet var initialBetAmount = 10; ///// SETTING FOR RAINBOW PROTECTION var anti_rainbow = 1; // Enabled(1) or Disabled(0) var howm_rainbows = 2; // After how many rainbows bet to one color var many_rainbows = 2; // How many bets on one color after rainbow ///// FAIL SAFE // SIMPLE // Max Bet Amount Before Reset Mode // This mode allows you to set a max bet amount before the bot resets to min bet // SET THIS to your maximum bet amount before reset! Set this value to 0 to use fail safe denominator mode var maxBetAmountBeforeReset = 0; // ADVANCED // Fail safe Denominator Mode // This mode uses balance/failsafeDenominator // set this variable to 0 if you wanna use the other mode! var failsafeDenominator = 2.1; // ^^ The max bet is the balance divided by this variable’s number. So at 2, the bot will not make a bet that is more than half your starting balance. At 3 it’s a third, etc. Set it to 1 to let it bet your entire balance. (Note: This does not mean that it will keep you from losing half of your balance exactly, but rather will keep you from placing a bet that is more than half) // The color the bot chooses as the first bet var betColor = 'red'; // ONLY TOUCH THESE IS YOU KNOW EXACTLY WHAT THEY ARE // OTHERWISE IGNORE IT var scalingBetMode = 0; var scalingBetPercentDenominator = 1000; // LOGGING SYSTEM // /* debugout.js by @inorganik */ // save all the console.logs to a file function debugout() { var self = this; // OPTIONS self.realTimeLoggingOn = true; // log in real time (forwards to console.log) self.useTimestamps = false; // insert a timestamp in front of each log self.useLocalStorage = false; // store the output using window.localStorage() and continuously add to the same log each session self.recordLogs = true; // set to false after you're done debugging to avoid the log eating up memory self.autoTrim = true; // to avoid the log eating up potentially endless memory self.maxLines = 14; // if autoTrim is true, this many most recent lines are saved self.tailNumLines = 100; // how many lines tail() will retrieve self.logFilename = 'csgodouble-log.txt'; // filename of log downloaded with downloadLog() // vars self.depth = 0; self.parentSizes = [0]; self.currentResult = ''; self.startTime = new Date(); self.output = ''; this.version = function() { return '0.5.0' } /* USER METHODS */ this.getLog = function() { var retrievalTime = new Date(); // if recording is off, so dev knows why they don't have any logs if (!self.recordLogs) { self.log('[debugout.js] log recording is off.'); } // if using local storage, get values if (self.useLocalStorage) { var saved = window.localStorage.getItem('debugout.js'); if (saved) { saved = JSON.parse(saved); self.startTime = new Date(saved.startTime); self.output = saved.log; retrievalTime = new Date(saved.lastLog); } } return self.output + '\n---- Log retrieved: '+retrievalTime+' ----\n' + self.formatSessionDuration(self.startTime, retrievalTime); } // accepts optional number or uses the default for number of lines this.tail = function(numLines) { var numLines = numLines || self.tailLines; return self.trimLog(self.getLog(), numLines); } // accepts a string to search for this.search = function(string) { var lines = self.output.split('\n'); var rgx = new RegExp(string); var matched = []; // can't use a simple Array.prototype.filter() here // because we need to add the line number for (var i = 0; i < lines.length; i++) { var addr = '['+i+'] '; if (lines[i].match(rgx)) { matched.push(addr + lines[i]); } } var result = matched.join('\n'); if (result.length == 0) result = 'Nothing found for "'+string+'".'; return result } // accepts the starting line and how many lines after the starting line you want this.getSlice = function(lineNumber, numLines) { var lines = self.output.split('\n'); var segment = lines.slice(lineNumber, lineNumber + numLines); return segment.join('\n'); } // immediately downloads the log - for desktop browser use this.downloadLog = function() { var file = "data:text/plain;charset=utf-8,"; var logFile = self.getLog(); var encoded = encodeURIComponent(logFile); file += encoded; var a = document.createElement('a'); a.href = file; a.target = '_blank'; a.download = self.logFilename; document.body.appendChild(a); a.click(); a.remove(); } // records a log this.log = function(obj) { // log in real time if (self.realTimeLoggingOn) console.log(obj); // record log var type = self.determineType(obj); if (type != null && self.recordLogs) { var addition = self.formatType(type, obj); // timestamp, formatted for brevity if (self.useTimestamps) { var logTime = new Date(); self.output += self.formatTimestamp(logTime); } self.output += addition+'\n'; if (self.autoTrim) self.output = self.trimLog(self.output, self.maxLines); // local storage if (self.useLocalStorage) { var last = new Date(); var saveObject = { startTime: self.startTime, log: self.output, lastLog: last } saveObject = JSON.stringify(saveObject); window.localStorage.setItem('debugout.js', saveObject); } } self.depth = 0; self.parentSizes = [0]; self.currentResult = ''; } /* METHODS FOR CONSTRUCTING THE LOG */ // like typeof but classifies objects of type 'object' // kept separate from formatType() so you can use at your convenience! this.determineType = function(object) { if (object != null) { var typeResult; var type = typeof object; if (type == 'object') { var len = object.length; if (len == null) { if (typeof object.getTime == 'function') { typeResult = 'Date'; } else if (typeof object.test == 'function') { typeResult = 'RegExp'; } else { typeResult = 'Object'; } } else { typeResult = 'Array'; } } else { typeResult = type; } return typeResult; } else { return null; } } // format type accordingly, recursively if necessary this.formatType = function(type, obj) { switch(type) { case 'Object' : self.currentResult += '{\n'; self.depth++; self.parentSizes.push(self.objectSize(obj)); var i = 0; for (var prop in obj) { self.currentResult += self.indentsForDepth(self.depth); self.currentResult += prop + ': '; var subtype = self.determineType(obj[prop]); var subresult = self.formatType(subtype, obj[prop]); if (subresult) { self.currentResult += subresult; if (i != self.parentSizes[self.depth]-1) self.currentResult += ','; self.currentResult += '\n'; } else { if (i != self.parentSizes[self.depth]-1) self.currentResult += ','; self.currentResult += '\n'; } i++; } self.depth--; self.parentSizes.pop(); self.currentResult += self.indentsForDepth(self.depth); self.currentResult += '}'; if (self.depth == 0) return self.currentResult; break; case 'Array' : self.currentResult += '['; self.depth++; self.parentSizes.push(obj.length); for (var i = 0; i < obj.length; i++) { var subtype = self.determineType(obj[i]); if (subtype == 'Object' || subtype == 'Array') self.currentResult += '\n' + self.indentsForDepth(self.depth); var subresult = self.formatType(subtype, obj[i]); if (subresult) { self.currentResult += subresult; if (i != self.parentSizes[self.depth]-1) self.currentResult += ', '; if (subtype == 'Array') self.currentResult += '\n'; } else { if (i != self.parentSizes[self.depth]-1) self.currentResult += ', '; if (subtype != 'Object') self.currentResult += '\n'; else if (i == self.parentSizes[self.depth]-1) self.currentResult += '\n'; } } self.depth--; self.parentSizes.pop(); self.currentResult += ']'; if (self.depth == 0) return self.currentResult; break; case 'function' : obj += ''; var lines = obj.split('\n'); for (var i = 0; i < lines.length; i++) { if (lines[i].match(/\}/)) self.depth--; self.currentResult += self.indentsForDepth(self.depth); if (lines[i].match(/\{/)) self.depth++; self.currentResult += lines[i] + '\n'; } return self.currentResult; break; case 'RegExp' : return '/'+obj.source+'/'; break; case 'Date' : case 'string' : if (self.depth > 0 || obj.length == 0) { return '"'+obj+'"'; } else { return obj; } case 'boolean' : if (obj) return 'true'; else return 'false'; case 'number' : return obj+''; break; } } this.indentsForDepth = function(depth) { var str = ''; for (var i = 0; i < depth; i++) { str += '\t'; } return str; } this.trimLog = function(log, maxLines) { var lines = log.split('\n'); if (lines.length > maxLines) { lines = lines.slice(lines.length - maxLines); } return lines.join('\n'); } this.lines = function() { return self.output.split('\n').length; } // calculate testing time this.formatSessionDuration = function(startTime, endTime) { var msec = endTime - startTime; var hh = Math.floor(msec / 1000 / 60 / 60); var hrs = ('0' + hh).slice(-2); msec -= hh * 1000 * 60 * 60; var mm = Math.floor(msec / 1000 / 60); var mins = ('0' + mm).slice(-2); msec -= mm * 1000 * 60; var ss = Math.floor(msec / 1000); var secs = ('0' + ss).slice(-2); msec -= ss * 1000; return '---- Session duration: '+hrs+':'+mins+':'+secs+' ----' } this.formatTimestamp = function(timestamp) { var year = timestamp.getFullYear(); var date = timestamp.getDate(); var month = ('0' + (timestamp.getMonth() +1)).slice(-2); var hrs = Number(timestamp.getHours()); var mins = ('0' + timestamp.getMinutes()).slice(-2); var secs = ('0' + timestamp.getSeconds()).slice(-2); return '['+ year + '-' + month + '-' + date + ' ' + hrs + ':' + mins + ':'+secs + ']: '; } this.objectSize = function(obj) { var size = 0, key; for (key in obj) { if (obj.hasOwnProperty(key)) size++; } return size; } /* START/RESUME LOG */ if (self.useLocalStorage) { var saved = window.localStorage.getItem('debugout.js'); if (saved) { saved = JSON.parse(saved); self.output = saved.log; var start = new Date(saved.startTime); var end = new Date(saved.lastLog); self.output += '\n---- Session end: '+saved.lastLog+' ----\n'; self.output += self.formatSessionDuration(start, end); self.output += '\n\n'; } } self.output += '---- Session started: '+self.startTime+' ----\n\n'; } var bugout = new debugout(); // jQUERY BUTTON // var navbar = $('.navbar-header'); var navbarHtml = navbar.html(); navbar.html(''+navbarHtml); ////////////////////////////// //DON'T TOUCH NOTHING BELOW THIS LINE var rainbow_bet = 0; var bets_rainbow = 0; var num_rainbow = 0; var bets_won = 0; var bets_lost = 0; var bets_all = 0; var highestLossStreak = 0; var currentLossStreak = 0; var startingBalance = 0; var initialBalance = 0; var mode = '1'; // Don't touch var currentBetAmount = 0 var startvar = 0; //LOSS-STREAK COUNTERS var lossStreak1 = 0; var lossStreak2 = 0; var lossStreak3 = 0; var lossStreak4 = 0; var lossStreak5 = 0; var lossStreak6 = 0; var lossStreak7 = 0; var lossStreak8 = 0; var lossStreak9 = 0; var lossStreak10 = 0; var lossStreak11 = 0; var lossStreak12 = 0; function lossStreakCounter() { if (currentLossStreak == 1) { lossStreak1++ } if (currentLossStreak == 2) { lossStreak2++ } if (currentLossStreak == 3) { lossStreak3++ } if (currentLossStreak == 4) { lossStreak4++ } if (currentLossStreak == 5) { lossStreak5++ } if (currentLossStreak == 6) { lossStreak6++ } if (currentLossStreak == 7) { lossStreak7++ } if (currentLossStreak == 8) { lossStreak8++ } if (currentLossStreak == 9) { lossStreak9++ } if (currentLossStreak == 10) { lossStreak10++ } if (currentLossStreak == 11) { lossStreak11++ } if (currentLossStreak == 12) { lossStreak12++ } } function tick() { var a=getStatus();if(a!==lastStatus&&"unknown"!==a){switch(a){case"waiting":bet();break;case"rolled":rolled()}lastStatus=a,printInfo() } }function checkBalance() { return getBalance()=howm_rainbows && anti_rainbow==1) { bets_rainbow=bets_rainbow+1 bet_rainbow() } else { bets_rainbow=0 wonLastRoll()?bet_won():bet_lost() } } function bet_rainbow() { if(bets_rainbow==many_rainbows) { num_rainbow=0 } rainbow_bet=rainbow_bet+1 wonLastRoll()?rainbow_won():rainbow_lost() } function rainbow_won() { bets_won=bets_won+1 if(lastBetColor=="red") { betColor='black' } else { betColor='red' } currentLossStreak = 0; } function rainbow_lost() { bets_lost=bets_lost+1 if(lastBetColor=="red") { betColor='red' } else(lastBetColor=="black") { BetColor="black" } currentLossStreak += 1; if (currentLossStreak > highestLossStreak) { highestLossStreak = currentLossStreak; } lossStreakCounter(); } function bet_won() { bets_won=bets_won+1 num_rainbow=0 if(lastBetColor=="red") { betColor='red' } else(lastBetColor=="black") { BetColor="black" } currentLossStreak = 0; } function bet_lost() { bets_lost=bets_lost+1 num_rainbow=num_rainbow+1 if(lastBetColor=="red") { betColor='black' } else { betColor='red' } currentLossStreak += 1; if (currentLossStreak > highestLossStreak) { highestLossStreak = currentLossStreak; } lossStreakCounter(); } function bet() { if(startingBalance == 0) { startingBalance = getBalance() } if (getBalance() < initialBetAmount) { console.warn("You don't have enough credits to bet that amount!") } if (getBalance() == 0) { console.warn("You have 0 credits! Deposit credits to use the bot.") } if (failsafeDenominator != 0 && maxBetAmountBeforeReset != 0) { console.warn("You have both options set! Please set either failsafeDenominator or maxBetAmountBeforeReset to 0.") } else { if(scalingBetMode == 1 && startvar == 1) { initialBetAmount = Math.floor(getBalance()/scalingBetPercentDenominator) currentBetAmount=wonLastRoll()?(Math.floor(getBalance()/scalingBetPercentDenominator)):2*currentBetAmount if (currentBetAmount >= (initialBalance/failsafeDenominator) && failsafeDenominator != 0) { currentBetAmount = Math.floor(getBalance()/scalingBetPercentDenominator) initialBalance = getBalance() console.warn("Maximum bet limit reached! New initial balance set to ", initialBalance) } if (currentBetAmount >= maxBetAmountBeforeReset && maxBetAmountBeforeReset != 0) { currentBetAmount = Math.floor(getBalance()/scalingBetPercentDenominator) initialBalance = getBalance() console.warn("Maximum bet limit reached! New initial balance set to ", initialBalance) } } if(scalingBetMode == 0 && startvar == 1) { currentBetAmount=wonLastRoll()?(initialBetAmount):2*currentBetAmount if (currentBetAmount >= (initialBalance/failsafeDenominator) && failsafeDenominator != 0) { currentBetAmount = Math.floor(initialBetAmount) initialBalance = getBalance() console.warn("Maximum bet limit reached! New initial balance set to ", initialBalance) } if (currentBetAmount >= maxBetAmountBeforeReset && maxBetAmountBeforeReset != 0) { currentBetAmount = Math.floor(initialBetAmount) initialBalance = getBalance() console.warn("Maximum bet limit reached! New initial balance set to ", initialBalance) } } } if (scalingBetMode == 0 && startvar == 0) { currentBetAmount = initialBetAmount startvar = 1 } checkBalance()&&(setBetAmount(currentBetAmount),setTimeout(placeBet,50)) } function setBetAmount(a) { $betAmountInput.val(a) } function placeBet() { return"red"===betColor?($redButton.click(),void(lastBetColor="red")):($blackButton.click(),void(lastBetColor="black")) } function getStatus() { var a=$statusBar.text();if(hasSubString(a,"Rolling in"))return"waiting";if(hasSubString(a,"***ROLLING***"))return"rolling";if(hasSubString(a,"rolled")){var b=parseInt(a.split("rolled")[1]);return lastRollColor=getColor(b),"rolled"}return"unknown" } function getBalance() { return parseInt($balance.text()) } function hasSubString(a,b) { return a.indexOf(b)>-1 } function getColor(a) { return 0==a?"green":a>=1&&7>=a?"red":"black" } function lossStreakCounter() { if (currentLossStreak == 1) { lossStreak1++ } if (currentLossStreak == 2) { lossStreak2++ } if (currentLossStreak == 3) { lossStreak3++ } if (currentLossStreak == 4) { lossStreak4++ } if (currentLossStreak == 5) { lossStreak5++ } if (currentLossStreak == 6) { lossStreak6++ } if (currentLossStreak == 7) { lossStreak7++ } if (currentLossStreak == 8) { lossStreak8++ } if (currentLossStreak == 9) { lossStreak9++ } if (currentLossStreak == 10) { lossStreak10++ } if (currentLossStreak == 11) { lossStreak11++ } if (currentLossStreak == 12) { lossStreak12++ } } function wonLastRoll() { return lastBetColor?lastRollColor===lastBetColor:null } var currentBetAmount=initialBetAmount,currentRollNumber=1,lastStatus,lastBetColor,lastRollColor,$balance=$("#balance"),$betAmountInput=$("#betAmount"),$statusBar=$(".progress #banner"),$redButton=$("#panel1-7 .betButton"),$blackButton=$("#panel8-14 .betButton"),refreshIntervalId=setInterval(tick,500); setInterval(function() { if (!WS) { chat('alert', 'Reconnecting...'); connect(); } }, 10000);