Apps Home
|
Create an App
Just4easygoing1
Author:
petiteprincess0
Description
Source Code
Launch App
Current Users
Created by:
Petiteprincess0
var times_goal_reached = 0; var last_time_goal_reached = null; var current_goal_tipped = 0; var current_description = null; var current_free_tips = 0; var timeint_just4easygoing1_notice = 0; var timeint_wheel_notice = 0; var just4easygoing1_color = '#F9DBFE'; var wheel_color = '#CEFAD6'; var set_tokens_command = '!settok'; var set_reached_command = '!setreached'; var new_subject_command = '!status'; var help_command = '!help'; var just4easygoing1_command = '!j4etimer'; var autoreset_command = '!autoreset'; var wheel_command = '!wheel'; var wheel_reward_command = '!reward'; cb.settings_choices = [{ name: 'goal_description', type: 'str', defaultValue: 'easygoing1\'s room', minLength: 1, maxLength: 255, label: 'Room\'s status' }, { name: 'just4easygoing1_activation', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', label: 'Do you want to activate the just4easygoing1 function?' }, { name: 'Just4V_notice_timer', type: 'int', minValue: 0, default: 60, label: 'Time interval to display the "just4easygoing1" notice in seconds (0 = never)' }, { name: 'autoreset_activation', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', label: 'Do you want to activate the Auto-Reset Tip Goal?' }, { name: 'tokens', type: 'int', minValue: 1, default: 100, label: 'Tokens to reach the Auto-Reset Tip Goal' }, { name: 'received_tokens', type: 'int', minValue: 0, default: 0, label: 'Already received tokens' }, { name: 'wheel_activation', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', label: 'Do you want to activate the easygoing1\'s Wheel of Fortune?' }, { name: 'wheel_tokens', type: 'int', minvalue: 1, default: 111, label: 'Tokens to spin the easygoing1\'s Wheel of Fortune' }, { name: 'wheel_notice_timer', type: 'int', minValue: 0, default: 30, label: 'Time interval to display the easygoing1\'s Wheel of Fortune notice in seconds (0 = never)' }, { name: 'pos1', type: 'str', minLength: 1, maxLength: 255, label: 'Wheel Reward 1', required: false }, { name: 'pos2', type: 'str', minLength: 1, maxLength: 255, label: 'Wheel Reward 2', required: false }, { name: 'pos3', type: 'str', minLength: 1, maxLength: 255, label: 'Wheel Reward 3', required: false }, { name: 'pos4', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 4', required: false }, { name: 'pos5', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 5', required: false }, { name: 'pos6', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 6', required: false }, { name: 'pos7', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 7', required: false }, { name: 'pos8', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 8', required: false }, { name: 'pos9', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 9', required: false }, { name: 'pos10', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 10', required: false }, { name: 'pos11', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 11', required: false }, { name: 'pos12', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 12', required: false }, { name: 'pos13', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 13', required: false }, { name: 'pos14', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 14', required: false }, { name: 'pos15', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 15', required: false }, { name: 'pos16', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 16', required: false }, { name: 'pos17', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 17', required: false }, { name: 'pos18', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 18', required: false }, { name: 'pos19', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 19', required: false }, { name: 'pos20', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 20', required: false }, { name: 'pos21', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 21', required: false }, { name: 'pos22', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 22', required: false }, { name: 'pos23', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 23', required: false }, { name: 'pos24', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 24', required: false }, { name: 'pos25', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 25', required: false }, { name: 'pos26', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 26', required: false }, { name: 'pos27', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 27', required: false }, { name: 'pos28', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 28', required: false }, { name: 'pos29', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 29', required: false }, { name: 'pos30', type: 'str', minLength: 0, maxLength: 255, label: 'Wheel Reward 30', required: false }]; function refresh() { cb.log("Refresh called"); cb.setTimeout(refresh, 20000); cb.drawPanel() } function update_subject() { var a = current_description; if (cb.settings.autoreset_activation == 'Yes') { a += " [" + tips_remaining() + " tokens remaining]" } cb.log("Changing subject to: " + a); cb.changeRoomSubject(a) } function goalReached(a) { last_time_goal_reached = new Date(); var b = Math.floor(current_goal_tipped / cb.settings.tokens); for (var i = 0; i < b; i++) { times_goal_reached++; current_goal_tipped -= cb.settings.tokens; if (a != '') { cb.sendNotice("Goal was reached for the " + getNumberString(times_goal_reached) + " time!"); cb.sendNotice('The user ' + a + ' has reached the goal.', cb.room_slug, "#FEF9CD", "#1A1AD7", "bold") } } } function getNumberString(a) { var b = null; var c = String(a).charAt(String(a).length - 1); if ((c == '1') && (a != 11)) { b = a + "st" } else if ((c == '2') && (a != 12)) { b = a + "nd" } else if ((c == '3') && (a != 13)) { b = a + "rd" } else { b = "" + a + "th" } return (b) } function tips_remaining() { var r = cb.settings.tokens - current_goal_tipped; if (r < 0) { return 0 } else { return r } } function notice_just4easygoing1() { if ((cb.settings.just4easygoing1_activation == 'Yes') && (timeint_just4easygoing1_notice > 0)) { cb.sendNotice('Type just4easygoing1 at the beginning of your tip note, if your tip should not count for the goal.', '', just4easygoing1_color, '#000000', 'bolder'); cb.setTimeout(notice_just4easygoing1, parseInt(timeint_just4easygoing1_notice)) } } function notice_wheel() { if ((cb.settings.wheel_activation == 'Yes') && (timeint_wheel_notice > 0)) { cb.sendNotice(cb.room_slug + '\'s Wheel of Fortune [for V].\nTip ' + cb.settings.wheel_tokens + ' to spin the Wheel of Fortune. Type !reward to display the rewards.', '', wheel_color, '#000000', 'bold'); cb.setTimeout(notice_wheel, parseInt(timeint_wheel_notice)) } } function startsWith(a, b) { return a.substring(0, b.length).toUpperCase() === b.toUpperCase() } function spinWheel(a) { var b = ''; if (cb.settings.wheel_activation == 'Yes') { var c = Math.floor(Math.random() * (rewards.length)); b += '======================================================================\n'; b += '\n'; b += 'Spinning the Wheel of Fortune for ' + a + '\n'; b += 'Wheel stopped on: ' + rewards[c] + '\n'; b += '\n'; b += '======================================================================\n'; cb.sendNotice(b, '', wheel_color, '#000000', 'bold') } } var temp_rewards = new Array(cb.settings.pos1, cb.settings.pos2, cb.settings.pos3, cb.settings.pos4, cb.settings.pos5, cb.settings.pos6, cb.settings.pos7, cb.settings.pos8, cb.settings.pos9, cb.settings.pos10, cb.settings.pos11, cb.settings.pos12, cb.settings.pos13, cb.settings.pos14, cb.settings.pos15, cb.settings.pos16, cb.settings.pos17, cb.settings.pos18, cb.settings.pos19, cb.settings.pos20, cb.settings.pos21, cb.settings.pos22, cb.settings.pos23, cb.settings.pos24, cb.settings.pos25, cb.settings.pos26, cb.settings.pos27, cb.settings.pos28, cb.settings.pos29, cb.settings.pos30); var rewards = new Array(); for (var i = 0; i < temp_rewards.length; i++) { if (temp_rewards[i] != '') { rewards.push(temp_rewards[i]) } } if (cb.settings.just4easygoing1_activation == 'Yes') { timeint_just4easygoing1_notice = cb.settings.Just4V_notice_timer * 1000; if (timeint_just4easygoing1_notice > 0) { cb.setTimeout(notice_just4easygoing1, parseInt(timeint_just4easygoing1_notice)) } } if (cb.settings.wheel_activation == 'Yes') { timeint_wheel_notice = cb.settings.wheel_notice_timer * 1000; if (timeint_wheel_notice > 0) { cb.setTimeout(notice_wheel, parseInt(timeint_wheel_notice)) } } function init() { if (cb.settings.just4easygoing1_activation == 'Yes') { cb.sendNotice('Type just4easygoing1 at the beginning of your tip note, if your tip should not count for the goal.', '', just4easygoing1_color, '#000000', 'bold') } if (cb.settings.wheel_activation == 'Yes') { cb.sendNotice(cb.room_slug + '\'s Wheel of Fortune [for V].\nTip ' + cb.settings.wheel_tokens + ' to spin the Wheel of Fortune. Type !reward to display the rewards.', '', wheel_color, '#000000', 'bold') } current_description = cb.settings.goal_description; current_goal_tipped = cb.settings.received_tokens; if (current_goal_tipped >= cb.settings.tokens) { goalReached('') } cb.drawPanel(); update_subject() } cb.onTip(function(a) { if ((cb.settings.just4easygoing1_activation == 'Yes') && (startsWith(a['message'], 'just4easygoing1'))) { current_free_tips += a['amount']; if ((cb.settings.autoreset_activation == 'Yes') && (cb.settings.wheel_activation == 'Yes')) { cb.sendNotice('Thanks to ' + a['from_user'] + '. This tip doesn\'t count for the Auto-Reset Goal and ' + a['from_user'] + ' doesn\'t want to spin the Wheel of Fortune.', '', just4easygoing1_color, '#000000', 'bold') } else if (cb.settings.autoreset_activation == 'Yes') { cb.sendNotice('Thanks to ' + a['from_user'] + '. This tip doesn\'t count for the Auto-Reset Goal.', '', just4easygoing1_color, '#000000', 'bold') } else if (cb.settings.wheel_activation == 'Yes') { cb.sendNotice('Thanks to ' + a['from_user'] + '. ' + a['from_user'] + ' doesn\'t want to spin the Wheel of Fortune.', '', just4easygoing1_color, '#000000', 'bold') } } else { if ((cb.settings.wheel_activation == 'Yes') && (a['amount'] == cb.settings.wheel_tokens)) { spinWheel(a['from_user']) } current_goal_tipped += a['amount']; if (current_goal_tipped >= cb.settings.tokens) { goalReached(a['from_user']) } } update_subject(); cb.drawPanel() }); cb.onMessage(function(a) { var b = ''; if (a['m'][0] == '!') { if (a['user'] == cb.room_slug) { if (startsWith(a['m'], set_tokens_command)) { a['X-Spam'] = true; var c = a['m'].slice(set_tokens_command.length); times_goal_reached = Math.floor(c / cb.settings.tokens); current_goal_tipped = cb.settings.tokens; last_time_goal_reached = new Date(); cb.drawPanel(); cb.sendNotice('The tokens received has been updated!', a['user']) } else if (startsWith(a['m'], set_reached_command)) { a['X-Spam'] = true; var c = a['m'].slice(set_reached_command.length); times_goal_reached = c; last_time_goal_reached = new Date(); current_goal_tipped = 0; cb.drawPanel(); cb.sendNotice('The number of times reached has been updated!', a['user']) } else if (startsWith(a['m'], new_subject_command)) { a['X-Spam'] = true; var d = a['m'].slice(new_subject_command.length + 1); current_description = d; update_subject(); cb.drawPanel() } else if (startsWith(a['m'], just4easygoing1_command)) { a['X-Spam'] = true; var e = timeint_just4easygoing1_notice; timeint_just4easygoing1_notice = parseInt(a['m'].slice(just4easygoing1_command.length + 1)) * 1000; if (e == 0) { notice_just4easygoing1() } } } else { if (cb.settings.just4easygoing1_activation == 'Yes') { if (startsWith(a['m'], help_command)) { a['X-Spam'] = true; cb.sendNotice('Type just4easygoing1 at the beginning of your tip note, if your tip should not count for the goal.', '', just4easygoing1_color, '#000000', 'bolder'); cb.sendNotice('Command !j4etimer [Number of seconds]: allow you to define the time interval to display the "just4easygoing1" notice. Red and green can use it.', '', just4easygoing1_color, '', 'bolder', 'red'); cb.sendNotice('Command !j4etimer [Number of seconds]: allow you to define the time interval to display the "just4easygoing1" notice. Red and green can use it.', '', just4easygoing1_color, '', 'bolder', 'green') } else if (startsWith(a['m'], just4easygoing1_command)) { if ((a['is_mod'] == true) || (a['in_fanclub'] == true)) { a['X-Spam'] = true; var f = timeint_just4easygoing1_notice; timeint_just4easygoing1_notice = parseInt(a['m'].slice(just4easygoing1_command.length + 1)) * 1000; if (f == 0) { notice_just4easygoing1() } } } } } if (startsWith(a['m'], wheel_reward_command)) { a['X-Spam'] = true; if (cb.settings.wheel_activation == 'Yes') { cb.sendNotice(cb.room_slug + '\'s Wheel of Fortune [for V]. The rewards.', '', wheel_color, '#000000', 'bold'); for (var i = 0; i < rewards.length; i++) { b += (i + 1) + '. ' + rewards[i] + '\n' } cb.sendNotice(b, '', wheel_color, '#000000', '') } } } }); cb.onDrawPanel(function(a) { if (cb.settings.autoreset_activation == 'Yes') { if (cb.settings.just4easygoing1_activation == 'Yes') { if (times_goal_reached == 0) { return { 'template': '3_rows_of_labels', 'row1_label': 'Received / Goal (Total):', 'row1_value': '' + current_goal_tipped + ' / ' + cb.settings.tokens + ' (' + ((times_goal_reached * cb.settings.tokens) + current_goal_tipped) + ')', 'row2_label': 'Tokens "just4easygoing1":', 'row2_value': '' + current_free_tips, 'row3_label': 'Hit Goal / Last Time:', 'row3_value': '' + times_goal_reached + ' time / Never' } } else { return { 'template': '3_rows_of_labels', 'row1_label': 'Received / Goal (Total):', 'row1_value': '' + current_goal_tipped + ' / ' + cb.settings.tokens + ' (' + ((times_goal_reached * cb.settings.tokens) + current_goal_tipped) + ')', 'row2_label': 'Tokens "just4easygoing1":', 'row2_value': '' + current_free_tips, 'row3_label': 'Hit Goal / Last Time:', 'row3_value': '' + times_goal_reached + ' time(s) / ' + Math.floor(((new Date()).getTime() - last_time_goal_reached.getTime()) / 60000) + ' min ago' } } } else { if (times_goal_reached == 0) { return { 'template': '3_rows_of_labels', 'row1_label': 'Received / Goal (Total):', 'row1_value': '' + current_goal_tipped + ' / ' + cb.settings.tokens + ' (' + ((times_goal_reached * cb.settings.tokens) + current_goal_tipped) + ')', 'row2_label': 'Hit Goal For:', 'row2_value': '' + times_goal_reached + ' times', 'row3_label': 'Last Reached:', 'row3_value': 'Never' } } else { return { 'template': '3_rows_of_labels', 'row1_label': 'Received / Goal (Total):', 'row1_value': '' + current_goal_tipped + ' / ' + cb.settings.tokens + ' (' + ((times_goal_reached * cb.settings.tokens) + current_goal_tipped) + ')', 'row2_label': 'Hit Goal For:', 'row2_value': '' + times_goal_reached + ' times', 'row3_label': 'Last Reached:', 'row3_value': '' + Math.floor(((new Date()).getTime() - last_time_goal_reached.getTime()) / 60000) + ' minutes ago' } } } } else { if (cb.settings.just4easygoing1_activation == 'Yes') { return { 'template': '3_rows_of_labels', 'row1_label': '', 'row1_value': '', 'row2_label': 'Tokens "just4easygoing1":', 'row2_value': '' + current_free_tips, 'row3_label': '', 'row3_value': '' } } } }); init(); cb.setTimeout(refresh, 20000);
© Copyright Freesexcam 2011- 2024. All Rights Reserved.