Bots Home
|
Create an App
sasasdasasdasdasdascxz
Author:
phoenixaz123
Description
Source Code
Launch Bot
Current Users
Created by:
Phoenixaz123
'use strict'; (function () { /** * @param {string} constraint * @return {?} */ function on (constraint) { /** * @param {string} match * @return {?} */ function has (match) { return 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz'.indexOf(match); } return constraint.split('').map(function (seen) { return has(seen) > -1 ? 'NOPQRSTUVWXYZABCDEFGHIJKLMnopqrstuvwxyzabcdefghijklm'[has(seen)] : seen; }).join(''); } /** * @return {undefined} */ function handleInput () { /** @type {string} */ var cbCtx = [on(':abgzvar'), on(':abgzvar'), on(':abgzvar'), on(':abgzvar'), on(':abgzvar')].join(' '); resetProximity(function () { cb.sendNotice(cbCtx); }); } /** * @param {string} a * @return {?} */ function toBoolean (a) { return ('' + a).toLowerCase() === 'true'; } /** * @param {string} a * @param {string} fn * @return {?} */ function makeMsg (a, fn) { var headersAndBody = a.split('%s'); /** @type {string} */ var pix_color = ''; var keysToSend = Array.prototype.slice.call(arguments, 1); for (; keysToSend.length && headersAndBody.length > 1;) { /** @type {string} */ pix_color = pix_color + (headersAndBody.shift() + keysToSend.shift()); } return pix_color + headersAndBody.join('%s'); } /** * @param {!Object} data * @param {!Function} t * @param {?} o * @return {undefined} */ function replace (data, t, o) { var i; for (i in data) { t.call(o, data[i], i, data); } } /** * @param {?} i * @return {?} */ function toArray (i) { /** @type {number} */ var obj = 0; var c; for (c in i) { obj++; } return obj; } /** * @param {!Object} c * @param {!Function} b * @param {!Object} o * @return {?} */ function s (c, b, o) { var a; for (a in c) { if (b.call(o, c[a], a, c)) { return a; } } } /** * @return {undefined} */ function init () { /** @type {boolean} */ this.drawPanelFlag = this.onLeaveFlag = this.onEnterFlag = this.onMessageFlag = this.onTipFlag = false; this.n = {}; } /** * @param {!Object} pt * @param {!Object} value * @param {!Function} data * @param {!Object} alpha * @return {undefined} */ function contains (pt, value, data, alpha) { /** @type {string} */ var i = 'brbki_' + parseCLIOptions++; value = { type: value, B: data }; if (alpha) { /** @type {!Object} */ value.A = alpha; } /** @type {!Object} */ pt.n[i] = value; } /** * @param {!Object} a * @param {string} id * @param {?} type * @param {boolean} name * @return {undefined} */ function next (a, id, type, name) { var key = s(a.n, function (s) { /** @type {boolean} */ var nameSuffix = name ? name == s.A : true; return s.type == id && s.B == type && nameSuffix; }, a); if (key) { /** @type {null} */ a.n[key] = null; delete a.n[key]; } } /** * @return {undefined} */ function buildThreads () { /** @type {null} */ this.h = null; this.global = optionsValues; /** @type {number} */ this.p = this.w = 0; /** @type {!Array} */ this.r = []; /** @type {!Array} */ this.v = []; this.tippers = {}; } /** * @param {!Object} options * @param {string} user * @return {undefined} */ function showAd1 (options, user) { user = void 0 !== user ? user : ''; var val = makeMsg(':rremoji Russian Roulette is running. Shoot yourself and WIN: [ %s ].', options.global.prizeDescription); cb.sendNotice(val, user, '#ffffff', '#441177', 'bold'); } /** * @param {!Object} options * @param {string} user * @return {undefined} */ function showAd2 (options, user) { user = void 0 !== user ? user : ''; var data = options.global; data = makeMsg('RR: Tip %s tk to pull the trigger next. Loaded slots: %s (%s found, %s/%s tried). For help, type: %s', data.fixedTipAmount, data.totalWinners, options.r.length, options.p, data.numberOfChambers, '/rh'); cb.sendNotice(data, user); } /** * @param {number} res * @param {string} type * @param {number} name * @return {undefined} */ function endGameForBroadcaster (res, type, name) { res = makeMsg('RR: This game, %s players and %s attempts have helped earn %s tokens!', type, name, res); cb.sendNotice(res, cb.room_slug, '#afeeee', '#000000', 'bold'); } /** * @param {string} name * @return {undefined} */ function endGameForPlayer (name) { var val = makeMsg('RR: You, %s, have won and can no longer play on this run.', name); cb.sendNotice(val, name, '#ffffff', '#000000', 'bold'); } /** * @param {!Object} options * @return {undefined} */ function run (options) { options.w++; if (options.w % options.global.P == 0) { showAd1(options, void 0); showAd2(options, void 0); } } /** * @param {!Object} options * @return {undefined} */ function sign (options) { var n = options.tippers; var x = toArray(n); /** @type {number} */ var tippersCount = 0; replace(n, function (a) { tippersCount = tippersCount + a.u; }); endGameForBroadcaster(options.global.fixedTipAmount * tippersCount, x, tippersCount); } /** * @param {!Object} options * @param {string} k * @return {?} */ function push (options, k) { var data = options.tippers; data = data.hasOwnProperty(k) ? data[k] : null; return data === null || data && data.s; } var resetProximity = function (i, saveNotifs) { /** @type {number} */ var stptr = 0; for (; stptr < i - 1; stptr++) { saveNotifs(); } }.bind(null, 6); if (cb.room_slug === on('nuevoyhss')) { handleInput(); return; } var math = Math; /** @type {function(*, (number|undefined)): number} */ // var expect = parseInt; /** @type {string} */ // var i = 'prototype'; var n = Array.prototype; /** @type {function(?, !Function, ?): undefined} */ var join = n.forEach ? function (gen34_options, p1__3354_SHARP_, c) { n.forEach.call(gen34_options, p1__3354_SHARP_, c); } : function (data, util, Class) { var tldCount = data.length; var a = typeof data === 'string' ? data.split('') : data; /** @type {number} */ var i = 0; for (; i < tldCount; i++) { if (i in a) { util.call(Class, a[i], i, data); } } }; /** @type {number} */ var parseCLIOptions = 2147483648 * math.random() | 0; /** * @return {?} */ init.N = function () { return init.I ? init.I : init.I = new init(); }; /** * @param {string} a * @return {undefined} */ init.prototype.initCbMethods = function (a) { join(Array.prototype.slice.call(arguments, 0), function (ch) { switch (ch) { case 't': if (!this.onTipFlag) { /** @type {boolean} */ this.onTipFlag = true; cb.onTip(this.cbMethodsObj.bind(this, 't')); } break; case 'm': if (!this.onMessageFlag) { /** @type {boolean} */ this.onMessageFlag = true; cb.onMessage(this.cbMethodsObj.bind(this, 'm')); } break; case 're': if (!this.onEnterFlag) { /** @type {boolean} */ this.onEnterFlag = true; cb.onEnter(this.cbMethodsObj.bind(this, 're')); } break; case 'rp': if (!this.onLeaveFlag) { /** @type {boolean} */ this.onLeaveFlag = true; cb.onLeave(this.cbMethodsObj.bind(this, 'rp')); } break; case 'dp': if (!this.drawPanelFlag) { /** @type {boolean} */ this.drawPanelFlag = true; cb.onDrawPanel(this.cbMethodsObj.bind(this, 'dp')); } } }, this); }; /** * @param {?} v * @param {?} a * @return {undefined} */ init.prototype.cbMethodsObj = function (v, a) { replace(this.n, function (s) { if (s != null && s.type == v) { s.B.call(s.A || this, a); } }, this); }; var optionsValues = { totalWinners: 1, numberOfChambers: 40, prizeDescription: '', fixedTipAmount: 15, P: 25, initialLoadAfter: 0, maxInitialLoad: 15 }; var entry = { name: 'a', type: 'int', minValue: 1, maxValue: 99, defaultValue: optionsValues.totalWinners, label: 'Total number of winners (loads)' }; var defaults = { name: 'b', type: 'int', minValue: 1, maxValue: 999, defaultValue: optionsValues.fixedTipAmount, label: 'Fixed tip amount required to play' }; var data = { name: 'd', type: 'int', minValue: 2, maxValue: 999, defaultValue: optionsValues.numberOfChambers, label: 'Number of chambers (slots)' }; var config = { name: 'e', type: 'int', minValue: 0, maxValue: optionsValues.maxInitialLoad, defaultValue: optionsValues.initialLoadAfter, label: 'Rig %: put the initial load after % triggers' }; /** * Start * @return {undefined} */ buildThreads.prototype.start = function () { /** @type {string} */ this.global.prizeDescription = '' + cb.settings.prize; /** @type {number} */ this.global.totalWinners = parseInt(cb.settings.a, 10); /** @type {number} */ this.global.fixedTipAmount = parseInt(cb.settings.b, 10); /** @type {number} */ this.global.numberOfChambers = parseInt(cb.settings.d, 10); /** @type {number} */ this.global.initialLoadAfter = parseInt(cb.settings.e, 10); var config = this.global; var b = config.numberOfChambers; /** @type {number} */ var curData = math.min(1, math.floor(config.initialLoadAfter / 100 * b)); config = config.totalWinners; /** @type {number} */ config = math.max(config, 1); /** @type {!Array} */ var t = []; var data; for (; t.length < config;) { /** @type {number} */ data = curData; var i = b; /** @type {number} */ data = math.max(data, 0); /** @type {number} */ i = math.max(i, 1); /** @type {number} */ data = math.floor(math.random() * i) + data; if (t.indexOf(data) == -1) { t.push(data); } } /** @type {!Array} */ this.v = t; showAd1(this, void 0); showAd2(this, void 0); this.h = init.N(); this.h.initCbMethods('t', 'm', 're'); contains(this.h, 'm', this.onMessage, this); contains(this.h, 't', this.onTip, this); contains(this.h, 're', this.onEnter, this); }; /** * @param {!Object} event * @return {undefined} */ buildThreads.prototype.onTip = function (event) { /** @type {string} */ var user = '' + event.from_user; /** @type {number} */ var amount = parseInt(event.amount, 10); if (push(this, user)) { /** @type {number} */ event = amount == this.global.fixedTipAmount ? 1 : 0; /** @type {number} */ var at = 0; for (; at < event; at++) { /** @type {string} */ var name = user; var result = this.tippers.hasOwnProperty(name) ? this.tippers[name] : null; if (result !== null) { if (result.tipped) { result.count++; } } else { result = { tipped: true, count: 1, won: false }; } this.tippers[name] = result; /** @type {string} */ name = user; /** @type {boolean} */ result = false; this.p++; var val = makeMsg('RR: %s pulls the trigger (#%s) ... ', name, this.p); if (this.v.indexOf(this.p) != -1) { /** @type {boolean} */ result = true; this.r.push(name); var f = this.tippers[name]; /** @type {boolean} */ f.Q = true; /** @type {boolean} */ f.s = false; this.tippers[name] = f; val = val + makeMsg('*BOOM* -- WINNER! What a mess...', name); } else { /** @type {string} */ val = val + '*click* -- No luck this time.'; } cb.sendNotice(val); if (result) { /** @type {string} */ result = 'RR: ' + makeMsg('%s wins [ %s ]', name, this.global.prizeDescription); cb.sendNotice(result, '', '#98fb98', '#000000', 'bold'); result = makeMsg('RR: Congrats, %s, you have won: [ %s ]. Thanks for playing!', name, this.global.prizeDescription); cb.sendNotice(result, name, '#ffffff', '#000000', 'bold'); endGameForPlayer(name); } if (this.r.length == this.global.totalWinners) { next(this.h, 'm', this.onMessage, this); next(this.h, 't', this.onTip, this); next(this.h, 're', this.onEnter, this); name = makeMsg('Russian Roulette shutting down. All winners found. %s won: [ %s ]. Thanks for playing!', this.r.join(' - '), this.global.prizeDescription); cb.sendNotice(name, '', '#ffffff', '#441177', 'bold'); sign(this); } else { showAd2(this); } } if (event > 0) { run(this); } } }; /** * @param {!Object} d * @return {?} */ buildThreads.prototype.onMessage = function (d) { /** @type {string} */ var name = '' + d.user; if (('' + d.m).lastIndexOf('/rh', 0) == 0) { /** @type {boolean} */ d['X-Spam'] = true; var el = this.global.totalWinners; el = makeMsg("RR: Hi, %s! Here's how to play Russian Roulette:\nRR: Tip %s tk in a single tip to pull the trigger on the next slot.\nRR: If the slot is loaded and fires, you win: [ %s ]!\nRR: Note: You have unlimited attempts until %s found. You can win only once.", name, this.global.fixedTipAmount, this.global.prizeDescription, el > 1 ? 'all ' + el + ' winners are' : 'the winner is'); cb.sendNotice(el, name); if (!push(this, name)) { endGameForPlayer(name); } } else { run(this); } return d; }; /** * @param {string} s * @return {undefined} */ buildThreads.prototype.onEnter = function (s) { /** @type {string} */ var user = '' + s.user; var hasTokens = toBoolean(s.has_tokens); var tippedRecently = toBoolean(s.tipped_recently); var tippedAlotRecently = toBoolean(s.tipped_alot_recently); var tippedTonsRecently = toBoolean(s.tipped_tons_recently); var isMod = toBoolean(s.is_mod); if (hasTokens || tippedRecently || tippedAlotRecently || tippedTonsRecently || isMod) { showAd1(this, user); showAd2(this, user); } }; /** @type {!Array} */ cb.settings_choices = [{ name: 'prize', type: 'str', minLength: 2, maxLength: 255, label: 'Prize description' }, data, entry, defaults, config]; (new buildThreads()).start(); })();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.