mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
Fix
This commit is contained in:
@@ -28,16 +28,7 @@ module.exports = class Pokemon {
|
||||
this.legendary = data.is_legendary;
|
||||
this.mythical = data.is_mythical;
|
||||
this.baby = data.is_baby;
|
||||
this.heldItems = data.held_items
|
||||
.filter(item => item.version_details.some(version => {
|
||||
const inSwordShield = version.version.name === 'sword' || version.version.name === 'shield';
|
||||
if (inSwordShield) return true;
|
||||
if (!inSwordShield && (version.version.name === 'ultra-sun' || version.version.name === 'ultra-moon')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}))
|
||||
.map(item => ({ url: item.item.url, name: null }));
|
||||
this.heldItems = data.missingno ? data.heldItems : [];
|
||||
this.varieties = data.varieties.map(variety => {
|
||||
const name = firstUpperCase(variety.pokemon.name
|
||||
.replace(new RegExp(`${this.slug}-?`, 'i'), '')
|
||||
@@ -145,7 +136,17 @@ module.exports = class Pokemon {
|
||||
}
|
||||
this.height = defaultBody.height * 3.94;
|
||||
this.weight = defaultBody.weight * 0.2205;
|
||||
await this.fetchHeldItemNames();
|
||||
this.heldItems = defaultBody.held_items
|
||||
.filter(item => item.version_details.some(version => {
|
||||
const inSwordShield = version.version.name === 'sword' || version.version.name === 'shield';
|
||||
if (inSwordShield) return true;
|
||||
if (!inSwordShield && (version.version.name === 'ultra-sun' || version.version.name === 'ultra-moon')) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}))
|
||||
.map(item => ({ url: item.item.url, name: null }));
|
||||
await this.fetchHeldItemNames(defaultBody);
|
||||
await this.fetchChain();
|
||||
this.gameDataCached = true;
|
||||
return this;
|
||||
|
||||
Reference in New Issue
Block a user