Apps Home
|
Create an App
Sasha's Sensual Dice v1.2.0
Author:
gaius
Description
Source Code
Launch App
Current Users
Created by:
Gaius
/************************************************************************************* * Name: Sasha's Sensual Dice * Author: Gaius * Version: 1.2.0 * Date: 19-11-2018 *************************************************************************************/ cb.settings_choices = [ { name: 'tokens', type: 'int', minValue: 1, label: 'How much does it cost to roll the Dice?', defaultValue: 22 }, { name: 'remove_winning_prize', type: 'choice', label: 'Remove won Prizes from the list after each roll?', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'die_type', type: 'choice', label: 'Use Traditional (6-sided) or Chinese (10-sided) Dice? (Note: All 21 Prizes must be defined, even if you use the Traditional Dice)', choice1: 'Traditional', choice2: 'Chinese', defaultValue: 'Traditional' }, { name: 'multirolls', type: 'int', minValue: 1, label: 'What is the maximum number of Rolls you want a user to be able to make in a single tip? (set to 1 to disable) Example: If you set this to 3 and you charge 22 tokens per roll, a user could tip 44 for 2 Rolls or 66 for 3 Rolls.', defaultValue: 1 }, { name: 'too_high_multiples', type: 'choice', label: 'What shall happen if a user tips an amount that is a multiple of the Roll Price but would result in more consecutive Rolls than allowed?', choice1: 'Roll the Dice as often as allowed', choice2: 'Do not roll the Dice at all', defaultValue: 'Do not roll the Dice at all' }, { name: 'minimum_rolls', type: 'int', minValue: 0, maxValue: 50, label: 'What is the minimum number of Rolls before the rare Die can appear? (Keep this secret!)', defaultValue: 50 }, { name: 'notice_wait_time', type: 'choice', label: 'With which frequency does the App announce itself (in minutes)?', choice1: 5, choice2: 10, choice3: 11, choice4: 15, choice5: 20, choice6: 25, choice7: 30, choice8: 45, choice9: 60, defaultValue: 25 }, { name: 'change_room_subject', type: 'choice', label: 'Change Room Subject when using this App?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, {name: 'prize_1', type: 'str', label: 'Prize for rolling 1', defaultValue: 'My WhatsApp Number, for Life'}, {name: 'prize_2', type: 'str', label: 'Prize for rolling 2', defaultValue: ''}, {name: 'prize_3', type: 'str', label: 'Prize for rolling 3', defaultValue: ''}, {name: 'prize_4', type: 'str', label: 'Prize for rolling 4', defaultValue: ''}, {name: 'prize_5', type: 'str', label: 'Prize for rolling 5', defaultValue: ''}, {name: 'prize_6', type: 'str', label: 'Prize for rolling 6', defaultValue: ''}, {name: 'prize_7', type: 'str', label: 'Prize for rolling 7', defaultValue: ''}, {name: 'prize_8', type: 'str', label: 'Prize for rolling 8', defaultValue: ''}, {name: 'prize_9', type: 'str', label: 'Prize for rolling 9', defaultValue: ''}, {name: 'prize_10', type: 'str', label: 'Prize for rolling 10', defaultValue: ''}, {name: 'prize_11', type: 'str', label: 'Prize for rolling 11', defaultValue: ''}, {name: 'prize_12', type: 'str', label: 'Prize for rolling 12', defaultValue: ''}, {name: 'prize_13', type: 'str', label: 'Prize for rolling 13 (RARE if using Traditional Dice)', defaultValue: ''}, {name: 'prize_14', type: 'str', label: 'Prize for rolling 14 (only shown if using Chinese Dice)', defaultValue: ''}, {name: 'prize_15', type: 'str', label: 'Prize for rolling 15 (only shown if using Chinese Dice)', defaultValue: ''}, {name: 'prize_16', type: 'str', label: 'Prize for rolling 16 (only shown if using Chinese Dice)', defaultValue: ''}, {name: 'prize_17', type: 'str', label: 'Prize for rolling 17 (only shown if using Chinese Dice)', defaultValue: ''}, {name: 'prize_18', type: 'str', label: 'Prize for rolling 18 (only shown if using Chinese Dice)', defaultValue: ''}, {name: 'prize_19', type: 'str', label: 'Prize for rolling 19 (only shown if using Chinese Dice)', defaultValue: ''}, {name: 'prize_20', type: 'str', label: 'Prize for rolling 20 (only shown if using Chinese Dice)', defaultValue: ''}, {name: 'prize_21', type: 'str', label: 'Prize for rolling 21 (RARE, only shown if using Chinese Dice)', defaultValue: ''} ]; var price = cb.settings.tokens; var langTokens = (price > 1) ? 'tokens' : 'token'; var numberOfSides = (cb.settings.die_type == 'Traditional') ? 6 : 10; var multiRolls = cb.settings.multirolls; var lastRoller = '--'; var lastPrizeWon = '--'; var rollCounter = 0; var winners = []; var prizes = []; var minimumRollsToGetRareDice = parseInt(cb.settings.minimum_rolls); var maxOutcome = (cb.settings.die_type == 'Traditional') ? 13 : 21; var dieImagePrefix = (cb.settings.die_type == 'Traditional') ? ':reddie' : ':cdie'; var rareChance = 10; // percent chance of rolling a RARE (Minimum Rolls must also be met) cb.onTip(function (tip) { var tipAmount = parseInt(tip['amount']); // check to see if tip was for a dice roll if (tipAmount >= price && (tipAmount % price == 0)) { var numberOfRolls = Math.floor(tipAmount / price); if (numberOfRolls > multiRolls) { if (cb.settings.too_high_multiples == 'Roll the Dice as often as allowed'){ numberOfRolls = multiRolls; } else { numberOfRolls = 0; } } for (var i = 0; i < numberOfRolls; i++) { roll(tip['from_user']); lastRoller = tip['from_user']; } } }); cb.onDrawPanel(function (user) { return { 'template': '3_rows_12_22_31', 'row1_label': 'Last Prize Won:', 'row1_value': lastPrizeWon, 'row2_label': 'Last Player:', 'row2_value': lastRoller, 'row3_value': 'rolled ' + rollCounter + ' time(s)' }; }); cb.onEnter(function (user) { showAppAd(user['user']); }); cb.onMessage(function (msg) { if (msg['m'].match(/!winners/i)) { msg['X-Spam'] = true; showPrizesWon(msg['user']); } else if (msg['m'].match(/!prizes/i)) { msg['X-Spam'] = true; if (msg['m'].match(/all/i) && ((msg['is_mod'] == true) || (msg['user'] == cb.room_slug))) { showPrizes(); } else { showPrizes(msg['user']); } } return msg; }); function roll(username) { rollCounter++; var die1 = Math.floor(Math.random() * numberOfSides) + 1; var die2 = Math.floor(Math.random() * numberOfSides) + 1; // see if there's a chance we can roll a rare Die if (rollCounter > minimumRollsToGetRareDice) { if (Math.random() <= (rareChance / 100)) { die1 = 7; } } var total = die1 + die2; var winner = false; if (total >= 1) { winner = true; var prize = cb.settings['prize_' + total]; } else { winner = false; var prize = 'A Thank You'; } var rareText = ''; if (total == maxOutcome) rareText = ""; var prizeIndex = prizes.indexOf(prize + rareText); if (prizeIndex >= 0) { if (cb.settings.remove_winning_prize == 'Yes') prizes.splice(prizeIndex, 1); } else { prize = 'A Thank You!'; } var msg = dieImagePrefix + die1 + " " + dieImagePrefix + die2 + "\n"; msg += username + " rolled a " + total + "! \n".toUpperCase(); msg += "Roll #" + rollCounter + " | Prize: " + prize; var textColor = '#000000'; var bgColor = '#DBFBFF'; if (winner) textColor = '#008596'; if (total == maxOutcome) { bgColor = '#FFDBF3'; textColor = '#A805A6'; } cb.sendNotice(msg, '', bgColor, textColor, 'bold'); lastPrizeWon = prize; winners.push("Roll #" + rollCounter + " (" + total + "): " + username + " - " + prize); cb.drawPanel(); } function setPrizes() { var rareText = ''; for (var i = 1; i <= maxOutcome; i++) { if (i == maxOutcome) rareText = ""; prizes.push(cb.settings['prize_' + i] + rareText); } } function showPrizes(username) { if (prizes.length) { var rareText = ''; var msg = "### SASHA'S PRIZES ###"; for (var i = 1; i <= maxOutcome; i++) { if (i == maxOutcome) rareText = ""; if (prizes.indexOf(cb.settings['prize_' + i] + rareText) >= 0) msg += "\nRoll " + i + " - " + cb.settings['prize_' + i] + rareText; } } else { var msg = "Sorry, there are no Prizes left, all have already been won."; } if (rollCounter < minimumRollsToGetRareDice) { if ((minimumRollsToGetRareDice - rollCounter) == 1) { msg += "\nGood Luck! Have Fun with Sasha!" } else { msg += "\nGood Luck! Have Fun with Sasha!" } } cb.sendNotice(msg, username, '#DBFBFF', '#008596', 'bold'); } function showPrizesWon(username) { var msg = "### LAST 20 WINNERS ###"; msg += "\nList sorted in chronological order"; if (winners.length == 0) { cb.sendNotice('Noone has won anything yet. Roll the Dice to win a Prize!', username, '', '', 'bold'); } else { var recentWinners = winners.slice(-20); for (var i = 0; i < recentWinners.length; i++) msg += "\n" + recentWinners[i]; cb.sendNotice(msg, username, '#DBFBFF', '#008596', 'bold'); } } function advertise() { showAppAd(); cb.setTimeout(advertise, parseInt(cb.settings.notice_wait_time) * 60000); } function showAppAd(username) { var msg = ""; msg += "We are playing Roll the Dice!\n"; msg += "Each Roll reveals a Prize. There are " + prizes.length + " possible Prizes.\n"; if (cb.settings.remove_winning_prize == 'Yes') { msg += "Each Prize won will be removed from the list.\n"; } else { msg += "Each Prize won will stay on the list.\n"; } msg += "Tip EXACTLY " + price + " " + langTokens + " to roll the Dice. All other tip amounts will NOT result in a Dice Roll. \n"; if (multiRolls > 1) msg += "You can roll a maximum of " + multiRolls + " times in a single tip (" + (multiRolls*price) + " tokens). \n"; msg += "Type \"!prizes\" to see the list of Prizes. \n"; msg += "Type \"!winners\" to see a list of the last 20 Winners."; cb.sendNotice(msg, username, '', '#15A6B0', 'bold'); } function init() { setPrizes(); advertise(); if (cb.settings.change_room_subject == 'Yes') { cb.changeRoomSubject('Lovense Lush & Roll the Dice! Watch me strip & Help me cum!! #lovense #lush #ohmibod #dice #young #cute #sexy #latina #dildo #anal #squirt'); } } init();
© Copyright Freesexcam 2011- 2024. All Rights Reserved.