Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var config = {};
- var initialized = false;
- function patchFunctions(debugging = false) {
- if (!initialized) {
- engine.placeBet = function (bet, multiplier, callback) {
- engine.bet(bet, parseFloat(multiplier / 100));
- }
- engine.getMaxBet = function () {
- return userInfo.balance;
- }
- engine.getCurrentPayout = function () {
- return (engine.gameState != 'IN_PROGRESS' ? null : (engine.bust * 100));
- }
- engine.getBalance = function () {
- return userInfo.balance;
- }
- engine.getUsername = function () {
- return userInfo.uname;
- }
- engine.getEngine = function () {
- return engine;
- }
- engine.lastGamePlayed = function () {
- return (engine.lastGamePlay() != 'NOT_PLAYED' ? true : false);
- }
- engine.lastGamePlay = function () {
- let lastGame = engine.history.first();
- if (lastGame.wager) {
- if (lastGame.cashedAt) {
- return 'WON';
- }
- return 'LOST';
- }
- return 'NOT_PLAYED';
- }
- engine.stop = function (reason) {
- stop(reason);
- }
- engine.on('GAME_STARTING', function () {
- if (this._events['game_starting']) {
- if (debugging) { console.log(`[debug] Remit 'GAME_STARTING'->'game_starting' {game_id: ${engine.gameId}, time_till_start: 5000}`); }
- engine.emit('game_starting', { game_id: engine.gameId, time_till_start: 5000 });
- }
- });
- engine.on('GAME_STARTED', function () {
- if (this._events['game_started']) {
- if (debugging) { console.log(`[debug] Remit 'GAME_STARTED'->'game_started' {${engine.playing}}`); }
- engine.emit('game_started', engine.playing);
- }
- });
- engine.on('GAME_ENDED', function () {
- if (this._events['game_crash']) {
- let lastGame = engine.history.first();
- let elapsed = parseInt(lastGame.lastGameTick - lastGame.startTime);
- if (debugging) { console.log(`[debug] Remit 'GAME_ENDED'->'game_crash' {elapsed: ${elapsed}, game_crash: ${lastGame.bust}, bonuses: 0, hash: ${lastGame.hash}}`); }
- engine.emit('game_crash', { elapsed: elapsed, game_crash: (lastGame.bust * 100), bonuses: 0, hash: lastGame.hash });
- }
- });
- engine.on('CASHED_OUT', function (bet) {
- if (this._events['cashed_out']) {
- if (debugging) { console.log(`[debug] Remit 'CASHED_OUT'->'cashed_out' {username: ${bet.uname}, amount: ${bet.wager}, stopped_at: ${bet.cashedAt}}`); }
- engine.emit('cashed_out', { username: bet.uname, amount: bet.wager, stopped_at: (bet.cashedAt * 100) });
- }
- });
- engine.on('BET_PLACED', function (bet) {
- if (this._events['player_bet']) {
- if (debugging) { console.log(`[debug] Remit 'BET_PLACED'->'player_bet' {username: ${bet.uname}, bet: ${bet.wager}`); }
- engine.emit('player_bet', { username: bet.uname, bet: bet.wager });
- }
- });
- initialized = true;
- }
- }
- patchFunctions();
- ///////////////////////// V1 BELOW /////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement