mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Show correct form sprite in pokedex-stats
This commit is contained in:
@@ -99,7 +99,10 @@
|
||||
"encounters": [],
|
||||
"chain": [0],
|
||||
"missingno": true,
|
||||
"sprite": "https://cdn.bulbagarden.net/upload/9/98/Missingno_RB.png",
|
||||
"sprites": {
|
||||
"default": "https://cdn.bulbagarden.net/upload/9/98/Missingno_RB.png",
|
||||
"yellow": "https://cdn.bulbagarden.net/upload/0/03/Missingno_Y.png"
|
||||
},
|
||||
"box": "https://cdn.bulbagarden.net/upload/1/1f/AniMS_Missingno_I.png",
|
||||
"url": "https://bulbapedia.bulbagarden.net/wiki/MissingNo."
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ module.exports = class PokedexCommand extends Command {
|
||||
const embed = new MessageEmbed()
|
||||
.setColor(0xED1C24)
|
||||
.setAuthor(`#${data.displayID} - ${data.name}`, data.boxImageURL, data.serebiiURL)
|
||||
.setThumbnail(data.spriteImageURL)
|
||||
.setThumbnail(data.formSpriteImageURL(variety.id))
|
||||
.addField(`❯ Base Stats (${variety.name || 'Base'} Form)`, stripIndents`
|
||||
\`HP: [${'█'.repeat(repeat.hp)}${' '.repeat(20 - repeat.hp)}]\` **${variety.stats.hp}**
|
||||
\`Attack: [${'█'.repeat(repeat.atk)}${' '.repeat(20 - repeat.atk)}]\` **${variety.stats.atk}**
|
||||
|
||||
@@ -100,11 +100,19 @@ module.exports = class Pokemon {
|
||||
}
|
||||
|
||||
get spriteImageURL() {
|
||||
if (this.missingno) return missingno.sprite;
|
||||
if (this.missingno) return missingno.sprites.default;
|
||||
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`;
|
||||
}
|
||||
|
||||
formSpriteImageURL(variety) {
|
||||
if (this.missingno && form === 'yellow') return missingno.sprites.yellow;
|
||||
if (this.id === 898) return 'https://assets.pokemon.com/assets/cms2/img/pokedex/full/898.png';
|
||||
const found = this.varieties.find(vrity => variety ? vrity.id === variety.toLowerCase() : vrity.default);
|
||||
const name = found.name ? found.name.toLowerCase().split(' ').map(n => n.charAt(0)).join('') : '';
|
||||
return `https://serebii.net/pokemon/art/${this.displayID}${name ? `-${name}` : ''}.png`;
|
||||
}
|
||||
|
||||
get boxImageURL() {
|
||||
if (this.missingno) return missingno.box;
|
||||
return `https://www.serebii.net/pokedex-swsh/icon/${this.displayID}.png`;
|
||||
|
||||
Reference in New Issue
Block a user