fix: LoadItems() overwriting item cache avatar sandbox
This commit is contained in:
parent
3e5ae5b782
commit
ec9c7f8671
1 changed files with 24 additions and 22 deletions
|
|
@ -500,29 +500,31 @@ async function LoadItems() {
|
||||||
`
|
`
|
||||||
document.getElementById('inventory').appendChild(ItemColumn)
|
document.getElementById('inventory').appendChild(ItemColumn)
|
||||||
|
|
||||||
ItemCache[item.id] = {
|
if (ItemCache[item.id] === undefined) {
|
||||||
type: item.type,
|
ItemCache[item.id] = {
|
||||||
name: item.name,
|
type: item.type,
|
||||||
price: item.price,
|
name: item.name,
|
||||||
creator: {
|
price: item.price,
|
||||||
name: item.creator.name,
|
creator: {
|
||||||
id: item.creator.id
|
name: item.creator.name,
|
||||||
},
|
id: item.creator.id
|
||||||
thumbnail: item.thumbnail,
|
},
|
||||||
asset: undefined
|
thumbnail: item.thumbnail,
|
||||||
}
|
asset: undefined
|
||||||
|
|
||||||
if (item.price === 0) {
|
|
||||||
if (item.sales === 0) {
|
|
||||||
console.log("ITEM IS AWARD-ONLY!!! ", item)
|
|
||||||
ItemCache[item.id].price = null
|
|
||||||
} else {
|
|
||||||
ItemCache[item.id].price = 0
|
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (item.type === 'hat') {
|
if (item.price === 0) {
|
||||||
ItemCache[item.id].accessoryType = item.accessoryType
|
if (item.sales === 0) {
|
||||||
|
console.log("ITEM IS AWARD-ONLY!!! ", item)
|
||||||
|
ItemCache[item.id].price = null
|
||||||
|
} else {
|
||||||
|
ItemCache[item.id].price = 0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item.type === 'hat') {
|
||||||
|
ItemCache[item.id].accessoryType = item.accessoryType
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ItemColumn.getElementsByClassName('p-2')[0].addEventListener('click', function(){
|
ItemColumn.getElementsByClassName('p-2')[0].addEventListener('click', function(){
|
||||||
|
|
|
||||||
Reference in a new issue