From fea17cf3dba3fe3a9c3c301b570a4df90e545bd5 Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 10 Feb 2024 16:32:37 +0000 Subject: [PATCH] Pass output into more event functions --- project/src/callbacks/InventoryCallbacks.ts | 12 ++++++++---- project/src/controllers/InventoryController.ts | 9 ++++----- .../routers/item_events/InventoryItemEventRouter.ts | 8 ++++---- 3 files changed, 16 insertions(+), 13 deletions(-) diff --git a/project/src/callbacks/InventoryCallbacks.ts b/project/src/callbacks/InventoryCallbacks.ts index 281beab3..d3c0e3fa 100644 --- a/project/src/callbacks/InventoryCallbacks.ts +++ b/project/src/callbacks/InventoryCallbacks.ts @@ -155,27 +155,30 @@ export class InventoryCallbacks pmcData: IPmcData, body: IInventoryCreateMarkerRequestData, sessionID: string, + output: IItemEventRouterResponse, ): IItemEventRouterResponse { - return this.inventoryController.createMapMarker(pmcData, body, sessionID); + return this.inventoryController.createMapMarker(pmcData, body, sessionID, output); } public deleteMapMarker( pmcData: IPmcData, body: IInventoryDeleteMarkerRequestData, sessionID: string, + output: IItemEventRouterResponse, ): IItemEventRouterResponse { - return this.inventoryController.deleteMapMarker(pmcData, body, sessionID); + return this.inventoryController.deleteMapMarker(pmcData, body, sessionID, output); } public editMapMarker( pmcData: IPmcData, body: IInventoryEditMarkerRequestData, sessionID: string, + output: IItemEventRouterResponse, ): IItemEventRouterResponse { - return this.inventoryController.editMapMarker(pmcData, body, sessionID); + return this.inventoryController.editMapMarker(pmcData, body, sessionID, output); } /** Handle OpenRandomLootContainer */ @@ -183,9 +186,10 @@ export class InventoryCallbacks pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, + output: IItemEventRouterResponse, ): IItemEventRouterResponse { - return this.inventoryController.openRandomLootContainer(pmcData, body, sessionID); + return this.inventoryController.openRandomLootContainer(pmcData, body, sessionID, output); } public redeemProfileReward( diff --git a/project/src/controllers/InventoryController.ts b/project/src/controllers/InventoryController.ts index 09362296..e9580b4e 100644 --- a/project/src/controllers/InventoryController.ts +++ b/project/src/controllers/InventoryController.ts @@ -812,6 +812,7 @@ export class InventoryController pmcData: IPmcData, request: IInventoryCreateMarkerRequestData, sessionID: string, + output: IItemEventRouterResponse, ): IItemEventRouterResponse { // Get map from inventory @@ -823,7 +824,6 @@ export class InventoryController mapItem.upd.Map.Markers.push(request.mapMarker); // sync with client - const output = this.eventOutputHolder.getOutput(sessionID); output.profileChanges[sessionID].items.change.push(mapItem); return output; @@ -840,6 +840,7 @@ export class InventoryController pmcData: IPmcData, request: IInventoryDeleteMarkerRequestData, sessionID: string, + output: IItemEventRouterResponse, ): IItemEventRouterResponse { // Get map from inventory @@ -853,7 +854,6 @@ export class InventoryController mapItem.upd.Map.Markers = markers; // sync with client - const output = this.eventOutputHolder.getOutput(sessionID); output.profileChanges[sessionID].items.change.push(mapItem); return output; } @@ -869,6 +869,7 @@ export class InventoryController pmcData: IPmcData, request: IInventoryEditMarkerRequestData, sessionID: string, + output: IItemEventRouterResponse, ): IItemEventRouterResponse { // Get map from inventory @@ -880,7 +881,6 @@ export class InventoryController mapItem.upd.Map.Markers[indexOfExistingNote] = request.mapMarker; // sync with client - const output = this.eventOutputHolder.getOutput(sessionID); output.profileChanges[sessionID].items.change.push(mapItem); return output; @@ -908,10 +908,9 @@ export class InventoryController pmcData: IPmcData, body: IOpenRandomLootContainerRequestData, sessionID: string, + output: IItemEventRouterResponse, ): IItemEventRouterResponse { - const output = this.eventOutputHolder.getOutput(sessionID); - /** Container player opened in their inventory */ const openedItem = pmcData.Inventory.items.find((item) => item._id === body.item); const containerDetailsDb = this.itemHelper.getItem(openedItem._tpl); diff --git a/project/src/routers/item_events/InventoryItemEventRouter.ts b/project/src/routers/item_events/InventoryItemEventRouter.ts index c2e9a9a1..dce3c28e 100644 --- a/project/src/routers/item_events/InventoryItemEventRouter.ts +++ b/project/src/routers/item_events/InventoryItemEventRouter.ts @@ -85,13 +85,13 @@ export class InventoryItemEventRouter extends ItemEventRouterDefinition case ItemEventActions.APPLY_INVENTORY_CHANGES: return this.inventoryCallbacks.sortInventory(pmcData, body, sessionID); case ItemEventActions.CREATE_MAP_MARKER: - return this.inventoryCallbacks.createMapMarker(pmcData, body, sessionID); + return this.inventoryCallbacks.createMapMarker(pmcData, body, sessionID, output); case ItemEventActions.DELETE_MAP_MARKER: - return this.inventoryCallbacks.deleteMapMarker(pmcData, body, sessionID); + return this.inventoryCallbacks.deleteMapMarker(pmcData, body, sessionID, output); case ItemEventActions.EDIT_MAP_MARKER: - return this.inventoryCallbacks.editMapMarker(pmcData, body, sessionID); + return this.inventoryCallbacks.editMapMarker(pmcData, body, sessionID, output); case ItemEventActions.OPEN_RANDOM_LOOT_CONTAINER: - return this.inventoryCallbacks.openRandomLootContainer(pmcData, body, sessionID); + return this.inventoryCallbacks.openRandomLootContainer(pmcData, body, sessionID, output); case ItemEventActions.HIDEOUT_QTE_EVENT: return this.hideoutCallbacks.handleQTEEvent(pmcData, body, sessionID); case ItemEventActions.REDEEM_PROFILE_REWARD: