From c577ef3bf2b14aef25b1272ae438f0a502d700f3 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Thu, 29 May 2025 11:18:50 +0200 Subject: [PATCH] subtract platinum --- src/controllers/api/renamePetController.ts | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/controllers/api/renamePetController.ts b/src/controllers/api/renamePetController.ts index 9dc07d55..6672d064 100644 --- a/src/controllers/api/renamePetController.ts +++ b/src/controllers/api/renamePetController.ts @@ -1,16 +1,20 @@ import { getJSONfromString } from "@/src/helpers/stringHelpers"; -import { getInventory } from "@/src/services/inventoryService"; +import { getInventory, updateCurrency } from "@/src/services/inventoryService"; import { getAccountIdForRequest } from "@/src/services/loginService"; import { RequestHandler } from "express"; export const renamePetController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); - const inventory = await getInventory(accountId, "KubrowPets"); + const inventory = await getInventory(accountId, "KubrowPets PremiumCredits PremiumCreditsFree"); const data = getJSONfromString(String(req.body)); const details = inventory.KubrowPets.id(data.petId)!.Details!; details.Name = data.name; + const currencyChanges = updateCurrency(inventory, 15, true); await inventory.save(); - res.json(data); + res.json({ + ...data, + inventoryChanges: currencyChanges + }); }; interface IRenamePetRequest {