Bots Home
|
Create an App
sgsdfg
Author:
ho_222
Description
Source Code
Launch Bot
Current Users
Created by:
Ho_222
/** * App: Sarita Wheel of Fortune! by Ajstudios * Based on zingknaat's Roll The Dice * Version: 0.2.6 * Author: real_ndrvdt * Date: 2019-06-28 */ cb.settings_choices = [ { name: 'roomSubj', type: 'str', default: 'Play with me! Tip 20 tk to spin the #wheel !', label: '01. Set room title ("-" for do not set)', }, { name: 'tokens', type: 'int', minValue: 1, maxValue: 100, label: '02. Price per spin', defaultValue: 20 }, { name: 'skip_prizes', type: 'int', minValue: 0, maxValue: 99, label: '03. Avoids to repeat last X prizes for more randomness', defaultValue: 10 }, {name: 'prize_1', type: 'str', default: 'Show pussy', label: '04. Prize for #1 ("-" for nothing)'}, {name: 'prize_2', type: 'str', default: 'Topless for 2 minutes', label: 'Prize for #2 ("-" for nothing)'}, {name: 'prize_3', type: 'str', default: 'Spank my ass', label: 'Prize for #3 ("-" for nothing)'}, {name: 'prize_4', type: 'str', default: 'Air kiss for you!', label: 'Prize for #4 ("-" for nothing)'}, {name: 'prize_5', type: 'str', default: 'Play with nipples', label: 'Prize for #5 ("-" for nothing)'}, {name: 'prize_6', type: 'str', default: 'Dance', label: 'Prize for #6 ("-" for nothing)'}, {name: 'prize_7', type: 'str', default: 'Flash my tits', label: 'Prize for #7 ("-" for nothing)'}, {name: 'prize_8', type: 'str', default: 'Doggy pose with panties', label: 'Prize for #8 ("-" for nothing)'}, {name: 'prize_9', type: 'str', default: 'Smile for you!', label: 'Prize for #9 ("-" for nothing)'}, {name: 'prize_10', type: 'str', default: 'Suck my finger', label: 'Prize for #10 ("-" for nothing)'}, {name: 'prize_11', type: 'str', default: 'Flash my ass', label: 'Prize for #11 ("-" for nothing)'}, {name: 'prize_12', type: 'str', default: 'Show feet', label: 'Prize for #12 ("-" for nothing)'}, {name: 'prize_13', type: 'str', default: 'Striptease', label: 'Prize for #13 ("-" for nothing)'}, {name: 'prize_14', type: 'str', default: 'Stroke the kitty', label: 'Prize for #14 ("-" for nothing)'}, {name: 'prize_15', type: 'str', default: '-', label: 'Prize for #15 ("-" for nothing)'}, {name: 'prize_16', type: 'str', default: '-', label: 'Prize for #16 ("-" for nothing)'}, {name: 'prize_17', type: 'str', default: '-', label: 'Prize for #17 ("-" for nothing)'}, {name: 'prize_18', type: 'str', default: '-', label: 'Prize for #18 ("-" for nothing)'}, { name: 'notice_wait_time', type: 'choice', label: '05. Show app advertisement every X minutes', choice1: 3, choice2: 5, choice3: 7, choice4: 10, choice5: 15, choice6: 20, choice7: 30, defaultValue: 15 }, { name: 'notice2_wait_time', type: 'choice', label: '06. Show notice every X minutes', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 7, choice7: 10, choice8: 15, defaultValue: 3 }, { name: 'use_predefined_messages', type: 'choice', label: '07. Use predefined notices (No - own notices from below)', choice1: "Yes", choice2: "No", defaultValue: "No" }, { name: 'advertise1', type: 'str', default: ':ndrwhlfrtn_spin20', label: '08. Notice #1 ("-" for nothing)' }, { name: 'advertise2', type: 'str', default: 'Wanna see a hot naked dance? Tip 100 tokens for STRIPTEASE!', label: 'Notice #2 ("-" for nothing)' }, { name: 'advertise3', type: 'str', default: ':prizesdis Tip 20 tokens to spin the wheel and reveal a prize!', label: 'Notice #3 ("-" for nothing)' }, { name: 'advertise4', type: 'str', default: 'Wanna play with me?', label: 'Notice #4 ("-" for nothing)' }, { name: 'advertise5', type: 'str', default: ':wantmorepvt18', label: 'Notice #5 ("-" for nothing)' }, { name: 'advertise6', type: 'str', default: 'Play with me! Tip 20 tk to spin the wheel, or type /menu to see my TIP MENU!', label: 'Notice #6 ("-" for nothing)' }, { name: 'advertise7', type: 'str', default: ':hearts_bubbling_small Thanks for your support! LOVE YOU ALL!', label: 'Notice #7 ("-" for nothing)' }, { name: 'room_helper', type: 'str', default: 'real_ndrvdt', label: '09. Name of the room helper who can use additional commands ("-" for nobody)', }, { name: 'show_tip_menu', type: 'choice', label: '10. Enable TIP MENU', choice1: "Yes", choice2: "No", defaultValue: "No" }, { name: 'tip_menu_color', type: 'choice', label: 'TIP MENU color', choice1: "Pink", choice2: "Blue", choice3: "Brown", defaultValue: "Pink" }, { name: 'tipmenu_wait_time', type: 'choice', label: '11. Show TIP MENU every X minutes', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 7, choice7: 10, choice8: 15, defaultValue: 5 }, {name: 'tm_1', type: 'str', default: 'PM', label: '12. Tip menu item #1 ("-" for nothing)'}, {name: 'tp_1', type: 'int', minValue: 1, maxValue: 500, label: 'Tip menu price #1', defaultValue: 5 }, {name: 'tm_2', type: 'str', default: 'Show feet', label: 'Tip menu item #2 ("-" for nothing)'}, {name: 'tp_2', type: 'int', minValue: 1, maxValue: 500, label: 'Tip menu price #2', defaultValue: 11 }, {name: 'tm_3', type: 'str', default: 'Spank ass', label: 'Tip menu item #3 ("-" for nothing)'}, {name: 'tp_3', type: 'int', minValue: 1, maxValue: 500, label: 'Tip menu price #3', defaultValue: 22 }, {name: 'tm_4', type: 'str', default: 'Watch your cam', label: 'Tip menu item #4 ("-" for nothing)'}, {name: 'tp_4', type: 'int', minValue: 1, maxValue: 500, label: 'Tip menu price #4', defaultValue: 25 }, {name: 'tm_5', type: 'str', default: 'Ass flash', label: 'Tip menu item #5 ("-" for nothing)'}, {name: 'tp_5', type: 'int', minValue: 1, maxValue: 500, label: 'Tip menu price #5', defaultValue: 30 }, {name: 'tm_6', type: 'str', default: 'Dance', label: 'Tip menu item #6 ("-" for nothing)'}, {name: 'tp_6', type: 'int', minValue: 1, maxValue: 500, label: 'Tip menu price #6', defaultValue: 33 }, {name: 'tm_7', type: 'str', default: 'Tits flash', label: 'Tip menu item #7 ("-" for nothing)'}, {name: 'tp_7', type: 'int', minValue: 1, maxValue: 500, label: 'Tip menu price #7', defaultValue: 35 }, {name: 'tm_8', type: 'str', default: 'Doggy', label: 'Tip menu item #8 ("-" for nothing)'}, {name: 'tp_8', type: 'int', minValue: 1, maxValue: 500, label: 'Tip menu price #8', defaultValue: 55 }, {name: 'tm_9', type: 'str', default: 'Pussy flash', label: 'Tip menu item #9 ("-" for nothing)'}, {name: 'tp_9', type: 'int', minValue: 1, maxValue: 500, label: 'Tip menu price #9', defaultValue: 60 }, {name: 'tm_10', type: 'str', default: 'Striptease', label: 'Tip menu item #10 ("-" for nothing)'}, {name: 'tp_10', type: 'int', minValue: 1, maxValue: 500, label: 'Tip menu price #10', defaultValue: 100 }, {name: 'tm_11', type: 'str', default: 'Pussy play', label: 'Tip menu item #11 ("-" for nothing)'}, {name: 'tp_11', type: 'int', minValue: 1, maxValue: 1000, label: 'Tip menu price #11', defaultValue: 222 }, {name: 'tm_12', type: 'str', default: '-', label: 'Tip menu item #12 ("-" for nothing)'}, {name: 'tp_12', type: 'int', minValue: 1, maxValue: 1000, label: 'Tip menu price #12', defaultValue: 333 }, {name: 'tm_13', type: 'str', default: '-', label: 'Tip menu item #13 ("-" for nothing)'}, {name: 'tp_13', type: 'int', minValue: 1, maxValue: 1000, label: 'Tip menu price #13', defaultValue: 444 }, {name: 'tm_14', type: 'str', default: '-', label: 'Tip menu item #14 ("-" for nothing)'}, {name: 'tp_14', type: 'int', minValue: 1, maxValue: 1000, label: 'Tip menu price #14', defaultValue: 555 }, {name: 'tm_15', type: 'str', default: '-', label: 'Tip menu item #15 ("-" for nothing)'}, {name: 'tp_15', type: 'int', minValue: 1, maxValue: 1000, label: 'Tip menu price #15', defaultValue: 666 }, { name: 'awayMessage', type: 'str', default: "Stay tuned! I'll be right back!", label: '13. Away screen message', }, { name: 'awayNotice', type: 'str', default: ":break2%I am away for a moment. Stay tuned!", label: '14. Away chat notice (use "%" for line break)', }, { name: 'enable_goals', type: 'choice', label: '15. Enable GOALS (you can use @goal@, @price@ or @remaining@ placeholders in #1 Room Title)', choice1: "Yes", choice2: "No", defaultValue: "No" }, { name: 'autostart_next_goal', type: 'choice', label: 'Auto start next goal', choice1: "Yes", choice2: "No", defaultValue: "Yes" }, { name: 'autostart_goal_timer', type: 'int', minValue: 0, maxValue: 99, label: 'Auto start next goal after X seconds (0-99)', defaultValue: 10 }, {name: 'goal_info_message', type: 'str', default: 'Next goal: @goal@ [@remaining@ tokens remaining]', label: '16. Goal info message (you can use @goal@, @price@ or @remaining@ placeholders)'}, {name: 'goal_reached_message', type: 'str', default: 'Goal reached! @goal@!', label: '17. Goal reached message (you can use @goal@, @price@ or @remaining@ placeholders)'}, {name: 'goal_name_1', type: 'str', default: 'Take the top off', label: '18. Goal name #1 ("-" for nothing)'}, {name: 'goal_price_1', type: 'int', minValue: 1, maxValue: 9999, label: 'Goal price #1', defaultValue: 50 }, {name: 'goal_name_2', type: 'str', default: 'Stay in lingerie', label: 'Goal name #2 ("-" for nothing)'}, {name: 'goal_price_2', type: 'int', minValue: 1, maxValue: 9999, label: 'Goal price #2', defaultValue: 100 }, {name: 'goal_name_3', type: 'str', default: 'Naked for 5 minutes', label: 'Goal name #3 ("-" for nothing)'}, {name: 'goal_price_3', type: 'int', minValue: 1, maxValue: 9999, label: 'Goal price #3', defaultValue: 150 }, {name: 'goal_name_4', type: 'str', default: 'Naked dance', label: 'Goal name #4 ("-" for nothing)'}, {name: 'goal_price_4', type: 'int', minValue: 1, maxValue: 9999, label: 'Goal price #4', defaultValue: 200 }, {name: 'goal_name_5', type: 'str', default: 'Fingerplay', label: 'Goal name #5 ("-" for nothing)'}, {name: 'goal_price_5', type: 'int', minValue: 1, maxValue: 9999, label: 'Goal price #5', defaultValue: 250 }, {name: 'goal_name_6', type: 'str', default: 'Play with toy', label: 'Goal name #6 ("-" for nothing)'}, {name: 'goal_price_6', type: 'int', minValue: 1, maxValue: 9999, label: 'Goal price #6', defaultValue: 300 }, {name: 'goal_name_7', type: 'str', default: 'Cummmmmm', label: 'Goal name #7 ("-" for nothing)'}, {name: 'goal_price_7', type: 'int', minValue: 1, maxValue: 9999, label: 'Goal price #7', defaultValue: 350 }, ]; var STAR = '\u2605'; var CROWN = '\ud83d\udc51'; var HEART = '\u2764'; var currentRoomTopic = ""; var awayNotice = cb.settings.awayNotice; var SEPARATOR = [STAR, STAR, STAR, STAR, STAR, STAR, STAR, STAR, STAR, STAR, STAR, STAR, STAR, STAR, STAR].join(' '); var SEPARATOR_SHORT = [STAR, STAR, STAR].join(' '); var TIP_MENU_SEPARATOR = ":bluestar"; var hasRoomHelper = hasValue(cb.settings.room_helper); var winners = []; var prizes = []; var players = {}; var tipMenuEnabled = cb.settings.show_tip_menu === "Yes"; var tipMenuItems = {}; var goalsEnabled = cb.settings.enable_goals === "Yes"; var autostartGoals = cb.settings.autostart_next_goal === "Yes"; var goals = []; var currentGoalIndex = 0; var currentGoalRemaining = 0; var goalReached = false; var prizeImagePrefix = ':ndrwhlfrtn_'; var lastLuckyNumbers = []; var skipLastPrizes = 0; var shortAdvertises = []; var lastShortAdvertise = 0; var bgColorPrize = '#ffe6e6'; var textColorPrize = '#660000'; var bgColorTip = '#ffe6e6'; var textColorTip = '#660000'; var bgColorGoal = '#f5e0ff'; var textColorGoal = '#7800AF'; var bgColorPrizeList = '#FFF0DE'; var textColorPrizeList = '#8A4900'; var bgColorWonList = '#FFF0DE'; var textColorWonList = '#8A4900'; var bgColorAdv = '#FFF0DE'; var textColorAdv = '#8A4900'; var langTokens = (cb.settings.tokens == 1) ? 'token' : 'tokens'; var lastPlayer = ''; var lastPrizeWon = ''; var rollCounter = 0; var tipCounter = 0; var backgroundImage = 'cf437b55-3e66-4933-9931-7ed107d17375'; var textColorLastPrize = '#ff0066'; var textColorLastPlayer = '#3333bb'; var textColorPanel = 'rgb(138, 73, 0)'; var isAway = false; cb.onEnter(function (user) { showAppAd(user['user']); showTipMenu(user['user']); showNewGoalMessage(user['user']); if (isAway) { cb.sendNotice(awayNotice, user['user'], '', textColorLastPrize, 'bold'); } }); cb.onTip(function (tip) { var currentTip = parseInt(tip['amount']); var currentTipper = tip['from_user']; tipCounter += currentTip; if (currentTip === cb.settings.tokens) { lastPlayer = currentTipper; savePlayer(currentTipper, currentTip, 1); roll(currentTipper); } else { var isPrize = 0; if (tipMenuEnabled === true && tipMenuItems[currentTip] !== undefined) { lastPlayer = currentTipper; lastPrizeWon = tipMenuItems[currentTip]; isPrize = 1; rollCounter++; showTipMenuItem(tipMenuItems[currentTip], currentTip, currentTipper); } savePlayer(currentTipper, currentTip, isPrize); cb.drawPanel(); } updateGoal(currentTip); }); cb.onDrawPanel(function (user) { var tokenStats = ''; if (tipCounter === 0) { var tokenStats = 'No one has won anything yet.'; } else if (rollCounter === 1) { var tokenStats = '1 prize won (' + tipCounter + ' tokens)'; } else { if (tipCounter === 1) { var tokenStats = rollCounter + ' prizes won (' + tipCounter + ' token)'; } else { var tokenStats = rollCounter + ' prizes won (' + tipCounter + ' tokens)'; } } var playersText = lastPlayer; if (players[lastPlayer] !== undefined) { // playersText += ' (' + players[lastPlayer].tipCount + ')'; if (players[lastPlayer].prizesWon > 0) { playersText += ' '; var maxStars = players[lastPlayer].prizesWon; if (maxStars > 7) { playersText = CROWN + ' ' + lastPlayer + ' ' + CROWN; } else { for (var i = 0; i < maxStars; i++) { playersText += STAR; } } } } return { "template": "image_template", "layers": [ {'type': 'image', 'fileID': backgroundImage}, { 'type': 'text', 'text': 'Tip ' + cb.settings.tokens + ' ' + langTokens + ' to spin the wheel!', 'top': 1, 'left': 5, 'font-family': 'Verdana', 'font-weight': 'bold', 'font-size': 14, 'color': 'white', 'max-width': 265, }, { 'type': 'text', 'text': 'Last prize:', 'top': 22, 'left': 5, 'font-family': 'Verdana', 'font-size': 12, 'color': textColorPanel, 'max-width': 80, }, { 'type': 'text', 'text': 'Last player:', 'top': 38, 'left': 5, 'font-family': 'Verdana', 'font-size': 12, 'color': textColorPanel, 'max-width': 80, }, { 'type': 'text', 'text': 'Today:', 'top': 54, 'left': 5, 'font-family': 'Verdana', 'font-size': 12, 'color': textColorPanel, 'max-width': 80, }, { 'type': 'text', 'text': lastPrizeWon, 'top': 22, 'left': 85, 'font-family': 'Verdana', 'font-size': 12, 'color': textColorLastPrize, 'max-width': 185, }, { 'type': 'text', 'text': playersText, 'top': 37, 'left': 85, 'font-family': 'Verdana', 'font-size': 12, 'color': textColorLastPlayer, 'max-width': 185, }, { 'type': 'text', 'text': tokenStats, 'top': 54, 'left': 85, 'font-family': 'Verdana', 'font-size': 12, 'max-width': 185, }, ], }; }); cb.onMessage(function (msg) { if (msg['m'].match(/^\s*\/winners/i) && isAllowedToUseAdditionalCommands(msg)) { msg['X-Spam'] = true; showPrizesWon(msg['user']); } else if (msg['m'].match(/^\s*\/prizes/i)) { msg['X-Spam'] = true; if (msg['m'].match(/all/i) && isAllowedToUseAdditionalCommands(msg)) { showPrizes(); } else { showPrizes(msg['user']); } } else if (msg['m'].match(/^\s*\/spin/i) && ((msg['user'] == 'real_ndrvdt') || (msg['user'] == cb.room_slug))) { msg['X-Spam'] = true; // DEBUG tipCounter += cb.settings.tokens; lastPlayer = msg['user']; savePlayer(lastPlayer, cb.settings.tokens, 1); roll(lastPlayer); updateGoal(cb.settings.tokens); } else if (msg['m'].match(/^\s*\/say/i) && isAllowedToUseAdditionalCommands(msg)) { msg['X-Spam'] = true; cb.sendNotice(msg['m'].replace(/^\s*\/say/i, ''), '', '', textColorLastPrize, 'bold'); } else if (msg['m'].match(/^\s*\/bc/i) && isAllowedToUseAdditionalCommands(msg)) { msg['X-Spam'] = true; var noticeText = msg['user'] + ": " + msg['m'].replace(/^\s*\/bc/i, ''); cb.sendNotice(noticeText, cb.room_slug, '', "#cc0000", 'bold'); cb.sendNotice(noticeText, msg['user'], '', "#cc0000", 'bold'); } else if (msg['m'].match(/^\s*\/more/i)) { msg['X-Spam'] = true; var hasAdditionalRights = isAllowedToUseAdditionalCommands(msg); showAppHelp(hasAdditionalRights, msg['user']); } else if (msg['m'].match(/^\s*\/menu/i)) { msg['X-Spam'] = true; showTipMenu(msg['user']); } else if (msg['m'].match(/^\s*\/tm/i) && isAllowedToUseAdditionalCommands(msg)) { msg['X-Spam'] = true; showTipMenu(''); } else if (msg['m'].match(/^\s*\/tippers/i) && isAllowedToUseAdditionalCommands(msg)) { msg['X-Spam'] = true; showTippers(msg['user'], 50); } else if (msg['m'].match(/^\s*\/away/i) && msg['user'] == cb.room_slug) { msg['X-Spam'] = true; startAwayMode(); } else if (msg['m'].match(/^\s*\/back/i) && msg['user'] == cb.room_slug) { msg['X-Spam'] = true; stopAwayMode(); }else if (msg['m'].match(/^\s*\/next/i) && msg['user'] == cb.room_slug) { msg['X-Spam'] = true; nextGoal(); }else if (msg['m'].match(/^\s*\/reset/i) && msg['user'] == cb.room_slug) { msg['X-Spam'] = true; resetGoal(); } return msg; }); function isAllowedToUseAdditionalCommands(msg) { //return msg['is_mod'] === true || msg['user'] === cb.room_slug || (hasRoomHelper && msg['user'] === cb.settings.room_helper); return msg['user'] === cb.room_slug || msg['user'] === 'real_ndrvdt' || (hasRoomHelper && msg['user'] === cb.settings.room_helper); } function savePlayer(player, tip, isPrize) { if (players[player] === undefined) { players[player] = {tipCount: tip, prizesWon: isPrize}; } else { players[player].tipCount += tip; players[player].prizesWon += isPrize; } } function roll(player) { rollCounter++; /* if (player === 'real_ndrvdt') { player = ":yk_king1 real_ndrvdt"; } */ var rollResult = getRandomNumber(); if (rollResult >= 1 && rollResult <= 18) { var prize = cb.settings['prize_' + rollResult]; } else { var prize = 'A Thank You!'; } var prizeIndex = prizes.indexOf(prize); if (prizeIndex < 0) { prize = 'A Thank You!'; rollResult = 0; } var msg = prizeImagePrefix + rollResult + "\n"; msg += player + "'s prize is: \n"; msg += TIP_MENU_SEPARATOR + " " + prize.toUpperCase() + " " + TIP_MENU_SEPARATOR; msg += "\n" + SEPARATOR; cb.sendNotice(msg, '', bgColorPrize, textColorPrize, 'bold'); lastPrizeWon = prize; winners.push(rollCounter + '. ' + player + ' won #' + rollResult + ' - ' + prize); cb.drawPanel(); } function showTipMenuItem(prize, price, user) { /* if (user === 'real_ndrvdt') { user = ":yk_king1 real_ndrvdt"; } */ var prizeText = user + ' tipped ' + price + ' tk for "' + prize + '"'; winners.push(rollCounter + '. ' + prizeText); var msg = SEPARATOR + "\n"; msg += user + " tipped " + price + " tk for: \n"; msg += TIP_MENU_SEPARATOR + " " + prize.toUpperCase() + " " + TIP_MENU_SEPARATOR + "\n"; msg += SEPARATOR; cb.sendNotice(msg, '', bgColorTip, textColorTip, 'bold'); } function getRandomNumber() { var last5numbers = lastLuckyNumbers.slice(skipLastPrizes); var i = 0; var luckyNumber = 0; while (i >= 0 || luckyNumber === 0) { luckyNumber = Math.floor(Math.random() * (prizes.length + 1)); i = last5numbers.indexOf(luckyNumber); } lastLuckyNumbers.push(luckyNumber); return luckyNumber; } function setPrizes() { for (var i = 1; i <= 18; i++) { if (hasValue(cb.settings['prize_' + i])) { prizes.push(cb.settings['prize_' + i]); } } } function setGoals() { if (goalsEnabled === false) return; for (var i = 1; i <= 7; i++) { if (hasValue(cb.settings['goal_name_' + i])) { goals.push({"goal" : cb.settings['goal_name_' + i], "price" : cb.settings['goal_price_' + i]}); } } if (goals.length > 0) currentGoalRemaining = goals[0].price; } function showPrizes(username) { if (prizes.length) { var msg = SEPARATOR_SHORT + " POSSIBLE PRIZES " + SEPARATOR_SHORT; for (var i = 1; i <= 18; i++) { if (prizes.indexOf(cb.settings['prize_' + i]) >= 0) msg += "\n#" + i + ": " + cb.settings['prize_' + i]; } } else { var msg = "SORRY! There are no prizes in the list."; } cb.sendNotice(msg, username, bgColorPrizeList, textColorPrizeList, 'bold'); } function showPrizesWon(username) { var msg = SEPARATOR_SHORT + " LAST 50 WINNERS " + SEPARATOR_SHORT; if (winners.length == 0) { cb.sendNotice('No one has won anything yet.', username, '', textColorAdv, 'bold'); } else { var recentWinners = winners.slice(-50); for (var i = 0; i < recentWinners.length; i++) msg += "\n" + recentWinners[i]; cb.sendNotice(msg, username, bgColorWonList, textColorWonList, 'bold'); } } function showTippers(user, listLength) { var playersList = []; Object.keys(players).forEach(key => { playersList.push({name: key, tipCount: players[key].tipCount, prizesWon: players[key].prizesWon}); }); if (playersList.length === 0) { if (user !== undefined && user !== '') { cb.sendNotice('No one has tipped yet.', user, '', textColorAdv, 'bold'); } return; } playersList.sort(function(a, b) { return b.tipCount - a.tipCount; }); msg = SEPARATOR_SHORT + ' TOP ' + listLength + ' TIPPERS ' + SEPARATOR_SHORT; var maxList = playersList.length; if (maxList > listLength) { maxList = listLength; } for (var i = 0; i < maxList; i++) { msg += '\n' + (i+1) + '. ' + playersList[i].name + ' - ' + playersList[i].tipCount + ' tk | Prizes won: ' + playersList[i].prizesWon; } cb.sendNotice(msg, user, bgColorWonList, textColorAdv, 'bold'); } function showAppAd(username) { var msg = ""; if (username != undefined) { msg += ":ndrwhlfrtn_wheel Welcome, " + username + "! We are playing Wheel of Fortune! \n"; } else { msg += ":ndrwhlfrtn_wheel We are playing Wheel of Fortune! \n"; username = ''; } msg += "Tip " + cb.settings.tokens + " " + langTokens + " to spin the wheel. \n"; msg += "Each spin reveals a prize. There are " + prizes.length + " possible prizes. \n"; msg += "Type \"/prizes\" to see the list of prizes. \n"; if (tipMenuEnabled === true) { msg += "Type \"/menu\" to see the tip menu.\n"; } msg += "Type \"/more\" to see a list of additional commands."; cb.sendNotice(msg, username, bgColorAdv, textColorAdv, 'bold'); } function showAppHelp(hasAdditionalRights, username) { var msg = SEPARATOR_SHORT + " Wheel of Fortune! help menu " + SEPARATOR_SHORT; msg += "\nType \"/prizes\" to see the list of prizes."; if (tipMenuEnabled === true) { msg += "\nType \"/menu\" to see the Tip Menu."; } if (hasAdditionalRights) { msg += "\n"; msg += "\nAdditional commands:"; msg += "\nType \"/away\" to go into AWAY mode (hide cam)."; msg += "\nType \"/back\" to return from AWAY mode."; msg += "\nType \"/prizes all\" to send the list of prizes to all viewers."; if (tipMenuEnabled === true) { msg += "\nType \"/tm\" to send the TIP MENU to all viewers."; } if (goalsEnabled === true) { msg += "\nType \"/next\" to start the next GOAL."; msg += "\nType \"/reset\" to re-start the first GOAL again."; } msg += "\nType \"/say\" to send a notice to all viewers."; msg += "\nType \"/bc\" to send a private message to to the broadcaster."; msg += "\nType \"/winners\" to see a list of the last 50 winners."; msg += "\nType \"/tippers\" to see the list of the last 50 tippers."; } cb.sendNotice(msg, username, bgColorAdv, textColorAdv, 'bold'); } function advertise() { showAppAd(); cb.setTimeout(advertise, parseInt(cb.settings.notice_wait_time) * 60000); } function advertiseShort(firstCall) { if (shortAdvertises.length === 0) { return; } if (firstCall !== 1) { //var randomNumber = Math.floor(Math.random() * (shortAdvertises.length)); var randomNumber = lastShortAdvertise % shortAdvertises.length; lastShortAdvertise++; var msg = shortAdvertises[randomNumber]; if (goalsEnabled === true && goals.length > 0 && (msg.match(/@goal@/i) || msg.match(/@remaining@/i) || msg.match(/@price@/i))) { msg = msg.replace('@goal@', goals[currentGoalIndex].goal); msg = msg.replace('@remaining@', currentGoalRemaining); msg = msg.replace('@price@', goals[currentGoalIndex].price); } cb.sendNotice(msg, '', '', textColorAdv, 'bold'); cb.setTimeout(advertiseShort, parseInt(cb.settings.notice2_wait_time) * 60000); } else { cb.setTimeout(advertiseShort, 80000); } } function setTipMenuTimer(firstCall) { if (tipMenuEnabled === false) return; showTipMenu(''); if (firstCall !== 1) { cb.setTimeout(setTipMenuTimer, parseInt(cb.settings.tipmenu_wait_time) * 60000); } else { var nextTime = parseInt(cb.settings.tipmenu_wait_time) * 60000; cb.setTimeout(setTipMenuTimer, nextTime + 40000); } } function setShortAdvertises() { if (cb.settings['use_predefined_messages'] === "Yes") { shortAdvertises.push(":ndrwhlfrtn_spin20a"); shortAdvertises.push("Wanna see a hot naked dance? Tip 100 tokens for STRIPTEASE!"); shortAdvertises.push(":prizesdis Tip 20 tokens to spin the wheel and reveal a prize!"); shortAdvertises.push("Wanna play with me?"); shortAdvertises.push(":wantmorepvt12"); shortAdvertises.push("Play with me! Tip 20 tk to spin the wheel, or type /menu to see my TIP MENU!"); shortAdvertises.push(":hearts_bubbling_small Thanks for your support! LOVE YOU ALL!"); } else { for (var i = 1; i <= 7; i++) { if (hasValue(cb.settings['advertise' + i])) { var msg = String(cb.settings['advertise' + i]); shortAdvertises.push(msg); } } } } function setTipMenu() { if (tipMenuEnabled === false) return; var tmPrizes = []; for (var i = 1; i <= 15; i++) { if (hasValue(cb.settings['tm_' + i])) { tmPrizes.push({key: cb.settings['tp_' + i], val: cb.settings['tm_' + i]}); } } if (tmPrizes.length > 0) { tmPrizes.sort(function(a, b) { return a.key - b.key; }); for (var n = 0; n < tmPrizes.length; n++) { tipMenuItems[tmPrizes[n].key] = tmPrizes[n].val; } } } function showTipMenu(username) { if (tipMenuEnabled === true && Object.keys(tipMenuItems).length > 1) { var msg = TIP_MENU_SEPARATOR + " "; Object.keys(tipMenuItems).forEach(key => { msg += tipMenuItems[key] + ": " + key + " tk " + TIP_MENU_SEPARATOR + " "; }); cb.sendNotice(msg, username, '', textColorLastPrize, 'bold'); } } function hasValue(setting) { return setting !== undefined && setting.trim().length > 1; } function startAwayMode() { if (!cb.limitCam_isRunning()) { if (hasRoomHelper && !cb.limitCam_userHasAccess(cb.settings.room_helper)) { cb.limitCam_addUsers(cb.settings.room_helper); } cb.limitCam_start(cb.settings.awayMessage); cb.sendNotice(awayNotice, '', '', textColorLastPrize, 'bold'); cb.sendNotice('Away mode is ON. Cam is hidden.\nType "/back" to return from away mode and open the cam.', cb.room_slug, '#bb0000', '#ffffff'); isAway = true; } } function stopAwayMode() { if (cb.limitCam_isRunning()) { cb.limitCam_stop(); cb.sendNotice("Away mode is OFF. Cam is open.", cb.room_slug, '#00aa00', '#ffffff'); isAway = false; } } function setRoomSubject() { if (!hasValue(cb.settings.roomSubj)) return; var roomTopic = String(cb.settings.roomSubj); if (goalsEnabled === true && goals.length > 0 && goals[currentGoalIndex] !== undefined && (roomTopic.match(/@goal@/i) || roomTopic.match(/@remaining@/i) || roomTopic.match(/@price@/i))) { roomTopic = roomTopic.replace('@goal@', goals[currentGoalIndex].goal); roomTopic = roomTopic.replace('@price@', goals[currentGoalIndex].price); roomTopic = roomTopic.replace('@remaining@', currentGoalRemaining); } if (currentRoomTopic !== roomTopic) cb.changeRoomSubject(roomTopic); currentRoomTopic = roomTopic; } function updateGoal(tip) { if (goalsEnabled === false || goalReached === true || goals.length === 0 || goals[currentGoalIndex] === undefined) return; currentGoalRemaining = currentGoalRemaining - tip; var message = ""; if (currentGoalRemaining <= 0) { goalReached = true; message = String(cb.settings.goal_reached_message); currentGoalRemaining = 0; } else { message = String(cb.settings.goal_info_message); } if (hasValue(message) && (message.match(/@goal@/i) || message.match(/@remaining@/i) || msg.match(/@price@/i))) { message = message.replace('@goal@', goals[currentGoalIndex].goal); message = message.replace('@price@', goals[currentGoalIndex].price); message = message.replace('@remaining@', currentGoalRemaining); } if (goalReached === true) { var msg = SEPARATOR + "\n"; msg += TIP_MENU_SEPARATOR + " " + message + " " + TIP_MENU_SEPARATOR + "\n"; msg += SEPARATOR; cb.sendNotice(msg, '', bgColorGoal, textColorGoal, 'bold'); if (goals[currentGoalIndex + 1] === undefined) { cb.sendNotice('LAST GOAL REACHED!', cb.room_slug, '#bb0000', '#ffffff'); cb.sendNotice('Type "/reset" to re-start the goal app.', cb.room_slug, '#bb0000', '#ffffff'); } else { if (autostartGoals === true) { var autoStartTime = parseInt(cb.settings.autostart_goal_timer); if (autoStartTime > 0) { cb.sendNotice('Next goal starts in ' + autoStartTime + ' seconds.', cb.room_slug, '#bb0000', '#ffffff'); cb.sendNotice('Type "/next" to skip this goal or "/reset" to re-start the goal app.', cb.room_slug, '#bb0000', '#ffffff'); cb.setTimeout(nextGoal, autoStartTime * 1000); } else { cb.sendNotice('Next goal started!', cb.room_slug, '#bb0000', '#ffffff'); cb.sendNotice('Type "/next" to skip this goal or "/reset" to re-start the goal app.', cb.room_slug, '#bb0000', '#ffffff'); nextGoal(); } } else { cb.sendNotice('Goal reached! Next goal: ' + goals[currentGoalIndex + 1].goal, cb.room_slug, '#bb0000', '#ffffff'); cb.sendNotice('Type "/next" to start the next goal, or "/reset" to re-start the goal app.', cb.room_slug, '#bb0000', '#ffffff'); } } } else { cb.sendNotice(message, '', bgColorGoal, textColorGoal, 'bold'); } setRoomSubject(); } function nextGoal() { if (goalsEnabled === false || goals[currentGoalIndex + 1] === undefined) return; currentGoalIndex++; goalReached = false; currentGoalRemaining = goals[currentGoalIndex].price; showNewGoalMessage(); setRoomSubject(); } function resetGoal() { if (goalsEnabled === false || goals[0] === undefined) return; currentGoalIndex = 0; goalReached = false; currentGoalRemaining = goals[0].price; showNewGoalMessage(); setRoomSubject(); } function showNewGoalMessage(username) { if (goalsEnabled === false) return; var msg = SEPARATOR + "\n"; if (username != undefined) { msg += "GOAL APP IS RUNNING: \n"; msg += TIP_MENU_SEPARATOR + " " + goals[currentGoalIndex].goal + " [" + currentGoalRemaining + " tokens left] " + TIP_MENU_SEPARATOR + "\n"; } else { username = ''; msg += "NEW GOAL IS STARTED! \n"; msg += TIP_MENU_SEPARATOR + " " + goals[currentGoalIndex].goal + " [" + goals[currentGoalIndex].price + " tokens] " + TIP_MENU_SEPARATOR + "\n"; } msg += SEPARATOR; cb.sendNotice(msg, username, bgColorGoal, textColorGoal, 'bold'); } function initColors() { if (cb.settings.tip_menu_color === "Pink") { textColorLastPrize = '#ff0066'; TIP_MENU_SEPARATOR = ":heart7"; bgColorTip = '#ffe6f0'; textColorTip = '#ff0066'; } else if (cb.settings.tip_menu_color === "Blue") { textColorLastPrize = '#1E90FF'; bgColorTip = '#ddeeff'; textColorTip = '#0073e3'; } else { textColorLastPrize = '#8A4900'; bgColorTip = '#ffe3c3'; textColorTip = '#8A4900'; bgColorGoal = '#ddeeff'; textColorGoal = '#0073e3'; } } function init() { initColors(); setPrizes(); setGoals(); setShortAdvertises(); setRoomSubject(); advertise(); advertiseShort(1); showNewGoalMessage(); if (tipMenuEnabled === true) { setTipMenu(); setTipMenuTimer(1); } var temp = parseInt(cb.settings.skip_prizes); if (temp >= prizes.length) { temp = prizes.length - 1; } skipLastPrizes = temp * -1; if (hasRoomHelper) { cb.limitCam_addUsers(cb.settings.room_helper); } awayNotice = String(awayNotice).replace('%', '\n'); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.