From 2c2d90ba2329d4c822f1c258d31318df9d4f2de3 Mon Sep 17 00:00:00 2001 From: Sainan <63328889+Sainan@users.noreply.github.com> Date: Mon, 8 Sep 2025 05:39:40 +0200 Subject: [PATCH] make sure all webui options trigger respective inventory syncs --- src/controllers/api/artifactsController.ts | 2 ++ src/controllers/api/gildWeaponController.ts | 4 ++-- src/controllers/api/infestedFoundryController.ts | 2 ++ src/controllers/api/maturePetController.ts | 2 ++ src/controllers/api/modularWeaponCraftingController.ts | 4 ++-- src/controllers/api/nameWeaponController.ts | 4 ++-- src/controllers/api/releasePetController.ts | 4 ++-- src/controllers/api/renamePetController.ts | 4 ++-- src/controllers/api/setSupportedSyndicateController.ts | 2 ++ src/controllers/custom/abilityOverrideController.ts | 2 ++ src/controllers/custom/addCurrencyController.ts | 2 ++ src/controllers/custom/addItemsController.ts | 4 ++-- .../custom/addMissingHelminthBlueprintsController.ts | 2 ++ src/controllers/custom/addMissingMaxRankModsController.ts | 2 ++ src/controllers/custom/addXpController.ts | 4 ++-- src/controllers/custom/changeModularPartsController.ts | 2 ++ .../custom/editSuitInvigorationUpgradeController.ts | 2 ++ src/controllers/custom/importController.ts | 2 ++ src/controllers/custom/manageQuestsController.ts | 2 ++ src/controllers/custom/popArchonCrystalUpgradeController.ts | 2 ++ .../custom/pushArchonCrystalUpgradeController.ts | 2 ++ src/controllers/custom/setBoosterController.ts | 2 ++ src/controllers/custom/setEvolutionProgressController.ts | 2 ++ src/controllers/custom/unlockAllCapturaScenesController.ts | 6 ++++++ src/controllers/custom/unlockAllIntrinsicsController.ts | 2 ++ .../custom/unlockAllProfitTakerStagesController.ts | 2 ++ .../custom/unlockAllSimarisResearchEntriesController.ts | 2 ++ src/controllers/custom/updateFingerprintController.ts | 2 ++ 28 files changed, 60 insertions(+), 14 deletions(-) diff --git a/src/controllers/api/artifactsController.ts b/src/controllers/api/artifactsController.ts index 4fb2155d..362aa971 100644 --- a/src/controllers/api/artifactsController.ts +++ b/src/controllers/api/artifactsController.ts @@ -3,6 +3,7 @@ import { getAccountIdForRequest } from "../../services/loginService.ts"; import type { RequestHandler } from "express"; import type { IInventoryClient, IUpgradeClient } from "../../types/inventoryTypes/inventoryTypes.ts"; import { addMods, getInventory } from "../../services/inventoryService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; export const artifactsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -57,6 +58,7 @@ export const artifactsController: RequestHandler = async (req, res) => { } res.send(itemId); + broadcastInventoryUpdate(req); }; interface IArtifactsRequest { diff --git a/src/controllers/api/gildWeaponController.ts b/src/controllers/api/gildWeaponController.ts index 0bd921b3..dea62765 100644 --- a/src/controllers/api/gildWeaponController.ts +++ b/src/controllers/api/gildWeaponController.ts @@ -1,6 +1,6 @@ import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "../../services/loginService.ts"; -import { sendWsBroadcastTo } from "../../services/wsService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; import { getJSONfromString } from "../../helpers/stringHelpers.ts"; import { addMiscItems, getInventory } from "../../services/inventoryService.ts"; import type { TEquipmentKey } from "../../types/inventoryTypes/inventoryTypes.ts"; @@ -75,5 +75,5 @@ export const gildWeaponController: RequestHandler = async (req, res) => { InventoryChanges: inventoryChanges, AffiliationMods: affiliationMods }); - sendWsBroadcastTo(accountId, { update_inventory: true }); + broadcastInventoryUpdate(req); }; diff --git a/src/controllers/api/infestedFoundryController.ts b/src/controllers/api/infestedFoundryController.ts index de0b714e..27510f80 100644 --- a/src/controllers/api/infestedFoundryController.ts +++ b/src/controllers/api/infestedFoundryController.ts @@ -20,6 +20,7 @@ import { applyCheatsToInfestedFoundry, handleSubsumeCompletion } from "../../services/infestedFoundryService.ts"; +import { sendWsBroadcastTo } from "../../services/wsService.ts"; export const infestedFoundryController: RequestHandler = async (req, res) => { const account = await getAccountForRequest(req); @@ -363,6 +364,7 @@ export const infestedFoundryController: RequestHandler = async (req, res) => { ); addRecipes(inventory, recipeChanges); await inventory.save(); + sendWsBroadcastTo(account._id.toString(), { sync_inventory: true }); } res.end(); break; diff --git a/src/controllers/api/maturePetController.ts b/src/controllers/api/maturePetController.ts index 9ddc2786..38c59523 100644 --- a/src/controllers/api/maturePetController.ts +++ b/src/controllers/api/maturePetController.ts @@ -2,6 +2,7 @@ import { getJSONfromString } from "../../helpers/stringHelpers.ts"; import { getInventory } from "../../services/inventoryService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import type { RequestHandler } from "express"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; export const maturePetController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -19,6 +20,7 @@ export const maturePetController: RequestHandler = async (req, res) => { : [details.DominantTraits.FurPattern, details.DominantTraits.FurPattern, details.DominantTraits.FurPattern], unmature: data.revert }); + broadcastInventoryUpdate(req); }; interface IMaturePetRequest { diff --git a/src/controllers/api/modularWeaponCraftingController.ts b/src/controllers/api/modularWeaponCraftingController.ts index 7e235241..52559fb8 100644 --- a/src/controllers/api/modularWeaponCraftingController.ts +++ b/src/controllers/api/modularWeaponCraftingController.ts @@ -1,6 +1,6 @@ import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "../../services/loginService.ts"; -import { sendWsBroadcastTo } from "../../services/wsService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; import { getJSONfromString } from "../../helpers/stringHelpers.ts"; import { getInventory, @@ -197,5 +197,5 @@ export const modularWeaponCraftingController: RequestHandler = async (req, res) MiscItems: miscItemChanges } }); - sendWsBroadcastTo(accountId, { update_inventory: true }); + broadcastInventoryUpdate(req); }; diff --git a/src/controllers/api/nameWeaponController.ts b/src/controllers/api/nameWeaponController.ts index ece87fef..aecf7ea6 100644 --- a/src/controllers/api/nameWeaponController.ts +++ b/src/controllers/api/nameWeaponController.ts @@ -3,7 +3,7 @@ import { getAccountIdForRequest } from "../../services/loginService.ts"; import { getInventory, updateCurrency } from "../../services/inventoryService.ts"; import { getJSONfromString } from "../../helpers/stringHelpers.ts"; import type { TEquipmentKey } from "../../types/inventoryTypes/inventoryTypes.ts"; -import { sendWsBroadcastTo } from "../../services/wsService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; interface INameWeaponRequest { ItemName: string; @@ -28,5 +28,5 @@ export const nameWeaponController: RequestHandler = async (req, res) => { res.json({ InventoryChanges: currencyChanges }); - sendWsBroadcastTo(accountId, { update_inventory: true }); + broadcastInventoryUpdate(req); }; diff --git a/src/controllers/api/releasePetController.ts b/src/controllers/api/releasePetController.ts index fb707b7a..f034f731 100644 --- a/src/controllers/api/releasePetController.ts +++ b/src/controllers/api/releasePetController.ts @@ -1,7 +1,7 @@ import { getJSONfromString } from "../../helpers/stringHelpers.ts"; import { getInventory, updateCurrency } from "../../services/inventoryService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; -import { sendWsBroadcastTo } from "../../services/wsService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; import type { RequestHandler } from "express"; export const releasePetController: RequestHandler = async (req, res) => { @@ -20,7 +20,7 @@ export const releasePetController: RequestHandler = async (req, res) => { await inventory.save(); res.json({ inventoryChanges }); // Not a mistake; it's "inventoryChanges" here. - sendWsBroadcastTo(accountId, { update_inventory: true }); + broadcastInventoryUpdate(req); }; interface IReleasePetRequest { diff --git a/src/controllers/api/renamePetController.ts b/src/controllers/api/renamePetController.ts index d1f0cc3b..73e54172 100644 --- a/src/controllers/api/renamePetController.ts +++ b/src/controllers/api/renamePetController.ts @@ -1,7 +1,7 @@ import { getJSONfromString } from "../../helpers/stringHelpers.ts"; import { getInventory, updateCurrency } from "../../services/inventoryService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; -import { sendWsBroadcastTo } from "../../services/wsService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; import type { IInventoryChanges } from "../../types/purchaseTypes.ts"; import type { RequestHandler } from "express"; @@ -23,7 +23,7 @@ export const renamePetController: RequestHandler = async (req, res) => { ...data, inventoryChanges: inventoryChanges }); - sendWsBroadcastTo(accountId, { update_inventory: true }); + broadcastInventoryUpdate(req); }; interface IRenamePetRequest { diff --git a/src/controllers/api/setSupportedSyndicateController.ts b/src/controllers/api/setSupportedSyndicateController.ts index 53db10b9..8357f424 100644 --- a/src/controllers/api/setSupportedSyndicateController.ts +++ b/src/controllers/api/setSupportedSyndicateController.ts @@ -1,6 +1,7 @@ import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import { Inventory } from "../../models/inventoryModels/inventoryModel.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; export const setSupportedSyndicateController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -15,4 +16,5 @@ export const setSupportedSyndicateController: RequestHandler = async (req, res) ); res.end(); + broadcastInventoryUpdate(req); }; diff --git a/src/controllers/custom/abilityOverrideController.ts b/src/controllers/custom/abilityOverrideController.ts index 47b7e13a..135e0eb9 100644 --- a/src/controllers/custom/abilityOverrideController.ts +++ b/src/controllers/custom/abilityOverrideController.ts @@ -1,5 +1,6 @@ import { getInventory } from "../../services/inventoryService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; import type { TEquipmentKey } from "../../types/inventoryTypes/inventoryTypes.ts"; import type { RequestHandler } from "express"; @@ -19,6 +20,7 @@ export const abilityOverrideController: RequestHandler = async (req, res) => { } } res.end(); + broadcastInventoryUpdate(req); }; interface IAbilityOverrideRequest { diff --git a/src/controllers/custom/addCurrencyController.ts b/src/controllers/custom/addCurrencyController.ts index dd7f472b..60ff9968 100644 --- a/src/controllers/custom/addCurrencyController.ts +++ b/src/controllers/custom/addCurrencyController.ts @@ -1,6 +1,7 @@ import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import { addFusionPoints, getInventory } from "../../services/inventoryService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; export const addCurrencyController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -13,6 +14,7 @@ export const addCurrencyController: RequestHandler = async (req, res) => { } await inventory.save(); res.end(); + broadcastInventoryUpdate(req); }; interface IAddCurrencyRequest { diff --git a/src/controllers/custom/addItemsController.ts b/src/controllers/custom/addItemsController.ts index 203e648c..4add37ac 100644 --- a/src/controllers/custom/addItemsController.ts +++ b/src/controllers/custom/addItemsController.ts @@ -1,7 +1,7 @@ import { getAccountIdForRequest } from "../../services/loginService.ts"; import { getInventory, addItem } from "../../services/inventoryService.ts"; import type { RequestHandler } from "express"; -import { sendWsBroadcastTo } from "../../services/wsService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; export const addItemsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -10,9 +10,9 @@ export const addItemsController: RequestHandler = async (req, res) => { for (const request of requests) { await addItem(inventory, request.ItemType, request.ItemCount, true, undefined, request.Fingerprint, true); } - sendWsBroadcastTo(accountId, { sync_inventory: true }); await inventory.save(); res.end(); + broadcastInventoryUpdate(req); }; interface IAddItemRequest { diff --git a/src/controllers/custom/addMissingHelminthBlueprintsController.ts b/src/controllers/custom/addMissingHelminthBlueprintsController.ts index 27f6dec8..3aae37a3 100644 --- a/src/controllers/custom/addMissingHelminthBlueprintsController.ts +++ b/src/controllers/custom/addMissingHelminthBlueprintsController.ts @@ -2,6 +2,7 @@ import { getAccountIdForRequest } from "../../services/loginService.ts"; import { getInventory, addRecipes } from "../../services/inventoryService.ts"; import type { RequestHandler } from "express"; import { ExportRecipes } from "warframe-public-export-plus"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; export const addMissingHelminthBlueprintsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -21,4 +22,5 @@ export const addMissingHelminthBlueprintsController: RequestHandler = async (req await inventory.save(); res.end(); + broadcastInventoryUpdate(req); }; diff --git a/src/controllers/custom/addMissingMaxRankModsController.ts b/src/controllers/custom/addMissingMaxRankModsController.ts index 46a299a3..ddff0cf7 100644 --- a/src/controllers/custom/addMissingMaxRankModsController.ts +++ b/src/controllers/custom/addMissingMaxRankModsController.ts @@ -2,6 +2,7 @@ import { getInventory } from "../../services/inventoryService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import type { RequestHandler } from "express"; import { ExportArcanes, ExportUpgrades } from "warframe-public-export-plus"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; export const addMissingMaxRankModsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -41,4 +42,5 @@ export const addMissingMaxRankModsController: RequestHandler = async (req, res) await inventory.save(); res.end(); + broadcastInventoryUpdate(req); }; diff --git a/src/controllers/custom/addXpController.ts b/src/controllers/custom/addXpController.ts index 6c89bc7c..7ca1d2d9 100644 --- a/src/controllers/custom/addXpController.ts +++ b/src/controllers/custom/addXpController.ts @@ -1,6 +1,6 @@ import { applyClientEquipmentUpdates, getInventory } from "../../services/inventoryService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; -import { sendWsBroadcastTo } from "../../services/wsService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; import type { IOid } from "../../types/commonTypes.ts"; import type { IEquipmentClient } from "../../types/equipmentTypes.ts"; import type { TEquipmentKey } from "../../types/inventoryTypes/inventoryTypes.ts"; @@ -24,9 +24,9 @@ export const addXpController: RequestHandler = async (req, res) => { } applyClientEquipmentUpdates(inventory, gear, category as TEquipmentKey); } - sendWsBroadcastTo(accountId, { sync_inventory: true }); await inventory.save(); res.end(); + broadcastInventoryUpdate(req); }; type IAddXpRequest = { diff --git a/src/controllers/custom/changeModularPartsController.ts b/src/controllers/custom/changeModularPartsController.ts index df63da13..32e17fda 100644 --- a/src/controllers/custom/changeModularPartsController.ts +++ b/src/controllers/custom/changeModularPartsController.ts @@ -1,5 +1,6 @@ import { getInventory } from "../../services/inventoryService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; import type { TEquipmentKey } from "../../types/inventoryTypes/inventoryTypes.ts"; import type { RequestHandler } from "express"; @@ -20,6 +21,7 @@ export const changeModularPartsController: RequestHandler = async (req, res) => await inventory.save(); } res.end(); + broadcastInventoryUpdate(req); }; interface IUpdateFingerPrintRequest { diff --git a/src/controllers/custom/editSuitInvigorationUpgradeController.ts b/src/controllers/custom/editSuitInvigorationUpgradeController.ts index 200b403a..713b1c0e 100644 --- a/src/controllers/custom/editSuitInvigorationUpgradeController.ts +++ b/src/controllers/custom/editSuitInvigorationUpgradeController.ts @@ -1,6 +1,7 @@ import { getAccountIdForRequest } from "../../services/loginService.ts"; import { getInventory } from "../../services/inventoryService.ts"; import type { RequestHandler } from "express"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; const DEFAULT_UPGRADE_EXPIRY_MS = 7 * 24 * 60 * 60 * 1000; // 7 days @@ -31,4 +32,5 @@ export const editSuitInvigorationUpgradeController: RequestHandler = async (req, } await inventory.save(); res.end(); + broadcastInventoryUpdate(req); }; diff --git a/src/controllers/custom/importController.ts b/src/controllers/custom/importController.ts index 02528e64..1dda3189 100644 --- a/src/controllers/custom/importController.ts +++ b/src/controllers/custom/importController.ts @@ -3,6 +3,7 @@ import { getInventory } from "../../services/inventoryService.ts"; import { getLoadout } from "../../services/loadoutService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import { getPersonalRooms } from "../../services/personalRoomsService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; import type { IInventoryClient } from "../../types/inventoryTypes/inventoryTypes.ts"; import type { IGetShipResponse } from "../../types/personalRoomsTypes.ts"; import type { RequestHandler } from "express"; @@ -32,6 +33,7 @@ export const importController: RequestHandler = async (req, res) => { } res.end(); + broadcastInventoryUpdate(req); }; interface IImportRequest { diff --git a/src/controllers/custom/manageQuestsController.ts b/src/controllers/custom/manageQuestsController.ts index 4c7d614d..b1cbde84 100644 --- a/src/controllers/custom/manageQuestsController.ts +++ b/src/controllers/custom/manageQuestsController.ts @@ -9,6 +9,7 @@ import { import { logger } from "../../utils/logger.ts"; import type { RequestHandler } from "express"; import { ExportKeys } from "warframe-public-export-plus"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; export const manageQuestsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -157,4 +158,5 @@ export const manageQuestsController: RequestHandler = async (req, res) => { await inventory.save(); res.status(200).end(); + broadcastInventoryUpdate(req); }; diff --git a/src/controllers/custom/popArchonCrystalUpgradeController.ts b/src/controllers/custom/popArchonCrystalUpgradeController.ts index 2d5e40b9..9fdb12ff 100644 --- a/src/controllers/custom/popArchonCrystalUpgradeController.ts +++ b/src/controllers/custom/popArchonCrystalUpgradeController.ts @@ -1,6 +1,7 @@ import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import { getInventory } from "../../services/inventoryService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; export const popArchonCrystalUpgradeController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -12,6 +13,7 @@ export const popArchonCrystalUpgradeController: RequestHandler = async (req, res ); await inventory.save(); res.end(); + broadcastInventoryUpdate(req); return; } res.status(400).end(); diff --git a/src/controllers/custom/pushArchonCrystalUpgradeController.ts b/src/controllers/custom/pushArchonCrystalUpgradeController.ts index 6eb7276e..aae46b31 100644 --- a/src/controllers/custom/pushArchonCrystalUpgradeController.ts +++ b/src/controllers/custom/pushArchonCrystalUpgradeController.ts @@ -1,6 +1,7 @@ import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import { getInventory } from "../../services/inventoryService.ts"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; export const pushArchonCrystalUpgradeController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -15,6 +16,7 @@ export const pushArchonCrystalUpgradeController: RequestHandler = async (req, re } await inventory.save(); res.end(); + broadcastInventoryUpdate(req); return; } } diff --git a/src/controllers/custom/setBoosterController.ts b/src/controllers/custom/setBoosterController.ts index 756aad98..b3109a2e 100644 --- a/src/controllers/custom/setBoosterController.ts +++ b/src/controllers/custom/setBoosterController.ts @@ -2,6 +2,7 @@ import { getAccountIdForRequest } from "../../services/loginService.ts"; import { getInventory } from "../../services/inventoryService.ts"; import type { RequestHandler } from "express"; import { ExportBoosters } from "warframe-public-export-plus"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; const I32_MAX = 0x7fffffff; @@ -42,4 +43,5 @@ export const setBoosterController: RequestHandler = async (req, res) => { } await inventory.save(); res.end(); + broadcastInventoryUpdate(req); }; diff --git a/src/controllers/custom/setEvolutionProgressController.ts b/src/controllers/custom/setEvolutionProgressController.ts index c68ccaff..2c6a28a7 100644 --- a/src/controllers/custom/setEvolutionProgressController.ts +++ b/src/controllers/custom/setEvolutionProgressController.ts @@ -1,6 +1,7 @@ import { getInventory } from "../../services/inventoryService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import type { RequestHandler } from "express"; +import { broadcastInventoryUpdate } from "../../services/wsService.ts"; export const setEvolutionProgressController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -25,6 +26,7 @@ export const setEvolutionProgressController: RequestHandler = async (req, res) = await inventory.save(); res.end(); + broadcastInventoryUpdate(req); }; type ISetEvolutionProgressRequest = { diff --git a/src/controllers/custom/unlockAllCapturaScenesController.ts b/src/controllers/custom/unlockAllCapturaScenesController.ts index 45dffcf0..7565ffa2 100644 --- a/src/controllers/custom/unlockAllCapturaScenesController.ts +++ b/src/controllers/custom/unlockAllCapturaScenesController.ts @@ -2,19 +2,25 @@ import type { RequestHandler } from "express"; import { ExportResources, ExportVirtuals } from "warframe-public-export-plus"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import { addItem, getInventory } from "../../services/inventoryService.ts"; +import { sendWsBroadcastTo } from "../../services/wsService.ts"; export const unlockAllCapturaScenesController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); const inventory = await getInventory(accountId); + let needSync = false; for (const uniqueName of Object.keys(ExportResources)) { if (resourceInheritsFrom(uniqueName, "/Lotus/Types/Items/MiscItems/PhotoboothTile")) { await addItem(inventory, uniqueName, 1); + needSync = true; } } await inventory.save(); res.end(); + if (needSync) { + sendWsBroadcastTo(accountId, { sync_inventory: true }); + } }; const resourceInheritsFrom = (resourceName: string, targetName: string): boolean => { diff --git a/src/controllers/custom/unlockAllIntrinsicsController.ts b/src/controllers/custom/unlockAllIntrinsicsController.ts index 8dd484ce..ad7fc107 100644 --- a/src/controllers/custom/unlockAllIntrinsicsController.ts +++ b/src/controllers/custom/unlockAllIntrinsicsController.ts @@ -1,6 +1,7 @@ import { getInventory } from "../../services/inventoryService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import type { RequestHandler } from "express"; +import { sendWsBroadcastTo } from "../../services/wsService.ts"; export const unlockAllIntrinsicsController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -16,4 +17,5 @@ export const unlockAllIntrinsicsController: RequestHandler = async (req, res) => inventory.PlayerSkills.LPS_DRIFT_ENDURANCE = 10; await inventory.save(); res.end(); + sendWsBroadcastTo(accountId, { sync_inventory: true }); }; diff --git a/src/controllers/custom/unlockAllProfitTakerStagesController.ts b/src/controllers/custom/unlockAllProfitTakerStagesController.ts index 79fe3b87..4c362d3d 100644 --- a/src/controllers/custom/unlockAllProfitTakerStagesController.ts +++ b/src/controllers/custom/unlockAllProfitTakerStagesController.ts @@ -1,6 +1,7 @@ import { getInventory } from "../../services/inventoryService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import type { RequestHandler } from "express"; +import { sendWsBroadcastTo } from "../../services/wsService.ts"; const allEudicoHeistJobs = [ "/Lotus/Types/Gameplay/Venus/Jobs/Heists/HeistProfitTakerBountyOne", @@ -21,4 +22,5 @@ export const unlockAllProfitTakerStagesController: RequestHandler = async (req, } await inventory.save(); res.end(); + sendWsBroadcastTo(accountId, { sync_inventory: true }); }; diff --git a/src/controllers/custom/unlockAllSimarisResearchEntriesController.ts b/src/controllers/custom/unlockAllSimarisResearchEntriesController.ts index fae3c55d..a12626dd 100644 --- a/src/controllers/custom/unlockAllSimarisResearchEntriesController.ts +++ b/src/controllers/custom/unlockAllSimarisResearchEntriesController.ts @@ -1,6 +1,7 @@ import type { RequestHandler } from "express"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import { getInventory } from "../../services/inventoryService.ts"; +import { sendWsBroadcastTo } from "../../services/wsService.ts"; export const unlockAllSimarisResearchEntriesController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -17,4 +18,5 @@ export const unlockAllSimarisResearchEntriesController: RequestHandler = async ( ].map(type => ({ TargetType: type, Scans: 10, Completed: true })); await inventory.save(); res.end(); + sendWsBroadcastTo(accountId, { sync_inventory: true }); }; diff --git a/src/controllers/custom/updateFingerprintController.ts b/src/controllers/custom/updateFingerprintController.ts index f600b578..48e83c85 100644 --- a/src/controllers/custom/updateFingerprintController.ts +++ b/src/controllers/custom/updateFingerprintController.ts @@ -2,6 +2,7 @@ import { getInventory } from "../../services/inventoryService.ts"; import type { WeaponTypeInternal } from "../../services/itemDataService.ts"; import { getAccountIdForRequest } from "../../services/loginService.ts"; import type { RequestHandler } from "express"; +import { sendWsBroadcastTo } from "../../services/wsService.ts"; export const updateFingerprintController: RequestHandler = async (req, res) => { const accountId = await getAccountIdForRequest(req); @@ -22,6 +23,7 @@ export const updateFingerprintController: RequestHandler = async (req, res) => { await inventory.save(); } res.end(); + sendWsBroadcastTo(accountId, { sync_inventory: true }); }; interface IUpdateFingerPrintRequest {