paradocks

Untitled

Jan 12th, 2015
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var flameBot, betspeed, aftermanualtrigger, loop, loopenabled, betData, condition, profit, target, losscount, totalloss, totalwin, currentbet, basebet, mainmult, initmult, result, UI = '',
  2.     UI2 = '';
  3. profit = 0;
  4. betspeed = 500;
  5. loopcount = 0;
  6. betstarted = false;
  7. loopenabled = false;
  8. aftermanualtrigger = false;
  9. flameBot = {
  10.     initialize: {
  11.         init1: function() {
  12.             var lib = '<link rel="stylesheet" href="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css" /><script src="https://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>';
  13.             $(lib).appendTo('head');
  14.             setTimeout(function() {
  15.                 flameBot.initialize.init2();
  16.             }, 1000);
  17.         },
  18.         init2: function() {
  19.             losscount = 0;
  20.             totalloss = 0;
  21.             totalwin = 0;
  22.             $('.hero__main').empty().css('width', '550px') & $('.hero__main').css("padding", "0") & $(UI).appendTo('.hero__main') &
  23.                 $('#flameBot').tabs() & $('button').button().css('font-size', '13px').css('padding', '5px');
  24.             $('#stats th').css("width", "20%").css("font-size", "15px");
  25.             $('#hilo, #resetorzero').buttonset();
  26.             $('#flameBot li').css('font-size', '15px');
  27.             $('#flameBot #resetorzero').css('font-size', '13px');
  28.             $('#flameBot div[role=tabpanel] td').css('padding', 1);
  29.             $('#start').click(function() {
  30.  
  31.                 looptimes = 999999999;
  32.                 if (loopenabled === false) {
  33.                     loopenabled = true;
  34.  
  35.                     loop = setInterval(function() {
  36.  
  37.                         if (loopcount >= looptimes) {
  38.                             clearInterval(loop);
  39.                             loopcount = 0;
  40.                             loopenabled = false;
  41.                         } else {
  42.                             if (betstarted === true) {} else {
  43.                                 flameBot.API.bet();
  44.                             }
  45.                         }
  46.                     }, betspeed);
  47.  
  48.                 }
  49.  
  50.             });
  51.             $('#stop').click(function() {
  52.                 clearInterval(loop);
  53.                 loopenabled = false;
  54.                 loopcount = 0;
  55.             });
  56.             $('#setparams').click(function() {
  57.                 flameBot.API.setParams();
  58.             })
  59.         }
  60.     },
  61.     tools: {
  62.         dec2Sat: function(decimal) {
  63.             return (Math.floor(decimal * 1e8));
  64.         },
  65.         token: function() {
  66.             return localStorage.token;
  67.         },
  68.         satToDec: function(satoshi) {
  69.             return ((satoshi / 1e8).toFixed(8));
  70.         },
  71.  
  72.     },
  73.     API: {
  74.         onLoss: function() {
  75.             totalloss++;
  76.             losscount++;
  77.             if ($('#afterlossesenabled').is(':checked') === true) {
  78.                 if (losscount >= $('#afterlosses').val()) {
  79.                     if ($('#aftermanualenabled').is(':checked') === true) {
  80.  
  81.                         if (aftermanualtrigger === true) {} else {
  82.                             var r = confirm("Click Okay to reset to base. Click cancel to bet 0 until win.");
  83.                             if (r == true) {
  84.                                 aftermanualtrigger = false;
  85.                                 currentbet = basebet;
  86.                                 losscount = 0;
  87.                             } else {
  88.                                 aftermanualtrigger = true;
  89.                                 currentbet = 0;
  90.                             }
  91.                         }
  92.  
  93.                     } else {
  94.                         if ($('input:radio[name=resetorzero]:checked').val() == 'orzero') {
  95.                             currentbet = 0;
  96.                         } else if ($('input:radio[name=resetorzero]:checked').val() == 'resetor') {
  97.                             losscount = 0;
  98.                             currentbet = basebet;
  99.                         }
  100.                     }
  101.  
  102.                 } else {
  103.                     if (losscount == $('#startlosses').val()) {
  104.                         currentbet = currentbet * $('#initialmultiplier').val();
  105.                     } else if (losscount > $('#startlosses').val()) {
  106.                         currentbet = currentbet * $('#mainmultiplier').val();
  107.                     }
  108.                 }
  109.             } else {
  110.                 if (losscount == $('#startlosses').val()) {
  111.                     currentbet = currentbet * $('#initialmultiplier').val();
  112.                 } else if (losscount > $('#startlosses').val()) {
  113.                     currentbet = currentbet * $('#mainmultiplier').val();
  114.                 }
  115.             }
  116.             flameBot.API.addRow();
  117.         },
  118.         onWin: function() {
  119.             if (aftermanualtrigger === true) {
  120.                 aftermanualtrigger = false
  121.             }
  122.             totalwin++;
  123.             losscount = 0;
  124.             currentbet = basebet;
  125.             flameBot.API.addRow();
  126.         },
  127.         setParams: function() {
  128.             losscount = 0;
  129.             initmult = $('#initialmultiplier').val();
  130.             mainmult = $('#mainmultiplier').val();
  131.             basebet = flameBot.tools.dec2Sat($('#basebet').val());
  132.             currentbet = basebet;
  133.             if ($('input:radio[name=hilo]:checked').val() == 'hi') {
  134.                 condition = '>';
  135.                 target = (99.99 - (99 / $('#chance').val())).toFixed(2);
  136.             } else if ($('input:radio[name=hilo]:checked').val() == 'lo') {
  137.                 condition = '<';
  138.                 target = (99 / $('#chance').val()).toFixed(2);
  139.             } else if ($('input:radio[name=hilo]:checked').val() == 'swap') {
  140.                 condition = '<';
  141.                 target = 0 + (99 / $('#chance').val()).toFixed(2);
  142.             }
  143.         },
  144.         addRow: function() {
  145.             var bettable = '',
  146.                 bettab = '#lastbet2';
  147.             bettable += '<tr><td>' + flameBot.tools.satToDec(result.bet.amount) + '</td>';
  148.             bettable += '<td>' + result.bet.multiplier + 'x' + '</td>'; /* return bet payout */
  149.             bettable += '<td>' + (result.bet.target).toFixed(2) + '</td>'; /* return target*/
  150.             bettable += '<td>' + result.bet.roll + '</td>'; /* return roll */
  151.             bettable += '<td id="proff">' + flameBot.tools.satToDec(result.bet.profit) + '</td></tr>';
  152.  
  153.             var stattable = '',
  154.                 stattab = '#lastbet3';
  155.             stattable += '<tr><td style="color:green;">' + flameBot.tools.satToDec(result.user.balance) + '</td><td style="color:red;">' + losscount + '</td><td style="color:green;">' + totalwin + '</td><td style="color:red;">' + totalloss + '</td><td id="profit">' + (profit).toFixed(8) + '</td></tr>';
  156.             $(stattab).empty();
  157.             $(stattab).prepend(stattable);
  158.             stattable = '';
  159.             if ($(bettab + ' tbody tr').length >= 30) {
  160.                 $(bettab + ' tr').last().remove();
  161.                 $(bettab).prepend(bettable);
  162.                 bettable = '';
  163.             } else if ($(bettab).length < 30) {
  164.                 $(bettab).prepend(bettable);
  165.                 bettable = '';
  166.             }
  167.  
  168.             $('#lastbet2 *, #lastbet3 *, #lastbet *, #proff').css('text-align', 'center');
  169.             $('#lastbet2 *, #lastbet3 *, #lastbet *').css('width', '20%');
  170.             $('#lastbet *').css('padding', '5px');
  171.             $('#lastbet *').css('border-bottom', '1px solid #ccc');
  172.             $('#result-1').css('padding', '5px');
  173.             $('#lastbet2 *, #lastbet3 *, #proff').css('padding', '5px');
  174.             $('#lastbet > tbody > tr > th:nth-child(2)').css('border-top', '1px solid #ddd');
  175.             if (profit >= 0) {
  176.                 $('#profit').css('color', 'green');
  177.             } else {
  178.                 $('#profit').css('color', 'red');
  179.             }
  180.             if (result.bet.win === true) {
  181.                 $('#proff:first').css('color', 'green');
  182.             } else {
  183.                 $('#proff:first').css('color', 'red');
  184.             }
  185.             betstarted = false;
  186.         },
  187.  
  188.         bet: function() {
  189.             betstarted = true;
  190.             var betData = {
  191.                 amount: currentbet,
  192.                 condition: condition,
  193.                 target: target,
  194.             };
  195.             $.ajax({
  196.                 url: 'https://api.primedice.com/api/bet?access_token=' + flameBot.tools.token(),
  197.                 type: 'POST',
  198.                 data: betData,
  199.                 datatype: 'jsonp',
  200.                 success: function(data) {
  201.                     result = data;
  202.                     profit = parseFloat(profit) + parseFloat(flameBot.tools.satToDec(data.bet.profit));
  203.                     if (data.bet.win === true) {
  204.                         flameBot.API.onWin();
  205.                     } else {
  206.                         flameBot.API.onLoss();
  207.                     }
  208.                 },
  209.                 error: function(errorThrown) {
  210.                     betstarted = false;
  211.                 }
  212.             });
  213.         },
  214.         seedChange: function() {
  215.             function seedgen() {
  216.                 var seed = '';
  217.                 var seedlength = 10;
  218.                 var charset = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!@#$%^&*()';
  219.                 for (var i = 0; i <= seedlength; i++)
  220.  
  221.                     seed += charset.charAt(Math.floor(Math.random() * charset.length));
  222.  
  223.                 return seed;
  224.             }
  225.             var s = seedgen(),
  226.                 url = 'https://api.primedice.com/api/seed?access_token=' + localStorage.token,
  227.                 sData = {
  228.                     seed: s
  229.                 };
  230.  
  231.             $.ajax({
  232.                 url: url,
  233.                 type: 'POST',
  234.                 data: sData,
  235.                 datatype: 'json',
  236.                 success: function(data, textStatus, jqXHR) {
  237.                     data2 = data;
  238.                     $('#currentseed').val(data2.seeds.client);
  239.  
  240.  
  241.                 },
  242.                 error: function(jqXHR, textStatus, errorThrown) {
  243.                     return false;
  244.                 }
  245.             });
  246.         },
  247.         swap: function() {
  248.             if (condition2 == '<') {
  249.                 condition2 = '>';
  250.                 target2 = (99.99 - (99 / $('#payout').val())).toFixed(2);
  251.             } else if (condition2 == '>') {
  252.                 condition2 = '<';
  253.                 target2 = (99 / $('#payout').val()).toFixed(2);
  254.             }
  255.         },
  256.     }
  257. }
  258.  
  259. var UI = '';
  260. UI += '<table id="lastbet">';
  261. UI += '<tr><th>Bet</th><th>Payout</th><th>Game</th><th>Roll</th><th>Profit</th></tr></table>';
  262. UI += '<div style="max-height:120px !important;overflow-y: scroll;overflow-x: hidden;"><table id="lastbet2"></table></div>';
  263. UI += '<div id="flameBot" style="width:550px"><ul><li>';
  264. UI += '<a href="/play#basic">Basic Settings</a></li>';
  265. UI += '<li><a href="/play#onloss">On Loss</a></li>';
  266. UI += '<li><a href="/play#onlosstreak">Loss - Adv.</a></li>';
  267. UI += '<li style="margin:8px;font-size:12px;margin-left:35px;text-align:center;"><span>FlameBot - v1.0</span></li>';
  268. UI += '</ul>';
  269. UI += '<div id="basic" style="font-size:17.5px;"><center>';
  270. UI += '<table style="display:table;"><thead><tr><th>Basebet: </th><th>Chance:</th></tr></thead><tbody><tr><td><input id="basebet" type="text"></td><td><input id="chance" type="text"></td></tr></tbody><thead><tr><th>High/Low/Swap:</th><th>Swap Every:</th></tr></thead><tbody><tr><td><div id="hilo"><input type="radio" id="hi" value="hi" name="hilo"><label for="hi">High</label> <input type="radio" id="lo" value="lo" name="hilo" checked="checked"><label for="lo">Low</label> <input type="radio" id="swap" value="swap" name="hilo"><label for="swap">Swap</label> </div></td><td><input id="swapevery" type="text"></td></tr></tbody></table></div></center>';
  271. UI += '<div id="onloss" style="font-size:17.5px;"><center>';
  272. UI += '<table style="display:table;"><thead><tr><th>Start Multipling: </th><th>Main Multiplier:</th></tr></thead><tbody><tr><td><input id="startlosses" style="text-align:center;" placeholder="after # of losses"type="text"></td><td><input id="mainmultiplier" style="text-align:center;" placeholder="2, 4, etc."type="text"></td></tr></tbody><thead><tr><th>Initial Multiplier</th><th>Max Bet:</th></tr></thead><tbody><tr><td><input id="initialmultiplier" style="text-align:center;" placeholder="2, 4, etc."type="text"></td><td><input id="maxbet" style="text-align:center;" placeholder="ex. 0.001" type="text"></td></tr></tbody></table>';
  273. UI += '</center></div>';
  274. UI += '<div id="onlosstreak" style="font-size:17.5px;"><center>';
  275. UI += '<table style="display:table;"><thead><tr><th>After: <input type="checkbox" id="afterlossesenabled"></th><th>Either: </th></tr></thead><tbody><tr><td><input id="afterlosses" style="text-align:center;" placeholder="# of losses"type="text"></td><td><div id="resetorzero"><input type="radio" id="resetor" value="resetor" name="resetorzero"><label for="resetor">Reset to Base</label><input type="radio" id="orzero" value="orzero" name="resetorzero" checked="checked"><label for="orzero">Roll 0 to Win</label></div></td></tr></tbody><thead><tr><th>Manualy Choose?</th><th>Swap After: <input id="swaplossesenabled" type="checkbox"></th></tr></thead><tbody><tr><td><center><input id="aftermanualenabled" type="checkbox"></center></td><td><input id="swaplosses" style="text-align:center;" placeholder="# of losses" type="text"></td></tr></tbody></table>';
  276. UI += '</center></div>';
  277. UI += '<div id="controlstat">';
  278. UI += '<center><div id="toolbar" class="ui-widget-header ui-corner-all"><div id="buttonz"><span id="startstop"><button id="start">Start</button><button id="stop">Stop</button></span><span id="set"><button id="setparams">Set Params</button><button id="save">Save Settings</button><button id="load">Load Settings</button></div></center><br>';
  279. UI += '<table style="margin:10px;"id="stats">';
  280. UI += '<thead><tr><th>Balance</th><th>Loss Streak</th><th>Total Wins</th><th>Total Losses</th><th>Total Profit</th></tr></thead><tbody></tbody><table id="lastbet3"></table></table>';
  281. UI += '</div>';
  282. UI += '</div>';
  283. flameBot.initialize.init1();
Advertisement
Add Comment
Please, Sign In to add comment