Apps Home
|
Create an App
MvN3
Author:
armincheggg
Description
Source Code
Launch App
Current Users
Created by:
Armincheggg
/** * DariApp * Version: 1.0.1 * Author: KingChris_ * Date: 2016-02-23 * Last Update: 2016-02-24 * With code or ideas originally from: Sethir, zingknaat, sweetdann, Britney_And_Justin **/ var DariAppVersion = '1.0.1'; var tipCounter = 0; var highTipper = '--'; var highTipAmount = 0; var roomKing = '--'; var crownIcon = '\u265B'; var lastTipper = '--'; var lastTipAmount = 0; var wofPrizes = []; var wofSpinCount = 0; var tipTotals = {}; var goalReached = 0; cb.settings_choices = [ // Tip goal {name: 'goal_enabled', type: 'choice', label: 'Enable Tip Goal?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'goal_total', type: 'int', label: 'Tokens to achieve goal', defaultValue: 1000}, {name: 'goal_subject', type: 'str', label: 'Goal Subject', defaultValue: '#cum show!'}, {name: 'goal_reached', type: 'str', label: 'Goal Reached Subject', defaultValue: 'Goal reached! #cum show now in progress. Thanks to all tippers!'}, // Tip menu {name: 'menu_item1', type: 'str', label: 'Menu Item #1', defaultValue: 'spank butt'}, {name: 'menu_item1_price', type: 'int', label: 'Price for item #1', defaultValue: 25}, {name: 'menu_item2', type: 'str', label: 'Menu Item #2', defaultValue: 'dance', required: false}, {name: 'menu_item2_price', type: 'int', label: 'Price for item #2', defaultValue: 35, required: false}, {name: 'menu_item3', type: 'str', label: 'Menu Item #3', defaultValue: 'camel toe', required: false}, {name: 'menu_item3_price', type: 'int', label: 'Price for item #3', defaultValue: 48, required: false}, {name: 'menu_item4', type: 'str', label: 'Menu Item #4', defaultValue: 'show boobs/pussy/ass', required: false}, {name: 'menu_item4_price', type: 'int', label: 'Price for item #4', defaultValue: 50, required: false}, {name: 'menu_item5', type: 'str', label: 'Menu Item #5', defaultValue: '2 dances + spanks', required: false}, {name: 'menu_item5_price', type: 'int', label: 'Price for item #5', defaultValue: 69, required: false}, {name: 'menu_item6', type: 'str', label: 'Menu Item #6', defaultValue: 'finger in pussy slit', required: false}, {name: 'menu_item6_price', type: 'int', label: 'Price for item #6', defaultValue: 90, required: false}, {name: 'menu_item7', type: 'str', label: 'Menu Item #7', defaultValue: 'jiggly puss / pussy squeeze', required: false}, {name: 'menu_item7_price', type: 'int', label: 'Price for item #7', defaultValue: 95, required: false}, {name: 'menu_item8', type: 'str', label: 'Menu Item #8', defaultValue: 'rear reveal', required: false}, {name: 'menu_item8_price', type: 'int', label: 'Price for item #8', defaultValue: 99, required: false}, {name: 'menu_item9', type: 'str', label: 'Menu Item #9', defaultValue: 'gap-cam or desk-cam view pussy close up', required: false}, {name: 'menu_item9_price', type: 'int', label: 'Price for item #9', defaultValue: 101, required: false}, {name: 'menu_item10', type: 'str', label: 'Menu Item #10', defaultValue: 'spread pussy / rear spread', required: false}, {name: 'menu_item10_price', type: 'int', label: 'Price for item #10', defaultValue: 105, required: false}, {name: 'menu_item11', type: 'str', label: 'Menu Item #11', defaultValue: 'rear in your face', required: false}, {name: 'menu_item11_price', type: 'int', label: 'Price for item #11', defaultValue: 111, required: false}, {name: 'menu_item12', type: 'str', label: 'Menu Item #12', defaultValue: 'camel toe + rear spread', required: false}, {name: 'menu_item12_price', type: 'int', label: 'Price for item #12', defaultValue: 115, required: false}, {name: 'menu_item13', type: 'str', label: 'Menu Item #13', defaultValue: 'shake smack spread', required: false}, {name: 'menu_item13_price', type: 'int', label: 'Price for item #13', defaultValue: 120, required: false}, {name: 'menu_item14', type: 'str', label: 'Menu Item #14', defaultValue: 'boing boing pussy!', required: false}, {name: 'menu_item14_price', type: 'int', label: 'Price for item #14', defaultValue: 149, required: false}, {name: 'menu_item15', type: 'str', label: 'Menu Item #15', defaultValue: 'lips that grip', required: false}, {name: 'menu_item15_price', type: 'int', label: 'Price for item #15', defaultValue: 199, required: false}, // Wheel of Fortune {name: 'wof_enabled', type: 'choice', label: 'Enable Wheel of Fortune?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'wof_price', type: 'int', label: 'Price for Wheel of Fortune (make sure there is NOT a menu item at this price!)', minValue: 1, defaultValue: 33}, {name: 'wof_prize1', type: 'str', label: 'Prize #1', defaultValue: 'spank butt'}, {name: 'wof_prize2', type: 'str', label: 'Prize #2', defaultValue: 'spank pussy'}, {name: 'wof_prize3', type: 'str', label: 'Prize #3', defaultValue: 'show boobs'}, {name: 'wof_prize4', type: 'str', label: 'Prize #4', defaultValue: 'show pussy', required: false}, {name: 'wof_prize5', type: 'str', label: 'Prize #5', defaultValue: 'show ass', required: false}, {name: 'wof_prize6', type: 'str', label: 'Prize #6', defaultValue: 'suck nipples', required: false}, {name: 'wof_prize7', type: 'str', label: 'Prize #7', defaultValue: 'dance', required: false}, {name: 'wof_prize8', type: 'str', label: 'Prize #8', defaultValue: 'spank butt both hands hard', required: false}, {name: 'wof_prize9', type: 'str', label: 'Prize #9', defaultValue: 'gap-cam', required: false}, {name: 'wof_prize10', type: 'str', label: 'Prize #10', defaultValue: 'floor-cam dance', required: false}, {name: 'wof_prize11', type: 'str', label: 'Prize #11', defaultValue: '', required: false}, {name: 'wof_prize12', type: 'str', label: 'Prize #12', defaultValue: '', required: false}, {name: 'wof_prize13', type: 'str', label: 'Prize #13', defaultValue: '', required: false}, {name: 'wof_prize14', type: 'str', label: 'Prize #14', defaultValue: '', required: false}, {name: 'wof_prize15', type: 'str', label: 'Prize #15', defaultValue: '', required: false}, // King Tipper / Highest Tip {name: 'ht_enabled', type: 'choice', label: 'Enable Highest Tip? (highest single tip)', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'king_enabled', type: 'choice', label: 'Enable King Tipper? (total tokens given)', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'king_minimum', type: 'int', label: 'Minimum Tokens Tipped to Become King', minValue: 1, defaultValue: 100}, //{name: 'king_crown', type: 'choice', label: 'King Crown Icon', choice1: '', choice2: '\u265B', choice3: ':smallCrown', defaultValue: '\u265B'}, // Blackjack {name: 'blackjack_enabled', type: 'choice', label: 'Enable Blackjack? (you need an actual deck of cards to play!)', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'blackjack_price', type: 'int', label: 'Price for Blackjack (make sure there is NOT a menu item at this price!)', minValue: 1, defaultValue: 42}, {name: 'bjinfo1', type: 'str', label: 'Blackjack Rules/Info Line 1', defaultValue: 'RULES: Get 21 points (or as close as you can). Face cards = 10. Aces = 1 or 11. Can split pairs if you want. If we tie we draw cards again. If you reach 5 cards without busting you automatically win.', required: false}, {name: 'bjinfo2', type: 'str', label: 'Blackjack Rules/Info Line 2', defaultValue: 'If you lose - you get nothing.', required: false}, {name: 'bjinfo3', type: 'str', label: 'Blackjack Rules/Info Line 3', defaultValue: 'If you win - you can choose any item off my tip menu up to a value of 120tks.', required: false}, {name: 'bjinfo4', type: 'str', label: 'Blackjack Rules/Info Line 4', defaultValue: 'BONUS: If you win by getting blackjack (21) or by reaching 5 cards without busting you\'ll get a free dance with your choice of prize!', required: false}, // App Options {name: 'notice_wait_time', type: 'int', label: 'Notify viewers of this app\'s functions every X minutes', minValue: 2, defaultValue: 10} ]; cb.onDrawPanel(function (user) { var goalProgress = 0; var goalProgressMsg = 'Disabled'; var htMsg = 'Disabled'; if (cb.settings.goal_enabled == 'Yes') { if (tipCounter > cb.settings.goal_total) { goalProgress = 100; } else { goalProgress = tipCounter ? parseFloat((tipCounter / cb.settings.goal_total) * 100).toFixed(1) : 0; } goalProgressMsg = tipCounter + '/' + cb.settings.goal_total + ' (' + goalProgress + ' %)'; } if (cb.settings.ht_enabled == 'Yes') { htMsg = highTipper + ' (' + highTipAmount + ')'; } return { 'template': '3_rows_of_labels', 'row1_label': 'Goal Progress: ', 'row1_value': goalProgressMsg, 'row2_label': 'Highest Tip: ', 'row2_value': htMsg, 'row3_label': 'Last Tipper: ', 'row3_value': lastTipper + ' (' + lastTipAmount + ')' }; }); cb.onTip(function (tip) { tipCounter += parseInt(tip['amount']); lastTipAmount = parseInt(tip['amount']); lastTipper = tip['from_user']; // Store record of this user's tips this session if(tipTotals[tip['from_user']]) { tipTotals[tip['from_user']] = tipTotals[tip['from_user']] + parseInt(tip['amount']); } else { tipTotals[tip['from_user']] = parseInt(tip['amount']); } // New HT? if (lastTipAmount > highTipAmount && cb.settings.ht_enabled == 'Yes') { highTipAmount = lastTipAmount; highTipper = lastTipper; cb.sendNotice(tip['from_user'] + ' has the new Highest Tip of ' + highTipAmount + ' tokens!', '', '#ABFFFB', '#000000', 'bold'); } // New King? var theKing = findKing(); if (theKing != roomKing && cb.settings.king_enabled == 'Yes' && tipTotals[tip['from_user']] >= cb.settings.king_minimum) { var dethroning = roomKing == '--' ? '' : roomKing + ' has been dethroned! '; cb.sendNotice(dethroning + tip['from_user'] + ' is the new ' + crownIcon + ' King with a total of ' + tipTotals[theKing] + ' tokens tipped today!', '', '#ABFFFB', '#000000', 'bold'); roomKing = theKing; } // Check if user tipped for something on the menu // Wheel of Fortune? if (cb.settings.wof_enabled == 'Yes' && lastTipAmount == parseInt(cb.settings.wof_price)) { cb.sendNotice(tip['from_user'] + ' has spun the Wheel of Fortune!', '', '#ABFFFB', '#000000', 'bold'); playWoF(); } // Blackjack else if (cb.settings.blackjack_enabled == 'Yes' && lastTipAmount == parseInt(cb.settings.blackjack_price)) { cb.sendNotice(tip['from_user'] + ' is now playing Blackjack against ' + cb.room_slug + '!', '', '#ABFFFB', '#000000', 'bold'); } // Tip Menu else { for(var i=1;i<=15;i++) { if(parseInt(cb.settings['menu_item' + i + '_price']) == lastTipAmount) { cb.sendNotice(tip['from_user'] + ' tipped for: ' + cb.settings['menu_item' + i], '', '#ABFFFB', '#000000', 'bold'); break } } } // Check if the goal has been reached if (cb.settings.goal_enabled == 'Yes') { checkGoal(tipCounter); } // Update only when tip>1 (to prevent possible crashes on walls of 1 from such frequent updating) if (lastTipAmount>1) { cb.drawPanel(); if(goalReached==0 && cb.settings.goal_enabled == 'Yes') { updateSubject(); } } }); cb.onEnter(function (user) { cb.sendNotice('Welcome ' + user['user'] + '.', user['user'], '', '', 'bold'); showAppAd(user['user']); }); cb.onMessage(function(msg) { // commands var arguments = msg['m'].split(' '); if(arguments[0].charAt(0) == '/') { // && !msg['X-Spam']) { switch(arguments[0].toLowerCase()) { case '/menu': { msg['X-Spam'] = true; showMenu(msg['user']); break; } case '/bmenu': { if(msg['is_mod'] || msg['user'] == cb.room_slug) { msg['X-Spam'] = true; showMenu(''); } break; } case '/sendmenu': { if((msg['is_mod'] || msg['user'] == cb.room_slug) && arguments.length >= 2) { msg['X-Spam'] = true; var modSender = arguments[1]; showMenu(modSender); cb.sendNotice('Sent tip menu to user ' + modSender, msg['user'], '#FCFCD7', '', ''); } break; } case '/wfprizes': { msg['X-Spam'] = true; showWFPrizes(msg['user']); break; } case '/bwfprizes': { if(msg['is_mod'] || msg['user'] == cb.room_slug) { msg['X-Spam'] = true; showWFPrizes(''); } break; } case '/sendwfprizes': { if((msg['is_mod'] || msg['user'] == cb.room_slug) && arguments.length >= 2) { msg['X-Spam'] = true; var modSender = arguments[1]; showWFPrizes(modSender); cb.sendNotice('Sent prize list to user ' + modSender, msg['user'], '#FCFCD7', '', ''); } break; } case '/bjinfo': { msg['X-Spam'] = true; if (cb.settings.blackjack_enabled == 'Yes') { cb.sendNotice(cb.settings.bjinfo1, msg['user'], '#FCFCD7', '', ''); cb.sendNotice(cb.settings.bjinfo2, msg['user'], '#FCFCD7', '', ''); cb.sendNotice(cb.settings.bjinfo3, msg['user'], '#FCFCD7', '', ''); cb.sendNotice(cb.settings.bjinfo4, msg['user'], '#FCFCD7', '', ''); } else { cb.sendNotice('ERROR: Blackjack is not currently enabled in the room.', msg['user'], '#FCFCD7', '', ''); } break; } case '/tippers': { if(msg['is_mod'] || msg['user'] == cb.room_slug) { msg['X-Spam'] = true; cb.sendNotice('#TIPPERS LIST#', msg['user'], '#FCFCD7', '', 'bold'); for(var key in tipTotals) { cb.sendNotice(key + ': ' + tipTotals[key], msg['user'], '#FCFCD7', '', ''); } } break; } case '/settotal': { if(msg['user'] == cb.room_slug && arguments.length >= 2) { var newTotal = parseInt(arguments[1]); if(newTotal < 0) { cb.sendNotice('New total must be a number and greater than zero.', msg['user'], '', '', 'bold'); } else { tipCounter = newTotal; checkGoal(tipCounter); cb.drawPanel(); } } break; } case '/addtotal': { if(msg['user'] == cb.room_slug && arguments.length >= 2) { var addTotal = parseInt(arguments[1]); if(newTotal < 0) { cb.sendNotice('Tokens to add must be a number and greater than zero.', msg['user'], '', '', 'bold'); } else { tipCounter += addTotal; checkGoal(tipCounter); cb.drawPanel(); } } break; } case '/tipped': { if((msg['is_mod'] || msg['user'] == cb.room_slug) && arguments.length >= 2) { msg['X-Spam'] = true; var tipperName = arguments[1]; if(tipTotals[tipperName]) { cb.sendNotice(tipperName + ' has tipped ' + tipTotals[tipperName], msg['user'], '#FCFCD7', '', ''); } else { cb.sendNotice(tipperName + ' has not tipped.', msg['user'], '#FC0C07', '', ''); } } break; } case '/dhelp': { if(msg['is_mod'] || msg['user'] == cb.room_slug) { msg['X-Spam'] = true; cb.sendNotice('/menu - shows the tip menu.', msg['user'], '#FCFCD7', '', ''); cb.sendNotice('/wfprizes - lists the possible Wheel of Fortune prizes.', msg['user'], '#FCFCD7', '', ''); cb.sendNotice('/bjinfo - shows info and rules for Blackjack.', msg['user'], '#FCFCD7', '', ''); cb.sendNotice('/bmenu - broadcasts tip menu to all users. Broadcaster and moderators only', msg['user'], '#FCFCD7', '', ''); cb.sendNotice('/sendmenu username - sends tip menu to the specified user. Broadcaster and moderators only', msg['user'], '#FCFCD7', '', ''); cb.sendNotice('/bwfprizes - broadcasts /wfprizes to all users. Broadcaster and moderators only', msg['user'], '#FCFCD7', '', ''); cb.sendNotice('/sendwfprizes username - sends /wfprizes to the specified user. Broadcaster and moderators only', msg['user'], '#FCFCD7', '', ''); cb.sendNotice('/tippers - shows list of everyone who has tipped since app was started. Broadcaster and moderators only', msg['user'], '#FCFCD7', '', ''); cb.sendNotice('/tipped username - checks if a specific user has tipped or not since the app was started. Broadcaster and moderators only', msg['user'], '#FCFCD7', '', ''); cb.sendNotice('/settotal number - sets the tip total to the number specified. Broadcaster only.', msg['user'], '#FCFCD7', '', ''); cb.sendNotice('/addtotal number - add number to the current tip total. Broadcaster only.', msg['user'], '#FCFCD7', '', ''); } break; } } } // King? if (cb.settings.king_enabled == 'Yes' && msg['user'] == roomKing) { var crown = crownIcon ? crownIcon + ' | ' : ''; msg['m'] = crown + msg['m']; } return msg; }); // This function is inefficient and should probably be improved // probably very slow if there are a lot of different tippers function findKing() { var mostTokens = 0; var kingName = '--'; for(var key in tipTotals) { if (tipTotals[key] > mostTokens) { mostTokens = tipTotals[key]; kingName = key; } } return kingName; } function showMenu(user) { var msg = ''; cb.sendNotice('#TIP MENU#', user, '#FCFCD7', '', 'bold'); for(var i=1;i<=15;i++) { if(cb.settings['menu_item' + i] && (parseInt(cb.settings['menu_item' + i + '_price']) > 0)) { if (i>1) msg += '\n'; msg += cb.settings['menu_item' + i + '_price'] + ' - ' + cb.settings['menu_item' + i]; } } if (cb.settings.wof_enabled == 'Yes') { msg += '\n'; msg += cb.settings['wof_price'] + ' - spin the Wheel of Fortune!'; } if (cb.settings.blackjack_enabled == 'Yes') { msg += '\n'; msg += cb.settings['blackjack_price'] + ' - play Blackjack against ' + cb.room_slug + '!'; } cb.sendNotice(msg, user, '#FCFCD7', '', ''); } function showWFPrizes(user) { var msg = ''; if (cb.settings.wof_enabled == 'Yes') { cb.sendNotice('#WHEEL OF FORTUNE PRIZES#', user, '#FCFCD7', '', 'bold'); for(var i=1;i<=15;i++) { if(cb.settings['wof_prize' + i]) { if (i>1) msg += '\n'; msg += '#' + i + ' - ' + cb.settings['wof_prize' + i]; } } } else { msg = 'ERROR: Wheel of Fortune is not currently enabled in this room.'; } cb.sendNotice(msg, user, '#FCFCD7', '', ''); } function playWoF() { // Count prizes var numWOFPrizes = 0; if (wofPrizes.length<1) { for(var i=1;i<=15;i++) { if(cb.settings['wof_prize' + i]) { // Add each prize twice to increase segment count and make it "more random" wofPrizes.push(cb.settings['wof_prize' + i]); wofPrizes.push(cb.settings['wof_prize' + i]); } } } numWOFPrizes = wofPrizes.length; // Choose a random prize var randSegment = Math.floor(Math.random() * numWOFPrizes); cb.sendNotice('... and the wheel has landed on ... ' + wofPrizes[randSegment], '', '#ABFFFB', '#000000', 'bold'); } function showAppAd(username) { var msg = ""; msg += "This room is running DariApp v" + DariAppVersion + " by KingChris_\n"; msg += "Type /menu to see the tip menu."; if(cb.settings.wof_enabled == 'Yes') { msg += "\n"; msg += "Wheel of Fortune is enabled. Tip " + cb.settings.wof_price + " to spin. Type /wfprizes to see a list of possible prizes."; } if(cb.settings.blackjack_enabled == 'Yes') { msg += "\n"; msg += "Blackjack is enabled. Tip " + cb.settings.blackjack_price + " to play against me. Type /bjinfo to see rules and info."; } if(cb.settings.ht_enabled == 'Yes' && highTipAmount>0) { msg += "\n"; msg += highTipper + " currently has the Highest Tip of " + highTipAmount + " tokens. /tip " + parseInt(highTipAmount+1) + " or more to beat them!"; } if(cb.settings.king_enabled == 'Yes' && roomKing != '--') { msg += "\n"; msg += roomKing + " is currently the " + crownIcon + " King with a total of " + tipTotals[roomKing] + " tokens tipped today!"; } cb.sendNotice(msg, username, '', '#15A6B0', 'bold'); } function advertise() { showAppAd(); cb.setTimeout(advertise, parseInt(cb.settings.notice_wait_time) * 60000); } function checkGoal(total) { var remainder = 0; if(total >= parseInt(cb.settings.goal_total) && goalReached==0) { remainder = tipCounter - parseInt(cb.settings.goal_total); if(remainder < 0) { remainder = 0; } goalReached=1; var goalAnnounce = cb.settings.goal_reached; cb.sendNotice(goalAnnounce, '', '#FFCC00', '#AB001C', 'bold'); } } function updateSubject() { var theSubject = ''; var theGoal = cb.settings.goal_subject; var remaining = 0; if (cb.settings.goal_enabled == 'Yes') { remaining = parseInt(cb.settings.goal_total) - tipCounter; if(remaining < 0) { remaining = 0; } theSubject = theGoal + ' [' + remaining + ' tokens remaining] '; } if (cb.settings.wof_enabled == 'Yes') { theSubject += 'Spin the Wheel of Fortune for ' + cb.settings.wof_price + ' tokens! ' } cb.changeRoomSubject(theSubject); } function init() { updateSubject(); advertise(); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.