Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (window._bot != undefined) {
- alert('Bot added before, if something goes wrong try reload the page')
- }
- window._bot = true
- window._martingale = 2.05
- window._variant = Math.random() >= 0.5 ? 1 : 0
- // window._variants = ['Roll < 49', 'Roll > 51']
- function log(message) {
- console.log('[Dice Bot]: ' + message)
- }
- function roll() {
- $.ajax({
- url: "/ajax/system_dice.php",
- cache: false,
- type: "POST",
- data: {
- method: "dice_play",
- csrf_token: $("#csrf_token").val(),
- locale: 'ru',
- currency: window._currency,
- bet: window._amount,
- type: window._variant
- },
- dataType: "json",
- success: function(data) {
- if (typeof data === "object") {
- if (data.result == "OK") {
- log('Balance: ' + data.bal)
- if (data.win == "1") {
- window._amount = window._base
- window._tries = 1
- window._variant = Math.abs(window._variant - 1)
- if (window._stopAfterWon == true) {
- stop()
- }
- } else {
- window._amount = (window._martingale * window._amount).toFixed(8)
- window._tries += 1
- }
- log(window._variant + ' ' + (data.win == '1' ? 'WON' : 'LOST') + '. Set bet to ' + window._amount)
- $('.bet').val(window._amount)
- var so = $("select[name=currency] option:selected").html();
- var re = /([^\-]+?- )[0-9.]+?( [a-zA-Z0-9]+)/g;
- var sn = so.replace(re, "$1" + data.bal + "$2");
- $("select[name=currency] option:selected").html(sn).trigger("chosen:updated");
- if (window._stop == true) {
- return;
- }
- setTimeout(function() {
- roll()
- }, window._interval)
- }
- return;
- }
- log('ERROR - ' + data.error)
- },
- error: function() {
- log('Got an error')
- }
- });
- }
- function stop() {
- window._stop = true
- }
- function stopAfterWon() {
- window._stopAfterWon = true
- }
- function start(interval) {
- window._base = $('.bet').val()
- window._stop = false
- window._stopAfterWon = false
- window._tries = 1
- window._interval = 10e3 // 5s default interval
- window._amount = window._base
- window._currency = '50001' // 1 - BTC, 40001 - ETH, 50001 - USD
- roll();
- }
- let section = '.dice_htable > tbody td:last'
- $(section).html('')
- $('<input />', {
- id: 'bot_start',
- type: 'button',
- value: 'Start',
- }).appendTo(section).click(start)
- $('<input />', {
- id: 'bot_stop',
- type: 'button',
- style: 'background-color: #f4a35e',
- value: 'Stop',
- }).appendTo(section).click(stop)
- $('<input />', {
- id: 'bot_stop',
- type: 'button',
- style: 'background-color: #90d8b4',
- value: 'After win',
- }).appendTo(section).click(stopAfterWon)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement