Apps Home
|
Create an App
prueba22
Author:
programdor_02
Description
Source Code
Launch App
Current Users
Created by:
Programdor_02
/** * App: Roll The Dice * Version: 1.0 * Author: gen0sc0ck_ * Date: 2020-04-27 */ cb.settings_choices = [ { name: 'tokens', type: 'int', minValue: 1, maxValue: 100, label: 'cuantos tokens quieres cobrar por los dados ', defaultValue: 10 }, { name: 'remove_winning_prize', type: 'choice', label: 'eliminar el premio de la lista despues de tirar los dados', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'die_type', type: 'choice', label: '¿Usa el dado tradicional (6 lados) o chino (10 lados)? (NOTA: Si elige el dado chino ' +', establezca todos los premios 21. De lo contrario, solo configure los primeros 13.) ', choice1: 'Traditional', choice2: 'Chinese', default: 'Chinese' }, { name: 'minimum_rolls', type: 'choice', label: '¿Cuál es el número mínimo de tiradas antes de que puedan aparecer los dados raros? (¡Mantén esto en secreto!)', choice1: 0, choice1: 1, choice1: 2, choice1: 3, choice1: 4, choice1: 5, choice1: 10, choice2: 15, choice3: 20, choice4: 25, choice5: 30, choice6: 35, choice7: 40, choice8: 45, choice9: 50, defaultValue: 0 }, { name: 'notice_wait_time', type: 'choice', label: 'en minutos, ¿con qué frecuencia debe anunciarse la aplicación?', choice1: 1, choice2: 2, choice3: 3, choice4: 4, choice5: 5, choice6: 10, choice7: 15, choice8: 60, defaultValue: 2 }, {name: 'prize_1', type: 'str', label: 'premio al azar de los dados 1', defaultValue: ':spitonboobs2'}, {name: 'prize_2', type: 'str', label: 'premio al azar de los dados 2', defaultValue: ':SpitonPussy'}, {name: 'prize_3', type: 'str', label: 'premio al azar de los dados 3', defaultValue: ':openpussyhole'}, {name: 'prize_4', type: 'str', label: 'premio al azar de los dados 4', defaultValue: ':masturbatevagina12'}, {name: 'prize_5', type: 'str', label: 'premio al azar de los dados 5', defaultValue: ':openasshole'}, {name: 'prize_6', type: 'str', label: 'premio al azar de los dados 6', defaultValue: ':masturbatevagina22'}, {name: 'prize_7', type: 'str', label: 'premio al azar de los dados 7', defaultValue: ':pussy_1'}, {name: 'prize_8', type: 'str', label: 'premio al azar de los dados 8', defaultValue: ':Openass'}, {name: 'prize_9', type: 'str', label: 'premio al azar de los dados 9', defaultValue: ':nud'}, {name: 'prize_10', type: 'str', label: 'premio al azar de los dados 10', defaultValue: ':asshole12'}, {name: 'prize_11', type: 'str', label: 'premio al azar de los dados 11', defaultValue: ':assfinger6767'}, {name: 'prize_12', type: 'str', label: 'premio al azar de los dados 12', defaultValue: ':openleggspussy789'}, {name: 'prize_13', type: 'str', label: 'premio al azar de los dados 13 (raro si usa el dado tradicional)', defaultValue: ':suckfinger9'}, {name: 'prize_14', type: 'str', label: 'premio al azar de los dados 14 (solo se muestra si se usan dados chinos)', defaultValue: ':titsshow007'}, {name: 'prize_15', type: 'str', label: 'premio al azar de los dados 15 (osolo se muestra si se usan dados chinos)', defaultValue: ':openassholeeeeeeee'}, {name: 'prize_16', type: 'str', label: 'premio al azar de los dados 16 (solo se muestra si se usan dados chinos)', defaultValue: ':fingerass'}, {name: 'prize_17', type: 'str', label: 'premio al azar de los dados 17 (solo se muestra si se usan dados chinos)', defaultValue: '::masturbatevagina17'}, {name: 'prize_18', type: 'str', label: 'premio al azar de los dados 18 (solo se muestra si se usan dados chinos)', defaultValue: ':fingersquirt'}, {name: 'prize_19', type: 'str', label: 'Ppremio al azar de los dados 19 (solo se muestra si se usan dados chinos)', defaultValue: ':suckfeetgenna'}, {name: 'prize_20', type: 'str', label: 'premio al azar de los dados 20 (solo se muestra si se usan dados chinos)', defaultValue: ':masturbatevagina22'}, {name: 'prize_21', type: 'str', label: 'premio al azar de los dados 21 (raro si usa los dado chinos)', defaultValue: ':openpussyfingers'} ]; var langTokens = (cb.settings.tokens > 1) ? 'tokens' : 'token'; var numberOfSides = (cb.settings.die_type == 'Traditional') ? 6 : 10; var lastRoller = '--'; var lastPrizeWon = '--'; var rollCounter = 0; var tipCounter = 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'; cb.onTip( function (tip) { tipCounter += parseInt(tip['amount']); if (parseInt(tip['amount']) >= cb.settings.tokens) { var numberOfRolls = Math.floor(parseInt(tip['amount']) / cb.settings.tokens); for (var i = 0; i < numberOfRolls; i++) { roll(tip['from_user']); lastRoller = tip['from_user']; } } else { cb.drawPanel(); } }); 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': tipCounter + ' ' + langTokens + ' received / 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); // convoluted logic to appease the dev gods on cb var randomNum = Math.ceil(Math.random() * (100 - minimumRollsToGetRareDice) + minimumRollsToGetRareDice); if (rollCounter == randomNum) { if ((die1 == 1) && (die2 != 1)) die1 = (cb.settings.die_type == 'Traditional') ? 7 : 11; if ((die2 == 1) && (die1 != 1)) die2 = (cb.settings.die_type == 'Traditional') ? 7 : 11; } 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 prizeIndex = prizes.indexOf(prize); 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 = '#D9FAD7'; if (winner) textColor = '#067D00'; 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 = " (VERY RARE)"; prizes.push(cb.settings['prize_' + i] + rareText); } } function showPrizes(username) { if (prizes.length) { var rareText = ''; var msg = "##### POSSIBLE PRIZES #####"; for (var i = 1; i <= maxOutcome; i++) { if (i == maxOutcome) rareText = " (VERY RARE)"; 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 in the list, but thank you for the tip. :thumbsup"; } cb.sendNotice(msg, username, '#DBFBFF', '#008596', 'bold'); } function showPrizesWon(username) { var msg = "##### LAST 40 WINNERS #####"; msg += "\nList sorted in chronological order"; if (winners.length == 0) { cb.sendNotice('No one has won anything yet. Roll the dice to win a prize!', username, '', '', 'bold'); } else { var recentWinners = winners.slice(-40); for (var i = 0; i < recentWinners.length; i++) msg += "\n" + recentWinners[i]; cb.sendNotice(msg, username, '#FFF0DE', '#8A4900', 'bold'); } } function advertise() { showAppAd(); cb.setTimeout(advertise, parseInt(cb.settings.notice_wait_time) * 60000); } function showAppAd(username) { var msg = ""; if (username != undefined) { msg += "Welcome, " + username + "! We are playing Roll The Dice. \n"; } else { msg += "Roll The Dice by en0sc0ck_ \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 " + cb.settings.tokens + " " + langTokens + " to roll the dice. \n"; msg += "Type \"/prizes\" to see the list of prizes. \n"; msg += "Type \"/prizes all\" to send the list to all viewers if you're a mod or the broadcaster.\n"; msg += "Type \"/winners\" to see a list of the last 20 winners."; cb.sendNotice(msg, username, '', '#15A6B0', 'bold'); } function init() { setPrizes(); advertise(); cb.changeRoomSubject('Tip ' + cb.settings.tokens + ' tokens to roll the dice!'); } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.