diff options
author | mat <27899617+mat-1@users.noreply.github.com> | 2021-04-17 18:42:09 -0500 |
---|---|---|
committer | mat <27899617+mat-1@users.noreply.github.com> | 2021-04-17 18:42:09 -0500 |
commit | e30e548f22c3c23f73498d7827f4ea87640f78b1 (patch) | |
tree | 9251a2ee26f939cf6a51208b082d258eef51242e /build | |
parent | 14ab63a82d750e897b4db2bd558ebbdb9fa0159c (diff) | |
download | skyblock-api-e30e548f22c3c23f73498d7827f4ea87640f78b1.tar.gz skyblock-api-e30e548f22c3c23f73498d7827f4ea87640f78b1.tar.bz2 skyblock-api-e30e548f22c3c23f73498d7827f4ea87640f78b1.zip |
add head_texture to items
Diffstat (limited to 'build')
-rw-r--r-- | build/cleaners/skyblock/inventory.js | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/build/cleaners/skyblock/inventory.js b/build/cleaners/skyblock/inventory.js index c2bb3f6..0131e1b 100644 --- a/build/cleaners/skyblock/inventory.js +++ b/build/cleaners/skyblock/inventory.js @@ -25,7 +25,7 @@ function base64decode(base64) { return Buffer.from(base64, 'base64'); } function cleanItem(rawItem) { - var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m; + var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o; // if the item doesn't have an id, it isn't an item if (rawItem.id === undefined) return null; @@ -34,21 +34,35 @@ function cleanItem(rawItem) { const damageValue = rawItem.Damage; const itemTag = rawItem.tag; const extraAttributes = (_a = itemTag === null || itemTag === void 0 ? void 0 : itemTag.ExtraAttributes) !== null && _a !== void 0 ? _a : {}; + let headId; + if (vanillaId === 397) { + const headDataBase64 = (_e = (_d = (_c = (_b = itemTag === null || itemTag === void 0 ? void 0 : itemTag.SkullOwner) === null || _b === void 0 ? void 0 : _b.Properties) === null || _c === void 0 ? void 0 : _c.textures) === null || _d === void 0 ? void 0 : _d[0]) === null || _e === void 0 ? void 0 : _e.Value; + if ((extraAttributes === null || extraAttributes === void 0 ? void 0 : extraAttributes.id) === 'LARGE_MINING_SACK') + console.log(headDataBase64); + if (headDataBase64) { + const headData = JSON.parse(base64decode(headDataBase64).toString()); + const headDataUrl = (_g = (_f = headData === null || headData === void 0 ? void 0 : headData.textures) === null || _f === void 0 ? void 0 : _f.SKIN) === null || _g === void 0 ? void 0 : _g.url; + if (headDataUrl) { + const splitUrl = headDataUrl.split('/'); + headId = splitUrl[splitUrl.length - 1]; + } + } + } return { - id: (_b = extraAttributes === null || extraAttributes === void 0 ? void 0 : extraAttributes.id) !== null && _b !== void 0 ? _b : null, + id: (_h = extraAttributes === null || extraAttributes === void 0 ? void 0 : extraAttributes.id) !== null && _h !== void 0 ? _h : null, count: itemCount !== null && itemCount !== void 0 ? itemCount : 1, vanillaId: damageValue ? `${vanillaId}:${damageValue}` : vanillaId.toString(), display: { - name: (_d = (_c = itemTag === null || itemTag === void 0 ? void 0 : itemTag.display) === null || _c === void 0 ? void 0 : _c.Name) !== null && _d !== void 0 ? _d : 'null', - lore: (_f = (_e = itemTag === null || itemTag === void 0 ? void 0 : itemTag.display) === null || _e === void 0 ? void 0 : _e.Lore) !== null && _f !== void 0 ? _f : [], + name: (_k = (_j = itemTag === null || itemTag === void 0 ? void 0 : itemTag.display) === null || _j === void 0 ? void 0 : _j.Name) !== null && _k !== void 0 ? _k : 'null', + lore: (_m = (_l = itemTag === null || itemTag === void 0 ? void 0 : itemTag.display) === null || _l === void 0 ? void 0 : _l.Lore) !== null && _m !== void 0 ? _m : [], // if it has an ench value in the tag, then it should have an enchant glint effect - glint: ((_g = itemTag === null || itemTag === void 0 ? void 0 : itemTag.ench) !== null && _g !== void 0 ? _g : []).length > 0 + glint: ((_o = itemTag === null || itemTag === void 0 ? void 0 : itemTag.ench) !== null && _o !== void 0 ? _o : []).length > 0 }, reforge: extraAttributes === null || extraAttributes === void 0 ? void 0 : extraAttributes.modifier, enchantments: extraAttributes === null || extraAttributes === void 0 ? void 0 : extraAttributes.enchantments, anvil_uses: extraAttributes === null || extraAttributes === void 0 ? void 0 : extraAttributes.anvil_uses, timestamp: extraAttributes === null || extraAttributes === void 0 ? void 0 : extraAttributes.timestamp, - skull_owner: (_m = (_l = (_k = (_j = (_h = itemTag === null || itemTag === void 0 ? void 0 : itemTag.SkullOwner) === null || _h === void 0 ? void 0 : _h.Properties) === null || _j === void 0 ? void 0 : _j.textures) === null || _k === void 0 ? void 0 : _k[0]) === null || _l === void 0 ? void 0 : _l.value) !== null && _m !== void 0 ? _m : undefined, + head_texture: headId, }; } function cleanItems(rawItems) { |