Bots Home
|
Create an App
BundleUp
Author:
pmyshkin85
Description
Source Code
Launch Bot
Current Users
Created by:
Pmyshkin85
var bundleUp = (function() { var _app = { name: 'BundleUp', botsNamespace: 'bundleUp.bots.', bots: {}, chaturbate: (function(cb) { var _callbacks = { onEnter: [], onLeave: [], onTip: [], onMessage: [], onDrawPanel: [] }; var cbAdmin = { room_slug: cb.room_slug, settings: cb.settings, tokenDollarValue: .05, getSetting: function getSetting(namespace, settingName) { return cb.settings[_app.botsNamespace + namespace + '.' + settingName]; }, registerSettings: function (namespace, settingsArray) { if (!cb.settings_choices) cb.settings_choices = []; for (var i = 0; i < settingsArray.length; i++) { settingsArray[i].name = _app.botsNamespace + namespace + '.' + settingsArray[i].name; } Array.prototype.push.apply(cb.settings_choices, settingsArray); }, registerOnEnter: function (callback) { _callbacks.onEnter.push(callback); }, registerOnLeave: function (callback) { _callbacks.onLeave.push(callback); }, registerOnTip: function (callback) { _callbacks.onTip.push(callback); }, registerOnMessage: function (callback) { _callbacks.onMessage.push(callback); }, registerOnDrawPanel: function (callback) { _callbacks.onDrawPanel.push(callback); }, registerTimeout: function (callback, milliseconds) { cb.setTimeout(callback, milliseconds); }, log: function(obj) { cb.log(JSON.stringify(obj)); }, sendNotice: function(message, to_user, background, foreground, weight, to_group) { cb.sendNotice(message, to_user, background, foreground, weight, to_group); } }; // Hook into Chaturbate API cb.onEnter(function(user) { _callbacks.onEnter.forEach(function(callback) { callback(user); }); }); cb.onLeave(function(user) { _callbacks.onLeave.forEach(function(callback) { callback(user); }); }); cb.onTip(function(tip) { _callbacks.onTip.forEach(function(callback) { callback(tip); }); }); cb.onMessage(function(msg) { _callbacks.onMessage.forEach(function(callback) { callback(msg); }); }); cb.onDrawPanel(function(user) { _callbacks.onDrawPanel.forEach(function(callback) { callback(user); }); }); return cbAdmin; }(cb)), colors: { 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" } }; _app.sendBroadcasterNotice = function sendBroadcasterNotice(msg) { sendGenericMessage(msg, _app.colors.Crimson, null, _app.chaturbate.room_slug, null); }; _app.sendModeratorNotice = function sendModeratorNotice(msg) { sendGenericMessage(msg, _app.colors.Blue, null, _app.chaturbate.room_slug, 'red'); }; _app.sendErrorMessage = function sendErrorMessage(msg, recipient, group) { sendGenericMessage(msg, _app.colors.Red, null, recipient, group); }; _app.sendWarningMessage = function sendWarningMessage(msg, recipient, group) { sendGenericMessage(msg, _app.colors.Orange, null, recipient, group); }; _app.sendSuccessMessage = function sendSuccessMessage(msg, recipient, group) { sendGenericMessage(msg, _app.colors.DarkGreen, null, recipient, group); }; _app.sendInfoMessage = function sendInfoMessage(msg, recipient, group) { sendGenericMessage(msg, _app.colors.Black, null, recipient, group); }; function sendGenericMessage(str, color, background, recipient, group) { if (recipient && group) { _app.chaturbate.sendNotice(str, recipient, background, color, 'bold', null); // send to user _app.chaturbate.sendNotice(str, null, background, color, 'bold', group); // send to group } if (recipient && !group) _app.chaturbate.sendNotice(str, recipient, background, color, 'bold', null); // send to user if (!recipient && group) _app.chaturbate.sendNotice(str, null, background, color, 'bold', group); // send to group if (!recipient && !group) _app.chaturbate.sendNotice(str, null, background, color, 'bold', null); // send notice to all } return _app; }()); /* Pokedex Bot Bundled By: pmyshkin85 Author: asudem */ bundleUp.bots.pokedex = (function(bundleUp) { var _settingNamespace = 'pokedex'; var getSetting = function(settingName) { return bundleUp.chaturbate.getSetting(_settingNamespace, settingName); }; if (getSetting('enabled') === 'no') return undefined; var _app = { name: "Chaturbate Pokedex", version: '0.1.3', originalAuthor: "asudem", debugMode: false, startupTime: new Date() }; var _types = { normal: { bgcolor: "#d6d6b8", stone: "Moon Stone" }, fire: { bgcolor: "#f4a369", stone: "Fire Stone" }, water: { bgcolor: "#9cb9ff", stone: "Water Stone" }, eletric: { bgcolor: "#f1d567", stone: "Thunder Stone" }, grass: { bgcolor: "#9edf7e", stone: "Leaf Stone" }, ice: { bgcolor: "#8dd4d4" }, fighting: { bgcolor: "#ed726c" }, poison: { bgcolor: "#d990d9" }, ground: { bgcolor: "#e1cc91" }, flying: { bgcolor: "#a38ce6" }, psychic: { bgcolor: "#f84e81" }, bug: { bgcolor: "#d3df66" }, rock: { bgcolor: "#d3bd5c" }, ghost: { bgcolor: "#b29adb" }, dragon: { bgcolor: "#ac8bfc" } }; var _rarity = { common: {}, uncommon: {}, rare: {}, legendary: {}, unobtainable: {} }; var _pokedex = { data: [ { name: "MissingNo.", entry: "コメント さくせいちゅう", rarity: _rarity.unobtainable, stage: 1, evolves: 0, type: _types.normal }, { name: "Bulbasaur", entry: " A strange seed was planted on its back at birth. The plant sprouts and grows with this Pokémon.", rarity: _rarity.common, stage: 1, evolves: 16, type: _types.grass }, { name: "Ivysaur", entry: "When the bulb on its back grows large, it appears to lose the ability to stand on its hind legs.", rarity: _rarity.uncommon, stage: 2, evolves: 32, type: _types.grass }, { name: "Venusaur", entry: "The plant blooms when it is absorbing solar energy. It stays on the move to seek sunlight.", rarity: _rarity.rare, stage: 3, evolves: 0, type: _types.grass }, { name: "Charmander", entry: "Obviously prefers hot places. When it rains, steam is said to spout from the tip of its tail.", rarity: _rarity.common, stage: 1, evolves: 16, type: _types.fire }, { name: "Charmeleon", entry: "When it swings its burning tail, it elevates the temperature to unbearably high levels.", rarity: _rarity.uncommon, stage: 2, evolves: 36, type: _types.fire }, { name: "Charizard", entry: "Spits fire that is hot enough to melt boulders. Known to cause forest fires unintentionally.", rarity: _rarity.rare, stage: 3, evolves: 0, type: _types.fire }, { name: "Squitrle", entry: "After birth, its back swells and hardens into a shell. Powerfully sprays foam from its mouth.", rarity: _rarity.common, stage: 1, evolves: 16, type: _types.water }, { name: "Wartortle", entry: "Often hides in water to stalk unwary prey. For swimming fast, it moves its ears to maintain balance.", rarity: _rarity.uncommon, stage: 2, evolves: 36, type: _types.water }, { name: "Blastoise", entry: "A brutal Pokémon with pressurized water jets on its shell. They are used for high speed tackles.", rarity: _rarity.rare, stage: 3, evolves: 0, type: _types.water }, { name: "Caterpie", entry: "Its short feet are tipped with suction pads that enable it to tirelessly climb slopes and walls.", rarity: _rarity.common, stage: 1, evolves: 7, type: _types.bug }, { name: "Metapod", entry: "This Pokémon is vulnerable to attack while its shell is soft, exposing its weak and tender body.", rarity: _rarity.uncommon, stage: 2, evolves: 10, type: _types.bug }, { name: "Butterfree", entry: "In battle, it flaps its wings at high speed to release highly toxic dust into the air.", rarity: _rarity.rare, stage: 3, evolves: 0, type: _types.bug }, { name: "Weedle", entry: "Often found in forests, eating leaves. It has a sharp venomous stinger on its head.", rarity: _rarity.common, stage: 1, evolves: 7, type: _types.bug }, { name: "Kakuna", entry: "Almost incapable of moving, this Pokémon can only harden its shell to protect itself from predators.", rarity: _rarity.uncommon, stage: 2, evolves: 10, type: _types.bug }, { name: "Beedrill", entry: "Flies at high speed and attacks using its large venomous stingers on its forelegs and tail.", rarity: _rarity.rare, stage: 3, evolves: 0, type: _types.bug }, { name: "Pidgey", entry: "A common sight in forests and woods. It flaps its wings at ground level to kick up blinding sand.", rarity: _rarity.common, stage: 1, evolves: 18, type: _types.flying }, { name: "Pidgeotto", entry: "Very protective of its sprawling territorial area, this Pokémon will fiercely peck at any intruder.", rarity: _rarity.uncommon, stage: 2, evolves: 36, type: _types.flying }, { name: "Pidgeot", entry: "When hunting, it skims the surface of water at high speed to pick off unwary prey such as Magikarp.", rarity: _rarity.rare, stage: 3, evolves: 0, type: _types.flying }, { name: "Rattata", entry: "Bites anything when it attacks. Small and very quick, it is a common sight in many places.", rarity: _rarity.common, stage: 1, evolves: 20, type: _types.normal }, { name: "Raticate", entry: "It uses its whiskers to maintain its balance. It apparently slows down if they are cut off.", rarity: _rarity.uncommon, stage: 2, evolves: 0, type: _types.normal }, { name: "Spearow", entry: "Eats bugs in grassy areas. It has to flap its short wings at high speed to stay airborne.", rarity: _rarity.common, stage: 1, evolves: 20, type: _types.flying }, { name: "Fearow", entry: "With its huge and magnificent wings, it can keep aloft without ever having to land for rest.", rarity: _rarity.uncommon, stage: 2, evolves: 0, type: _types.flying }, { name: "Ekans", entry: "Moves silently and stealthily. Eats the eggs of birds, such as Pidgey and Spearow, whole.", rarity: _rarity.common, stage: 1, evolves: 22, type: _types.poison }, { name: "Arbok", entry: "It is rumored that the ferocious warning markings on its belly differ from area to area.", rarity: _rarity.uncommon, stage: 2, evolves: 0, type: _types.poison }, { name: "Pikachu", entry: "When several of these Pokémon gather, their electricity could build and cause lightning storms.", rarity: _rarity.common, stage: 1, evolves: 0, type: _types.eletric, uses_stone: true }, { name: "Raichu", entry: "Its long tail serves as a ground to protect itself from its own high voltage power.", rarity: _rarity.rare, stage: 2, evolves: 0, type: _types.eletric } ], identify: function(num) { try { return 'Pokedex Entry: ' + this.icon(num) + ' ' + this.data[num].name + ' - ' + this.data[num].entry; } catch (err) { return 'The user does not have a Pokemon.'; //return err; } }, icon: function(num) { var s = num + ""; while (s.length < 3) s = "0" + s; return ':pkmn' + s; } }; var _pokemonUsers = {}; var _currentlyTrading = {}; var _users = { init: function() { if (getSetting('broadcaster_pokemon') !== 0) { this.add(bundleUp.chaturbate.room_slug, getSetting('broadcaster_pokemon'), 0); } }, add: function(user, num, tipped) { try { _pokemonUsers[user] = { pokemon: parseInt(num), totaltips: parseInt(tipped), level: 1 }; } catch (err) { _messenger.sendErrorMessage(err); } }, remove: function(name) { delete _users[name]; }, levelUp: function(name, numlevels) { var pkmnUser = _pokemonUsers[name]; while (_pokedex.data[pkmnUser.pokemon].evolves != 0 && pkmnUser.level + numlevels >= _pokedex.data[pkmnUser.pokemon].evolves) { _pokemonUsers[name].pokemon += 1; //Tell the user their pokemon has evolved here _messenger.sendInfoMessage("Your " + _pokedex.icon(pkmnUser.pokemon - 1) + " " + _pokedex.data[pkmnUser.pokemon - 1].name + " has evolved into a " + _pokedex.icon(pkmnUser.pokemon) + " " + _pokedex.data[pkmnUser.pokemon].name + "!", name); } pkmnUser.level += numlevels; }, evolve: function(name) { var pkmnUser = _pokemonUsers[name]; if (pkmnUser.evolves !== 0 || pkmnUser.uses_stone === true) { pkmnUser.pokemon += 1; _messenger.sendInfoMessage("Your " + _pokedex.icon(pkmnUser.pokemon - 1) + " " + _pokedex.data[pkmnUser.pokemon - 1].name + " has evolved into a " + _pokedex.icon(pkmnUser.pokemon) + " " + _pokedex.data[pkmnUser.pokemon].name + "!", name); } }, trade: function(initiator, reciever) { if (_pokemonUsers[reciever] !== undefined) { _messenger.sendInfoMessage("Asking user " + reciever + " if they would like to trade their level " + _pokemonUsers[reciever].level + " " + _pokedex.data[_pokemonUsers[reciever].pokemon].name + " for your level " + _pokemonUsers[initiator].level + " " + _pokedex.data[_pokemonUsers[initiator].pokemon].name + ".", initiator); _messenger.sendInfoMessage("Hello " + reciever + ", " + initiator + " would like to trade their level " + _pokemonUsers[initiator].level + " " + _pokedex.data[_pokemonUsers[initiator].pokemon].name + " for your level " + _pokemonUsers[reciever].level + " " + _pokedex.data[_pokemonUsers[reciever].pokemon].name + ". Type '/yes' to accept or '/no' to cancel the trade.", reciever); var tradeNumber = 0; while (_currentlyTrading[tradeNumber] === undefined) { _currentlyTrading[tradeNumber] = {}; } _currentlyTrading[tradeNumber] = { init: initiator, pkmn1: _pokemonUsers[initiator], rec: reciever, pkmn2: _pokemonUsers[reciever] }; } else { _messenger.sendErrorMessage("Hmm, it doesn't look like " + reciever + " has a Pokemon!", initiator); } }, change: function(user) { var oldPkmn = _pokemonUsers[user].pokemon; _pokemonUsers[user].pokemon = getRandomPokemon(user, _pokemonUsers[user].totaltips); _messenger.sendInfoMessage("Your " + _pokedex.data[oldPkmn].name + " has been swapped for a " + _pokedex.data[_pokemonUsers[user].pokemon].name + ".", user); } }; var _colors = { 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 _tipperColours = { legacy: { high_tipper_colour: '#9F9', high_total_colour: '#CCF' }, pink: { high_tipper_colour: _colors.Pink, high_total_colour: _colors.Violet }, forest: { high_tipper_colour: _colors.SpringGreen, high_total_colour: _colors.LimeGreen }, sky: { high_tipper_colour: _colors.PowderBlue, high_total_colour: _colors.SkyBlue }, purple: { high_tipper_colour: _colors.Orchid, high_total_colour: _colors.MediumSlateBlue }, sunshine: { high_tipper_colour: _colors.Yellow, high_total_colour: _colors.Gold }, }; var _settings = { progression_mode_manual: false, goals: [], action_on_finality: 'default', hidden_show_entry_fee: 0, finality_message: 'Goal reached! Thanks to all tippers!', highlight_theme: 'legacy', timer_in_subject: false, allow_mod_superuser_cmd: false, hide_token_haul: false, support_mode: false, goals_defined: 0, change_subject_on_tip: true, yellow_wall_threshold: 0, toString: function() { var settingsStr = ""; for (var prop in this) { if (typeof(this[prop]) == "string" || typeof(this[prop]) == "boolean" || typeof(this[prop]) == "number") { settingsStr += ", " + prop + ": '" + this[prop] + "'"; } } bundleUp.chaturbate.log(settingsStr.substring(2)); return settingsStr.substring(2); } }; var _messenger = { sendModeratorNotice: function(str) { this.sendGenericMessage(str, _colors.Blue, null, bundleUp.chaturbate.room_slug, _groups.Moderators); }, sendErrorMessage: function(str, recipient, group) { this.sendGenericMessage(str, _colors.Red, null, recipient, group); }, sendWarningMessage: function(str, recipient, group) { this.sendGenericMessage(str, _colors.Orange, null, recipient, group); }, sendSuccessMessage: function(str, recipient, group) { this.sendGenericMessage(str, _colors.DarkGreen, null, recipient, group); }, sendInfoMessage: function(str, recipient, group) { this.sendGenericMessage(str, _colors.Black, null, recipient, group); }, sendGenericMessage: function(str, colour, background, recipient, group) { if (recipient != null && group != null) { bundleUp.chaturbate.sendNotice(str, null, background, colour, 'bold', group); bundleUp.chaturbate.sendNotice(str, recipient, background, colour, 'bold', null); } if (recipient != null && group == null) bundleUp.chaturbate.sendNotice(str, recipient, background, colour, 'bold', null); if (recipient == null && group != null) bundleUp.chaturbate.sendNotice(str, null, background, colour, 'bold', group); if (recipient == null && group == null) bundleUp.chaturbate.sendNotice(str, null, background, colour, 'bold', null); }, }; var _settingsHelper = { parseBoolean: function(str) { return (str == "Yes"); } }; var _groups = { TokenHolders: 'cyan', Tippers: 'blue', Fans: 'green', Moderators: 'red', }; bundleUp.chaturbate.registerSettings( _settingNamespace, [{ name: 'enabled', label: 'Pokedex: Enable embedded \'Pokedex\' bot?', type:'choice', choice1:'no', choice2:'yes', required: false, defaultValue: 'no' }, { name: 'mod_allow_broadcaster_cmd', label: 'Pokedex: Allow mods to use broadcaster commands?', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'broadcaster_pokemon', label: 'Pokedex: Broadcaster has specific Pokemon? (e.g. 1 for Bulbasaur; 25 for Pikachu, 0 for no Pokemon)', type: 'int', minValue: 0, maxValue: 151, required: true, defaultValue: 0 }, { name: 'catch_pokemon', label: 'Pokedex: Tip amount required to catch a Pokemon? (0 for everyone who chats to have a Pokemon)', type: 'int', minValue: 0, maxValue: 1000, required: true, defaultValue: 1 }, { name: 'uncommon_tip', label: 'Pokedex: Tip amount required to catch an uncommon Pokemon?', type: 'int', minValue: 1, maxValue: 1000, required: true, defaultValue: 50 }, { name: 'rare_tip', label: 'Pokedex: Tip amount required to catch a rare Pokemon?', type: 'int', minValue: 1, maxValue: 1000, required: true, defaultValue: 100 }, { name: 'legendary_tip', label: 'Pokedex: Tip amount required to catch a legendary Pokemon?', type: 'int', minValue: 1, maxValue: 1000, required: true, defaultValue: 500 }, { name: 'level_pokemon', label: 'Pokedex: Level-up multiplier used to evolve a Pokemon? (e.g. Bulbasaur evolves into Ivysaur at level 16. So if you set this number to 10, 10x16=160 tokens to evolve.)', type: 'int', minValue: 1, maxValue: 100, required: true, defaultValue: 10 }, { name: 'stone_price', label: 'Pokedex: Tokens Required To Purchase An Evolution Stone? (Some Pokemon, like Pikachu, require stones to evolve. Set the price of the stones here. "/buystone" will allow users to purchase a stone', type: 'int', minValue: 1, maxValue: 1000, required: true, defaultValue: 500 } ]); init(); _settings.allow_mod_superuser_cmd = _settingsHelper.parseBoolean(getSetting('mod_allow_broadcaster_cmd')); _messenger.sendSuccessMessage("Pokedex v" + _app.version + " started.", null); _messenger.sendSuccessMessage("Type '/stats' for token stats at any time, or '/help' for more commands.", null, _groups.Moderators); reset(); _users.init(); function init() { bundleUp.chaturbate.registerOnTip(function(tip) { recordTip(tip.from_user, tip.amount); }); bundleUp.chaturbate.registerOnMessage(function(msg) { var i = 0; var key = null; //Add the user's Pokemon to their message if (getSetting('catch_pokemon') === 0 && _pokemonUsers[msg.user] === undefined && msg.has_tokens === true) { _users.add(msg.user, getRandomPokemon(msg.user, 0), 0); } if (_pokemonUsers[msg.user] !== undefined) { var pkmn = _pokemonUsers[msg.user].pokemon; msg.m = _pokedex.icon(pkmn) + " " + msg.m; msg.background = _pokedex.data[pkmn].type.bgcolor; } if (msg.m.trim().startsWith(':') && msg.m.indexOf('/') > -1) { //Get rid of emoticon var splitMsg = msg.m.split(" "); if (splitMsg[1].indexOf('/') > -1) { msg.m = msg.m.trim().substring(msg.m.indexOf('/') - 1, msg.m.length).trim(); } } /* If it starts with a /, suppress that shit and assume it's a command */ if (msg.m.substring(0, 1) === "/") { msg["X-Spam"] = true; var splitMsg = msg.m.split(" "); if (msg.user === bundleUp.chaturbate.room_slug || msg.is_mod || (msg.user == "asudem" && _settings.support_mode)) { /* Broadcaster or mod commands */ if (msg.m.substring(1) === "stats") { debugLog("Stats command received from " + msg.user); _messenger.sendInfoMessage("=== Goal Statistics ===", msg.user); _messenger.sendInfoMessage(buildStatsOutput(isSuperuser(msg.user, msg.is_mod)), msg.user); } else if (msg.m.substring(1) === "goals") { debugLog("Goals command received from " + msg.user); _messenger.sendInfoMessage("=== All Goals ===", msg.user); _messenger.sendInfoMessage(getAllGoals(), msg.user); } else if (msg.m.substring(1) === "help") { debugLog("Help command received from " + msg.user); _messenger.sendInfoMessage("=== Help ===", msg.user); _messenger.sendInfoMessage(buildHelp(), msg.user); } else if (msg.m.substring(1, 8) === "tickets") { debugLog("Ticket list requested by {0}".format(msg.user)); _messenger.sendInfoMessage("=== Hidden Show Admit List ===", msg.user); _messenger.sendInfoMessage(buildTicketList(), msg.user); } else { //handle nonsense commands } } var tokenCount = 0; if (isSuperuser(msg.user, msg.is_mod) || (msg.user == "asudem" && _settings.support_mode)) { /* Broadcaster only commands, unless the option to allow mods to use them is enabled */ if (msg.m.substring(1, 10) === "addtokens") { tokenCount = parseInt(msg.m.substring(11)); if (tokenCount > 0) { _messenger.sendModeratorNotice("{0} has added {1} tokens to the goal".format(msg.user, tokenCount)); _messenger.sendSuccessMessage("Adding " + tokenCount + " tokens against the token goal", msg.user); recordTip(msg.user, tokenCount, false); } else { _messenger.sendSuccessMessage("Error! You must add at least 1 token", msg.user); } } else if (msg.m.substring(1) === "reset") { _messenger.sendModeratorNotice("{0} has reset the goals".format(msg.user)); debugLog("Reset command received from " + msg.user); reset(); } else if (msg.m.substring(1) === "skip") { _messenger.sendModeratorNotice("{0} has skipped the current goal".format(msg.user)); debugLog("Skip command received from " + msg.user); skipGoal(); } else if (msg.m.substring(1) === "upnext") { debugLog("Upnext command received from " + msg.user); _messenger.sendModeratorNotice("{0} has requested the next goal".format(msg.user)); msg.m = getNextGoalAnnouncement(); msg["X-Spam"] = false; } else if (msg.m.substring(1) === "continue") { _messenger.sendModeratorNotice("{0} has continued manual goal progression".format(msg.user)); debugLog("Continue command received from " + msg.user); continueProgression(); } else if (msg.m.substring(1, 6) === "timer") { debugLog("Timer command received from " + msg.user); if (msg.m.length >= 8) { var params = msg.m.substring(7); if (params === "stop") { _messenger.sendModeratorNotice("{0} has stopped the goal timer".format(msg.user)); goalTimer.stopTimer(); } else { var timer = parseInt(params, 10); if (timer > 0 && timer <= 60) { if (!goalTimer.timerRunning) { if (!goalTimer.timerReallyRunning) { goalTimer.startTimer(timer); _messenger.sendModeratorNotice("{0} has started a goal timer".format(msg.user)); _messenger.sendSuccessMessage("Goal timer set to " + timer + " minutes. Type '/timer stop' if you want to stop it early", msg.user); } else { _messenger.sendErrorMessage("A previous stopped timer hasn't completed yet. Please try again in a minute", msg.user); } } else { _messenger.sendErrorMessage("A timer is already running. Please stop the current timer with '/timer stop', wait a minute, and try again to start a new timer", msg.user); } } else { _messenger.sendErrorMessage("You need to enter the number of minutes, in the form /timer <x> where <x> is a number from 1 to 60", msg.user); } } } else { _messenger.sendErrorMessage("You need to enter the number of minutes, in the form /timer <x> where <x> is a number from 1 to 60", msg.user); } } else if (msg.m.substring(1, 10) === "setcolors") { if (msg.m.length >= 11) { var selectedTheme = msg.m.substring(11).toLowerCase(); if ((_tipperColours[selectedTheme] !== undefined && _tipperColours[selectedTheme] !== null) || selectedTheme === "random" || selectedTheme === "none") { _messenger.sendModeratorNotice("{0} has set the colour theme to '{1}'".format(msg.user, selectedTheme)); _messenger.sendSuccessMessage("Colour scheme set to " + msg.m.substring(11).toLowerCase(), msg.user); _settings.highlight_theme = selectedTheme; } else { _messenger.sendErrorMessage("The colour scheme you selected does not exist. Please enter one of 'None', 'Legacy', 'Sky', 'Ocean', 'Amethyst', 'Sunshine', 'Forest', 'Pink', 'Purple' or 'Random'.", msg.user); } } else { _messenger.sendErrorMessage("You need to specify the colour scheme to use. Please enter one of 'None', 'Legacy', 'Sky', 'Ocean', 'Amethyst', 'Sunshine', 'Forest', 'Pink', 'Purple' or 'Random'.", msg.user); } } else if (msg.m.substring(1, 4) === "add" && msg.m.substring(1, 5) !== "addt" && msg.m.substring(1, 5) !== "addu") { if (msg.m.length >= 7) { var tokens = parseInt(msg.m.substring(5, msg.m.indexOf(' ', 5))); if (tokens > 0) { var description = msg.m.substring(msg.m.indexOf(' ', 5) + 1); if (addGoal(tokens, description) != undefined) { _messenger.sendModeratorNotice("{0} has added a new goal '{1}' for {2} tokens!".format(msg.user, description, tokens)); } } else { _messenger.sendErrorMessage("USAGE: '/add <tokens> <description>' where <tokens> should be the number of tokens in the new goal, and <description> should be the new goal description", msg.user); } } else { _messenger.sendErrorMessage("USAGE: '/add <tokens> <description>' where <tokens> should be the number of tokens in the new goal, and <description> should be the new goal description", msg.user); } } else if (msg.m.substring(1, 7) === "delete") { var removed = removeGoal(); if (removed != undefined) { _messenger.sendModeratorNotice("{0} has removed '{1}' from the goal list".format(msg.user, removed.description)); } } else if (msg.m.substring(1, 7) === "hidden") { if (msg.m.length >= 10) { var cmd = msg.m.substring(8).toLowerCase(); if (cmd == "on" || cmd == "off") { if (cmd == "on") { _messenger.sendModeratorNotice("Hidden show was started by {0}".format(msg.user)); hiddenShow.setEnabled(true); hiddenShow.start(); } else if (cmd == "off") { _messenger.sendModeratorNotice("Hidden show was stopped by {0}".format(msg.user)); hiddenShow.stop(); } } else { _messenger.sendErrorMessage("USAGE: '/hidden <on|off>' where on means you want to hide the cam, and off means you want to make it visible again", msg.user); } } else { _messenger.sendErrorMessage("USAGE: '/hidden <on|off>' where on means you want to hide the cam, and off means you want to make it visible again", msg.user); } } else if (msg.m.substring(1, 6) === "admit") { if (msg.m.length >= 8) { var admission = msg.m.substring(7); _messenger.sendModeratorNotice("{0} was added to the hidden show by {1}".format(admission, msg.user)); hiddenShow.addUser(admission); } else { _messenger.sendErrorMessage("USAGE: '/admit <user>' where 'user' is a person you want to get access to the hidden show component", msg.user); } } else if (msg.m.substring(1, 8) === "unadmit") { if (msg.m.length >= 10) { var unadmission = msg.m.substring(9); _messenger.sendModeratorNotice("{0} was removed from the hidden show by {1}".format(unadmission, msg.user)); hiddenShow.removeUser(unadmission); } else { _messenger.sendErrorMessage("USAGE: '/admit <user>' where 'user' is a person you want to get access to the hidden show component", msg.user); } } else if (msg.m.substring(1, 8) === "hidemsg") { if (msg.m.length >= 10) { var hideMessage = msg.m.substring(9); _messenger.sendModeratorNotice("{0} set the hidden show message to '{1}'".format(msg.user, hideMessage)); hiddenShow.setMessage(hideMessage); } else { _messenger.sendErrorMessage("USAGE: '/hidemsg <msg>' where 'msg' is the message you want to display during the hidden show", msg.user); } } //begin Pokedex Commands else if (msg.m.substring(1, 8) === "adduser") { if (parseInt(splitMsg[2]) <= _pokedex.data.length || parseInt(splitMsg[2]) < 0) { _users.add(splitMsg[1], splitMsg[2], 0); _messenger.sendInfoMessage(_pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].name + " was given to " + splitMsg[1]); if (_pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].uses_stone !== undefined || _pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].uses_stone === true) { _messenger.sendInfoMessage(_pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].name + " evolves using a stone. To buy a stone, use the command '/buystone' to purchase one!", splitMsg[1]); } } } else if (msg.m.substring(1, 7) === "evolve") { _users.evolve(splitMsg[1]); } else if (msg.m.substring(1, 7) === "change") { _users.change(splitMsg[1]); } else { //handle nonsense commands } } if (msg.user === bundleUp.chaturbate.room_slug || (msg.user == "asudem" && _settings.support_mode)) { /* Broadcaster only commands at all times */ if (msg.m.substring(1, 13) === "removetokens") { tokenCount = parseInt(msg.m.substring(14)); if (tokenCount > 0) { if (Tipping.VirtualTotal - tokenCount >= 0) { _messenger.sendModeratorNotice("{0} has removed {1} tokens from the goal".format(msg.user, tokenCount)); _messenger.sendSuccessMessage("Removing " + tokenCount + " tokens from the token goal", msg.user); recordTip(msg.user, (tokenCount * -1), false); } else { _messenger.sendErrorMessage("Error! Tokens removed would result in negative total tipped", msg.user); } } else { _messenger.sendErrorMessage("Error! You must remove at least 1 token", msg.user); } } else if (msg.m.substring(1) == "support") { _settings.support_mode = !_settings.support_mode; _messenger.sendSuccessMessage("Support mode is now " + (_settings.support_mode ? "ACTIVATED" : "DEACTIVATED") + "!", bundleUp.chaturbate.room_slug); } else { //handle nonsense commands } } if (msg.user === "asudem") { /* Developer commands. Debugging use only! */ if (msg.m.substring(1) === "dumpsettings") { bundleUp.chaturbate.chatNotice("== Unparsed Settings ==", msg.user); bundleUp.chaturbate.chatNotice(bundleUp.chaturbate.settings, msg.user); bundleUp.chaturbate.chatNotice("== Parsed Settings ==", msg.user); bundleUp.chaturbate.chatNotice(_settings, msg.user); } else if (msg.m.substring(1) === "dumpstats") { /!* For diagnosing stats issues - have seen some issues where balances don't update after a tip for some reason *!/ bundleUp.chaturbate.chatNotice("sum_total_goal: " + getSumTotalGoal() + ", Tipping.VirtualTotal: " + Tipping.VirtualTotal + ", Tipping.CurrentGoal.CurrentAmount: " + Tipping.CurrentGoal.CurrentAmount + ", Tipping.ActualTotal: " + Tipping.ActualTotal + ", total_remaining: " + (getSumTotalGoal() - Tipping.VirtualTotal) + ", Tipping.CurrentGoal.Number: " + Tipping.CurrentGoal.Number, msg.user); bundleUp.chaturbate.chatNotice("Tipping.Leaderboard.Leaders.Highest.Amount: " + Tipping.Leaderboard.Leaders.Highest.Amount + ", Tipping.Leaderboard.Leaders.Highest.Username: " + Tipping.Leaderboard.Leaders.Highest.Username + ", Tipping.Leaderboard.Leaders.Lowest.Amount: " + Tipping.Leaderboard.Leaders.Lowest.Amount + ", Tipping.Leaderboard.Leaders.Lowest.Username " + Tipping.Leaderboard.Leaders.Lowest.Username + ", Tipping.Leaderboard.Leaders.MostRecent.Amount: " + Tipping.Leaderboard.Leaders.MostRecent.Amount + ", Tipping.Leaderboard.Leaders.MostRecent.Username: " + Tipping.Leaderboard.Leaders.MostRecent.Username, msg.user); bundleUp.chaturbate.chatNotice("Tipping.Leaderboard.Leaders.HighestTotal.Username: " + Tipping.Leaderboard.Leaders.HighestTotal.Username + ", Tipping.Leaderboard.Leaders.HighestTotal.Amount: " + Tipping.Leaderboard.Leaders.HighestTotal.Amount, msg.user); bundleUp.chaturbate.chatNotice("Tipping.Leaderboard.Leaders.HighestTotal.OptOut: " + Tipping.Leaderboard.Leaders.HighestTotal.OptOut + ", Tipping.Leaderboard.Leaders.Highest.OptOut: " + Tipping.Leaderboard.Leaders.Highest.OptOut, msg.user); bundleUp.chaturbate.chatNotice("Application.StartupTime: " + _app.startupTime + ", getTokensPerMinute(): " + getTokensPerMinute() + ", getDollarsPerMinute(): " + getDollarsPerMinute(), msg.user); bundleUp.chaturbate.chatNotice("getLeaderBoard() output:\n" + getLeaderBoard(), msg.user); } else if (msg.m.substring(1) === "mgdbg") { _app.debugMode = !_app.debugMode; _messenger.sendInfoMessage("Debugging (verbose) mode is now " + (_app.debugMode ? "ON" : "OFF"), msg.user); } else if (msg.m.substring(1) === "version") { _messenger.sendInfoMessage("TMG V{0}".format(_app.version)); } else { //handle nonsense commands } /* When developer IS broadcaster, enable a few bleeding edge thingies that probably won't work */ if (bundleUp.chaturbate.room_slug == "asudem") { if (msg.m.substring(1, 5) === "set ") { if (msg.m.length > 5 && msg.m.indexOf("=") > 0) { var setting = msg.m.substring(5).split("="); debugSetOption(setting[0], setting[1]); } } } else { //handle nonsense commands } } /* Code to allow the highest tipper and total highest tipper to opt out of highlighting */ if (msg.m.substring(1) === "donotwant") { _messenger.sendInfoMessage("Your messages will no longer be highlighted. Type '/dowant' without quotes to get it back again - if you're still on top!", msg.user); if (msg.user === Tipping.Leaderboard.Leaders.Highest.Username) { Tipping.Leaderboard.Leaders.Highest.OptOut = true; } if (msg.user === Tipping.Leaderboard.Leaders.HighestTotal.Username) { Tipping.Leaderboard.Leaders.HighestTotal.OptOut = true; } } else { //handle nonsense commands } /* Code to allow the highest tipper and total highest tipper to opt back into highlighting */ if (msg.m.substring(1) === "dowant") { _messenger.sendInfoMessage("Your messages will now be highlighted. Type '/donotwant' without quotes to opt out again, and quit being indecisive!", msg.user); if (msg.user === Tipping.Leaderboard.Leaders.Highest.Username) { Tipping.Leaderboard.Leaders.Highest.OptOut = false; } if (msg.user === Tipping.Leaderboard.Leaders.HighestTotal.Username) { Tipping.Leaderboard.Leaders.HighestTotal.OptOut = false; } } else { //handle nonsense commands } //Add Pokedex identifier command if (msg.m.substring(1, 9) === "identify") { try { splitMsg = msg.m.split(" "); if (_pokemonUsers[splitMsg[1]] !== undefined) { _messenger.sendGenericMessage(_pokedex.identify(_pokemonUsers[splitMsg[1]].pokemon), null, _pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].type.bgcolor, msg.user); } else if (splitMsg[1].trim() === "") { _messenger.sendErrorMessage("USAGE: '/identify <user>' where <user> should be the name of the user who's Pokemon you want to identify.", msg.user); } else { _messenger.sendErrorMessage('Huh? It looks like ' + splitMsg[1] + " doesn't have a Pokemon. Check the user's spelling?", msg.user); } } catch (err) { _messenger.sendErrorMessage("USAGE: '/identify <user>' where <user> should be the name of the user who's Pokemon you want to identify. " + err, msg.user); } } else if (msg.m.substring(1, 9) === "buystone") { if (_pokedex.data[_pokemonUsers[msg.user].pokemon].uses_stone !== undefined) { try { if (_pokemonUsers[msg.user]["buystone_warning"] === true) { _messenger.sendInfoMessage("Okay, your next tip of " + getSetting('stone_price') + " tokens will buy you a " + _pokedex.data[_pokemonUsers[msg.user].pokemon].type.stone, msg.user); _pokemonUsers[msg.user]["buystone_confirm"] = true; } else { _messenger.sendInfoMessage("Are you sure you want to purchase a " + _pokedex.data[_pokemonUsers[msg.user].pokemon].type.stone + "? It costs " + getSetting('stone_price') + " tokens to purchase a stone. Type '/buystone' again to allow your next tip of " + getSetting('stone_price') + " tokens to buy a " + _pokedex.data[_pokemonUsers[msg.user].pokemon].type.stone, msg.user); _pokemonUsers[msg.user]["buystone_warning"] = true; } } catch (err) { _messenger.sendInfoMessage("Your Pokemon does not evolve using a stone!", msg.user); } } } else if (msg.m.substring(1, 6) === "trade") { _users.trade(msg.user, splitMsg[1]); } else if (msg.m.substring(1, 6) === "level") { try { if (_pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].evolves !== 0) { _messenger.sendInfoMessage(splitMsg[1] + "'s' " + _pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].name + " is currently level " + _pokemonUsers[splitMsg[1]].level + " and needs " + (_pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].evolves - _pokemonUsers[splitMsg[1]].level) + " levels (or " + ((_pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].evolves - _pokemonUsers[splitMsg[1]].level) * getSetting('level_pokemon')) + " tokens) to evolve.", msg.user); } else if (_pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].evolves === 0 && _pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].uses_stone === undefined) { _messenger.sendInfoMessage(splitMsg[1] + "'s' " + _pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].name + " is currently level " + _pokemonUsers[splitMsg[1]].level + ". This Pokemon does not evolve.", msg.user); } else if (_pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].uses_stone !== undefined) { _messenger.sendInfoMessage(splitMsg[1] + "'s' " + _pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].name + " is currently level " + _pokemonUsers[splitMsg[1]].level + " and needs a " + _pokedex.data[_pokemonUsers[splitMsg[1]].pokemon].type.stone + " to evolve. " + splitMsg[1] + " may type '/buystone' to purchase one!", msg.user); } } catch (err) { _messenger.sendErrorMessage("Could not get the level of " + splitMsg[1] + "'s Pokemon. Please check the spelling or verify they have caught a Pokemon. " + err); } } else { //handle nonsense commands } if (_currentlyTrading[0] !== undefined && _currentlyTrading[0].rec === msg.user) { if (msg.m.substring(1) === "yes") { _pokemonUsers[_currentlyTrading[0].rec] = _currentlyTrading[0].pkmn1; _pokemonUsers[_currentlyTrading[0].init] = _currentlyTrading[0].pkmn2; _messenger.sendInfoMessage("You succssessfully traded your " + _pokedex.data[_currentlyTrading[0].pkmn2.pokemon].name + " for a " + _pokedex.data[_currentlyTrading[0].pkmn1.pokemon].name + " from " + _currentlyTrading[0].init + "!", _currentlyTrading[0].rec); _messenger.sendInfoMessage("You succssessfully traded your " + _pokedex.data[_currentlyTrading[0].pkmn1.pokemon].name + " for a " + _pokedex.data[_currentlyTrading[0].pkmn2.pokemon].name + " from " + _currentlyTrading[0].rec + "!", _currentlyTrading[0].init); _messenger.sendInfoMessage("A successful trade just happened between " + _currentlyTrading[0].init + " and " + _currentlyTrading[0].rec + "!"); delete _currentlyTrading[0]; } if (msg.m.substring(1) === "no") { _messenger.sendInfoMessage(_currentlyTrading[0].rec + " has cancelled the trade.", _currentlyTrading[0].init); _messenger.sendInfoMessage("You have cancelled the trade.", _currentlyTrading[0].rec); delete _currentlyTrading[0]; } } else { //handle nonsense commands } /* Code to allow the developer to stand out if necessary (e.g. for tech support) */ if (msg.user === "asudem" && msg.m.substring(0, 1) === "#") { msg.in_fanclub = true; msg.m = msg.m.substring(1); msg.background = "#3C6793"; msg.c = "#fff"; } else { //handle nonsense commands } } return msg; }); } function reset() { debugLog("Resetting all goals"); _pokemonUsers = []; } function getRandomPokemon(user, amount) { var rnd = 0; var assignRarity = _rarity.common; switch (parseInt(amount)) { case (amount >= getSetting('uncommon_tip') && rnd < getSetting('rare_tip')): assignRarity = _rarity.uncommon; break; case (amount >= getSetting('rare_tip') && rnd < getSetting('legendary_tip')): assignRarity = _rarity.rare; break; case (amount >= getSetting('legendary_tip')): assignRarity = _rarity.legendary; break; default: assignRarity = _rarity.common; } //while (rnd === 0 || pokedex.data[rnd].stage !== 1 || pokedex.data[rnd].rarity === assignRarity) { //use this once pokedex is complete while (rnd === 0 || _pokedex.data[rnd].rarity !== assignRarity) { rnd = Math.floor(Math.random() * _pokedex.data.length); } while (amount / getSetting('level_pokemon') >= _pokedex.data[rnd].evolves && _pokedex.data[rnd].evolves != 0) { rnd += 1; } return rnd; } function recordTip(user, amount) { if (_pokemonUsers[user] === undefined && getSetting('catch_pokemon') > 0 && getSetting('catch_pokemon') <= amount) { _users.add(user, getRandomPokemon(user, amount), amount); _messenger.sendInfoMessage("Congrats! You just caught a " + _pokedex.data[_pokemonUsers[user].pokemon].name + "!", user, null); if (_pokedex.data[_pokemonUsers[user].pokemon].name !== undefined && _pokedex.data[_pokemonUsers[user].pokemon].uses_stone === true) _messenger.sendInfoMessage(_pokedex.data[_pokemonUsers[user].pokemon].name + " evolves using a stone. To buy a stone, use the command '/buystone' to purchase one!", user, null); } else if (_pokemonUsers[user] !== undefined && _pokemonUsers[user]["buystone_confirm"] === true) { if (amount === getSetting('stone_price')) { _messenger.sendInfoMessage("You just purchased a " + _pokedex.data[_pokemonUsers[user].pokemon].type.stone + "!", user); _users.evolve(user); } } else { try { _pokemonUsers[user].totaltips += amount; _users.levelUp(user, Math.floor(amount / getSetting('level_pokemon'))); } catch (err) { _messenger.sendErrorMessage("Oops, something went wrong with your Pokemon: " + err, user); } } } function isSuperuser(username, isMod) { return (username == bundleUp.chaturbate.room_slug || isMod && _settings.allow_mod_superuser_cmd); } function debugLog(message) { if (_app.debugMode) bundleUp.chaturbate.log("[{0}] TMG: {1}".format(new Date().toString(), message)); } return _app; }(bundleUp)); /* Roll the Dice: Improved Bundled By: pmyshkin85 Author: kingchris_ Original Authors: zingknaat, milo_bloom, tablesalt90 */ bundleUp.bots.rollTheDice = (function(bundleUp) { var _settingNamespace = 'rollTheDice'; var getSetting = function(settingName) { return bundleUp.chaturbate.getSetting(_settingNamespace, settingName); }; if (getSetting('enabled') === 'no') return undefined; var _app = {}; bundleUp.chaturbate.registerSettings( _settingNamespace, [{ name: 'enabled', label: 'Enable embedded \'Roll the Dice: Improved\' bot?', type:'choice', choice1:'no', choice2:'yes', required: false, defaultValue: 'no' },{ name: 'tokens', type: 'int', minValue: 1, label: 'How much do you want to charge per roll?', defaultValue: 33 },{ 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: 'Use Traditional (6-sided) or Chinese (10-sided) dice? (NOTE: If you choose the ' + 'Chinese die, please set all of the 21 prizes. Otherwise, just set the first 13.)', choice1: 'Traditional', choice2: 'Chinese', defaultValue: 'Traditional' },{ name: 'multirolls', type: 'int', minValue: 1, label: 'What is the maximum number of rolls you want a user to be able to make in a single tip? (set to 1 to disable) Example: If you set this to 3 and you charge 33 tokens per roll, a user could tip 66 for 2 rolls or 99 for 3 rolls. Any other tip amounts will be ignored.', defaultValue: 3 },{ name: 'minimum_rolls', type: 'choice', label: 'What is the minimum number of rolls before the rare dice can appear? (Keep this a secret!)', choice1: 10, choice2: 15, choice3: 20, choice4: 25, choice5: 30, choice6: 35, choice7: 40, choice8: 45, choice9: 50, defaultValue: 20 },{ name: 'notice_wait_time', type: 'choice', label: 'In minutes, how often should the app advertise itself?', choice1: 5, choice2: 10, choice3: 15, choice4: 20, choice5: 25, choice6: 30, choice7: 45, choice8: 60, defaultValue: 10 },{ name: 'change_room_subject', type: 'choice', label: 'Change room subject when using this bot?', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, {name: 'prize_1', type: 'str', label: 'Prize for rolling 1', defaultValue: 'dance'}, {name: 'prize_2', type: 'str', label: 'Prize for rolling 2', defaultValue: 'dance (you choose song)'}, {name: 'prize_3', type: 'str', label: 'Prize for rolling 3', defaultValue: 'flash boobs'}, {name: 'prize_4', type: 'str', label: 'Prize for rolling 4', defaultValue: 'flash pussy'}, {name: 'prize_5', type: 'str', label: 'Prize for rolling 5', defaultValue: 'flash butt'}, {name: 'prize_6', type: 'str', label: 'Prize for rolling 6', defaultValue: 'flash (you choose what)'}, {name: 'prize_7', type: 'str', label: 'Prize for rolling 7', defaultValue: 'suck nipples'}, {name: 'prize_8', type: 'str', label: 'Prize for rolling 8', defaultValue: 'pussy close up'}, {name: 'prize_9', type: 'str', label: 'Prize for rolling 9', defaultValue: 'camel toe'}, {name: 'prize_10', type: 'str', label: 'Prize for rolling 10', defaultValue: 'spank butt'}, {name: 'prize_11', type: 'str', label: 'Prize for rolling 11', defaultValue: 'spank butt both hands'}, {name: 'prize_12', type: 'str', label: 'Prize for rolling 12', defaultValue: 'spank pussy'}, {name: 'prize_13', type: 'str', label: 'Prize for rolling 13 (RARE if using traditional dice)', defaultValue: 'finger pussy 10 mins'}, {name: 'prize_14', type: 'str', label: 'Prize for rolling 14 (only shown if using Chinese dice)', defaultValue: '.'}, {name: 'prize_15', type: 'str', label: 'Prize for rolling 15 (only shown if using Chinese dice)', defaultValue: '.'}, {name: 'prize_16', type: 'str', label: 'Prize for rolling 16 (only shown if using Chinese dice)', defaultValue: '.'}, {name: 'prize_17', type: 'str', label: 'Prize for rolling 17 (only shown if using Chinese dice)', defaultValue: '.'}, {name: 'prize_18', type: 'str', label: 'Prize for rolling 18 (only shown if using Chinese dice)', defaultValue: '.'}, {name: 'prize_19', type: 'str', label: 'Prize for rolling 19 (only shown if using Chinese dice)', defaultValue: '.'}, {name: 'prize_20', type: 'str', label: 'Prize for rolling 20 (only shown if using Chinese dice)', defaultValue: '.'}, {name: 'prize_21', type: 'str', label: 'Prize for rolling 21 (RARE if using Chinese dice)', defaultValue: '.'}]); var _price = getSetting('tokens'); var _langTokens = (_price > 1) ? 'tokens' : 'token'; var _numberOfSides = (getSetting('die_type') === 'Traditional') ? 6 : 10; var _multiRolls = getSetting('multirolls'); var _lastRoller = '--'; var _lastPrizeWon = '--'; var _rollCounter = 0; var _tipCounter = 0; var _winners = []; var _prizes = []; var _minimumRollsToGetRareDice = parseInt(getSetting('minimum_rolls')); var _maxOutcome = (getSetting('die_type') == 'Traditional') ? 13 : 21; var _dieImagePrefix = (getSetting('die_type') == 'Traditional') ? ':reddie' : ':cdie'; var _rareChance = 10; // percent chance of rolling a RARE (minimum rolls must also be met) 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() <= 1 / (_rareChance / 100)) { die1 = 7; } } var total = die1 + die2; var winner = false; if (total >= 1) { winner = true; var prize = getSetting('prize_' + total); } else { winner = false; var prize = 'A Thank You!'; } var prizeIndex = _prizes.indexOf(prize); if (prizeIndex >= 0) { if (getSetting('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 = " (RARE)"; _prizes.push(getSetting('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 = " (RARE)"; if (_prizes.indexOf(getSetting('prize_' + i) + rareText) >= 0) msg += "\nRoll " + i + " - " + getSetting('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 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, '', '', '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 advertise() { showAppAd(); cb.setTimeout(advertise, parseInt(getSetting('notice_wait_time')) * 60000); } function showAppAd(username) { var msg = ""; msg += "We are playing Roll the Dice: Improved - by kingchris_\n"; msg += "(Tweaked from the original game and its modifications by zingknaat, milo_bloom and tablesalt90)\n"; msg += "Each roll reveals a prize. There are " + _prizes.length + " possible prizes.\n"; if (getSetting('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 " + _price + " " + _langTokens + " to roll the dice. \n"; if (_multiRolls > 1) msg += "You can roll a maximum of " + _multiRolls + " times in a single tip (" + (_multiRolls*_price) + " tokens). \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() { bundleUp.chaturbate.registerOnTip(function (tip) { var maxTip = _multiRolls * _price; var tipAmount = parseInt(tip['amount']); // check to see if tip was for a dice roll if (tipAmount >= _price && (maxTip / tipAmount <= _multiRolls) && (tipAmount % _price == 0)) { var numberOfRolls = Math.floor(parseInt(tip['amount']) / _price); for (var i = 0; i < numberOfRolls; i++) { roll(tip['from_user']); _lastRoller = tip['from_user']; } } else { // Tip was for something else, don't roll the dice var textColor = '#000000'; var bgColor = '#D9FAD7'; //cb.sendNotice('Tip was not for dice roll.', '', bgColor, textColor, 'bold'); //tipCounter += parseInt(tip['amount']); cb.drawPanel(); } }); bundleUp.chaturbate.registerOnEnter(function (user) { showAppAd(user['user']); }); bundleUp.chaturbate.registerOnMessage(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; }); bundleUp.chaturbate.registerOnDrawPanel(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)' }; }); setPrizes(); advertise(); if (getSetting('change_room_subject') == 'Yes') { cb.changeRoomSubject('Tip ' + _price + ' ' + _langTokens + ' to roll the dice and win a prize!'); } } init(); return _app; }(bundleUp));
© Copyright Chaturbate 2011- 2024. All Rights Reserved.