Apps Home
|
Create an App
elpepe
Author:
srmarfony
Description
Source Code
Launch App
Current Users
Created by:
Srmarfony
/** * App: Spyblue Ultra App * Version: 1.0 * Author: SrMarfony * Created: 2024-03-07 */ cb.settings_choices = [ { name: 'tokens', type: 'int', minValue: 1, maxValue: 100, label: 'Tokens required per roll:', defaultValue: 25 }, { name: 'remove_winning_prize', type: 'choice', label: 'Remove prize from list after each roll?', choice1: 'Yes', choice2: 'No', defaultValue: 'No' }, { name: 'die_type', type: 'choice', label: 'Select die type:', choice1: 'Traditional (6-sided)', choice2: 'Chinese (10-sided)', default: 'Traditional' }, { name: 'minimum_rolls', type: 'choice', label: 'Minimum rolls before rare dice can appear:', choice1: 10, choice2: 15, choice3: 20, choice4: 25, choice5: 30, choice6: 35, choice7: 40, choice8: 45, choice9: 50, defaultValue: 10 }, { name: 'notice_wait_time', type: 'choice', label: 'Frequency of app advertisements (in minutes):', choice1: 5, choice2: 10, choice3: 15, choice4: 20, choice5: 25, choice6: 30, choice7: 45, choice8: 60, defaultValue: 10 }, { name: 'prize_1', type: 'str', label: 'Prize for rolling 1:' }, {name: 'prize_2', type: 'str', label: 'Prize for rolling 2:'}, {name: 'prize_3', type: 'str', label: 'Prize for rolling 3:'}, {name: 'prize_4', type: 'str', label: 'Prize for rolling 4:'}, {name: 'prize_5', type: 'str', label: 'Prize for rolling 5:'}, {name: 'prize_6', type: 'str', label: 'Prize for rolling 6:'}, {name: 'prize_7', type: 'str', label: 'Prize for rolling 7:'}, {name: 'prize_8', type: 'str', label: 'Prize for rolling 8:'}, {name: 'prize_9', type: 'str', label: 'Prize for rolling 9:'}, {name: 'prize_10', type: 'str', label: 'Prize for rolling 10:'}, {name: 'prize_11', type: 'str', label: 'Prize for rolling 11:'}, {name: 'prize_12', type: 'str', label: 'Prize for rolling 12:'}, { name: 'prize_13', type: 'str', default: 'A smile', label: 'Prize for rolling 13 (RARE if using traditional dice):' }, { name: 'prize_14', type: 'str', default: 'A smile', label: 'Prize for rolling 14 (only shown if using Chinese dice):' }, { name: 'prize_15', type: 'str', default: 'A smile', label: 'Prize for rolling 15 (only shown if using Chinese dice):' }, { name: 'prize_16', type: 'str', default: 'A smile', label: 'Prize for rolling 16 (only shown if using Chinese dice):' }, { name: 'prize_17', type: 'str', default: 'A smile', label: 'Prize for rolling 17 (only shown if using Chinese dice):' }, { name: 'prize_18', type: 'str', default: 'A smile', label: 'Prize for rolling 18 (only shown if using Chinese dice):' }, { name: 'prize_19', type: 'str', default: 'A smile', label: 'Prize for rolling 19 (only shown if using Chinese dice):' }, { name: 'prize_20', type: 'str', default: 'A smile', label: 'Prize for rolling 20 (only shown if using Chinese dice):' }, { name: 'prize_21', type: 'str', default: 'A smile', label: 'Prize for rolling 21 (RARE; only shown if using Chinese dice):' } ]; 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 zingknaat \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(); "use strict"; var meanBroadcasters = ['missilex']; var emo=[":cutehug",":angel",":heheface3a",":dance3",":blush",":cool",":huh",":roll",":mellow",":ohmy",":smile",":thumbup",":wink",":woot",":bounce",":hello",":angel",":crazy",":thumbsup",":yes",":hearts",":happy1a",":innocent",":gangsta",":dancingbanana",":kissy",":help",":bow",":hello",":huh",":drool",":shi",":twerky1a",":hihi",":shello",":lolll"]; var color=["#ffb6c1","#ff82ab","#ee6aa7","#ff83fa","#d8bfd8","#eeaeee","#6495ed","#bcd2ee","#63b8ff","#87cefa","#8ee5ee","#00f5ff","#8deeee","#00eeee","#76eec6","#4eee94","#b4eeb4","#9aff9a","#7fff00","#adff2f","#bcee68","#9acd32","#cdcdb4","#eeee00","#ffd700","#ffc125","#eecfa1","#e3a869","#eecbad","#ff7256","#eeb4b4","#71c671","#c5c1aa"]; var censoredWords = ["fuck","bitch","pussy","anal","asshole","bastard","blowjob","cock","cunt","dick","fag","slut","whore","shit","nigger","nigga","faggot","motherfucker","fuckyou","gay"]; var badUsers = []; var watchedUsers = {}; var tipsTotal = 0; var users = []; var maxBadRatio = 30; var maxWatchedRatio = 5; var maxChars = 250; cb.onEnter(function(user) { if (meanBroadcasters.includes(user.user)){ cb.setTimeout(function() { cb.chatNotice('I am a harmless bot! please do not ban me. I will abide by the rules of the room and will not cause any disruption. However, if there is anything that I do that is not desirable, please ban me. Thanks!', user.user); }, 3000); } else { users.push(user['user']); } }); cb.onLeave(function(user) { var index = users.indexOf(user['user']); if (index > -1) { users.splice(index, 1); } }); cb.onTip(function(tip) { var fromUser = tip['from_user']; var toUser = tip['to_user']; var amount = tip['amount']; tipsTotal += amount; if (fromUser in watchedUsers && fromUser in badUsers) { watchedUsers[fromUser]['amount'] += amount; watchedUsers[fromUser]['ratio'] = Math.round((watchedUsers[fromUser]['amount'] / tipsTotal) * 100); if (watchedUsers[fromUser]['ratio'] >= maxWatchedRatio) { cb.chatNotice(fromUser + ' has been watched for tipping at a high rate. (' + watchedUsers[fromUser]['ratio'] + '% of total tips)', cb.room_slug); } } else if (fromUser in watchedUsers) { watchedUsers[fromUser]['amount'] += amount; watchedUsers[fromUser]['ratio'] = Math.round((watchedUsers[fromUser]['amount'] / tipsTotal) * 100); if (watchedUsers[fromUser]['ratio'] >= maxWatchedRatio) { cb.chatNotice(fromUser + ' has been watched for tipping at a high rate. (' + watchedUsers[fromUser]['ratio'] + '% of total tips)', cb.room_slug); } } else if (fromUser in badUsers) { watchedUsers[fromUser] = {'amount': amount, 'ratio': Math.round((amount / tipsTotal) * 100)}; if (watchedUsers[fromUser]['ratio'] >= maxWatchedRatio) { cb.chatNotice(fromUser + ' has been watched for tipping at a high rate. (' + watchedUsers[fromUser]['ratio'] + '% of total tips)', cb.room_slug); } } }); cb.onMessage(function (msg) { var message = msg.m.toLowerCase(); var user = msg['user']; var hasToken = msg['has_tokens']; var isMod = msg['is_mod']; var isCamscoreAllowed = msg['is_camscore_allowed']; var muted = msg['muted']; var isFan = msg['is_fan']; var isGrey = msg['grey']; var msgCensored = false; if (user in watchedUsers && user in badUsers) { watchedUsers[user]['count']++; watchedUsers[user]['ratio'] = Math.round((watchedUsers[user]['count'] / users.length) * 100); if (watchedUsers[user]['ratio'] >= maxBadRatio) { cb.chatNotice(user + ' has been watched for high chat ratio (' + watchedUsers[user]['ratio'] + '% of total users)', cb.room_slug); } } else if (user in watchedUsers) { watchedUsers[user]['count']++; watchedUsers[user]['ratio'] = Math.round((watchedUsers[user]['count'] / users.length) * 100); if (watchedUsers[user]['ratio'] >= maxBadRatio) { cb.chatNotice(user + ' has been watched for high chat ratio (' + watchedUsers[user]['ratio'] + '% of total users)', cb.room_slug); } } else if (user in badUsers) { watchedUsers[user] = {'count': 1, 'ratio': Math.round((1 / users.length) * 100)}; if (watchedUsers[user]['ratio'] >= maxBadRatio) { cb.chatNotice(user + ' has been watched for high chat ratio (' + watchedUsers[user]['ratio'] + '% of total users)', cb.room_slug); } } for (var i = 0; i < censoredWords.length; i++) { if (message.indexOf(censoredWords[i]) > -1) { msgCensored = true; break; } } if (msgCensored && !isMod && !isGrey && !isFan && !muted && !hasToken && user != cb.room_slug) { cb.chatNotice('Censored word(s) detected! Please refrain from using inappropriate language.', user); return msg['X-Spam'] = true; } if (msgCensored && isMod && !isGrey && !isFan && !muted && !hasToken && user != cb.room_slug) { return msg['X-Spam'] = false; } if (message.includes('@')) { if (!hasToken && !isMod && !isGrey && !isFan && !muted && user != cb.room_slug) { cb.chatNotice('Please do not mention other users without tipping first!', user); return msg['X-Spam'] = true; } } if (message.includes(':') && !msgCensored && !isMod && !isGrey && !isFan && !muted && user != cb.room_slug) { var emoCount = 0; for (var j = 0; j < emo.length; j++) { if (message.indexOf(emo[j]) > -1) { emoCount++; } } if (emoCount > 4) { cb.chatNotice('Please do not spam emoticons!', user); return msg['X-Spam'] = true; } } if (message.length > maxChars && !isMod && !isGrey && !isFan && !muted && user != cb.room_slug) { cb.chatNotice('Your message is too long! Please keep it under ' + maxChars + ' characters.', user); return msg['X-Spam'] = true; } return msg; });
© Copyright Freesexcam 2011- 2024. All Rights Reserved.