-
Notifications
You must be signed in to change notification settings - Fork 3
/
bustabit_script.js
44 lines (36 loc) · 1.09 KB
/
bustabit_script.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
var config = {
wager: {
value: 100, type: 'balance', label: 'wager'
},
payout: {
value: 2, type: 'multiplier', label: 'payout' }
};
// This is the Flat bet script from the bustabit site
// Replace this file by your own bot
// Script files must begin with 'var config = {}'
// Try to bet immediately when script starts
if (engine.gameState === "GAME_STARTING") {
makeBet();
}
engine.on('GAME_STARTING', onGameStarted);
engine.on('GAME_ENDED', onGameEnded);
function onGameStarted() {
makeBet();
}
function onGameEnded() {
var lastGame = engine.history.first();
// If we wagered, it means we played
if (!lastGame.wager) {
return;
}
if (lastGame.cashedAt) {
var profit = Math.round((config.wager.value * config.payout.value - config.wager.value) / 100)
log('we won', profit, 'bits');
} else {
log('we lost', Math.round(config.wager.value / 100), 'bits');
}
}
function makeBet() {
engine.bet(config.wager.value, config.payout.value);
log('betting', Math.round(config.wager.value / 100), 'on', config.payout.value, 'x');
}