diff --git a/assets/json/missingno.json b/assets/json/missingno.json index 1c46148f..3b378e87 100644 --- a/assets/json/missingno.json +++ b/assets/json/missingno.json @@ -56,6 +56,10 @@ "evolution_chain": { "url": null }, + "is_legendary": false, + "is_mythical": false, + "is_baby": false, + "gender_rate": -1, "stats": { "hp": 33, "atk": 136, @@ -64,6 +68,8 @@ "sDef": 6, "spd": 29 }, + "height": 120, + "weight": 3507.2, "abilities": ["N/A"], "chain": [0], "missingno": true, diff --git a/commands/search/pokedex.js b/commands/search/pokedex.js index 946a46ca..7f3af5a1 100644 --- a/commands/search/pokedex.js +++ b/commands/search/pokedex.js @@ -1,7 +1,7 @@ const Command = require('../../structures/Command'); const { MessageEmbed } = require('discord.js'); const { stripIndents } = require('common-tags'); -const { reactIfAble } = require('../../util/Util'); +const { firstUpperCase, reactIfAble } = require('../../util/Util'); module.exports = class PokedexCommand extends Command { constructor(client) { @@ -72,6 +72,7 @@ module.exports = class PokedexCommand extends Command { spd: Math.round((data.stats.spd / 255) * 10) * 2, total: Math.round((data.baseStatTotal / 720) * 10) * 2 }; + const feet = Math.floor(data.height / 12); const embed = new MessageEmbed() .setColor(0xED1C24) .setAuthor(`#${data.displayID} - ${data.name}`, data.boxImageURL, data.serebiiURL) @@ -80,6 +81,9 @@ module.exports = class PokedexCommand extends Command { ${data.entries[Math.floor(Math.random() * data.entries.length)]} `) .setThumbnail(data.spriteImageURL) + .addField('❯ Class', firstUpperCase(data.class), true) + .addField('❯ Height', `${feet}'${Math.round(data.height % 12)}"`, true) + .addField('❯ Weight', `${data.weight} lbs.`, true) .addField('❯ Types', typesShown.map(variety => { const showParens = variety.name && typesShown.length > 1; return `${variety.types.join('/')}${showParens ? ` (${variety.name})` : ''}`; @@ -106,7 +110,9 @@ module.exports = class PokedexCommand extends Command { \`-----------------------------------\` \`Total: [${'█'.repeat(repeat.total)}${' '.repeat(20 - repeat.total)}]\` **${data.baseStatTotal}** `) - .addField('❯ Abilities', data.abilities.join(' / ')); + .addField('❯ Abilities', data.abilities.join(' / ')) + .addField('❯ Gender Rate', + data.genderRate.genderless ? 'Genderless' : `♂️ ${data.genderRate.male}% ♀️ ${data.genderRate.female}%`); if (data.cry) { const connection = msg.guild ? this.client.voice.connections.get(msg.guild.id) : null; if (connection) { diff --git a/package.json b/package.json index 856b3ec9..16b7b3ca 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "123.2.2", + "version": "123.2.3", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": { diff --git a/structures/pokemon/Pokemon.js b/structures/pokemon/Pokemon.js index a2adbd16..0e9509cc 100644 --- a/structures/pokemon/Pokemon.js +++ b/structures/pokemon/Pokemon.js @@ -20,6 +20,14 @@ module.exports = class Pokemon { this.genus = data.genera.length ? `The ${data.genera.filter(entry => entry.language.name === 'en')[0].genus}` : 'Undiscovered Pokémon'; + this.genderRate = { + male: data.gender_rate === -1 ? 0 : 100 - ((data.gender_rate / 8) * 100), + female: data.gender_rate === -1 ? 0 : (data.gender_rate / 8) * 100, + genderless: data.gender_rate === -1 + }; + this.legendary = data.is_legendary; + this.mythical = data.is_mythical; + this.baby = data.is_baby; this.varieties = data.varieties.map(variety => { const name = firstUpperCase(variety.pokemon.name .replace(new RegExp(`${this.slug}-?`, 'i'), '') @@ -38,6 +46,8 @@ module.exports = class Pokemon { }; this.stats = data.missingno ? data.stats : null; this.abilities = data.missingno ? data.abilities : []; + this.height = data.missingno ? data.height : null; + this.weight = data.missingno ? data.weight : null; this.gameDataCached = data.missingno || false; this.missingno = data.missingno || false; this.cry = data.id > store.pokemonCountWithCry @@ -50,6 +60,14 @@ module.exports = class Pokemon { return this.stats.hp + this.stats.atk + this.stats.def + this.stats.sAtk + this.stats.sDef + this.stats.spd; } + get class() { + if (this.legendary) return 'legendary'; + if (this.mythical) return 'mythical'; + if (this.baby) return 'baby'; + if (this.missingno) return 'glitch'; + return 'standard'; + } + get displayID() { if (this.missingno) return '???'; return this.id.toString().padStart(3, '0'); @@ -61,6 +79,7 @@ module.exports = class Pokemon { get spriteImageURL() { if (this.missingno) return missingno.sprite; + if (this.id === 898) return 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/898.png'; return `https://serebii.net/pokemon/art/${this.displayID}.png`; } @@ -102,6 +121,8 @@ module.exports = class Pokemon { const { body } = await request.get(ability.ability.url); this.abilities.push(body.names.find(name => name.language.name === 'en').name); } + this.height = defaultBody.height * 3.94; + this.weight = defaultBody.weight * 0.2205; await this.fetchChain(); this.gameDataCached = true; return this; diff --git a/structures/pokemon/PokemonStore.js b/structures/pokemon/PokemonStore.js index 6eba70aa..04c13475 100644 --- a/structures/pokemon/PokemonStore.js +++ b/structures/pokemon/PokemonStore.js @@ -7,7 +7,7 @@ module.exports = class PokemonStore extends Collection { constructor(options) { super(options); - this.pokemonCount = 897; + this.pokemonCount = 898; this.pokemonCountWithCry = 893; }