fix: add proper inventory slot costs
Some checks are pending
Build / build (pull_request) Blocked by required conditions

This commit is contained in:
Subsonic154 2025-07-07 16:06:24 -04:00
parent 1545cdb8ce
commit c5f3b3b587

View File

@ -21,13 +21,12 @@ import { logger } from "@/src/utils/logger";
export const inventorySlotsController: RequestHandler = async (req, res) => {
const accountId = await getAccountIdForRequest(req);
const body = JSON.parse(req.body as string) as IInventorySlotsRequest;
if (body.Bin != InventorySlot.SUITS && body.Bin != InventorySlot.PVE_LOADOUTS) {
logger.warn(`unexpected slot purchase of type ${body.Bin}, account may be overcharged`);
}
const slotCost = body.Bin == InventorySlot.SUITS || body.Bin == InventorySlot.MECHSUITS ||
body.Bin == InventorySlot.PVE_LOADOUTS || body.Bin == InventorySlot.CREWMEMBERS ? 20 : 12;
const inventory = await getInventory(accountId);
const currencyChanges = updateCurrency(inventory, 20, true);
const currencyChanges = updateCurrency(inventory, slotCost, true);
updateSlots(inventory, body.Bin, 1, 1);
await inventory.save();