From c2402af09eb399c6b5f1cdf44d0face591f70a56 Mon Sep 17 00:00:00 2001 From: Dev Date: Sat, 31 Aug 2024 20:48:32 +0100 Subject: [PATCH] Add small refactors to 2 functions --- project/src/controllers/HideoutController.ts | 1 + project/src/services/LocationLifecycleService.ts | 8 +++++--- project/src/services/OpenZoneService.ts | 2 ++ 3 files changed, 8 insertions(+), 3 deletions(-) diff --git a/project/src/controllers/HideoutController.ts b/project/src/controllers/HideoutController.ts index 73444b69..a7a227a0 100644 --- a/project/src/controllers/HideoutController.ts +++ b/project/src/controllers/HideoutController.ts @@ -1334,6 +1334,7 @@ export class HideoutController { pmcData.Hideout.Production[request.recipeId] = null; output.profileChanges[sessionId].production = null; + return output; } diff --git a/project/src/services/LocationLifecycleService.ts b/project/src/services/LocationLifecycleService.ts index 201bc878..b3ee9f31 100644 --- a/project/src/services/LocationLifecycleService.ts +++ b/project/src/services/LocationLifecycleService.ts @@ -534,10 +534,12 @@ export class LocationLifecycleService { protected handleBTRItemTransferEvent(sessionId: string, request: IEndLocalRaidRequestData): void { const btrKey = "BTRTransferStash"; const btrContainerAndItems = request.transferItems[btrKey] ?? []; - if (btrContainerAndItems.length > 0) { - const itemsToSend = btrContainerAndItems.filter((item) => item._id !== btrKey); - this.btrItemDelivery(sessionId, Traders.BTR, itemsToSend); + if (btrContainerAndItems.length === 0) { + return; } + + const itemsToSend = btrContainerAndItems.filter((item) => item._id !== btrKey); + this.btrItemDelivery(sessionId, Traders.BTR, itemsToSend); } protected btrItemDelivery(sessionId: string, traderId: string, items: Item[]): void { diff --git a/project/src/services/OpenZoneService.ts b/project/src/services/OpenZoneService.ts index a79d176d..2a487d04 100644 --- a/project/src/services/OpenZoneService.ts +++ b/project/src/services/OpenZoneService.ts @@ -47,6 +47,8 @@ export class OpenZoneService { for (const mapKey in this.locationConfig.openZones) { if (!dbLocations[mapKey]) { this.logger.error(this.localisationService.getText("openzone-unable_to_find_map", mapKey)); + + continue; } const dbLocationToUpdate: ILocationBase = dbLocations[mapKey].base;