View difference between Paste ID: vzu1YAgL and EzthM6eg
SHOW: | | - or go back to the newest paste.
1
var config = {
2
  title: { value: 'title', type: 'noop', label: 'Dexon\'s Random script v1.5.5' },
3
  baseBet: { value: 100, type: 'balance', label: 'Base bet' },
4
  maxBet: { value: 10000, type: 'balance', label: 'Max bet' },
5
  payouts: {
6
    value: 'lo', type: 'radio', label: 'Payouts',
7
    options: {
8
      hi: { value: 'hi', type: 'noop', label: 'High cashouts (high risks, high rewards)' },
9
      lo: { value: 'lo', type: 'noop', label: 'Low cashouts (safer but harder to recover)' },
10
    }
11
  },
12
  mode: {
13
    value: 'real', type: 'radio', label: 'Mode',
14
    options: {
15
      real: { value: 'real', type: 'noop', label: 'Real bets' },
16
      sim: { value: 'sim', type: 'noop', label: 'Simulation' },
17
    }
18
  }
19
};
20
 
21
var prevBet = null, bet = null, payout = null, lossNetProfit = null, profit = null, isRecovering = null, skipping = null;
22
 
23
var placeBet = () => {
24
  bet = Math.round(config.baseBet.value + (lossNetProfit>0?lossNetProfit*(Math.random()):0));
25
  if(bet > config.maxBet.value) bet = Math.round(config.maxBet.value);
26
27
  bet = Math.round(bet/100)*100;
28
  payout = 100;
29
 
30
  if (userInfo.balance < bet) {
31
    stop('Insufficient balance to make the bet');
32
  }else{
33
    if(config.payouts.value === 'lo'){
34
      for(let i=1; i<=10000; i++){
35
        payout += 1;
36
        let odds = bet / (payout/100 * bet);
37
        if(Math.random() > odds * 0.99){
38
          break;
39
        }
40
      }
41
    }else if(config.payouts.value === 'hi'){
42
      let randomNum = Math.random();
43
      for(let i=1; i<=100000; i++){
44
        payout += 1;
45
        let odds = bet / (payout/100 * bet);
46
        if(randomNum > odds * 0.99){
47
          break;
48
        }
49
      }
50
    }
51
   
52
    if(Math.random() <= 0.01){
53
      skipping = true;
54
      log((config.mode.value === 'sim'?'(SIMULATION)':''), "1% protection! skip the bet.");
55
    }else{
56
      if(config.mode.value === 'sim'){
57
        log("(SIMULATION) Betting", parseFloat((bet/100).toFixed(2)), "on", parseFloat((payout/100).toFixed(2))+"x");
58
        prevBet = bet;
59
      }else if(config.mode.value === 'real'){
60
        log("Betting", parseFloat((bet/100).toFixed(2)), "on", parseFloat((payout/100).toFixed(2))+"x");
61
        engine.bet(bet, parseFloat((payout/100).toFixed(2)));
62
        prevBet = bet;
63
      }
64
    }
65
  }  
66
};
67
 
68
engine.on('GAME_STARTING', () => {
69
  placeBet();
70
});
71
 
72
engine.on('GAME_ENDED', (data) => {
73
  if(!prevBet || skipping){
74
    skipping = false;
75
    return;
76
  }
77
  log("Game busted @", data.bust);
78
  let bust = data.bust * 100;
79
  let win = null;
80
  if(payout > bust){
81
    win = false;
82
  }else{
83
    win = true;
84
  }
85
 
86
  if(win){
87
    if(lossNetProfit > 0) lossNetProfit -= bet * (payout/100) - bet;
88
    if(lossNetProfit <= 0){
89
      lossNetProfit = 0;
90
      isRecovering = false;
91
    }
92
    profit += bet * (payout/100) - bet;
93
    log((config.mode.value === 'sim'?'(SIMULATION)':''), "Won", parseFloat(((bet * (payout/100))/100).toFixed(2)), "bits", (lossNetProfit>0?". | Current net loss: "+parseFloat((lossNetProfit/100).toFixed(2))+" bits":""));
94
  }else{
95
    lossNetProfit += bet;
96
    isRecovering = true;
97
    profit -= bet;
98
    log((config.mode.value === 'sim'?'(SIMULATION)':''), "Lost", parseFloat((bet/100).toFixed(2)), "bits. | Current net loss:", parseFloat((lossNetProfit/100).toFixed(2)), "bits");
99
  }
100
 
101
  log("Profit: " + parseFloat((profit/100).toFixed(2)));
102
});