Apps Home
|
Create an App
eah
Author:
dirtyh
Description
Source Code
Launch App
Current Users
Created by:
Dirtyh
/******************************************************* Welcome to Chaturbate's version of Cards Against Humanity! * Title : Cards Against Humanity * Original By : kittehbangity * Modified By : emmiazure and dirtyhed * Version : 1.0.0 (2018.03.18) *******************************************************/ cb.settings_choices = [{ name: 'ADVERT_TIME', type: 'int', minValue: 4, maxValue: 10, defaultValue: 10, label: 'Delay for Notice display (4 to 10 min) ' }]; /***** App commands *****/ var COMMAND = { // General Commands: HELP : 'help', /* Display the commands. */ POINTS : 'points', /* Display points for players */ PLAYERS : 'players', /* Display list of players */ // Broadcaster Commands: ADD : 'add', /* Add one or more viewers to player list */ STARTGAME : 'startgame', /* Start the game */ STOPGAME : 'stopgame', /* Stop the game */ OPEN : 'open', /* Open submitted white cards */ CHOOSE : 'choose', /* Pick the best answer */ RESET : 'reset', /* Reset winners list */ // Viewer Commands: LIST : 'l', /* Show list of white cards owned */ PICK : 'p', /* Pick a card for her/his turn */ }; /***** App colors *****/ var COLOR = { DEVELOPER : '#D9F7F7', /* Very light blue: Highlight colour for developers */ BRED : '#FF1407', /* Bright red: Timer notice, misc. important messages */ MRED : '#D80A00', /* Medium red */ HIGHLIGHT : '#EEE5FF', /* Pastel purple: Highlight colour for ticket holders */ SUCCESS : '#468847', /* Green: Everything is fine */ ERROR : '#FF0000', /* Red: Everything fails */ INFO : '#144D8C', /* Blue-grey: Help and misc info */ NOTICE : '#6900CC', /* Bluish purple: General chat notice */ DPURPLE : '#663399', /* Dark purple */ LPURPLE : '#8041BF', /* Lighter purple */ BLUE : '#000099', /* Dark blue */ MOD : '#DC0000', /* Moderator red */ FAN : '#009900', /* Fan green */ SYNTAX : '#995B00', /* Brownish: Usage notice colour and messages to broadcaster on mod-action */ HVTEXT : '#D80A00', /* Reddish: Text colour for Hi-Vis notices */ HVBACK : '#FFFFBF', /* Light yellow: Backbround colour for Hi-Vis notices */ TBMBACK : '#E0EEFF', TBMTEXT : '#12447A', MAG : '#E509E5', /* Magenta */ STOPHL : '#FFE5E5', PINK : '#FF48D2', /* Pink */ BLI : '#DDFFCC', /* Pastel green - Birdy */ BF : '#FFE0EA' /* Pastel pink - Blaze */ }; var numCards = 10; var roomHost = cb.room_slug; /********** Misc Variables **********/ var cmdPrefix = '/'; var dashLine = "------------------------------------------------------------"; /***** Arrays *****/ var playerList = []; // Array of players var whiteCards = []; // Array of white cards owned by players var whiteAvailable = []; // Array of white cards in the deck var submittedCards = new Object(); // Map of white cards submitted for the round var orderedSubmittedCards = []; // Array of white cards submitted var points = []; // Map of points function getUser(k) { return submittedCards[k]; } var blackAvailable = []; // List of black cards var curBlackCard; cb.onMessage(function(msg) { var m = msg['m']; var u = msg['user']; var isMod = msg['is_mod']; var isRoomHost = (u == roomHost); //cb.log("u: " + u); //cb.log("isMod: " + isMod); //cb.log("m: "+ m); //cb.log("isRoomHost: "+ isRoomHost); // split the chat message into a command, "cmd" and its parameters "cmdval" // further splits cmdval into array "cmdValArray" var regexCommandSplit = '^' + cmdPrefix + '(\\S+)(?:\\b\\s*)(.*)?'; var regexListSplit = /[\s]+/; var reCmdSplit = new RegExp(regexCommandSplit); var cmdSplit = m.match(reCmdSplit); var cmd; var cmdval; var cmdValArray; //cb.log("cmdSplit: "+ cmdSplit); if (cmdSplit) { cmd = cmdSplit[1]; cmdval = cmdSplit[2]; if (cmdval != null) cmdval = cmdval.replace(/^\s+|\s+$/g,''); if (cmdval != null) { cmdValArray = cmdval.split(regexListSplit); } else { cmdValArray = ''; } cb.log("cmdValArray: "+ cmdValArray); } if (/^(\?|!)/.test(m)) { msg['X-Spam'] = true; return cb.sendNotice(dashLine+"\n* " +": Incorrect command prefix.\n"+dashLine,u,'',COLOR.MRED,'bold'); } if (cmdval && (/^</.test(cmdval))) { msg['X-Spam'] = true; return cb.sendNotice(dashLine+"\n* The < and > are not required. Please re-enter.\n"+dashLine,u,'',COLOR.MRED,'bold'); } /***** Ok, let's start processing commands *****/ switch (cmd) { /******************* * General Commands * *******************/ /***** Help and Command List ***** /help *****/ case COMMAND.HELP: //cb.sendNotice(getCommandList(u,isMod),u,'',COLOR.INFO,'bold'); var smt = getCommandList(u,isMod); cb.sendNotice(smt); cb.log("smt: "+smt); break; /***** Winners List ***** /winners *****/ case COMMAND.POINTS: showPoints(); break; /***** Players List ***** /players *****/ case COMMAND.PLAYERS: cb.sendNotice(getPlayersList(),u,'',COLOR.INFO,'bold'); break; /************************************** * Moderator and Broadcaster Commands * **************************************/ /***** Add user(s) ***** /add *****/ case COMMAND.ADD: if ((isMod) || isRoomHost) { if (cmdval) { if (cmdValArray.length > 1) { // We are adding multiple viewers at once cb.sendNotice("* Mass adding users to the player list",u,'',COLOR.NOTICE,'bold'); for (var i=0; i<cmdValArray.length; i++) { if (!user('check',cmdValArray[i]) && cmdValArray[i] != "") { // User is not yet on the list user('add',cmdValArray[i]); // And add the user ( } else if (cmdValArray[i] != "") { // Safe to assume we don't have to add this user? cb.sendNotice("* Skipped: '" + cmdValArray[i] + "' is already on the player list.",u,'',COLOR.SYNTAX); } } // end for cb.sendNotice("* Mass adding completed - Viewers Notified.",u,'',COLOR.NOTICE,'bold'); // Kinda nice to know we're done } else { if ( user('check',cmdval) ) { cb.sendNotice("* Skipped: '" + cmdval + "' is already on the list.",u,'',COLOR.NOTICE,'bold'); } else { // We are just adding one viewer if (!cbjs.arrayContains(playerList,cmdval)) playerList.push(cmdval); // Inform viewer cb.sendNotice("* '" + cmdval + "' you have been added to the player list.",cmdval,'',COLOR.NOTICE,'bold'); // Inform adder cb.sendNotice("* Viewer '" + cmdval + "' added to the player list.",u,'',COLOR.NOTICE,'bold'); // Inform broadcaster cb.sendNotice("* Viewer '" + cmdval + "' added to the player list by '" + u + "'.",roomHost,'',COLOR.SYNTAX,''); } } // end if +cmdValArray.length } // end if cmdval } // end if ((isMod) || isRoomHost) else { cb.sendNotice("Only broadcaster and/or moderator can add player.",u,'',COLOR.ERROR,'bold'); } break; /***** Start game ***** /startgame *****/ case COMMAND.STARTGAME: if (isRoomHost) { startGame(); } else { cb.sendNotice("Only broadcaster and/or moderator can start game.",u,'',COLOR.ERROR,'bold'); } break; /***** Stop game ***** /stopgame *****/ case COMMAND.STOPGAME: if (isRoomHost) { stopGame(); } else { cb.sendNotice("Only broadcaster and/or moderator can stop game.",u,'',COLOR.ERROR,'bold'); } break; /***** Open submitted white cards ***** /open *****/ case COMMAND.OPEN: if (isRoomHost) { openCards(); } else { cb.sendNotice("Only broadcaster and/or moderator can open cards.",u,'',COLOR.ERROR,'bold'); } break; /***** Choose the best answer ***** /choose *****/ case COMMAND.CHOOSE: if (isRoomHost) { if (cmdval) { if (orderedSubmittedCards != null && parseInt(cmdval) > 0 && parseInt(cmdval) <= orderedSubmittedCards.length){ var number = parseInt(cmdval)-1; var bestAnswer = chooseBestAnswer(number); var winner = getKeyByValue(submittedCards, bestAnswer); cb.sendNotice("Winner is "+winner); points[winner] += 1; showPoints(); nextRound(); } else { cb.sendNotice("Please choose the correct number of card",u,'',COLOR.ERROR,'bold'); } } } else { cb.sendNotice("Only broadcaster and/or moderator can choose best answer.",u,'',COLOR.ERROR,'bold'); } break; /************************************** * Players Commands * **************************************/ /***** List ***** /l *****/ case COMMAND.LIST: var cardList = getWhiteCardsList(u); if (cardList != null && cardList != '') {cb.sendNotice(cardList,u,'',COLOR.NOTICE,'bold');} break; /***** Pick ***** /p *****/ case COMMAND.PICK: cb.log("cmdval: "+cmdval); cb.log("whiteCards[u].length: "+whiteCards[u].length); if (cmdval){ if (whiteCards[u] != null && parseInt(cmdval) > 0 && parseInt(cmdval) <= whiteCards[u].length){ cmdval = parseInt(cmdval)-1; pick(cmdval, u); } else { cb.sendNotice("Please choose the correct number of card",u,'',COLOR.ERROR,'bold'); } } break; } /*** switch DONE ***/ }) /********** Functions **********/ // User Handling function user(command,user) { if ( (command === 'add') ) { playerList.push(user); cb.sendNotice("* Added: '" + user + "'.",user,'',COLOR.SUCCESS,''); // say who. cb.sendNotice("* '"+ user+"' you have been added to the ticket holders list.",user,'',COLOR.NOTICE,'bold'); } // end if add if ( (command === 'del') ) { if (cbjs.arrayContains(playerList,user)) cbjs.arrayRemove(playerList,user); } // end if del if (command === 'check') { return (cbjs.arrayContains(playerList, user) == true ? true : false); } // end if check } // end function user // Get the list of commands function getCommandList(u,isMod) { var text = "--------------- Game Rules---------------"; text += "\n"; text += "At the beginning of the game, each player is given ten White \"Cards\". "; text += "\n"; text += "\n Emmi is the Card Czar and plays a Black Card. In each round the app will display the fill-in-the-blank phrase on the Black Card."; text += "\n"; text += "\n Players fill in the blank by passing one White Card to Emmi."; text += "\n"; text += "\n The app will collect and shuffle all of the answers and show each card combination to the group. Emmi then picks the funniest play, and whoever submitted it gets one Awesome Point."; text += "\n"; text += "\n After the round, players will be given new White Card back up to ten."; text += "\n"; text += "\n --------------- COMMAND LIST ---------------"; text += "\n"; text += "\n" + cmdPrefix + COMMAND.HELP + " - Display the commands."; text += "\n---------------------------------------------------"; // line below list return text; } function getPlayersList() { var players = "--------------- PLAYERS LIST ---------------"; // Header for (var i=1; i<=playerList.length; i++) { players += "\n" + i + ". " + playerList[i-1]; } return players; } function getWhiteCardsList(user) { var cards; if (whiteCards[user] != null){ cards = "--------------- WHITE CARDS LIST ---------------"; cb.log("whiteCards[user] != null"); for (var i=1; i<=whiteCards[user].length; i++) { cb.log("whiteCards[user][i-1] "+ whiteCards[user][i-1]); cards += "\n" + i + ". " + whiteCards[user][i-1]; } } else { if (playerList.indexOf(user) > -1){ cb.sendNotice("Cards are not distributed yet or game has ended.",user,'',COLOR.ERROR,'bold'); } else { cb.sendNotice("You are not playing.",user,'',COLOR.ERROR,'bold'); } } return cards; } function showPoints(){ var text = "--------------- AWESOME POINTS ---------------"; for (var user in points) { text += "\n" + user + ": " + points[user] + "\n"; } cb.sendNotice(text,'','',COLOR.NOTICE,'bold'); } function startGame(){ whiteAvailable = whiteCardsList; blackAvailable = blackCardsList; // Distribute white cards to players var rnumber; var player; for (var i=0; i<playerList.length; i++) { player = playerList[i]; whiteCards[player] = []; points[player] = 0; for (var j=0; j<numCards; j++) { rnumber = Math.floor(Math.random() * whiteAvailable.length); //cb.log("whiteAvailable[rnumber]" + whiteAvailable[rnumber]); //cb.log("rnumber" + rnumber); whiteCards[player][j] = whiteAvailable[rnumber]; whiteAvailable.splice(rnumber, 1); } //cb.sendNotice(getWhiteCardsList(player),player,'',COLOR.NOTICE,'bold'); } nextRound(); } function stopGame(){ playerList = []; whiteCards = []; submittedCards = []; orderedSubmittedCards = []; points = []; } function openCards(){ var notice; var i = 1; for (var user in submittedCards) { cb.log("user "+user); cb.log("i "+i); cb.log("submittedCards[user] "+submittedCards[user]); orderedSubmittedCards[i-1] = submittedCards[user]; notice = curBlackCard; notice += "\n" +i + ". " + submittedCards[user]; //cb.setTimeout(function(){ cb.sendNotice(notice); }, 3000*i); cb.sendNotice(notice); i++; } } function chooseBestAnswer(number){ return orderedSubmittedCards[number]; } function nextRound(){ // init submittedCards submittedCards = []; // randomize a Black Card for the round var rand = Math.floor(Math.random() * blackAvailable.length); curBlackCard = blackAvailable[rand]; blackAvailable.splice(rand,1); cb.sendNotice("QUESTION: " +curBlackCard,'','',COLOR.NOTICE,'bold'); var player; var randWhite; if ((whiteAvailable.length >= playerList.length)){ for (var i=0; i<playerList.length; i++) { player = playerList[i]; if (whiteCards[player].length < numCards) { for (var j = whiteCards[player].length; j<numCards; j++){ randWhite = Math.floor(Math.random() * whiteAvailable.length); whiteCards[player].push(whiteAvailable[randWhite]); whiteAvailable.splice(randWhite, 1); } } } } for (var i=0; i<playerList.length; i++) { player = playerList[i]; cb.sendNotice("\n" + getWhiteCardsList(player),player,'',COLOR.NOTICE,'bold'); } } function pick(number, userId){ if (userId in submittedCards) { cb.sendNotice("You have already picked a card ", userId,'',COLOR.ERROR,'bold'); } else { var picked = whiteCards[userId][number]; // remove card from user's "hands" whiteCards[userId].splice(number,1); // add to submitted cards submittedCards[userId] = picked; cb.sendNotice("You picked " + "\"" + picked + "\"", userId,'',COLOR.NOTICE,'bold'); } return picked; } function getUserId(user){ return playerList.indexOf(user); } function advert() { cb.chatNotice('Emmi Against Humanity! Everyone can play!'); cb.chatNotice(getCommandList(roomHost,false), cb.room_slug); cb.setTimeout(advert, (cb.settings.ADVERT_TIME * 60000)); } function getKeyByValue(map, value){ for (var key in map){ if (map[key] === value) { return key; } } } function init() { advert(); } var blackCardsList = ["My new diet! Kale juice and __________.","Emmi sets aside 15 minutes a day for __________.","Emmi likes __________ waaay too much!","Buy Emmi's new book, __________ for Fun and Profit!","I'm sorry but we don't allow __________ at the supermarket.","When having sex, __________ is a must!","__________. Awesome in theory, kinda a mess in practice.","Emmi got suspended when she brought __________ for show and tell.","Emmi's secret fetish: _________.","Next from JK Rowling, Harry Potter and the Chamber of __________.","HELP, I'm addicted to __________.","A date with Emmi would be incomplete without __________.","__________ is Emmi's secret power.","Coming to a theater near you, Emmi and the __________.","I find __________ very disturbing, yet somewhat exciting!","She's young, hot, and full of __________.","Hey Emmi, __________ does NOT count as a workout!","__________. Betcha can't have just one.","I get by with a little help from __________.","__________? That's my favorite!","Doctor's are finally embracing the curative powers of __________.","Shh, I'm thinking about __________.","Emmi will not go online without __________.","Forget Grey, give me Fifty Shades of __________.","Before I kill you Mr. Bond, I must show you __________.","Today I learned about __________.","Soup of the day - Cream of __________.","__________ killed my boner.","I must be high, I'm mesmerized by __________.","If it wasn't for __________, my life would have no meaning.","You can solve every problem with __________","All my poetry is inspired by __________.","I got 99 problems but __________ ain't one.","__________: good to the last drop!","Starting this week, casual Friday will officially become __________ Friday.","_______ best describes my relationship status.","I don't need drugs, I'm high on _________.","Emmi spent all her money on __________.","Money can't buy me love, but it can buy me __________.","Wow! There's nothing like __________in the morning.","Next on ESPN4: The World Series of __________.","He who controls __________ controls the world.","When I'm in prison, I'll have __________ smuggled in.","During sex, I like to think about __________.","Anthropologists have recently discovered a primitive tribe that worships __________.","Lifetime presents Emmi, the story of __________.","When I am a billionaire, I shall erect a 50-foot statue to commemorate __________.","In an attempt to reach a wider audience, the Smithsonian Museum of Natural History has opened an interactive exhibit on __________.","Sorry everyone, I was just __________.","Due to a PR fiasco, Walmart no longer offers __________.","I find your lack of _____ disturbing.","How about a nice game of _______?","Everything's better with ______ on it.","On the Internet, no one knows you're __________.","I enjoy being spanked with __________.","After I grew bored with internet porn, I could only masturbate to _____.","New from Ronco, the __________-O-Matic.","Are you really __________? Because that's hot!","I never thought I'd die by __________, but I always hoped I would.","My new favorite drink is called _________. It's better than it sounds.","This is fun and all, but it's not a real party until you're __________.","Only you can prevent __________!","__________ makes the world go round.","On a scale of one to __________, how would you rate your pain?","You guys, you can buy __________ on the dark web.","I’m just gonna stay in tonight. You know, Netflix and __________.","You can’t wait forever. It’s time to talk to your doctor about ________.","You say tomato, I say __________.","America is hungry. America needs _____.","Welcome to the jungle, we've got fun and __________.","Start off each morning with a cup of coffee and __________.","Danger? No, my middle name is __________.","It's the year of __________ on the Chinese zodiac!","Texting is fine, but I'd rather communicate the old-fashioned way by __________","My favorite TV channel is the one that shows programs about __________.","Stop staring at my ___________!","The road to success is paved with ____________.","Were off to see the Wizard! The wonderful wizard of _________!","Come with me, and you'll see, a world of pure __________.","Trust me, I'm __________.","If I had one wish, I would wish for __________."]; var whiteCardsList = ["Emmi's fine ass","tears of shame","assless chaps","butt stuff","whispering all sexy","running out of seamen","doing the right thing","sperm whales","full frontal nudity","friction","science","forces beyond our control","a sad handjob","10 incredible facts about the anus","finger painting","a cop who is also a dog","teaching a robot to love","butt sex","Emmi eating a popsicle","that ass","flying sex snakes","motorboating","gloryholes","hanging from the ceiling fan","sex toys","a bag of dildos","rubbing one out","spanking the monkey","road head","a dirty sanchez","doggy style","my Elmo costume","one titty hanging out","gangbanging clowns","getting my junk caught in my zipper","devious thoughts","hot cheese","half-assed foreplay","three months in the hole","inappropriate yodeling","masturbating in Wal-mart","$20 worth of weed","making a pouty face","getting the hiccups during oral","screaming orgasms","pickles","Emmi's nipples","deez nuts","sucking the chrome off a trailer hitch","a hockey stick","a sticky keyboard","spanking that ass with a fish","flashing people at the grocery store","nipple clamps","boobies","awkward erections","being naked in public","ball gags","stroking it","advanced masturbation techniques","twerking","sex toys from Home Depot","sexting","twerking to country music","ball sacks","bleaching your butthole","my collection of high tech sex toys","edible underpants","velcro underwear","dungeon porn","show tunes","my sex life","warm, velvety puppet sex","vibrators","a fleshlight","an erection that lasts four hours","getting naked and watching cartoons","topless river dancing","unlimited soup, salad, and breadsticks","a mouthful of potato salad","switching to Geico","not wearing pants","sexy pandas","dem titties","ejaculating live bees","wet dreams","a sex goblin with a carnival penis","five dollar footlongs","anal beads","jumpimg to conclusions","masturbation","funky fresh rhymes","extremely agressive masturbaton","permant orgasm face disorder","wearing glasses and trying to sound smart","waking up naked in a hotel parking lot","the clitoris","dry humping a pillow","vigorous jazz hands","balls","filling every orfice with pudding","tasteful sideboob","50,000 volts straight to the nipples","double penetration","shame & guilt","a sausage festival","actually taking candy from a baby","live sex shows","a 20 inch dildo shaped like a pecan pie","heavy duty jumper cables","pre-op trannies","the orgy at the BBQ","using jello as a lube","sucking jello through a straw","the munchies","celebrity-endorsed jumbo dildos","being tied up with licorice rope","safety straps","tube steak","public nudity","tentacle porn","Harry Potter erotica","Eating all of the cookies before the bake-sale.","Lockjaw.","dropping it like it's hot","All-you-can-eat shrimp for $4.99.","girl on girl action","large cheese pizzas","taco Tuesdays","8 hours of foreplay","fried pickles","naked Twister","zesty breakfast burritos","Naked News","binge watching internet porn","very fancy piggy banks","a 24 carat gold vibrator worth over $3000","studying for a prostate exam","throwing Monopoly money at strippers with fake tits","sex so good you put the binoculars down so you can masturbate","hotdog fried rice","a bunion fetish","internet porn analysis paralysis","a whole new kind of porn","clenched butt cheeks","at least three ducks","rock music and premarital sex","tossed salad and scrambled eggs","sexy fun time","lube as far as the eye can see","siamese twins joined at the penis","the nipple clamp challenge","rib flavoured ribbed condoms","scoring a perfectly good penis pump at a garage sale","memorizing 50 digits of pi","quietly trying to open a bag of chips during doggy style","just beat it, beat it, beat it","rim job","asexual predator","cream in my coffee","love muscle milk","using maple syrup as lube","using Christmas lights as anal beads","high heeled sneakers","boobies, just boobies","nuclear powered vibrators","Panic! At The Dildo","discount sex toys","the unkindest butt plug of all time","ass attacks","lube. Lots of lube","dildos, the original selfie stick","50 shades of hungry","stockpiles of lesbian porn","what The Rock was really cooking","spontaneous human combustion","sexual experimentation in college","belly button lint","watching pornography in public","55-gallon drums of lube","cowboys eating pudding","having sex with a bowl of jello","a herd of turtles","hiccups","an aggravatingly slow internet connection","haters that are gonna hate","simultaneously committing all seven deadly sins","80's hair bands that refuse to retire","boats and hoes!","wearing extra thin pants for a strip club lap dance","scratch and sniff panties","accidental sexting","forgetting the safe word","jiggle physics","liking big butts, and not being able to lie about it","a sex doll that just wants to be friends","wild bouncing boobs","burping the worm in the mole hole","cattle-prodding the oyster ditch with the lap rocket","cleaning the cobwebs with the womb broom","knockers","doing squat thrusts in the cucumber patch","playing a game of Mr. Wobbly hides his helmet","shooting the meat rocket into the sausage wallet","taking the bald-headed gnome for a stroll in the misty forest","slapping sloppies","hot pudding for supper","hardpore corn","goofy boots","snatchchat","Netflix and chill"]; // OK, let's roll! init();
© Copyright Chaturbate 2011- 2025. All Rights Reserved.