From b5e0712675c3abda863ea1d3b271c315082a8b8f Mon Sep 17 00:00:00 2001 From: Sainan Date: Sun, 29 Dec 2024 02:46:57 +0100 Subject: [PATCH] fix: exalted weapons should not be duplicated as they are shared (#645) --- src/services/inventoryService.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index 73acd669..78f4f219 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -431,8 +431,11 @@ export const addMechSuit = async (mechsuitName: string, accountId: string) => { return changedInventory.MechSuits[suitIndex - 1].toJSON(); }; -export const addSpecialItem = async (itemName: string, accountId: string) => { +export const addSpecialItem = async (itemName: string, accountId: string): Promise => { const inventory = await getInventory(accountId); + if (inventory.SpecialItems.find(x => x.ItemType == itemName)) { + return; + } const specialItemIndex = inventory.SpecialItems.push({ ItemType: itemName, Configs: [], @@ -441,7 +444,7 @@ export const addSpecialItem = async (itemName: string, accountId: string) => { XP: 0 }); const changedInventory = await inventory.save(); - return changedInventory.SpecialItems[specialItemIndex - 1].toJSON(); + return changedInventory.SpecialItems[specialItemIndex - 1].toJSON(); }; export const addSpaceSuit = async (spacesuitName: string, accountId: string) => {