Add small refactors to 2 functions

This commit is contained in:
Dev 2024-08-31 20:48:32 +01:00
parent d518549711
commit c2402af09e
3 changed files with 8 additions and 3 deletions

View File

@ -1334,6 +1334,7 @@ export class HideoutController {
pmcData.Hideout.Production[request.recipeId] = null;
output.profileChanges[sessionId].production = null;
return output;
}

View File

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

View File

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