XFE Git
XFE Studio Git
Git 首页 全局搜索
XFE 主站 文档 NuGet

SpaceNinjaServer

A simple server for a small space ninja game

公开
关注 0 Fork 1 Star 0
UTF-8
import { getInventory, updateCurrency } from "../../services/inventoryService.ts";
import { getAccountIdForRequest } from "../../services/loginService.ts";
import type { RequestHandler } from "express";

export const upgradeOperatorController: RequestHandler = async (req, res) => {
    const accountId = await getAccountIdForRequest(req);
    const inventory = await getInventory(
        accountId,
        "OperatorCustomizationSlotPurchases PremiumCredits PremiumCreditsFree"
    );
    inventory.OperatorCustomizationSlotPurchases ??= 0;
    inventory.OperatorCustomizationSlotPurchases += 1;
    const inventoryChanges = updateCurrency(inventory, 10, true);
    await inventory.save();
    res.json({ InventoryChanges: inventoryChanges });
};