Advertisement
Guest User

Untitled

a guest
Jun 23rd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.07 KB | None | 0 0
  1. if (window._bot != undefined) {
  2. alert('Bot added before, if something goes wrong try reload the page')
  3. }
  4.  
  5. window._bot = true
  6. window._martingale = 2.05
  7. window._variant = Math.random() >= 0.5 ? 1 : 0
  8.  
  9. // window._variants = ['Roll < 49', 'Roll > 51']
  10.  
  11. function log(message) {
  12. console.log('[Dice Bot]: ' + message)
  13. }
  14.  
  15. function roll() {
  16. $.ajax({
  17. url: "/ajax/system_dice.php",
  18. cache: false,
  19. type: "POST",
  20. data: {
  21. method: "dice_play",
  22. csrf_token: $("#csrf_token").val(),
  23. locale: 'ru',
  24. currency: window._currency,
  25. bet: window._amount,
  26. type: window._variant
  27. },
  28. dataType: "json",
  29. success: function(data) {
  30. if (typeof data === "object") {
  31. if (data.result == "OK") {
  32. log('Balance: ' + data.bal)
  33.  
  34. if (data.win == "1") {
  35. window._amount = window._base
  36. window._tries = 1
  37. window._variant = Math.abs(window._variant - 1)
  38.  
  39. if (window._stopAfterWon == true) {
  40. stop()
  41. }
  42. } else {
  43. window._amount = (window._martingale * window._amount).toFixed(8)
  44. window._tries += 1
  45. }
  46.  
  47. log(window._variant + ' ' + (data.win == '1' ? 'WON' : 'LOST') + '. Set bet to ' + window._amount)
  48.  
  49. $('.bet').val(window._amount)
  50.  
  51. var so = $("select[name=currency] option:selected").html();
  52. var re = /([^\-]+?- )[0-9.]+?( [a-zA-Z0-9]+)/g;
  53. var sn = so.replace(re, "$1" + data.bal + "$2");
  54. $("select[name=currency] option:selected").html(sn).trigger("chosen:updated");
  55.  
  56. if (window._stop == true) {
  57. return;
  58. }
  59.  
  60. setTimeout(function() {
  61. roll()
  62. }, window._interval)
  63. }
  64.  
  65. return;
  66. }
  67.  
  68. log('ERROR - ' + data.error)
  69. },
  70.  
  71. error: function() {
  72. log('Got an error')
  73. }
  74. });
  75. }
  76.  
  77. function stop() {
  78. window._stop = true
  79. }
  80.  
  81. function stopAfterWon() {
  82. window._stopAfterWon = true
  83. }
  84.  
  85. function start(interval) {
  86. window._base = $('.bet').val()
  87.  
  88. window._stop = false
  89. window._stopAfterWon = false
  90. window._tries = 1
  91. window._interval = 10e3 // 5s default interval
  92. window._amount = window._base
  93.  
  94. window._currency = '50001' // 1 - BTC, 40001 - ETH, 50001 - USD
  95.  
  96. roll();
  97. }
  98.  
  99. let section = '.dice_htable > tbody td:last'
  100.  
  101. $(section).html('')
  102.  
  103. $('<input />', {
  104. id: 'bot_start',
  105. type: 'button',
  106. value: 'Start',
  107. }).appendTo(section).click(start)
  108.  
  109. $('<input />', {
  110. id: 'bot_stop',
  111. type: 'button',
  112. style: 'background-color: #f4a35e',
  113. value: 'Stop',
  114. }).appendTo(section).click(stop)
  115.  
  116. $('<input />', {
  117. id: 'bot_stop',
  118. type: 'button',
  119. style: 'background-color: #90d8b4',
  120. value: 'After win',
  121. }).appendTo(section).click(stopAfterWon)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement