From f56c451827b90c7cd64112e00b303fb4d349a608 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Mon, 31 Mar 2025 14:18:07 +0200 Subject: [PATCH] mechsuits as well --- src/services/inventoryService.ts | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/src/services/inventoryService.ts b/src/services/inventoryService.ts index 96203345..61794438 100644 --- a/src/services/inventoryService.ts +++ b/src/services/inventoryService.ts @@ -506,12 +506,12 @@ export const addItem = async ( } case "EntratiMech": { return { - ...addMechSuit( + ...(await addMechSuit( inventory, typeName, {}, premiumPurchase ? EquipmentFeatures.DOUBLE_CAPACITY : undefined - ), + )), ...occupySlot(inventory, InventorySlot.MECHSUITS, premiumPurchase) }; } @@ -731,16 +731,22 @@ export const addPowerSuit = async ( return inventoryChanges; }; -export const addMechSuit = ( +export const addMechSuit = async ( inventory: TInventoryDatabaseDocument, mechsuitName: string, inventoryChanges: IInventoryChanges = {}, features: number | undefined = undefined -): IInventoryChanges => { +): Promise => { const powersuit = ExportWarframes[mechsuitName] as IPowersuit | undefined; - if (powersuit?.exalted) { - for (const specialItem of powersuit.exalted) { - addSpecialItem(inventory, specialItem, inventoryChanges); + const exalted = powersuit?.exalted ?? []; + for (const specialItem of exalted) { + addSpecialItem(inventory, specialItem, inventoryChanges); + } + if (powersuit?.additionalItems) { + for (const item of powersuit.additionalItems) { + if (exalted.indexOf(item) == -1) { + combineInventoryChanges(inventoryChanges, await addItem(inventory, item, 1)); + } } } const suitIndex =