Advertisement
Guest User

Untitled

a guest
May 27th, 2019
116
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.79 KB | None | 0 0
  1. var config = {};
  2. var initialized = false;
  3.  
  4. function patchFunctions(debugging = false) {
  5. if (!initialized) {
  6. engine.placeBet = function (bet, multiplier, callback) {
  7. engine.bet(bet, parseFloat(multiplier / 100));
  8. }
  9. engine.getMaxBet = function () {
  10. return userInfo.balance;
  11. }
  12. engine.getCurrentPayout = function () {
  13. return (engine.gameState != 'IN_PROGRESS' ? null : (engine.bust * 100));
  14. }
  15. engine.getBalance = function () {
  16. return userInfo.balance;
  17. }
  18. engine.getUsername = function () {
  19. return userInfo.uname;
  20. }
  21. engine.getEngine = function () {
  22. return engine;
  23. }
  24. engine.lastGamePlayed = function () {
  25. return (engine.lastGamePlay() != 'NOT_PLAYED' ? true : false);
  26. }
  27. engine.lastGamePlay = function () {
  28. let lastGame = engine.history.first();
  29. if (lastGame.wager) {
  30. if (lastGame.cashedAt) {
  31. return 'WON';
  32. }
  33. return 'LOST';
  34. }
  35. return 'NOT_PLAYED';
  36. }
  37. engine.stop = function (reason) {
  38. stop(reason);
  39. }
  40. engine.on('GAME_STARTING', function () {
  41. if (this._events['game_starting']) {
  42. if (debugging) { console.log(`[debug] Remit 'GAME_STARTING'->'game_starting' {game_id: ${engine.gameId}, time_till_start: 5000}`); }
  43. engine.emit('game_starting', { game_id: engine.gameId, time_till_start: 5000 });
  44. }
  45. });
  46. engine.on('GAME_STARTED', function () {
  47. if (this._events['game_started']) {
  48. if (debugging) { console.log(`[debug] Remit 'GAME_STARTED'->'game_started' {${engine.playing}}`); }
  49. engine.emit('game_started', engine.playing);
  50. }
  51. });
  52. engine.on('GAME_ENDED', function () {
  53. if (this._events['game_crash']) {
  54. let lastGame = engine.history.first();
  55. let elapsed = parseInt(lastGame.lastGameTick - lastGame.startTime);
  56. if (debugging) { console.log(`[debug] Remit 'GAME_ENDED'->'game_crash' {elapsed: ${elapsed}, game_crash: ${lastGame.bust}, bonuses: 0, hash: ${lastGame.hash}}`); }
  57. engine.emit('game_crash', { elapsed: elapsed, game_crash: (lastGame.bust * 100), bonuses: 0, hash: lastGame.hash });
  58. }
  59. });
  60. engine.on('CASHED_OUT', function (bet) {
  61. if (this._events['cashed_out']) {
  62. if (debugging) { console.log(`[debug] Remit 'CASHED_OUT'->'cashed_out' {username: ${bet.uname}, amount: ${bet.wager}, stopped_at: ${bet.cashedAt}}`); }
  63. engine.emit('cashed_out', { username: bet.uname, amount: bet.wager, stopped_at: (bet.cashedAt * 100) });
  64. }
  65. });
  66. engine.on('BET_PLACED', function (bet) {
  67. if (this._events['player_bet']) {
  68. if (debugging) { console.log(`[debug] Remit 'BET_PLACED'->'player_bet' {username: ${bet.uname}, bet: ${bet.wager}`); }
  69. engine.emit('player_bet', { username: bet.uname, bet: bet.wager });
  70. }
  71. });
  72. initialized = true;
  73. }
  74. }
  75. patchFunctions();
  76.  
  77. ///////////////////////// V1 BELOW /////////////////////////
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement