Apps Home
|
Create an App
teste Sugar daddy
Author:
braziliancouple01
Description
Source Code
Launch App
Current Users
Created by:
Braziliancouple01
// CB APP // variaveis globais para Progressive Goals { var dummycounter = ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '11', '12', '13', '14', '15' ]; var backgroundArray = { menu: ['Cube Wave', 'Hearts', 'Snow', 'Aquarium', 'Snakeskin', 'Pastels', 'Clouds', 'Lava Lamp', 'Light Blue', 'Moon', 'personalized - CumCreamery', 'personalized - Liv n Drew', 'Blue Bars', 'Valentines Pink Bars', 'Valentines 2 Hearts' ], command: ['cubewave', 'hearts', 'snow', 'aquarium', 'snakeskin', 'pastels', 'clouds', 'lavalamp', 'lightblue', 'moon', 'cumcreamery', 'livanddrew', 'bluegradient', 'valentines1', 'valentines2' ], devfile: ['add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add', 'add' ], livefile: ['a13352e3-5a29-44b8-86fe-4171d2fc5186','56c61a44-8f7e-4fa7-aec3-1c5014901668', 'd2b04b2b-8a50-4774-b59f-db60dc508d52', '769ab1c7-cf54-440a-b068-3aa63f2d4e2d', 'd078bed1-0d97-4835-91aa-7e0afa8c5351', 'cf9c4af4-2fe3-45a7-bbad-f9668773f9b7', '51c32ede-98da-4ef7-be05-f3af87f8a161', '124cf05b-2e6a-4c5b-81f5-36dd91e49dfa', '294562e6-ba51-4649-a04c-e5b0ee3d811c', 'd95aad54-5951-473d-8fc5-ce70c5ea04d7', '7dfaf9d0-5557-49a2-9a35-167ffb5c0bfc', '7749bfd4-92eb-429b-988f-06c9499a2e37', '79c00c7a-50ec-4851-bff6-dc755fc7c965', 'f7dae9fc-abaa-4e98-a404-768f6b8e7cde', 'b3843415-a843-4d32-b6ff-e123eea66402' ] }; var fontSize = 12; var customPanel = false; } // variaveis globais para Progressive Goals // CB SETTINGS {cb.settings_choices = [ /* Mensagem INTRO */ {name: 'INTRO L1', label: ' ******************************************************************* ******************************************************************* Hi, guys! Thank you for choose the Brazilian Couple App. This app is a collection that I intend to help any broadcaster to start your show. It was edited with notepad++ in javascript language. If you copy and paste there, you will see that i tried to organize the code in a way that you can remove some parts. Feel free to edit as like I felt! ******************************************************************* *******************************************************************', type: 'choice',required: false}, {name: 'INTRO L2', label: ' ******************************************************************* THIS FIRST BLOCK YOU CAN SET ON MULTIPLE PARTS___________ *******************************************************************', type: 'choice',required: false}, /* FIM Mensagem INTRO */ /* Mensagem Welcome Room*/ {name: 'Welcome Room L1', label: '********************** PART 1: WELCOME ROOM ********************* This is the settings for Message, Background and foreground color for the Welcome Room Message. __________________ *******************************************************************', type: 'choice',required: false}, /* FIM Mensagem Welcome Room */ /* Config Welcome Room */ {name: 'enableMessage', label: 'Message on or off? -- Would you like to activate message notice?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'welcomeMsg', type: 'str', defaultValue: 'Hey $user$, Welcome to my room!', required: true, label: 'Welcome Message for users! you can use $user$ to put users\'s name'}, {name: 'welcomeMsg2', type: 'str', defaultValue: 'Be nice and have fun! :kisses4u', required: true, label: 'Welcome Message 2 for users! you can use $user$ to put users\'s name'}, {name: 'backgroundColor', type: 'str', defaultValue: '#FF69B4', required: true, label: 'Choose your Background color for users\'s Welcome. default: Hot Pink'}, {name: 'foregroundColor', type: 'str', defaultValue: '#FFFFFF', required: true, label: 'Choose your Foreground color for users\'s Welcome. default: White'}, /* FIM Config Welcome Room */ /* Mensagem Followers Message */ {name: 'Follow Settings L1', label: '******************** PART 2: FOLLOW SETTINGS ********************* This part you will know whos following you! ___________ *******************************************************************', type: 'choice',required: false}, /* FIM Mensagem Followers Message */ /* Config Followers Message */ {name: 'enableEntryMessage', label: 'Follow on or off? -- Would you like to activate followers notice?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'backgroundColor2', type: 'str', defaultValue: '#FF69B4', required: true, label: 'Please Choose your background color message for followers notice!'}, {name: 'foregroundColor2', type: 'str', defaultValue: '#FFFFFF', required: true, label: 'Please Choose your foreground color message for followers notice!'}, /* FIM Config Followers Message */ /* Mensagem Rotating Notifier */ {name: 'Rotating Notifier Settings L1', label: '**************** PART 3: ROTATING NOTIFIER SETTINGS *************** This is the Rotating Notifier. You can automatically send messages in your room! ______________________________ *******************************************************************', type: 'choice',required: false}, /* FIM Mensagem Rotating Notifier */ /* Config Rotating Notifier */ {name: 'enableRotating', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: 'Rotating notifier on or off -- Would you like to enable it?'}, {name: 'msg1', type:'str', defaultValue: 'She is so hot!! She deserves tips right!?', required: false, label:'Message 1',}, {name: 'msg2', type:'str', required: false, label:'Message 2',}, {name: 'msg3', type:'str', required: false, label:'Message 3',}, {name: 'msg4', type:'str', required: false, label:'Message 4',}, {name: 'msg5', type:'str', required: false, label:'Message 5',}, {name: 'msg6', type:'str', required: false, label:'Message 6',}, {name: 'msg7', type:'str', required: false, label:'Message 7',}, {name: 'msg8', type:'str', required: false, label:'Message 8',}, {name: 'msg9', type:'str', required: false, label:'Message 9',}, {name: 'msg10', type:'str', required: false, label:'Message 10',}, {name: 'msgcolor', type: 'str', defaultValue: '#FF69B4', required: true, label: 'Please Choose your background color message for rotating notifier!'}, {name: 'chat_ad', type:'int', minValue: 1, maxValue: 999, defaultValue: 2, label: 'Delay in minutes between notices being displayed (minimum 1)'}, /* FIM Config Rotating Notifier */ /* Mensagem Tip Response */ {name: 'Tip Response L1', label: '******************** PART 4: TIP RESPONSE ********************* This is the Tip Response. Its an auto thank you response. _________ *******************************************************************', type: 'choice',required: false}, /* FIM Tip Response */ /* Config Tip Response */ {name: 'enableTipResponse1', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: 'Tip Auto thank you! on or off -- Would you like to enable it?'}, { name: 'tipamount', type: 'int', minValue: 1, defaultValue: 10, label: 'Minimum tokens required for a thank you message'}, { name: 'tipmsg', type: 'str', minLength: 8, maxLength: 128, defaultValue: '**** Thank you [tipper] for your tip!!! (: **** ', label: "Tip thank you message, [tipper] = tipper's name" }, /* FIM Config Tip Response */ /* Mensagem ADVICE */ {name: 'Advice L1', label: '********************************************************************* THIS BLOCK WE STRONGLY RECOMMEND DO NOT SET ON MULTIPLE PARTS to avoid conflicts!! Choose one game per time. But, this is only a recommendation. ________________________ ********************************************************************* GAMES!!! _______________________________ ********************************************************************* ', type: 'choice',required: false}, /* FIM Mensagem ADVICE */ /* Mensagem Progressive Goals */ {name: 'Progressive Goals L1', label: '******************** PART 5: PROGRESSIVE GOALS ****************** This Game you can set your action on each goal. You set the amount and the action. Goals are not cumulative. You can set up a Single goal or multiple goals. If you want to use one single goal, just clear out the descriptions and amounts for the goals that are not being used. You can restart a single goal many times if you want, just type "/restartgoal" command _______________________________ *********************************************************************', type: 'choice',required: false}, /* FIM Mensagem Progressive Goals */ // Progressive Goal Choices {name: 'enableProgressiveGoalGame', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: 'Progressive Goals Game on or off -- Would you like to enable it?'}, {name: 'allowModsAuthority', label: 'Allow moderators to have authority to broadcaster commands? It is usually ok to give trusted moderators general authority with this setting to help them run your show, however they will have authority to perform actions such as manually adding tips to goals, and changing goal thresholds, so make sure your moderator is trustworthy', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'allowModsStats', label: 'Allow moderators to use the "/stats" command to see current show time online and tip totals', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'showTotals', label: 'Show the total tips so far for the current app in the draw panel?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'fembotRunning', label: 'Are you using Dorothy\'s Fembot alongside the Tip Goals App? This setting is used to suppress error messages from the Tip Goals App for invalid commands as it is expected the Fembot will handle errors (so you don\'t get the same error twice)', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'progressiveGoalTextColor',label: 'Text color for chat notices related to the Progressive Goal App',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: 'Dark Green'}, {name: 'progressiveGoalCustomTextColor', label: 'If you picked a custom text color in the previous setting, enter the hex color (6 character hex color codes including the # prefix, such as #FFFFFF):', type: 'str', minLength: 1, maxLength: 7, required: false}, {name: 'progressiveGoalBgColor',label: 'Background/Highlight color for chat notices related to the Progressive Goal App', 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: 'Light Teal',choice12: 'Cream',choice13: 'Light Bronze',choice14: 'Light Periwinkle',choice15: 'Light Fuschia',choice16: 'Light Lime',choice17: 'Light Plum',choice18: 'Custom',defaultValue: 'Light Green'}, {name: 'progressiveGoalCustomBgColor', label: 'If you picked a custom text color in the previous setting, enter the hex color (6 character hex color codes including the # prefix, such as #FFFFFF):', type: 'str', minLength: 1, maxLength: 7, required: false}, {name: 'panelBackground', label: 'Which background panel type would you like to display? Note you cannot use the personalized background unless they are for your room, it will use the default if they are selected', type: 'choice', choice1: 'default - no image', choice2: backgroundArray.menu[0], choice3: backgroundArray.menu[1], choice4: backgroundArray.menu[2], choice5: backgroundArray.menu[3], choice6: backgroundArray.menu[4], choice7: backgroundArray.menu[5], choice8: backgroundArray.menu[6], choice9: backgroundArray.menu[7], choice10: backgroundArray.menu[8], choice11: backgroundArray.menu[9], choice12: backgroundArray.menu[10], choice13: backgroundArray.menu[11], choice14: backgroundArray.menu[12], choice15: backgroundArray.menu[13], choice16: backgroundArray.menu[14], defaultValue: backgroundArray.menu[1]}, {name: 'panelTextColor',label: 'Text color for the panel text (if a custom background is used)',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: 'Dark Blue'}, {name: 'panelCustomTextColor', label: 'If you picked a custom text color in the previous setting, enter the hex color (6 character hex color codes including the # prefix, such as #FFFFFF):', type: 'str', minLength: 1, maxLength: 7, required: false}, // *** Single or Progressive Goals {name: 'progressiveRoomSubjectSfx', label: 'Title? -- This is a general Title. It will appended to the individual goal descriptions shown in the room title', type: 'str',required: false, minLength: 1, maxLength: 100, defaultValue: 'Let´s getting hot?!! #anal #pussy #latina #lovense #petite #new'}, {name: 'progressiveAutoNext', label: 'Once the current goal is reached, automatically start next goal, or require manual start of a goal with the "/next" command? Note that with manual start, tips that exceed the current goal are not counted toward the next goal. With auto-start, the excess amount is rolled over to the next goal.', type: 'choice', choice1: 'Auto-start next', choice2: 'Manually start next', defaultValue: 'Auto-start next'}, {name: 'progressiveGoalDescription1', label: 'Goal #1 Description', type: 'str', minLength: 1, maxLength: 100, defaultValue: 'Topless'}, {name: 'progressiveGoalAmount1', label: 'Goal #1 amount', type: 'int', minValue: 1, maxValue: 100000, defaultValue: 66}, {name: 'progressiveGoalDescription2', label: 'Goal #2 Description', type: 'str', required: false, minLength: 1, maxLength: 100, defaultValue: 'All Naked'}, {name: 'progressiveGoalAmount2', label: 'Goal #2 amount', type: 'int', required: false, minValue: 1, maxValue: 100000, defaultValue: 99}, {name: 'progressiveGoalDescription3', label: 'Goal #3 Description', type: 'str', required: false, minLength: 1, maxLength: 100, defaultValue: 'Naked Strip'}, {name: 'progressiveGoalAmount3', label: 'Goal #3 amount', type: 'int', required: false, minValue: 1, maxValue: 100000, defaultValue: 111}, {name: 'progressiveGoalDescription4', label: 'Goal #4 Description', type: 'str', required: false, minLength: 1, maxLength: 100, defaultValue: 'Pussy Play'}, {name: 'progressiveGoalAmount4', label: 'Goal #4 amount', type: 'int', required: false, minValue: 1, maxValue: 100000, defaultValue: 222}, {name: 'progressiveGoalDescription5', label: 'Goal #5 Description', type: 'str', required: false, minLength: 1, maxLength: 100, defaultValue: 'CUM Show'}, {name: 'progressiveGoalAmount5', label: 'Goal #5 amount', type: 'int', required: false, minValue: 1, maxValue: 100000, defaultValue: 555}, {name: 'progressiveGoalDescription6', label: 'Goal #6 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount6', label: 'Goal #6 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription7', label: 'Goal #7 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount7', label: 'Goal #7 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription8', label: 'Goal #8 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount8', label: 'Goal #8 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription9', label: 'Goal #9 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount9', label: 'Goal #9 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription10', label: 'Goal #10 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount10', label: 'Goal #10 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription11', label: 'Goal #11 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount11', label: 'Goal #11 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription12', label: 'Goal #12 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount12', label: 'Goal #12 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription13', label: 'Goal #13 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount13', label: 'Goal #13 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription14', label: 'Goal #14 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount14', label: 'Goal #14 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription15', label: 'Goal #15 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount15', label: 'Goal #15 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription16', label: 'Goal #16 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount16', label: 'Goal #16 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription17', label: 'Goal #17 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount17', label: 'Goal #17 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription18', label: 'Goal #18 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount18', label: 'Goal #18 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription19', label: 'Goal #19 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount19', label: 'Goal #19 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, {name: 'progressiveGoalDescription20', label: 'Goal #20 Description', type: 'str',required: false, minLength: 1, maxLength: 100}, {name: 'progressiveGoalAmount20', label: 'Goal #20 amount', type: 'int',required: false, minValue: 1, maxValue: 100000}, //Progressive Goal Choices /* Mensagem Master Demands Game */ {name: 'Master Demands Game L1', label: '******************************************************************* **************** PART 6: MASTER DEMANDS GAME ***************** This is the Master Demands Game. Rules: They tip and say what broadcaster does while the time countdown.__________ *******************************************************************', type: 'choice',required: false}, /* FIM Master Demands Game */ /* Config Master Demands Game */ {name: 'enableMasterDemandsGame', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: 'Master Demands Game on or off -- Would you like to enable it?'}, {name: 'display_rules', type: 'choice', choice1:'Never', choice2:'Every 10 seconds', choice3:'Every 30 seconds', choice4:'Every minute', choice5:'Every 2 minutes', choice6:'Every 3 minutes', choice7:'Every 5 minutes', choice8:'Every 10 minutes', choice9:'Every 15 minutes', defaultValue: 'Every 3 minutes' }, {name: 'Level_1_Master_Demands_minimum_tokens', type: 'int', minValue: 1, default: 50 }, {name: 'Level_1_duration_in_minutes', type: 'int', minValue: 1, maxValue: 240, default: 1 }, {name: 'Level_2_Master_Demands_minimum_tokens', type: 'int', minValue: 1, default: 100, required: false }, {name: 'Level_2_duration_in_minutes', type: 'int', minValue: 1, maxValue: 240, default: 2, required: false }, {name: 'Level_3_Master_Demands_minimum_tokens', type: 'int', minValue: 1, default: 200, required: false }, {name: 'Level_3_duration_in_minutes', type: 'int', minValue: 1, maxValue: 240, default: 5, required: false }, {name: 'Level_4_Master_Demands_minimum_tokens', type: 'int', minValue: 1, required: false }, {name: 'Level_4_duration_in_minutes', type: 'int', minValue: 1, maxValue: 240, required: false }, {name: 'Level_5_Master_Demands_minimum_tokens', type: 'int', minValue: 1, required: false }, {name: 'Level_5_duration_in_minutes', type: 'int', minValue: 1, maxValue: 240, required: false }, {name: 'Private_for_big_Master_Demands', type: 'choice', choice1:'Yes', choice2:'No', defaultValue: 'Yes', required: false}, {name: 'Big_Master_Demands_minimum_tokens', type: 'int', minValue: 1, default: 500, required: false }, {name: 'Private_duration_in_minutes', type: 'int', minValue: 1, maxValue: 240 }, /* FIM Master Demands Game */ /* Mensagem Tip Jar Game */ {name: 'Tip Jar Game L1', label: '******************************************************************* **************** PART 7: TIP JAR GAME ***************** This is the Tip Jar Game. Rules: This is a Jar! You set a time for each tip countdown while you do your show! When the jar is empty you stop and wait for the next tipper!__________ *******************************************************************', type: 'choice',required: false}, /* FIM Tip Jar Game */ /* Config Tip Jar Game */ {name: 'enableTipJarGame', type: 'choice', choice1: 'yes', choice2: 'no', defaultValue: 'yes', label: 'Tip Jar Game on or off -- Would you like to enable it?'}, {name:'room_name', type: 'str', minLength: 1, maxLength: 255, label:'Room subject:'}, {name:'get_it_going', type:'int', minValue:1, default:50, label:'Tip required to start show:'}, {name:'reduce_tip_jar', type:'int', minValue:1, maxValue:60, default:10, label:'Reduce the tip jar every X seconds:'}, {name:'reduce_tips_by', type:'int', minValue:1, maxValue:20, default:1, label:'Amount to reduce tip jar by:'} /* FIM Config Tip Jar Game */ ]; } // CB SETTINGS /* INICIO EXECUCAO -- Welcome Room */ if (cb.settings.enableMessage == 'Yes') { cb.onEnter(({ user }) => { const { welcomeMsg, welcomeMsg2, backgroundColor, foregroundColor } = cb.settings; let msg = welcomeMsg.replace(/\$user\$/g, user); let msg2 = welcomeMsg2.replace(/\$user\$/g, user); cb.sendNotice(msg, user, backgroundColor, foregroundColor, 'bold'); cb.sendNotice(msg2, user,'bold'); }); }; /* FIM EXECUCAO -- Welcome Room */ /* INICIO EXECUCAO -- Followers Message */ if (cb.settings.enableEntryMessage == 'Yes') { let broadcaster = '' cb.onStart(_user => { cb.getRoomUsersData(usersData => { if (usersData['success']) { for (user of usersData['data']['room_owner']) { broadcaster = user } } }); }); cb.onFollow(user => { const { backgroundColor2, foregroundColor2 } = cb.settings; cb.sendNotice(user['user'] + ' is now following me!', broadcaster, backgroundColor2, foregroundColor2, '','',''); }); }; /* FIM EXECUCAO -- Followers Message */ /* INICIO EXECUCAO -- Rotating Notifier */ if (cb.settings.enableRotating == 'yes') { var i=0; var MAXITEMS=10; function chatAd() { var msg; while (cb.settings['msg' + (i + 1)] == 0) { //skip empty messages i++; i %= MAXITEMS; } msg = cb.settings['msg' + (i + 1)]; i++; i %= MAXITEMS; cb.sendNotice(msg,'','',cb.settings['msgcolor'],'bolder'); cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); } cb.setTimeout(chatAd, (cb.settings.chat_ad * 60000)); }; /* FIM EXECUCAO -- Rotating Notifier */ /* INICIO EXECUCAO -- Tip Response */ if (cb.settings.enableTipResponse1 == 'yes') { cb.onTip(function (tip) { if (parseInt(tip['amount']) >= cb.settings.tipamount) { tipper = tip['from_user']; tipmsg=cb.settings.tipmsg; tipmsg = tipmsg.replace("[tipper]", tipper); cb.chatNotice(tipmsg, tipper); } }); }; /* FIM EXECUCAO -- Tip Response */ /* INICIO EXECUCAO -- Master demands game*/ if (cb.settings.enableMasterDemandsGame == 'yes') { var total_tipped = 0; var high_tip_username = null; var high_tip_amount = 0; var last_tip_username = null; var last_tip_amount = 0; var subject_is_set_with_0 = false; var control_duration = 0; var new_subject = null; var private_indicator = "!"; var timer_value = 0; var notice_timer_value = 0; var rules_list = null; // handlers cb.onTip(function(tip) { // update total total_tipped += tip['amount'] // if the option for Big Sugar Daddy is turned on, neither the token minimum or duration is left blank, and the current tip is higher than the Big Sugar Daddy minimum... if ((tip['amount'] >= cb.settings.Big_Master_Demands_minimum_tokens) && ((cb.settings.Private_for_big_Master_Demands == 'Yes')) && (cb.settings.Private_duration_in_minutes != null) && (cb.settings.Big_Master_Demands_minimum_tokens != null)) { // show the corresponding duration in the message control_duration = cb.settings.Private_duration_in_minutes // append the message to specify "in a private room" private_indicator = " in a private room!" } // if it's not a Big Sugar Daddy tip, apply the regular logic to determine the corresponding length of time else { // if level 2 is greater than current tip, or level 2 is null, this is a level 1 tip if ((cb.settings.Level_2_Master_Demands_minimum_tokens > tip['amount']) || (cb.settings.Level_2_Master_Demands_minimum_tokens == null) || (cb.settings.Level_2_duration_in_minutes == null)) { control_duration = cb.settings.Level_1_duration_in_minutes } // if the former is not true, and if level 3 is greater than current tip, or level 3 is null, this is a level 2 tip else if ((cb.settings.Level_3_Master_Demands_minimum_tokens > tip['amount']) || (cb.settings.Level_3_Master_Demands_minimum_tokens == null) || (cb.settings.Level_3_duration_in_minutes == null)) { control_duration = cb.settings.Level_2_duration_in_minutes } // if the former is not true, and if level 4 is greater than current tip, or level 4 is null, this is a level 3 tip else if ((cb.settings.Level_4_Master_Demands_minimum_tokens > tip['amount']) || (cb.settings.Level_4_Master_Demands_minimum_tokens == null) || (cb.settings.Level_4_duration_in_minutes == null)) { control_duration = cb.settings.Level_3_duration_in_minutes } // if the former is not true, and if level 5 is greater than current tip, or level 5 is null, this is a level 4 tip else if ((cb.settings.Level_5_Master_Demands_minimum_tokens > tip['amount']) || (cb.settings.Level_5_Master_Demands_minimum_tokens == null) || (cb.settings.Level_5_duration_in_minutes == null)) { control_duration = cb.settings.Level_4_duration_in_minutes } // if the former is not true, and this is not a Big Sugar Daddy tip, then it is a level 5 tip else if ((cb.settings.Big_Master_Demands_minimum_tokens > tip['amount']) || (cb.settings.Big_Master_Demands_minimum_tokens == null) || (cb.settings.Private_duration_in_minutes == null) || (cb.settings.Private_for_big_Master_Demands == 'No')) { control_duration = cb.settings.Level_5_duration_in_minutes } } timer_value = (1000 * 60 * control_duration) // if the current tip is higher than the highest tip thus far if ((tip['amount'] > high_tip_amount) && (tip['amount'] >= cb.settings.Level_1_Master_Demands_minimum_tokens)) { // update high score and display new subject high_tip_amount = tip['amount'] high_tip_username = tip['from_user'] update_subject(); cb.setTimeout(times_up, timer_value) } // consider removing this part last_tip_amount = tip['amount'] last_tip_username = tip['from_user'] if (tip['amount'] > high_tip_amount) { high_tip_amount = tip['amount'] high_tip_username = tip['from_user'] } // end section to consider for removal cb.drawPanel(); }); cb.onDrawPanel(function(user) { return { 'template': '3_rows_of_labels', 'row1_label': 'High Score:', 'row1_value': '' + high_tip_amount, 'row2_label': 'Sugar Daddy:', 'row2_value': format_username(high_tip_username), 'row3_label': 'Total Tips:', 'row3_value': total_tipped }; }); // helper functions function update_subject() { new_subject = "Highest tip: "+ high_tip_amount + " tks - Master " + high_tip_username + ", tell me what to do for " + control_duration + " minute(s)" + private_indicator; cb.log("Changing subject to: " + new_subject); cb.changeRoomSubject(new_subject); } function format_username(val) { if (val === null) { return "--"; } else { return val.substring(0, 12); } } function times_up() { cb.chatNotice("Ohhh.. Time's up! Be my Master again!"); high_tip_username = "--" cb.drawPanel(); } function build_rules_list(){ cb.chatNotice('Master Demands Game is active. You are de Master and we do it! Let´s Play!?'); rules_list = "Giving the highest tip makes you the King Master, and you control the show!\nBe the Master for " + cb.settings.Level_1_duration_in_minutes + " minutes with a tip of " + cb.settings.Level_1_Master_Demands_minimum_tokens + " or more." if ((cb.settings.Level_2_Master_Demands_minimum_tokens != null) && (cb.settings.Level_2_duration_in_minutes != null)) { rules_list += ("\nBe the Master for " + cb.settings.Level_2_duration_in_minutes + " minutes with a tip of " + cb.settings.Level_2_Master_Demands_minimum_tokens + " or more.") } if ((cb.settings.Level_3_Master_Demands_minimum_tokens != null) && (cb.settings.Level_2_duration_in_minutes != null)) { rules_list += ("\nBe the Master for " + cb.settings.Level_3_duration_in_minutes + " minutes with a tip of " + cb.settings.Level_3_Master_Demands_minimum_tokens + " or more.") } if ((cb.settings.Level_4_Master_Demands_minimum_tokens != null) && (cb.settings.Level_2_duration_in_minutes != null)) { rules_list += ("\nBe the Master " + cb.settings.Level_4_duration_in_minutes + " minutes with a tip of " + cb.settings.Level_4_Master_Demands_minimum_tokens + " or more.") } if ((cb.settings.Level_5_Master_Demands_minimum_tokens != null) && (cb.settings.Level_2_duration_in_minutes != null)) { rules_list += ("\nBe the Master for " + cb.settings.Level_5_duration_in_minutes + " minutes with a tip of " + cb.settings.Level_5_Master_Demands_minimum_tokens + " or more.") } if ((cb.settings.Private_duration_in_minutes != null) && (cb.settings.Big_Master_Demands_minimum_tokens != null) && (cb.settings.Private_for_big_Master_Demands == 'Yes')) { rules_list += ("\nBe the King Master for " + cb.settings.Private_duration_in_minutes) + " minutes and get the model all to yourself with a tip of " + cb.settings.Big_Master_Demands_minimum_tokens + " or more."//rules_list += ( + cb.settings.Private_duration_in_minutes + " minutes and get the model all to yourself with a tip of " + Big_Master_Demands_minimum_tokens + " or more.") } } function set_notice_timer(){ switch(cb.settings.display_rules) { case 'Never': notice_timer_value = (0) break; case 'Every 10 seconds': notice_timer_value = (10 * 1000) break; case 'Every 30 seconds': notice_timer_value = (30 * 1000) break; case 'Every minute': notice_timer_value = (60 * 1000) break; case 'Every 2 minutes': notice_timer_value = (2 * 60 * 1000) break; case 'Every 3 minutes': notice_timer_value = (3 * 60 * 1000) break; case 'Every 5 minutes': notice_timer_value = (6 * 60 * 1000) break; case 'Every 10 minutes': notice_timer_value = (10 * 60 * 1000) break; case 'Every 15 minutes': notice_timer_value = (15 * 60 * 1000) break; } cb.chatNotice(rules_list); cb.setTimeout(set_notice_timer, notice_timer_value) } }; /* FIM EXECUCAO -- Master demands game*/ /* INICIO EXECUCAO -- Progressive Goals game*/ if (cb.settings.enableProgressiveGoalGame == 'yes') { // 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; } } // prototype functions // USER MESSAGES { 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 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]); if(message[0].charAt(0) == '/') { msg['X-Spam'] = true; 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]; } if(isFan) { populateFanClubArray(u); } switch(command) { //********* Tip Goal App Commands case '/chgpanelbg': { cmd = 1; if (isBC || (isMod && cb.settings.allowModsAuthority == 'Yes')) { if (message[1]) { newBg = message[1].toLowerCase(); customizePanelBackground(newBg,u); } 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, yellow); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, yellow); } break; } case '/chgpaneltext': { cmd = 1; if (isBC || (isMod && cb.settings.allowModsAuthority == 'Yes')) { newcolor = msg['m'].substring(14).trim(); if (newcolor) { customizePanelText(newcolor,u); } 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, yellow); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, yellow); } break; } case '/next': { cmd = 1; if (isBC || (isMod && cb.settings.allowModsAuthority == 'Yes')) { if (finalGoalMet) { cb.sendNotice('Command cannot be used once all goals have been completed.', u, yellow); } else if (currentGoalTips < currentGoalTotal) { cb.sendNotice('Command cannot be used during goal, it should be used only to manually advance a goal once complete if the auto-advance is off. The /skip command can be used to bypass the rest of a goal.', u, yellow); } else { advanceGoal(); cb.sendNotice('You have manually advanced to the next goal.', u, yellow); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, yellow); } break; } case '/skip': { cmd = 1; if (isBC || (isMod && cb.settings.allowModsAuthority == 'Yes')) { if (finalGoalMet) { cb.sendNotice('Command cannot be used once all goals have been completed.', u, yellow); } else { advanceGoal(); cb.sendNotice('You have skipped the remainder of the current goal and advanced to the next.', u, yellow); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, yellow); } break; } case '/addtips': { cmd = 1; if (isBC || (isMod && cb.settings.allowModsAuthority == 'Yes')) { if (commandVar1 == 0 || isNaN(commandVar1)) { cb.sendNotice('The parameter is the tip amount to be added to the current tip count, and must be a positive or negative number other than 0. For example, use "/addtips 100" to simulate a user having tipped 100 tokens.',u,yellow); } else if (finalGoalMet) { cb.sendNotice('Command cannot be used once all goals, cycles or sequences have been completed.', u, yellow); } else if (commandVar1 < 0 && Math.abs(commandVar1) > currentGoalTips) { cb.sendNotice('You cannot subtract more tokens than have been tipped for the current goal.', u, yellow); } else { recordTip(commandVar1,'bc',isFan); if (commandVar1 > 0) { cb.sendNotice('You have added ' + commandVar1 + ' tokens.', u, yellow); } else { cb.sendNotice('You have subtracted ' + Math.abs(commandVar1) + ' tokens.', u, yellow); } } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, yellow); } break; } case '/stats': { cmd = 1; if (isBC || (isMod && cb.settings.allowModsStats == 'Yes')) { cb.sendNotice('Current Session Stats: \n \u21D2 Tip Goal App Time Online......... ' + timeOnline() + '\n \u21D2 Total Tips................................ ' + currentSessionTotal + ' tokens ($' + Number(currentSessionTotal*.05).toFixed(2) + ' @ 5 cents per token', u, yellow, '', 'bold'); } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, yellow); } break; } case '/lg': case '/listgoals': { cmd = 1; if (isBC || (isMod && cb.settings.allowModsAuthority == 'Yes')) { if (!message[1] || message[1] == 'all') { listGoals(message[1],u) } else { cb.sendNotice('Invalid parameter provided, the parameter should be left blank to send the list to only the requester, or can be set to "all" to send to the entire room.', u, yellow); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, yellow); } break; } case '/resetapp': { cmd = 1; if (isBC) { initProgGoal(u); cb.sendNotice('You have reset the App and started the goal show again at the first goal.', u, yellow); } else { cb.sendNotice('Only broadcasters are able to use the "/resetapp" command.', u, yellow); } break; } case '/restartgoal': { cmd = 1; if (isBC || (isMod && cb.settings.allowModsAuthority == 'Yes')) { restartGoal(); cb.sendNotice('You have restarted the current goal.', u, yellow); } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, yellow); } break; } case '/setgoal1': case '/setgoal2': case '/setgoal3': case '/setgoal4': case '/setgoal5': case '/setgoal6': case '/setgoal7': case '/setgoal8': case '/setgoal9': case '/setgoal10': case '/setgoal11': case '/setgoal12': case '/setgoal13': case '/setgoal14': case '/setgoal15': case '/setgoal16': case '/setgoal17': case '/setgoal18': case '/setgoal19': case '/setgoal20': { cmd = 1; if (isBC || (isMod && cb.settings.allowModsAuthority == 'Yes')) { goalnum = parseInt(message[0].substring(8)); if (commandVar1 <= 0 || isNaN(commandVar1)) { cb.sendNotice('The first parameter is the new amount for goal ' + goalnum + ' and has be be a number greater than 0. For example, "/setgoal' + goalnum + ' 300 Shirt Off" to set goal ' + goalnum + ' to Shirt off at 300 tokens.', u, yellow); } else if (goalnum == currentGoal && commandVar1 < currentGoalTips) { cb.sendNotice('The current goal cannot be updated to an amount less than what has already been tipped for this goal. The "/restartgoal" command can be used to clear the current goal tip totals, but this is not recommended.', u, yellow); } else if (!message[2]) { cb.sendNotice('The second parameter is the description of goal ' + goalnum + ' (can be multiple words). For example, "/setjar' + goalnum + ' 300 Shirt Off" to set goal ' + goalnum + ' to Shirt off at 300 tokens.', u, yellow); } else if (goalnum > 1 && !progGoalArray.amt[goalnum-2] >= 1) { cb.sendNotice('You cannot skip goal levels. If setting a goal for level ' + goalnum + ', then level ' + (goalnum-1) + ' must already have a goal defined.', u, yellow); } else { for (let i = 2; i < message.length; i++) { if (i === 2) { label = message[i]; } else { label += " " + message[i]; } } progGoalArray.amt[goalnum-1] = commandVar1; progGoalArray.desc[goalnum-1] = label; updateGoal(goalnum); cb.sendNotice('Goal ' + goalnum + ' was added/updated to the amount of ' + commandVar1 + ' and a description of "' + label + '".', u, yellow); cb.sendNotice(u + ' added/updated Progressive Goal #' + goalnum + ' to the goal amount of ' + commandVar1 + ' and a description of "' + label + '".', '', yellow, '', '', 'red'); cb.sendNotice(u + ' added/updated Progressive Goal #' + goalnum + ' to the goal amount of ' + commandVar1 + ' and a description of "' + label + '".', cb.room_slug, yellow); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, yellow); } break; } case '/rmvgoal': { cmd = 1; if (isBC || (isMod && cb.settings.allowModsAuthority == 'Yes')) { goalnum = message[1]; if (isNaN(goalnum) || goalnum < 1 || goalnum > 20) { cb.sendNotice('The first parameter is the goal level being removed, and musy be a number from 1 to 20 to indicate the goal level number that should be removed. For example, "/rmvgoal 3" will remove the goal and description info for level 3.', u, yellow); } else if (goalnum > progGoalArray.amt.length) { cb.sendNotice('There is no goal entry at level ' + goalnum + ', there are currently only entries up to goal level ' + progGoalArray.amt.length + '.', u, yellow); } else { progGoalArray.amt.splice((goalnum-1),1); progGoalArray.desc.splice((goalnum-1),1); updateGoal(goalnum); cb.sendNotice('Progressive Goal #' + goalnum + ' was removed from the goal list', u, yellow); cb.sendNotice(u + ' removed Progressive Goal #' + goalnum + ' from the goal list', '', yellow, '', '', 'red'); cb.sendNotice(u + ' removed Progressive Goal #' + goalnum + ' from the goal list', cb.room_slug, yellow); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, yellow); } break; } case '/setgoaltext': { cmd = 1; if (isBC || (isMod && cb.settings.allowModsAuthority == 'Yes')) { goalSubjectText = msg['m'].substring(13).trim() if (goalSubjectText != '' && goalSubjectText != null) { changeRoomSubject(); } else { cb.sendNotice('No value was specified for the new room subject suffix.', u, yellow); } } else { cb.sendNotice('Only broadcasters and moderators with sufficient authority are able to use that command.', u, yellow); } break; } //********* Help Menu case '/goalshelp': { cmd = 1; if (isMod || isBC) { helpModBC(u); } else { cb.sendNotice('Only broadcasters and moderators are able to use the help command, there are no commands available to general users.', u, yellow); } break; } } //********* End of Expected commands if (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] == '/usepresale' || message[0] == '/presalelist' || message[0] == '/presaleprice' || message[0] == '/presalepricetimer' || message[0] == '/presalestarttimer' || message[0] == '/presalestoptimer' || message[0] == '/presaleaddtime' || message[0] == '/exppresale' || message[0] == '/addpresale' || message[0] == '/rmvpresale' || message[0] == '/chgpresalemode' || message[0] == '/presaletimeleft)' || 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 (cb.settings.fembotRunning != 'Yes') { if (cmd == 0) { cb.sendNotice(message[0] + ' is not a recognized Tip Goals command (although it may just be a command for another app or bot).\nType "/uahelp" to see a full list of the available UltraApp commands.', u, yellow); } } } return msg; }); } // USER MESSAGES // USER LEAVES { cb.onLeave(function(user) { var u = user.user; }); } // USER LEAVES // 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 voteAmount = 1; // ***** Tip Count Array if (!cbjs.arrayContains(tipCountArray.name, u)) { tipCountArray.name.push(u); tipCountArray.amount.push(tipAmount); } else { tipCountArray.amount[findTipper(u)] += tipAmount; } // ***** Record tip for goal progress and track total stats recordTip(tipAmount,u,isFan); }); } //TIPPING // 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 (!finalGoalMet) { panel.row1_value = 'Current Goal (#' + (currentGoal) + ') : ' + (currentGoalTips > currentGoalTotal ? currentGoalTotal : currentGoalTips) + ' / ' + currentGoalTotal + ' \u25FE (' + (currentGoalTotal-(currentGoalTips > currentGoalTotal ? currentGoalTotal : currentGoalTips)) + ' left)'; leftjust1 = 10; panel.row2_value = 'Progress: ' + goalBar((currentGoalTips > currentGoalTotal ? currentGoalTotal : currentGoalTips),currentGoalTotal) + ' (' + Math.floor((currentGoalTips > currentGoalTotal ? currentGoalTotal : currentGoalTips)/currentGoalTotal*100) + ' %)'; leftjust2 = 42; if (cb.settings.showTotals == 'Yes') { panel.row3_value = 'Total Goal Show Tips: ' + currentAppTotalGoal; leftjust3 = 55; } else { panel.row3_value = 'At Goal: ' + currentGoalDesc; leftjust3 = 65; } } else { panel.row1_value = 'All Goals Completed!'; leftjust1 = 65; panel.row2_value = 'Progress: ' + goalBar(100,100) + ' (100 %)'; leftjust2 = 42; if (cb.settings.showTotals == 'Yes') { panel.row3_value = 'Total Goal Show Tips: ' + currentAppTotalGoal; leftjust3 = 55; } else { panel.row3_value = ''; } } panel.layers = [ {'type': 'image', 'fileID': backgroundImage}, { 'type': 'text', 'text': panel.row1_value, 'top': topjust1, 'left': leftjust1, 'font-size': fontSize, 'font-weight': 'bold', 'color': textColor, }, { 'type': 'text', 'text': panel.row2_value, 'top': topjust2, 'left': leftjust2, 'font-size': fontSize, 'font-weight': 'bold', 'color': textColor, }, { 'type': 'text', 'text': panel.row3_value, 'top': topjust3, 'left': leftjust3, 'font-size': fontSize, 'font-weight': 'bold', 'color': textColor, }, ] return panel; }); // DRAW PANEL // VARIAVEIS E ARRAYS { // *********************************** Variables and Arrays ************************************** var initialize = 0; var BC = cb.room_slug; var currentGoal = 1; var currentGoalTips = 0; var currentGoalTotal = 0; var currentSessionTotal = 0; var currentAppTotalGoal = 0; var goalSubjectText = cb.settings.progressiveRoomSubjectSfx; var progressiveGoalDescription1 = cb.settings.progressiveGoalDescription1; var progressiveGoalDescription2 = cb.settings.progressiveGoalDescription2; var progressiveGoalDescription3 = cb.settings.progressiveGoalDescription3; var progressiveGoalDescription4 = cb.settings.progressiveGoalDescription4; var progressiveGoalDescription5 = cb.settings.progressiveGoalDescription5; var progressiveGoalDescription6 = cb.settings.progressiveGoalDescription6; var progressiveGoalDescription7 = cb.settings.progressiveGoalDescription7; var progressiveGoalDescription8 = cb.settings.progressiveGoalDescription8; var progressiveGoalDescription9 = cb.settings.progressiveGoalDescription9; var progressiveGoalDescription10 = cb.settings.progressiveGoalDescription10; var progressiveGoalDescription11 = cb.settings.progressiveGoalDescription11; var progressiveGoalDescription12 = cb.settings.progressiveGoalDescription12; var progressiveGoalDescription13 = cb.settings.progressiveGoalDescription13; var progressiveGoalDescription14 = cb.settings.progressiveGoalDescription14; var progressiveGoalDescription15 = cb.settings.progressiveGoalDescription15; var progressiveGoalDescription16 = cb.settings.progressiveGoalDescription16; var progressiveGoalDescription17 = cb.settings.progressiveGoalDescription17; var progressiveGoalDescription18 = cb.settings.progressiveGoalDescription18; var progressiveGoalDescription19 = cb.settings.progressiveGoalDescription19; var progressiveGoalDescription20 = cb.settings.progressiveGoalDescription20; var progressiveGoalAmount1 = cb.settings.progressiveGoalAmount1; var progressiveGoalAmount2 = cb.settings.progressiveGoalAmount2; var progressiveGoalAmount3 = cb.settings.progressiveGoalAmount3; var progressiveGoalAmount4 = cb.settings.progressiveGoalAmount4; var progressiveGoalAmount5 = cb.settings.progressiveGoalAmount5; var progressiveGoalAmount6 = cb.settings.progressiveGoalAmount6; var progressiveGoalAmount7 = cb.settings.progressiveGoalAmount7; var progressiveGoalAmount8 = cb.settings.progressiveGoalAmount8; var progressiveGoalAmount9 = cb.settings.progressiveGoalAmount9; var progressiveGoalAmount10 = cb.settings.progressiveGoalAmount10; var progressiveGoalAmount11 = cb.settings.progressiveGoalAmount11; var progressiveGoalAmount12 = cb.settings.progressiveGoalAmount12; var progressiveGoalAmount13 = cb.settings.progressiveGoalAmount13; var progressiveGoalAmount14 = cb.settings.progressiveGoalAmount14; var progressiveGoalAmount15 = cb.settings.progressiveGoalAmount15; var progressiveGoalAmount16 = cb.settings.progressiveGoalAmount16; var progressiveGoalAmount17 = cb.settings.progressiveGoalAmount17; var progressiveGoalAmount18 = cb.settings.progressiveGoalAmount18; var progressiveGoalAmount19 = cb.settings.progressiveGoalAmount19; var progressiveGoalAmount20 = cb.settings.progressiveGoalAmount20; var yellow = "#f4d599"; // Used for clock countdown var red = "#f4c1bc"; // Used for last 2 minutes of clock countdown var ticketHolderBgColor = '#e8fbe8' // Light green highlighting for ticket show buyers var dashLine60 = new Array(60).join("-"); var dashLine70 = new Array(70).join("-"); var dashLine80 = new Array(80).join("-"); var dashLine90 = new Array(90).join("-"); var backgroundImage = ''; var textColor = 'black'; var leftjust1 = 20; var leftjust2 = 20; var leftjust3 = 20; var topjust1 = 5; var topjust2 = 28; var topjust3 = 51; // Arrays */ var fanClubList = []; var tipCountArray = {name: [], amount: []}; var progGoalArray = {desc: [], amt: [], recyc: []}; var drawpanel = {panel: {}}; } //VARIAVEIS E ARRAYS // FUNCTIONS { // *********************************** 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"); } } } //********** Build Fan Club Array ************** function populateFanClubArray(user) { if (!cbjs.arrayContains(fanClubList,user)) { fanClubList.push(user); } else { return; } } //********** Tipper List ************** function findTipper(user) { for (var i = 0; i < tipCountArray.name.length; i++) { if(tipCountArray.name[i] == user) { break; } } return i; } // *********************************** Length of show ************************************** function clockTimeCal() { timeNow = new Date(); return timeNow - ultraAppStartTime.getTime(); } function timeOnline() { var timeElapsed = clockTimeCal(); var clockMS = timeElapsed % 1000; var clockSeconds = ((timeElapsed - clockMS) % 60000); var clockMinutes = ((timeElapsed - clockSeconds - clockMS) % 3600000); var clockHours = (timeElapsed - clockMinutes - clockSeconds - clockMS); clockSeconds = clockSeconds / 1000; clockMinutes = clockMinutes / 60000; clockHours = clockHours / 3600000; if (clockHours > 0) { return clockHours + " hour" + (clockHours > 1 ? "s" : "") + " and " + clockMinutes + " minute" + (clockMinutes > 1 ? "s" : ""); } else if (clockMinutes > 0 && clockSeconds === 0) { return clockMinutes + " minute" + (clockMinutes > 1 ? "s" : ""); } else if (clockMinutes > 0) { return clockMinutes + " minute" + (clockMinutes > 1 ? "s" : "") + " and " + clockSeconds + " second" + (clockSeconds > 1 ? "s" : ""); } else { return clockSeconds + " second" + (clockSeconds > 1 ? "s" : ""); } } // *********************************** Progressive Goal Functions ************************************** function initProgGoal(setby) { progGoalColors(); finalGoalMet = false; totalProgGoals = progGoalArray.desc.length; currentGoalTips = 0; currentGoal = 1; currentGoalDesc = progGoalArray.desc[currentGoal-1]; currentGoalTotal = progGoalArray.amt[currentGoal-1]; changeRoomSubject(); if (progGoalArray.desc.length <= 1) { cb.sendNotice(dashLine60 + '\n* ' + setby + ' has started the Tip Goals App.\n* There is a single goal for the show.\n' + dashLine60, '', progGoalBgColor, progGoalTxtColor, 'bold'); } else { cb.sendNotice(dashLine60 + '\n* ' + setby + ' has started the Tip Goals App.\n* There are ' + totalProgGoals + ' goals in the current show.\n' + dashLine60, '', progGoalBgColor, progGoalTxtColor, 'bold'); } cb.drawPanel(); } function progGoalColors() { progGoalNoticesTxtColor = checkTextColor("Dark Red"); progGoalNoticesBgColor = checkBgColor("Cream"); if (cb.settings.progressiveGoalTextColor == 'Custom') { progGoalTxtColor = checkTextColor(cb.settings.progressiveGoalCustomTextColor); if (progGoalTxtColor == 'default') { cb.sendNotice('Progressive Goals - Error while setting the text color. It has to be in a HEX format. Using default value.', cb.room_slug, yellow, '', 'bold'); progGoalTxtColor = '#FFFFFF'; } } else { progGoalTxtColor = checkTextColor(cb.settings.progressiveGoalTextColor); } if (cb.settings.progressiveGoalBgColor == 'Custom') { progGoalBgColor = checkBgColor(cb.settings.progressiveGoalCustomBgColor); if (progGoalBgColor == 'default') { cb.sendNotice('Leaderboard - Error while setting the background color. It has to be in a HEX format. Using default value.', cb.room_slug, yellow, '', 'bold'); progGoalBgColor = '#FFFFFF'; } } else { progGoalBgColor = checkBgColor(cb.settings.progressiveGoalBgColor); } } function restartGoal() { currentGoal--; currentGoalTips = 0; finalGoalMet = false; nextGoal(); cb.drawPanel(); } function updateGoal(goalnum) { currentGoalDesc = progGoalArray.desc[currentGoal-1]; currentGoalTotal = progGoalArray.amt[currentGoal-1]; changeRoomSubject(); cb.drawPanel(); } //********** Record Tip and Track Goal Progress ************** function recordTip(tipAmount,tipBy,isFan) { if (tipBy != 'bc') { currentAppTotalGoal += tipAmount; currentSessionTotal += tipAmount; } if (!finalGoalMet) { savedCurrentGoalTips = currentGoalTips; currentGoalTips += tipAmount; if (currentGoalTips >= currentGoalTotal) { if (cb.settings.progressiveAutoNext == 'Auto-start next') { exceedGoal(tipAmount,tipBy); } else { goalComplete(); } } } cb.drawPanel(); } function exceedGoal(tipAmount,tipBy) { excessTip = tipAmount - (currentGoalTotal - savedCurrentGoalTips); goalComplete(); if (!finalGoalMet) { nextGoal(); currentGoalTips = excessTip; if (currentGoalTips >= currentGoalTotal) { savedCurrentGoalTips = 0; exceedGoal(currentGoalTips); } } } function goalComplete() { if (progGoalArray.desc.length == 1) { cb.sendNotice(dashLine70 + '\n :CGGoal15 The Goal has been met!! :CGGoal15 \n' + dashLine70, '', progGoalBgColor, progGoalTxtColor, 'bold'); finalGoalMet = true; changeRoomSubject(); } else if ((currentGoal) < progGoalArray.desc.length) { cb.sendNotice(dashLine70 + '\n :CGGoal15 Goal #' + currentGoal + ' (' + progGoalArray.desc[currentGoal-1] + ') has been met!! :CGGoal15 \n' + dashLine70, '', progGoalBgColor, progGoalTxtColor, 'bold'); if (cb.settings.progressiveAutoNext != 'Auto-start next') { cb.sendNotice('The goal has been completed and per configuration the app is awaiting manual advance using the "/next" command', '', yellow, '', '', 'red') cb.sendNotice('The goal has been completed and per configuration the app is awaiting manual advance using the "/next" command', cb.room_slug, yellow, '', '') } } else if ((currentGoal) == progGoalArray.desc.length) { finalGoalMet = true; changeRoomSubject(); cb.sendNotice(dashLine70 + '\n :CGGoal15 Final Goal (' + progGoalArray.desc[currentGoal-1] + ') has been met!! :CGGoal15 \n *****' + getTopTipper() + ' was the top tipper!!! *****\n' + dashLine70, '', progGoalBgColor, progGoalTxtColor, 'bold'); } } function advanceGoal() { currentGoalTips = 0; goalComplete(); if (!finalGoalMet) { nextGoal(); } cb.drawPanel(); } function getTopTipper() { var swapped, temp1, temp2; do { swapped = false; for (var i = 0; i < tipCountArray.amount.length ; i++) { if (tipCountArray.amount[i] < tipCountArray.amount[i + 1]) { temp1 = tipCountArray.amount[i]; temp2 = tipCountArray.name[i]; tipCountArray.amount[i] = tipCountArray.amount[i + 1]; tipCountArray.amount[i + 1] = temp1; tipCountArray.name[i] = tipCountArray.name[i + 1]; tipCountArray.name[i + 1] = temp2; swapped = true; } } } while (swapped); return tipCountArray.name[0]; } function nextGoal() { currentGoal++; currentGoalDesc = progGoalArray.desc[currentGoal-1]; currentGoalTotal = progGoalArray.amt[currentGoal-1]; changeRoomSubject(); } function changeRoomSubject() { if (!finalGoalMet) { newsubject = 'Current Goal: ' + currentGoalDesc + ' at ' + currentGoalTotal + ' tokens. '; newsubject += goalSubjectText; if (progGoalArray.desc.length >= (currentGoal + 1)) { newsubject += ' --- Next Goal: ' + progGoalArray.desc[currentGoal]; } else if (progGoalArray.desc.length > 1) { newsubject += ' --- This is the Last Goal!'; } } else { newsubject = 'All Goals Have Been Completed!!! '; newsubject += goalSubjectText; } cb.changeRoomSubject(newsubject); } function listGoals(group,reqby) { if (group == 'all') { outString = 'Goal List (sent to All) :'; sendto = ''; } else { outString = 'Goal List (sent to You) :'; sendto = reqby; } let i = 0; while (progGoalArray.amt[i] > 0 && progGoalArray.desc[i] != null && progGoalArray.desc[i] != '') { outString += '\nGoal #' + (i+1) + ' : ' + progGoalArray.desc[i] + ' (' + progGoalArray.amt[i] + ' tokens)'; i++; } if (i > 0) { cb.sendNotice(dashLine60 + '\n' + outString + '\n' + dashLine60, sendto, progGoalBgColor, progGoalTxtColor, 'bold'); } else { cb.sendNotice('There are no goals configured', reqby, yellow); } } //********** 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; } //********** Panel ************** function customizePanelText(newcolor,sendto) { if (!newcolor && cb.settings.panelTextColor == 'Custom') { textcolorchk = checkTextColor(cb.settings.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, yellow, ''); } 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, yellow, ''); } else { textColor = textcolorchk; cb.drawPanel(); } } else { textColor = checkTextColor(cb.settings.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, yellow, ''); } } 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, yellow, ''); } } // *********************************** Help Function ************************************** function helpModBC(from) { cb.sendNotice('Tip Goals App Help',from,yellow); cb.sendNotice('You can setup a single goal, or multiple goals that will be progressed through in sequence as users tip. There is a configuration flag that defines if the app automatically moves from one goal to the next, or requires the use of the /next command to advance after the goal is met. If set to automatic advance, tips that exceed the goal will carry over to the next goal. If set to advance by command, the tips do not roll over.' + '\nBy default, the room subject will show the current goal amount and description, the next goal description and a configurable block of text that you can use to describe what happens at the last goal or after the goals, or even just put searchable hashtags to draw more people into the show. This room subject text can be edited using the "/setgoaltext" command as noted below.' + '\nAny changes you make are not stored permanently, they are only stored within the current session. They will be kept if you switch between app features, but not if you deactivate the app. ' + '\nAlso, you must keep the goals in sequence, and cannot add an entry that would leave an empty level. For example, if goal levels 1-3 are filled in, you can\'t add a level 5, you must add a level 4 first. ' ,from); cb.sendNotice('',from,yellow); cb.sendNotice('Tip Goals App Commands ' + '\n/stats : Display a listing of your time online (with the app running) and total tips while the App has been active.' + '\n/addtips [tokens] : This can be used to simulate users having tipped and advance the token count within a goal. Indicate the number of tokens you are adding as the [tokens] parameter, and note the value can be negative. You can add more than the current goal, but you cannot subtract less than has been tipped in the current goal.' + '\n/listgoals (also /lg) : List the current setup of the goals.' + '\n/restartgoal : If you\'d like to repeat a goal (common if you have a single goal you\'re recycling), you can use this command at any time to reset the tip count on the current goal to 0 (even if already complete)' + '\n/setgoal1, /setgoal2, /setgoal3...(thru /setgoal20) [goal] [description] : These are the commands that let you edit the goals for your show. Both the [goal] and [description] parameters must be entered every time and will update both values. Note this is also only a temporary change made within the session, it does not permanently update the launch page config.' + '\nThe 1-20 designation as part of the command identifies which entry you are modifying.' + '\nThe [goal] parameter is the new value you are setting for the goal amount. Even if you are not changing the goal (only changing the description, you must still enter the existing value for the goal.' + '\nThe [description] Parameter is the new value you are setting for the goal description. Even if you are not changing the description (only changing the goal amount), you must still enter the existing value for the description.' + '\nAn example of the syntax for this command would be "/setgoal4 400 Blow job", which would set goal 4 to be a Blow Job once you reach 400 tokens. ' + '\nNote that you can\'t make updates to the current goal or past goal, only future goals.' + '\n/rmvgoal [level] : Remove the goal entry for goal level of [level] (amount and description are both removed). Note this is also only a temporary change made within the session, it does not permanently update the launch page config. ' + '\n/setgoaltext [newsubject] : Update the text that is shown in the Room Subject between the current goal and the next goal.' + '\n/next : Used to advance to the next goal once the current goal is complete, when auto advance is turned off.' + '\n/skip : Advance to the next goal regardless of the status of the current goal.' + '\n/chgpanelbg [imagename]: Change the background of the drawpanel to one of the valid images. Images are updated regularly, so you can see the current list by entering this command with no parameter and the error message will show the current valid choices. Note that you can also see the images by going to the "Source Code" tab for the app and clicking the link for "App Images".' + '\n/chgpaneltext [newcolor]: Change the color of the text in the drawpanel to either a hex code (#0000ff) or the exact text of one of the color choices from the menu ("Dark Green", "Dark Red", etc). You can lookup hex codes for any color on a site such as Color-hexa: https://www.colorhexa.com/' ,from); cb.sendNotice('',from,yellow); } } } // FUNCTIONS // USER Enter 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 isNotGray = user.has_tokens; // for testing gray/fanclub user functions on testbed //if (u == 'dorothyuser2'){ // isNotGray = false; // isFan = true; //} // if(isFan) { populateFanClubArray(u); } // **** General Entry Message if(cb.settings.enableEntryMessage == 'Yes') { if (progGoalArray.desc.length <= 1) { cb.sendNotice(cb.settings.entryMessage + '\n* The Progressive Goal Feature is currently active, and there is a single goal set up for the show.', u, progGoalBgColor, progGoalTxtColor, 'bold'); } else { cb.sendNotice(cb.settings.entryMessage + '\n* The Progressive Goal Feature is currently active, and there are ' + totalProgGoals + ' goals set up for the show.', u, progGoalBgColor, progGoalTxtColor, 'bold'); } } // USER Enter }); }; /* FIM EXECUCAO -- Progressive Goals game*/ /* INICIO EXECUCAO -- Tip Jar game*/ if (cb.settings.enableTipJarGame == 'yes') { var isItGoing = 0; var goalMet = 0; var tipJar = 0; var totalTip = 0; var showOrNot = ""; var roomName = cb.settings.room_name; var startApp = new Date(); var startAt = cb.settings.get_it_going; //var lastTipper = ''; var reduceTJ = cb.settings.reduce_tip_jar * 1000; var reduceBy = cb.settings.reduce_tips_by; var resumeShow = reduceBy; var bigTipper = "--"; var bigTip = 0; var bigTipLocation = -1; var topTipper = new Array(); var ttLength = 0; cb.changeRoomSubject(roomName + ' [Start Tipping]'); cb.setTimeout(checkJar, reduceTJ); cb.chatNotice("Type '/stats' to see statistics."); cb.chatNotice("Broadcasters and Mods: Type '/help' to see additional functions."); function checkJar() { if(isItGoing == 1) { if(tipJar>0) { tipJar=tipJar-reduceBy; if(tipJar<0) { resetApp(); } } else { resetApp(); } } cb.setTimeout(checkJar, reduceTJ); cb.drawPanel(); } function checkTip(u,t) { var exists = 0; var location = 0; for (i=0;i<topTipper.length;i++){ if(topTipper[i].username == u) { exists = 1; location = i; } } if (exists == 1) { topTipper[location].amount += t; } else { var tipper=new Object(); tipper.username=u; tipper.amount=t; topTipper[ttLength] = tipper; ttLength++; } for (i=0;i<topTipper.length;i++){ if(topTipper[i].amount > bigTip) { bigTip = topTipper[i].amount; bigTipLocation = i; } } bigTipper = topTipper[bigTipLocation].username + "(" + topTipper[bigTipLocation].amount + ")"; } function printTokens(x) { cb.chatNotice("*** Keep It Going - Tokens Earned by User ***",x); for (i=0;i<topTipper.length;i++) { cb.chatNotice(topTipper[i].username + " (" + topTipper[i].amount + ")",x); } cb.chatNotice("Total Tips: " + totalTip,x); } function resetApp() { tipJar = 0; isItGoing = 0; cb.changeRoomSubject(roomName + " - [Show Stopping - Start Tipping to start it again]"); } function chageTimer(x) { if (x == 'Faster') { if (reduceTJ > 1000) { reduceTJ -= 1000; } } else if (x=='Slower') { if (reduceTJ < 60000) { reduceTJ += 1000; } } else if (x=='Fastest') { reduceTJ = 1000; } else if (x=='Slowest') { reduceTJ = 60000; } else if (x=='Pause') { reduceBy=0; } else if (x=='Resume') { reduceBy=resumeShow; } } function printHelp(x) { var help = "*** Keep It Going App - Help ***\n"; help += "If 'Show Is On' is in the Keep It Going Status, start your show\n"; help += "If 'STOP SHOW!!' is in the Keep It Going Status, stop your show\n"; help += "You can control how quickly the Tip Jar empties:\n"; help += "Type '/faster' to speed up emptying the Tip Jar\n"; help += "Type '/slower' to slow down emptying the Tip Jar\n"; help += "Type '/fastest' to set emptying Tip Jar Rate to 1 sec\n"; help += "Type '/slowest' to set emptying Tip Jar Rate to 60 secs\n"; help += "Type '/resume' to resume Tip Jar emptying\n"; help += "Type '/pause' to pause Tip Jar emptying\n"; help += "Type '/tokens' to see the amount each tipper has tipped."; cb.chatNotice(help, x); } function printStats(x) { var running = ((new Date()).getTime() - startApp.getTime()) / 1000; var minutes = Math.round(running/60); var hours = Math.floor(minutes/60); minutes = minutes%60; var runningStr = hours + ' hrs. ' + minutes + ' mins.'; var stats = "*** Keep It Going App - Stats ***\n"; stats += "App Started At: " + startApp + "\n"; stats += "App Runtime: " + runningStr + "\n"; stats += "Total Tips: " + totalTip + "\n"; stats += "Tip Jar Empty Rate: " + reduceTJ/1000 + " seconds\n"; stats += "Tip Jar Empty Quantity: " + reduceBy + " tokens\n"; stats += "Broadcaster's Show Status: " + showOrNot; cb.chatNotice(stats,x); } cb.onDrawPanel(function(user) { if (user == cb.room_slug) { if (isItGoing == 1) { showOrNot = "Show is On"; } else { showOrNot = "STOP SHOW!!"; } return { 'template': '3_rows_of_labels', 'row1_label':'Keep It Going:', 'row1_value':showOrNot, 'row2_label':'Total Tokens Earned:', 'row2_value':"" + totalTip + ' Tokens', 'row3_label': 'Tip Jar:', 'row3_value': tipJar }; } else { if(isItGoing == 1) { return { 'template': '3_rows_of_labels', 'row1_label': 'Keep It Going:', 'row1_value': 'Don\'t Let It Empty', 'row2_label': 'Tip Jar:', 'row2_value': tipJar, 'row3_label': 'Big Tipper:', 'row3_value': bigTipper }; } else if (isItGoing == 0 && goalMet == 1) { var toGo = startAt - tipJar; return { 'template': '3_rows_of_labels', 'row1_label': 'Lets Get It Going!', 'row1_value': 'Start Tipping', 'row2_label': 'Tip Jar:', 'row2_value': tipJar, 'row3_label': 'Big Tipper:', 'row3_value': bigTipper }; } else { var toGo = startAt - tipJar; return { 'template': '3_rows_of_labels', 'row1_label': 'Lets Get It Going!', 'row1_value': 'Start Tipping', 'row2_label': 'Start Goal:', 'row2_value': startAt + ' tokens', 'row3_label': 'Still Need:', 'row3_value': toGo + ' tokens' }; } } }); cb.onTip(function (tip) { tipJar += parseInt(tip['amount']) totalTip += parseInt(tip['amount']) //lastTipper = tip['from_user'] if(isItGoing == 0 && goalMet ==0) { if(tipJar >= startAt) { isItGoing = 1; goalMet = 1; cb.changeRoomSubject(roomName + ' - [Keep It Going - Don\'t Let the Tip Jar Empty]'); } } else if (isItGoing == 0 && goalMet == 1){ isItGoing = 1; goalMet = 1; cb.changeRoomSubject(roomName + ' - [Keep It Going - Don\'t Let the Tip Jar Empty]'); } checkTip(tip['from_user'],tip['amount']); cb.drawPanel(); }); cb.onMessage(function (msg) { if (msg['m'] == '/faster' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; chageTimer("Faster"); } else if (msg['m'] == '/fastest' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; chageTimer("Fastest"); } else if (msg['m'] == '/slower' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; chageTimer("Slower"); } else if (msg['m'] == '/slowest' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; chageTimer("Slowest"); } else if (msg['m'] == '/pause' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; chageTimer("Pause"); } else if (msg['m'] == '/resume' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; chageTimer("Resume"); } else if (msg['m'] == '/help' && (msg['user'] == cb.room_slug || msg['is_mod'])) { msg['X-Spam'] = true; printHelp(msg['user']); } else if (msg['m'] == '/stats') { msg['X-Spam'] = true; printStats(msg['user']); } else if (msg['m'] == '/tokens') { msg['X-Spam'] = true; printTokens(msg['user']); } else if (msg['user'] == "acoola") { msg['background'] = '#fc3'; } else if (bigTipLocation >= 0) { if (msg['user'] == topTipper[bigTipLocation].username) { msg['background'] = '#ccff00'; } } return msg; }); }; /* FIM EXECUCAO -- Tip Jar game*/ function init() { if (cb.settings.enableMasterDemandsGame == 'yes') { // new_subject = cb.settings.room_subject // cb.log("Changing subject to: " + new_subject); // cb.changeRoomSubject(new_subject); build_rules_list(); set_notice_timer(); }; if (cb.settings.enableProgressiveGoalGame == 'yes') { //INITIALIZE { if (initialize == 0) { var BC = cb.room_slug; // *** Load Array for Progressive Goals for (let i = 1; i <= 20; i++) { goalDesc = this["progressiveGoalDescription"+i]; goalAmt = this["progressiveGoalAmount"+i]; goalRecyc = this["progressiveGoalRecycle"+i]; if(goalDesc != '' && goalDesc != null && goalAmt != '' && goalAmt != null) { progGoalArray.desc.push(goalDesc); progGoalArray.amt.push(goalAmt); progGoalArray.recyc.push(goalRecyc); } } //*** Initialize background if (cb.settings.panelBackground != 'default - no image') { if (cbjs.arrayContains(backgroundArray.menu,cb.settings.panelBackground)) { newbackground = backgroundArray.command[backgroundArray.menu.indexOf(cb.settings.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, yellow); } } else { customPanel = false; } initProgGoal(BC); ultraAppStartTime = new Date(); initialize = 1; } } // INITIALIZE }; } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.