Skip to content
This repository has been archived by the owner on Oct 27, 2024. It is now read-only.

Commit

Permalink
make catacombs_requirements more specific
Browse files Browse the repository at this point in the history
fix catacombs_requirements and requirements.dungeon not being able to be merged
  • Loading branch information
mat-1 committed Apr 24, 2022
1 parent befd253 commit 39c1300
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "typed-hypixel-api",
"version": "1.3.0",
"version": "1.3.1",
"main": "build/index.js",
"types": "build/index.d.js",
"repository": "https://github.com/skyblockstats/typed-hypixel-api.git",
Expand Down
8 changes: 6 additions & 2 deletions src/responses/resources/skyblock/items.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,10 @@ export interface SkyBlockItemsResponse {
essence_type: string
costs: number[]
}
/** I don't know why this is its own field, this can be used as a fallback if requirements.dungeon is missing. */
catacombs_requirements?: {
dungeon: {
type: string
type: 'CATACOMBS'
level: number
}
}
Expand All @@ -168,7 +169,10 @@ export interface SkyBlockItemsResponse {
ATTACK_SPEED?: number[]
}
requirements?: {
/** If present, you need a specific level in a dungeon. */
/**
* If present, you need a specific level in a dungeon. Note that
* sometimes `catacombs_requirements` is used instead of this field.
*/
dungeon?: {
type: 'CATACOMBS'
level: number
Expand Down
19 changes: 10 additions & 9 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,16 @@ console.log('\x1b[1m%s\x1b[0m', 'Running tests. This will take a few minutes, be
const startTime = Date.now();

(async () => {

// we have to do this otherwise typescript gets mad :(
const itemsResponse = await request('resources/skyblock/items', {}, true)
const originalItems = itemsResponse.data.items
for (let i = 0; i < originalItems.length / 1000; i++) {
itemsResponse.data.items = originalItems.slice(i * 1000, (i + 1) * 1000)
await testData('SkyBlockItemsResponse', itemsResponse)
}


await testData('SkyBlockPlayerBingoResponse', await request('skyblock/bingo', {
key: process.env.API_KEY,
uuid: 'e471665f71014891bef337c8d22cf04b'
Expand Down Expand Up @@ -92,15 +102,6 @@ const startTime = Date.now();
await testData('SkyBlockNewsResponse', await request('skyblock/news', { key: process.env.API_KEY }, true))
await testData('SkyBlockBazaarResponse', await request('skyblock/bazaar', {}, true))

// we have to do this otherwise typescript gets mad :(
const itemsResponse = await request('resources/skyblock/items', {}, true)
const originalItems = itemsResponse.data.items
for (let i = 0; i < originalItems.length / 1000; i++) {
itemsResponse.data.items = originalItems.slice(i * 1000, (i + 1) * 1000)
await testData('SkyBlockItemsResponse', itemsResponse)
}


await testData('PlayerDataResponse', await request('player', {
uuid: 'ed32a0660fc948378dcf8ed717d1188c',
key: process.env.API_KEY
Expand Down

0 comments on commit 39c1300

Please sign in to comment.