diff --git a/js/account/avatar-sandbox.js b/js/account/avatar-sandbox.js index 9379fbf..bb1d4b9 100644 --- a/js/account/avatar-sandbox.js +++ b/js/account/avatar-sandbox.js @@ -343,6 +343,44 @@ async function UpdateAvatar() { const FormattedAvatar = structuredClone(Avatar) + if (RetroItems === null) { + const RetroItemsPromise = Avatar.items.map(async (id) => { + if (Math.abs(id) !== id) { + Items = (await (await fetch('https://poly-upd-archival.pages.dev/data.json')).json()) + Object.values(Items).forEach((item, index) => { + item.id = parseInt(Object.keys(Items)[index]) + item.thumbnail = 'https://poly-archive.pages.dev/assets/thumbnails/' + item.id + '.png' + item.creator = { + id: 1, + name: "Polytoria" + } + if (item.asset === undefined) { + item.asset = 'https://poly-upd-archival.pages.dev/glb/' + item.id + '.glb' + } + item.id = item.id*-1 + item.ribbon = 'retro' + ItemCache[item.id] = item + }) + + const PaginationItems = Object.values(Items) + let Groups = [] + while (PaginationItems.length > 0) { + Groups.push(PaginationItems.splice(0, 12)); + } + + Items = { + assets: Groups[Page - 1], + pages: Groups.length + } + + RetroItems = Groups + return + } + }) + + await Promise.all(RetroItemsPromise) + } + const AccessoryPromise = [...Avatar.items, Avatar.tool].filter((x) => x !== undefined && !x.toString().startsWith('http') && !x.toString().startsWith('data:')).map(async (x, index) => { if (ItemCache[x] === undefined) { try { @@ -740,36 +778,6 @@ async function LoadItems() { return } console.log('Equipped Outfit: ', outfit) - if (RetroItems === null) { - Items = (await (await fetch('https://poly-upd-archival.pages.dev/data.json')).json()) - Object.values(Items).forEach((item, index) => { - item.id = parseInt(Object.keys(Items)[index]) - item.thumbnail = 'https://poly-archive.pages.dev/assets/thumbnails/' + item.id + '.png' - item.creator = { - id: 1, - name: "Polytoria" - } - if (item.asset === undefined) { - item.asset = 'https://poly-upd-archival.pages.dev/glb/' + item.id + '.glb' - } - item.id = item.id*-1 - item.ribbon = 'retro' - ItemCache[item.id] = item - }) - - const PaginationItems = Object.values(Items) - let Groups = [] - while (PaginationItems.length > 0) { - Groups.push(PaginationItems.splice(0, 12)); - } - - Items = { - assets: Groups[Page - 1], - pages: Groups.length - } - - RetroItems = Groups - } Avatar = outfit.data UpdateAvatar() })