aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormat <github@matdoes.dev>2022-04-23 16:56:11 -0500
committermat <github@matdoes.dev>2022-04-23 16:56:11 -0500
commitc1896fdc8620ca57fad2f766158630b7eea19a4c (patch)
tree6427cd5337c246733ec6c02d3f12228c2a61f316
parent3a8393deb2f057e9b9601f23dc53b23913160e13 (diff)
downloadskyblock-api-c1896fdc8620ca57fad2f766158630b7eea19a4c.tar.gz
skyblock-api-c1896fdc8620ca57fad2f766158630b7eea19a4c.tar.bz2
skyblock-api-c1896fdc8620ca57fad2f766158630b7eea19a4c.zip
add a bunch of items because hypixel
-rw-r--r--src/cleaners/skyblock/itemId.ts64
-rw-r--r--src/cleaners/skyblock/itemList.ts5
2 files changed, 64 insertions, 5 deletions
diff --git a/src/cleaners/skyblock/itemId.ts b/src/cleaners/skyblock/itemId.ts
index 1d75979..ebaff8a 100644
--- a/src/cleaners/skyblock/itemId.ts
+++ b/src/cleaners/skyblock/itemId.ts
@@ -9,7 +9,7 @@ const ITEMS = {
'sand:1': 'red_sand',
- 'ink_sack': 'ink_sac',
+ 'ink_sack': 'dye',
'ink_sack:3': 'cocoa_beans',
'ink_sack:4': 'lapis_lazuli',
@@ -37,6 +37,12 @@ const ITEMS = {
'mycel': 'mycelium',
'cocoa': 'cocoa_beans',
+ 'redstone_lamp_off': 'redstone_lamp',
+ 'redstone_comparator': 'comparator',
+ 'redstone_torch_on': 'redstone_torch',
+ 'iron_plate': 'light_weighted_pressure_plate',
+ 'gold_plate': 'heavy_weighted_pressure_plate',
+
'huge_mushroom_1': 'red_mushroom_block',
'huge_mushroom_2': 'brown_mushroom_block',
@@ -45,8 +51,52 @@ const ITEMS = {
'iron': 'iron_ingot',
'gold': 'gold_ingot',
+ 'hard_clay': 'stained_hardened_clay',
+ 'stained_clay': 'stained_hardened_clay',
+
+ 'wood_sword': 'wooden_sword',
+ 'wood_spade': 'wooden_shovel',
+ 'wood_pickaxe': 'wooden_pickaxe',
+ 'wood_axe': 'wooden_axe',
+ 'wood_hoe': 'wooden_hoe',
+
+ 'stone_spade': 'stone_shovel',
+
+ 'gold_sword': 'golden_sword',
+ 'gold_spade': 'golden_shovel',
+ 'gold_pickaxe': 'golden_pickaxe',
+ 'gold_axe': 'golden_axe',
+ 'gold_hoe': 'golden_hoe',
+ 'gold_helmet': 'golden_helmet',
+ 'gold_chestplate': 'golden_chestplate',
+ 'gold_leggings': 'golden_leggings',
+ 'gold_boots': 'golden_boots',
+ 'gold_barding': 'golden_horse_armor',
+
+ 'iron_barding': 'iron_horse_armor',
+ 'iron_spade': 'iron_shovel',
+
+ 'diamond_spade': 'diamond_shovel',
+
+ 'gold_record': 'record_13',
+ 'green_record': 'record_cat',
+ 'record_3': 'record_blocks',
+ 'record_4': 'record_chirp',
+ 'record_5': 'record_far',
+ 'record_6': 'record_mall',
+ 'record_7': 'record_mellohi',
+ 'record_8': 'record_stal',
+ 'record_9': 'record_strad',
+ 'record_10': 'record_ward',
+ 'record_12': 'record_wait',
+
'sulphur_ore': 'sulphur',
+ 'book_and_quill': 'writable_book',
+ 'mushroom_soup': 'mushroom_stew',
+ 'red_rose': 'red_flower',
+ 'firework': 'fireworks',
+ 'skull_item': 'skull',
'endstone': 'end_stone',
'lapis_lazuli_block': 'lapis_block',
'snow_ball': 'snowball',
@@ -74,6 +124,14 @@ export type hypixelItemNames = keyof typeof ITEMS
export type cleanItemNames = (typeof ITEMS)[keyof typeof ITEMS]
/** Clean an item with a weird name (log_2:1) and make it have a better name (dark_oak_log) */
-export function cleanItemId(itemId: string): cleanItemNames {
- return ITEMS[itemId.toLowerCase()] ?? itemId.toLowerCase()
+export function cleanItemId(itemId: string): string {
+ itemId = itemId.toLowerCase()
+ if (itemId in ITEMS)
+ return ITEMS[itemId]
+ if (itemId.includes(':')) {
+ const [item, damage] = itemId.split(':')
+ if (item in ITEMS)
+ return ITEMS[item] + ':' + damage
+ }
+ return itemId
}
diff --git a/src/cleaners/skyblock/itemList.ts b/src/cleaners/skyblock/itemList.ts
index 3a166e3..f64b273 100644
--- a/src/cleaners/skyblock/itemList.ts
+++ b/src/cleaners/skyblock/itemList.ts
@@ -1,5 +1,6 @@
import typedHypixelApi from 'typed-hypixel-api'
import { headIdFromBase64 } from './inventory.js'
+import { cleanItemId } from './itemId.js'
export interface ItemRequirement {
// idk what these do
@@ -40,11 +41,11 @@ function cleanItemRequirements(data: typedHypixelApi.SkyBlockItemsResponse['item
}
function cleanItemListItem(item: typedHypixelApi.SkyBlockItemsResponse['items'][number]): ItemListItem {
- const vanillaId = item.material.toLowerCase()
+ const vanillaId = cleanItemId(item.durability ? `${item.material}:${item.durability}` : item.material)
return {
id: item.id,
headTexture: (item.material === 'SKULL_ITEM' && 'skin' in item) ? headIdFromBase64(item.skin) : undefined,
- vanillaId: item.durability ? `${vanillaId}:${item.durability}` : vanillaId,
+ vanillaId,
tier: item.tier ?? null,
display: {
name: item.name,