Apps Home
|
Create an App
asfdaf
Author:
crazytipper123
Description
Source Code
Launch App
Current Users
Created by:
Crazytipper123
/* ******************************************************* * Title: KarenShow * Author: Ryan * ******************************************************* */ // vars var gEnableShow = true; var gTotalTipToday = 0; var gPrizeTipJar = 0; // NOTE: if user opt out from prizes, their tip doesnt get added into tip jar var gHighTipUsername = null; var gHighTipAmount = 0; var last_tip_username = null; var TIME_ONE_SEC = 1000; var TIME_ONE_MINUTE = 60 * TIME_ONE_SEC; var CONFIG_ADVERT_MINUTES = 1 * TIME_ONE_MINUTE; var EMOTE_STAR = ' :star_olivia_dellvine '; var EMOTE_STARS = EMOTE_STAR + EMOTE_STAR + EMOTE_STAR; var gOptOutList = new Array(); var gHashTag = '#karen #dice #show #cute #sexy #hot #bigroundeye #beautiful #pvt'; var gUsingLovense = false; var gUsingCrazyShow = false; var gSpecialUser = 'raccoon_pig'; var gShowSubject = true; // requires resetting too var playerStats = {}; var gameStats = {firstplace: '',secondplace: '',thirdplace: '',firsttips: 0,secondtips: 0,thirdtips: 0}; var gCurrentCommandArg = new Array(); // i'm abusing global variable here, this is used to store current command argument (only valid during command parsing) // you need to populate this, refer to init() for more information var gAdvertInformation = new Array(); var gCommandInformation = new Array(); // Karen show variable var gAddViewerCommand = '/addticket'; var gRemoveViewerCommand = '/removeticket'; var gSetGoalCommand = '/setgoal'; var gSetExtendGoalCommand = '/setextendgoal'; var gSetExtendLengthCommand = '/setextendlength'; var gSetTicketGoalCommand = '/setticketgoal'; var gSetShowLengthCommand = '/setshowlength'; var gSetTicketShowLengthCommand = '/setticketshowlength'; var gSetTicketShowTextCommand = '/setticketshowtext'; var gSetShowTextCommand = '/setshowtext'; var gSetTicketPrice1 = '/setticket1'; var gSetTicketPrice2 = '/setticket2'; var gKarenGoalTarget = 800; // the token required to hit each goal var gKarenShowLength = 10 * 60; // set our initial karen show length var gKarenShowCurrentLength = gKarenShowLength; // set our current karen show length var gKarenShowStarted = false; var gKarenShowPaused = false; // used to force timer to pause, in case karen needs to go off for a while var gKarenCurrentGoalTarget = 0; var gKarenShowExtendGoal = 1; // has command to set this var gKarenShowExtendLength = 1; // has command to set this var gKarenShowCurrentExtendGoal = 0; var gTicketShowGoal = 200; // the cost to trigger crazy ticket show var gTicketShowLength = 20 * 60; // show length in minutes var gKarenShowText = 'Panties off Dance Show'; // karen public show text var gLotteryPrize = 'Naked Cum Show'; // current lottery prize var gTicketShowText = gLotteryPrize; // the text used for current ticket show (indicate what kind of show it is) var gLotteryCost = 399; // cost of each lottery ticket var gTicketShowCost = [ gLotteryCost, gLotteryCost ]; // ticket cost differently depending on which stage we are in, before goal is hit and after goal is hit // lottery var gLotteryTicketCount = 5; // minimum number of ticket to be sold var gLotteryTicketHolder = new Array(); // holds an array of all lottery ticket holder (reset each round) var gIsLotteryMode = true; // indicate if we are in lottery mode /* SETTINGS */ cb.settings_choices = [ /**** SETTINGS ****/ { name: 'roomSubject', label: 'Room Subject', type: 'str', minLength: 0, maxLength: 100, required: true, defaultValue: 'Topless dance show'}, { name: 'goalAmount', label: 'Token to Goal', type: 'int', minValue: 1, defaultValue: 555 }, { name: 'showLength', label: 'Show Length (in minutes)', type: 'int', minValue: 1, defaultValue: 10 }, ]; /* ON TIP */ cb.onTip(function (tip) { if(gEnableShow) { last_tip_username = tip['from_user']; gTotalTipToday += tip['amount']; if(tip['amount'] > gHighTipAmount) { gHighTipAmount = tip['amount']; gHighTipUsername = tip['from_user']; } //IncrementAdvertMessagesCount(); if (last_tip_username in playerStats) { playerStats[last_tip_username].totaltips += tip['amount'] } else { playerStats[last_tip_username] = { totaltips: tip['amount'] } } // update tip statistic trackTips(last_tip_username, tip['amount']); if(inArray(last_tip_username, gOptOutList)) { notify(last_tip_username + ' opt out from prizes, tips will be ignored, type \'/opt\' to opt in/out from prizes'); } else { handleLotteryTicket(tip['amount'], tip['from_user']); handleKarenShowTip(tip['amount'], tip['from_user']); } cb.drawPanel(); } }); function handleLotteryTicket(tip, user) { if(gIsLotteryMode) { // ensure user tip enough if(tip >= gLotteryCost) { addUser(user); // give that fellow a ticket gLotteryTicketHolder.push(user); // add user to the ticket holder list if(gLotteryTicketHolder.length < gLotteryTicketCount) { notify(EMOTE_STARS + user + EMOTE_STARS + ' purchased a ticket!!! Ticket left to start show: ' + (gLotteryTicketCount - gLotteryTicketHolder.length)); notify('Show will start after all tickets are sold: ' + gLotteryPrize); } else if(gLotteryTicketHolder.length == gLotteryTicketCount) { notify(user + ' purchased a ticket!!! We met the minimum ticket requirement! Ticket show will start soon!'); } notify('Thanks for purchasing the ticket!!!', user, '#FFFFFF', '#FF0000'); } } } /* DRAW PANEL */ cb.onDrawPanel(function (user) { if(gEnableShow) { var timeInMinutes = Math.floor(gKarenShowCurrentLength/60); var timeInSeconds = gKarenShowCurrentLength % 60; var timeLeftText = timeInMinutes + ' min ' + timeInSeconds + ' sec'; var showStatus = ''; // if host not in room, pause the show if(!gKarenShowPaused) { showStatus += 'Started' } else { showStatus += 'Paused' } if(!gUsingCrazyShow) { if(gKarenShowStarted) { return { 'template': '3_rows_of_labels', 'row1_label': 'Time Left: ', 'row1_value': timeLeftText, 'row2_label': 'Next clothing off in: ', 'row2_value': (gKarenGoalTarget - gKarenCurrentGoalTarget) + ' tokens', 'row3_label': 'Show Status: ', 'row3_value': showStatus } } else { return { 'template': '3_rows_of_labels', 'row1_label': 'Start Show in: ', 'row1_value': (gKarenGoalTarget - gKarenCurrentGoalTarget) + ' tokens', 'row2_label': 'Initial Show Length: ', 'row2_value': timeLeftText, 'row3_label': 'Goal: ', 'row3_value': gKarenShowText } } } else { if(!gKarenShowStarted) { // type of show, show length and goal to start return { 'template': '3_rows_of_labels', 'row1_label': 'Crazy Ticket Show in: ', 'row1_value': (gTicketShowGoal - gKarenCurrentGoalTarget) + ' tokens', 'row2_label': 'Initial Show Length: ', 'row2_value': timeLeftText, 'row3_label': 'Show Type: ', 'row3_value': gTicketShowText } } else { // type of show and show length return { 'template': '3_rows_of_labels', 'row1_label': 'Time Left: ', 'row1_value': timeLeftText, 'row2_label': 'Show Type: ', 'row2_value': gTicketShowText, 'row3_label': 'Show Status: ', 'row3_value': showStatus } } } } }); /* START OF GAME SPECIFIC FUNCTION */ function handleKarenShowTip(tipAmount, user) { gKarenCurrentGoalTarget += tipAmount; if(!gUsingCrazyShow) { // if show yet to start if(!gKarenShowStarted) { // start our show if(gKarenCurrentGoalTarget >= gKarenGoalTarget) { gKarenCurrentGoalTarget = 0; // reset the variable gKarenShowStarted = true; gKarenShowPaused = false; gKarenShowCurrentLength = gKarenShowLength; notify(':goall :showtime_', null, '#FFFFFF', '#000000', null); notify(':goall :showtime_', null, '#FFFFFF', '#000000', null); notify(':goall :showtime_', null, '#FFFFFF', '#000000', null); } updateSubject(); } else { gKarenShowCurrentExtendGoal += tipAmount; // check how much time this tip will extend (if any) var secondToIncrease = 0; while(gKarenShowCurrentExtendGoal >= gKarenShowExtendGoal) { gKarenShowCurrentExtendGoal -= gKarenShowExtendGoal; secondToIncrease += gKarenShowExtendLength; } if(secondToIncrease > 0) { gKarenShowCurrentLength += secondToIncrease; notify(':time-extended1 ' + user + ' tipping has added ' + secondToIncrease + ' seconds to Karen Show!!!', null, '#FFFFFF', '#FF0000', null); } // check if we hit our goal if(gKarenCurrentGoalTarget >= gKarenGoalTarget) { gKarenCurrentGoalTarget = 0; // reset the variable notify(EMOTE_STARS + ':goalreached3 Another clothing will be taken off (if there is any left)' + EMOTE_STARS, null, '#FFFFFF', '#000000', null); } updateSubject(); } } else { // if goal yet to hit if(!gKarenShowStarted) { // start our show if(gKarenCurrentGoalTarget >= gTicketShowGoal) { gKarenCurrentGoalTarget = 0; // reset the variable gKarenShowStarted = true; gKarenShowPaused = true; gKarenShowCurrentLength = gTicketShowLength; notify(':goall :ticketshow1', null, '#FFFFFF', '#000000', null); notify(':goall :ticketshow1', null, '#FFFFFF', '#000000', null); notify(':goall :ticketshow1', null, '#FFFFFF', '#000000', null); } // ensure it meet token criteria if(tipAmount >= gTicketShowCost[0]) { // add user if he doesn't has access if(!cb.limitCam_userHasAccess(user)) { cb.limitCam_addUsers(user); // NOTE: depending on whether we hit the goal, we need to display a different ticket price notify(':crazyticketsoldto ' + user + ' :tickets123 @' + (gKarenShowStarted? gTicketShowCost[1]: gTicketShowCost[0]) + ' token'); } else { notify('You already owned a ticket to the show', user); } } updateSubject(); } else { gKarenShowCurrentExtendGoal += tipAmount; // ensure it meet token criteria if(tipAmount >= gTicketShowCost[1]) { // add user if he doesn't has access if(!cb.limitCam_userHasAccess(user)) { cb.limitCam_addUsers(user); notify(':crazyticketsoldto ' + user + ' :tickets123 @' + gTicketShowCost[1] + ' token'); } else { notify('You already owned a ticket to the show', user); } } } } } /* Initialization */ function init() { gKarenShowText = cb['settings']['roomSubject']; gKarenGoalTarget = cb['settings']['goalAmount']; gKarenShowLength = cb['settings']['showLength'] * 60; // this ensure app restart doesn't screw up gHighTipUsername = null; gHighTipAmount = 0; last_tip_username = null; // you need to populate this gAdvertInformation = new Array(); gCommandInformation = new Array(); playerStats = {}; initCommand(); // setup our jackpot prizes var currPool = 0; // initialize our required information for notification // it's given in a key value pair where key refers to the function to trigger the notification // intialTimer refers to the initial timer before it's fired // periodicTimer refers to the periodic timer after the first firing // minMsgCount refers to the minimum number of messages before the message can fire (this prevent us from spamming the room when no one is typing) // maxNoFireCount refers to the max number of time we can avoid firing the notification before we will force it to fire gAdvertInformation[advertGamerules] = { initialTimer: 0.1 * CONFIG_ADVERT_MINUTES, periodicTimer: CONFIG_ADVERT_MINUTES, minMsgCount: 20, maxNoFireCount: 4}; gAdvertInformation[advertKarenShowCountdown] = { initialTimer: TIME_ONE_SEC, periodicTimer: TIME_ONE_SEC, minMsgCount: 0, maxNoFireCount: 0 }; gAdvertInformation[advertLeaderboard] = { initialTimer: 0.5 * CONFIG_ADVERT_MINUTES, periodicTimer: CONFIG_ADVERT_MINUTES, minMsgCount: 10, maxNoFireCount: 7 }; // start our periodic timer // automatically initialize those required variable, this is basically constructor in c++ class for (var key in gAdvertInformation) { if (gAdvertInformation.hasOwnProperty(key)) { gAdvertInformation[key].currentMsgCount = 0; // number of msg we have seen since we last fire it gAdvertInformation[key].missedFireCount = gAdvertInformation[key].maxNoFireCount; // number of time we skipped firing the messages (set to max to ensure it's fired) } } cb.setTimeout(advertLeaderboard, gAdvertInformation[advertLeaderboard].initialTimer); cb.setTimeout(advertGamerules, gAdvertInformation[advertGamerules].initialTimer); cb.setTimeout(advertKarenShowCountdown, gAdvertInformation[advertKarenShowCountdown].initialTimer); updateSubject(); } init(); /* Helper function */ function initCommand() { gCommandInformation = new Array(); // initialize our command information // public command gCommandInformation['/help'] = { callBackFcn: handleHelpCommand, userGroupCallBackFcn: checkIsViewer, helpText: 'display all available command in KarenKeno' }; gCommandInformation['/leaderboard'] = { callBackFcn: handleLeaderBoardCommand, userGroupCallBackFcn: checkIsViewer, helpText: 'display KarenKeno Leaderboard' }; gCommandInformation['/opt'] = { callBackFcn: handleOptCommand, userGroupCallBackFcn: checkIsViewer, helpText: 'Opt in or out of prize' }; // privilege user command gCommandInformation['/helpall'] = { callBackFcn: handleHelpCommandAll, userGroupCallBackFcn: checkHasPrivileges, helpText: 'send /help to everyone' }; gCommandInformation['/hashtaglovense'] = { callBackFcn: handleToggleHashtagLovense, userGroupCallBackFcn: checkHasPrivileges, helpText: 'Toggle hashtag for lovense' }; gCommandInformation['/pause'] = { callBackFcn: handleKarenShowPause, userGroupCallBackFcn: checkHasPrivileges, helpText: 'Toggle pausing for Karen show' }; gCommandInformation['/leaderboardall'] = { callBackFcn: handleLeaderBoardCommandAll, userGroupCallBackFcn: checkHasPrivileges, helpText: 'send /leaderboard to everyone' }; // host command gCommandInformation['/totaltoken'] = { callBackFcn: handleTotalTokenCommand, userGroupCallBackFcn: checkIsHost, helpText: 'show total token gained so far' }; gCommandInformation['/ticketshow'] = { callBackFcn: handleToggleTicketShow, userGroupCallBackFcn: checkIsHost, helpText: 'Toggle crazy ticket show' }; gCommandInformation['/start'] = { callBackFcn: handleTicketStartShow, userGroupCallBackFcn: checkIsHost, helpText: 'Start our ticket show' }; gCommandInformation['/forcestart'] = { callBackFcn: handleTicketForceStartShow, userGroupCallBackFcn: checkIsHost, helpText: 'Force ticket show to start' }; gCommandInformation['/forceend'] = { callBackFcn: handleTicketForceEndShow, userGroupCallBackFcn: checkIsHost, helpText: 'Force ticket show to end' }; gCommandInformation['/ticketlist'] = { callBackFcn: handleTicketShowList, userGroupCallBackFcn: checkIsHost, helpText: 'Ticket viewer list' }; gCommandInformation['/toggleshowsubject'] = { callBackFcn: handleToggleUseSubject, userGroupCallBackFcn: checkIsHost, helpText: 'Toggle usage of show subject' }; gCommandInformation['/enableshow'] = { callBackFcn: handleEnableShow, userGroupCallBackFcn: checkIsHost, helpText: 'Hidden command' }; gCommandInformation[gAddViewerCommand] = { callBackFcn: handleTicketAdd, userGroupCallBackFcn: checkIsHost, helpText: 'Add viewer to ticket show' }; gCommandInformation[gRemoveViewerCommand] = { callBackFcn: handleTicketRemove, userGroupCallBackFcn: checkIsHost, helpText: 'Remove viewer from ticket show' }; gCommandInformation[gSetGoalCommand] = { callBackFcn: handleGoalTargetCommand, userGroupCallBackFcn: checkIsHost, helpText: '\'' + gSetGoalCommand + ' <new_amount>\' will change our goal target to new_amount of token' }; gCommandInformation[gSetExtendGoalCommand] = { callBackFcn: handleExtendGoalCommand, userGroupCallBackFcn: checkIsHost, helpText: '\'' + gSetExtendGoalCommand + ' <new_amount>\' will change our goal extension target to new_amount of token' }; gCommandInformation[gSetExtendLengthCommand] = { callBackFcn: handleExtendLengthCommand, userGroupCallBackFcn: checkIsHost, helpText: '\'' + gSetExtendLengthCommand + ' <new_amount>\' will change our goal extension length to new_amount' }; gCommandInformation[gSetTicketGoalCommand] = { callBackFcn: handleTicketGoalTargetCommand, userGroupCallBackFcn: checkIsHost, helpText: '\'' + gSetTicketGoalCommand + ' <new_amount>\' will change our ticket goal target to new_amount of token' }; gCommandInformation[gSetShowLengthCommand] = { callBackFcn: handleSetShowLengthCommand, userGroupCallBackFcn: checkIsHost, helpText: '\'' + gSetShowLengthCommand + ' <new_amount>\' will change our show length to new_amount' }; gCommandInformation[gSetTicketShowLengthCommand] = { callBackFcn: handleSetTicketShowLengthCommand, userGroupCallBackFcn: checkIsHost, helpText: '\'' + gSetTicketShowLengthCommand + ' <new_amount>\' will change our ticket show length to new_amount' }; gCommandInformation[gSetTicketShowTextCommand] = { callBackFcn: handleSetTicketShowTextCommand, userGroupCallBackFcn: checkIsHost, helpText: '\'' + gSetTicketShowTextCommand + ' <new_text>\' will change our ticket show text to new_text' }; gCommandInformation[gSetShowTextCommand] = { callBackFcn: handleSetShowTextCommand, userGroupCallBackFcn: checkIsHost, helpText: '\'' + gSetShowTextCommand + ' <new_text>\' will change our show text to new_text' }; gCommandInformation[gSetTicketPrice1] = { callBackFcn: handleSetTicketPrice1Command, userGroupCallBackFcn: checkIsHost, helpText: '\'' + gSetTicketPrice1 + ' <new_amount>\' will change our ticket price' }; gCommandInformation[gSetTicketPrice2] = { callBackFcn: handleSetTicketPrice2Command, userGroupCallBackFcn: checkIsHost, helpText: '\'' + gSetTicketPrice2 + ' <new_amount>\' will change our ticket price' }; } // recurring advertisement on how to play karen jackpot function advertGamerules() { var text = 'Karen Show:\n'; if(!gUsingCrazyShow) { // if not started, inform them to start the show and the goal after that if(!gKarenShowStarted) { text += 'Once we hit goal: :alessdance ' + gKarenShowText + ' :alessdance\n'; text += 'After the show has started, each goal will take off another clothing\n'; text += 'Tipping will also increase show length!\n'; } // after show started, tell them that they can increase show length by tipping else { text += 'Hitting the next goal will take off another clothing!\n'; text += 'Tip to increase show length!\n'; text += 'Every ' + gKarenShowExtendGoal + ' token add ' + gKarenShowExtendLength + ' second to show length. Group tipping is enabled!\n'; } if(gIsLotteryMode && !gUsingCrazyShow && gLotteryTicketHolder.length < gLotteryTicketCount) { text += '\nTipping ' + gLotteryCost + ' token or more gets you a ticket.\n'; text += gLotteryPrize + ' will start after all tickets are sold: ' + (gLotteryTicketCount - gLotteryTicketHolder.length) + ' ticket left.\n'; text += 'Type \'/opt\' to opt in/out from prizes\n'; } } else { // if not started, inform them to start the show if(!gKarenShowStarted) { text += 'Crazy Ticket Show: ' + gTicketShowText + '\n'; text += 'Tip ' + gTicketShowCost[0] + ' token for a ' + (gTicketShowLength/60) + ' minutes ticket show\n'; if(gTicketShowCost[0] != gTicketShowCost[1]) { text += 'After we hit the goal, each ticket would cost ' + gTicketShowCost[1] + ' token!!!\n'; } } // after show started, tell them that they can increase show length by tipping else { text += 'Tip ' + gTicketShowCost[1] + ' token to get a ticket\n'; } } handleAdvertFiring(text, '', '', '', 'bold', advertGamerules); } function advertKarenShowCountdown() { var text = ''; // only subtract timer if show has started and is not currently paused if(gKarenShowStarted && !gKarenShowPaused) { gKarenShowCurrentLength -= 1; // drop timer by 1 second if(gKarenShowCurrentLength == 0) { gUsingCrazyShow = false; // we always force crazy show to end gKarenShowCurrentLength = gKarenShowLength; // reset gKarenCurrentGoalTarget = 0; // reset our goal too gKarenShowStarted = false; // end our show gKarenShowCurrentExtendGoal = 0; if(!gUsingCrazyShow) { notify(':thatsallfolks Tip to start the next show!', null, '#FFFFFF', '#000000', null); notify(':thatsallfolks Tip to start the next show!', null, '#FFFFFF', '#000000', null); notify(':thatsallfolks Tip to start the next show!', null, '#FFFFFF', '#000000', null); } else { notify(':thatsallfolks :bysexie74_thankswatching', null, '#FFFFFF', '#000000', null); notify(':thatsallfolks :bysexie74_thankswatching', null, '#FFFFFF', '#000000', null); notify(':thatsallfolks :bysexie74_thankswatching', null, '#FFFFFF', '#000000', null); } updateSubject(); } // everytime we update timer, we need to update the draw panel to ensure our show timer is properly updated cb.drawPanel(); } handleAdvertFiring(text, '', '', '', 'bold', advertKarenShowCountdown); } function handleToggleHashtagLovense(msg) { gUsingLovense = !gUsingLovense; updateSubject(); } function handleKarenShowPause(msg) { gKarenShowPaused = !gKarenShowPaused; notify('Karen show pause: ' + gKarenShowPaused, 'roomHost', '#FFFFFF', '#FF0000'); // if show has started, the pausing indicator on draw panel will automatically be updated updateSubject(); } function handleGoalTargetCommand(msg) { var text = msg['m']; msg['X-Spam'] = true; // we want to hide this command from showing up // first strip out the command then parse it as a integer var newGoalVal = parseInt(text.substr(gSetGoalCommand.length)); if(newGoalVal != 0) { gKarenGoalTarget = newGoalVal; notify('Karen show goal changed to: ' + gKarenGoalTarget, 'roomHost', '#FFFFFF', '#FF0000'); // everytime we update this we need to update subject and drawboard updateSubject(); } else { notify('Use only integer for goal', 'roomHost'); } } function handleSetTicketPrice1Command(msg) { var text = msg['m']; msg['X-Spam'] = true; // we want to hide this command from showing up // first strip out the command then parse it as a integer var newGoalVal = parseInt(text.substr(gSetTicketPrice1.length)); if(newGoalVal != 0) { gTicketShowCost[0] = newGoalVal; notify('Ticket price (before goal) changed to: ' + newGoalVal, 'roomHost', '#FFFFFF', '#FF0000'); // everytime we update this we need to update subject and drawboard updateSubject(); } else { notify('Use only integer for goal', 'roomHost'); } } function handleSetTicketPrice2Command(msg) { var text = msg['m']; msg['X-Spam'] = true; // we want to hide this command from showing up // first strip out the command then parse it as a integer var newGoalVal = parseInt(text.substr(gSetTicketPrice1.length)); if(newGoalVal != 0) { gTicketShowCost[1] = newGoalVal; notify('Ticket price (after goal) changed to: ' + newGoalVal, 'roomHost', '#FFFFFF', '#FF0000'); // everytime we update this we need to update subject and drawboard updateSubject(); } else { notify('Use only integer for goal', 'roomHost'); } } function handleTicketGoalTargetCommand(msg) { var text = msg['m']; msg['X-Spam'] = true; // we want to hide this command from showing up // first strip out the command then parse it as a integer var newGoalVal = parseInt(text.substr(gSetTicketGoalCommand.length)); if(newGoalVal != 0) { gTicketShowGoal = newGoalVal; notify('Karen show goal changed to: ' + gTicketShowGoal, 'roomHost', '#FFFFFF', '#FF0000'); // everytime we update this we need to update subject and drawboard updateSubject(); } else { notify('Use only integer for goal', 'roomHost'); } } function handleExtendLengthCommand(msg) { var text = msg['m']; msg['X-Spam'] = true; // we want to hide this command from showing up // first strip out the command then parse it as a integer var newGoalVal = parseInt(text.substr(gSetExtendLengthCommand.length)); if(newGoalVal != 0) { gKarenShowExtendLength = newGoalVal; notify('Extend length changed to: ' + gKarenShowExtendLength, 'roomHost', '#FFFFFF', '#FF0000'); } else { notify('Use only integer for goal', 'roomHost'); } } function handleSetShowLengthCommand(msg) { var text = msg['m']; msg['X-Spam'] = true; // we want to hide this command from showing up // first strip out the command then parse it as a integer var newGoalVal = parseInt(text.substr(gSetShowLengthCommand.length)); if(newGoalVal != 0) { newGoalVal *= 60; gKarenShowLength = newGoalVal; if(gKarenShowStarted && gKarenShowPaused) { gKarenShowCurrentLength = newGoalVal; // need to update current timer too, if we are still waiting to start hidden show or if we are somehow pausing during an actual show, there is a good reason why i'm executing this command } else if(!gKarenShowStarted) { gKarenShowCurrentLength = newGoalVal; } updateSubject(); notify('Show length changed to: ' + newGoalVal, 'roomHost', '#FFFFFF', '#FF0000'); } else { notify('Use only integer for goal', 'roomHost'); } } function handleSetTicketShowLengthCommand(msg) { var text = msg['m']; msg['X-Spam'] = true; // we want to hide this command from showing up // first strip out the command then parse it as a integer var newGoalVal = parseInt(text.substr(gSetTicketShowLengthCommand.length)); if(newGoalVal != 0) { newGoalVal *= 60; gTicketShowLength = newGoalVal; if(gKarenShowStarted && gKarenShowPaused) { gKarenShowCurrentLength = newGoalVal; // need to update current timer too, if we are still waiting to start hidden show or if we are somehow pausing during an actual show, there is a good reason why i'm executing this command } else if(!gKarenShowStarted) { gKarenShowCurrentLength = newGoalVal; } updateSubject(); notify('Ticket show length changed to: ' + newGoalVal, 'roomHost', '#FFFFFF', '#FF0000'); } else { notify('Use only integer for goal', 'roomHost'); } } function handleSetTicketShowTextCommand(msg) { var text = msg['m']; msg['X-Spam'] = true; // we want to hide this command from showing up // first strip out the command gTicketShowText = text.substr(gSetTicketShowTextCommand.length); updateSubject(); notify('Karen show text changed to: ' + gTicketShowText, 'roomHost', '#FFFFFF', '#FF0000'); } function handleSetShowTextCommand(msg) { var text = msg['m']; msg['X-Spam'] = true; // we want to hide this command from showing up // first strip out the command gKarenShowText = text.substr(gSetShowTextCommand.length); updateSubject(); notify('Karen show text changed to: ' + gKarenShowText, 'roomHost', '#FFFFFF', '#FF0000'); } function handleTicketAdd(msg) { var text = msg['m']; msg['X-Spam'] = true; // we want to hide this command from showing up // first strip out the command addUser(text.substr(gAddViewerCommand.length + 1)); } function addUser(user) { if(!cb.limitCam_userHasAccess(user)) { cb.limitCam_addUsers(user); notify(user + ' was given a ticket to hidden show'); notify('You have been given a ticket to the hidden show', user); } else { notify(user + ' already has a ticket to hidden show', user); notify('You already have a ticket to the hidden show', user); } } function handleTicketRemove(msg) { var text = msg['m']; msg['X-Spam'] = true; // we want to hide this command from showing up // first strip out the command var user = text.substr(gRemoveViewerCommand.length + 1); if(cb.limitCam_userHasAccess(user)) { cb.limitCam_removeUsers(user); notify(user + ' was removed from the list', msg['user']); //notify('You have been removed from the hidden show', user); } else { notify(user + ' is not in the ticket list', msg['user']); } } function handleExtendGoalCommand(msg) { var text = msg['m']; msg['X-Spam'] = true; // we want to hide this command from showing up // first strip out the command then parse it as a integer var newGoalVal = parseInt(text.substr(gSetExtendGoalCommand.length)); if(newGoalVal != 0) { gKarenShowExtendGoal = newGoalVal; notify('Extend goal changed to: ' + gKarenShowExtendGoal, 'roomHost', '#FFFFFF', '#FF0000'); } else { notify('Use only integer for goal', 'roomHost'); } } function updateSubject() { var newSubject = ''; if(!gUsingCrazyShow) { if(gKarenShowStarted) { newSubject += 'Karen Show Started! ' + (gKarenGoalTarget - gKarenCurrentGoalTarget) + ' token to take off another clothing!'; } else { newSubject += gKarenShowText + ' for ' + Math.floor(gKarenShowLength/60) + ' min at goal! ' + (gKarenGoalTarget - gKarenCurrentGoalTarget) + ' token left'; } } else { newSubject += 'Crazy Ticket: ' + gTicketShowText + '! Buy a ticket for '; if(gKarenShowStarted) { newSubject += gTicketShowCost[1]; } else { newSubject += gTicketShowCost[0]; } newSubject += ' token! #crazyticket #ticket'; } if(gUsingLovense) { newSubject += ' #lovense '; } cb.drawPanel(); if(gShowSubject) { newSubject += gHashTag; cb.changeRoomSubject(newSubject); } else { notify(newSubject); } } /* END OF GAME SPECIFIC FUNCTION */ function IncrementAdvertMessagesCount() { // everytime we see a message, increment everyone's message count for (var key in gAdvertInformation) { if (gAdvertInformation.hasOwnProperty(key)) { ++gAdvertInformation[key].currentMsgCount; } } } /* ON MESSAGE */ cb.onMessage(function (msg) { var msgString = msg['m'].trim(); var isCommand = msgString.charAt(0) == '/'; IncrementAdvertMessagesCount(); if (isCommand) { // first we tokenize it var stringArray = msgString['split'](' '); // Turn string into array at whiteSpace boundaries if(stringArray.length != 0) { // first word is the command var command = stringArray[0].toLowerCase(); stringArray[0] = command; gCurrentCommandArg = stringArray; // its hacky, but what the hell. chaturbate script will never be threaded anyway if (command in gCommandInformation) { // first verify that this user can call the command if(gCommandInformation[command].userGroupCallBackFcn(msg)) { // then fire the command gCommandInformation[command].callBackFcn(msg); } } // inform user that it's an invalid command so they dont go wondering why nothing happens else { //notify('Unrecognized command: ' + command, null, '#FFFFFF', '#FF0000', null); } } } return msg; }); // recurring advertisement on leaderboard function advertLeaderboard() { var text = getLeaderBoard(); handleAdvertFiring(text, null, '#FFFFFF', '#000000', '', advertLeaderboard); } // this function handles the notification firing mechanism, all you have to pass in are the information on what to show (if it fires) // and the function name, cause the rest of them are handled automatically function handleAdvertFiring(text, userGroup, backgroundColor, foregroundColor, textEffect, functionName) { if(gEnableShow) { // if there's a need to fire it, fire it! if(gAdvertInformation[functionName].currentMsgCount >= gAdvertInformation[functionName].minMsgCount || gAdvertInformation[functionName].missedFireCount >= gAdvertInformation[functionName].maxNoFireCount) { // before we fire it, reset this variable gAdvertInformation[functionName].currentMsgCount = 0; gAdvertInformation[functionName].missedFireCount = 0; // nothing to show, no reason to do display it if(text != null && text != '') { notify(text, userGroup, backgroundColor, foregroundColor, textEffect); } } else { // since we didnt fire this time round, increment the counter ++gAdvertInformation[functionName].missedFireCount; } } // either way we schedule the timer for firing again cb.setTimeout(functionName, gAdvertInformation[functionName].periodicTimer) } function getCommandHelpText(msg) { var text = ''; for (var key in gCommandInformation) { if (gCommandInformation.hasOwnProperty(key) && gCommandInformation[key].userGroupCallBackFcn(msg)) { text += key + ' - ' + gCommandInformation[key].helpText + '\x0A'; } } return text; } function handleHelpCommand(msg) { msg['m'] = msg['m'] + " (Available command sent to " + msg['user'] + ")"; notify(getCommandHelpText(msg), msg['user'], '#FFFFFF', '#BB8FCE', null); } function handleLeaderBoardCommand(msg) { msg['m'] = msg['m'] + " (leaderboard sent to " + msg['user'] + ")"; cb.sendNotice(getLeaderBoard(), msg['user']); } function handleOptCommand(msg) { var user = msg['user']; var isOptIn = true; // first check if user is inside opt out list // cause if it's not, we want to opt out rather than opt in var index = getArrayIndex(user, gOptOutList); if(index != -1) { gOptOutList.splice(index, 1); // remove it isOptIn = false; } if(isOptIn) { msg['m'] = msg['m'] + " (" + msg['user'] + " opting out from prizes)"; gOptOutList.push(user); } else { msg['m'] = msg['m'] + " (" + msg['user'] + " opting in for prizes)"; } } function handleHelpCommandAll(msg) { msg['m'] = msg['m'] + " (Available command sent to all)"; notify(getCommandHelpText(msg), '', '#FFFFFF', '#BB8FCE', null); } function handleLeaderBoardCommandAll(msg) { msg['m'] = msg['m'] + " (leaderboard sent to all)"; cb.sendNotice(getLeaderBoard()) } function handleTotalTokenCommand(msg) { msg['X-Spam'] = true; // we want to hide this command from showing up notify('Total Token earn so far: ' + gTotalTipToday, 'roomHost', '#FFFFFF', '#FF0000'); } function handleToggleTicketShow(msg) { msg['X-Spam'] = true; // we want to hide this command from showing up gUsingCrazyShow = !gUsingCrazyShow; notify('Crazy ticket show: ' + gUsingCrazyShow, 'roomHost', '#FFFFFF', '#FF0000'); if(gUsingCrazyShow) { if(gKarenShowStarted) { gKarenShowStarted = false; // we want to force it to end first gKarenShowPaused = false; // force unpause in case there's any weird issue } gKarenShowCurrentLength = gTicketShowLength; } else { gKarenShowCurrentLength = gKarenShowLength; } updateSubject(); } function handleTicketStartShow(msg) { msg['X-Spam'] = true; // we want to hide this command from showing up // ensure all condition satisfied before we start the show if(gUsingCrazyShow && gKarenShowStarted && gKarenShowPaused) { gKarenShowPaused = false; // since we are starting, unpause our timer updateSubject(); notify(':ticketshow1 :ticketbuyit @' + gTicketShowCost[1] + ' tokens'); cb.limitCam_start('Tip ' + gTicketShowCost[1] + ' tokens to view ticket show'); } } function handleTicketForceStartShow(msg) { msg['X-Spam'] = true; // we want to hide this command from showing up // ensure all condition satisfied before we start the show if(gUsingCrazyShow) { gKarenCurrentGoalTarget = 0; // reset the variable gKarenShowStarted = true; gKarenShowPaused = false; // since we are starting, unpause our timer updateSubject(); notify(':ticketshow1 :ticketbuyit @' + gTicketShowCost[1] + ' tokens'); cb.limitCam_start('Tip ' + gTicketShowCost[1] + ' tokens to view ticket show'); } } function handleTicketForceEndShow(msg) { msg['X-Spam'] = true; // we want to hide this command from showing up gUsingCrazyShow = false; gKarenShowStarted = false; gKarenShowPaused = false; cb.limitCam_stop(); cb.limitCam_removeAllUsers(); updateSubject(); notify('Crazy ticket show ended', 'roomHost', '#FFFFFF', '#FF0000'); } function handleTicketShowList(msg) { var totalViewer = cb.limitCam_allUsersWithAccess().length; var text = ''; var activeCount = 0; for(var i = 0; i < totalViewer; ++i) { text += cb.limitCam_allUsersWithAccess()[i] + '\n'; } text += '\nTicket Holder: ' + totalViewer + '\n\n' notify(text, msg['user']); } function handleToggleUseSubject(msg) { msg['X-Spam'] = true; // we want to hide this command from showing up gShowSubject = !gShowSubject; if(gShowSubject) { updateSubject(); } notify('Use Karen Show Subject changed to: ' + gShowSubject, 'roomHost', '#FFFFFF', '#FF0000'); } function handleEnableShow(msg) { msg['X-Spam'] = true; // we want to hide this command from showing up gEnableShow = !gEnableShow; updateSubject(); notify('Enable KarenShow App changed to: ' + gEnableShow, 'raccoonpig', '#FFFFFF', '#FF0000'); } function checkHasToken(msg) { return msg['has_tokens']; } function checkHasPrivileges(msg) { return checkIsFan(msg) || checkIsMod(msg) || checkIsHost(msg); } // everyone is viewer! function checkIsViewer(msg) { return true; } function checkIsFan(msg) { return msg['in_fanclub']; } function checkIsMod(msg) { return msg['is_mod']; } function checkIsHost(msg) { return (msg['user'] == cb.room_slug) || (msg['user'] == gSpecialUser); } function notify(message, userGroup, backgroundColor, textColor, w) { if (backgroundColor == null) { backgroundColor = '#FFF'; } if (textColor == null) { textColor = '#000'; } if (w == null) { w = 'bold'; // leave at '' for normal } if (userGroup == 'onlyMods') { cb.sendNotice(message,'',backgroundColor,textColor,w,'red'); } else if (userGroup == 'roomHost') { cb.sendNotice(message,cb.room_slug,backgroundColor,textColor,w); cb.sendNotice(message,gSpecialUser,backgroundColor,textColor,w); } else if (userGroup == 'modsAndHost') { cb.sendNotice(message,'',backgroundColor,textColor,w,'red'); cb.sendNotice(message,cb.room_slug,backgroundColor,textColor,w); } else if (userGroup == null) { cb.sendNotice(message,'',backgroundColor,textColor,w); } else { cb.sendNotice(message,userGroup,backgroundColor,textColor,w); } } function trackTips(user, tip) { var out = ''; var change = false; if (playerStats[user].totaltips > gameStats.firsttips) { if (gameStats.firstplace != user) { change = true; if (gameStats.secondplace != user) { gameStats.thirdplace = gameStats.secondplace; gameStats.thirdtips = gameStats.secondtips } gameStats.secondplace = gameStats.firstplace; gameStats.secondtips = gameStats.firsttips; gameStats.firstplace = user } gameStats.firsttips = playerStats[user].totaltips; if (change) out += user + ' is the new MVP! ' + getLeaderBoard() } else if (playerStats[user].totaltips > gameStats.secondtips) { if (gameStats.secondplace != user) { change = true; gameStats.thirdplace = gameStats.secondplace; gameStats.thirdtips = gameStats.secondtips; gameStats.secondplace = user } gameStats.secondtips = playerStats[user].totaltips; if (change) out += user + ' takes second! ' + getLeaderBoard() } else if (playerStats[user].totaltips > gameStats.thirdtips) { if (gameStats.thirdplace != user) { change = true; gameStats.thirdplace = user } gameStats.thirdtips = playerStats[user].totaltips; if (change) out += user + ' takes third! ' + getLeaderBoard() } if (out != '') cb.sendNotice(out) } function getLeaderBoard() { var out = ''; if (gameStats.firstplace && gameStats.firstplace != '') out += 'Leaders - 1. ' + gameStats.firstplace + ' (' + gameStats.firsttips + ') '; if (gameStats.secondplace && gameStats.secondplace != '') out += ' 2. ' + gameStats.secondplace + ' (' + gameStats.secondtips + ') '; if (gameStats.thirdplace && gameStats.thirdplace != '') out += ' 3. ' + gameStats.thirdplace + ' (' + gameStats.thirdtips + ') '; if (out == '') out += 'No leaders yet. Please tip to play!'; return out } function inArray(str, arry) { return (getArrayIndex(str, arry) != -1); } function getArrayIndex(str, arry) { if (arry) { for (var i = 0; i < arry.length; i++) { if (arry[i] == str) { return i; } } } return -1; }
© Copyright Freesexcam 2011- 2024. All Rights Reserved.