diff options
author | mat <github@matdoes.dev> | 2022-04-20 19:16:16 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-04-20 19:16:16 -0500 |
commit | 6b2bdd5b86eb0ebdf67b50bf5f2dcf74044fe914 (patch) | |
tree | 986d1f11c1267d9598a15f6031aeee1e2925ea63 /src/cleaners/skyblock/pets.ts | |
parent | 5712e10eec2c9fa881bdf19295808404c56f7d33 (diff) | |
download | skyblock-api-6b2bdd5b86eb0ebdf67b50bf5f2dcf74044fe914.tar.gz skyblock-api-6b2bdd5b86eb0ebdf67b50bf5f2dcf74044fe914.tar.bz2 skyblock-api-6b2bdd5b86eb0ebdf67b50bf5f2dcf74044fe914.zip |
store api ids in skyblock-constants
Diffstat (limited to 'src/cleaners/skyblock/pets.ts')
-rw-r--r-- | src/cleaners/skyblock/pets.ts | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/cleaners/skyblock/pets.ts b/src/cleaners/skyblock/pets.ts index 031924a..4ee7cda 100644 --- a/src/cleaners/skyblock/pets.ts +++ b/src/cleaners/skyblock/pets.ts @@ -1,8 +1,8 @@ import typedHypixelApi from 'typed-hypixel-api' import { fetchItemList } from '../../hypixel.js' import { levelFromXpTable } from '../../util.js' -import { fetchPets } from '../../constants.js' import { ItemListItem } from './itemList.js' +import * as constants from '../../constants.js' // https://hypixel-skyblock.fandom.com/wiki/Module:Pet/LevelingData?action=edit @@ -57,12 +57,15 @@ export async function cleanPets(data: typedHypixelApi.SkyBlockProfileMember): Pr const obtainedPets: Pet[] = [] let activePet: Pet | null = null - const allPetIds = await fetchPets() + const allPetIds = await constants.fetchPets() const obtainedPetIds: string[] = [] const itemList = await fetchItemList() + let petIds: string[] = [] + for (const petData of data.pets ?? []) { + petIds.push(petData.type) const xpTable = RARITY_XP_TABLES[petData.tier] ?? RARITY_XP_TABLES.LEGENDARY const level = levelFromXpTable(petData.exp, xpTable) const pet: Pet = { @@ -80,6 +83,7 @@ export async function cleanPets(data: typedHypixelApi.SkyBlockProfileMember): Pr activePet = pet } + constants.addPets(petIds) const missingPetIds = allPetIds.filter(id => !obtainedPetIds.includes(id)) return { |