diff options
Diffstat (limited to 'src/cleaners/skyblock/inventory.ts')
-rw-r--r-- | src/cleaners/skyblock/inventory.ts | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/src/cleaners/skyblock/inventory.ts b/src/cleaners/skyblock/inventory.ts index 76acf60..5d72928 100644 --- a/src/cleaners/skyblock/inventory.ts +++ b/src/cleaners/skyblock/inventory.ts @@ -20,7 +20,7 @@ interface Item { timestamp?: string enchantments?: { [ name: string ]: number } - skull_owner?: string + head_texture?: string } export type Inventory = Item[] @@ -34,6 +34,21 @@ function cleanItem(rawItem): Item { const damageValue = rawItem.Damage const itemTag = rawItem.tag const extraAttributes = itemTag?.ExtraAttributes ?? {} + let headId: string + + if (vanillaId === 397) { + const headDataBase64 = itemTag?.SkullOwner?.Properties?.textures?.[0]?.Value + if (extraAttributes?.id === 'LARGE_MINING_SACK') console.log(headDataBase64) + if (headDataBase64) { + const headData = JSON.parse(base64decode(headDataBase64).toString()) + const headDataUrl = headData?.textures?.SKIN?.url + if (headDataUrl) { + const splitUrl = headDataUrl.split('/') + headId = splitUrl[splitUrl.length - 1] + } + } + } + return { id: extraAttributes?.id ?? null, count: itemCount ?? 1, @@ -51,8 +66,7 @@ function cleanItem(rawItem): Item { anvil_uses: extraAttributes?.anvil_uses, timestamp: extraAttributes?.timestamp, - skull_owner: itemTag?.SkullOwner?.Properties?.textures?.[0]?.value ?? undefined, - + head_texture: headId, } } @@ -83,7 +97,7 @@ export const INVENTORIES = { wardrobe: 'wardrobe_contents' } -export type Inventories = { [name in keyof typeof INVENTORIES ]: Inventories } +export type Inventories = { [name in keyof typeof INVENTORIES ]: Item[] } export async function cleanInventories(data: any): Promise<Inventories> { const cleanInventories: any = {} |