forked from Aiscargeauh/BustabitScripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathGrowingPayout.js
53 lines (49 loc) · 1.7 KB
/
GrowingPayout.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
45
46
47
48
49
50
51
52
53
var config = {
baseBet: { value: 100, type: 'balance', label: 'Base Bet' },
minimumPayout: { value: 2, type: 'multiplier', label: 'Minimum Payout' },
maximumPayout: { value: 100, type: 'multiplier', label: 'Maximum Payout' }
}
//Limit variable: Being able to set a maximum payout.
//If reached, go back in reverse to minimize damage.
var currentPayout = config.minimumPayout.value;
var isBetting = false;
var userProfit = 0;
var isGoingUp = true;
engine.on('GAME_STARTING', function () {
log('');
log('NEW GAME')
log('Chasing payout: x' + currentPayout + '.');
engine.bet(config.baseBet.value, currentPayout);
isBetting = true;
});
engine.on('GAME_ENDED', function () {
let gameInfos = engine.history.first();
if(isBetting){
if (!gameInfos.cashedAt) {
//Lost
if(isGoingUp){
currentPayout += 1;
if(currentPayout >= config.maximumPayout.value && isGoingUp){
isGoingUp = false;
log("Now going down.");
}
}else{
currentPayout -= 1;
if(currentPayout <= config.minimumPayout.value && !isGoingUp){
log("Now going up.");
isGoingUp = true;
currentPayout = config.minimumPayout.value;
}
}
userProfit -= config.baseBet.value;
log('Lost...');
}else{
//Won
userProfit += config.baseBet.value;
currentPayout = config.minimumPayout.value;
log('Won! Returning to minimum payout.');
}
log('Current profit: ' + userProfit/100 + ' bits.');
}
log('END GAME');
});