Bots Home
|
Create an App
13isabaker-001
Author:
13isnotadozen
Description
Source Code
Launch Bot
Current Users
Created by:
13isnotadozen
cb.chatNotice('97Kate-multibot bot 1.22 20190507 has started', ' ', '#ffff00', '#0000ff', 'bolder'); //constants var BDIAMOND = '\u2666'; // ♦ var BSTAR = '\u2605'; // ★ var HEART = '\u2665'; // ♥ var MAXITEMS = 10; var NUMWORD = ['zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']; var GIFTAVOID = [0]; //add gifts to avoid example [1,2,3] var GIFTPREFIX = ':gift_'; var SPEED_OF_TIMER = 1000; var NOTEMAX=5; //color codes var PURPLE = "#CD9DCD";//original color: #B369B3 var gSeparators = [ { label: 'Hearts', shortcut: ':heart2' }, { label: 'Glitter', shortcut: ':pixelglitter' }, { label: 'Flowers', shortcut: ':tinyflower2' }, { label: 'Bow', shortcut: ':bluebow' }, { label: 'Hearts2', shortcut: ':pixelheart' }, { label: 'Smiley', shortcut: ':smile' }, { label: 'Text Heart', shortcut: HEART }, { label: 'Text Diamond', shortcut: BDIAMOND }, { label: 'Text Star', shortcut: BSTAR } ]; //globals // usually I add a 'g' in front of the variable to indicate that it is global variable and also to prevent variable name clashes var gSeparator = "| "; var gTipmenuprice = []; var gTipmenuitem = []; var gTipMenuText; var last_tipper = null; var users = [cb.room_slug]; var gSpamPass = 0000; var gSpamNotice = ""; var gDicePrice = cb.settings.diceTokens; var numberOfSides = (cb.settings.die_type == 'Traditional') ? 6 : 10; var multiRolls = cb.settings.multirolls; 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'; var rareChance = 10; // percent chance of rolling a RARE (minimum rolls must also be met) var giftCount = 190; var lastGift = 0; var gDiceAvail; var gGiftAvail; var gMenuAvail; var gLastAdNum = 0; var gBreak = false; var aModerators = []; // king tipper var tipperArray = new Array; var numTippers = 0; var currentKing = ''; var kingTip = 0; var kingMin = parseInt(cb.settings.kingMin); var leaderArray = [['',0],['',0],['',0]]; var initialize = 0; var notifierSpamTGL = 0; var notifierMessage = cb.settings.spamMessage; // timer var _timerTimeout = 0; var _countDownRemain; // note var aNote = []; var noteLast=NOTEMAX; var noteMinutes; //settings cb.settings_choices = [ { name: 'allowMenu', label: "Play Tip Menu ? /// Igrat' tipmenu ? (type !menu to start/stop)", type: 'choice', choice1: 'No', choice2: 'Yes', defaultValue: 'Yes' }, { name: 'allowDice', label: "Play Dice? /// Igrat' v kosti ? (type !dice to start/stop", type: 'choice', choice1: 'No', choice2: 'Yes', defaultValue: 'Yes' }, { name: 'allowGift', label: "Play Gift ? /// Igrat' podarok ? (type !gift to start/stop)", type: 'choice', choice1: 'No', choice2: 'Yes', defaultValue: 'Yes' }, { name: 'ad_time', label: 'Advertisement every ? minutes /// Reklama kazhdaya ? minut (minimum 1)', type: 'int', minValue: 1, maxValue: 999, defaultValue: 1 }, { name: 'cost_per_gift', label: "Cost per Gift /// Stoimost' za podarok (in tokens)", type: 'int', minValue: 1, maxValue: 100, defaultValue: 29 }, { name: 'noticecolor', label: 'Color Tipmenu /// Tipmenu tsvet : red #FF0000)', type: 'str', defaultValue: '#FF0000' }, { name: 'sepchar', label: "Separator character /// Razdelitel' simvolov", type: 'choice', choice1: 'Vertical Bar', choice2: 'Hearts', choice3: 'Glitter', choice4: 'Flowers', choice5: 'Bow', choice6: 'Hearts2', choice7: 'Smiley', choice8: 'Text Heart', choice9: 'Text Diamond', choice10: 'Text Star', defaultValue: 'Hearts2' }, { name: 'item1', label: 'Item 1', type: 'str', required: false, defaultValue: '69--PM' }, { name: 'item2', label: 'Item 2', type: 'str', required: false, defaultValue: '199--if you love me' }, { name: 'item3', label: 'item 3', type: 'str', required: false, defaultValue: '49--if you like my T-shirt' }, { name: 'item4', label: 'Item 4', type: 'str', required: false, defaultValue: '19--if you like my smile' }, { name: 'item5', label: 'Item 5', type: 'str', required: false, defaultValue: '29--if you like my eyes' }, { name: 'item6', label: 'Item 6', type: 'str', required: false, defaultValue: '33--if you like Lucky the chair' }, { name: 'item7', label: 'Item 7', type: 'str', required: false, defaultValue: '11--wear glasses' }, { name: 'item8', label: 'Item 8', type: 'str', required: false, defaultValue: '20--stand up and turn around' }, { name: 'item9', label: 'Item 9', type: 'str', required: false, defaultValue: '15--song request' }, { name: 'item10', label: 'Item 10', type: 'str', required: false, defaultValue: '399--flash pussy' }, { name: 'diceTokens', label: "How many tokens for 1 diceroll /// Skol'ko zhetonov za 1 brosok kostey ?", type: 'int', minValue: 1, maxValue: 999, defaultValue: 51 }, { name: 'multirolls', label: "Maximum 3 prizes in 1 diceroll /// Maksimum 3 priza v 1 broske Igra'naya kost", type: 'int', maxValue: 3, defaultValue: 3 }, { name: 'too_high_multiples', label: 'What happens if the Tip is a multiple of the roll price ? /// Chto, yesli chayevyye kratny tsene rulona ?', type: 'choice', choice1: "Give as many prizes as allowed / Dayte stol'ko prizov, skol'ko pozvoleno", choice2: 'Do not give prizes /// Ne dayut prizov', defaultValue: 'Give as much prizes as allowed' }, { name: 'minimum_rolls', label: "How many rolls before the rare die can appear ? /// Skol'ko broskov do poyavleniya redkikh kubikov ?", type: 'int', minValue: 0, maxValue: 50, defaultValue: 10 }, { name: 'die_type', label: "There are only traditional dice /// yest' tol'ko traditsionnyye Igral'naya kost ", type: 'choice', choice1: 'Traditional', defaultValue: 'Traditional' }, { name: 'prize_1', label: 'Prize for rolling 1', type: 'str', defaultValue: 'A smile' }, { name: 'prize_2', label: 'Prize for rolling 2', type: 'str', defaultValue: 'spank ass' }, { name: 'prize_3', label: 'Prize for rolling 3', type: 'str', defaultValue: 'ass with panties + bend over' }, { name: 'prize_4', label: 'Prize for rolling 4', type: 'str', defaultValue: 'send a kiss' }, { name: 'prize_5', label: 'Prize for rolling 5', type: 'str', defaultValue: 'show feet ' }, { name: 'prize_6', label: 'Prize for rolling 6', type: 'str', defaultValue: 'take off my shorts 5 minutes' }, { name: 'prize_7', label: 'Prize for rolling 7', type: 'str', defaultValue: 'pull nipples close to cam' }, { name: 'prize_8', label: 'Prize for rolling 8', type: 'str', defaultValue: 'flash boobs' }, { name: 'prize_9', label: 'Prize for rolling 9', type: 'str', defaultValue: 'write in PM' }, { name: 'prize_10', label: 'Prize for rolling 10', type: 'str', defaultValue: 'handbra 1 min' }, { name: 'prize_11', label: 'Prize for rolling 11', type: 'str', defaultValue: 'spank ass 5 times' }, { name: 'prize_12', label: 'Prize for rolling 12', type: 'str', defaultValue: 'boobdance on song' }, { name: 'prize_13', label: 'Prize for rolling 13 (RARE)', type: 'str', defaultValue: 'a smile' }, {name: 'kingTipper', label: "Do you want to use King Tipper ? /// Vy khotite ispol'zovat' King Tipper ?", type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'leaderBoard', label: "Do you want to use the Leader Board ? /// Vy khotite ispol'zovat' tablitsu liderov ? ", type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'tipTitles', label: "Do you want to show how much they tipped ? /// Khotite pokazat' skol'ko oni chayevykh ?", type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'kingMin', label: "How much to become the new King ? /// Skol'ko zhetonov, chtoby stat' novym korolem ?", type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 25}, {name: 'notifierTip', label: 'say thank you after tips ? /// skazhi spasibo posle chayevykh?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes'}, {name: 'tipMessage', label: 'Enter a thank you message /// Vvedite vashe soobshcheniye, chtoby poblagodarit', type: 'str', minLength: 1, maxLength: 1000, defaultValue: '- - Thank you - - Spasiba ! - -'}, {name: 'tipMessageMin', label: "Say thank you from ? tokens /// skazat' spasibo ot? zhetony", type: 'int', minValue: 1, maxValue: 1000000, defaultValue: 10}, {name:'allowNote', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes', label: "Display Notes"}, {name:'note1', type:'str', required: true, label:'Note 1', defaultValue: 'Type !help to see the help menu.'}, {name:'note2', type:'str', required: false, label:'Note 2',}, {name:'note3', type:'str', required: false, label:'Note 3',}, {name:'note4', type:'str', required: false, label:'Note 4',}, {name:'note5', type:'str', required: false, label:'Note 5',}, {name:'noteColor', type:'str', label:'Note color (html code default dark red #9F000F)', defaultValue: '#9F000F'}, {name:'noteMinutes', type:'int', minValue: 1, maxValue: 999, defaultValue: 2, label: 'Delay in minutes between notices being displayed (1-999)'} ]; ////// //cb hooks ////// 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 + ' token' + ((tipCounter > 1) ? 's' : '') + ' received / rolled ' + rollCounter + ' time(s)' }; }); cb.onEnter(function(user) { cb.sendNotice('Welcome ' + user['user'] + ' :heyy I hope you like me and :followsmall-bobo me.', user['user'], '#63ff2f', '', 'bold'); if ( ! user['has_tokens']) { cb.sendNotice('Grey users, when allowed to chat, will have to follow the instructions below to get activated.', user['user'], '#63ff2f', '', 'bold'); } if (user['is_mod']) { if (aModerators.indexOf(user['user']) == -1) { aModerators.push(user['user']); } } advertise(user['user']); }); cb.onLeave(function(user) { if (user['is_mod']) { if (aModerators.indexOf(user['user']) >= 0) { aModerators.splice(aModerators.indexOf(user['user']), 1); } } }); cb.onMessage(function(msg) { var isModel = msg['user'] == cb.room_slug; var isMod = msg['is_mod']; var isFan = msg['in_fanclub']; var msgString = msg['m'].toLowerCase(); var message = msg['m'].split(' '); if ( (msgString.startsWith('!!')) || (msgString.startsWith('//'))) { bSuccess = true; //ignore commands meant for other bots msg['X-Spam'] = true; //mark msg as spam to prevent any ! command being sent to room } else if ( (msgString.startsWith('!')) || (msgString.startsWith('/'))) { msgString = msgString.substr(1); //strip off the ! or / (but it is still in msg) var bSuccess = false; msg['X-Spam'] = true; //mark msg as spam to prevent any ! command being sent to room //model or mod commands only if ( isModel || isMod ) { if ( msgString.startsWith('time ') || msgString === 'time' ) { doTimer(msgString,msg['user']); bSuccess = true; } else if (msgString === 'dice' || msgString === 'kubs' ) { gDiceAvail = !gDiceAvail; if (msgString === 'dice') { cb.sendNotice('Dice ' + (gDiceAvail ? "Started" : "Stopped") , '', '', cb.settings['noticecolor'], 'bold'); } else { cb.sendNotice('Kubs ' + (gDiceAvail ? "NACHALOS'" : "OSTANOVLENO") , '', '', cb.settings['noticecolor'], 'bold'); } bSuccess = true; } else if (msgString === 'gift' ) { gGiftAvail = !gGiftAvail; cb.sendNotice('Gift ' + (gGiftAvail ? "Started" : "Stopped") , '', '', cb.settings['noticecolor'], 'bold'); bSuccess = true; } else if(msgString === 'tipmenu') { gMenuAvail = !gMenuAvail; cb.sendNotice('Tipmenu ' + (gMenuAvail ? "Started" : "Stopped") , '', '', cb.settings['noticecolor'], 'bold'); bSuccess = true; } else if(msgString.startsWith('warn ') || (msgString == 'warn') ) { // space on end sendWarn(msg['m'], msg['user'] ); bSuccess = true; } else if(msgString.startsWith('notice ') || (msgString == 'notice') ) { // space on end sendNotice(msg['m'], msg['user'] ); bSuccess = true; } else if(msgString === 'lol all') { showPrizes(); bSuccess = true; } else if(msgString === 'menu all') { showMenuAd(); bSuccess = true; } else if(msgString.startsWith('noteset') || msgString === 'noteset') { noteSet(msg['m'], msg['user']); bSuccess = true; } else if(msgString.startsWith('noteclear') || msgString === 'noteclear') { noteClear(msg['m'], msg['user']); bSuccess = true; } else if(msgString.startsWith('noteminutes') || msgString === 'noteminutes') { noteMinutesSet(msg['m'], msg['user']); bSuccess = true; } else if(msgString === 'break') { gBreak = ! gBreak; cb.sendNotice('Break ' + (gBreak ? "Started" : "Stopped") , '', '', cb.settings['noticecolor'], 'bold','red'); bSuccess = true; } else if(msgString.startsWith('giftcount') || msgString === 'giftcount') { giftCountSet(msg['m'], msg['user']); bSuccess = true; } } if ( (isModel) || (isMod) || (msg['has_tokens'] == true) ) { if ( msgString.startsWith('m ') ) { //space on end cb.sendNotice('You wrote ' + msg['m'].substr(4) + ' to all mods', msg['user'], '', '', 'bold'); cb.sendNotice(msg['user'] + ' wrote to mods: ' + msg['m'].substr(4),'', '', '', 'bold', 'red'); bSuccess = true; } else if(msgString.startsWith('w ') || (msgString == 'w') ) { // space on end sendWhisper(msg['m'], msg['user'], (isModel || isMod) ); bSuccess = true; } } //anybody can do these even a spammer if (msgString === 'lol') { showPrizes(msg['user']); bSuccess = true; } else if( (msgString === 'bobo') || (msgString === 'help') ) { cb.sendNotice(getHelp( ((isModel) || (isMod)), msg['user'] ), msg['user']); bSuccess = true; } else if( (msgString === 'king') ) { showLeaderAd(msg['user']); setTimeout(function() { showKingAd(msg['user']); }, 500); bSuccess = true; } else if( (msgString === 'menu') ) { showMenuAd(msg['user']); bSuccess = true; } else if( (msgString === 'note') ) { showNotes(msg['user']); bSuccess = true; } if (bSuccess) { msg['m'] = ''; } else { cb.sendNotice('Unknown command',msg['user']); } } else if (isModel) { var emo = [":heart7", ":heart7", ]; var colr = ['#ffff66', '#ffff66']; var i = Math.floor((Math.random() * 1) + 1); msg.m = emo[i] + " " + msg.m; msg['background'] = colr[i]; } else if (isMod) { var emo = ["", "", ]; var colr = ['FFFFFF', 'FFFFFF']; var i = Math.floor((Math.random() * 1) + 1); msg.m = emo[i] + " " + msg.m; msg['background'] = colr[i]; } else if (isFan) { var emo = ["", "", ]; var colr = ['#b3ff67', '#b3ff67']; var i = Math.floor((Math.random() * 1) + 1); msg.m = emo[i] + " " + msg.m; msg['background'] = colr[i]; } else if (msg['has_tokens'] == true) { // return msg //approved message } else if (users.indexOf(msg['user']) != -1) { // return msg //approved message } else if (msg['m'] == gSpamPass.toString()) { users.push(msg['user']); msg['X-Spam'] = true; msg['m'] = "Correct number, You may talk now."; } else { setTimeout(function() { cb.sendNotice(gSpamNotice, msg['user']); }, 500); msg['m'] = "Please read the instructions and enter the correct number to talk."; msg['X-Spam'] = true; } //tip titles, if turned on, as well as king's crown if (cb.settings.tipTitles == 'Yes' && parseInt(tipperArray[findTipper(msg['user'])][1]) > 0 && message[0].charAt(0) != "/" && (msg['X-Spam'] != true) ) { msg['m'] = setTipTitles(msg['user'],msg['m']); } return msg; }); cb.onTip(function(tip) { if ((tip['amount'] == cb.settings.cost_per_gift) && (gGiftAvail)) { //present cb.chatNotice(tip['from_user'] + ' You are so kind to me, Spasiba !', ' ', '#ffa3a3', '#0000ff', 'bold'); cb.chatNotice(getGift() + ' Thank you soo much darling !' , ' ', '#ffa3a3', '#0000ff', 'bold'); } else if ( (tip['amount'] >= gDicePrice) && (tip['amount'] % gDicePrice == 0) && (gDiceAvail)) { //dice var numberOfRolls = Math.floor( tip['amount'] / gDicePrice); 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']; } } else { //tip menu var i = gTipmenuprice.indexOf(tip['amount']); if ((i >= 0) && (gMenuAvail)) { cb.sendNotice(tip['from_user'] + ' tipped for ' + gTipmenuitem[i], '', '', cb.settings['noticecolor'], 'bold'); } else { // Tip was for something else, don't roll the dice //cb.sendNotice('Tip was not for dice roll.', '', '#D9FAD7', '#000000', 'bold'); //tipCounter += parseInt(tip['amount']); cb.drawPanel(); } } tipperArray[findTipper(tip['from_user'])][1] += parseInt(tip['amount']); if(cb.settings.kingTipper == 'Yes') { if(tip['from_user'] != currentKing && parseInt(tipperArray[findTipper(tip['from_user'])][1]) > kingTip && parseInt(tipperArray[findTipper(tip['from_user'])][1]) >= parseInt(cb.settings.kingMin)) { if(currentKing != '') { cb.sendNotice('You have been dethroned by ' + tip['from_user'] + ', but revenge is sweet...', currentKing, PURPLE); } cb.sendNotice('We have a new King!\nAll hail ' + tip['from_user'] + '!','',PURPLE); currentKing = tip['from_user']; kingTip = parseInt(tipperArray[findTipper(tip['from_user'])][1]); } else if(tip['from_user'] == currentKing) { kingTip = parseInt(tipperArray[findTipper(tip['from_user'])][1]); } } if(cb.settings.leaderBoard == 'Yes') { //create an array of the names var nameArray = new Array; for(var i = 0; i < leaderArray.length; i++) { nameArray[i] = leaderArray[i][0]; } //the user is not currently in the top 3 if(!cbjs.arrayContains(nameArray,tip['from_user'])) { if(tipperArray[findTipper(tip['from_user'])][1] > leaderArray[0][1]) { leaderArray[2][0] = leaderArray[1][0]; leaderArray[2][1] = leaderArray[1][1]; leaderArray[1][0] = leaderArray[0][0]; leaderArray[1][1] = leaderArray[0][1]; leaderArray[0][0] = tip['from_user']; leaderArray[0][1] = tipperArray[findTipper(tip['from_user'])][1]; } else if(tipperArray[findTipper(tip['from_user'])][1] < leaderArray[0][1] && tipperArray[findTipper(tip['from_user'])][1] > leaderArray[1][1] || tipperArray[findTipper(tip['from_user'])][1] == leaderArray[0][1]) { leaderArray[2][0] = leaderArray[1][0]; leaderArray[2][1] = leaderArray[1][1]; leaderArray[1][0] = tip['from_user']; leaderArray[1][1] = tipperArray[findTipper(tip['from_user'])][1]; } else if(tipperArray[findTipper(tip['from_user'])][1] < leaderArray[1][1] && tipperArray[findTipper(tip['from_user'])][1] > leaderArray[2][1] || tipperArray[findTipper(tip['from_user'])][1] == leaderArray[1][1]) { leaderArray[2][0] = tip['from_user']; leaderArray[2][1] = tipperArray[findTipper(tip['from_user'])][1]; } } //the user is currently in the top 3 else { //the user is already #1 if(leaderArray[0][0] == tip['from_user']) { leaderArray[0][1] = tipperArray[findTipper(tip['from_user'])][1]; } //the user is #2 and is moving to #1 if(leaderArray[1][0] == tip['from_user'] && tipperArray[findTipper(tip['from_user'])][1] > parseInt(leaderArray[0][1])) { leaderArray[1][0] = leaderArray[0][0]; leaderArray[1][1] = leaderArray[0][1]; leaderArray[0][0] = tip['from_user']; leaderArray[0][1] = parseInt(tipperArray[findTipper(tip['from_user'])][1]); } //the user is #2 and is not moving to #1 else if(leaderArray[1][0] == tip['from_user'] && tipperArray[findTipper(tip['from_user'])][1] <= parseInt(leaderArray[0][1])) { leaderArray[1][1] = parseInt(tipperArray[findTipper(tip['from_user'])][1]); } //the user is #3 and is moving to #2 else if(leaderArray[2][0] == tip['from_user'] && tipperArray[findTipper(tip['from_user'])][1] > parseInt(leaderArray[1][1])) { leaderArray[2][0] = leaderArray[1][0]; leaderArray[2][1] = leaderArray[1][1]; leaderArray[1][0] = tip['from_user']; leaderArray[1][1] = parseInt(tipperArray[findTipper(tip['from_user'])][1]); } //the user is #3 and is moving to #1 else if(leaderArray[2][0] == tip['from_user'] && tipperArray[findTipper(tip['from_user'])][1] > parseInt(leaderArray[0][1])) { leaderArray[2][0] = leaderArray[1][0]; leaderArray[2][1] = leaderArray[1][1]; leaderArray[1][0] = leaderArray[0][0]; leaderArray[1][1] = leaderArray[0][1]; leaderArray[0][0] = tip['from_user']; leaderArray[0][1] = parseInt(tipperArray[findTipper(tip['from_user'])][1]); } //the user is #3 and is not moving else if(leaderArray[2][0] == tip['from_user'] && tipperArray[findTipper(tip['from_user'])][1] <= parseInt(leaderArray[1][1])) { leaderArray[2][1] = tipperArray[findTipper(tip['from_user'])][1]; } if(leaderArray[2][0] == leaderArray[1][0] || leaderArray[2][0] == leaderArray[0][0]) { leaderArray[2][0] = ''; leaderArray[2][1] = 0; } if(leaderArray[1][0] == leaderArray[0][0]) { leaderArray[1][0] = ''; leaderArray[1][1] = 0; } } } if(cb.settings.notifierTip == 'Yes' && parseInt(tip['amount']) >= cb.settings.tipMessageMin) { cb.sendNotice(cb.settings.tipMessage,'', PURPLE); } }); ////// // utility functions ////// function pad (str, max) { str = str.toString(); return str.length < max ? pad("0" + str, max) : str; } ////// // script functions ////// function doTimer(sCommand, sUser) { var iTime; if (sCommand == 'time') { if (_timerTimeout != 0) { var minutes = Math.floor( _countDownRemain / (60* 1000) ); var seconds = Math.floor( (_countDownRemain - (minutes * (60 * 1000))) / 1000); cb.sendNotice('Timer: ' + minutes + ':' + pad(seconds,2) + ' remaining',sUser); } else { cb.sendNotice('Timer not running',sUser); } } else if (sCommand == 'time 1s' || sCommand == 'time second') { if (_timerTimeout != 0) { cb.sendNotice('A timer is already running',sUser); } else { _countDownRemain = 1 * ( 1000); _timerTimeout = cb.setTimeout(overtime, SPEED_OF_TIMER); } } else { iTime = parseInt(sCommand.substr(sCommand.indexOf(' ')+1)); //strip off /cmd if (iTime == 0 ) { if (_timerTimeout == 0) { cb.sendNotice('No timer running to cancel',sUser); } else { cb.cancelTimeout(_timerTimeout); _timerTimeout = 0; cb.sendNotice( '----------TIMER CANCELLED----------', '', '#AA00AA', '#FFFF00', 'bold' ); } } else if ( (! iTime) || (iTime < 0 ) || (iTime > 30)) { cb.sendNotice('To start timer, type !time <minutes> from 1 to 30',sUser); cb.sendNotice('To cancel timer, type !time 0',sUser); } else if (_timerTimeout != 0) { cb.sendNotice('A timer is already running',sUser); } else { _countDownRemain = iTime * (60 * 1000); _timerTimeout = cb.setTimeout(overtime, SPEED_OF_TIMER); } } } function sendWhisper( sCommand, sUser, bIsSuper) { var sTo; sMessage = sCommand.substr(sCommand.indexOf(' ')+1).trim(); //strip off /cmd sTo = sMessage.substr(0, sMessage.indexOf(' ')); //get the destination sMessage = sMessage.substr(sTo.length+1).trim(); //strip off destination if ((sTo.length == 0) || (sMessage.length == 0) || (! sTo) || (! sMessage) ) { cb.sendNotice('To whisper, type !whisper <user> <message>',sUser); } else if ((aModerators.indexOf(sTo) == -1) && (! bIsSuper) ) { cb.sendNotice('You may only whisper to a moderator',sUser); } else { cb.sendNotice('You wrote ' + sMessage + ' to ' + sTo, sUser, '', '', 'bold'); cb.sendNotice(sUser + ' wrote to you: ' + sMessage, sTo, '', '', 'bold'); } } function sendWarn( sCommand, sUser) { var sTo; sMessage = sCommand.substr(sCommand.indexOf(' ')+1).trim(); //strip off /cmd sTo = sMessage.substr(0, sMessage.indexOf(' ')); //get the destination sMessage = sMessage.substr(sTo.length+1).trim(); //strip off destination if ((sTo.length == 0) || (sMessage.length == 0) || (! sTo) || (! sMessage) ) { cb.sendNotice('To warn, type !warn <user> <message>',sUser); } else { cb.sendNotice(sUser + ' WARNED ' + sTo + ': ' + sMessage, '', '', '', 'bold', 'red'); cb.sendNotice('WARNING: ' + sMessage, sTo, '', '', 'bold'); } } function sendNotice( sCommand, sUser) { var sTo; sMessage = sCommand.substr(sCommand.indexOf(' ')+1).trim(); //strip off /cmd if ((sMessage.length == 0) || (! sMessage) ) { cb.sendNotice('To send notice, type !notice <message>',sUser); } else { cb.sendNotice(sUser + ' notified the room' , '', '', '', 'bold', 'red'); cb.sendNotice(sMessage, '', '', '', 'bold'); } } function noteSet( sCommand, sUser) { var iNote; sMessage = sCommand.substr(sCommand.indexOf(' ')+1).trim(); //strip off /cmd iNote = parseInt(sMessage.substr(0, sMessage.indexOf(' '))); //get the note number sMessage = sMessage.substr(1).trim(); //strip off note number if ((iNote < 1) || (iNote > 5) || (sMessage.length == 0) || (! iNote) || (! sMessage) ) { cb.sendNotice('To set note, type !setnote <1-5> <note>',sUser); } else { cb.sendNotice('Note ' + iNote + ' was: '+ ((aNote[iNote] == undefined) ? 'blank' : aNote[iNote]) + '\n' + 'Note ' + iNote + ' now: '+ sMessage, sUser, '', '', 'bold'); aNote[iNote] = sMessage; } } function noteClear( sCommand, sUser) { var iNote; sMessage = sCommand.substr(sCommand.indexOf(' ')+1).trim(); //strip off /cmd iNote = parseInt(sMessage); //get the note number if ((iNote < 2) || (iNote > 5) || (! iNote) ) { cb.sendNotice('To clear note, type !clearnote <2-5>',sUser); } else { cb.sendNotice('Note ' + iNote + ' cleared, was: ' + aNote[iNote], sUser, '', '', 'bold'); aNote[iNote] = undefined; } } function noteMinutesSet( sCommand, sUser) { var iMinutes; sMessage = sCommand.substr(sCommand.indexOf(' ')+1).trim(); //strip off /cmd iMinutes = parseInt(sMessage); //get the time if ((iMinutes < 1) || (iMinutes > 999) || (! iMinutes) ) { cb.sendNotice('To set note minutes, type !noteminutes <1-999>',sUser); } else { cb.sendNotice('Note minutes set to ' + iMinutes + ', was: ' + noteMinutes, sUser, '', '', 'bold'); noteMinutes = iMinutes; } } function giftCountSet( sCommand, sUser) { var i; sMessage = sCommand.substr(sCommand.indexOf(' ')+1).trim(); //strip off /cmd i = parseInt(sMessage); //get the count if ( (i < 100) || (i > 999) || (! i) ) { cb.sendNotice('To set gift count, type !giftcount <100-999>',sUser); } else { cb.sendNotice('Gift count was: '+ giftCount + ' now: '+ i, sUser, '', '', 'bold'); giftCount = i; } } function dicePrice( sCommand, sUser) { var iprice; sMessage = sCommand.substr(sCommand.indexOf(' ')+1).trim(); //strip off /cmd iPrice = parseInt(sMessage); //get the price if ((iPrice < 1) || (iPrice > 99) || (! iPrice) ) { cb.sendNotice('To set dice price, type !diceprice <1-99>',sUser); } else { cb.sendNotice('Dice price set to ' + iPrice + ', was: ' + gDicePrice, sUser, '', '', 'bold'); gDicePrice = iPrice; } } function giftPrice( sCommand, sUser) { var iprice; sMessage = sCommand.substr(sCommand.indexOf(' ')+1).trim(); //strip off /cmd iPrice = parseInt(sMessage); //get the price if ((iPrice < 1) || (iPrice > 99) || (! iPrice) ) { cb.sendNotice('To set gift price, type !giftprice <1-99>',sUser); } else { cb.sendNotice('Gift price set to ' + iPrice + ', was: ' + gGiftPrice, sUser, '', '', 'bold'); gGiftPrice = iPrice; } } function getHelp(bIsSuper, sUser) { var s = '******************************************************\x0A'; if (sUser == cb.room_slug) { s += '- - - - - - - Menyu pomoshchi\x0A'; s += '******************************************************\x0A'; s += "!m <soobshcheniye> - Otpravit' soobshcheniye vsem moderatoram\x0A"; s += "!w <kliyent> <soobshcheniye> - Otpravit' soobshcheniye klyient\x0A"; s += "!lol - Pokazat' kub prizy\x0A"; // s += "!king - Show leaderboard\x0A"; s += "!menu - Pokazat' chayevyye menyu\x0A"; s += "!note - Pokazat' zapiska\x0A"; s += "******************************************************\x0A"; s += "- - -Eti komandy skryty ot obychnykh pol'zovateley\x0A"; s += "******************************************************\x0A"; s += "!gift - Vklyuchite / vyklyuchite podarki- - - - - - -" + (gGiftAvail ? "SEYCHAS NACHALOS'" : "SEYCHAS OSTANOVLENO") + "\x0A"; s += "!kubs - Vklyuchite / vyklyuchite kubs - - - - - - - -" + (gDiceAvail ? "SEYCHAS NACHALOS'" : "SEYCHAS OSTANOVLENO") + "\x0A"; s += "!tipmenu - Vklyuchite / vyklyuchite chayevyye menyu -" + (gMenuAvail ? "SEYCHAS NACHALOS'" : "SEYCHAS OSTANOVLENO") + "\x0A"; s += "!break - Vklyuchite / vyklyuchite pereryv - - - - - -" + (gBreak ? "SEYCHAS NACHALOS'" : "SEYCHAS OSTANOVLENO") + "\x0A";; s += "!time 1(-30) - ZAPUSK Taymera\x0A"; s += "!time 0 - OSTANOVITE Taymera\x0A"; s += "!diceprice <tsena> - ustanavlivat' kub tsena\x0A"; s += "!giftprice <tsena> - ustanavlivat' podarki tsena\x0A"; s += "!lol all - pokazat' prizy kubs v komnatu\x0A"; s += "!menu all - pokazat' chayevyye menyu v komnatu\x0A"; s += "!warn <kliyent> <soobshcheniye> - predosteregat' kliyent\x0A"; s += "!notice <soobshcheniye> - pokazat' soobshcheniye v komnatu\x0A"; s += "!noteset <1-5> <zapiska> - ustanavlivat' zapiska\x0A"; s += "!noteclear <2-5> - udalyat' zapiska\x0A"; // s += "!noteminutes <1-999> - Note frequency (minutes).\x0A"; } else { s += '- - - - - - - Help menu.\x0A'; s += '******************************************************\x0A'; s += '!m <message> - Send a message to all moderators\x0A'; s += '!w <user> <message> - Send a message to a user\x0A'; s += '!lol - Show dice prizes\x0A'; s += '!king - Show leaderboard\x0A'; s += '!menu - Show tip menu\x0A'; s += '!note - Show notes\x0A'; if (bIsSuper) { s += '******************************************************\x0A'; s += '- - -These commands are hidden from regular users.\x0A'; s += '******************************************************\x0A'; s += '!gift - Turn the gifts on/off - - - ' + (gGiftAvail ? "NOW STARTED" : "NOW STOPPED") + '\x0A'; s += '!dice - Turn the dice game on/off - ' + (gDiceAvail ? "NOW STARTED" : "NOW STOPPED") + '\x0A'; s += '!tipmenu - Turn the tip menu on/off- - ' + (gMenuAvail ? "NOW STARTED" : "NOW STOPPED") + '\x0A'; s += '!break - Turn the break mode on/off- - ' + (gBreak ? "NOW STARTED" : "NOW STOPPED") + '\x0A'; s += '!time 1(-30) - to START the Timer manually .\x0A'; s += '!time 0 - to STOP the timer. \x0A'; s += '!diceprice <amount> - Change dice price\x0A'; s += '!giftprice <amount> - Change gift price\x0A'; s += '!giftcount <100-999> - Change gift count - Currently:' + giftCount + '\x0A'; s += '!lol all - Show dice prizes to everyone\x0A'; s += '!menu all - Show tip menu to all.\x0A'; s += '!warn <user> <message> - Warn a user.\x0A'; s += '!notice <message> - Send message to the room.\x0A'; s += '!noteset <1-5> <note> - Change a note.\x0A'; s += '!noteclear <2-5> - Clear a note.\x0A'; s += '!noteminutes <1-999> - Note frequency (minutes).\x0A'; } } s += '******************************************************'; return (s); } function getGift() { var numGift = Math.floor(Math.random() * giftCount ) + 1; if (giftCount > GIFTAVOID.length) { //only avoid gifts if there are gifts to award while ( (GIFTAVOID.indexOf(numGift) >= 0) || (numGift == lastGift) ) { numGift = Math.floor(Math.random() * giftCount ) + 1; } } lastGift = numGift; return GIFTPREFIX + cb.room_slug.split('').reverse().join('') + '_' + pad(numGift,3); } 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 = " (RARE)"; 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 = '#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 showPrizes(username) { if (prizes.length) { var rareText = ''; var msg = "***** POSSIBLE PRIZES *****"; for (var i = 1; i <= maxOutcome; i++) { if (i == maxOutcome) rareText = " (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"; } if (rollCounter < minimumRollsToGetRareDice) { if ((minimumRollsToGetRareDice - rollCounter) == 1) { msg += "\nOnly 1 roll until the rare die can appear." } else { msg += "\n" + (minimumRollsToGetRareDice - rollCounter) + " rolls until the rare die can appear." } } cb.sendNotice(msg, username, '#DBFBFF', '#008596', 'bold'); } function showPrizesWon(username) { //THIS IS NOT CURRENTLY CALLED if (gDiceAvail) { var msg = "***** LAST 20 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, '#ffff00', '#000000', 'bold'); } else { var recentWinners = winners.slice(-20); for (var i = 0; i < recentWinners.length; i++) msg += "\n" + recentWinners[i]; cb.sendNotice(msg, username, '#FFF0DE', '#8A4900', 'bold'); } } } function showNotes(sUser) { var i; var s = '- - - Notes - - -'; for (i = 1; i <= NOTEMAX; i++) { s += '\nNote ' + i + ': ' + ((aNote[i] == undefined ) ? 'blank' : aNote[i] ); } cb.sendNotice(s, sUser, '', cb.settings['noteColor'],'bold'); } function noteAd() { var note; if (! gBreak) { while (aNote[(++noteLast)] == undefined ) { //skip empty messages if (noteLast > NOTEMAX) { noteLast = 0; } } note = aNote[(noteLast)]; if (cb.settings['allowNote'] == 'Yes') { cb.sendNotice(note,'','',cb.settings['noteColor'],'bold'); } } cb.setTimeout(noteAd, (noteMinutes * 60000)); } function showDiceAd(sUser) { var s = ":diceroll1 :diceroll \n"; s += "Tip " + gDicePrice + " tokens to roll the dice. \n"; s += "Type \!lol\ to see the list of prizes.\n"; if (multiRolls > 1) { s += "You can win maximum " + multiRolls + " prizes (" + (multiRolls * gDicePrice) + " tokens)"; } cb.sendNotice(s, sUser, '', '#15A6B0', 'bold'); } function showGiftAd(sUser) { cb.sendNotice(':giftbox Tip ' + cb.settings.cost_per_gift + ' token' + ((cb.settings.cost_per_gift > 1) ? 's' : '') + ' to surprise Kate by sending her a nice random gift.', sUser, '', '#0000cc', 'bold'); } function showMenuAd(sUser) { if ( gTipMenuText != 'Tip Menu: ' ) { cb.sendNotice(gTipMenuText, sUser, '', cb.settings['noticecolor'], 'bold'); } } function showKingAd(sUser) { if (kingTip < parseInt(cb.settings.kingMin)) { var supplant = cb.settings.kingMin; } else { var supplant = kingTip + 1; } cb.sendNotice('- Tip ' + supplant + ' to become the new King -', sUser, PURPLE); } function showLeaderAd(sUser) { cb.sendNotice('- - - - - - Leaderboard - - - - - - - -', sUser, PURPLE); cb.sendNotice(leaderArray[0][0] + ' : ' + leaderArray[0][1] + '\n' + leaderArray[1][0] + ' : ' + leaderArray[1][1] + '\n' + leaderArray[2][0] + ' : ' + leaderArray[2][1], sUser); } function advertise(sUser) { var a = []; var i = 0; // if at the end of the list, start over if (gLastAdNum == 4) { gLastAdNum = 0; } // check the ads in reverse if ((kingTipper || leaderBoard) && gLastAdNum < 4) { i = 4; } if (gMenuAvail && gLastAdNum < 3) { i = 3; } if (gGiftAvail && gLastAdNum < 2) { i = 2; } if (gDiceAvail && gLastAdNum < 1) { i = 1; } // show ad(s) if ((sUser && gDiceAvail) || (i == 1 && ! gBreak) ) { showDiceAd(sUser); } if ((sUser && gGiftAvail) || (i == 2 && ! gBreak) ) { showGiftAd(sUser); } if ((sUser && gMenuAvail) || (i == 3 && ! gBreak) ) { showMenuAd(sUser); } if ( (i == 4 && ! gBreak) ) { if (leaderBoard) { showLeaderAd(sUser); } if (kingTipper && ! gBreak) { showKingAd(sUser); } } if (! sUser) { if (! gBreak) { gLastAdNum = i; } cb.setTimeout(advertise, parseInt(cb.settings.ad_time) * (60 * 1000)); } } function overtime() { var minutes = Math.floor( _countDownRemain / (60* 1000) ); var seconds = Math.floor( (_countDownRemain - (minutes * (60 * 1000))) / 1000); cb.cancelTimeout(_timerTimeout); if ( minutes == 0 && seconds == 0 ) { // time to stop cb.sendNotice( '---------------THE END----------------', '', '#AA00AA', '#FFFF00', 'bold' ); _timerTimeout = 0; } else if ( minutes == 0 && seconds == 1 ) { cb.sendNotice( '---------- 1 SECOND LEFT----------', '', '#AA00AA', '#FFFF00', 'bold' ); } else if ( minutes == 0 && seconds % 10 == 0 && seconds <= 30 ) { cb.sendNotice( '----------' + seconds + ' SECONDS LEFT----------', '', '#AA00AA', '#FFFF00', 'bold' ); } else if ( minutes == 1 && seconds == 0 ) { cb.sendNotice( '----------1 MINUTE LEFT-------------', '', '#AA00AA', '#FFFF00', 'bold' ); } else if ( (( minutes % 5 == 0 ) || ( minutes <= 10 && minutes > 1) ) && seconds == 0 ) { cb.sendNotice( '----------' + minutes + ' MINUTES LEFT-----------', '', '#AA00AA', '#FFFF00', 'bold' ); } if (_countDownRemain > 0) { _countDownRemain -= SPEED_OF_TIMER; _timerTimeout = cb.setTimeout(overtime,SPEED_OF_TIMER); } } //functions function tipperArrayPopulate(user) { tipperArray[numTippers] = new Array; tipperArray[numTippers][0] = user; tipperArray[numTippers][1] = 0; numTippers++; } function findTipper(user) { for(var i = 0; i < tipperArray.length; i++) { if(tipperArray[i][0] == user) { break; } } if(i == tipperArray.length) { tipperArrayPopulate(user); findTipper(user); } return i; } function setTipTitles(user, message) { if(cb.settings.kingTipper == 'Yes' && user == currentKing) { var m = ':smallCrown |' + tipperArray[findTipper(user)][1] + '| ' + message; } else { var m = '|' + tipperArray[findTipper(user)][1] + '| ' + message; } return m; } ////// // initialization ////// function antiSpamInit() { gSpamPass = Math.floor((Math.random() * 9000) + 1001); var passp = gSpamPass.toString().split(""); gSpamNotice = "To prevent spambots users without tokens must first enter the following number to be able to chat.\n" + NUMWORD[passp[0]] + " " + NUMWORD[passp[1]] + " " + NUMWORD[passp[2]] + " " + NUMWORD[passp[3]] + " (enter as a number , e.g. 2345)"; } function availInit() { gDiceAvail = cb.settings.allowDice == 'Yes'; gGiftAvail = cb.settings.allowGift == 'Yes'; gMenuAvail = cb.settings.allowMenu == 'Yes'; kingTipper = cb.settings.kingTipper == 'Yes'; leaderBoard = cb.settings.leaderBoard == 'Yes'; } function setPrizes() { var rareText = ''; for (var i = 1; i <= maxOutcome; i++) { if (i == maxOutcome) { rareText = " (RARE)"; } prizes.push(cb.settings['prize_' + i] + rareText); } } function separatorInit() { for (i = 0; i < gSeparators.length; i++) { if (cb.settings['sepchar'] == gSeparators[i].label) { gSeparator = gSeparators[i].shortcut + ' '; } } } function noteInit() { var i; var note; for (i = 1; i <= NOTEMAX; i++) { if (cb.settings['note' + i ] != 0 ) { aNote[i] = cb.settings['note' + i ]; } } noteMinutes = cb.settings.noteMinutes; cb.setTimeout(noteAd, ((noteMinutes * 60000) + 30000)); // start note with 30s offset } function tipMenuInit() { separatorInit(); gTipMenuText = 'Tip Menu: '; for (i = 0; i < MAXITEMS; i++) { var tmp = cb.settings['item' + (i + 1)]; if (tmp) { var arr = tmp.split('--'); if (arr[1] === undefined) { cb.sendNotice("Error-You need two '- -' to separate the tip amount and menu item for item no " + i, '', '', cb.settings['noticecolor'], 'bold'); } else { if (parseInt(arr[0]) > 0) { gTipmenuprice[i] = parseInt(arr[0]); gTipmenuitem[i] = arr[1]; if (i >= 1) { gTipMenuText += gSeparator; } gTipMenuText += arr[1] + '(' + parseInt(arr[0]) + ') '; } } } } if ((gTipMenuText == 'Tip Menu: ') && (gMenuAvail)) { cb.sendNotice('Error-No tip menu items found', '', '', cb.settings['noticecolor'], 'bold'); } } function init() { antiSpamInit(); availInit(); setPrizes(); tipMenuInit(); noteInit(); advertise(); if ((cb.settings.change_room_subject == 'Yes') && (gDiceAvail)) { cb.changeRoomSubject('Tip ' + gDicePrice + ' token' + ((gDicePrice > 1) ? 's' : '') + ' to roll the dice and win a prize!'); } } init();
© Copyright Chaturbate 2011- 2024. All Rights Reserved.