Bots Home
|
Create an App
multiwheel
Author:
tkktestdev
Description
Source Code
Launch Bot
Current Users
Created by:
Tkktestdev
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.App = void 0; var _Commands = require("./Commands"); var _PubSub = require("./PubSub"); var _Settings = require("./Settings"); var _Global = require("./Global"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var App = function App(api) { var _this = this; _classCallCheck(this, App); _defineProperty(this, "run", function () { _this.api.settings_choices = _this.settings.get(); }); _defineProperty(this, "register", function (plugin) { _this.commands.register(plugin); _this.settings.register(plugin); _this.plugins.push(plugin); return _this; }); _defineProperty(this, "pubSub", function () { _this.api.onStart(function (user) { _PubSub.pubSub.publish('botStart', user); }); _this.api.onTip(function (tip) { _PubSub.pubSub.publish('newTip', tip); }); _this.api.onEnter(function (user) { _PubSub.pubSub.publish('userEnter', user); }); _this.api.onLeave(function (user) { _PubSub.pubSub.publish('userLeave', user); }); _this.api.onMessage(function (msg) { _this.commands.handleMsg(msg); _PubSub.pubSub.publish('newMsg', msg); }); _this.api.onFollow(function (user) { _PubSub.pubSub.publish('newFollow', user); }); _this.api.onUnFollow(function (user) { _PubSub.pubSub.publish('unFollow', user); }); _this.api.onDrawPanel(function (user) { _PubSub.pubSub.publish('onDrawPanel', user); }); }); this.api = api; this.settings = new _Settings.SettingsHandler(this.api); this.commands = new _Commands.Commands(this.api); this.global = new _Global.Global(this.api); this.plugins = []; // Design this.errorBgColor = '#f44336'; this.errorFontColor = '#fff'; this.botBgColor = '#f44336'; this.botFontColor = '#fff'; this.logo = ':xxxxzzzznnnnmmmc'; this.pubSub(); }; exports.App = App; },{"./Commands":3,"./Global":5,"./PubSub":6,"./Settings":7}],2:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CbUser = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var CbUser = function CbUser(user) { var _this = this; var _options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, CbUser); _defineProperty(this, "updateCbData", function () { var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {}; _this.in_fanclub = options.in_fanclub || _this.in_fanclub; _this.has_tokens = options.has_tokens || _this.has_tokens; _this.is_mod = options.is_mod || _this.is_mod; _this.tipped_recently = options.tipped_recently || _this.tipped_recently; _this.tipped_alot_recently = options.tipped_alot_recently || _this.tipped_alot_recently; _this.tipped_tons_recently = options.tipped_tons_recently || _this.tipped_tons_recently; _this.gender = options.gender || _this.gender; return _this; }); _defineProperty(this, "setColor", function (color) { _this.color = color; return _this; }); this.user = user; this.in_fanclub = _options.in_fanclub; this.has_tokens = _options.has_tokens; this.is_mod = _options.is_mod; this.tipped_recently = _options.tipped_recently; this.tipped_alot_recently = _options.tipped_alot_recently; this.tipped_tons_recently = _options.tipped_tons_recently; this.gender = _options.gender || null; this.color = null; }; exports.CbUser = CbUser; },{}],3:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Commands = void 0; var _Error = require("./Error"); function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var Commands = function Commands(api) { var _this = this; _classCallCheck(this, Commands); _defineProperty(this, "register", function (obj) { if (!obj.commands) { return _this; } for (var command in obj.commands) { _this.commands[command] = obj.commands[command]; } return _this; }); _defineProperty(this, "get", function () { return _this.commands; }); _defineProperty(this, "getRole", function (msg) { if (msg.user === _this.api.room_slug) { return 'host'; } if (msg.is_mod) { return 'mod'; } return 'user'; }); _defineProperty(this, "handleMsg", function (msg) { if (msg.m.charAt(0) !== '/') return msg; var message = msg.m.split(' '); var _message = _toArray(message), command = _message[0], params = _message.slice(1); command = command.toLowerCase().substr(1); if (_this.getCommand(command)) { msg['X-Spam'] = true; var role = _this.getRole(msg); _this.execute({ command: command, params: params, role: role, msg: msg }); } return msg; }); _defineProperty(this, "getCommand", function (command) { if (_this.commands.hasOwnProperty(command)) { return _this.commands[command]; } }); _defineProperty(this, "execute", function (_ref) { var command = _ref.command, _ref$params = _ref.params, params = _ref$params === void 0 ? [] : _ref$params, role = _ref.role, msg = _ref.msg; var cmd = _this.getCommand(command); if (!cmd) return; if (cmd.permission === 'host' && role !== 'host') { _this.error.permission(msg); return; } if (cmd.permission === 'mod' && (role !== 'mod' || role !== 'host')) { _this.error.permission(msg); return; } // if params match those in cmd.params cmd.func(params, msg); }); this.api = api; this.error = new _Error.Error(api); this.commands = {}; }; exports.Commands = Commands; },{"./Error":4}],4:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Error = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var Error = function Error(api) { var _this = this; _classCallCheck(this, Error); _defineProperty(this, "permission", function (msg) { var bg = '#f44336'; var message = "\uD83D\uDED1 You do not have permission to run that command \uD83D\uDED1"; _this.api.sendNotice("".concat(message), msg.user, bg, _this.txt); }); _defineProperty(this, "invalid", function (msg) { var bg = '#f44336'; var message = "\uD83D\uDED1 That is an invalid command \uD83D\uDED1"; _this.api.sendNotice("".concat(message), msg.user, bg, _this.txt); }); this.api = api; this.txt = '#ffffff'; }; exports.Error = Error; },{}],5:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Global = void 0; var _PubSub = require("./PubSub"); var _util = require("./util"); var _CbUser = require("./CbUser"); var _excluded = ["user"]; function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; } function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var Global = function Global(api) { var _this = this; _classCallCheck(this, Global); _defineProperty(this, "onStart", function () { _this.api.setTimeout(_this.createUserOnStart, 5000); }); _defineProperty(this, "onEnter", function (user) { _this.updateUserOnEnter(user); }); _defineProperty(this, "onLeave", function (user) { _this.updateUserOnLeave(user); }); _defineProperty(this, "onMessage", function (msg) { if (msg.user === _this.api.room_slug) return; var user = _util.util.getUserByName(msg.user, _this.currentUsers); if (user && user.gender === null) { user.updateCbData(msg).setColor(_this.getColor(user)); } }); _defineProperty(this, "onFollow", function (user) { _this.newFollower(user); }); _defineProperty(this, "onUnfollow", function (user) { _this.newUnfollower(user); }); _defineProperty(this, "newFollower", function (user) { if (!_this.newFollows.includes(user.user)) { _this.newFollows.push(user.user); } if (_this.unFollows.includes(user.user)) { _util.util.removeFromArr(user.user, _this.unFollows); } }); _defineProperty(this, "newUnfollower", function (user) { if (_this.newFollows.includes(user.user)) { _util.util.removeFromArr(user.user, _this.newFollows); } _this.unFollows.push(user.user); }); _defineProperty(this, "createUserOnStart", function () { _this.api.getRoomUsersData(function (usersData) { if (usersData.success) { usersData.data.dark_purple.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_tons_recently: true }); }); usersData.data.light_purple.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_alot_recently: true }); }); usersData.data.dark_blue.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_recently: true }); }); usersData.data.light_blue.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_recently: false, has_tokens: true }); }); usersData.data.grey.forEach(function (name) { _this.updateUserOnEnter({ user: name, tipped_recently: false }); }); usersData.data.fanclub.forEach(function (name) { _this.updateUserOnEnter({ user: name, in_fanclub: true, tipped_recently: true }); }); usersData.data.moderator.forEach(function (name) { _this.updateUserOnEnter({ user: name, is_mod: true }); }); } }); }); _defineProperty(this, "updateUserOnEnter", function (cbUser) { if (cbUser.user === _this.api.room_slug) return; var user = cbUser.user, rest = _objectWithoutProperties(cbUser, _excluded); var roomUser = _util.util.getUserByName(user, _this.currentUsers); if (roomUser) { roomUser.updateCbData(rest).setColor(_this.getColor(roomUser)); _this.currentUsers.push(roomUser); } else { var newUser = new _CbUser.CbUser(user, rest); newUser.setColor(_this.getColor(newUser)); _this.currentUsers.push(newUser); } }); _defineProperty(this, "getColor", function (roomUser) { if (roomUser.tipped_tons_recently) { return 'Dark Purple'; } if (roomUser.tipped_alot_recently) { return 'Purple'; } if (roomUser.tipped_recently) { return 'Dark Blue'; } if (roomUser.has_tokens && roomUser.tipped_recently !== true) { return 'Light Blue'; } return 'Grey'; }); _defineProperty(this, "updateUserOnLeave", function (cbUser) { if (cbUser.user === _this.api.room_slug) return; var roomUser = _util.util.getUserByName(cbUser.user, _this.currentUsers); _util.util.removeFromArr(roomUser, _this.currentUsers); }); this.api = api; this.currentUsers = []; this.newFollows = []; this.unFollows = []; this.mods = []; this.fans = []; this.nice = []; _PubSub.pubSub.subscribe('botStart', this.onStart); _PubSub.pubSub.subscribe('userEnter', this.onEnter); _PubSub.pubSub.subscribe('userLeave', this.onLeave); _PubSub.pubSub.subscribe('newMsg', this.onMessage); _PubSub.pubSub.subscribe('newFollow', this.onFollow); _PubSub.pubSub.subscribe('unFollow', this.onUnfollow); }; exports.Global = Global; },{"./CbUser":2,"./PubSub":6,"./util":8}],6:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.pubSub = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var PubSub = function PubSub() { var _this = this; _classCallCheck(this, PubSub); _defineProperty(this, "subscribe", function (evName, fn) { _this.events[evName] = _this.events[evName] || []; _this.events[evName].push(fn); }); _defineProperty(this, "unsubscribe", function (evName, fn) { if (_this.events[evName]) { _this.events[evName] = _this.events[evName].filter(function (func) { return func !== fn; }); } }); _defineProperty(this, "publish", function (evName, data) { if (_this.events[evName]) { _this.events[evName].forEach(function (func) { return func(data); }); } }); this.events = {}; }; var pubSub = new PubSub(); exports.pubSub = pubSub; },{}],7:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.SettingsHandler = void 0; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /** * In each plugin call App.settings.register? */ var SettingsHandler = function SettingsHandler(api) { var _this = this; _classCallCheck(this, SettingsHandler); _defineProperty(this, "register", function (obj) { var settings = obj.settings; if (!settings || settings.constructor !== Array) { return _this; } settings.forEach(function (setting) { _this.settings.push(setting); }); return _this; }); _defineProperty(this, "get", function () { return _this.settings; }); this.api = api; this.settings = []; }; exports.SettingsHandler = SettingsHandler; },{}],8:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.util = void 0; var util = { /** * Return a user object from an array */ getUserByName: function getUserByName(userName, arr) { if (arr.some(function (obj) { return obj.user === userName; })) { return arr.find(function (obj) { return obj.user === userName; }); } return false; }, removeFromArr: function removeFromArr(roomUser, arr) { var index = arr.indexOf(roomUser); arr.splice(index, 1); }, strRepeat: function strRepeat(str, times) { return times > 0 ? str.repeat(times) : ''; }, // calulate line length to put spaces calcSpace: function calcSpace(str, line) { var strlen = str.length; var res = line - strlen; // res = res / 2; return res; }, // merge two above calcLen: function calcLen(str, len) { var sp = "\u205F\u205F"; return this.strRepeat(sp, this.calcSpace(str, len)); }, // calculate the length of string to remove the word "notice from notices" calcPer: function calcPer(str) { var len = str.length; var notice = 8; var percent = notice / len * 100; return "".concat(percent, "%"); }, /** * Time related functions */ formatTime: function formatTime(date) { var hours = date.getHours(); var mins = date.getMinutes(); hours = util.addLeadingZeros(hours); mins = util.addLeadingZeros(mins); return "".concat(hours, ":").concat(mins); }, addLeadingZeros: function addLeadingZeros(n) { if (n <= 9) { return "0".concat(n); } return n; }, formatName: function formatName(name) { if (name === '') { return '---'; } return name.substring(0, 15); } }; exports.util = util; },{}],9:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.app = void 0; var _App = require("./core/App"); var _multiWheel = require("./plugins/multiWheel"); var app = new _App.App(cb); exports.app = app; app.register(new _multiWheel.MultiWheel(cb)); app.run(); },{"./core/App":1,"./plugins/multiWheel":10}],10:[function(require,module,exports){ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MultiWheel = void 0; var _util = require("../core/util"); var _PubSub = require("../core/PubSub"); function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } var MultiWheel = function MultiWheel(api) { var _this = this; _classCallCheck(this, MultiWheel); _defineProperty(this, "onTip", function (tip) { // const user = tip.from_user; var amount = parseInt(tip.amount); // check if amount is equal to active wheel. if (amount === _this.wheelOne.price && _this.wheelOne.price > 0) { _this.spinWheel(tip, _this.wheelOne); } if (amount === _this.wheelTwo.price && _this.wheelTwo.price > 0) { _this.spinWheel(tip, _this.wheelTwo); } if (amount === _this.wheelThree.price && _this.wheelThree.price > 0) { _this.spinWheel(tip, _this.wheelThree); } }); _defineProperty(this, "spinWheel", function (tip, wheel) { var randNum = _this.randomRange(1, 12); if (randNum === wheel.lastNum) { _this.spinWheel(tip, wheel); return; } var prize = wheel.prizes[randNum - 1].trim(); var checkLoser = false; if (prize === '') { prize = "Not a winner, we'll add you to the loser list."; var loser = { name: tip.from_user, wheel: "".concat(wheel.name, " Wheel"), winner: false }; _this.losers.unshift(loser); // this.losers.unshift(`${tip.from_user} ★ ${wheel.name} Wheel ★`); } else { _this.winners.unshift("".concat(tip.from_user, " \u2605 ").concat(prize, " \u2605")); checkLoser = _this.allowLoserRemove(tip); } // Build Result Notice var str1 = "\u2605 ".concat(tip.from_user, " spun ").concat(_this.api.room_slug, "'s ").concat(wheel.name, " Wheel \u2605"); var str2 = "".concat(_this.spinImg[randNum - 1]); var str3 = "".concat(tip.from_user, ", you spin a ").concat(randNum, " ...Thank You\n \u2605\u2605\u2605 PRIZE: ").concat(prize, " \u2605\u2605\u2605"); _this.api.sendNotice("".concat(str1), '', _this.gameBgColor, _this.gameFontColor, 'bold'); _this.api.sendNotice("".concat(str2), ''); _this.api.sendNotice("".concat(str3), '', _this.gameBgColor, _this.gameFontColor, 'bold'); if (checkLoser) { _this.api.sendNotice("".concat(tip.from_user, ", you now have 20 seconds to type: \"/yesmissmars\" to be removed from the /marslosers list"), '', _this.gameBgColor, _this.gameFontColor, 'bold'); } }); _defineProperty(this, "showAd", function () { var str = ""; var str1 = ":mediumwheel-ad2 \uD835\uDC74\uD835\uDC70\uD835\uDC7A\uD835\uDC7A \uD835\uDC74\uD835\uDCD0\uD835\uDC79\uD835\uDC7A \uD835\uDC7E\uD835\uDC6F\uD835\uDC6C\uD835\uDC6C\uD835\uDC73"; if (_this.wheelOne.price > 0) { var _this$calcPercentWin = _this.calcPercentWin(_this.wheelOne.prizes), percent = _this$calcPercentWin.percent, numPrizes = _this$calcPercentWin.numPrizes; str += "".concat(_this.wheelOne.name, " Wheel: ").concat(_this.wheelOne.price, " to spin. ").concat(percent, "% chance to win 1 of ").concat(numPrizes, " prizes.\n"); } if (_this.wheelTwo.price > 0) { var _this$calcPercentWin2 = _this.calcPercentWin(_this.wheelTwo.prizes), _percent = _this$calcPercentWin2.percent, _numPrizes = _this$calcPercentWin2.numPrizes; str += "".concat(_this.wheelTwo.name, " Wheel: ").concat(_this.wheelTwo.price, " to spin. ").concat(_percent, "% chance to win 1 of ").concat(_numPrizes, " prizes.\n"); } if (_this.wheelThree.price > 0) { var _this$calcPercentWin3 = _this.calcPercentWin(_this.wheelThree.prizes), _percent2 = _this$calcPercentWin3.percent, _numPrizes2 = _this$calcPercentWin3.numPrizes; str += "".concat(_this.wheelThree.name, " Wheel: ").concat(_this.wheelThree.price, " to spin. ").concat(_percent2, "% chance to win 1 of ").concat(_numPrizes2, " prizes.\n"); } str += "Type /marswheel to see prizes, winners and losers"; _this.api.sendNotice("".concat(str1), '', _this.adBgColor, _this.adFontColor, ''); _this.api.sendNotice("".concat(str), '', _this.adBgColor, _this.adFontColor, 'bold'); }); _defineProperty(this, "initAd", function () { if (_this.api.settings.multiWheel_ad > 0) { _this.showAd(); _this.api.setTimeout(_this.initAd, _this.api.settings.multiWheel_ad * 60000); } }); _defineProperty(this, "randomRange", function (min, max) { var rNum = Math.random(); rNum = Math.floor(rNum * (max - min + 1) + min); return rNum; }); _defineProperty(this, "calcPercentWin", function (arr) { var prizes = arr; var winningPrizes = []; prizes.forEach(function (prize) { if (prize !== '') { winningPrizes.push(prize); } }); var percent = Math.round(winningPrizes.length / prizes.length * 100); var numPrizes = winningPrizes.length; return { percent: percent, numPrizes: numPrizes }; }); _defineProperty(this, "allowLoserRemove", function (tip) { var loser = _this.losers.filter(function (loserObj) { return loserObj.name === tip.from_user; }); if (loser.length > 0) { loser.forEach(function (instance) { instance.winner = true; _this.api.setTimeout(function () { instance.winner = false; }, 20000); }); _this.loserTimer = _this.api.setTimeout(function () { _this.api.sendNotice("Time's up ".concat(tip.from_user, ", you're still a loser. Play again for another chance."), '', _this.gameBgColor, _this.gameFontColor, 'bold'); }, 20000); return true; } }); _defineProperty(this, "marswheelCmd", function (params, msg) { if (!params[0]) { _this.showCmds(msg); } else if (params[0] === '1' || params[0] === '2' || params[0] === '3') { _this.showPrizes(params, msg); } else if (msg.user === _this.api.room_slug && params[0] === 'send') { _this.showAd(); } }); _defineProperty(this, "showWinners", function (params, msg) { var str = "\u2605 Mars Wheel Winners \u2605\n"; if (_this.winners.length < 1) { str += "No winners yet\n"; } else if (_this.winners.length >= 1 && _this.winners.length < 10) { _this.winners.forEach(function (winner) { str += "".concat(winner, "\n"); }); } else { for (var i = 0; i < 10; i++) { str += "".concat(_this.winners[i], "\n"); } } str = str.substr(0, str.length - 1); _this.api.sendNotice("".concat(str), msg.user, _this.gameBgColor, _this.gameFontColor, 'bold'); }); _defineProperty(this, "showLosers", function (params, msg) { var str = "\u2605 Mars Wheel Losers \u2605\n"; if (_this.losers.length < 1) { str += "No losers. Time to spin and take a risk for \uD835\uDC40\uD835\uDC3C\uD835\uDC46\uD835\uDC46 \uD835\uDC40\uD835\uDC9C\uD835\uDC45\uD835\uDC46\n"; } else if (_this.losers.length >= 1 && _this.losers.length < 10) { _this.losers.forEach(function (loser) { str += "".concat(loser.name, " \u2192 ").concat(loser.wheel, " \n"); }); } else { for (var i = 0; i < 10; i++) { str += "".concat(_this.losers[i].name, " \u2192 ").concat(_this.losers[i].wheel, " \n"); } } str = str.substr(0, str.length - 1); _this.api.sendNotice("".concat(str), msg.user, _this.gameBgColor, _this.gameFontColor, 'bold'); }); _defineProperty(this, "showPrizes", function (params, msg) { var prizes = null; var arr = []; var str = ""; if (params[0] === '1' && _this.wheelOne.price > 0) { prizes = _this.wheelOne.prizes; str += "\u2605 ".concat(_this.wheelOne.name, " Wheel Prizes \u2605\n"); } else if (params[0] === '2' && _this.wheelTwo.price > 0) { prizes = _this.wheelTwo.prizes; str += "\u2605 ".concat(_this.wheelTwo.name, " Wheel Prizes \u2605\n"); } else if (params[0] === '3' && _this.wheelThree.price > 0) { prizes = _this.wheelThree.prizes; str += "\u2605 ".concat(_this.wheelThree.name, " Wheel Prizes \u2605\n"); } prizes.forEach(function (prize) { if (prize === '' || prize === null) { var prizeStr = 'Not a winner'; arr.push(prizeStr); } else { arr.push(prize); } }); str += "Prize 1: ".concat(arr[0], "\n Prize 2: ").concat(arr[1], "\n Prize 3: ").concat(arr[2], "\n Prize 4: ").concat(arr[3], "\n Prize 5: ").concat(arr[4], "\n Prize 6: ").concat(arr[5], "\n Prize 7: ").concat(arr[6], "\n Prize 8: ").concat(arr[7], "\n Prize 9: ").concat(arr[8], "\n Prize 10: ").concat(arr[9], "\n Prize 11: ").concat(arr[10], "\n Prize 12: ").concat(arr[11]); _this.api.sendNotice("".concat(str), msg.user, _this.gameBgColor, _this.gameFontColor, 'bold'); }); _defineProperty(this, "showCmds", function () { var msg = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : null; var str = "Miss Mars Wheel Commands:\n"; if (_this.wheelOne.price > 0) { str += "Type \"/marswheel 1\" for ".concat(_this.wheelOne.name, " prizelist\n"); } if (_this.wheelTwo.price > 0) { str += "Type \"/marswheel 2\" for ".concat(_this.wheelTwo.name, " prizelist\n"); } if (_this.wheelThree.price > 0) { str += "Type \"/marswheel 3\" for ".concat(_this.wheelThree.name, " prizelist\n"); } str += "Type \"/marswinners\" to see the list of the last 10 winners\n"; str += "Type \"/marslosers\" to see the list of the last 10 losers"; if (msg) { if (msg.user === _this.api.room_slug) { str += "\n\nBroadcaster secret commands:\n Type \"/marswheel send\" to send the wheel ad to the room"; } _this.api.sendNotice("".concat(str), msg.user, _this.gameBgColor, _this.gameFontColor, ''); } else { _this.api.sendNotice("".concat(str), '', _this.gameBgColor, _this.gameFontColor, ''); } }); _defineProperty(this, "removeLoser", function (params, msg) { var findLoser = _this.losers.find(function (loser) { return loser.name === msg.user; }); if (msg.has_tokens || findLoser || msg.user === _this.api.room_slug) { msg['X-Spam'] = false; } if (findLoser) { if (findLoser.winner === true) { _this.api.cancelTimeout(_this.loserTimer); var loserInstances = _this.losers.filter(function (loser) { return loser.name === msg.user; }); loserInstances.forEach(function (loserInstance) { _util.util.removeFromArr(loserInstance, _this.losers); }); _this.api.sendNotice("Well done ".concat(msg.user, ", you're no longer a loser"), '', _this.gameBgColor, _this.gameFontColor, 'bold'); } else { _this.api.sendNotice("".concat(msg.user, ", follow instructions correctly be removed from the /marslosers list. Play again."), '', _this.gameBgColor, _this.gameFontColor, 'bold'); } } else if (msg.has_tokens && msg.user !== _this.api.room_slug) { _this.api.sendNotice("".concat(msg.user, ", you're not currently a loser. Time to spin a wheel."), '', _this.gameBgColor, _this.gameFontColor, 'bold'); } }); _defineProperty(this, "addCommands", function () { var commands = { marswheel: { func: _this.marswheelCmd, permission: 'user', description: 'See the prizelist', params: [] }, marswinners: { func: _this.showWinners, permission: 'user', description: 'See last 10 winners', params: [] }, marslosers: { func: _this.showLosers, permission: 'user', description: 'See last 10 losers', params: [] }, yesmissmars: { func: _this.removeLoser, permission: 'user', description: 'Remove yourself from the loser list', params: [] } }; return commands; }); _defineProperty(this, "addSettings", function () { var settings = [{ name: 'games_blank_space_1', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'wheelBreak4', label: "Spin The Wheel ".concat(_util.util.strRepeat("_", 30)), type: 'choice', required: false }, { name: 'games_blank_space_2', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'multiWheel_ad', label: 'Show advertisement every ? minutes (0 is off)', type: 'int', minValue: 0, defaultValue: '6' }, { name: 'wheel_ad_color', label: 'Custom advertisement font color (HTML hex color code)', type: 'str', defaultValue: '', required: false }, { name: 'wheel_game_color', label: 'Game background color (HTML hex color code)', type: 'str', defaultValue: '', required: false }, { name: 'games_blank_space_3', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'wheelBreak1', label: "Wheel 1 ".concat(_util.util.strRepeat("_", 30)), type: 'choice', required: false }, { name: 'games_blank_space_4', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'wheelOnePrice', label: 'How much to spin? (0 turns wheel off)', type: 'int', minValue: 0, defaultValue: 33 }, { name: 'wheelOneName', label: 'Name of this wheel', type: 'str', defaultValue: 'Findom' }, { name: 'wheelOnePrize1', label: 'Prize 1', type: 'str', required: false }, { name: 'wheelOnePrize2', label: 'Prize 2', type: 'str', required: false }, { name: 'wheelOnePrize3', label: 'Prize 3', type: 'str', required: false }, { name: 'wheelOnePrize4', label: 'Prize 4', type: 'str', required: false }, { name: 'wheelOnePrize5', label: 'Prize 5', type: 'str', required: false }, { name: 'wheelOnePrize6', label: 'Prize 6', type: 'str', required: false }, { name: 'wheelOnePrize7', label: 'Prize 7', type: 'str', required: false }, { name: 'wheelOnePrize8', label: 'Prize 8', type: 'str', required: false }, { name: 'wheelOnePrize9', label: 'Prize 9', type: 'str', required: false }, { name: 'wheelOnePrize10', label: 'Prize 10', type: 'str', required: false }, { name: 'wheelOnePrize11', label: 'Prize 11', type: 'str', required: false }, { name: 'wheelOnePrize12', label: 'Prize 12', type: 'str', required: false }, { name: 'games_blank_space_5', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'wheelBreak2', label: "Wheel 2 ".concat(_util.util.strRepeat("_", 30)), type: 'choice', choice1: 'N/A', defaultValue: 'N/A' }, { name: 'games_blank_space_6', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'wheelTwoPrice', label: 'How much to spin? (0 turns wheel off)', type: 'int', minValue: 0, defaultValue: '34' }, { name: 'wheelTwoName', label: 'Name of this wheel', type: 'str', defaultValue: 'Femdom' }, { name: 'wheelTwoPrize1', label: 'Prize 1', type: 'str', required: false }, { name: 'wheelTwoPrize2', label: 'Prize 2', type: 'str', required: false }, { name: 'wheelTwoPrize3', label: 'Prize 3', type: 'str', required: false }, { name: 'wheelTwoPrize4', label: 'Prize 4', type: 'str', required: false }, { name: 'wheelTwoPrize5', label: 'Prize 5', type: 'str', required: false }, { name: 'wheelTwoPrize6', label: 'Prize 6', type: 'str', required: false }, { name: 'wheelTwoPrize7', label: 'Prize 7', type: 'str', required: false }, { name: 'wheelTwoPrize8', label: 'Prize 8', type: 'str', required: false }, { name: 'wheelTwoPrize9', label: 'Prize 9', type: 'str', required: false }, { name: 'wheelTwoPrize10', label: 'Prize 10', type: 'str', required: false }, { name: 'wheelTwoPrize11', label: 'Prize 11', type: 'str', required: false }, { name: 'wheelTwoPrize12', label: 'Prize 12', type: 'str', required: false }, { name: 'games_blank_space_7', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'wheelBreak3', label: "Wheel 3 ".concat(_util.util.strRepeat("_", 30)), type: 'choice', choice1: 'N/A', defaultValue: 'N/A' }, { name: 'games_blank_space_8', label: "".concat(_util.util.strRepeat('#', 40)), type: 'choice', required: false }, { name: 'wheelThreePrice', label: 'How much to spin? (0 turns wheel off)', type: 'int', minValue: 0, defaultValue: '35' }, { name: 'wheelThreeName', label: 'Name of this wheel', type: 'str', defaultValue: 'Worship' }, { name: 'wheelThreePrize1', label: 'Prize 1', type: 'str', required: false }, { name: 'wheelThreePrize2', label: 'Prize 2', type: 'str', required: false }, { name: 'wheelThreePrize3', label: 'Prize 3', type: 'str', required: false }, { name: 'wheelThreePrize4', label: 'Prize 4', type: 'str', required: false }, { name: 'wheelThreePrize5', label: 'Prize 5', type: 'str', required: false }, { name: 'wheelThreePrize6', label: 'Prize 6', type: 'str', required: false }, { name: 'wheelThreePrize7', label: 'Prize 7', type: 'str', required: false }, { name: 'wheelThreePrize8', label: 'Prize 8', type: 'str', required: false }, { name: 'wheelThreePrize9', label: 'Prize 9', type: 'str', required: false }, { name: 'wheelThreePrize10', label: 'Prize 10', type: 'str', required: false }, { name: 'wheelThreePrize11', label: 'Prize 11', type: 'str', required: false }, { name: 'wheelThreePrize12', label: 'Prize 12', type: 'str', required: false }]; return settings; }); this.api = api; this.settings = this.addSettings(); this.commands = this.addCommands(); this.winners = []; this.losers = []; this.loserTimer = null; // Design // this.largeImg = [':koekeloeretrafalgarsquarepoez10']; this.adImg = ':mediumwheel-ad2'; this.spinImg = [':oekeloeretrafalgarsquarepoezz1', ':oekeloeretrafalgarsquarepoezz2', ':oekeloeretrafalgarsquarepoezz3', ':oekeloeretrafalgarsquarepoezz4', ':oekeloeretrafalgarsquarepoezz5', ':oekeloeretrafalgarsquarepoezz6', ':oekeloeretrafalgarsquarepoezz7', ':oekeloeretrafalgarsquarepoezz8', ':oekeloeretrafalgarsquarepoezz9', ':oekeloeretrafalgarsquarepoezz10', ':oekeloeretrafalgarsquarepoezz11', ':oekeloeretrafalgarsquarepoezz12']; this.gameBgColor = this.api.settings.wheel_game_color || '#BD4F6C'; this.gameFontColor = '#fff'; this.adBgColor = ''; this.adFontColor = this.api.settings.wheel_ad_color || '#BD4F6C'; // wheels this.wheelOne = { name: this.api.settings.wheelOneName, price: parseInt(this.api.settings.wheelOnePrice), lastNum: 0, prizes: [this.api.settings.wheelOnePrize1, this.api.settings.wheelOnePrize2, this.api.settings.wheelOnePrize3, this.api.settings.wheelOnePrize4, this.api.settings.wheelOnePrize5, this.api.settings.wheelOnePrize6, this.api.settings.wheelOnePrize7, this.api.settings.wheelOnePrize8, this.api.settings.wheelOnePrize9, this.api.settings.wheelOnePrize10, this.api.settings.wheelOnePrize11, this.api.settings.wheelOnePrize12] }; this.wheelTwo = { name: this.api.settings.wheelTwoName, price: parseInt(this.api.settings.wheelTwoPrice), lastnum: 0, prizes: [this.api.settings.wheelTwoPrize1, this.api.settings.wheelTwoPrize2, this.api.settings.wheelTwoPrize3, this.api.settings.wheelTwoPrize4, this.api.settings.wheelTwoPrize5, this.api.settings.wheelTwoPrize6, this.api.settings.wheelTwoPrize7, this.api.settings.wheelTwoPrize8, this.api.settings.wheelTwoPrize9, this.api.settings.wheelTwoPrize10, this.api.settings.wheelTwoPrize11, this.api.settings.wheelTwoPrize12] }; this.wheelThree = { name: this.api.settings.wheelThreeName, price: parseInt(this.api.settings.wheelThreePrice), lastnum: 0, prizes: [this.api.settings.wheelThreePrize1, this.api.settings.wheelThreePrize2, this.api.settings.wheelThreePrize3, this.api.settings.wheelThreePrize4, this.api.settings.wheelThreePrize5, this.api.settings.wheelThreePrize6, this.api.settings.wheelThreePrize7, this.api.settings.wheelThreePrize8, this.api.settings.wheelThreePrize9, this.api.settings.wheelThreePrize10, this.api.settings.wheelThreePrize11, this.api.settings.wheelThreePrize12] }; _PubSub.pubSub.subscribe('newTip', this.onTip); this.api.setTimeout(this.initAd, 90000); this.showCmds(); }; exports.MultiWheel = MultiWheel; },{"../core/PubSub":6,"../core/util":8}]},{},[9]);
© Copyright Chaturbate 2011- 2024. All Rights Reserved.