diff --git a/src/server/types/Pet.js b/src/server/types/Pet.js index 5fccef5..5e5ec3a 100644 --- a/src/server/types/Pet.js +++ b/src/server/types/Pet.js @@ -33,6 +33,9 @@ const resolvers = { return null; } + // Neopets may omit this field entirely; treat "missing" as null. + const altStyleId = customPetData.custom_pet.alt_style ?? null; + const petType = await petTypeBySpeciesAndColorLoader.load({ speciesId: customPetData.custom_pet.species_id, colorId: customPetData.custom_pet.color_id, @@ -53,7 +56,7 @@ const resolvers = { .join(","); petState = petStates.find((ps) => ps.swfAssetIds === swfAssetIdsString); if (petState) { - return { id: petState.id }; + return { id: petState.id, altStyleId }; } // Next, look for a pet state matching the same pose. (This can happen if @@ -71,7 +74,7 @@ const resolvers = { `because it matches pose ${pose}. Actual pet state for these ` + `assets not found: ${swfAssetIdsString}`, ); - return { id: petState.id }; + return { id: petState.id, altStyleId }; } } @@ -85,7 +88,7 @@ const resolvers = { `as an UNKNOWN fallback pose. Actual pet state for these ` + `assets not found: ${swfAssetIdsString}`, ); - return { id: petState.id }; + return { id: petState.id, altStyleId }; } // If we still don't have a pet state, raise an error. (This can happen diff --git a/src/server/types/PetAppearance.js b/src/server/types/PetAppearance.js index 2036036..6a92c8f 100644 --- a/src/server/types/PetAppearance.js +++ b/src/server/types/PetAppearance.js @@ -78,6 +78,12 @@ const typeDefs = gql` """ id: ID! + """ + The ID of the alt style used to render this appearance, if any. + Null when this appearance is not using an alt style. + """ + altStyleId: ID + species: Species! color: Color! pose: Pose!