From 4443259724220639f21a3e2c843a75fab3821b69 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Mon, 8 Sep 2025 05:47:47 +0200 Subject: [PATCH] refresh inventory for infinite cheats --- src/controllers/custom/setAccountCheatController.ts | 4 ++++ static/webui/script.js | 4 ---- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/controllers/custom/setAccountCheatController.ts b/src/controllers/custom/setAccountCheatController.ts index 5a188777..07a1da4f 100644 --- a/src/controllers/custom/setAccountCheatController.ts +++ b/src/controllers/custom/setAccountCheatController.ts @@ -1,5 +1,6 @@ import { getInventory } from "../../services/inventoryService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; +import { sendWsBroadcastTo } from "../../services/wsService.ts"; import type { IAccountCheats } from "../../types/inventoryTypes/inventoryTypes.ts"; import type { RequestHandler } from "express"; @@ -10,6 +11,9 @@ export const setAccountCheatController: RequestHandler = async (req, res) => { inventory[payload.key] = payload.value; await inventory.save(); res.end(); + if (["infiniteCredits", "infinitePlatinum", "infiniteEndo", "infiniteRegalAya"].indexOf(payload.key) != -1) { + sendWsBroadcastTo(accountId, { update_inventory: true, sync_inventory: true }); + } }; interface ISetAccountCheatRequest { diff --git a/static/webui/script.js b/static/webui/script.js index d31ab4a8..9d15b4fe 100644 --- a/static/webui/script.js +++ b/static/webui/script.js @@ -2869,10 +2869,6 @@ for (const id of uiConfigs) { url: "/custom/setConfig?" + window.authz, contentType: "application/json", data: JSON.stringify({ [id]: this.checked }) - }).then(() => { - if (["infiniteCredits", "infinitePlatinum", "infiniteEndo", "infiniteRegalAya"].indexOf(id) != -1) { - updateInventory(); - } }); }; }