Apps Home
|
Create an App
Playing Nounou
Author:
ptitoinou28260
Description
Source Code
Launch App
Current Users
Created by:
Ptitoinou28260
var YES = "Yes"; var SECOND_FACTOR = 1000; var MINUTE_FACTOR = 60 * SECOND_FACTOR; var TIP_MENU_SIZE = 25; var TIP_MENU_FIELDS = []; for (var i = 0; i < TIP_MENU_SIZE; i++) { var INDEX = i + 1; TIP_MENU_FIELDS.push({ name: "tipMenuChoice" + INDEX, type: "str", defaultValue: "", label: "Tip menu choice " + INDEX, required: false }, { name: "tipMenuChoice" + INDEX + "Amount", type: "int", defaultValue: null, minValue: 1, label: "Tip menu choice " + INDEX + " token amount", required: false }); } cb.settings_choices = [ { name: "roomSubject", type: "str", defaultValue: "Enjoy good time in " + cb.room_slug + "'s room.", label: "The room subject", required: true }, { name: "welcomeMessage", type: "str", defaultValue: "Welcome $name, have a good time here.", label: "The welcome message ($name to insert user name)", required: true }, { name: "notificationMessage", type: "str", defaultValue: "Please, if you like, tip ;)", label: "The notification message", required: true }, { name: "notificationRepeat", type: "int", defaultValue: 1, minValue: 1, maxValue: 15, label: "The notification repeat delay (in minutes)", required: true }, { name: "specialLottery", type: "choice", defaultValue: YES, choice1: YES, choice2: "No", label: "Set a special lottery", required: true }, { name: "specialLotteryWin", type: "str", defaultValue: "3 minutes lovense control", label: "The special lottery win", required: true }, { name: "specialLotteryAmount", type: "int", defaultValue: 1, minValue: 1, label: "The special lottery ticket price", required: true }, { name: "specialLotteryIfMore", type: "choice", defaultValue: YES, choice1: YES, choice2: "No", label: "Add Tipper to special lottery when tip bigger than needed", required: true }, { name: "specialLotteryCountdown", type: "int", defaultValue: 1, minValue: 1, maxValue: 180, label: "The special lottery countdown (in minutes)", required: true }, { name: "specialLotteryTokens", type: "int", defaultValue: 1000, minValue: 1, maxValue: 10000, label: "The special lottery tokens countdown", required: true }, { name: "displayTipMenu", type: "choice", defaultValue: YES, choice1: YES, choice2: "No", label: "Display the tip menu", required: true }, { name: "displayTipMenuBuy", type: "choice", defaultValue: YES, choice1: YES, choice2: "No", label: "Display user buy for tip menu", required: true } ].concat(TIP_MENU_FIELDS); var roomSubject = cb.settings.roomSubject; var welcomeMessage = cb.settings.welcomeMessage; var notificationMessage = cb.settings.notificationMessage; var notificationRepeat = cb.settings.notificationRepeat * MINUTE_FACTOR; var specialLottery = (cb.settings.specialLottery === YES); var specialLotteryWin = cb.settings.specialLotteryWin; var specialLotteryAmount = cb.settings.specialLotteryAmount; var specialLotteryIfMore = (cb.settings.specialLotteryIfMore === YES); var specialLotteryCountdown = cb.settings.specialLotteryCountdown * MINUTE_FACTOR; var specialLotteryTokens = cb.settings.specialLotteryTokens; var tipMenu = []; for (var i = 0; i < TIP_MENU_SIZE; i++) { var INDEX = i + 1; if (cb.settings["tipMenuChoice" + INDEX] && cb.settings["tipMenuChoice" + INDEX + "Amount"]) { tipMenu.push({ amount: cb.settings["tipMenuChoice" + INDEX + "Amount"], for: cb.settings["tipMenuChoice" + INDEX] }); } } var displayTipMenu = (cb.settings.displayTipMenu === YES); var displayTipMenuBuy = (cb.settings.displayTipMenuBuy === YES); var specialLotteryTokensCollected = null; var specialLotteryElapsedTime = null; var specialLotteryToStart = false; var specialLotteryStarted = false; var specialLotteryPlayers = null; var notify = function () { if (specialLotteryToStart) { specialLotteryStart(); } cb.sendNotice("" + notificationMessage + getSpecialLotteryNotice() + getTipMenu(), null, null, "#003bff", "bolder"); cb.setTimeout(notify, notificationRepeat); }; var getTipMenu = function () { if (displayTipMenu && tipMenu.length) { return "\n Tip menu : " + tipMenu.map(function (entrie) { return entrie.for + " (" + entrie.amount + ")"; }).join(" | "); } return ""; }; var getSpecialLotteryNotice = function () { specialLotteryElapsedTime += notificationRepeat; if (specialLotteryStarted && (specialLotteryElapsedTime >= specialLotteryCountdown || specialLotteryTokensCollected >= specialLotteryTokens)) { specialLotteryStarted = false; if (specialLotteryPlayers.length > 0) { return "\n Lottery end, " + specialLotteryPlayers[Math.floor(Math.random() * specialLotteryPlayers.length)] + " won : " + specialLotteryWin + "\n Thank you all for your tips"; } } if (specialLotteryStarted) { var endCountdown = (specialLotteryCountdown - specialLotteryElapsedTime) / MINUTE_FACTOR; var endToken = specialLotteryTokens - specialLotteryTokensCollected; return "\n Special lottery : " + specialLotteryWin + ", tip " + specialLotteryAmount + (specialLotteryIfMore ? " or more " : " ") + " to get a ticket\n Winner will be drawn after " + endCountdown + " minute" + (endCountdown > 1 ? "s" : "") + " or after " + endToken + " token" + (endToken > 1 ? "s" : ""); } return ""; }; var specialLotteryStart = function () { if (specialLottery) { specialLotteryTokensCollected = 0; specialLotteryElapsedTime = -notificationRepeat; specialLotteryStarted = true; specialLotteryToStart = false; specialLotteryPlayers = []; cb.sendNotice("Special lottery : " + specialLotteryWin + ", will start soon", null, null, "#5fbb5e", "bolder"); } }; var ownerHelp = function () { cb.sendNotice("Owner help menu :\n /subject [subject] : change the room subject\n /newLottery : start a new special lottery : " + specialLotteryWin, cb.room_slug, null, "#5fbb5e", "bolder"); }; var newLottery = function (message) { if (message.m === "/newLottery" && message.user === cb.room_slug) { specialLotteryStart(); return true; } return false; }; var help = function (message) { if (message.m === "/help" && message.user === cb.room_slug) { ownerHelp(); return true; } return false; }; var changeSubject = function (message) { if (/^\/subject .+/.test(message.m)) { cb.changeRoomSubject(message.m.replace("/subject ", "")); return true; } return false; }; var commands = [ help, changeSubject, newLottery ]; cb.onMessage(function (message) { for (var _i = 0, commands_1 = commands; _i < commands_1.length; _i++) { var command = commands_1[_i]; if (command(message)) { message.m = ""; } } return message; }); cb.onTip(function (tip) { if (displayTipMenuBuy) { var subject = tipMenu.filter(function (entrie) { return entrie.amount === tip.amount; })[0]; cb.sendNotice(tip.from_user + " tipped for " + subject.for, null, "#5fbb5e", "#ffffff", "bolder"); } if (specialLotteryStarted && specialLottery && (tip.amount === specialLotteryAmount && (specialLotteryIfMore && tip.amount >= specialLotteryAmount)) && specialLotteryPlayers.indexOf(tip.from_user) === -1) { specialLotteryPlayers.push(tip.from_user); cb.sendNotice(tip.from_user + " is now in lottery for " + tip.amount + " token" + (tip.amount > 1 ? "s" : ""), null, "#5fbb5e", "#ffffff", "bolder"); specialLotteryTokensCollected += tip.amount; } }); cb.onEnter(function (user) { if (user.user !== cb.room_slug) { cb.sendNotice(welcomeMessage.replace("$name", user.user), user.user, null, "#ff5ecf", "bolder"); } }); cb.changeRoomSubject(roomSubject); notify();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.