Pass output into more event functions

This commit is contained in:
Dev 2024-02-10 16:32:37 +00:00
parent f7a16e15f9
commit fea17cf3db
3 changed files with 16 additions and 13 deletions

View File

@ -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(

View File

@ -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);

View File

@ -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: