fix: update slots where addEquipment is used #1207
@ -1,7 +1,7 @@
 | 
				
			|||||||
import { RequestHandler } from "express";
 | 
					import { RequestHandler } from "express";
 | 
				
			||||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
					import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
				
			||||||
import { getInventory, addMiscItems, addEquipment } from "@/src/services/inventoryService";
 | 
					import { getInventory, addMiscItems, addEquipment, occupySlot } from "@/src/services/inventoryService";
 | 
				
			||||||
import { IMiscItem, TFocusPolarity, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
					import { IMiscItem, TFocusPolarity, TEquipmentKey, InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
				
			||||||
import { logger } from "@/src/utils/logger";
 | 
					import { logger } from "@/src/utils/logger";
 | 
				
			||||||
import { ExportFocusUpgrades } from "warframe-public-export-plus";
 | 
					import { ExportFocusUpgrades } from "warframe-public-export-plus";
 | 
				
			||||||
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
					import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
				
			||||||
@ -105,6 +105,7 @@ export const focusController: RequestHandler = async (req, res) => {
 | 
				
			|||||||
            ];
 | 
					            ];
 | 
				
			||||||
            const inventory = await getInventory(accountId);
 | 
					            const inventory = await getInventory(accountId);
 | 
				
			||||||
            const inventoryChanges = addEquipment(inventory, "OperatorAmps", request.StartingWeaponType, parts);
 | 
					            const inventoryChanges = addEquipment(inventory, "OperatorAmps", request.StartingWeaponType, parts);
 | 
				
			||||||
 | 
					            occupySlot(inventory, InventorySlot.AMPS, false);
 | 
				
			||||||
            await inventory.save();
 | 
					            await inventory.save();
 | 
				
			||||||
            res.json((inventoryChanges.OperatorAmps as IEquipmentClient[])[0]);
 | 
					            res.json((inventoryChanges.OperatorAmps as IEquipmentClient[])[0]);
 | 
				
			||||||
            break;
 | 
					            break;
 | 
				
			||||||
 | 
				
			|||||||
@ -7,9 +7,12 @@ import {
 | 
				
			|||||||
    updateCurrency,
 | 
					    updateCurrency,
 | 
				
			||||||
    addEquipment,
 | 
					    addEquipment,
 | 
				
			||||||
    addMiscItems,
 | 
					    addMiscItems,
 | 
				
			||||||
    applyDefaultUpgrades
 | 
					    applyDefaultUpgrades,
 | 
				
			||||||
 | 
					    occupySlot,
 | 
				
			||||||
 | 
					    productCategoryToInventoryBin
 | 
				
			||||||
} from "@/src/services/inventoryService";
 | 
					} from "@/src/services/inventoryService";
 | 
				
			||||||
import { ExportWeapons } from "warframe-public-export-plus";
 | 
					import { ExportWeapons } from "warframe-public-export-plus";
 | 
				
			||||||
 | 
					import { IInventoryChanges } from "@/src/types/purchaseTypes";
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const modularWeaponTypes: Record<string, TEquipmentKey> = {
 | 
					const modularWeaponTypes: Record<string, TEquipmentKey> = {
 | 
				
			||||||
    "/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimary": "LongGuns",
 | 
					    "/Lotus/Weapons/SolarisUnited/Primary/LotusModularPrimary": "LongGuns",
 | 
				
			||||||
@ -47,7 +50,10 @@ export const modularWeaponCraftingController: RequestHandler = async (req, res)
 | 
				
			|||||||
    const configs = applyDefaultUpgrades(inventory, ExportWeapons[data.Parts[0]]?.defaultUpgrades);
 | 
					    const configs = applyDefaultUpgrades(inventory, ExportWeapons[data.Parts[0]]?.defaultUpgrades);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Give weapon
 | 
					    // Give weapon
 | 
				
			||||||
    const inventoryChanges = addEquipment(inventory, category, data.WeaponType, data.Parts, {}, { Configs: configs });
 | 
					    const inventoryChanges: IInventoryChanges = {
 | 
				
			||||||
 | 
					        ...addEquipment(inventory, category, data.WeaponType, data.Parts, {}, { Configs: configs }),
 | 
				
			||||||
 | 
					        ...occupySlot(inventory, productCategoryToInventoryBin(category)!, false)
 | 
				
			||||||
 | 
					    };
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Remove credits & parts
 | 
					    // Remove credits & parts
 | 
				
			||||||
    const miscItemChanges = [];
 | 
					    const miscItemChanges = [];
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user