Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // CONFIG ////////////////
- var betColor = 'green';
- var START_BETTING_FROM = 10;
- //////////////////////////
- var stack_table = [3,3,5,5,5,7,7,7,8,8,9,9,12,15,16,16,19,20,20,23,23,25,25,25,30,30,33,38,43,43,45,50,50,58,60,65,70,75,80,88,100,103,113,125,150,160,175,
- 188,200,210,223,240,260,275,300,325,350,375,408,435,465,500,545,590,635,685,735,800,850,875,1000,1100,1200,1300,1400,1500,1600,1710,1830];
- var currentBetAmount = 0,
- currentRollNumber = 1,
- lastStatus, lastBetColor, lastRollColor, $balance = $("#balance"),
- $betAmountInput = $("#betAmount"),
- $statusBar = $(".progress #banner"),
- $greenButton = $("#panel0-0 .betButton"),
- refreshIntervalId = setInterval(tick, 500);
- var green_from = 0;
- var actual_betting_index = 0;
- var place_bet = false;
- function tick() {
- var a = getStatus();
- if (a !== lastStatus && "unknown" !== a) {
- switch (a) {
- case "waiting":
- bet();
- break;
- case "rolled":
- rolled()
- }
- lastStatus = a;
- printInfo();
- }
- }
- function rolled() {
- currentRollNumber++;
- if(lastRollColor != "green"){
- green_from++;
- if(green_from >= START_BETTING_FROM){
- currentBetAmount = stack_table[actual_betting_index];
- actual_betting_index++;
- place_bet = true;
- }
- }else{
- actual_betting_index = 0;
- green_from = 0;
- place_bet = false;
- }
- }
- function checkBalance() {
- return getBalance() < currentBetAmount ? (console.warn("BANKRUPT! Not enough balance for next bet, aborting."), clearInterval(refreshIntervalId), !1) : !0
- }
- function bet() {
- if(place_bet){
- checkBalance() && (setBetAmount(currentBetAmount), setTimeout(placeBet, 500))
- }
- }
- function placeBet() {
- $greenButton.click();
- }
- function setBetAmount(a) {
- $betAmountInput.val(a)
- }
- 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 hasSubString(a, b) {
- return a.indexOf(b) > -1
- }
- function getColor(a) {
- return 0 == a ? "green" : a >= 1 && 7 >= a ? "red" : "black"
- }
- function wonLastRoll() {
- return betColor ? lastRollColor === betColor : null
- }
- function getBalance() {
- return parseInt($balance.text())
- }
- function printInfo() {
- var a = " \nStatus: " + lastStatus + "\nRolls played: " + currentRollNumber + "\nCurrent bet amount: " + currentBetAmount + "\nLast roll result: " + (null === wonLastRoll() ? "-" : wonLastRoll() ? "won" : "lost");
- console.log(a)
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement