SHOW:
|
|
- or go back to the newest paste.
| 1 | // Variable Cashout point with percent of balance BASEBET. | |
| 2 | //Engine events: | |
| 3 | ||
| 4 | engine.on('game_starting', function(info) {
| |
| 5 | console.log('Game Starting in ' + info.time_till_start);
| |
| 6 | }); | |
| 7 | ||
| 8 | engine.on('game_started', function(data) {
| |
| 9 | console.log('Game Started', data);
| |
| 10 | }); | |
| 11 | ||
| 12 | engine.on('game_crash', function(data) {
| |
| 13 | console.log('Game crashed at ', data.game_crash);
| |
| 14 | }); | |
| 15 | ||
| 16 | engine.on('player_bet', function(data) {
| |
| 17 | console.log('The player ', data.username,
| |
| 18 | ' placed a bet. This player could be me :o.'); | |
| 19 | }); | |
| 20 | ||
| 21 | engine.on('cashed_out', function(resp) {
| |
| 22 | console.log('The player ', resp.username,
| |
| 23 | ' cashed out. This could be me.'); | |
| 24 | }); | |
| 25 | ||
| 26 | engine.on('msg', function(data) {
| |
| 27 | console.log('Chat message!...');
| |
| 28 | }); | |
| 29 | ||
| 30 | engine.on('connect', function() {
| |
| 31 | console.log( | |
| 32 | 'Client connected, this wont happen when you run the script' | |
| 33 | ); | |
| 34 | }); | |
| 35 | ||
| 36 | engine.on('disconnect', function() {
| |
| 37 | console.log('Client disconnected');
| |
| 38 | }); | |
| 39 | ||
| 40 | ||
| 41 | //Getters: | |
| 42 | console.log('Balance: ' + engine.getBalance());
| |
| 43 | console.log('The current payout is: ' + engine.getCurrentPayout());
| |
| 44 | console.log('My username is: ', engine.getUsername());
| |
| 45 | console.log('The max current bet is: ', engine.getMaxBet() / 100, ' Bits');
| |
| 46 | console.log('The current maxWin is: ', engine.getMaxWin() / 100, ' Bits');
| |
| 47 | // engine.getEngine() for raw engine | |
| 48 | ||
| 49 | ||
| 50 | //Helpers: | |
| 51 | console.log('Was the last game played? ', engine.lastGamePlayed() ? 'Yes' :
| |
| 52 | 'No'); | |
| 53 | console.log('Last game status: ', engine.lastGamePlay());
| |
| 54 | ||
| 55 | ||
| 56 | //Actions: | |
| 57 | //Do this between the 'game_starting' and 'game_started' events | |
| 58 | //engine.placeBet(betInSatoshis, autoCashOutinPercent, autoPlay); | |
| 59 | ||
| 60 | //engine.cashOut(); //Do this when playing | |
| 61 | //engine.stop(); //Stops the strategy | |
| 62 | //engine.chat('Hello Spam');
| |
| 63 | ||
| 64 | var percentageWanted = 0.05; // 0.1% or less recommended <0.001% to survive zombie appocolypses :D | |
| 65 | var currentBet = (percentageWanted * 0.0001 * engine.getBalance()) * 100; | |
| 66 | var loss = 0; | |
| 67 | var lossTolerance = 27; // how many loses before restarting? | |
| 68 | var lastGameLost = false; | |
| 69 | var cashOut = 160; | |
| 70 | engine.on('game_starting', function() {
| |
| 71 | if (engine.lastGamePlay() == 'LOST') {
| |
| 72 | loss += 1; | |
| 73 | if (loss < lossTolerance + 1) { //not inclusive of int-lossTolerance originally
| |
| 74 | if (cashOut < 400) { // increase these if needed
| |
| 75 | currentBet *= 1.49; | |
| 76 | cashOut *= 1.26; | |
| 77 | } else {
| |
| 78 | currentBet *= 1.32; // increase these if needed | |
| 79 | cashOut = 400; | |
| 80 | cashOut *= 1.04; | |
| 81 | } | |
| 82 | ||
| 83 | } else { // restart the bot after X loss streaks
| |
| 84 | currentBet = (percentageWanted * 0.0001 * engine.getBalance()) * | |
| 85 | 100; | |
| 86 | cashOut = 160; | |
| 87 | loss = 0; | |
| 88 | } | |
| 89 | } else if (engine.lastGamePlay() == 'WON') {
| |
| 90 | currentBet = (percentageWanted * 0.0001 * engine.getBalance()) * | |
| 91 | 100; | |
| 92 | cashOut = 160; | |
| 93 | loss = 0; | |
| 94 | } | |
| 95 | if (currentBet <= engine.getBalance() && currentBet <= engine.getMaxBet()) {
| |
| 96 | engine.placeBet(Math.round(currentBet / 100) * 100, Math.round( | |
| 97 | cashOut / 1) * 1, false); | |
| 98 | } else {
| |
| 99 | engine.stop(); | |
| 100 | console.log( | |
| 101 | 'You ran out of bits or exceeded the max bet :(');
| |
| 102 | } | |
| 103 | }); |