View difference between Paste ID: 28sqRtAL and wsDDvypD
SHOW: | | - or go back to the newest paste.
1
// CoolCoop Bustabit Script
2
// By: Mayor Pogi
3
// Version 0.1.1
4
// Switches beteen PlusCoup and Martingale Strategies
5
 
6
/************************/
7
 
8
var plusCoupBaseBet = 12;
9
var plusCoupCashout = 1.55;
10
 
11
var martingaleBaseBet = 12;
12
var martingaleMultipler = 1.1;
13
var martingaleCashout = 10;
14
 
15
var X = 10;
16
var streakX = 5;
17
 
18
/************************/
19
 
20
 
21
X = Math.round(X * 100);
22
plusCoupBaseBet = Math.round(plusCoupBaseBet) * 100;
23
plusCoupCashout = Math.round(plusCoupCashout * 100);
24
martingaleBaseBet = Math.round(martingaleBaseBet) * 100;
25
martingaleCashout = Math.round(martingaleCashout * 100);
26
 
27
 
28
var PLUSCOUP = 'PlusCoup';
29
var MARTINGALE = 'Martingale';
30
 
31
 
32
var mode = PLUSCOUP;
33
 
34
var currentGameData;
35
var playedLast = false;
36
var wonLast = true;
37
var gamesSinceX = 0;
38
 
39
 
40
engine.on('game_started', function(data) {
41
    currentGameData = data;
42
});
43
 
44
engine.on('game_starting', function(info) {
45
 
46
    if(mode == PLUSCOUP && wonLast && p >= 0 && gamesSinceX >= streakX) {
47
        console.log("Switching To MARTINGALE");
48
        mode = MARTINGALE;
49
    } else if(mode == MARTINGALE && wonLast) {
50
        console.log("Switching To PLUSCOUP");
51
        mode = PLUSCOUP;
52
    }
53
   
54
    if(mode == MARTINGALE) {
55
        betMartingale();
56
    } else {
57
        betPlusCoup();
58
    }
59
   
60
});
61
 
62
engine.on('game_crash', function(data) {   
63
    if(data.game_crash >= X) {
64
        gamesSinceX = 0;
65
    } else {
66
        gamesSinceX++;
67
    }
68
   
69
    if (!currentGameData || !currentGameData.hasOwnProperty(engine.getUsername())) {
70
        playedLast = false;
71
        return;
72
    };
73
   
74
    playedLast = true;
75
 
76
    if(mode == MARTINGALE) {
77
        wonLast = data.game_crash >= martingaleCashout;
78
        postGameMartingale();
79
    } else {
80
        wonLast = data.game_crash >= plusCoupCashout;
81
        postGamePlusCoup();
82
    }
83
});
84
 
85
/************************/
86
 
87
var n = 1;
88
var p = 0;
89
 
90
/************************/
91
 
92
function betPlusCoup() {
93
 
94
    var currentBet = n * plusCoupBaseBet;
95
   
96
    console.log("{n:" + n + ", p:" + p/100 + ", currentBet:" + currentBet/100 + "}");
97
   
98
    engine.placeBet(Math.round(currentBet), plusCoupCashout);
99
}
100
 
101
function postGamePlusCoup() {
102
    if(playedLast) {
103
        if(wonLast) {
104
            p += (n * plusCoupBaseBet * (plusCoupCashout/100 - 1));
105
            if(p > 0) p = 0;
106
           
107
            if(p < 0) {
108
                n++;
109
            } else {
110
                n = 1;
111
            }
112
        } else {
113
            p -= (n * plusCoupBaseBet);
114
        }
115
    }
116
}
117
 
118
/************************/
119
 
120
var martingaleNextBet = martingaleBaseBet;
121
 
122
/************************/
123
 
124
function betMartingale() {
125
    console.log("{ currentBet:" + martingaleNextBet/100 + "}");
126
   
127
    engine.placeBet(Math.round(martingaleNextBet/100) * 100, martingaleCashout);
128
}
129
 
130
function postGameMartingale() {
131
    if(!wonLast) {
132
        martingaleNextBet = martingaleNextBet * martingaleMultipler;
133
    } else {
134
        martingaleNextBet = martingaleBaseBet;
135
    }
136
}