From c1fcd3042ee064c664a3bf934d4609220d010ab6 Mon Sep 17 00:00:00 2001 From: Sainan Date: Tue, 4 Feb 2025 03:22:37 -0800 Subject: [PATCH] feat(webui): ensure forma count of at least 5 when max ranking item (#893) Closes #889 Reviewed-on: http://209.141.38.3/OpenWF/SpaceNinjaServer/pulls/893 --- src/controllers/custom/addXpController.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/controllers/custom/addXpController.ts b/src/controllers/custom/addXpController.ts index d624388e..7cb284fe 100644 --- a/src/controllers/custom/addXpController.ts +++ b/src/controllers/custom/addXpController.ts @@ -3,12 +3,23 @@ import { getAccountIdForRequest } from "@/src/services/loginService"; import { IEquipmentClient } from "@/src/types/inventoryTypes/commonInventoryTypes"; import { TEquipmentKey } from "@/src/types/inventoryTypes/inventoryTypes"; import { RequestHandler } from "express"; +import { ExportMisc } from "warframe-public-export-plus"; export const addXpController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); const inventory = await getInventory(accountId); const request = req.body as IAddXpRequest; for (const [category, gear] of Object.entries(request)) { + for (const clientItem of gear) { + const dbItem = inventory[category as TEquipmentKey].id(clientItem.ItemId.$oid); + if (dbItem) { + if (dbItem.ItemType in ExportMisc.uniqueLevelCaps) { + if ((dbItem.Polarized ?? 0) < 5) { + dbItem.Polarized = 5; + } + } + } + } addGearExpByCategory(inventory, gear, category as TEquipmentKey); } await inventory.save();