fix: update slots where addEquipment is used
All checks were successful
Build / build (18) (push) Successful in 40s
Build / build (20) (push) Successful in 1m3s
Build / build (22) (push) Successful in 1m3s
Build / build (20) (pull_request) Successful in 37s
Build / build (18) (pull_request) Successful in 1m4s
Build / build (22) (pull_request) Successful in 1m1s

This commit is contained in:
Sainan 2025-03-15 21:35:55 +01:00
parent 7a52337af7
commit c1114b02e5
2 changed files with 11 additions and 4 deletions

View File

@ -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;

View File

@ -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 = [];