Bots Home
|
Create an App
PokeTest
Author:
avstestbed
Description
Source Code
Launch Bot
Current Users
Created by:
Avstestbed
var Application = { Name: "Chaturbate Pokedex", // The name of the application Version: 0.02, // The current version of the application Author: "ambersonata", // The author of this version. Don't change this unless you modified something! OriginalAuthor: "asudem", // The original author, I.E. me. If you change this, you're a cunt. It's not like it gets displayed anywhere Debug: false, // Whether the application is in debug (verbose) mode. StartupTime: null, // The time the application started up. Don't set this, it gets set at runtime LocalDebug: false, Constants: { }, SpecialThanks: [ { user: "mx2k6", reason: "Creating Tip Multi-Goal" }, { user: "bllueberrylove", reason: "Inspiring me to make this bot!" } ] }; var UserConstants = { //"buttonup": { pokemon: 25, totaltips: 0 }, init: function() { } }; 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: "Umbreon", entry: "On the night of a full moon, or when it gets excited, the ring patterns on its body glow yellow.", rarity: rarity.unobtainable, stage: 1, evolves: 0, type: types.ghost }, { 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; if (Application.LocalDebug == true) { return '<img src="pkmn' + s + '.gif">'; } return ':pkmn' + s; } }; var pokemonUsers = {}; var currentlyTrading = {}; var users = { init: function() { if (cb.settings.broadcaster_pokemon !== 0) { this.add(cb.room_slug, cb.settings.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); } }; //Credit http://stackoverflow.com/questions/921789/ function loopObjects(object) { for (var key in object) { if (!object.hasOwnProperty(key)) continue; var obj = object[key]; for (var prop in obj) { if (!obj.hasOwnProperty(key)) continue; cb.log(prop + " = " + obj[prop]); } } } if (cb == null) { var cb = { changeRoomSubject: function(new_subject) {}, drawPanel: function() {}, log: function(message) {}, onDrawPanel: function(func) {}, onEnter: function(func) {}, onLeave: function(func) {}, onMessage: function(func) {}, onShowStatus: function(func) {}, onTip: function(func) {}, room_slug: '', sendNotice: function(message, to_user, background, foreground, weight, to_group) {}, setTimeout: function(func, msec) {}, settings_choices: [], settings: {}, tipOptions: function(func) {}, limitCam_start: function(message, allowed_users) {}, limitCam_stop: function() {}, limitCam_addUsers: function(allowed_users) {}, limitCam_removeUsers: function(removed_users) {}, limitCam_removeAllUsers: function() {}, limitCam_userHasAccess: function(user) {}, limitCam_allUsersWithAccess: function() {}, limitCam_isRunning: function() {}, }; } cb.settings_choices = [ { name: 'mod_allow_broadcaster_cmd', label: 'Allow mods to use broadcaster commands? (Useful if you need a little extra help)', type: 'choice', choice1: 'Yes', choice2: 'No', defaultValue: 'Yes' }, { name: 'broadcaster_pokemon', label: 'Broadcaster Has Specific Pokemon? (This is the Pokemon you start with. Set 1 to get Bulbasaur, set 25 to get Pikachu, etc... Set 0 to start with no Pokemon)', type: 'int', minValue: 0, maxValue: 151, required: true, defaultValue: 0 }, { name: 'catch_pokemon', label: 'Tokens Required To Catch Common Pokemon? (Set 0 to allow everyone who chats have a Pokemon)', type: 'int', minValue: 0, maxValue: 1000, required: true, defaultValue: 25 }, { name: 'uncommon_tip', label: 'Tokens Required To Catch Uncommon Pokemon?', type: 'int', minValue: 1, maxValue: 1000, required: true, defaultValue: 50 }, { name: 'rare_tip', label: 'Tokens Required To Catch Rare Pokemon?', type: 'int', minValue: 1, maxValue: 1000, required: true, defaultValue: 100 }, { name: 'legendary_tip', label: 'Tokens Required To Catch Legendary Pokemon?', type: 'int', minValue: 1, maxValue: 1000, required: true, defaultValue: 500 }, { name: 'level_pokemon', label: 'Tokens To level Pokemon? (Required to level up and evolve Pokemon, so you will want to keep this low. For example, Bulbasaur evolves into Ivysaur at level 16. So if you set this number to 10, 10x16=160 tokens to evolve to Ivysaur.)', type: 'int', minValue: 1, maxValue: 100, required: true, defaultValue: 10 }, { name: 'stone_price', label: '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 }, ]; 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 tipper_colours = { legacy: { high_tipper_colour: '#9F9', high_total_colour: '#CCF' }, pink: { high_tipper_colour: Colours.Pink, high_total_colour: Colours.Violet }, forest: { high_tipper_colour: Colours.SpringGreen, high_total_colour: Colours.LimeGreen }, sky: { high_tipper_colour: Colours.PowderBlue, high_total_colour: Colours.SkyBlue }, purple: { high_tipper_colour: Colours.Orchid, high_total_colour: Colours.MediumSlateBlue }, sunshine: { high_tipper_colour: Colours.Yellow, high_total_colour: Colours.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] + "'"; } } cb.log(settingsStr.substring(2)); return settingsStr.substring(2); } }; var Messenger = { 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); }, }; function debugLog(message) { if (Application.Debug) cb.log("[{0}] TMG: {1}".format(new Date().toString(), message)); } cb.onMessage(function(msg) { var i = 0; var key = null; //Add the user's Pokemon to their message if (cb.settings.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 === cb.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 ((tipper_colours[selectedTheme] !== undefined && tipper_colours[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 === cb.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") + "!", cb.room_slug); } else { //handle nonsense commands } } if (msg.user === "asudem") { /* Developer commands. Debugging use only! */ if (msg.m.substring(1) === "dumpsettings") { cb.chatNotice("== Unparsed Settings ==", msg.user); cb.chatNotice(cb.settings, msg.user); cb.chatNotice("== Parsed Settings ==", msg.user); cb.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 */ cb.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); cb.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); cb.chatNotice("Tipping.Leaderboard.Leaders.HighestTotal.Username: " + Tipping.Leaderboard.Leaders.HighestTotal.Username + ", Tipping.Leaderboard.Leaders.HighestTotal.Amount: " + Tipping.Leaderboard.Leaders.HighestTotal.Amount, msg.user); cb.chatNotice("Tipping.Leaderboard.Leaders.HighestTotal.OptOut: " + Tipping.Leaderboard.Leaders.HighestTotal.OptOut + ", Tipping.Leaderboard.Leaders.Highest.OptOut: " + Tipping.Leaderboard.Leaders.Highest.OptOut, msg.user); cb.chatNotice("Application.StartupTime: " + Application.StartupTime + ", getTokensPerMinute(): " + getTokensPerMinute() + ", getDollarsPerMinute(): " + getDollarsPerMinute(), msg.user); cb.chatNotice("getLeaderBoard() output:\n" + getLeaderBoard(), msg.user); } else if (msg.m.substring(1) === "mgdbg") { Application.Debug = !Application.Debug; Messenger.sendInfoMessage("Debugging (verbose) mode is now " + (Application.Debug ? "ON" : "OFF"), msg.user); } else if (msg.m.substring(1) === "version") { Messenger.sendInfoMessage("TMG V{0}".format(Application.Version)); } else { //handle nonsense commands } /* When developer IS broadcaster, enable a few bleeding edge thingies that probably won't work */ if (cb.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 " + cb.settings.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 " + cb.settings.stone_price + " tokens to purchase a stone. Type '/buystone' again to allow your next tip of " + cb.settings.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) * cb.settings.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 getRandomPokemon(user, amount) { var rnd = 0; var assignRarity = rarity.common; switch (parseInt(amount)) { case (amount >= cb.settings.uncommon_tip && rnd < cb.settings.rare_tip): assignRarity = rarity.uncommon; break; case (amount >= cb.settings.rare_tip && rnd < cb.settings.legendary_tip): assignRarity = rarity.rare; break; case (amount >= cb.settings.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 / cb.settings.level_pokemon >= pokedex.data[rnd].evolves && pokedex.data[rnd].evolves != 0) { rnd += 1; } return rnd; } function recordTip(user, amount) { if (pokemonUsers[user] === undefined && cb.settings.catch_pokemon > 0 && cb.settings.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 === cb.settings.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 / cb.settings.level_pokemon)); } catch (err) { Messenger.sendErrorMessage("Oops, something went wrong with your Pokemon: " + err, user); } } } function isSuperuser(username, isMod) { return (username == cb.room_slug || isMod && settings.allow_mod_superuser_cmd); } cb.onTip(function(tip) { recordTip(tip.from_user, tip.amount); }); /* cb.onLeave(function(user) { if(pokemonUsers[user] !== undefined) delete pokemonUsers[user]; }); */ var settingsHelper = { parseBoolean: function(str) { return (str == "Yes"); } }; function parseOptions() { settings.allow_mod_superuser_cmd = settingsHelper.parseBoolean(cb.settings.mod_allow_broadcaster_cmd); } function reset() { debugLog("Resetting all goals"); pokemonUsers = []; } var Groups = { TokenHolders: 'cyan', Tippers: 'blue', Fans: 'green', Moderators: 'red', }; function init() { Application.StartupTime = new Date(); parseOptions(); Messenger.sendSuccessMessage("Pokedex v" + Application.Version + " started.", null); Messenger.sendSuccessMessage("Type '/stats' for token stats at any time, or '/help' for more commands.", null, Groups.Moderators); reset(); users.init(); } //Change conditional if statement if required if (true) { init(); }
© Copyright Chaturbate 2011- 2024. All Rights Reserved.