Apps Home
|
Create an App
ticket show test 2022
Author:
isleofkaya
Description
Source Code
Launch App
Current Users
Created by:
Isleofkaya
/** **/ // prototype functions { String.prototype.capitalize = function() { return this.charAt(0).toUpperCase() + this.slice(1); } String.prototype.repeat = function (number) { return new Array(number + 1).join(this); } String.prototype.equals = function (str) { var m = new RegExp(str); return this.match(m) != null; } String.prototype.equalsIgnoreCase = function (str) { var m = new RegExp(str, 'i'); return this.match(m) != null; } } { var dummycounter = ['0', '1' ]; var backgroundArray = { menu: ['White', 'Other' ], command: ['white', 'other' ], devfile: ['add', 'add' ], livefile: ['4c8fb244-1180-400e-ad93-2bf0a9c6f0d4', 'c747fb86-4264-41e9-9847-4503b18da8e7' ] }; var fontSize = 12; var customPanel = false; } {cb.settings_choices = [ {name: 'intro', label: 'See the full list of commands with /tickethelp', type: 'choice',required: false}, {name: 'ticketShowPrice', label: 'Ticket show price', type: 'int',minValue: 1,maxValue: 99999,defaultValue: 50}, {name: 'ticketRoomSubjectSfx', label: 'Ticket show title', type:'str', minLength: 1,maxLength: 200, required: false, defaultValue: ' '}, {name: 'ticketRoomSubjectSfxb', label: 'Room subject after ticket show', type:'str', minLength: 1,maxLength: 200, required: false, defaultValue: ' '}, {name: 'ticketShowAfterNotice', label: 'Text to display after ticket show in subject and 1st line of panel', type:'str',minLength: 1,maxLength: 100,required: false,defaultValue: ' '}, {name: 'ticketShowAfterNoticeb', label: 'Text to display after ticket show in 2nd line of panel', type:'str',minLength: 1,maxLength: 100,required: false,defaultValue: ' '}, {name: 'ticketShowAfterNoticec', label: 'Text to display after ticket show in 3rd line of panel', type:'str',minLength: 1,maxLength: 100,required: false,defaultValue: ' '}, {name: 'ticketShowCumulative', label: 'Accumulate a users total show tips toward ticket price', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'ticketShowStartMode', label: 'Which mode determines when to start the show', type: 'choice', choice1: 'Start Show Anytime', choice2: 'Start Show after Timer', choice3: 'Start Show after Ticket Goal', choice4: 'Start Show after Token Goal', defaultValue: 'Start Show Anytime'}, {name: 'ticketShowStartAuto', label: 'Start the show manually with /startshow or automatically', type: 'choice', choice1: 'Start from Command', choice2: 'Automated Start', defaultValue: 'Start from Command'}, {name: 'ticketShowGoal', label: 'Goal amount for token/ticket sales before starting the show', type: 'int',minValue: 1,maxValue: 5000,defaultValue: 1000,required: false}, {name: 'ticketShowStartTimer', label: 'If automated, define number of minutes for countdown. Timer will start immediately upon starting broadcast, or when Hidden Ticket Show feature is turned on', type: 'int',minValue: 1,maxValue: 120,defaultValue: 15,required: false}, {name: 'ticketShowFanAppreciation', label: 'Free show that only users defined below can access', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No'}, {name: 'ticketShowFreeFC', label: 'Give a free ticket to CB Fanclub members', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'ticketShowFreeMods', label: 'Give a free ticket to moderators', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'ticketShowFreeEFC', label: 'Give a free ticket to External Fanclub members', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'ticketShowFreeVIP', label: 'Give a free ticket to VIP List members?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'ticketShowPriceFC', label: 'Discounted price for a ticket for CB Fan Club members', type: 'int',minValue: 0,maxValue: 99999,required: false}, {name: 'ticketShowPriceEFC', label: 'Discounted price for a ticket for External Fan Club members', type: 'int',minValue: 0,maxValue: 99999,required: false}, {name: 'ticketShowPriceVIP', label: 'Discounted price for a ticket for VIP List members', type: 'int',minValue: 0,maxValue: 99999,required: false}, {name: 'bctext', label: 'Custom name. Leave blank for default term "Broadcaster"', type: 'str',required: false, minLength: 1, maxLength: 50}, {name: 'extFanList', label: 'Names of External Fan Club members to grant special privileges, such as free or reduced prices to shows. Separate usernames with a comma with no spaces', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false}, {name: 'EFCname', label: 'Name of External Fan Club (optional)', type: 'str', minLength: 1, maxLength: 50, required: false}, {name: 'VIPList', label: 'Names of VIP List users to grant special privileges, such as free or reduced prices to shows. Separate usernames with a comma with no spaces', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false}, {name: 'VIPname', label: 'Name of the VIP List (optional)', type: 'str', minLength: 1, maxLength: 50, required: false}, {name: 'botModList', label: 'Names of users to grant botmod privileges', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false}, {name: 'allowModsAuthority', label: 'Allow mods to have authority to broadcaster commands', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'ticketShowModsAdd', label: 'Allow mods to use the "add" and "remove" commands?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'ticketShowModsChgPrice', label: 'Allow moderators to change the price of a ticket?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'ticketShowReducePriceWarn', label: 'Reduce ticket price by this amount when the /showwarn command is used to indicate the show is nearly over. Set to 0 to not use this feature', type: 'int',minValue: 0,maxValue: 99999,defaultValue: 0,required: false}, {name: 'ticketShowEnableOT', label: 'Enable Outstanding Ticket feature so users can save their ticket for use in a later show. Note that the broadcaster must still record the user names and enter them in the OTS list below. Can also be used for granting free tickets to viewers for a future show in place of a refund if there was a problem with a show, or user bought at the last second and missed the show', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No'}, {name: 'ticketShowOTList', label: 'If the Outstanding Ticket feature is enabled above, enter names of users to grant a ticket to a future show. User will be notified when they enter that they have a free ticket, and if they choose to use it, the broadcaster is notified so they can remove them from the list before next show. The format should be a comma separated list (user1,user2,user3)', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '', required: false}, {name: 'ticketShowAllowGift', label: 'Allow users to buy additional tickets to gift to other users', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No'}, {name: 'ticketShowPreviewLength',label: 'Length of preview for users joining the room',type: 'choice', choice1: 'No Preview', choice2: '10 seconds',choice3: '20 seconds', choice4: '30 seconds', choice5: '1 minute', choice6: '2 minutes', choice7: '3 minutes',choice8: '4 minutes',choice9: '5 minutes',defaultValue: 'No Preview'}, {name: 'ticketShowPreviewGrays', label: 'Allow users without tokens to view the free preview:', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No'}, {name: 'ticketshowEnableIcon', label: 'Show ticket icon by the users that have bought a ticket to the show', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'tipLeaderGif1', label: 'Icon for users who have purchased a ticket', type: 'str',defaultValue: ' ',required: false}, {name: 'ticketNoticeInterval',required: false,type: 'str',defaultValue: 1.2,label: 'Interval for price and tip menu notices'}, {name: 'ticketShowTextColor',label: 'Text color for chat notices',type: 'choice',choice1: 'White/No Color',choice2: 'Black',choice3: 'Dark Grey',choice4: 'Dark Red',choice5: 'Dark Orange',choice6: 'Dark Green',choice7: 'Dark Aqua',choice8: 'Dark Blue',choice9: 'Dark Purple',choice10: 'Dark Pink',choice11: 'Custom',defaultValue: ' '}, {name: 'ticketShowCustomTextColor', label: 'Custom text color hex code', type: 'str', minLength: 1, maxLength: 7, required: false}, {name: 'ticketShowBgColor',label: 'Background color for chat notices', type: 'choice', choice1: 'White/No Color',choice2: 'Light Yellow',choice3: 'Light Blue',choice4: 'Light Pink',choice5: 'Light Red',choice6: 'Light Green',choice7: 'Light Purple',choice8: 'Light Orange',choice9: 'Light Grey',choice10: 'Light Aqua',choice11: 'Custom',defaultValue: ' '}, {name: 'ticketShowCustomBgColor', label: 'Custom background text color hex code', type: 'str', minLength: 1, maxLength: 7, required: false}, {name: 'panelBackground', label: 'Panel to display', type: 'choice', choice1: 'Default', choice2: backgroundArray.menu[0], choice3: backgroundArray.menu[1], defaultValue: 'Default'}, {name: 'panelTextColor',label: 'Text color for the panel',type: 'choice',choice1: 'White/No Color',choice2: 'Black',choice3: 'Dark Grey',choice4: 'Dark Red',choice5: 'Dark Orange',choice6: 'Dark Green',choice7: 'Dark Aqua',choice8: 'Dark Blue',choice9: 'Dark Purple',choice10: 'Dark Pink',choice11: 'Dark Gold',choice12: 'Dark Teal',choice13: 'Dark Brown',choice14: 'Dark Bronze',choice15: 'Dark Periwinkle',choice16: 'Dark Fuschia',choice17: 'Dark Lime',choice18: 'Dark Plum',choice19: 'Custom',defaultValue: ' '}, {name: 'panelCustomTextColor', label: 'Custom text color hex code', type: 'str', minLength: 1, maxLength: 7, required: false}, {name: 'fembotRunning', label: 'Are you using Dorothys Fembot alongside this Ticket Show', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'No'} ]; } { // *********************************** Variables and Arrays ************************************** var initialize = 0; var BC = cb.room_slug; var ticketSubjectText = cb.settings.ticketRoomSubjectSfx; var ticketSubjectTextb = cb.settings.ticketRoomSubjectSfxb; var ticketPrice = cb.settings.ticketShowPrice; var ticketShowCumulative = cb.settings.ticketShowCumulative; var ticketShowStartMode = cb.settings.ticketShowStartMode; var ticketShowStartAuto = cb.settings.ticketShowStartAuto; var ticketShowGoal = cb.settings.ticketShowGoal; var ticketShowStartTimer = cb.settings.ticketShowStartTimer; var ticketShowFanAppreciation = cb.settings.ticketShowFanAppreciation; var ticketShowFreeFC = cb.settings.ticketShowFreeFC; var ticketShowFreeMods = cb.settings.ticketShowFreeMods; var ticketShowFreeEFC = cb.settings.ticketShowFreeEFC; var ticketShowFreeVIP = cb.settings.ticketShowFreeVIP; var ticketShowPriceFC = cb.settings.ticketShowPriceFC; var ticketShowPriceEFC = cb.settings.ticketShowPriceEFC; var ticketShowPriceVIP = cb.settings.ticketShowPriceVIP; var ticketShowModsAdd = cb.settings.ticketShowModsAdd; var ticketShowModsChgPrice = cb.settings.ticketShowModsChgPrice; var ticketShowAfterNotice = cb.settings.ticketShowAfterNotice; var ticketShowAfterNoticeb = cb.settings.ticketShowAfterNoticeb; var ticketShowAfterNoticec = cb.settings.ticketShowAfterNoticec; var ticketShowReducePriceWarn = cb.settings.ticketShowReducePriceWarn; var ticketShowEnableOT = cb.settings.ticketShowEnableOT; var tipLeaderGif1 = cb.settings.tipLeaderGif1; var ticketShowAllowGift = cb.settings.ticketShowAllowGift; var freePreviewLengthText = cb.settings.ticketShowPreviewLength; var ticketShowPreviewGrays = cb.settings.ticketShowPreviewGrays; var ticketNoticeInterval = cb.settings.ticketNoticeInterval; var ticketShowTextColor = cb.settings.ticketShowTextColor; var ticketShowCustomTextColor = cb.settings.ticketShowCustomTextColor; var ticketShowBgColor = cb.settings.ticketShowBgColor; var ticketShowCustomBgColor = cb.settings.ticketShowCustomBgColor; var panelBackground = cb.settings.panelBackground; var panelTextColor = cb.settings.panelTextColor; var panelCustomTextColor = cb.settings.panelCustomTextColor; var fembotRunning = cb.settings.fembotRunning; var allowModsAuthority = cb.settings.allowModsAuthority; var currentAppTotalTicket = 0; var ticketStartMode = ''; var ticketModeAuto = ''; var ticketShowTotalTips = 0; var ticketShowTotalTicketsBought = 0; var ticketStartTime = 0; var ticketStopTime = 0; var ticketTimeAdded = 0; var ticketMinsRemain = 0; var ticketSecsRemain = 0; var ticketShowOtToggle = 0; var newTicketMode = ''; var countTickets = 0; var countTicketsFromPreview = 0; var ticketShowEnded = false; var appNoticeColor = '#FFFFFF'; var black = '#000000'; var ticketHolderBgColor = '#FFFFFF' var freePreviewerBgColor = '#FFFFFF' var dashLine80 = new Array(80).join('-'); var dashLine60 = new Array(60).join('-'); var dashLine70 = new Array(70).join('-'); var dashLine90 = new Array(90).join('-'); var backgroundImage = ''; var textColor = 'panelTextColor'; var leftjust1 = 20; var leftjust2 = 20; var leftjust3 = 20; var topjust1 = 4; var topjust2 = 26; var topjust3 = 49; // Arrays */ var fanClubList = []; var VIPListArray = []; var VIPsInShow = []; var extFanListArray = []; var extFansInShow = []; var botModListArray = []; var modsInShow = []; var ticketShowViewerList = []; var ticketShowPreViewerList = []; var freePreviewUserArray = []; var freePreviewTimeArray = [0]; var ticketHolderList = []; var moderatorList = {name: [], type: []}; var ticketCumulative = {name: [], amount: []}; var outstandingTicketArray = []; var otChangesArray = {name: [], type: []}; var ticketShowExtraTickets = {name: [], count: []}; var drawpanel = {panel: {}}; } { // *********************************** Functions ************************************** { // Generic functions to set the color or separator characters function checkTextColor(color) { switch (color) { case 'White/No color': return '#FFFFFF'; case 'Black': return '#000000'; case 'Dark Blue': return '#0629AC'; case 'Dark Pink': return '#FF6680'; case 'Dark Green': return '#006600'; case 'Dark Red': return '#cc0000'; case 'Dark Purple': return '#3d003d'; case 'Dark Grey': return '#737373'; case 'Dark Orange': return '#e77400'; case 'Dark Aqua': return '#006767'; case 'Dark Gold': return '#998100'; case 'Dark Teal': return '#003f1f'; case 'Dark Brown': return '#582c00'; case 'Dark Bronze': return '#a56728'; case 'Dark Periwinkle': return '#155bd7'; case 'Dark Fuschia': return '#d6155c'; case 'Dark Lime': return '#6b790c'; case 'Dark Plum': return '#7f13bf'; default: if (/^#[0-9A-F]{6}$/i.test(color)) { return color; } else if (/^[0-9A-F]{6}$/i.test(color)) { return ('#' + color); } else { return ('default'); } } } function checkBgColor(color) { switch (color) { case 'White/No color': return '#FFFFFF'; case 'Light Aqua': return '#adeaea'; case 'Light Pink': return '#FFE6EA'; case 'Light Green': return '#94e594'; case 'Light Red': return '#ff9a9a'; case 'Light Purple': return '#f2cdff'; case 'Light Orange': return '#ffd9b3'; case 'Light Grey': return '#e6e6e6'; case 'Light Blue': return '#d1eaee'; case 'Light Yellow': return '#ffff94' case 'Cream': return '#f9f6ed' case 'Light Bronze': return '#ebccad'; case 'Light Periwinkle': return '#d7e4fb'; case 'Light Teal': return '#d7fbee'; case 'Light Fuschia': return '#fbd7e4'; case 'Light Lime': return '#ecf6a7'; case 'Light Plum': return '#e3c0f9'; default: if (/^#[0-9A-F]{6}$/i.test(color)) { return color; } else if (/^[0-9A-F]{6}$/i.test(color)) { return ('#' + color); } else { return ('default'); } } } function leftJustify(textstring,line) { textStringLength = textstring.length; if (fontSize == 11) { if (line == 1) { if (textStringLength < 4) { return 114; } else if (textStringLength < 6) { return 109; } else if (textStringLength < 8) { return 104; } else if (textStringLength < 10) { return 100; } else if (textStringLength < 12) { return 95; } else if (textStringLength < 14) { return 90; } else if (textStringLength < 16) { return 86; } else if (textStringLength < 18) { return 82; } else if (textStringLength < 20) { return 77; } else if (textStringLength < 22) { return 72; } else if (textStringLength < 24) { return 67; } else if (textStringLength < 26) { return 62; } else if (textStringLength < 28) { return 58; } else if (textStringLength < 30) { return 53; } else if (textStringLength < 32) { return 49; } else if (textStringLength < 34) { return 44; } else if (textStringLength < 37) { return 39; } else if (textStringLength < 40) { return 34; } else if (textStringLength < 42) { return 30; } else if (textStringLength < 44) { return 26; } else if (textStringLength < 47) { return 21; } else if (textStringLength < 49) { return 16; } else if (textStringLength < 51) { return 11; } else { return 7; } } else { if (textStringLength < 4) { return 114; } else if (textStringLength < 6) { return 110; } else if (textStringLength < 8) { return 105; } else if (textStringLength < 10) { return 100; } else if (textStringLength < 12) { return 97; } else if (textStringLength < 14) { return 93; } else if (textStringLength < 16) { return 88; } else if (textStringLength < 18) { return 83; } else if (textStringLength < 20) { return 79; } else if (textStringLength < 22) { return 74; } else if (textStringLength < 24) { return 71; } else if (textStringLength < 26) { return 66; } else if (textStringLength < 28) { return 61; } else if (textStringLength < 30) { return 57; } else if (textStringLength < 32) { return 53; } else if (textStringLength < 34) { return 48; } else if (textStringLength < 37) { return 44; } else if (textStringLength < 39) { return 39; } else if (textStringLength < 42) { return 34; } else if (textStringLength < 44) { return 29; } else if (textStringLength < 47) { return 24; } else if (textStringLength < 49) { return 19; } else if (textStringLength < 52) { return 14; } else { return 7; } } } else { if (line == 1) { if (textStringLength < 4) { return 113; } else if (textStringLength < 6) { return 108; } else if (textStringLength < 8) { return 103; } else if (textStringLength < 10) { return 99; } else if (textStringLength < 12) { return 94; } else if (textStringLength < 14) { return 89; } else if (textStringLength < 16) { return 84; } else if (textStringLength < 18) { return 80; } else if (textStringLength < 20) { return 75; } else if (textStringLength < 22) { return 70; } else if (textStringLength < 24) { return 65; } else if (textStringLength < 26) { return 60; } else if (textStringLength < 28) { return 55; } else if (textStringLength < 30) { return 50; } else if (textStringLength < 32) { return 46; } else if (textStringLength < 34) { return 41; } else if (textStringLength < 37) { return 36; } else if (textStringLength < 40) { return 31; } else if (textStringLength < 42) { return 26; } else if (textStringLength < 44) { return 22; } else if (textStringLength < 47) { return 17; } else if (textStringLength < 49) { return 12; } else if (textStringLength < 51) { return 7; } else { return 3; } } else { if (textStringLength < 4) { return 113; } else if (textStringLength < 6) { return 109; } else if (textStringLength < 8) { return 104; } else if (textStringLength < 10) { return 99; } else if (textStringLength < 12) { return 95; } else if (textStringLength < 14) { return 91; } else if (textStringLength < 16) { return 86; } else if (textStringLength < 18) { return 81; } else if (textStringLength < 20) { return 77; } else if (textStringLength < 22) { return 72; } else if (textStringLength < 24) { return 68; } else if (textStringLength < 26) { return 63; } else if (textStringLength < 28) { return 58; } else if (textStringLength < 30) { return 54; } else if (textStringLength < 32) { return 50; } else if (textStringLength < 34) { return 45; } else if (textStringLength < 37) { return 40; } else if (textStringLength < 39) { return 35; } else if (textStringLength < 42) { return 30; } else if (textStringLength < 44) { return 25; } else if (textStringLength < 47) { return 20; } else if (textStringLength < 49) { return 15; } else if (textStringLength < 52) { return 10; } else { return 3; } } } } //********** Build Moderator Array ************** function populateModeratorArray(user,type,mode) { if (mode == 'a') { if (!cbjs.arrayContains(moderatorList.name,user)) { moderatorList.name.push(user); moderatorList.type.push(type); } else { return; } } else if (mode == 'r') { if (cbjs.arrayContains(moderatorList.name,user)) { nameIndex = moderatorList.name.indexOf(user); moderatorList.name.splice(nameIndex,1); moderatorList.type.splice(nameIndex,1); } else { return; } } else { return; } } function addRmvModsInShow(user, mode) { if (mode == 'a') { if (cbjs.arrayContains(modsInShow,user)) { return; } else { modsInShow.push(user); } } else if (mode == 'r') { if (cbjs.arrayContains(modsInShow,user)) { cbjs.arrayRemove(modsInShow,user); } else { return; } } } function populateFanClubArray(user) { if (!cbjs.arrayContains(fanClubList,user)) { fanClubList.push(user); } else { return; } } function addRmvVIP(user, mode) { if (mode == 'a') { if (cbjs.arrayContains(VIPListArray,user)) { return; } else { VIPListArray.push(user); } } else if (mode == 'r') { if (cbjs.arrayContains(VIPListArray,user)) { cbjs.arrayRemove(VIPListArray,user); } else { return; } } } function addRmvVIPInShow(user, mode) { if (mode == 'a') { if (cbjs.arrayContains(VIPsInShow,user)) { return; } else { VIPsInShow.push(user); } } else if (mode == 'r') { if (cbjs.arrayContains(VIPsInShow,user)) { cbjs.arrayRemove(VIPsInShow,user); } else { return; } } } function addRmvExtFan(user, mode) { if (mode == 'a') { if (cbjs.arrayContains(extFanListArray,user)) { return; } else { extFanListArray.push(user); } } else if (mode == 'r') { if (cbjs.arrayContains(extFanListArray,user)) { cbjs.arrayRemove(extFanListArray,user); } else { return; } } } function addRmvExtFanInShow(user, mode) { if (mode == 'a') { if (cbjs.arrayContains(extFansInShow,user)) { return; } else { extFansInShow.push(user); } } else if (mode == 'r') { if (cbjs.arrayContains(extFansInShow,user)) { cbjs.arrayRemove(extFansInShow,user); } else { return; } } } //********** Goal Bar ************** function goalBar(current,total) { if (current > 0 && total > 0) { percent = Math.round(100*(current/total)); } else { percent = 0; } bar = ''; full = '\u25C6'; half = '\u25C8'; empty = '\u25C7'; a = (percent - (percent % 10)) / 10; b = (percent % 10) > 0 ? 1 : 0; c = 10 - (a + b); bar += charRepeat(full, a); (b === 1 ? bar += half : bar += ''); bar += charRepeat(empty, c) return bar; } function charRepeat(d, e) { var string = ''; for (var index = 1; index <= e; index++) { string += d } return string; } // *********************************** Ultra App Ticket Show Functions ************************************** function initTicketShow() { ticketShowColors(); countTickets = 0; countTicketsFromPreview = 0; showStage = 'ticketsales'; changeRoomSubject(); ticketSkipMin = false; ticketSkipSec = false; ticketModeMessage = ''; setTicketMode('init',BC); ticketShowEnded = false; ticketSalesEnded = false; loadFreeTickets(); if (ticketShowEnableOT == 'Yes' && ticketShowFanAppreciation != 'Yes') { setTicketShowOtToggle('on',BC) } if (ticketShowFanAppreciation == 'Yes') { cb.sendNotice('' + 'Today\'s Ticket Show is a Fan Club Appreciation Show! Only Fan Club Members and VIPs will be admitted to the show.\n' + '', '', ticketBgColor, ticketTxtColor, 'bold'); } else { cb.sendNotice('Do not deactivate or restart the Ticket Show App once users have bought tickets. Save the ticket list first with /tickets to view and copy, then add those users back to the show once restarted with /add.', BC, appNoticeColor); if (ticketShowAllowGift == 'Yes') { cb.sendNotice('' + 'See commands with /tickethelp.' + '', '', ticketBgColor, ticketTxtColor, 'bold'); } } initTicketNoticeTimer(); cb.drawPanel(); } function ticketShowColors() { ticketNoticesTxtColor = checkTextColor('Black'); ticketNoticesBgColor = checkBgColor('White'); ticketTxtColorFan = checkTextColor('Black'); ticketBgColorFan = checkBgColor('Light Green'); ticketTxtColorVIP = checkTextColor('Black'); ticketBgColorVIP = checkBgColor('Light Purple'); ticketTxtColorMod = checkTextColor('Black'); ticketBgColorMod = checkBgColor('Light Red'); if (ticketShowTextColor == 'Custom') { ticketTxtColor = checkTextColor(ticketShowCustomTextColor); if (ticketTxtColor == 'default') { cb.sendNotice('Ticket Show - Error while setting the text color. It has to be in a HEX format. Using default value.', cb.room_slug, appNoticeColor, '', 'bold'); ticketTxtColor = '#FFFFFF'; } } else { ticketTxtColor = checkTextColor(ticketShowTextColor); } if (ticketShowBgColor == 'Custom') { ticketBgColor = checkBgColor(ticketShowCustomBgColor); if (ticketBgColor == 'default') { cb.sendNotice('Ticket Show - Error while setting the background color. It has to be in a HEX format. Using default value.', cb.room_slug, appNoticeColor, '', 'bold'); ticketBgColor = '#FFFFFF'; } } else { ticketBgColor = checkBgColor(ticketShowBgColor); } } function initTicketNoticeTimer() { if (ticketNoticeInterval == '' || ticketNoticeInterval == null) { cb.sendNotice('Ticket Show Chat Notice Interval is not set. Using default value of 1.8 minutes.', cb.room_slug, appNoticeColor); ticketNoticeInt = 1.2; } else { ticketNoticeInt = parseFloat(ticketNoticeInterval); } if (ticketNoticeInt < 1) { cb.sendNotice('Ticket Show Chat Notice Interval is too short, must be at least 1 minute. Using default value of 2.6 minutes.', cb.room_slug, appNoticeColor); ticketNoticeInt = 1.2; } ticketNoticeInt *= 60000; ticketNoticeInt = parseInt(ticketNoticeInt); cb.setTimeout(ticketNoticeTimer, ticketNoticeInt); } function ticketNoticeTimer() { if (showStage == 'ticketsales' || showStage == 'ticketshow' || showStage == 'showwarn') { ticketNotice(); } cb.setTimeout(ticketNoticeTimer, ticketNoticeInt); } function ticketNotice() { if (ticketShowFanAppreciation == 'Yes') { msg = 'Today\'s Ticket Show is a Fan Club Appreciation Show! Only Fan Club Members and VIPs will be admitted to the show.'; } else { msg = 'General admission ticket price is ' + ticketPrice + ' token' + (ticketPrice > 1 ? 's.' : '.'); if (cb.settings.ticketShowPriceFC > 1 && cb.settings.ticketShowFreeFC != 'Yes') { msg += '\nChaturbate Fanclub members can buy a ticket to the show for ' + cb.settings.ticketShowPriceFC + ' token' + (cb.settings.ticketShowPriceFC > 1 ? 's.' : '.'); } else if (cb.settings.ticketShowFreeFC == 'Yes') { msg += '\nChaturbate Fanclub members get a free ticket!'; } if (cb.settings.ticketShowPriceEFC > 1 && cb.settings.ticketShowFreeEFC != 'Yes') { msg += '\n' + EFCname + ' members can buy a ticket to the show for ' + cb.settings.ticketShowPriceEFC + ' token' + (cb.settings.ticketShowPriceEFC > 1 ? 's.' : '.'); } else if (cb.settings.ticketShowFreeEFC == 'Yes') { msg += '\n' + EFCname + ' members get a free ticket!'; } if (cb.settings.ticketShowPriceVIP > 1 && cb.settings.ticketShowFreeVIP != 'Yes') { msg += '\n' + VIPname + ' members can buy a ticket to the show for ' + cb.settings.ticketShowPriceVIP + ' token' + (cb.settings.ticketShowPriceVIP > 1 ? 's.' : '.'); } else if (cb.settings.ticketShowFreeVIP == 'Yes') { msg += '\n' + VIPname + ' members get a free ticket!'; } } } function setTicketShowOtToggle(option, sendto) { if(option == 'on') { if(ticketShowOtToggle == 1) { cb.sendNotice('The Outstanding Ticket feature is already enabled.',sendto,appNoticeColor); } else { ticketShowOtToggle = 1; cb.sendNotice('' + 'The Outstanding Ticket (OT) feature has been started.\n You can save your ticket if you have to leave before the show starts.\n Use the command "/saveticket" to save it, but note that by saving your ticket you will be removed from the current show\'s list.\n You can view the OT List with the command "/otlist".\n You can redeem an outstanding ticket with the command "/useticket".' + '', '', ticketBgColor, ticketTxtColor, 'bold'); cb.sendNotice('Notice Regarding Outstanding Tickets: The Outstanding tickets added and removed during the show must be made permanent by updating the list on the App Launch page.\n The list can be viewed using the command "/otlist".\n The changes for the current session can be seen using "/otchanges".\n It is recommended to save the list externally and update the OT list before the next show. Changes made during the show are not saved beyond the current session.',cb.room_slug,appNoticeColor); } } else if(option == 'off') { if(ticketShowOtToggle == 0) { cb.sendNotice('The Outstanding Ticket feature is already disabled.',sendto,appNoticeColor); } else { ticketShowOtToggle = 0; cb.sendNotice('You have disabled the Outstanding Ticket (OT) feature.\n* The outstanding ticket list is still intact, but no more tickets will be sold.\n* The list can be viewed using the command "/otlist".\n* The changes for the current session can be seen using "/otchanges" \n* Be sure to update these entries into the OT List on the App Launch Page, they cannot be saved automatically.',sendto,appNoticeColor); } } } function setTicketPrice(amount,announce) { ticketPrice = parseInt(amount); if (announce == 'yes') { ticketPriceChangeNotice(ticketPrice); } } function ticketPriceChangeNotice(price) { cb.sendNotice('The Ticket Show price has been updated. Tickets are now ' + ticketPrice + ' tokens.' , '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); changeRoomSubject(); cb.drawPanel(); } function loadFreeTickets() { if (ticketShowFreeMods == 'Yes') { for (let i = 0; i < modsInShow.length; i++) { if (!cb.limitCam_userHasAccess(modsInShow[i])) { addRmvTicket('add',modsInShow[i],'mod'); } } } if (ticketShowFreeFC == 'Yes') { for (let i = 0; i < fanClubList.length; i++) { if (!cb.limitCam_userHasAccess(fanClubList[i])) { addRmvTicket('add',fanClubList[i],'fan'); } } } if (ticketShowFreeEFC == 'Yes') { for (let i = 0; i < extFansInShow.length; i++) { if (!cb.limitCam_userHasAccess(extFansInShow[i])) { addRmvTicket('add',extFansInShow[i],'extfan'); } } } if (ticketShowFreeVIP == 'Yes') { for (let i = 0; i < VIPsInShow.length; i++) { if (!cb.limitCam_userHasAccess(VIPsInShow[i])) { addRmvTicket('add',VIPsInShow[i],'vip'); } } } } function checkFreeTickets(user,isMod,isFan,isExtFan,isVIP,checkmode) { if (!cb.limitCam_userHasAccess(user) && showStage != 'aftershow') { if (isMod) { if (ticketShowFreeMods == 'Yes') { addRmvTicket('add',user,'mod'); cb.sendNotice('' + 'You\'ve been added to the show because you\'re a moderator! \n' + '', user, ticketBgColor, ticketTxtColor, 'bold'); } else if (checkmode == 'enter') { cb.sendNotice('' + '\n* The Ticket Show is not configured to give a free ticket to moderators. \n' + '', user, ticketBgColor, ticketTxtColor, 'bold'); } } else if (isFan) { if (ticketShowFreeFC == 'Yes') { addRmvTicket('add',user,'fan'); cb.sendNotice('' + 'You\'ve automatically been added to the show because you\'re in the Chaturbate Fan Club! \n' + '', user, ticketBgColor, ticketTxtColor, 'bold'); } else if (ticketShowPriceFC > 1 && checkmode == 'enter') { cb.sendNotice('' + '\n* As a Chaturbate Fan Club member, you can buy a ticket to the show for ' + ticketShowPriceFC + ' tokens. \n' + '', user, ticketBgColor, ticketTxtColor, 'bold'); } } else if (isExtFan) { if (ticketShowFreeEFC == 'Yes') { addRmvTicket('add',user,'extfan'); cb.sendNotice('' + 'You\'ve automatically been added to the show because you\'re a member of ' + EFCname + '! \n' + '', user, ticketBgColor, ticketTxtColor, 'bold'); } else if (ticketShowPriceEFC > 1 && checkmode == 'enter') { cb.sendNotice('' + 'As a member of ' + EFCname + ', you can buy a ticket to the show for ' + ticketShowPriceEFC + ' tokens. \n' + '', user, ticketBgColor, ticketTxtColor, 'bold'); } } else if (isVIP) { if (ticketShowFreeVIP == 'Yes') { addRmvTicket('add',user,'vip'); cb.sendNotice('' + 'You\'ve automatically been added to the show because you\'re a member of ' + VIPname + '! \n' + '', user, ticketBgColor, ticketTxtColor, 'bold'); } else if (ticketShowPriceVIP > 1 && checkmode == 'enter') { cb.sendNotice('' + 'As a member of ' + VIPname + ', you can buy a ticket to the show for ' + ticketShowPriceVIP + ' tokens. \n' + '', user, ticketBgColor, ticketTxtColor, 'bold'); } } } } function setTicketMode(startmode,sendto) { if (startmode == 'init') { if (ticketShowStartMode == 'Start Show Anytime') { newTicketMode = 'manual'; } else if (ticketShowStartMode == 'Start Show after Timer') { newTicketMode = 'timer'; } else if (ticketShowStartMode == 'Start Show after Ticket Goal') { newTicketMode = 'ticketgoal'; } else if (ticketShowStartMode == 'Start Show after Token Goal') { newTicketMode = 'tokengoal'; } if (ticketShowStartAuto == 'Start from Command') { newTicketAuto = 'bc'; } else if (ticketShowStartAuto == 'Automated Start') { newTicketAuto = 'auto'; } } else { newTicketAuto = ticketModeAuto; if (startmode != '' && startmode != null) { newTicketMode = startmode; } else { newTicketMode = ticketStartMode; } } if (ticketStartMode == 'timer' && newTicketMode != 'timer') { if (ticketMinsRemain > 0 || ticketSecsRemain > 0) { stopTicketTimer(sendto); } } if (newTicketMode == 'manual') { ticketStartMode = 'manual'; ticketModeAuto = 'bc'; updtTicketModeMessage(); } else if (newTicketMode == 'timer') { if (ticketShowStartTimer >= 1) { ticketStartMode = 'timer'; ticketTimeAmt = ticketShowStartTimer; if (newTicketAuto == 'auto') { ticketAutoTimer(ticketTimeAmt); ticketModeAuto = 'auto'; updtTicketModeMessage(); } else { ticketAutoTimer(ticketTimeAmt); ticketModeAuto = 'bc'; updtTicketModeMessage(); } } else { ticketStartMode = 'manual'; ticketModeAuto = 'bc'; updtTicketModeMessage(); cb.sendNotice('Ticket Show start is set to manual mode. Mode was requested for automatic timer, but the timer was not set on the start page. You can restart the bot and update the missing time, or continue and start the show manually at the end of a timer or at a time of your choosing.', sendto, appNoticeColor); } } else if (newTicketMode == 'tokengoal') { if (ticketShowGoal >= 1) { ticketStartMode = 'tokengoal'; ticketShowGoalTokens = ticketShowGoal; if (newTicketAuto == 'auto') { ticketModeAuto = 'auto'; updtTicketModeMessage(); } else { ticketModeAuto = 'bc'; updtTicketModeMessage(); } } else { ticketStartMode = 'manual'; ticketModeAuto = 'bc'; updtTicketModeMessage(); cb.sendNotice('Ticket Show start is set to manual mode. Mode was requested for automatic goal start, but the goal was not set on the start page. You can restart the bot and update the missing goal, update the goal using the command "/chgticketgoal [amt]" and then change the mode using "/chgticketmode goal", or continue and start the show manually at the end of a timer or at a time of your choosing.', sendto, appNoticeColor); } } else if (newTicketMode == 'ticketgoal') { if (ticketShowGoal >= 1) { ticketStartMode = 'ticketgoal'; ticketShowGoalTickets = ticketShowGoal; if (newTicketAuto == 'auto') { ticketModeAuto = 'auto'; updtTicketModeMessage(); } else { ticketModeAuto = 'bc'; updtTicketModeMessage(); } } else { ticketStartMode = 'manual'; ticketModeAuto = 'bc'; updtTicketModeMessage(); cb.sendNotice('Ticket Show start is set to manual mode. Mode was requested for automatic goal start, but the goal was not set on the start page. You can restart the bot and update the missing goal, update the goal using the command "/chgticketgoal [amt]" and then change the mode using "/chgticketmode goal", or continue and start the show manually at the end of a timer or at a time of your choosing.', sendto, appNoticeColor); } } } function setTicketAuto(automode) { if (automode == 'bc') { ticketModeAuto = 'bc'; updtTicketModeMessage(); } else if (automode == 'auto') { ticketModeAuto = 'auto'; updtTicketModeMessage(); } } function updtTicketModeMessage() { if (ticketStartMode == 'manual') { ticketModeMessage = 'The show will be started by ' + bctext + ' or Moderator.'; } else if (ticketStartMode == 'timer') { if (ticketModeAuto == 'auto') { ticketModeMessage = 'The show will start automatically when the timer of ' + ticketTimeAmt + ' minutes runs out.'; } else if (ticketModeAuto == 'bc') { ticketModeMessage = '' + bctext + ' will choose when to start the timer, and the show will start when the timer runs out.'; } } else if (ticketStartMode == 'tokengoal') { if (ticketModeAuto == 'auto') { ticketModeMessage = 'There will be a short 2 minute countdown started once the goal of ' + ticketShowGoalTokens + ' tokens is met, and then the show will start automatically.'; } else if (ticketModeAuto == 'bc') { ticketModeMessage = 'The show will be started manually by ' + bctext + ' or a Moderator once the goal is met for the total tips (' + ticketShowGoalTokens + ' tokens).'; } } else if (ticketStartMode == 'ticketgoal') { if (ticketModeAuto == 'auto') { ticketModeMessage = 'There will be a short 2 minute countdown started once the goal is met for tickets sold (' + ticketShowGoalTickets + ' tickets), and then the show will start automatically.'; } else if (ticketModeAuto == 'bc') { ticketModeMessage = 'The show will be started manually by ' + bctext + ' or Moderator once the goal is met for tickets sold (' + ticketShowGoalTickets + ' tickets).'; } } } function startTicketShowTimer(numtimer) { ticketMinsRemain = numtimer; ticketStartMode = 'timer'; ticketAutoTimer(ticketMinsRemain); cb.drawPanel(); } function ticketAutoTimer(addtime) { if (ticketModeAuto == 'auto') { if (ticketShowFanAppreciation == 'Yes') { cb.sendNotice('An automatic timer was started for the countdown to the Fan Appreciation show.', '', ticketBgColor, ticketTxtColor, 'bold'); } else { cb.sendNotice('An automatic timer was started, ticket show price will be ' + ticketPrice + ' tokens.', '', ticketBgColor, ticketTxtColor, 'bold'); } } else if (ticketModeAuto == 'bc') { cb.sendNotice('A timer was started to provide an countdown to approximate showtime. \n ' + bctext + ' or a moderator will start the show after the timer runs out.', '', ticketBgColor, ticketTxtColor, 'bold'); } ticketMinsRemain = addtime; ticketSecsRemain = 0; ticketStartTime = new Date(); ticketStopTime = new Date(ticketStartTime.getTime() + ticketMinsRemain * 60000); ticketTimerStopping = false; ticketTimerMin(); } function ticketTimerMin() { if (!ticketTimerStopping && ticketStartMode == 'timer') { switch (ticketMinsRemain) { case 60: case 45: case 30: case 25: case 20: case 15: case 10: case 9: case 8: case 7: case 6: case 5: case 4: case 3: case 2: if (ticketShowFanAppreciation == 'Yes') { cb.sendNotice('There are ' + ticketMinsRemain + ' minutes on the timer until the Fan Appreciation Show', '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); } else { cb.sendNotice('There are ' + ticketMinsRemain + ' minutes on the timer before the show starts', '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); } break; case 1: if (ticketShowFanAppreciation == 'Yes') { cb.sendNotice('There is 1 minute on the timer until the Fan Appreciation Show', '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); } else { cb.sendNotice('There is 1 minute on the timer before the show starts', '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); } break; } cb.drawPanel(); ticketMinsRemain--; if (ticketMinsRemain > 0) { ticketDisplaySeconds = false; } else { ticketDisplaySeconds = true; } ticketSecsRemain = 60; ticketTimerSec(); } } function ticketTimerSec() { if (!ticketTimerStopping && ticketStartMode == 'timer') { if (ticketDisplaySeconds) { switch (ticketSecsRemain) { case 30: case 10: case 5: case 4: case 3: case 2: cb.sendNotice('There are ' + ticketSecsRemain + ' seconds left', '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); break; case 1: cb.sendNotice('There is 1 second left', '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); break; } cb.drawPanel(); } if (ticketSecsRemain < 1) { if (ticketMinsRemain >= 1) { ticketTimerMin(); } else { if (ticketStartMode = 'timer' && ticketModeAuto == 'auto') { cb.sendNotice('Time is up! Ticket Show is starting', '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); startTicketShow(cb.room_slug); } else { cb.sendNotice('Time is up! The show will be started when ' + bctext + ' is ready.', '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); } } } else { ticketSecsRemain--; cb.setTimeout(ticketTimerSec, 1000); } } } function ticketAddTime(tickettimetoadd, user) { ticketStopTime = new Date(ticketStopTime.getTime() + tickettimetoadd * 60000); timetoaddabs = Math.abs(tickettimetoadd); if (tickettimetoadd > 0) { cb.sendNotice(user + ' has added ' + tickettimetoadd + ' minute' + (tickettimetoadd === 1 || tickettimetoadd === -1 ? '' : 's') + ' to the timer.',cb.room_slug,'','', 'bold'); cb.sendNotice(tickettimetoadd + ' minute' + (tickettimetoadd === 1 || tickettimetoadd === -1 ? ' has' : 's have') + ' been added to the timer. Now ' + ticketTimeLeft(),'',appNoticeColor,'', 'bold'); } else { cb.sendNotice(user + ' has subtracted ' + timetoaddabs + ' minute' + (timetoaddabs === 1 || timetoaddabs === -1 ? '' : 's') + ' from the timer.',cb.room_slug,'','', 'bold'); cb.sendNotice(timetoaddabs + ' minute' + (timetoaddabs === 1 || timetoaddabs === -1 ? ' has' : 's have') + ' been subtracted from the timer. Now ' + ticketTimeLeft(),'',appNoticeColor,'', 'bold'); } ticketMinsRemain = ticketMinsRemain + tickettimetoadd; if (ticketMinsRemain > 0) { ticketDisplaySeconds = false; } else { ticketDisplaySeconds = true; } cb.drawPanel(); return; } function ticketTimeCal() { ticketStartTime = new Date(); return ticketStopTime - ticketStartTime.getTime(); } function stopTicketTimer(mod) { ticketStopTime = new Date(); ticketTimerStopping = true; ticketMinsRemain = 0; ticketSecsRemain = 0; if(mod != null && mod != '') { cb.sendNotice(mod + ' has stopped the ticket show timer.','',appNoticeColor,'', 'bold'); } cb.drawPanel(); } function ticketTimeLeft(user) { var ticketTimeLeft = ticketTimeCal(); var ticketMS = ticketTimeLeft % 1000; var ticketSeconds = ((ticketTimeLeft - ticketMS) % 60000); var ticketMinutes = ((ticketTimeLeft - ticketSeconds - ticketMS) % 3600000); var ticketHours = (ticketTimeLeft - ticketMinutes - ticketSeconds - ticketMS); ticketSeconds = ticketSeconds / 1000; ticketMinutes = ticketMinutes / 60000; ticketHours = ticketHours / 3600000; if (ticketHours > 0) { return ticketHours + ' hour' + (ticketHours > 1 ? 's' : '') + ' and ' + ticketMinutes + ' minute' + (ticketMinutes > 1 ? 's' : '') + ' remaining on the ticket show timer.'; } else if (ticketMinutes > 0 && ticketSeconds === 0) { return ticketMinutes + ' minute' + (ticketMinutes > 1 ? 's' : '') + ' remaining on the ticket show timer.'; } else if (ticketMinutes > 0) { return ticketMinutes + ' minute' + (ticketMinutes > 1 ? 's' : '') + ' and ' + ticketSeconds + ' second' + (ticketSeconds > 1 ? 's' : '') + ' remaining on the ticket show timer.'; } else { return ticketSeconds + ' second' + (ticketSeconds > 1 ? 's' : '') + ' remaining on the ticket show timer.'; } } function ticketTimeLeftPanel() { var ticketTimeLeft = ticketTimeCal(); var ticketMS = ticketTimeLeft % 1000; var ticketSeconds = ((ticketTimeLeft - ticketMS) % 60000); var ticketMinutes = ((ticketTimeLeft - ticketSeconds - ticketMS) % 3600000); var ticketHours = (ticketTimeLeft - ticketMinutes - ticketSeconds - ticketMS); ticketSeconds = ticketSeconds / 1000; ticketMinutes = ticketMinutes / 60000; if (ticketMinutes > 0) { return (ticketMinutes+1) + ' minutes'; } else { return (ticketSeconds) + ' seconds remaining'; } } function addRmvTicket(mode,user,usertype,tipamt) { switch (mode) { case 'add': { if (cbjs.arrayContains(freePreviewUserArray,user)) { addindex = freePreviewUserArray.indexOf(user); freePreviewUserArray.splice(addindex,1); freePreviewTimeArray.splice(addindex,1); removePreViewer(user); } cb.limitCam_addUsers([user]); addViewer(user); addTicketHolder(user); if (usertype == 'fan') { cb.sendNotice('Chaturbate Fan Club member ' + user + ' has been added to the ticket show list.', '', ticketBgColorFan, ticketTxtColorFan, 'bold'); } else if (usertype == 'extfan') { cb.sendNotice(EFCname + ' member ' + user + ' has been added to the ticket show list.', '', ticketBgColorFan, ticketTxtColorFan, 'bold'); } else if (usertype == 'vip') { cb.sendNotice(VIPname + ' member ' + user + ' has been added to the ticket show list.', '', ticketBgColorVIP, ticketTxtColorVIP, 'bold'); } else if (usertype == 'mod') { cb.sendNotice('Moderator ' + user + ' has been added to the ticket show list.', '', ticketBgColorMod, ticketTxtColorMod, 'bold'); } else { cb.sendNotice('Welcome, ' + user + '! You have been added to the ticket show list.', user, ticketBgColor, ticketTxtColor, 'bold'); } cb.drawPanel(); break; } case 'rmv': { cb.limitCam_removeUsers([user]); removeTicketHolder(user); removeViewer(user); cb.sendNotice(user + ' has been removed from the ticket show list.', '', ticketBgColor, ticketTxtColor, 'bold'); cb.drawPanel(); break; } case 'addtip': { if (cbjs.arrayContains(freePreviewUserArray,user)) { addtipindex = freePreviewUserArray.indexOf(user); freePreviewUserArray.splice(addtipindex,1); freePreviewTimeArray.splice(addtipindex,1); countTicketsFromPreview ++; removePreViewer(user); } cb.limitCam_addUsers([user]); addViewer(user); addTicketHolder(user); ticketShowTotalTicketsBought++; if (usertype == 'fan') { cb.sendNotice('Welcome, Chaturbate Fan Club member ' + user + ', you have bought a ticket to the show.', '', ticketBgColorFan, ticketTxtColorFan, 'bold'); } else if (usertype == 'extfan') { cb.sendNotice('Welcome, ' + EFCname + ' member ' + user + '! You have bought a ticket to the show.', '', ticketBgColorFan, ticketTxtColorFan, 'bold'); } else if (usertype == 'vip') { cb.sendNotice('Welcome, ' + VIPname + ' member ' + user + '! You have bought a ticket to the show.', '', ticketBgColorVIP, ticketTxtColorVIP, 'bold'); } else if (usertype == 'mod') { cb.sendNotice('Welcome, ' + user + '! you have bought a ticket to the show.', '', ticketBgColorMod, ticketTxtColorMod, 'bold'); } else { cb.sendNotice('Welcome, ' + user + '! You have bought a ticket to the show.', '', ticketBgColor, ticketTxtColor, 'bold'); } if (ticketShowAllowGift == 'Yes' && tipamt >= (2*ticketPrice)) { addRmvTicket('addextra', user, 'common', (tipamt - ticketPrice)); } break; } case 'addextra': { var numtickets = Math.floor(parseInt(tipamt / ticketPrice)); if (numtickets > 0) { if (!cbjs.arrayContains(ticketShowExtraTickets.name,user)) { ticketShowExtraTickets.name.push(user); ticketShowExtraTickets.count.push(numtickets); } else { addextraindex = ticketShowExtraTickets.name.indexOf(user); ticketShowExtraTickets.count[addextraindex] = ticketShowExtraTickets.count[addextraindex] + numtickets; } cb.sendNotice(user + ', you have purchased ' + numtickets + ' extra tickets to the show. You can gift these to other users with the command /giftticket, followed by a space and then the username of the giftee. Each time you use the command it uses up one of your extra tickets. Please make sure to spell the user name right, gifted tickets cannot be recovered if they are gifted incorrectly.', user, ticketBgColor, ticketTxtColor, 'bold'); } cb.drawPanel(); break; } } } function addViewer(user) { if (!cbjs.arrayContains(ticketShowViewerList,user)) { ticketShowViewerList.push(user); } } function removeViewer(user) { if (cbjs.arrayContains(ticketShowViewerList,user)) { rmvvindex = ticketShowViewerList.indexOf(user); ticketShowViewerList.splice(rmvvindex,1); } } function addTicketHolder(user) { if (!cbjs.arrayContains(ticketHolderList,user)) { ticketHolderList.push(user); countTickets ++; } } function removeTicketHolder(user) { if (cbjs.arrayContains(ticketHolderList,user)) { rmvvindex = ticketHolderList.indexOf(user); ticketHolderList.splice(rmvvindex,1); if (countTickets > 0) { countTickets --; } } } function addPreViewer(user) { if (!cbjs.arrayContains(ticketShowPreViewerList,user)) { ticketShowPreViewerList.push(user); } } function removePreViewer(user) { if (cbjs.arrayContains(ticketShowPreViewerList,user)) { rmvpindex = ticketShowPreViewerList.indexOf(user); ticketShowPreViewerList.splice(rmvpindex,1); } } function addRmvPreview(mode,user) { switch (mode) { case 'add': { cb.limitCam_addUsers([user]); addViewer(user); addPreViewer(user); endtime = Date.now() + (freePreviewLength * 1000); freePreviewUserArray.push(user); index = freePreviewUserArray.indexOf(user); freePreviewTimeArray[index] = endtime; break; } case 'rmv': { cb.limitCam_removeUsers([user]); removeViewer(user); removePreViewer(user); break; } } } function previewMonitorTimer() { cb.setTimeout(previewMonitor, 5000); } function previewMonitor() { if (showStage == 'ticketshow' || showStage == 'showwarn' || showStage == 'showfinale') { previewCheckViewers(); previewMonitorTimer(); } cb.drawPanel(); } function previewCheckViewers() { nowtime = Date.now(); for (var chk = 0; chk < freePreviewUserArray.length; chk++) { user = freePreviewUserArray[chk]; if (cb.limitCam_userHasAccess(user)) { if (freePreviewTimeArray[chk] < nowtime) { addRmvPreview('rmv',user); cb.sendNotice('' + 'Your free preview of the ticket show for ' + freePreviewLengthText + ' has ended. You can rejoin the the show by tipping ' + ticketPrice + ' tokens.' + '', user, ticketBgColor, ticketTxtColor, 'bold'); } } } } function giftTicket(fromuser,touser) { cb.limitCam_addUsers([touser]); addViewer(touser); addTicketHolder(touser); cb.sendNotice('Welcome, ' + touser + '! ' + fromuser + ' has gifted you a ticket to the show.', '', ticketBgColor, ticketTxtColor, 'bold'); cb.drawPanel(); } function giveAwayTicket(fromuser,touser) { cb.limitCam_addUsers([touser]); addViewer(touser); addTicketHolder(touser); cb.limitCam_removeUsers([fromuser]); removeViewer(fromuser); removeTicketHolder(fromuser); cb.sendNotice('Welcome, ' + touser + '! ' + fromuser + ' has gifted you a ticket to the show.', '', ticketBgColor, ticketTxtColor, 'bold'); cb.drawPanel(); } function addRmvOutstandingTicket(mode,user) { switch (mode) { case 'add': { if (!cbjs.arrayContains(outstandingTicketArray,user)) { outstandingTicketArray.push(user); } populateOtChangesArray(user,'add'); break; } case 'rmv': { if (cbjs.arrayContains(outstandingTicketArray,user)) { cbjs.arrayRemove(outstandingTicketArray,user); } populateOtChangesArray(user,'rmv'); break; } } } function populateOtChangesArray(user,type) { if (cbjs.arrayContains(otChangesArray.name,user)) { index = otChangesArray.name.indexOf(user); if (otChangesArray.type[index] != type) { otChangesArray.name.push(user); otChangesArray.type.push(type); } else { return; } } else { otChangesArray.name.push(user); otChangesArray.type.push(type); } } function ticketShowGoalProgress(tipAmount) { ticketShowTotalTips = ticketShowTotalTips + tipAmount; if (ticketStartMode == 'tokengoal' && ticketShowTotalTips >= ticketShowGoalTokens) { cb.sendNotice('' + 'The ticket show Tip goal has been met! Starting a 2 minute timer for automatic start of show.', '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); ticketStartMode = 'timer'; ticketAutoTimer(2); } else if (ticketStartMode == 'ticketgoal' && ticketShowTotalTicketsBought >= ticketShowGoalTickets) { cb.sendNotice('' + 'The ticket show Ticket Goal has been met! Starting a 2 minute timer for automatic start of show.', '', ticketNoticesBgColor, ticketNoticesTxtColor, 'bold'); ticketStartMode = 'timer'; ticketAutoTimer(2); } } function startTicketShow(startedby) { if (ticketShowFanAppreciation == 'Yes') { cb.limitCam_start('Hidden Show\n\nFan Club Appreciation Show. Join the Fanclub to unlock the screen!'); } else { cb.limitCam_start('Ticket Show\n\nHidden Cam show in progress. \nCheck room notices for ticket price'); } showStage = 'ticketshow'; changeRoomSubject(); if (ticketMinsRemain > 0 || ticketSecsRemain > 0) { stopTicketTimer(); } hiddenTime = Date.now(); if (freePreviewLength > 0) { previewMonitorTimer(); } cb.drawPanel(); } function restartTicketShow(startedby) { cb.sendNotice('' + '' + startedby + ' has restarted the ticket show! All current ticket holders still have access. Ticket sales are open, price is ' + ticketPrice + ' tokens.' + '','',ticketBgColor, ticketNoticesTxtColor, 'bold'); if (ticketShowFanAppreciation == 'Yes') { cb.limitCam_start('Hidden Show\n\nFan Club Appreciation Show. Join the Fanclub to unlock the screen!'); } else { cb.limitCam_start('Ticket Show\n\nHidden Cam show in progress. \nCheck room notices for ticket price'); } if (showStage == 'aftershow') { ticketSubjectText = savedTicketSubjectText; } showStage = 'ticketshow'; changeRoomSubject(); ticketShowEnded = false; ticketSalesEnded = false; if (ticketMinsRemain > 0 || ticketSecsRemain > 0) { stopTicketTimer(); } hiddenTime = Date.now(); if (freePreviewLength > 0) { previewMonitorTimer(); } cb.drawPanel(); } function restartTicketSales(startedby) { if (showStage == 'aftershow') { cb.sendNotice('' + '' + startedby + ' has restarted ticket sales! All current ticket holders still have access. \n * Ticket price is ' + ticketPrice + ' tokens. \n' + dashLine80,'',ticketBgColor, ticketNoticesTxtColor, 'bold'); showStage = 'ticketsales'; ticketSubjectText = savedTicketSubjectText; ticketShowEnded = false; } else if (showStage == 'showfinale') { cb.sendNotice('' + '' + startedby + ' has restarted ticket sales! Ticket price is ' + ticketPrice + ' tokens. \n' + '','',ticketBgColor, ticketNoticesTxtColor, 'bold'); showStage = 'ticketshow'; } ticketSalesEnded = false; changeRoomSubject(); cb.drawPanel(); } function warnShowEnding(by) { showStage = 'showwarn'; if (ticketShowFanAppreciation == 'Yes') { } changeRoomSubject(); cb.drawPanel(); } function stopTicketSales(stoppedby) { if (ticketShowFanAppreciation == 'Yes') { } showStage = 'showfinale'; changeRoomSubject(); ticketSalesEnded = true; cb.drawPanel(); afterNoticeInt = 90000; setAfterNoticeTimeout(); } function stopTicketShow(stoppedby) { cb.sendNotice('' + 'The show has ended for a total length of ' + ((Date.now() - hiddenTime)/60000).toFixed(2) + ' minutes.' ,'',ticketBgColor,ticketNoticesTxtColor,'bold'); cb.limitCam_stop(); hiddenTime = 0; ticketShowEnded = true; ticketSalesEnded = true; showStage = 'aftershow'; savedTicketSubjectText = ticketSubjectText; ticketSubjectText = ticketShowAfterNotice; changeRoomSubject(); cb.drawPanel(); if (ticketShowOtToggle == 1) { if (otChangesArray.name.length > 0) { outString = ''; for (var i = 0; i < otChangesArray.name.length; i++) { if (otChangesArray.name[i] == null) { break } else { outString += (i > 0 ? ',' : '') + otChangesArray.name[i] + '(' + otChangesArray.type[i] + ')'; } } cb.sendNotice('Listing of Changes to the Outstanding Ticket List from this show : \n' + outString + '\nEnd of List', cb.room_slug, appNoticeColor); cb.sendNotice('Listing of Changes to the Outstanding Ticket List from this show : \n' + outString + '\nEnd of List', '', appNoticeColor, '', '', 'red'); } else { cb.sendNotice('No entries have been added to the Outstanding Ticket Changes list from this show.', cb.room_slug, appNoticeColor); } } if (countTicketsFromPreview > 0) { cb.sendNotice('Good news! ' + countTicketsFromPreview + ' viewers bought tickets from watching the free preview period.', cb.room_slug, appNoticeColor); } } function setAfterNoticeTimeout() { cb.setTimeout(afterNoticeTimer, afterNoticeInt); } function afterNoticeTimer() { if (showStage == 'showfinale') { setAfterNoticeTimeout(); } } function useTicket(user) { addRmvOutstandingTicket('rmv',user); cb.limitCam_addUsers([user]); addViewer(user); addTicketHolder(user); cb.sendNotice('Welcome ' + user + ', your Outstanding Ticket has been redeemed and you have been added to the show!', '', ticketBgColor, ticketTxtColor, 'bold'); cb.drawPanel(); } function saveTicket(user) { addRmvOutstandingTicket('add',user); cb.limitCam_removeUsers([user]); removeTicketHolder(user); removeViewer(user); cb.drawPanel(); } function sendPublicNotice (message, user, type) { if (message != null) { if (message != '' || message != ' ' || message != '\u00a0') { switch (type) { case 'h': cb.sendNotice('' + message.capitalize(), '', ticketBgColor,ticketNoticesTxtColor, 'bold'); break; case '': cb.sendNotice('' + message.capitalize(), '', '', ticketNoticesTxtColor, 'bold'); break; } } else { cb.sendNotice('You cannot send a blank message. Type a message and try again.', user, appNoticeColor); } } else { cb.sendNotice('You cannot send a blank message. Type a message and try again.', user, appNoticeColor); } } function recordTip(tipAmount,tipBy,isFan,isExtFan,isVIP) { currentAppTotalTicket += tipAmount; if (ticketShowFanAppreciation != 'Yes') { if (!ticketShowEnded && !ticketSalesEnded && (!cb.limitCam_userHasAccess(tipBy) || cbjs.arrayContains(ticketShowPreViewerList,tipBy))) { if (isFan) { if (tipAmount >= ticketShowPriceFC) { addRmvTicket('addtip', tipBy, 'fan', tipAmount); } else { checkCumulative(tipBy,tipAmount,ticketShowPriceFC,'fan'); } } else if (isExtFan) { if (tipAmount >= ticketShowPriceEFC) { addRmvTicket('addtip', tipBy, 'extfan', tipAmount); } else { checkCumulative(tipBy,tipAmount,ticketShowPriceEFC,'extfan'); } } else if (isVIP) { if (tipAmount >= ticketShowPriceVIP) { addRmvTicket('addtip', tipBy, 'vip', tipAmount); } else { checkCumulative(tipBy,tipAmount,ticketShowPriceVIP,'vip'); } } else { if (tipAmount >= ticketPrice) { addRmvTicket('addtip', tipBy, 'common', tipAmount); } else { checkCumulative(tipBy,tipAmount,ticketPrice,'common'); } } } else if (!ticketShowEnded && !ticketSalesEnded && cb.limitCam_userHasAccess(tipBy) && ticketShowAllowGift == 'Yes') { if (tipAmount >= ticketPrice) { addRmvTicket('addextra', tipBy, 'common', tipAmount); } } ticketShowGoalProgress(tipAmount); } cb.drawPanel(); } function checkCumulative(tipBy,tipAmount,cumTktPrice,usertype){ if (ticketShowCumulative == 'Yes') { if (!cbjs.arrayContains(ticketCumulative.name, tipBy)) { ticketCumulative.name.push(tipBy); ticketCumulative.amount.push(tipAmount); } else { index = ticketCumulative.name.indexOf(tipBy); if (ticketCumulative.amount[index] + tipAmount >= cumTktPrice) { addRmvTicket('addtip', tipBy, usertype, tipAmount); ticketCumulative.amount[index] = 0; } else { ticketCumulative.amount[index] += tipAmount; } } } } function changeRoomSubject() { if (ticketShowFanAppreciation == 'Yes') { if (showStage == 'ticketsales') { newsubject = ticketSubjectText; } else if (showStage == 'ticketshow' || showStage == 'showwarn' || showStage == 'showfinale') { newsubject = ticketSubjectText + '\u00A0' + ' Show has started '; } else if (showStage == 'aftershow') { newsubject = ticketSubjectText + '\u00A0' + ' ticketShowAfterNotice '; } else { newsubject = ticketSubjectText; } } else { if (showStage == 'ticketsales') { newsubject = ticketSubjectText + '\u00A0' + 'Tickets sales are open.'; } else if (showStage == 'ticketshow') { newsubject = ticketSubjectText + '\u00A0' + 'Ticket show has started.'; } else if (showStage == 'showwarn') { newsubject = ticketSubjectText + '\u00A0' + 'Ticket show may end soon, purchase not recommended'; } else if (showStage == 'showfinale') { newsubject = ticketSubjectText + '\u00A0' + 'Ticket sales have closed.'; } else if (showStage == 'aftershow') { newsubject = ticketShowAfterNotice + '\u00A0' + ticketSubjectTextb; } else { newsubject = ticketSubjectText; } } cb.changeRoomSubject(newsubject); } function customizePanelText(newcolor,sendto) { if (!newcolor && panelTextColor == 'Custom') { textcolorchk = checkTextColor(panelCustomTextColor); if (textcolorchk == 'default') { cb.sendNotice('Draw Panel Text Color - Error while setting the text color. It has to be in a HEX format.', sendto, appNoticeColor, ''); } else { textColor = textcolorchk; cb.drawPanel(); } } else if (newcolor) { textcolorchk = checkTextColor(newcolor); if (textcolorchk == 'default') { cb.sendNotice('Draw Panel Text Color - Error while setting the text color. It has to be in a HEX format.', sendto, appNoticeColor, ''); } else { textColor = textcolorchk; cb.drawPanel(); } } else { textColor = checkTextColor(panelTextColor); cb.drawPanel(); } } function customizePanelBackground(newbackground,sendto) { customPanel = false; if (cbjs.arrayContains(backgroundArray.command,newbackground)) { index = backgroundArray.command.indexOf(newbackground); if (cb.room_slug == 'dorothy') { backgroundImage = backgroundArray.devfile[index]; customPanel = true; currentPanel = newbackground; cb.drawPanel(); } else { menuname = backgroundArray.menu[index]; if (menuname.substring(0,12) == 'personalized') { if (newbackground == cb.room_slug) { backgroundImage = backgroundArray.livefile[index]; customPanel = true; currentPanel = newbackground; cb.drawPanel(); } else { cb.sendNotice('You have requested a personalized background, but you are not the room owner for that background, please choose again.', sendto, appNoticeColor, ''); } } else { backgroundImage = backgroundArray.livefile[index]; customPanel = true; currentPanel = newbackground; cb.drawPanel(); } } } else { cb.sendNotice('Invalid background name. The valid names are: \n' + cbjs.arrayJoin(backgroundArray.command, ', '), sendto, appNoticeColor, ''); } } // *********************************** Help Function ************************************** function helpCommon(option,from) { if(option == null){option = '';} cb.sendNotice('',from,appNoticeColor); cb.sendNotice( 'Ticket Show Commands For All Users' + '\n/tickets: Display the list of users that have bought a ticket.' + '\n/previewers: Display the list of users that are currently viewing a free preview.' + '\n/otlist: Display the list of outstanding ticket holders, can be used by anyone if the Outstanding Ticket feature is enabled.' + '\n/saveticket: If the broadcaster has enabled Outstanding Tickets - If you have bought a ticket and will not be able to stay for the show, you can save it for a future show. You will no longer be able to see the current show. IMPORTANT: If in the same session, the ticket will be available automatically. However for future shows or if the broadcaster restarts the bot, the broadcaster must add the saved tickets to the outstanding ticket list to be able to use them with /useticket. ' + '\n/useticket: If the broadcaster has enabled Outstanding Tickets (and is tracking them) - Redeem an outstanding ticket and use it for access to this show. You can use the command "/otlist" to view the list of outstanding ticket holders if the broadcaster has enabled this feature.' + '\n/tickettimeleft: Display the time left on the ticket show countdown for either automatic or manual starting mode.' + '\n/showtime: Display a message showing how long the current show has been hidden.' + '\n/givemyticketto [username]: (all ticket buyers) If you cannot stay for a show, and outstanding ticket feature is no used to allow saving your ticket, you can give your ticket to another user. This can only be done before the show starts, and you will be removed from the ticket show list!' + '\n/giftticket [username]: If the "gifting" feature is enabled, when you tip enough to buy extra tickets, you can gift those tickets to other users using this command. Each time you gift, it removes one of your "extra" tickets. You can only gift extra tickets with this command, to give away your own ticket, you can use /givemyticketto as noted below. Be sure to type the user name correctly for the person you are gifting to, extra tickets cannot be recovered once they are gifted. This can be done before and during the show.' ,from); cb.sendNotice('',from,appNoticeColor); } function helpModBC(option,from) { var valid = 0; if(option == null) {option = '';} switch(option) { case '': { valid = 1; cb.sendNotice('',from,appNoticeColor); cb.sendNotice( 'Ticket Show Commands For Broadcasters and Moderators' + '\n/tickets: (all users) Display the list of users that have bought a ticket. If the parameter of "alpha" is added, the list is displayed alphabetically. Note that viewers can be added back to the show using the /add command and pasting the list that is shown from the /tickets command. ' + '\n/previewers: (all users) Display the list of users that are currently viewing in their free preview period.' + '\n/otlist: (all users) Display the list of outstanding ticket holders, can be used by anyone if the Outstanding Ticket feature is enabled.' + '\n/saveticket: (all ticket buyers) If the broadcaster has enabled Outstanding Tickets (and is tracking them) - If you have bought a ticket and will not be able to stay for the show, you can save it for a future show. You will no longer be able to see the current show. IMPORTANT: If in the same session, the ticket will be available automatically. However for future shows or if the broadcaster restarts the bot, the broadcaster must add the saved tickets to the outstanding ticket list to be able to use them with /useticket. ' + '\n/useticket: (all users with an outstanding ticket) If the broadcaster has enabled Outstanding Tickets (and is tracking them) - Redeem an outstanding ticket and use it for access to this show. You can use the command /otlist to view the list of outstanding ticket holders if the broadcaster has enabled this feature.' + '\n/tickettimeleft: Display the time left on the ticket show countdown for either automatic or manual starting mode.' + '\n/showtime: (all users) Display a message showing how long the current show has been hidden.' + '\n/givemyticketto [user]: (all ticket buyers) If you cannot stay for a show, and outstanding ticket feature is no used to allow saving your ticket, you can give your ticket to another user. This can only be done before the show starts, and you will be removed from the ticket show list!' + '\n/giftticket [user]: (all users, once you have extra tickets) If the "gifting" feature is enabled, when you tip enough to buy extra tickets, you can gift those tickets to other users using this command. Each time you gift, it removes one of your "extra" tickets. You can only gift extra tickets with this command, to give away your own ticket, you can use /givemyticketto as noted below. Be sure to type the user name correctly for the person you are gifting to, extra tickets cannot be recovered once they are gifted. This can be done before and during the show.' ,from); cb.sendNotice('',from,appNoticeColor); break; } } } } } // ******************************* Upon user entry of a Message ************************************** { cb.onMessage(function (msg) { var message = msg['m'].split(' '); var cmd = 0; var symbolString = '~`!@#$%^&*()_-+={[}]|\\:;"\'<,>.?/'; var listRegExp = /[,\s]+/; var listRegExpSpc = /[,]+/; var m = msg.m; var u = msg.user; var isMod = msg.is_mod; var isFan = msg.in_fanclub; var isExtFan = cbjs.arrayContains(extFanListArray,u); var isVIP = cbjs.arrayContains(VIPListArray,u); var isBC = (u === cb.room_slug); var BC = cb.room_slug; var command = message[0] var commandVar1 = parseInt(message[1]); var commandVar2 = parseInt(message[2]); var commandVar3 = parseInt(message[3]); isBotMod = false; if (isMod) { populateModeratorArray(u,'cbmod','a'); } else { if (cbjs.arrayContains(moderatorList.name,u)) { nameIndex = moderatorList.name.indexOf(u); if (moderatorList.type[nameIndex] == 'botmod') { isBotMod = true; isMod = true; } } } if (isMod) { addRmvModsInShow(u,'a'); } if (isFan) { populateFanClubArray(u); } if (isVIP) { addRmvVIPInShow(u,'a'); } if (isExtFan) { addRmvExtFanInShow(u,'a'); } if (isMod || isFan || isExtFan || isVIP) { checkFreeTickets(u,isMod,isFan,isExtFan,isVIP,'msg'); } if(message[0].charAt(0) == '/') { msg['X-Spam'] = true; var ntc = null; for (var i = 1; i < message.length; i++) { if (i == 1) ntc = message[i]; else ntc += ' ' + message[i]; } var ntc2 = null; for (var i = 2; i < message.length; i++) { if (i == 2) ntc2 = message[i]; else ntc2 += ' ' + message[i]; } var cmdval = null; for (var i = 1; i < message.length; i++) { if (i == 1) cmdval = message[i]; else cmdval += ' ' + message[i]; } switch(command) { //********* General App Commands case '/chgpanelbg': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (message[1]) { newBg = message[1].toLowerCase(); customizePanelBackground(newBg,u); cb.drawPanel(); } else { cb.sendNotice('The /chgpanelbg command requires the entry of a parameter following the command, such as "/chgpanelbg lavalamp". The valid formats are: \n' + cbjs.arrayJoin(backgroundArray.command, ', '), u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/chgpaneltext': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { newcolor = msg['m'].substring(14).trim(); if (newcolor) { customizePanelText(newcolor,u); cb.drawPanel(); } else { cb.sendNotice('The /chgpaneltext command requires the entry of a parameter following the command, which represents either the color name or the color hex code, such as "/chgpaneltext blue" or "/chgpaneltext #0000ff".' , u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/stats': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { cb.sendNotice('Session Stats' + '\n Viewers, ' + ticketShowViewerList.length + '\n Total tips, ' + currentAppTotalTicket + ' tokens ($' + Number(currentAppTotalTicket*.05).toFixed(2) + ')' + '\n Tickets sold, ' + countTickets + ' tickets' + '\n Tickets sold from preview, ' + countTicketsFromPreview + ' tickets', u, appNoticeColor, '', 'bold'); } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } //********* Hidden Ticket Show Commands case '/tickets': { cmd = 1; if (ticketHolderList.length > 0) { if (message[1] == 'a' || message[1] == 'A' || message[1] == 'alpha') { var sortedticketlist = ticketHolderList.slice(); sortedticketlist.sort(); cb.sendNotice('Users currently on the Hidden Ticket Show List, in alphabetic order: ' + countTickets + ' ticket holders \n' + cbjs.arrayJoin(sortedticketlist, ', ') + '\nEnd of List', u, appNoticeColor); } else { cb.sendNotice('Users currently on the Hidden Ticket Show List, in order of when added: ' + countTickets + ' ticket holders \n' + cbjs.arrayJoin(ticketHolderList, ', ') + '\nEnd of List', u, appNoticeColor); } } else { cb.sendNotice('No ticket holders yet.', u, appNoticeColor); } break; } case '/previewers': { cmd = 1; if (freePreviewLength > 0) { if (ticketShowPreViewerList.length > 0) { if (message[1] == 'a' || message[1] == 'A' || message[1] == 'alpha') { var sortedpvlist = ticketShowPreViewerList.slice(); sortedpvlist.sort(); cb.sendNotice('Users currently seeing a free preview of the Ticket Show, in alphabetic order: ' + sortedpvlist.length + ' previewers \n' + cbjs.arrayJoin(sortedpvlist, ', ') + '\nEnd of List', u, appNoticeColor); } else { cb.sendNotice('Users currently seeing a free preview of the Ticket Show, in order of when added: ' + ticketShowPreViewerList.length + ' previewers \n' + cbjs.arrayJoin(ticketShowPreViewerList, ', ') + '\nEnd of List', u, appNoticeColor); } } else { cb.sendNotice('No free preview viewers at this time.', u, appNoticeColor); } } else { cb.sendNotice('The Free Preview is disabled.', u, appNoticeColor); } break; } case '/usegift': { cmd = 1; if (isBC || (isMod && cb.settings.allowModsAuthority == 'Yes')) { if (message[1]) { if (message[1].toLowerCase() != 'on' && message[1].toLowerCase() != 'off') { cb.sendNotice('Ticket Show: The value ' + message[1] + ' is not a valid option for the "/usegift" command, please try again, valid values are "on" or "off".', u, appNoticeColor); } else if (cb.settings.ticketShowFanAppreciation == 'Yes' && message[1].toLowerCase() == 'on') { cb.sendNotice('Ticket Show: Gifting of Tickets is not enabled for a Fan Appreciation show.', u, appNoticeColor); } else { if (message[1].toLowerCase() == 'on') { if (ticketShowAllowGift == 'Yes') { cb.sendNotice('Ticket Show: The Gifting of Tickets is already enabled.', u, appNoticeColor); } else { ticketShowAllowGift = 'Yes'; cb.sendNotice('You have enabled the Gifting of Tickets.', u, appNoticeColor); if (u != BC) { cb.sendNotice(u + 'has enabled the Gifting of Tickets.', BC, appNoticeColor); } } } else if (message[1].toLowerCase() == 'off') { if (ticketShowAllowGift == 'No') { cb.sendNotice('Ticket Show: The Gifting of Tickets is already disabled.', u, appNoticeColor); } else { ticketShowAllowGift = 'No'; cb.sendNotice('You have disabled the Gifting of Tickets.', u, appNoticeColor); if (u != BC) { cb.sendNotice(u + 'has disabled the Gifting of Tickets.', BC, appNoticeColor); } } } } } else { cb.sendNotice('Ticket Show: No parameter was specified for the "/usegift" command, valid values are "on" or "off".', u, appNoticeColor); } } else { cb.sendNotice('Ticket Show: Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/useot': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if(message[1] != null && message[1] != 'on' && message[1] != 'off') { cb.sendNotice('The value ' + message[1] + ' is not a valid option for /useot, please try again.', u, appNoticeColor); } else if(message[1] == null) { cb.sendNotice('You did not enter a valid option for /useot, please try again.', u, appNoticeColor); } else { setTicketShowOtToggle(message[1], u); } } else { cb.sendNotice('Only broadcasters and moderators are able to use that command.', u, appNoticeColor); } break; } case '/otlist': { cmd = 1; if (ticketShowOtToggle == 1) { cb.sendNotice('Users currently on the Outstanding Ticket List: ' + outstandingTicketArray.length, u, appNoticeColor); cb.sendNotice((outstandingTicketArray.length > 0 == true ? cbjs.arrayJoin(outstandingTicketArray, ', ') : 'No outstanding ticket holders.'), u); cb.sendNotice('End of List', u, appNoticeColor); } else { cb.sendNotice('The Ticket Show Outstanding Ticket feature is disabled.', u, appNoticeColor); } break; } case '/otchanges': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (otChangesArray.name.length > 0) { cb.sendNotice('Listing of Changes to the Outstanding Ticket List : ', u, appNoticeColor); outString = ''; for (var i = 0; i < otChangesArray.name.length; i++) { if (otChangesArray.name[i] == null) { break } else { outString += (i > 0 ? ',' : '') + otChangesArray.name[i] + '(' + otChangesArray.type[i] + ')'; } } cb.sendNotice(outString, u); cb.sendNotice('End of List', u, appNoticeColor); } else { cb.sendNotice('No entries have been added to the Outstanding Ticket Change list.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators are able to use that command.', u, appNoticeColor); } break; } case '/ctprice': case '/chgticketprice': case '/ticketprice': { cmd = 1; if (isBC || (isMod && ticketShowModsChgPrice == 'Yes')) { if (message[1]) { numprice = parseInt(message[1]) if (isNaN(numprice)) { cb.sendNotice('The value entered for the ticket price is not numeric, please try again.', u, appNoticeColor); break; } else if (numprice < 1 || numprice > 99999) { cb.sendNotice('The value entered for the ticket price is outside allowable values from 1 to 99999, please try again.', u, appNoticeColor); } else { setTicketPrice(numprice,'yes'); cb.sendNotice('The Hidden Ticket Show price has been updated to ' + numprice + ' tokens, all tips of at least this amount will add a user to the Ticket Show List. You can view the ticket list with the command "/tickets".', u, appNoticeColor); } } else { cb.sendNotice('No parameter was specified for the new ticket price.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/previewlength': { cmd = 1; if (showStage != 'ticketsales') { cb.sendNotice('The preview length can only be changed up until the show starts.', u, appNoticeColor); } else { if (isBC || (isMod && cb.settings.allowModsAuthority == 'Yes')) { if (message[1]) { if (message[1] != '0' && message[1] != '10sec' && message[1] != '20sec' && message[1] != '30sec' && message[1] != '1min' && message[1] != '2min' && message[1] != '3min' && message[1] != '4min' && message[1] != '5min') { cb.sendNotice('Ticket Show: The value entered for the new preview length is not valid, please make sure to use one of the following values: "0", "10sec", "20sec", "30sec", "1min", "2min", "3min", "4min", or "5min".', u, appNoticeColor); } else { switch (message[1]) { case '0': { freePreviewLength = 0; freePreviewLengthText = 'No Preview'; break; } case '10sec': { freePreviewLength = 10; freePreviewLengthText = '10 seconds'; break; } case '20sec': { freePreviewLength = 20; freePreviewLengthText = '20 seconds'; break; } case '30sec': { freePreviewLength = 30; freePreviewLengthText = '30 seconds'; break; } case '1min': { freePreviewLength = 60; freePreviewLengthText = '1 minute'; break; } case '2min': { freePreviewLength = 120; freePreviewLengthText = '2 minutes'; break; } case '3min': { freePreviewLength = 180; freePreviewLengthText = '3 minutes'; break; } case '4min': { freePreviewLength = 240; freePreviewLengthText = '4 minutes'; break; } case '5min': { freePreviewLength = 300; freePreviewLengthText = '5 minutes'; break; } } cb.sendNotice('Ticket Show: The Free Preview length has been updated to "' + freePreviewLengthText + '".', u, appNoticeColor); if (u != BC) { cb.sendNotice('Ticket Show: The Free Preview length has been updated to "' + freePreviewLengthText + '".', BC, appNoticeColor); } } } else { cb.sendNotice('Ticket Show: No parameter was specified for the new preview length.', u, appNoticeColor); } } else { cb.sendNotice('Ticket Show: Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } } break; } case '/starttickettimer': case '/ticketstarttimer': case '/starttimer': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (message[1]) { numtimer = parseInt(message[1]) if(isNaN(numtimer)) { cb.sendNotice('The value entered for the minutes to use for the timer is not numeric, please try again.', u, appNoticeColor); break; } else if(numtimer < 1 || numtimer > 60) { cb.sendNotice('The value entered for the minutes to use for the ticket show timer is outside allowable values from 1 to 60 minutes, please try again.', u, appNoticeColor); } else { startTicketShowTimer(numtimer); } } else { cb.sendNotice('No parameter was specified for the number of minutes to use for the timer.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/addtickettime': case '/ticketaddtime': case '/addtime': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (ticketMinsRemain > 0 || ticketSecsRemain > 0) { if (message[1]) { numtimer = parseInt(message[1]) if (isNaN(numtimer)) { cb.sendNotice('The value entered for the minutes to add to the ticket show start timer is not numeric, please try again.', u, appNoticeColor); } else if (numtimer < -60 || numtimer > 60) { cb.sendNotice('The value entered for the minutes to add to the ticket show start timer is outside allowable values from -60 to 60, please try again. Negative numbers can be used to subtract time.', u, appNoticeColor); } else if (numtimer == 0) { cb.sendNotice('Cannot add zero time.', u, appNoticeColor); } else if (numtimer < 0 && Math.abs(numtimer) > ticketMinsRemain) { cb.sendNotice('The value entered for the minutes to subtract is greater than the remaining time on the timer, please try again. Negative numbers can be used to subtract time.', u, appNoticeColor); } else if (numtimer > 0 && (Math.abs(numtimer) + ticketMinsRemain) > 60) { cb.sendNotice('The value entered for the minutes to add would exceed the maximum countdown time of 60 minutes when added to the current time left.', u, appNoticeColor); } else { ticketAddTime(numtimer, u); } } else { cb.sendNotice('No parameter was specified for the number of minutes to add to the timer.', u, appNoticeColor); } } else { cb.sendNotice('A timer has not been started yet for the ticket show countdown.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/ticketstoptime': case '/ticketstoptimer': case '/stoptimer': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (ticketMinsRemain > 0 || ticketSecsRemain > 0) { stopTicketTimer(u); } else { cb.sendNotice('A ticket timer is not currently running.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators are able to use that command.', u, appNoticeColor); } break; } case '/add': case '/addticket': { cmd = 1; if (isBC || (isMod && ticketShowModsAdd == 'Yes')) { if (cmdval != null) { var cmdvalsplit = cmdval.split(listRegExp); if (cmdvalsplit.length > 1) { cb.sendNotice('Adding multiple users to the ticket show list.', u, appNoticeColor); for (var i = 0; i < cmdvalsplit.length; i++) { if (cmdvalsplit[i]) { nametoadd = cmdvalsplit[i].toLowerCase(); if (!cb.limitCam_userHasAccess(nametoadd)) { addRmvTicket('add',nametoadd); cb.sendNotice('Added ' + nametoadd + ' to the ticket show list.', u); } else { cb.sendNotice(nametoadd + ' is already on the ticket show list. Skipping.', u); } } else { cb.sendNotice('Skipping null entry.', u); } } cb.sendNotice('All users were added and notified.', u, appNoticeColor) cb.sendNotice(u + ' has added multiple users to the ticket show list.\n' + 'Users added: ' + cbjs.arrayJoin(cmdvalsplit, ', '), '', appNoticeColor, '', 'normal', 'red'); } else { nametoadd = message[1].toLowerCase(); if (!cb.limitCam_userHasAccess(nametoadd)) { addRmvTicket('add',nametoadd); } else { cb.sendNotice('Note: User ' + nametoadd + ' is already in the Ticket Show List.', u, appNoticeColor); } } } else { if (!cb.limitCam_userHasAccess(u)) { addRmvTicket('add', u); } else { cb.sendNotice('Note: User ' + u + ' is already in the Ticket Show List.', u, appNoticeColor); } } } else { cb.sendNotice('You do not have authority to use the /add command.', u, appNoticeColor); } break; } case '/rmv': case '/del': case '/delticket': case '/rmvticket': { cmd = 1; if (isBC || (isMod && ticketShowModsAdd == 'Yes')) { if (message[1]) { nametormv = message[1].toLowerCase(); if (cb.limitCam_userHasAccess(nametormv)) { addRmvTicket('rmv',nametormv); } else { cb.sendNotice('Note: User is not in the Ticket Show List.', u, appNoticeColor); } } else { cb.sendNotice('No user was specified for the /rmv command.', u, appNoticeColor); } } else { cb.sendNotice('You do not have authority to use the /rmv command.', u, appNoticeColor); } break; } case '/giftticket': { cmd = 1; if (ticketShowFanAppreciation != 'Yes') { if (ticketShowAllowGift == 'Yes') { if (cbjs.arrayContains(ticketShowExtraTickets.name,u)) { index = ticketShowExtraTickets.name.indexOf(u); if (ticketShowExtraTickets.count[index] > 0) { giftTicket(u,message[1]); ticketShowExtraTickets.count[index]--; cb.sendNotice('You have gifted a ticket to ' + message[1] + '. Thank you for your generosity.', u, appNoticeColor, '', 'bold'); cb.sendNotice('Moderators: ' + u + ' has gifted a ticket to ' + message[1] + '.', '', appNoticeColor, '', '', 'red'); cb.sendNotice('Broadcaster: ' + u + ' has gifted a ticket to ' + message[1] + '.', BC, appNoticeColor); } else { cb.sendNotice('Sorry, you do not have any extra tickets remaining.', u, appNoticeColor); } } else { cb.sendNotice('Sorry, you have not purchased any extra tickets.', u, appNoticeColor); } } else { cb.sendNotice('Sorry, the broadcaster has not enabled the use of gifting tickets for this show.', u, appNoticeColor); } } else { cb.sendNotice('Tickets cannot be gifted for a Fan Appreciation show.', u, appNoticeColor); } break; } case '/giftmyticketto': case '/givemyticketto': { cmd = 1; if (ticketShowFanAppreciation != 'Yes') { if (ticketShowAllowGift == 'Yes') { if (cb.limitCam_userHasAccess(u) && showStage == 'ticketsales') { giveAwayTicket(u,message[1]); cb.sendNotice('You have gifted your ticket to ' + message[1] + '. You will now be removed from the show. Thank you for your generosity.',u,appNoticeColor,'','bold'); cb.sendNotice('Mods: ' + u + ' has gifted their own ticket to ' + message[1] + '.', '', appNoticeColor, '', '', 'red'); cb.sendNotice('Broadcaster: ' + u + ' has gifted their own ticket to ' + message[1] + '.', BC, appNoticeColor); } else { cb.sendNotice('Sorry, you do not have a ticket purchased or the show has already started.', u, appNoticeColor); } } else { cb.sendNotice('Sorry, the broadcaster has not enabled the gifting of tickets for this show.', u, appNoticeColor); } } else { cb.sendNotice('Tickets cannot be gifted for a Fan Appreciation show.', u, appNoticeColor); } break; } case '/chgtktmode': case '/chgticketmode': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (message[1]) { newTicketMode = message[1].toLowerCase(); if (newTicketMode != 'manual' && newTicketMode != 'timer' && newTicketMode != 'ticketgoal' && newTicketMode != 'tokengoal') { cb.sendNotice('The value entered for the new mode is not valid, please try again using a value of "manual", "timer", "ticketgoal", or "tokengoal".', u, appNoticeColor); } else { if (newTicketMode == ticketStartMode) { cb.sendNotice('The value entered for the new mode is the same as the existing mode, command ignored.', u, appNoticeColor); } else { setTicketMode(newTicketMode,u); cb.sendNotice(ticketModeMessage, '', ticketBgColor, ticketTxtColor, 'bold'); cb.drawPanel(); } } } else { cb.sendNotice('No parameter was specified for the new ticket show start mode. Valid values are "manual", "timer", "ticketgoal", or "tokengoal".', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/chgtktauto': case '/chgticketauto': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (message[1]) { newTicketAuto = message[1].toLowerCase(); if (newTicketAuto != 'bc' && newTicketAuto != 'auto') { cb.sendNotice('The value entered for the new mode is not valid, please try again using a value of "bc" or "auto" (broadcaster command or automatic start).', u, appNoticeColor); } else if (newTicketAuto == 'auto' && ticketStartMode == 'manual') { cb.sendNotice('The mode cannot be changed to "auto" unless there is a goal or timer being used to define when the show will start. Show is currently to be started at broadcaster discretion.', u, appNoticeColor); } else if (newTicketAuto == ticketModeAuto) { cb.sendNotice('The value entered for the new mode is the same as the existing mode, command ignored.', u, appNoticeColor); } else { setTicketAuto(newTicketAuto); cb.sendNotice(ticketModeMessage, '', ticketBgColor, ticketTxtColor, 'bold'); cb.drawPanel(); } } else { cb.sendNotice('No parameter was specified for the new autostart mode. Valid values are "bc" or "auto" (broadcaster command or automatic start).', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/tickettimeleft': { cmd = 1; if (ticketMinsRemain >= 1 || ticketSecsRemain >= 1) { cb.sendNotice(ticketTimeLeft(), '', appNoticeColor, '', 'bold'); } else { cb.sendNotice('A Hidden Ticket Show timer is not running.', u, appNoticeColor); } break; } case '/showtime': { cmd = 1; if (cb.limitCam_isRunning()) { cb.sendNotice('Hidden Ticket Show in progress for ' + ((Date.now() - hiddenTime)/60000).toFixed(1) + ' minutes.', u, ticketBgColor,ticketTxtColor,'bold'); } else { cb.sendNotice('The ticket show is not running, it has not yet started or already finished.', u, appNoticeColor); } break; } case '/useticket': { cmd = 1; if (ticketShowFanAppreciation != 'Yes') { if (ticketShowOtToggle == 1) { if (cb.limitCam_userHasAccess(u)) { cb.sendNotice('You already have a ticket to the show.', u, appNoticeColor); } else { if (cbjs.arrayContains(outstandingTicketArray,u)) { useTicket(u); cb.sendNotice('Broadcaster: ' + u + ' has used their Outstanding Ticket to join this show. They should be removed from the permanent OT list on the bot start page.', BC, appNoticeColor); cb.sendNotice('Mods: ' + u + ' has used their Outstanding Ticket. The broadcaster has been notified to remove them from the permanent OT list on the bot start page.', '', appNoticeColor, '', '', 'red'); } else { cb.sendNotice('Sorry, you do not have an outstanding ticket available.', u, appNoticeColor); } } } else { cb.sendNotice('Sorry, the broadcaster has not enabled the use of outstanding tickets for this show.', u, appNoticeColor); } } else { cb.sendNotice('Outstanding Ticket features are not enabled for a Fan Appreciation Show.', u, appNoticeColor); } break; } case '/saveticket': { cmd = 1; if (ticketShowFanAppreciation != 'Yes') { if (ticketShowOtToggle == 1) { if (cb.limitCam_userHasAccess(u) && showStage === 'ticketsales') { saveTicket(u); cb.sendNotice('Your ticket from this show has been saved and you have been removed from the ticket list for this show.', u, appNoticeColor, '', 'bold'); cb.sendNotice('Broadcaster: ' + u + ' has saved their ticket from this show to the Outstanding Ticket list. They should be added to the permanent OT list on the bot start page upon next restart.', BC, appNoticeColor); cb.sendNotice('Mods: ' + u + ' has saved their ticket from this show to the Outstanding Ticket list. The broadcaster has been notified to add them to the permanent OT list on the bot start page.', '', appNoticeColor, '', '', 'red'); } else { cb.sendNotice('Sorry, you have no ticket purchase to save, or the show has already started.', u, appNoticeColor); } } else { cb.sendNotice('Sorry, the broadcaster has not enabled the ability to save an outstanding tickets for this show.', u, appNoticeColor); } } else { cb.sendNotice('Outstanding Ticket features are not enabled for a Fan Appreciation Show.', u, appNoticeColor); } break; } case '/addot': { cmd = 1; if (ticketShowOtToggle == 1) { if (isBC || (isMod && ticketShowModsAdd == 'Yes')) { if(message[1] != '' && message[1] != null) { if (!cbjs.arrayContains(outstandingTicketArray,message[1])) { addRmvOutstandingTicket('add', message[1]); cb.sendNotice('User ' + message[1] + ' has been added to the Outstanding Ticket List.', u, appNoticeColor); } else { cb.sendNotice('Cannot add, user is already in the Outstanding Ticket List.', u, appNoticeColor); } } } } else { cb.sendNotice('The Outstanding Ticket list feature is disabled. It can be enabled with the command "/useot on".', u, appNoticeColor); } break; } case '/rmvot': { cmd = 1; if (ticketShowOtToggle == 1) { if (isBC || (isMod && ticketShowModsAdd === 'Yes')) { if(message[1] != '' && message[1] != null) { if (cbjs.arrayContains(outstandingTicketArray,message[1])) { addRmvOutstandingTicket('rmv', message[1]); cb.sendNotice('User ' + message[1] + ' has been removed from the Outstanding Ticket List.', u, appNoticeColor); } else { cb.sendNotice('Cannot remove, user is not in the Outstanding Ticket List.', u, appNoticeColor); } } } } else { cb.sendNotice('The Outstanding Ticket list feature is disabled. It can be enabled with the command "/useot on".', u, appNoticeColor); } break; } case '/startshow': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (!cb.limitCam_isRunning() && ticketShowEnded === false) { startTicketShow(u); } else if (!cb.limitCam_isRunning() && ticketShowEnded === true) { cb.sendNotice('The Hidden Cam show was already started and stopped, please use the command "/restartshow" to resume the hidden show.', u, appNoticeColor); } else { cb.sendNotice('The Hidden Cam show is already underway.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/showover': case '/showwarn': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (cb.limitCam_isRunning()) { if (showStage == 'ticketshow') { warnShowEnding(u); } else if (showStage == 'showwarn') { cb.sendNotice('The /showwarn or /showover command has already been used. To suspend ticket sales, use the /showend command. To end the show and return to a public broadcast, use the /stopshow command.', u, appNoticeColor); } else if (showStage == 'showfinale') { cb.sendNotice('The show has already progressed past the point this command should be used, ticket sales have already been suspended. To end the show and return to a public broadcast, use the /stopshow command.', u, appNoticeColor); } } else { cb.sendNotice('The Hidden Cam show has not been started or has already ended.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/showend': case '/stopsales': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (cb.limitCam_isRunning()) { if (showStage == 'showfinale') { cb.sendNotice('Ticket Sales have already been suspended.', u, appNoticeColor); } else { stopTicketSales(u); } } else { cb.sendNotice('The Hidden Cam show has not been started or has already ended.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/stopshow': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (cb.limitCam_isRunning()) { stopTicketShow(u); } else { cb.sendNotice('The Hidden Cam show has not been started or has already ended.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/ticketsubject': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { ticketSubjectText = msg['m'].substring(15).trim(); if (ticketSubjectText != '' && ticketSubjectText != null) { changeRoomSubject(); } else { cb.sendNotice('No value was specified for the new room subject suffix.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/ctsubject': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { ticketSubjectText = msg['m'].substring(11).trim(); if (ticketSubjectText != '' && ticketSubjectText != null) { changeRoomSubject(); } else { cb.sendNotice('No value was specified for the new room subject suffix.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/newticketshow': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (!cb.limitCam_isRunning()) { ticketlist = cb.limitCam_allUsersWithAccess(); if (ticketlist.length > 0) { cb.sendNotice('In case the ticket show was reset by mistake, the previous ticket list is displayed below so they can be added back to the show using the /add command : ', cb.room_slug, appNoticeColor); cb.sendNotice(cbjs.arrayJoin(ticketlist, ', '), cb.room_slug); cb.sendNotice('End of List', cb.room_slug, appNoticeColor); if (isMod) { cb.sendNotice('In case the ticket show was reset by mistake, the previous ticket list is displayed below so they can be added back to the show using the /add command : ', u, appNoticeColor); cb.sendNotice(cbjs.arrayJoin(ticketlist, ', '), u); cb.sendNotice('End of List', u, appNoticeColor); } } else { cb.sendNotice('No ticket buyers in the previous ticket list.', u, appNoticeColor); } initTicketShow(u,ticketPrice); cb.limitCam_removeAllUsers(); while (ticketShowViewerList.length > 0) viewerList.pop(); } else { cb.sendNotice('A Hidden Cam show is still running. The /newticketshow command can be used to start a brand new ticket show. The ticket list is cleared but the outstanding ticket list and changes list remains intact.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/restartshow': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (!cb.limitCam_isRunning()) { restartTicketShow(u); } else { cb.sendNotice('A Hidden Cam show is already running. The /restartshow command can be used to resume a hidden show that was ended prematurely or accidentally. All settings remain the same and the ticket list stays intact.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/restartsales': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { if (ticketSalesEnded == true) { restartTicketSales(u); } else { cb.sendNotice('Ticket Sales are already enabled.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } case '/ctn': { cmd = 1; if (isMod || isBC) { if (ntc != null && (ntc != '' || ntc != ' ' || ntc != '\u00a0')) { sendPublicNotice(ntc, u, ''); } else { cb.sendNotice('You cannot send a blank message. The correct syntax for this command is "/ctn [message]".', u, appNoticeColor); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/ctnh': { cmd = 1; if (isMod || isBC) { if (ntc != null && (ntc != '' || ntc != ' ' || ntc != '\u00a0')) { sendPublicNotice(ntc, u, 'h'); } else { cb.sendNotice('You cannot send a blank message. The correct syntax for this command is "/ctnh [message]".', u, appNoticeColor); } } else { cb.sendNotice('Only moderators and broadcasters are able to use that command.', u, appNoticeColor); } break; } //******** VIP Commands *********** case '/addvip': { cmd = 1; if (isBC) { if (cmdval != null) { var cmdvalsplit = cmdval.split(listRegExp); if (cmdvalsplit.length > 1) { addnotice = 'Adding multiple users to ' + VIPname + '.'; addnotice += '\nNote this is only applied during this session, permanent changes to ' + VIPname + ' must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.'; for (var vipi = 0; vipi < cmdvalsplit.length; vipi++) { if (cmdvalsplit[vipi] != '') { nametoadd = cmdvalsplit[vipi].toLowerCase(); if (!cbjs.arrayContains(VIPListArray, nametoadd)) { addRmvVIP(nametoadd,'a'); addnotice += '\nAdded ' + nametoadd + ' to ' + VIPname + '.'; cb.sendNotice(u + ' has added you to the ' + VIPname + '.', nametoadd, appNoticeColor); } else { addnotice += '\n' + nametoadd + ' is already on ' + VIPname + '. Skipping.'; } } } addnotice += '\nAll users were added and notified.'; cb.sendNotice(addnotice, u, appNoticeColor); cb.sendNotice(u + ' has added multiple users to ' + VIPname + '.\n' + 'Users added: ' + cbjs.arrayJoin(cmdvalsplit, ', '), '', appNoticeColor, '', 'normal', 'red'); } else { nametoadd = message[1].toLowerCase(); if (cbjs.arrayContains(VIPListArray,nametoadd)) { cb.sendNotice('Ticket Show: ' + nametoadd + ' is already on ' + VIPname + '.', u, appNoticeColor); } else { addRmvVIP(nametoadd,'a'); cb.sendNotice('Ticket Show: You have added ' + nametoadd + ' to ' + VIPname + '.\nNote this is only applied during this session, permanent VIP list changes must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.', u, appNoticeColor); cb.sendNotice('Ticket Show: Congratulations! You have been added to ' + VIPname + '!', nametoadd, appNoticeColor); } } } else { cb.sendNotice('Ticket Show: You did not specify the username you want to add to ' + VIPname + '.', u, appNoticeColor); } } else { cb.sendNotice('Ticket Show: Only broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/rmvvip': { cmd = 1; if (isBC) { if (message[1]) { nametormv = message[1].toLowerCase(); if (cbjs.arrayContains(VIPListArray,nametormv)) { addRmvVIP(nametormv,'r'); cb.sendNotice('Ticket Show: You have removed ' + nametormv + ' from ' + VIPname + '.\nNote this is only applied during this session, permanent changes to ' + VIPname + ' must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.', u, appNoticeColor); } else { cb.sendNotice('Ticket Show: ' + nametormv + ' is not on ' + VIPname + '.', u, appNoticeColor); } } else { cb.sendNotice('Ticket Show: You did not specify the username you want to remove from ' + VIPname + '.', u, appNoticeColor); } } else { cb.sendNotice('Ticket Show: Only broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/viplist': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { cb.sendNotice('Users currently on ' + VIPname + ': ' + VIPListArray.length + '\n' + (VIPListArray.length > 0 == true ? cbjs.arrayJoin(VIPListArray, ', ') : 'No users.') + '\nEnd of List', u, appNoticeColor); } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } //******** External Fan Club Commands *********** case '/addfan': { cmd = 1; if (isBC) { if (cmdval != null) { var cmdvalsplit = cmdval.split(listRegExp); if (cmdvalsplit.length > 1) { addnotice = 'Adding multiple users to ' + EFCname + '.'; addnotice += '\nNote this is only applied during this session, permanent changes to ' + EFCname + ' list must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.'; for (var efci = 0; efci < cmdvalsplit.length; efci++) { if (cmdvalsplit[efci] != '') { nametoadd = cmdvalsplit[efci].toLowerCase(); if (!cbjs.arrayContains(extFanListArray, nametoadd)) { addRmvExtFan(nametoadd,'a'); addnotice += '\nAdded ' + nametoadd + ' to ' + EFCname + '.'; cb.sendNotice(u + ' has added you to ' + EFCname + '.', nametoadd, appNoticeColor); } else { addnotice += '\n' + nametoadd + ' is already added to ' + EFCname + '. Skipping.'; } } } addnotice += '\nAll users were added and notified.'; cb.sendNotice(addnotice, u, appNoticeColor); cb.sendNotice(u + ' has added multiple users to ' + EFCname + '.\n' + 'Users added: ' + cbjs.arrayJoin(cmdvalsplit, ', '), '', appNoticeColor, '', 'normal', 'red'); } else { nametoadd = message[1].toLowerCase(); if (cbjs.arrayContains(extFanListArray,nametoadd)) { cb.sendNotice('Ticket Show: ' + nametoadd + ' is already added to ' + EFCname + '.', u, appNoticeColor); } else { addRmvExtFan(nametoadd,'a'); cb.sendNotice('Ticket Show: You have added ' + nametoadd + ' to ' + EFCname + '.\nNote this is only applied during this session, permanent changes to ' + EFCname + ' must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.', u, appNoticeColor); cb.sendNotice('Ticket Show: Congratulations! You have been added to ' + EFCname + '!', nametoadd, appNoticeColor); } } } else { cb.sendNotice('You did not specify the username you want to add to ' + EFCname + '.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/rmvfan': { cmd = 1; if (isBC) { if (message[1]) { nametormv = message[1].toLowerCase(); if (cbjs.arrayContains(extFanListArray,nametormv)) { addRmvExtFan(nametormv,'r'); cb.sendNotice('Ticket Show: You have removed ' + nametormv + ' from ' + EFCname + '.\nNote this is only applied during this session, permanent changes to ' + EFCname + ' must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.', u, appNoticeColor); } else { cb.sendNotice('Ticket Show: ' + nametormv + ' is not in ' + EFCname + '.', u, appNoticeColor); } } else { cb.sendNotice('You did not specify the username you want to remove from ' + EFCname + '.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/fanlist': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { cb.sendNotice('Users currently in ' + EFCname + ': ' + extFanListArray.length + '\n' + (extFanListArray.length > 0 == true ? cbjs.arrayJoin(extFanListArray, ', ') : 'No users.') + '\nEnd of List', u, appNoticeColor); } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } //******** Moderator List Commands *********** case '/addmod': { cmd = 1; if (isBC) { if (cmdval != null) { var cmdvalsplit = cmdval.split(listRegExp); if (cmdvalsplit.length > 1) { addnotice = 'Adding multiple users to the Ticket Show Moderator list.'; addnotice += '\nNote this is only applied during this session, permanent Moderator list changes must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.'; for (var modi = 0; modi < cmdvalsplit.length; modi++) { if (cmdvalsplit[modi] != '') { nametoadd = cmdvalsplit[modi].toLowerCase(); if (!cbjs.arrayContains(moderatorList.name, nametoadd)) { populateModeratorArray(nametoadd,'botmod','a'); addnotice += '\nAdded ' + nametoadd + ' to the Ticket Show Moderator list.'; cb.sendNotice(u + ' has added you to the Ticket Show Moderator list. You now have all moderator privileges, you can view the full command list with the "/tickethelp" command.', nametoadd, appNoticeColor); } else { addnotice += '\n' + nametoadd + ' is already on the Ticket Show Moderator list. Skipping.'; } } } addnotice += '\nAll users were added and notified.'; cb.sendNotice(addnotice, u, appNoticeColor); cb.sendNotice(u + ' has added multiple users to the Ticket Show Moderator list.\n' + 'Users added: ' + cbjs.arrayJoin(cmdvalsplit, ', '), '', appNoticeColor, '', 'normal', 'red'); } else { nametoadd = message[1].toLowerCase(); if (!cbjs.arrayContains(moderatorList.name,nametoadd)) { populateModeratorArray(nametoadd,'botmod','a'); cb.sendNotice('You have added ' + nametoadd + ' to the Ticket Show moderator list.', u, appNoticeColor); cb.sendNotice('Note this is only applied during this session, permanent VIP list changes must be made to the list defined when starting the Ticket Show App. This list should also be saved to a separate document.', u, appNoticeColor); cb.sendNotice(u + ' has added you to the Ticket Show moderator list. You now have all moderator privileges, you can view the full command list with the "/tickethelp" command.', nametoadd, appNoticeColor); } else { cb.sendNotice(nametoadd + ' is already on the Ticket Show moderator list.', u, appNoticeColor); } } } else { cb.sendNotice('You did not specify the username you want to add to the Ticket Show moderator list.', u, appNoticeColor); } } else { cb.sendNotice('Only broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/rmvmod': { cmd = 1; if (isBC) { if (message[1]) { nametormv = message[1].toLowerCase(); if (cbjs.arrayContains(moderatorList.name,nametormv)) { populateModeratorArray(nametormv,'botmod','r'); cb.sendNotice('You have removed ' + nametormv + ' from the Ticket Show Moderator list.', u, appNoticeColor); } else { cb.sendNotice(nametormv + ' is not in the Ticket Show Moderator list.', u, appNoticeColor); } } else { cb.sendNotice('Ticket Show: A parameter is required for this command to specify the user to remove from the Ticket Show Moderator list, such as "/rmvmod username".', u, appNoticeColor); } } else { cb.sendNotice('Ticket Show: Only broadcasters are able to use that command.', u, appNoticeColor); } break; } case '/modlist': { cmd = 1; if (isBC || (isMod && allowModsAuthority == 'Yes')) { message = ''; message += 'Users currently on the Ticket Show Moderator List: '; if (moderatorList.name.length > 0) { for (var modli = 0; modli < moderatorList.name.length; modli++) { message += '\n' + (modli+1) + '. ' + moderatorList.name[modli] + ' (' + moderatorList.type[modli] + ')'; } } else { message += '\nNo moderators currently assigned.'; } message += '\nEnd of List'; cb.sendNotice(message, u, appNoticeColor); } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, appNoticeColor); } break; } //********* Help Menu case '/tickethelp': { cmd = 1; if (isMod || isBC) { helpModBC(message[1],u); } else { helpCommon(message[1],u); } break; } //********* End of Expected commands } if (message[0] == '/chscoreboard' || message[0] == '/chs' || message[0] == '/chfixscore' || message[0] == '/chlength' || message[0] == '/chclearlist' || message[0] == '/chskip' || message[0] == '/chwin' || message[0] == '/chend' || message[0] == '/chstoptimer' || message[0] == '/chfree' || message[0] == '/chword' || message[0] == '/chprice' || message[0] == '/chplay' || message[0] == '/chh' || message[0] == '/chq' || message[0] == '/chlist' || message[0] == '/chi' || message[0] == '/charades' || message[0] == '/randomfree' || message[0] == '/random' || message[0] == '/ri' || message[0] == '/rw' || message[0] == '/badfree' || message[0] == '/badlibs' || message[0] == '/bli' || message[0] == '/blc' || message[0] == '/badprice' || message[0] == '/blw' || message[0] == '/addwho' || message[0] == '/addwhat' || message[0] == '/addwhere' || message[0] == '/addhowlong' || message[0] == '/uapresale' || message[0] == '/uapresales' || message[0] == '/backup' || message[0] == '/ki' || message[0] == '/gbhelp' || message[0] == '/whs' || message[0] == '/rri' || message[0] == '/whi' || message[0] == '/di' || message[0] == '/setusercolor' || message[0] == '/setusernn' || message[0] == '/setusericon' || message[0] == '/pt' || message[0] == '/gbstats' || message[0] == '/wi' || message[0] == '/wf' || message[0] == '/warfree' || message[0] == '/pi' || message[0] == '/pf' || message[0] == '/pressfree' || message[0] == '/pw' || message[0] == '/presswinners' || message[0] == '/ww' || message[0] == '/warwinners' || message[0] == '/cpd' || message[0] == '/chgprizedesc' || message[0] == '/addprize' || message[0] == '/cpp' || message[0] == '/changeprizeprice' || message[0] == '/mpl' || message[0] == '/masterprizelist' || message[0] == '/ap' || message[0] == '/pl' || message[0] == '/presslist' || message[0] == '/stoppress' || message[0] == '/press' || message[0] == '/pp' || message[0] == '/pressprizes' || message[0] == '/war' || message[0] == '/waragain' || message[0] == '/stopwar' || message[0] == '/warprizes' || message[0] == '/wl' || message[0] == '/warlist' || message[0] == '/wd' || message[0] == '/wardraw' || message[0] == '/wp' || message[0] == '/kb' || message[0] == '/freekeno' || message[0] == '/wargame' || message[0] == '/keno' || message[0] == '/kp' || message[0] == '/kpbc' || message[0] == '/rrprice' || message[0] == '/chambers' || message[0] == '/rrp' || message[0] == '/rr' || message[0] == '/rrs' || message[0] == '/shooters' || message[0] == '/wheelspins' || message[0] == '/wheelprice' || message[0] == '/freespin' || message[0] == '/freeroll' || message[0] == '/wheel' || message[0] == '/wheelprizes' || message[0] == '/dice' || message[0] == '/diceprizes' || message[0] == '/diceprice' || message[0] == '/usegraylock' || message[0] == '/chggraytime' || message[0] == '/fbhelp' || message[0] == '/expps' || message[0] == '/pslist' || message[0] == '/subject' || message[0] == '/check' || message[0] == '/pass' || message[0] == '/plist' || message[0] == '/plistw' || message[0] == '/email' || message[0] == '/newshow' || message[0] == '/useraffle' || message[0] == '/uselushmenu' || message[0] == '/usemedia' || message[0] == '/pm' || message[0] == '/reply' || message[0] == '/bc' || message[0] == '/tm' || message[0] == '/tbm' || message[0] == '/silencelevel' || message[0] == '/graphiclevel' || message[0] == '/ninja' || message[0] == '/unninja' || message[0] == '/ninjalist' || message[0] == '/silence' || message[0] == '/unsilence' || message[0] == '/silencelist' || message[0] == '/tipmenu' || message[0] == '/tipmenurequests' || message[0] == '/tipmenuadd' || message[0] == '/tipmenurmv' || message[0] == '/usemenu' || message[0] == '/posmenu' || message[0] == '/posmenurequests' || message[0] == '/posmenuadd' || message[0] == '/posmenurmv' || message[0] == '/useposmenu' || message[0] == '/startclock' || message[0] == '/addtoclock' || message[0] == '/timeleft' || message[0] == '/stopclock' || message[0] == '/cn' || message[0] == '/cnh' || message[0] == '/cnd' || message[0] == '/cndh' || message[0] == '/usenotifier' || message[0] == '/chgmsg1' || message[0] == '/chgmsg2' || message[0] == '/chgmsg3' || message[0] == '/chgmsg4' || message[0] == '/chgmsg5' || message[0] == '/dspmsg' || message[0] == '/leaders' || message[0] == '/useleaderboard' || message[0] == '/usetipcount' || message[0] == '/tippers' || message[0] == '/poll' || message[0] == '/usepoll' || message[0] == '/endpoll' || message[0] == '/restartpoll' || message[0] == '/addvote' || message[0] == '/polloptadd' || message[0] == '/polloptrmv' || message[0] == '/pollstarttimer' || message[0] == '/polladdtime' || message[0] == '/pollstoptimer' || message[0] == '/pollleader' || message[0] == '/addnice' || message[0] == '/rmvnice' || message[0] == '/nicelist' || message[0] == '/addvip' || message[0] == '/rmvvip' || message[0] == '/viplist' || message[0] == '/exportvip' || message[0] == '/addfan' || message[0] == '/rmvfan' || message[0] == '/fanlist' || message[0] == '/exportfans' || message[0] == '/addword' || message[0] == '/rmvword' || message[0] == '/wordlist' || message[0] == '/newsubject' || message[0] == '/dumpsettings' || message[0] == '/checkcolor' || message[0] == '/prepticket' || message[0] == '/dsptlist' || message[0] == '/usetlist' || message[0] == '/exptlist' || message[0] == '/addlbtop' || message[0] == '/addlbamt' || message[0] == '/useticketshow' || message[0] == '/exppresale' || message[0] == '/addpresale' || message[0] == '/rmvpresale' || message[0] == '/chgpresalemode' || message[0] == '/lushmenu' || message[0] == '/uselushmenu' || message[0] == '/chgtoy' || message[0] == '/uselush' || message[0] == '/usedomi' || message[0] == '/usenora' || message[0] == '/media' || message[0] == '/usemedia' || message[0] == '/prizes' || message[0] == '/usedice' || message[0] == '/chgdiceprice' || message[0] == '/dicerolls' || message[0] == '/usealltime' || message[0] == '/top10' || message[0] == '/alltime' || message[0] == '/startprivate' || message[0] == '/stopprivate' || message[0] == '/useraffle' || message[0] == '/entries' || message[0] == '/raffletickets' || message[0] == '/raffleentries' || message[0] == '/previousentries' || message[0] == '/resetraffle' || message[0] == '/clearraffle' || message[0] == '/addraffletkt' || message[0] == '/rmvraffletkt' || message[0] == '/addraffleprize' || message[0] == '/rmvraffleprize' || message[0] == '/raffleprizes' || message[0] == '/setraffleprice' || message[0] == '/raffledrawing' || message[0] == '/rafflestarttimer' || message[0] == '/startraffletimer' || message[0] == '/raffleaddtime' || message[0] == '/addraffletime' || message[0] == '/rafflestoptimer' || message[0] == '/stopraffletimer' || message[0] == '/raffletimeleft' || message[0] == '/chgrafflemode') { cmd = 1; } if (fembotRunning != 'Yes') { if (cmd == 0) { cb.sendNotice(message[0] + ' is not a recognized Ticket Show App command (although it may just be a command for another app or bot).\nType "/tickethelp" to see a full list of the available Ticket Show commands.', u, appNoticeColor); } } } // Highlight background for Ticket show users if (cb.limitCam_userHasAccess(u) && showStage != 'aftershow' && !cbjs.arrayContains(ticketShowPreViewerList, u)) { msg['background'] = ticketHolderBgColor; if (cb.settings.ticketshowEnableIcon == 'Yes') { msg.m = cb.settings.tipLeaderGif1 + msg.m; } } if (cbjs.arrayContains(ticketShowPreViewerList, u)) { msg['background'] = freePreviewerBgColor; } return msg; }); } // *********************************** Actions on user entering ************************************** { cb.onEnter(function(user) { // Variables var u = user.user; var isMod = user.is_mod; var isBC = (u === cb.room_slug); var isFan = user.in_fanclub; var isExtFan = cbjs.arrayContains(extFanListArray,u); var isVIP = cbjs.arrayContains(VIPListArray,u); var isNotGray = user.has_tokens; isBotMod = false; if (isMod) { populateModeratorArray(u,'cbmod','a'); } else { if (cbjs.arrayContains(moderatorList.name,u)) { nameIndex = moderatorList.name.indexOf(u); if (moderatorList.type[nameIndex] == 'botmod') { isBotMod = true; isMod = true; } } } if (isMod) { addRmvModsInShow(u,'a'); } if (isFan) { populateFanClubArray(u); } if (isVIP) { addRmvVIPInShow(u,'a'); } if (isExtFan) { addRmvExtFanInShow(u,'a'); } if (cb.limitCam_userHasAccess(u)) { addViewer(u); if (cbjs.arrayContains(freePreviewUserArray,u)) { addPreViewer(u); } cb.drawPanel(); } // **** Ticket Show functions and message if (!isBC) { if (isMod || isFan || isExtFan || isVIP) { checkFreeTickets(u,isMod,isFan,isExtFan,isVIP,'enter'); } if (cb.limitCam_isRunning()) { if (!cb.limitCam_userHasAccess(u)) { if (ticketShowFanAppreciation == 'Yes') { cb.sendNotice('' + 'Today\'s Ticket Show is a Fan Club Appreciation Show! Only Fan Club Members and VIPs will be admitted to the show.\n' + '', u, ticketBgColor, ticketTxtColor, 'bold'); } else { if (freePreviewLength > 0 && (showStage == 'ticketshow' || showStage == 'showwarn')) { if (!cbjs.arrayContains(freePreviewUserArray,u)) { if ((ticketShowPreviewGrays == 'No' && isNotGray) || ticketShowPreviewGrays == 'Yes') { addRmvPreview('add',u); cb.sendNotice('' + 'Your free preview of the ticket show for ' + freePreviewLengthText + ' has begun.' + '', u, ticketBgColor,ticketTxtColor,'bold'); } } } if (showStage == 'ticketshow') { cb.sendNotice('' + 'The ticket show has been in progress for ' + ((Date.now() - hiddenTime)/60000).toFixed(1) + ' minutes.' + '', u, ticketBgColor,ticketTxtColor,'bold'); if (ticketShowOtToggle == 1) { cb.sendNotice('' + 'The Outstanding Ticket Feature is enabled. You can use the command "/otlist" to see if you have an outstanding ticket. You can use a saved outstanding ticket with the command "/useticket". You can also save your ticket for a future show using the command "/saveticket" if the show has not staretd yet.' + '', u, ticketBgColor, ticketTxtColor, 'bold'); } } else if (showStage == 'showwarn') { cb.sendNotice('' + 'The ticket show has been in progress for ' + ((Date.now() - hiddenTime)/60000).toFixed(1) + ' minutes. The show may be ending soon. Buying a ticket is not recommended, but you may still buy one for ' + ticketPrice + ' tokens.' + '', u, ticketBgColor,ticketTxtColor,'bold'); } else if (showStage == 'showfinale') { cb.sendNotice('' + 'The ticket show has been in progress for ' + ((Date.now() - hiddenTime)/60000).toFixed(1) + ' minutes. The show may be ending soon. Ticket sales have closed, you can no longer buy a ticket.' + '', u, ticketBgColor,ticketTxtColor,'bold'); } } } else { if (cbjs.arrayContains(ticketShowPreViewerList,u)) { cb.sendNotice('' + 'You will be able to see a free preview of the show for 30 seconds.' + '', u, ticketBgColor,ticketTxtColor,'bold'); } } } else { if (showStage == 'ticketsales') { if (ticketShowFanAppreciation == 'Yes') { if (cb.limitCam_userHasAccess(u)) { cb.sendNotice('' + 'Welcome! You have a ticket to the Fan Appreciation show, the show has not yet started.' + '', u, ticketBgColor, ticketTxtColor, 'bold'); } else { cb.sendNotice('' + 'Today\'s Ticket Show is a Fan Club Appreciation Show! Only Fan Club Members and VIPs will be admitted to the show.' + '', u, ticketBgColor, ticketTxtColor, 'bold'); } } else { if (cb.limitCam_userHasAccess(u)) { cb.sendNotice('' + 'Welcome! You have a ticket to the show, the show has not yet started.' + '', u, ticketBgColor, ticketTxtColor, 'bold'); } else { } if (ticketShowAllowGift == 'Yes') { cb.sendNotice('' + 'See commands with /tickethelp.' + '', '', ticketBgColor, ticketTxtColor, 'bold'); } if (ticketShowOtToggle == 1) { cb.sendNotice('' + 'The Outstanding Ticket Feature is enabled. You can use the command "/otlist" to see if you have an outstanding ticket. You can use a saved outstanding ticket with the command "/useticket". You can also save your ticket for a future show using the command "/saveticket" if the show has not started yet.' + '', u, ticketBgColor, ticketTxtColor, 'bold'); } } } else if (showStage == 'aftershow' || ticketShowEnded === true) { cb.sendNotice('' + ' ' + '', u, ticketBgColor, ticketTxtColor, 'bold'); } } } }); } // *********************************** Actions upon leaving ************************************** { cb.onLeave(function(user) { var u = user.user; removeViewer(u); removePreViewer(u); }); } // *********************************** Actions upon Draw Panel ************************************** cb.onDrawPanel(function (user) { var panel = {}; if (customPanel) { panel.template = 'image_template'; panel.row1_label = 'row1_label'; panel.row1_value = 'row1_value'; panel.row2_label = 'row2_label'; panel.row2_value = 'row2_value'; panel.row3_label = 'row3_label'; panel.row3_value = 'row3_value'; } else { panel.template = '3_rows_11_21_31'; } if (ticketShowFanAppreciation == 'Yes') { panel.row1_value = 'Fan Appreciation Ticket Show'; leftjust1 = leftJustify(panel.row1_value,1); panel.row2_value = 'Only Fan Club and VIPs admitted'; leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'Join the Fanclub today to see the show!'; leftjust3 = leftJustify(panel.row3_value,3); } else if (showStage === 'ticketsales') { if (ticketStartMode == 'ticketgoal') { panel.row1_value = 'Ticket Goal \u00A0 \u16EB \u00A0 ' + ticketShowTotalTicketsBought + ' / ' + ticketShowGoalTickets + ' tickets'; leftjust1 = leftJustify(panel.row1_value+'..',1); panel.row2_value = 'Tickets are ' + ticketPrice + ' tokens'; leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'There are currently ' + countTickets + ' ticket holders.'; leftjust3 = leftJustify(panel.row3_value,3); } else if (ticketStartMode == 'tokengoal') { panel.row1_value = 'Token Goal \u00A0 \u16EB \u00A0 ' + ticketShowTotalTips + ' / ' + ticketShowGoalTokens + ' tokens'; leftjust1 = leftJustify(panel.row1_value+'...',1); panel.row2_value = 'Tickets are ' + ticketPrice + ' tokens'; leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'There are currently ' + countTickets + ' ticket holders.'; leftjust3 = leftJustify(panel.row3_value,3); } else if (ticketStartMode == 'timer') { panel.row1_value = 'Timer \u00A0 \u16EB \u00A0 ' + ((ticketSecsRemain > 0 || ticketMinsRemain > 0) ? ticketTimeLeftPanel() : 'Timer not yet started') + ''; leftjust1 = leftJustify(panel.row1_value,1); panel.row2_value = 'Tip ' + ticketPrice + ' tokens for a ticket.'; leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'There are currently ' + countTickets + ' ticket holders.'; leftjust3 = leftJustify(panel.row3_value,3); } else { panel.row1_value = 'Ticket sales are open.'; leftjust1 = leftJustify(panel.row1_value,1); panel.row2_value = 'Tip ' + ticketPrice + ' tokens for a ticket.'; leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'There are currently ' + countTickets + ' ticket holders.'; leftjust3 = leftJustify(panel.row3_value,3); } } else if (showStage == 'showfinale') { panel.row1_value = 'Ticket sales have closed.'; leftjust1 = leftJustify(panel.row1_value,1); if (freePreviewLength > 0 && ticketShowPreViewerList.length > 0) { panel.row2_value = 'Tip ' + ticketPrice + ' tokens for a ticket.'; } else { panel.row2_value = 'Tip ' + ticketPrice + ' tokens for a ticket.'; } leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'There are currently ' + countTickets + ' ticket holders.'; leftjust3 = leftJustify(panel.row3_value,3); } else if (showStage == 'aftershow') { panel.row1_value = ticketShowAfterNotice; leftjust1 = leftJustify(panel.row1_value,1); panel.row2_value = ticketShowAfterNoticeb; leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = ticketShowAfterNoticec; leftjust3 = 100; } else { panel.row1_value = 'Ticket show has started.'; leftjust1 = leftJustify(panel.row1_value,1); if (freePreviewLength > 0 && ticketShowPreViewerList.length > 0) { panel.row2_value = 'Tip ' + ticketPrice + ' tokens for a ticket.'; } else { panel.row2_value = 'Tip ' + ticketPrice + ' tokens for a ticket.'; } leftjust2 = leftJustify(panel.row2_value,2); panel.row3_value = 'There are currently ' + countTickets + ' ticket holders.'; leftjust3 = leftJustify(panel.row3_value,3); } panel.layers = [ {'type': 'image', 'fileID': backgroundImage}, { 'type': 'text', 'text': panel.row1_value, 'top': 17, 'left': 17, 'font-size': fontSize, 'font-weight': 'bold', 'font-family': 'Didot', 'color': textColor, }, { 'type': 'text', 'text': panel.row2_value, 'top': 30, 'left': 17, 'font-size': fontSize, 'font-family': 'Didot', 'color': textColor, }, { 'type': 'text', 'text': panel.row3_value, 'top': 41, 'left': 17, 'font-size': fontSize, 'font-family': 'Didot', 'color': textColor, }, ] return panel; }); // *********************************** Actions upon tipping ************************************** { cb.onTip (function (tip) { var tipAmount = Number.parseInt(tip.amount, 10); var u = tip.from_user var isFan = tip.from_user_in_fanclub; var isExtFan = cbjs.arrayContains(extFanListArray,u); var isVIP = cbjs.arrayContains(VIPListArray,u); // ***** Record tip for goal progress and track total stats recordTip(tipAmount,u,isFan,isExtFan,isVIP); }); } // *********************************** Initialize ************************************** { if (initialize == 0) { var BC = cb.room_slug; if (cb.settings.EFCname != '' && cb.settings.EFCname != null) { EFCname = cb.settings.EFCname; } else { EFCname = 'The External Fan Club'; } if (cb.settings.VIPname != '' && cb.settings.VIPname != null) { VIPname = cb.settings.VIPname; } else { VIPname = 'The VIP List'; } if (cb.settings.bctext != '' && cb.settings.bctext != null) { bctext = cb.settings.bctext; } else { bctext = 'The Broadcaster'; } // *** Init Free Preview Length switch (freePreviewLengthText) { case 'No Preview': { freePreviewLength = 0; break; } case '10 seconds': { freePreviewLength = 10; break; } case '20 seconds': { freePreviewLength = 20; break; } case '30 seconds': { freePreviewLength = 30; break; } case '1 minute': { freePreviewLength = 60; break; } case '2 minutes': { freePreviewLength = 120; break; } case '3 minutes': { freePreviewLength = 180; break; } case '4 minutes': { freePreviewLength = 240; break; } case '5 minutes': { freePreviewLength = 300; break; } } //*** Init OT List for Ticket Show if (cb.settings.ticketShowOTList != '' && cb.settings.ticketShowOTList != null) { var n = cb.settings.ticketShowOTList.toLowerCase(); outstandingTicketArray = n.split(','); } //*** Init External Fan Club List if (cb.settings.extFanList != '' && cb.settings.extFanList != null) { var n = cb.settings.extFanList.toLowerCase(); extFanListArray = n.split(','); } //*** Init VIP List for Ticket Show if (cb.settings.VIPList != '' && cb.settings.VIPList != null) { var n = cb.settings.VIPList.toLowerCase(); VIPListArray = n.split(','); } //*** Init App Mod List if (cb.settings.botModList != '' && cb.settings.botModList != null) { var n = cb.settings.botModList; botModListArray = n.split(','); for (var i = 0; i < botModListArray.length; i++) { populateModeratorArray(botModListArray[i].toLowerCase(), 'botmod', 'a'); } } //*** Initialize Panel if (panelBackground != 'Default') { if (cbjs.arrayContains(backgroundArray.menu,panelBackground)) { newbackground = backgroundArray.command[backgroundArray.menu.indexOf(panelBackground)]; customizePanelBackground(newbackground,BC); customizePanelText('',BC); } else { customPanel = false; cb.sendNotice('A custom panel background was chosen but it does not exist, using the default panel background.', BC, appNoticeColor); } } else { customPanel = false; } initTicketShow(); populateModeratorArray(BC,'broadcaster','a'); initialize = 1; } }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.