diff options
author | mat <github@matdoes.dev> | 2022-04-23 22:08:09 -0500 |
---|---|---|
committer | mat <github@matdoes.dev> | 2022-04-23 22:08:09 -0500 |
commit | a0daf3991126a3939bb990674a689d736103991e (patch) | |
tree | 92c553d27c4a09532cbe022d1ec12b6d08ae1740 /src/cleaners | |
parent | c1896fdc8620ca57fad2f766158630b7eea19a4c (diff) | |
download | skyblock-api-a0daf3991126a3939bb990674a689d736103991e.tar.gz skyblock-api-a0daf3991126a3939bb990674a689d736103991e.tar.bz2 skyblock-api-a0daf3991126a3939bb990674a689d736103991e.zip |
add some more stuff to item list
Diffstat (limited to 'src/cleaners')
-rw-r--r-- | src/cleaners/skyblock/itemId.ts | 4 | ||||
-rw-r--r-- | src/cleaners/skyblock/itemList.ts | 43 |
2 files changed, 36 insertions, 11 deletions
diff --git a/src/cleaners/skyblock/itemId.ts b/src/cleaners/skyblock/itemId.ts index ebaff8a..dc172b2 100644 --- a/src/cleaners/skyblock/itemId.ts +++ b/src/cleaners/skyblock/itemId.ts @@ -92,6 +92,10 @@ const ITEMS = { 'sulphur_ore': 'sulphur', + 'step': 'stone_slab', + 'nether_fence': 'nether_brick_fence', + 'empty_map': 'map', + 'nether_brick_item': 'nether_brick', 'book_and_quill': 'writable_book', 'mushroom_soup': 'mushroom_stew', 'red_rose': 'red_flower', diff --git a/src/cleaners/skyblock/itemList.ts b/src/cleaners/skyblock/itemList.ts index f64b273..8134f0a 100644 --- a/src/cleaners/skyblock/itemList.ts +++ b/src/cleaners/skyblock/itemList.ts @@ -3,12 +3,18 @@ import { headIdFromBase64 } from './inventory.js' import { cleanItemId } from './itemId.js' export interface ItemRequirement { - // idk what these do - // they'll probably be renamed at some point - dungeon: { + dungeon?: { type: string level: number } + skill?: { + type: string + level: number + } + slayer?: { + boss: string + level: number + } } // based on Item from inventory.ts @@ -22,7 +28,10 @@ export interface ItemListItem { glint: boolean } npcSellPrice: number | null - requirements: ItemRequirement | null + requirements: ItemRequirement + category: string | null + soulbound: boolean + museum: boolean } export interface ItemListData { @@ -30,13 +39,22 @@ export interface ItemListData { list: ItemListItem[] } -function cleanItemRequirements(data: typedHypixelApi.SkyBlockItemsResponse['items'][number]['requirements'] & typedHypixelApi.SkyBlockItemsResponse['items'][number]['catacombs_requirements']): ItemRequirement | null { - if (!data || !data.dungeon) return null +function cleanItemRequirements(data: typedHypixelApi.SkyBlockItemsResponse['items'][number]['requirements'], catacombsRequirements: typedHypixelApi.SkyBlockItemsResponse['items'][number]['catacombs_requirements']): ItemRequirement { + if (!data) return {} + let dungeonData = data.dungeon ?? catacombsRequirements?.dungeon return { - dungeon: { - type: data.dungeon.type, - level: data.dungeon.level - } + dungeon: dungeonData ? { + type: dungeonData.type.toLowerCase(), + level: dungeonData.level + } : undefined, + skill: data.skill ? { + type: data.skill.type.toLowerCase(), + level: data.skill.level + } : undefined, + slayer: data.slayer ? { + boss: data.slayer.slayer_boss_type, + level: data.slayer.level + } : undefined } } @@ -52,7 +70,10 @@ function cleanItemListItem(item: typedHypixelApi.SkyBlockItemsResponse['items'][ glint: item.glowing ?? false }, npcSellPrice: item.npc_sell_price ?? null, - requirements: cleanItemRequirements(item.catacombs_requirements ?? item.requirements) + requirements: cleanItemRequirements(item.requirements, item.catacombs_requirements), + category: item.category?.toLowerCase() ?? null, + soulbound: !!item.soulbound, + museum: item.museum ?? false } } |