Apps Home
|
Create an App
Ticket_Show_Clone
Author:
geohydro99
Description
Source Code
Launch App
Current Users
Created by:
Geohydro99
/** * App: Ticket Show * Version: 1.0.3 * Author: zingknaat * Date: 11.19.14 */ /* $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$$$**$$$$$$$$$**$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$$" ^$$$$$$F *$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$ z$$$$$$L ^$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$ e$$$$$$$$$e J$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$$eee$$$$$$$$$$$$$e$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$$b$$$$$$$$$$$$$$$$$$*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$)$$$$P"e^$$$F$r*$$$$F"$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$$$$d$$$$ "z$$$$" $$$$% $3$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$$*"""*$$$ .$$$$$$ z$$$* ^$e*$$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$" *$$ee$$$$$$$$$$*" $$$C$$$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$. "***$$"*"$$"" $$$$e*$$$$$$$$$$$$$$$$$$$$$$$$$$ $$$$$$$$$$$$$$$b "$b.$$" $$$$$b"$$$$$$$$$$$$$$$$$$$$$$$$$ $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$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$Gilo94'$$$$ */ cb.settings_choices = [ { name: 'price', type: 'int', minValue: 1, label: 'How much do you want to charge for your show?', defaultValue: 50, required: true }, { name: 'show_name', type: 'str', label: 'What type of show is this?', defaultValue: 'cum show', required: true }, { name: 'free_show_for_mods', type: 'choice', label: 'Let your hardworking mods watch for free?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', required: true }, { name: 'start_show_countdown', type: 'choice', label: 'When do you want to start the show? (in minutes)', choice1: '5', choice2: '10', choice3: '15', choice4: '20', choice5: '25', choice6: '30', choice7: '35', choice8: '40', choice9: '45', choice10: '50', choice11: '55', choice12: '60', defaultValue: '30', required: true }, { name: 'silence_grays', type: 'choice', label: 'Silence grays (people with no tokens)?', choice1: 'Yes', choice2: 'No', required: true } ]; // global vars var timeLeft = 0; var minsShowStarts = 0; var showStarted = false; var showEnded = false; var showStartTime = new Date(); var showEndTime = new Date(); var tipCounter = 0; var langTokens = (cb.settings.price > 1) ? 'tokens' : 'token'; cb.onTip(function (tip) { if (parseInt(tip['amount']) >= cb.settings.price) { if (!cbjs.arrayContains(cb.limitCam_allUsersWithAccess(), tip['from_user'])) { cb.limitCam_addUsers([tip['from_user']]); cb.sendNotice(tip['from_user'] + ' has been added to the Ticket Show\'s guestlist!', '', '#00A300', '#FFFFFF'); } } tipCounter += parseInt(tip['amount']); cb.drawPanel(); }); cb.onDrawPanel(function (user) { var guestList = cb.limitCam_allUsersWithAccess(); if (!showStarted && !showEnded) { return { 'template': '3_rows_of_labels', 'row1_label': 'Ticket Show Price:', 'row1_value': cb.settings.price + ' ' + langTokens, 'row2_label': 'Viewers (Bank):', 'row2_value': guestList.length + ' (' + tipCounter + ')', 'row3_label': 'Show Starts In:', 'row3_value': getTimeLeft() }; } else if (showStarted && !showEnded) { return { 'template': '3_rows_of_labels', 'row1_label': 'Ticket Show Price:', 'row1_value': cb.settings.price, 'row2_label': 'Viewers / Bank', 'row2_value': guestList.length + ' / ' + tipCounter, 'row3_label': 'Show Started At:', 'row3_value': showStartTime.toTimeString() }; } else if (showEnded) { var timeDelta = showEndTime - showStartTime; var timeDeltaSecs = timeDelta / 1000; var showLength = secondsToHms(timeDeltaSecs); return { 'template': '3_rows_12_22_31', 'row1_label': 'Bank:', 'row1_value': tipCounter, 'row2_label': 'Show Length:', 'row2_value': showLength, 'row3_value': 'Ticket Show Ended' }; } }); cb.onEnter(function (user) { advertise(user['user']); }); cb.onMessage(function (msg) { if (cb.room_slug === msg['user'] && msg['m'].match(/\/startshow/i) && !cb.limitCam_isRunning()) { msg['X-Spam'] = true; startShow(); } else if (cb.room_slug === msg['user'] && msg['m'].match(/\/stopshow/i)) { msg['X-Spam'] = true; stopShow(); } else if (cb.room_slug === msg['user'] && msg['m'].match(/\/restartapp/i)) { msg['X-Spam'] = true; resetShow(); } else if (msg['m'].match(/\/guestlist/i)) { msg['X-Spam'] = true; showGuestList(msg['user']) } else { var guestList = cb.limitCam_allUsersWithAccess(); if (cbjs.arrayContains(guestList, msg['user']) || (msg['user'] == cb.room_slug)) { if (cb.limitCam_isRunning()) { cb.sendNotice(msg['user'] + ': ' + msg['m'], cb.room_slug, '', '', 'bold'); for (var i = 0; i < guestList.length; i++) { if (msg['user'] != guestList[i]) { cb.sendNotice(msg['user'] + ': ' + msg['m'], guestList[i], '', '', 'bold'); } } msg['X-Spam'] = true; } else { if (cb.room_slug != msg['user']) { msg['m'] = ':tkt1 ' + msg['m']; msg['background'] = '#DAFFFF'; } } } else { if (cb.limitCam_isRunning() && (msg['user'] != cb.room_slug)) { msg['X-Spam'] = true; cb.sendNotice('Sorry! Only ticket holders may chat until the Ticket Show is over. You can still buy in though. :)', msg['user'], '', '#CC0000', 'bold'); } if(!cbjs.arrayContains(guestList, msg['user']) && msg['is_mod'] && (cb.settings.free_show_for_mods == 'Yes')) { cb.limitCam_addUsers([msg['user']]); cb.sendNotice(msg['user'] + ' has been added to the Ticket Show\'s guestlist because my mods are awesome!', '', '#00A300', '#FFFFFF'); } if(!msg['has_tokens'] && (cb.settings.silence_grays == 'Yes')) { msg['X-Spam'] = true; cb.sendNotice('Sorry! Only people with tokens may chat while the Ticket Show is running. Feel free to buy some tokens.', msg['user'], '', '', 'bold'); } } } return msg; }); function advertise(username) { var notices = "Ticket Show by zingknaat \n"; notices += "Today's show: " + cb.settings.show_name + "\n"; if (!showStarted) { notices += "The show will start in " + getTimeLeft() + " \n"; } else { notices += "The show started at " + showStartTime.toTimeString() + " \n"; } notices += "Tip " + cb.settings.price + " " + langTokens + " to join the show. \n"; notices += "Type /guestlist to see who'll be joining the show. "; if (!showEnded && !showStarted) { cb.sendNotice(notices, username, '', '#0000FF', 'bold'); if(username == undefined) { var notices2 = 'Type /startshow to start the show manually \n'; notices2 += 'Type /stopshow to end the show \n'; notices2 += 'Type /restartapp to restart the app without deactivating it first'; cb.sendNotice(notices2, cb.room_slug, '', '#0000FF', 'bold'); } } } function secondsToHms(d) { d = Number(d); var h = Math.floor(d / 3600); var m = Math.floor(d % 3600 / 60); var s = Math.floor(d % 3600 % 60); return ((h > 0 ? h + ' hrs ' : '') + (m > 0 ? (h > 0 && m < 10 ? '0' : '') + m + ' mins ' : ' ') + (s < 10 ? '0' : '') + s + ' secs'); } function getTimeLeft() { if (timeLeft > 0) return secondsToHms(timeLeft); return 0; } function updateTimeLeft() { if (timeLeft > 0 && !showEnded) { if (timeLeft >= 5) { timeLeft -= 5; cb.setTimeout(updateTimeLeft, 5000); } cb.drawPanel(); if (timeLeft % 180 == 0) advertise(); if (timeLeft == 60) { cb.sendNotice('Ticket Show starts in 1 minute. LAST CALL!!!', '', '#FF0000', '#FFFFFF', 'bold'); } else if (timeLeft % 60 == 0) { cb.sendNotice('Ticket Show starts in ' + secondsToHms(timeLeft) + '.', '', '#FFFFAA', '#000000', 'bold'); } } else { if(!showStarted && !showEnded) { var guestList = cb.limitCam_allUsersWithAccess(); if (guestList.length > 0) { startShow(); } else { resetShow(); } } } } function resetShow() { cb.sendNotice('Ticket Show has been reset.', '', '#E0FFE0', '#000000', 'bold'); stopShow(); showStartTime = new Date(); showEnded = false; tipCounter = 0; init(); } function startShow() { showStarted = true; showEnded = false; timeLeft = 0; showStartTime = new Date(); cb.drawPanel(); if (!cb.limitCam_isRunning()) { cb.limitCam_start('Ticket Show is in progress. Tip ' + cb.settings.price + ' to join the show. Otherwise, thanks for visiting!'); } var msg = 'Ticket Show Started!\n'; msg += 'Only ticket holders will be able to chat.'; cb.sendNotice(msg, '', '#0099FF', '#FFFFFF', 'bold') } function stopShow() { if (showStarted) { var msg = 'Ticket Show Ended!\n'; msg += 'Big thank you to all of the ticket holders!'; cb.sendNotice(msg, '', '#9933FF', '#FFFFFF', 'bold'); } showStarted = false; showEnded = true; showEndTime = new Date(); var guestList = cb.limitCam_allUsersWithAccess(); if (guestList.length > 0) cb.limitCam_removeAllUsers(); if (cb.limitCam_isRunning()) cb.limitCam_stop(); cb.drawPanel(); cb.changeRoomSubject('Ticket Show Ended'); } function showGuestList(username) { var guestList = cb.limitCam_allUsersWithAccess(); var rowNum = 1; var msg = '#### TICKET SHOW GUEST LIST ####'; for (var i = 0; i < guestList.length; i++) { msg += "\n" + rowNum + ") " + guestList[i]; rowNum++; } cb.sendNotice(msg, username); } function init() { cb.changeRoomSubject('Ticket Show: ' + cb.settings.show_name + ' (' + cb.settings.price + ' ' + langTokens + ')'); minsShowStarts = parseInt(cb.settings.start_show_countdown); timeLeft = minsShowStarts * 60; advertise(); cb.setTimeout(updateTimeLeft, 5000); } init();
© Copyright Freesexcam 2011- 2024. All Rights Reserved.