fix: update slots where addEquipment is used #1207
@ -1,7 +1,7 @@
 | 
			
		||||
import { RequestHandler } from "express";
 | 
			
		||||
import { getAccountIdForRequest } from "@/src/services/loginService";
 | 
			
		||||
import { getInventory, addMiscItems, addEquipment } from "@/src/services/inventoryService";
 | 
			
		||||
import { IMiscItem, TFocusPolarity, TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
			
		||||
import { getInventory, addMiscItems, addEquipment, occupySlot } from "@/src/services/inventoryService";
 | 
			
		||||
import { IMiscItem, TFocusPolarity, TEquipmentKey, InventorySlot } from "@/src/types/inventoryTypes/inventoryTypes";
 | 
			
		||||
import { logger } from "@/src/utils/logger";
 | 
			
		||||
import { ExportFocusUpgrades } from "warframe-public-export-plus";
 | 
			
		||||
import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes";
 | 
			
		||||
@ -105,6 +105,7 @@ export const focusController: RequestHandler = async (req, res) => {
 | 
			
		||||
            ];
 | 
			
		||||
            const inventory = await getInventory(accountId);
 | 
			
		||||
            const inventoryChanges = addEquipment(inventory, "OperatorAmps", request.StartingWeaponType, parts);
 | 
			
		||||
            occupySlot(inventory, InventorySlot.AMPS, false);
 | 
			
		||||
            await inventory.save();
 | 
			
		||||
            res.json((inventoryChanges.OperatorAmps as IEquipmentClient[])[0]);
 | 
			
		||||
            break;
 | 
			
		||||
 | 
			
		||||
@ -7,9 +7,12 @@ import {
 | 
			
		||||
    updateCurrency,
 | 
			
		||||
    addEquipment,
 | 
			
		||||
    addMiscItems,
 | 
			
		||||
    applyDefaultUpgrades
 | 
			
		||||
    applyDefaultUpgrades,
 | 
			
		||||
    occupySlot,
 | 
			
		||||
    productCategoryToInventoryBin
 | 
			
		||||
} from "@/src/services/inventoryService";
 | 
			
		||||
import { ExportWeapons } from "warframe-public-export-plus";
 | 
			
		||||
import { IInventoryChanges } from "@/src/types/purchaseTypes";
 | 
			
		||||
 | 
			
		||||
const modularWeaponTypes: Record<string, TEquipmentKey> = {
 | 
			
		||||
    "/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);
 | 
			
		||||
 | 
			
		||||
    // 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
 | 
			
		||||
    const miscItemChanges = [];
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user