Apps Home
|
Create an App
Auto Reset Multi Tip Goal
Author:
badbadbubba
Description
Source Code
Launch App
Current Users
Created by:
Badbadbubba
// Auto-Reset Multi Tip Goal // Based on Auto-Reset Tip Goal by Biron // V1.0.0 Mods July 31 2014 by Badbadbubba // Added multiplier goals, remove old goals from subject when met // // vars var times_goal_reached = 0; var last_time_goal_reached = null; var current_goal_tipped = 0; cb.settings_choices = [ {name: 'tokens', type: 'int', label:'Goal Tokens', minValue: 1, default: 100}, {name: 'goal_description', type: 'str', label:'Goal', minLength: 1, maxLength: 255, default:'Flash'}, {name: 'multi1', type: 'int', label:'Multiplier 1', minValue: 1, default: 2}, {name: 'multi1_desc', type: 'str', label:'Multiplier 1 Goal', minLength: 0, maxLength: 255, default:'Bra Off'}, {name: 'multi2', type: 'int', label:'Multiplier 2 (0 to disable)', minValue: 0, default: 5, required: false}, {name: 'multi2_desc', type: 'str', label:'Multiplier 2 Goal', minLength: 0, maxLength: 255, default:'Naked', required: false}, {name: 'multi3', type: 'int', label:'Multiplier 3 (0 to disable)', minValue: 0, default: 10, required: false}, {name: 'multi3_desc', type: 'str', label:'Multiplier 3 Goal', minLength: 0, maxLength: 255, default:'Cum Show',required: false}, {name: 'multi4', type: 'int', label:'Multiplier 4 (0 to disable)', minValue: 0, default: 15, required: false}, {name: 'multi4_desc', type: 'str', label:'Multiplier 4 Goal', minLength: 0, maxLength: 255, default:'Shower Show',required: false}, {name: 'multi5', type: 'int', label:'Multiplier 5 (0 to disable)', minValue: 0, default: 0, required: false}, {name: 'multi5_desc', type: 'str', label:'Multiplier 5 Goal', minLength: 0, maxLength: 255, required: false} ]; // handlers cb.onTip(function(tip) { current_goal_tipped += tip['amount'] if (current_goal_tipped >= cb.settings.tokens) { goalReached(); } update_subject(); cb.drawPanel(); }); cb.onDrawPanel(function(user) { 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' }; } }); // Functions function refresh() { cb.log("Refresh called"); cb.setTimeout(refresh, 20000); cb.drawPanel(); } function update_subject() { var gross_tips = times_goal_reached * cb.settings.tokens + current_goal_tipped; var new_subject = cb.settings.goal_description + " [" + tips_remaining() + " tokens left] "; for (var i= 1; i<= 5; i++) { var multiplier = parseInt(cb.settings['multi' + i]); var multiplier_goal = cb.settings['multi' + i + '_desc']; if ((gross_tips < (multiplier * cb.settings.tokens)) && (multiplier > 0)) { new_subject += multiplier_goal + '(' + multiplier + 'x) ' } } cb.log("Changing subject to: " + new_subject); cb.changeRoomSubject(new_subject); } function check_multigoal(times_reached) { for (var i= 1; i<= 5; i++) { var multiplier = parseInt(cb.settings['multi' + i]); var multiplier_goal = cb.settings['multi' + i + '_desc']; if ((times_reached==multiplier) && (multiplier > 0)) { cb.chatNotice("*** Multi Goal Reached " + multiplier + "x " + multiplier_goal + ' ***','','','','bold'); } } } function goalReached() { last_time_goal_reached = new Date(); var curr_times_reached = Math.floor(current_goal_tipped / cb.settings.tokens); for (var i = 0; i < curr_times_reached; i++) { times_goal_reached++; current_goal_tipped -= cb.settings.tokens; cb.chatNotice("Goal was reached for the " + getNumberString(times_goal_reached) + " time!"); check_multigoal(times_goal_reached); } } function getNumberString(number) { var numberString = null; if (number == 1) { numberString = "1st"; } else if (number == 2) { numberString = "2nd"; } else if (number == 3) { numberString = "3rd"; } else { numberString = "" + number + "th"; } return (numberString); } function tips_remaining() { var r = cb.settings.tokens - current_goal_tipped; if (r < 0) { return 0; } else { return r; } } function init() { update_subject(); } init(); cb.setTimeout(refresh, 20000);
© Copyright Freesexcam 2011- 2024. All Rights Reserved.