Update inventoryService.ts
All checks were successful
Build / build (22) (pull_request) Successful in 39s
Build / build (18) (pull_request) Successful in 59s
Build / build (20) (pull_request) Successful in 1m9s

This commit is contained in:
AMelonInsideLemon 2025-02-22 10:28:37 +01:00
parent 23f8818257
commit c69625e43d

View File

@ -379,8 +379,14 @@ export const addItem = async (
] ]
} }
}; };
} else {
const itemIndex = inventory.LevelKeys.findIndex(i => i.ItemType === typeName);
if (itemIndex !== -1) {
inventory.LevelKeys[itemIndex].ItemCount += quantity;
} else { } else {
inventory.LevelKeys.push({ ItemType: typeName, ItemCount: quantity }); inventory.LevelKeys.push({ ItemType: typeName, ItemCount: quantity });
}
return { return {
InventoryChanges: { InventoryChanges: {
LevelKeys: [ LevelKeys: [