Apps Home
|
My Uploads
|
Create an App
razin bran
Author:
pokedex
Description
Source Code
Launch App
Current Users
Created by:
Pokedex
App Images
cb.settings_choices = [ { name: 'room_subject', label: 'Room Subject:', type: 'str', minLength: 1, maxLength: 255, defaultValue: "Welcome to Hazel's room!" }, { name: 'room_tags', label: 'Room Tags (seperate by a space)', type: 'str', minLength: 1, maxLength: 255, defaultValue: '#18 #anime #ass #shh #bigass #bigboobs #tall #tease #panties #glasses #pale #cbt #cei #curvy #creamy #cute #socks #dance #strip #dildo #hitachi #new #feet #goth' }, { name: 'setting_init', label: 'Choose your game:', type: 'choice', choice1: 'hang', choice2: 'lotto', defaultValue: 'lotto' }, { name: 'cost', label: 'Game Participation Cost (Minimum).', type: 'int', minValue: 1, maxValue: 1000, defaultValue: 10 }, { name: 'loss_msg', label: 'Message for players when they lose a lotto', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Sorry! :(' }, { name: 'loss_percent', label: 'How frequently players will lose? (Make this your highest number!) 1-9999', type: 'int', minValue: 1, maxValue: 9999, defaultValue: 50 }, { name: 'first_prize', label: 'First Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Prize A' }, { name: 'first_prize_percent', label: 'First Prize frequency: (Keep these prize percentages low) 1-9999', type: 'int', minValue: 1, maxValue: 9999, defaultValue: 50 }, { name: 'second_prize', label: 'Second Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: 'Prize B' }, { name: 'second_prize_percent', label: 'Second Prize frequency: (The lower the frequency the rarer the prize) 1-9999', type: 'int', minValue: 1, maxValue: 9999, defaultValue: 50 }, { name: 'third_prize', label: 'Third Prize frequency: (Keep prizes in a most-common to most-rare order for best results) 1-9999', type: 'str', minLength: 1, maxLength: 255, defaultValue: '', required: false }, { name: 'third_prize_percent', label: 'Third Prize%', type: 'int', minValue: 0, maxValue: 9999, required: false, defaultValue: 0 }, { name: 'fourth_prize', label: 'Fourth Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: '', required: false }, { name: 'fourth_prize_percent', label: 'Fourth Prize%', type: 'int', minValue: 0, maxValue: 9999, required: false, defaultValue: 0 }, { name: 'fourth_prize', label: 'Fourth Prize', type: 'str', minLength: 1, maxLength: 255, defaultValue: '', required: false }, { name: 'fourth_prize_percent', label: 'Fourth Prize%', type: 'int', minValue: 0, maxValue: 9999, required: false, defaultValue: 0 } ]; var prizes = [ { prize: cb.settings.first_prize, percent: cb.settings.first_prize_percent, data: 0 }, { prize: cb.settings.second_prize, percent: cb.settings.second_prize_percent, data: 0 }, { prize: cb.settings.third_prize, percent: cb.settings.third_prize_percent, data: 0 }, { prize: cb.settings.fourth_prize, percent: cb.settings.fourth_prize_percent, data: 0 }, { prize: cb.settings.loss_msg, percent: cb.settings.loss_percent, data: 0 } ]; var subject = cb.settings.room_subject + ' ' + cb.settings.room_tags var fontSize = 11; var latest_tipper = "No one!"; var latest_tip = 0; var lastPrize = "Nothing!"; var Games = { hang: { Name: "Hangman", Cost: cb.settings.cost, String: "Word: _ _ _ _ _ _", Data: "Guessed: a e l r", Message: "Latest Tip & Next Prize:", Background: 'c84d98f2-1b1e-4aad-8d2f-41b0fa50aff0', play: function(tip) { finalize(tip); }, }, lotto: { Name: "Lucky Lotto!", Cost: cb.settings.cost, String: "No Drawings", Data: "Odds: 0%", Message: "No Tippers Yet!", Background: '62fef833-9c71-4d15-b5fc-b429891787e2', play: function(tip) { var i = tip.amount; Messenger.sendInfoMessage("===" + tip.from_user + "'s lotto ticket: ==="); while (i >= cb.settings.cost) { var lotto = lottoPrize(); this.String = "Drawing #: " + lotto.random; this.Data = "Odds: " + lotto.percent + "%"; Messenger.sendInfoMessage("| " + this.String + " - | Prize: " + lastPrize + " |"); i = i - cb.settings.cost; } Messenger.sendInfoMessage("===" + tip.from_user + "'s lotto ticket: ==="); finalize(tip); this.Message = "Player: " + latest_tipper + "(" + latest_tip + ")"; }, }, } function defaultMatrix(size) { var defaultValue = 0; var row = []; var matrix = []; for (var i=0; i < size; i++) { row.push(defaultValue); } for (var i=0; i < size; i++) { matrix.push(row); } return matrix; } cb.onTip(function(tip) { if (msg.m.substring(0, 4) === "lotto") { lotto.play(tip); } if (msg.m.substring(0, 4) === "hang") { cb.settings.setting_init = "hang"; cb.drawPanel(); } }); function finalize(tip) { latest_tipper = tip.from_user; latest_tip = tip.amount; cb.drawPanel(); } cb.onTip(function(tip) { if (tip.amount >= cb.settings.cost) { Games[cb.settings.setting_init].play(tip); } }); function init() { //Messenger.sendSuccessMessage("Hazel-Bot has started.", null); cb.changeRoomSubject(subject); cb.drawPanel(); } function shuffle(array) { //Set Variables var currentIndex = array.length, temporaryValue, randomIndex; //While there remain elements to shuffle... while (0 !== currentIndex) { //Pick a remaining element... randomIndex = Math.floor(Math.random() * currentIndex); currentIndex -= 1; //And swap it with the current element. temporaryValue = array[currentIndex]; array[currentIndex] = array[randomIndex]; array[randomIndex] = temporaryValue; }; //end of WHILE [While there remain elements to shuffle...] //Return the array return array; }; Number.prototype.between = function(first, last) { return (first < last ? this >= first && this <= last : this >= last && this <= first); } function lottoPrize() { var percentTotal = 0; var odds = 0; shuffle(prizes); var numberArray = [0]; for (var i = 0; i < prizes.length; i++) { percentTotal += prizes[i].percent; numberArray.push(numberArray[i] += prizes[i].percent); }; var rnd = Math.floor(Math.random() * percentTotal); cb.log('Random number: ' + rnd + '\n Percent Total: ' + percentTotal); for (var i = 0; i < prizes.length - 1; i++) { if (rnd.between(numberArray[i], numberArray[i + 1])) { lastPrize = prizes[i].prize; odds = (prizes[i].percent / percentTotal) * 100; break; } }; return { random: rnd, percent: odds }; }; var Groups = { TokenHolders: 'cyan', Tippers: 'blue', Fans: 'green', Moderators: 'red', }; var Colours = { AliceBlue: "#F0F8FF", AntiqueWhite: "#FAEBD7", Aqua: "#00FFFF", Aquamarine: "#7FFFD4", Azure: "#F0FFFF", Beige: "#F5F5DC", Bisque: "#FFE4C4", Black: "#000000", BlanchedAlmond: "#FFEBCD", Blue: "#0000FF", BlueViolet: "#8A2BE2", Brown: "#A52A2A", BurlyWood: "#DEB887", CadetBlue: "#5F9EA0", Chartreuse: "#7FFF00", Chocolate: "#D2691E", Coral: "#FF7F50", CornflowerBlue: "#6495ED", Cornsilk: "#FFF8DC", Crimson: "#DC143C", Cyan: "#00FFFF", DarkBlue: "#00008B", DarkCyan: "#008B8B", DarkGoldenRod: "#B8860B", DarkGrey: "#A9A9A9", DarkGreen: "#006400", DarkKhaki: "#BDB76B", DarkMagenta: "#8B008B", DarkOliveGreen: "#556B2F", DarkOrange: "#FF8C00", DarkOrchid: "#9932CC", DarkRed: "#8B0000", DarkSalmon: "#E9967A", DarkSeaGreen: "#8FBC8F", DarkSlateBlue: "#483D8B", DarkSlateGrey: "#2F4F4F", DarkTurquoise: "#00CED1", DarkViolet: "#9400D3", DeepPink: "#FF1493", DeepSkyBlue: "#00BFFF", DimGrey: "#696969", DodgerBlue: "#1E90FF", FireBrick: "#B22222", FloralWhite: "#FFFAF0", ForestGreen: "#228B22", Fuschia: "#FF00FF", Gainsboro: "#DCDCDC", GhostWhite: "#F8F8FF", Gold: "#FFD700", GoldenRod: "#DAA520", Grey: "#808080", Green: "#008000", GreenYellow: "#ADFF2F", HoneyDew: "#F0FFF0", HotPink: "#FF69B4", IndianRed: "#CD5C5C", Indigo: "#4B0082", Ivory: "#FFFFF0", Khaki: "#F0E68C", Lavender: "#E6E6FA", LavenderBlush: "#FFF0F5", LawnGreen: "#7CFC00", LemonChiffon: "#FFFACD", LightBlue: "#ADD8E6", LightCoral: "#F08080", LightCyan: "#E0FFFF", LightGoldenRodYellow: "#FAFAD2", LightGrey: "#D3D3D3", LightGreen: "#90EE90", LightPink: "#FFB6C1", LightSalmon: "#FFA07A", LightSeaGreen: "#20B2AA", LightSkyBlue: "#87CEFA", LightSlateGrey: "#778899", LightSteelBlue: "#B0C4DE", LightYellow: "#FFFFE0", Lime: "#00FF00", LimeGreen: "#32CD32", Linen: "#FAF0E6", Magenta: "#FF00FF", Maroon: "#800000", MediumAquaMarine: "#66CDAA", MediumBlue: "#0000CD", MediumOrchid: "#BA55D3", MediumPurple: "#9370DB", MediumSeaGreen: "#3CB371", MediumSlateBlue: "#7B68EE", MediumSpringGreen: "#00FA9A", MediumTurquoise: "#48D1CC", MediumVioletRed: "#C71585", MidnightBlue: "#191970", MintCream: "#F5FFFA", MistyRose: "#FFE4E1", Moccasin: "#FFE4B5", NavajoWhite: "#FFDEAD", Navy: "#000080", OldLace: "#FDF5E6", Olive: "#808000", OliveDrab: "#6B8E23", Orange: "#FFA500", OrangeRed: "#FF4500", Orchid: "#DA70D6", PaleGoldenRod: "#EEE8AA", PaleGreen: "#98FB98", PaleTurquoise: "#AFEEEE", PaleVioletRed: "#DB7093", PapayaWhip: "#FFEFD5", PeachPuff: "#FFDAB9", Peru: "#CD853F", Pink: "#FFC0CB", Plum: "#DDA0DD", PowderBlue: "#B0E0E6", Purple: "#800080", Red: "#FF0000", RosyBrown: "#BC8F8F", RoyalBlue: "#4169E1", SaddleBrown: "#8B4513", Salmon: "#FA8072", SandyBrown: "#F4A460", SeaGreen: "#2E8B57", SeaShell: "#FFF5EE", Sienna: "#A0522D", Silver: "#C0C0C0", SkyBlue: "#87CEEB", SlateBlue: "#6A5ACD", SlateGrey: "#708090", Snow: "#FFFAFA", SpringGreen: "#00FF7F", SteelBlue: "#4682B4", Tan: "#D2B48C", Teal: "#008080", Thistle: "#D8BFD8", Tomato: "#FF6347", Turquoise: "#40E0D0", Violet: "#EE82EE", Wheat: "#F5DEB3", White: "#FFFFFF", WhiteSmoke: "#F5F5F5", Yellow: "#FFFF00", YellowGreen: "#9ACD32" }; var Messenger = { sendBroadcasterNotice: function(str) { // <- This is a Pokedex added feature, please do not use this elsewhere ~Asudem cb.sendNotice("[Dev Notice]: " + str, cb.room_slug, "#ffff66", "#9216ff", 'bolder', null); }, sendModeratorNotice: function(str) { this.sendGenericMessage(str, Colours.Blue, null, cb.room_slug, Groups.Moderators); }, sendErrorMessage: function(str, recipient, group) { this.sendGenericMessage(str, Colours.Red, null, recipient, group); }, sendWarningMessage: function(str, recipient, group) { this.sendGenericMessage(str, Colours.Orange, null, recipient, group); }, sendSuccessMessage: function(str, recipient, group) { this.sendGenericMessage(str, Colours.DarkGreen, null, recipient, group); }, sendInfoMessage: function(str, recipient, group) { this.sendGenericMessage(str, Colours.Black, null, recipient, group); }, sendGenericMessage: function(str, colour, background, recipient, group) { if (recipient != null && group != null) { cb.sendNotice(str, null, background, colour, 'bold', group); cb.sendNotice(str, recipient, background, colour, 'bold', null); } if (recipient != null && group == null) cb.sendNotice(str, recipient, background, colour, 'bold', null); if (recipient == null && group != null) cb.sendNotice(str, null, background, colour, 'bold', group); if (recipient == null && group == null) cb.sendNotice(str, null, background, colour, 'bold', null); }, }; cb.onMessage(function(msg) { if (msg.user == cb.room_slug) { Games.lotto.play(); } }); var leftColColor = '#0a2756'; var rightColColor = '#0a2756' cb.onDrawPanel(function(user) { var setting_init = cb.settings.setting_init; return { "template": "image_template", "layers": [ { 'type': 'image', 'fileID': Games[setting_init].Background }, { 'type': 'text', 'text': "Let's Play: " + Games[setting_init].Name, 'top': 5, 'left': 21, 'font-size': fontSize, 'color': leftColColor, }, { 'type': 'text', 'text': "Tip " + Games[setting_init].Cost + " tokens to Play!", 'top': 29, 'left': 21, 'font-size': fontSize, 'color': leftColColor, }, { 'type': 'text', 'text': Games[setting_init].Message, 'top': 52, 'left': 21, 'font-size': fontSize, 'color': leftColColor, }, { 'type': 'text', 'text': Games[setting_init].String, 'top': 5, 'left': 147, 'font-size': fontSize, 'color': rightColColor, }, { 'type': 'text', 'text': Games[setting_init].Data, 'top': 29, 'left': 147, 'font-size': fontSize, 'color': rightColColor, }, { 'type': 'text', 'text': "Prize: " + lastPrize, 'top': 51, 'left': 147, 'font-size': fontSize, 'color': rightColColor, }, ], }; }); //Change conditional if statement if required if (true) { init(); }
© Copyright Chaturbate 2011- 2025. All Rights Reserved.