Guest User

PD3Bot v.4

a guest
Oct 10th, 2014
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  
  2. var loop, currentloss, curbet, basebet, seedcount, prebet, prerollsenabled, profit, prerollson, prerollcount, betval, currentwin, target2, condition2, wincount, xhr, tstatus, seedlength, counter, charset, everyxrolls,wins,losses, data1, data2, swapenabled, betstarted, wmultcount, lmultcount, storebet;
  3. condition2="<";
  4. target2="10";
  5. seedcount=0;
  6. currentloss = 0;
  7. lmultcount = 0;
  8. wmultcount = 0;
  9. prerollcount = 0;
  10. wins = 0;
  11. losses = 0;
  12. profit = 0;
  13. //jQuery UI CSS
  14. var jqueryready = false;
  15. var link = document.createElement("link");
  16. link.href = "https://jquery-ui.googlecode.com/svn/tags/latest/themes/dark-hive/jquery-ui.css";
  17. link.type = "text/css";
  18. link.rel = "stylesheet";
  19. document.getElementsByTagName("head")[0].appendChild(link);
  20. //jQuery UI inject
  21. (function() {
  22.     jqueryready = true;
  23.     var e = ".thing",
  24.         t = {
  25.             outline: "1px dashed #f0f",
  26.             cursor: "pointer"
  27.         };
  28.     var n = function() {
  29.         if (window.jQuery) {
  30.             r();
  31.         } else {
  32.             var e = document.createElement("script");
  33.            
  34.             e.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js");
  35.             document.body.appendChild(e);
  36.         }
  37.     };
  38.     var r = function() {
  39.         if (window.jQuery.ui) {
  40.             i();
  41.         } else {
  42.             var e = document.createElement("script");
  43.        
  44.             e.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.js");
  45.             document.body.appendChild(e);
  46.             initGUI();
  47.         }
  48.     };
  49.     var i = function() {
  50.         $(e).css(t).draggable().on("click", function(e) {
  51.             console.log(e.target.id + ":", e.target.style.left, e.target.style.top);
  52.         });
  53.     };
  54.     n();
  55. })();
  56. betstarted=false;var swapswap=2,swapcount=0;
  57. var curbalance=$('div.hero > div.hero__content > div > div.grid__item.S--one-whole.M--one-whole.custom--one-whole > aside > div.grid.grid--bottom.grid--reversed > div:nth-child(2) > span.btn.btn--tertiary.btn--large.btn--limited.btn--block > span.btn__text.select div').text()*100000000;
  58. function bet() {
  59.     if (betstarted === false) {
  60.         betstarted=true;
  61.         if ($('#stoprofitenabled').is(':checked') === true){
  62.             if (profit >= $('#stopprofitamount').val()) {
  63.                 clearInterval(loop);
  64.               loopenabled=false;
  65.                 loopcount=0;
  66.             }
  67.         }
  68.         if ($('#stoploss2enabled').is(':checked') === true){
  69.             if (profit <= (-1 * $('#stoplossamount').val())) {
  70.                 clearInterval(loop);
  71.               loopenabled=false;
  72.                 loopcount=0;
  73.             }
  74.         }
  75.         if (prerollsenabled === true){
  76.                 prebet=Math.floor($('#prerollbet').val()*100000000);
  77.                 curbet = prebet;
  78.         } else {
  79.             curbet=betval;
  80.         }
  81.         var betData = {
  82.                 amount: curbet,
  83.                 condition: condition2,
  84.                 target: target2,
  85.             },
  86.             url = 'https://api.primedice.com/api/bet?access_token=' + localStorage.token;
  87.          if (curbet > curbalance) {
  88.             clearInterval(loop);
  89.               loopenabled=false;
  90.                 loopcount=0;
  91.          }
  92.         $.ajax({
  93.             url: url,
  94.             type: 'POST',
  95.             data: betData,
  96.             datatype: 'json',
  97.             success: function(data, textStatus, jqXHR) {
  98.                 if ($('#seedchangeon').is(":checked") === true){
  99.                     if ($('#charset').val() != "") {
  100.                          charset=$('#charset').val();
  101.                     }
  102.                     if ($('#seedxrolls').val() == ""){} else {
  103.                         seedcount++;
  104.                     if (seedcount >= $('#seedxrolls').val()){
  105.                         seedchange(seedgen());
  106.                         seedcount=0;
  107.                                 }
  108.                             }
  109.                         }
  110.                 data1 = data;
  111.                 profit = profit = (parseFloat(profit) + parseFloat((data1.bet.profit/100000000))).toFixed(8);
  112.                 curbalance = data1.user.balance;
  113.                 addRow();
  114.  
  115.                 if (loopenabled === true) {
  116.                     loopcount++;
  117.                 }
  118.                 if ($('#hilo').val() == "swap") {
  119.                     if ($('#swaprollsenabled').is(':checked') === true){
  120.                         swapswap = $('#swaprolls').val();
  121.                         swapcount++;
  122.                         if (swapcount >= swapswap){
  123.                            swap();
  124.                            swapcount=0;
  125.                         }
  126.                 } else {
  127.                     swap();
  128.                 }
  129.             }      
  130.                 $('.btn__text.select div').text((data1.user.balance / 100000000).toFixed(8));
  131.                 if (data.bet.win === true) {
  132.                    win();
  133.                     if (prerollson === true){
  134.                         if (prerollsenabled === false) {
  135.                             prerollsenabled = true;
  136.                             prerollcount=0;
  137.                         }
  138.                     }  
  139.                     $('.btn__text.select div').attr('style', 'color:green;');
  140.                
  141.                 } else {
  142.                     lose();
  143.                     $('.btn__text.select div').attr('style', 'color:red;');
  144.                 }
  145.                
  146.                
  147.                 if (data.bet.win === true) { $('#proff').attr('style', 'text-align: center; width: 20%; padding: 5px;color:green;'); } else { $('#proff').attr('style', 'text-align: center; width: 20%; padding: 5px;color:red;'); }
  148.             betstarted=false;
  149.             },
  150.             error: function(jqXHR, textStatus, errorThrown) {
  151.                  betstarted=false;
  152.             }
  153.    
  154.    
  155.         });
  156.     } else if (betstarted === true) {}
  157. }
  158.  
  159. prerollcount=0;
  160.  
  161.  
  162. function preroll(){
  163.  
  164. }
  165. function win() {
  166.     if ($('#stopwinenabled').is(':checked') === true && prerollsenabled === false) {
  167.         clearInterval(loop);
  168.         currentloss=0;
  169.         loopcount=0;
  170.         loopenabled=false;
  171.     }
  172.    if (prerollson === true){
  173.     if (prerollsenabled === true) {
  174.             prerollcount = 0;
  175.         }
  176.     }
  177.     if ($('#seedchangeonwin').is(':checked') === true) {
  178.         seedchange(seedgen());
  179.     }
  180.     wins++;
  181.     currentloss=0;
  182.  
  183.     if ($('#winmultenabled').is(':checked') === true) {
  184.         if (prerollsenabled === true) {} else {
  185.             if (prerollson === true && prerollsenabled === false) {
  186.                 prerollsenabled = true;
  187.                 prerollcount = 0;
  188.             }
  189.             wmultcount++;
  190.             if (wmultcount < $('#resetwin').val()){
  191.                 betval = betval * $('#winlossmultiplier').val();
  192.             } else if (wmultcount >= $('#resetwin').val()) {
  193.                 betval = basebet;
  194.                 wmultcount = 0;
  195.  
  196.         }
  197.            
  198.     }
  199. }
  200.     if ($('#lossmultenabled').is(':checked') === true) {
  201.         if (prerollsenabled === true) {prerollcount=0;} else {
  202.              if (prerollson === true && prerollsenabled === false){
  203.                 prerollsenabled = true;
  204.                 prerollcount = 0;
  205.             }
  206.             betval = basebet;
  207.             lmultcount = 0;
  208.  
  209.         }
  210.     }
  211.    
  212. }
  213. function lose() {
  214.     currentloss++;
  215.     if ($('#stoplossenabled').is(':checked') === true && prerollsenabled === false) {
  216.         if ($('#stoplosses').val() <= currentloss){
  217.         clearInterval(loop);
  218.         currentloss=0;
  219.         loopcount=0;
  220.         loopenabled=false;
  221.         }
  222.     }
  223.     if (prerollson === true){
  224.     if (prerollsenabled === true){
  225.             prerollcount++;
  226.     if (prerollcount >= $('#numprerolls').val()){
  227.             prerollsenabled=false;
  228.     }
  229.     }
  230.    
  231.     }  
  232.     losses++;
  233.    
  234.     if ($('#lossmultenabled').is(':checked') === true) {
  235.         if (prerollsenabled === true) {} else {
  236.             lmultcount++;
  237.             if (lmultcount >= $('#multloss').val()){
  238.                 betval = betval * $('#winlossmultiplier').val();
  239.                 lmultcount = 0;
  240.             }
  241.         }
  242.     }
  243. }
  244.  
  245. function swap(){
  246.     if (condition2 == "<") {
  247.         condition2=">";
  248.         target2 = (99.99-(99/$('#payout').val())).toFixed(2);
  249.     } else if (condition2 == ">") {
  250.         condition2="<";
  251.         target2 =(99/$('#payout').val()).toFixed(2);
  252.     }
  253. }
  254.  
  255.  
  256. function addRow() {
  257.     $('#lastID').text('Last Bet ID: ' + data1.bet.id);
  258.     var bettable = '', bettab = '#lastbet2';
  259.             bettable += '<tr><td>' + (data1.bet.amount / 100000000).toFixed(8) + '</td>';
  260.             bettable += '<td>' + data1.bet.multiplier + 'x' + '</td>';  /* return bet payout */
  261.             bettable += '<td>' + (data1.bet.target).toFixed(2) + '</td>';  /* return target*/
  262.             bettable += '<td>' + data1.bet.roll + '</td>';  /* return roll */
  263.             bettable += '<td id="proff">'  + (data1.bet.profit / 100000000).toFixed(8) + '</td></tr>';
  264.    
  265.     var stattable = '', stattab = '#lastbet3';
  266.         stattable += '<tr><td style="color:green;">'+ (data1.user.balance/100000000).toFixed(8) + '</td><td style="color:red;">'+ currentloss + '</td><td style="color:green;">' + wins + '</td><td style="color:red;">'+ losses +'</td><td id="profit">'+ profit +'</td></tr>';
  267.         $(stattab).empty();
  268.         $(stattab).prepend(stattable);
  269.         stattable = '';
  270.     if ($(bettab + ' tbody tr').length >= 3) {
  271.         $(bettab + ' tr').last().remove();
  272.      $(bettab).prepend(bettable);
  273.         bettable='';
  274.     } else if ($(bettab).length < 3) {
  275.         $(bettab).prepend(bettable);
  276.         bettable='';
  277.     }
  278.     $('#lastbet2 *, #lastbet3 *, #lastbet *, #proff').css("text-align", "center");$('#lastbet2 *, #lastbet3 *, #lastbet *').css("width", "20%");
  279.          $('#lastbet *').css("padding", "5px");$('#lastbet *').css("border-bottom", "1px solid #ccc");$('#result-1').css("padding", "5px");
  280.          $('#lastbet2 *, #lastbet3 *, #proff').css("padding", "5px");$('#lastbet > tbody > tr > th:nth-child(2)').css("border-top", "1px solid #ddd");
  281.           if (profit >= 0) {
  282.             $('#profit').css("color", "green");
  283.           } else {
  284.             $('#profit').css("color", "red");
  285.           }
  286. }
  287.  
  288. $('<div id="paraContainer">').appendTo('.hero');
  289. var gui;
  290. gui='';
  291.     gui += '<div id="result">';
  292.     gui += '<ul>';
  293.     gui += '<li><a href="/play#lastbet-1">Last Bets: </a></li>';
  294.     gui += '<li><a style="float:right;" id="lastID" href="/play#lastbet-1">Last Bet ID: (none yet!)</a></li>';
  295.      gui += '<li><a style="float:right;" id="detach" href="/play#lastbet-1">Detach</a></li>';
  296.     gui += '</ul>';
  297.     gui += '<div id="result-1">';
  298.     gui += '<table id="lastbet">';
  299.     gui += '<tr><th>Bet</th><th>Payout</th><th>Game</th><th>Roll</th><th>Profit</th></tr></table>';
  300.         gui += '<table id="lastbet2">';    
  301.         gui += '</table>';
  302.     gui += '<table id="lastbet">';
  303.     gui += '<tr><th>Balance</th><th>Loss Streak</th><th>Total Wins</th><th>Total Losses</th><th>Total Profit</th></tr></table>';
  304.         gui += '<table id="lastbet3">';
  305.         gui += '</table>';
  306.     gui += '</div>';
  307.     gui += '</div>';
  308.     gui +='</div>';
  309.     gui += '<div id="paraGUI">';
  310.     gui += '<ul>';
  311.         gui += '<li><a href="/play#paraGUI-1">Params</a></li>';
  312.         gui += '<li><a href="/play#paraGUI-2">On Win/Loss</a></li>';
  313.         gui += '<li><a href="/play#paraGUI-3">Advanced</a></li>';
  314.         gui += '<li><a href="/play#paraGUI-4">Seed</a></li>';
  315.         gui += '<li><a href="/play#paraGUI-5">Credits</a></li>';
  316.     gui += '</ul>';
  317.     gui += '<div id="paraGUI-1">';
  318.         gui += '<div>';
  319.             gui += '<table id="params1">';
  320.             gui += '<tr><th>Basebet:</th><th>Multiplier:</th><th>Hi/Lo/Swap</th></tr>';
  321.                 gui += '<tr><td><input id="basebet" placeholder="Basebet"/></td><td><input id="payout" placeholder="ex. 10, 90"/></td>';
  322.                 gui += '<td><select id="hilo"><option value="hi">Hi</option><option value="lo">Lo</option><option value="swap">Swap</option></select></td></tr>';
  323.             gui += '<tr><th>Enable Prerolls</th><th># of Prerolls</th><th>Preroll Bet</th></tr>';
  324.                 gui += '<tr><td><input id="prerollsenabled" type="checkbox"/></td><td><input id="numprerolls"/></td><td><input id="prerollbet"/></td></tr>';
  325.             gui += '</table>';
  326.         gui += '</div>';
  327.     gui +='</div>';
  328.     gui +='<div id="paraGUI-2">';
  329.         gui +='<div>';
  330.             gui += '<table id="params1">';
  331.             gui += '<tr><th>Multiply On Loss? <input id="lossmultenabled" type="checkbox"/></th><th>Multiply on Win? <input id="winmultenabled" type="checkbox"/></th><th>Multiplier on W/L</th></tr>';
  332.             gui += '<tr><td><label for="multloss">Mutiply After X Losses:</label><br><input id="multloss" placeholder="Multiply Every X Rolls"/></td><td><label for="multwin">Reset After X Wins:</label><br><input id="resetwin" placeholder="Reset After X Wins"/></td>';
  333.             gui += '<td><input id="winlossmultiplier" placeholder="2 (2x), 1.5 (1.5x) etc"/></tr>';
  334.             gui += '</table>';
  335.  
  336.         gui+= '</div>';
  337.     gui +='</div>';
  338.     gui +='<div id="paraGUI-3">';
  339.         gui +='<div>';
  340.             gui += '<table id="params1">';
  341.             gui += '<tr><th><label>Stop After: <input id="stoplossenabled" type="checkbox"></label></th><th><label>Stop On Win: </label></th><th>Swap After: <input id="swaprollsenabled" type="checkbox"></th></tr>';
  342.             gui += '<tr><td><input style="width:85px;" id="stoplosses" placeholder="# of losses"/></td><td><input id="stopwinenabled" type="checkbox"></td>';
  343.             gui += '<td><input id="swaprolls" type="text" placeholder="# of rolls"></tr>';
  344.             gui += '<tr><th>Stop on Profit:<input id="stopprofitenabled" type="checkbox"></th><th>Stop on Loss: <input id="stoploss2enabled" type="checkbox"></th></tr>';
  345.             gui += '<tr><td><input id="stopprofitamount" type="text"/> </td><td>-<input id="stoplossamount" type="text"/></td></tr>';
  346.              gui += '<tr><p>Note: Use Total Profit as your reference for stop loss/profit. Do NOT enter a balance.</p></tr>'
  347.             gui += '</table>';
  348.  
  349.         gui+= '</div>';
  350.     gui +='</div>';
  351.     gui +='<div id="paraGUI-4">';
  352.         gui +='<div>';
  353.             gui += '<table id="params1">';
  354.             gui += '<tr><th>Current Seed:</th><th>Charset:</th><th>Change Every #: <input id="seedchangeon" type="checkbox"/></th></tr>';
  355.             gui += '<tr><td><input style="color:red;text-align:center;"id="currentseed"/></td><td><input id="charset" placeholder="Optional"/></td>';
  356.             gui += '<td><input id="seedxrolls" placeholder="ex. 1, 10, 20"/></tr>';
  357.             gui += '<tr><td>Change on Win: <input id="seedchangeonwin" type="checkbox"/> </td></tr>';
  358.  
  359.             gui += '</table>';
  360.         gui += '</div>';
  361.     gui +='</div>';
  362.     gui +='<div id="paraGUI-5">';
  363.         gui += '<div>';
  364.         gui += '<p>Version: 0.4</p>';
  365.         gui += '<p>Created By: paradocks</p>';
  366.         gui += '<p>PD Username: paradocks</p>';
  367.         gui += '<p>BTCTalk Username: paradoxal420</p>';
  368.         gui += '<p>Tip Addy: <input type="text" style="width:auto;"value="1LuLz9djKFPTfbFuCKedm2FuX1fiSqt5hg"/></p>';
  369.  
  370.         gui += '</div>';
  371.     gui +='</div>';
  372. gui +='<div id="buttonz"><button id="start">Start</button><button id="stop">Stop</button><button id="setparams">Set Params</button><button id="seedchange">Change Seed</button><button id="saveparams">Save Params</button><button id="resetstats">Reset Stats</button><br><label for="numrolls">Number of Rolls: <input id="numrollsenabled" type="checkbox"></label><input style="width:85px;" id="numrolls"/><br></div>';
  373. gui +='</div>';
  374. $(gui).appendTo("#paraContainer");
  375.  
  376.  
  377. seedlength = 5;
  378. counter = 0;
  379. charset = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ123';
  380. everyxrolls = 3;
  381.  
  382. function seedgen() {
  383.     var seed = '';
  384.  
  385.     for (var i = 0; i <= seedlength; i++)
  386.  
  387.         seed += charset.charAt(Math.floor(Math.random() * charset.length));
  388.  
  389.     return seed;
  390. }
  391.  
  392. function seedchange(s) {
  393.  
  394.     var url = 'https://api.primedice.com/api/seed?access_token=' + localStorage.token,
  395.     sData = {
  396.         seed: s
  397.     };
  398.  
  399.     $.ajax({
  400.         url: url,
  401.         type: 'POST',
  402.         data: sData,
  403.         datatype: 'json',
  404.         success: function(data, textStatus, jqXHR) {
  405.             data2 = data;
  406.             $('#currentseed').val(data2.seeds.client);
  407.    
  408.  
  409.         },
  410.         error: function(jqXHR, textStatus, errorThrown) {
  411.                 return false;
  412.         }
  413.     });
  414. }
  415. // Click Funcs
  416. $('#seedchange').click(function(){
  417.     seedchange(seedgen());
  418. });
  419. $('#detach').click(function(){
  420.     $('#result').draggable();
  421. });
  422. $('#setparams').click(function(){
  423.     if ( $('#prerollsenabled').is(':checked') === true) {
  424.  
  425.         prerollson = true;
  426.         prerollcount=0;
  427.         prerollsenabled=true;
  428.         prebet=Math.floor($('#prerollbet').val()*100000000);
  429.         basebet = Math.floor($('#basebet').val()*100000000);
  430.         betval = basebet;
  431.  
  432.     } else if ( $('#prerollsenabled').is(':checked') === false ) {
  433.         prerollson = false;
  434.         prerollsenabled=false;
  435.         basebet = Math.floor($('#basebet').val()*100000000);
  436.         betval = basebet;
  437.     }
  438.    
  439.     if ($('#hilo').val() == "hi") {
  440.         condition2=">";
  441.         target2 = (99.99-(99/$('#payout').val())).toFixed(2);
  442.     } else if ($('#hilo').val() == "lo") {
  443.         condition2="<";
  444.         target2 = (99/$('#payout').val()).toFixed(2);
  445.     } else if ($('#hilo').val() == "swap") {
  446.         condition2="<";
  447.         target2 = 0 + (99/$('#payout').val()).toFixed(2);
  448.         swapenabled=true;
  449.     }
  450. });
  451. $('#saveparams').click(function(){
  452.     localStorage.setItem("params-stored", true);
  453.     localStorage.setItem("basebet", $('#basebet').val());
  454.     localStorage.setItem("payout", $('#payout').val());
  455.     localStorage.setItem("prerollbet", $('#prerollbet').val());
  456.     localStorage.setItem("prerollenabled", $('#prerollsenabled').is(':checked'));
  457.     localStorage.setItem("numprerolls", $('#numprerolls').val());
  458.  
  459. })
  460. if (localStorage.getItem("params-stored") === "true") {
  461. $('#basebet').val(localStorage.getItem("basebet"));
  462. $('#payout').val(localStorage.getItem("payout"));
  463. $('#prerollbet').val(localStorage.getItem("prerollbet"));
  464. $('#prerollsenabled').prop('checked', localStorage.getItem("prerollenabled"));
  465. $('#numprerolls').val(localStorage.getItem("numprerolls"));
  466. }
  467. var loop, loopenabled, loopcount, looptimes;
  468. loopenabled = false;
  469. loopcount = 0;
  470. $('#start').click(function(){
  471.     if ($('#numrollsenabled').is(':checked') === true) {
  472.         looptimes = $('#numrolls').val();
  473.     } else {
  474.  
  475.         looptimes = 999999999;  
  476.     }
  477.    
  478.     if (loopenabled === false) {
  479.         loopenabled = true;
  480.         loop = setInterval(function(){
  481.            
  482.             if (loopcount >= looptimes){
  483.                 clearInterval(loop);
  484.                 loopcount = 0;
  485.                 loopenabled=false;
  486.             } else {
  487.                 bet();
  488.             }
  489.         }, 103);
  490.  
  491.     }
  492.  
  493. });
  494.  
  495. $('#stop').click(function(){
  496.     clearInterval(loop);
  497.     loopenabled=false;
  498.     loopcount=0;
  499. });
  500. $('#resetstats').click(function(){
  501. wins = 0;
  502. losses = 0;
  503. profit = 0;
  504. currentloss = 0;  
  505. addRow();
  506. });
  507.  
  508. function initGUI(){
  509.     setTimeout(function(){
  510.         $('#paraContainer').css("font-size", "11px")
  511.         $('#result, #paraGUI').tabs();
  512.         $('#paraGUI-1, #params1 td, #params1 th').css("padding", "5px");
  513.         $('#params1 select, #params1 input').css("width",  "80%");
  514.         $('#params1 select, #params1 input').css("margin",  "2px");
  515.         $('#params1 select, #params1 input').css("padding",  "4px");
  516.         $('#params1 td, #params1 th').css("text-align", "center");
  517.         $('#buttonz *').css("margin","5px");
  518.         $('#buttonz').css("padding","3px");
  519.         $('#buttonz').css("text-align","center");
  520.         $('#buttonz').css("border-top","1px solid #bbb");
  521.         $('#paraContainer').draggable();
  522.         $('#paraContainer').css("z-index","1000");
  523.         $('#paraContainer').width(450);
  524.         $('#paraContainer button').button();
  525.     },750);
  526. }
Advertisement
Add Comment
Please, Sign In to add comment