Remove redundant returns from various hideout functions used inside takeProduction()

This commit is contained in:
Dev 2024-02-01 12:47:48 +00:00
parent 3bf44b7863
commit d920dceb53
2 changed files with 20 additions and 15 deletions

View File

@ -730,19 +730,24 @@ export class HideoutController
{
// Ensure server and client are in-sync when player presses 'get items' on farm
this.hideoutHelper.updatePlayerHideout(sessionID);
return this.hideoutHelper.getBTC(pmcData, request, sessionID, output);
this.hideoutHelper.getBTC(pmcData, request, sessionID, output);
return output;
}
const recipe = hideoutDb.production.find((r) => r._id === request.recipeId);
if (recipe)
{
return this.handleRecipe(sessionID, recipe, pmcData, request, output);
this.handleRecipe(sessionID, recipe, pmcData, request, output);
return output;
}
const scavCase = hideoutDb.scavcase.find((r) => r._id === request.recipeId);
if (scavCase)
{
this.handleScavCase(sessionID, pmcData, request, output);
return output;
}
@ -763,7 +768,6 @@ export class HideoutController
* @param pmcData Player profile
* @param request Remove production from area request
* @param output Output object to update
* @returns IItemEventRouterResponse
*/
protected handleRecipe(
sessionID: string,
@ -771,7 +775,7 @@ export class HideoutController
pmcData: IPmcData,
request: IHideoutTakeProductionRequestData,
output: IItemEventRouterResponse,
): IItemEventRouterResponse
): void
{
// Variables for managemnet of skill
let craftingExpAmount = 0;
@ -889,7 +893,9 @@ export class HideoutController
),
);
return this.httpResponse.appendErrorToOutput(output);
this.httpResponse.appendErrorToOutput(output);
return;
}
// Check if the recipe is the same as the last one - get bonus when crafting same thing multiple times
@ -923,7 +929,7 @@ export class HideoutController
this.inventoryHelper.addItemsToStash(sessionID, addItemsRequest, pmcData, output);
if (output.warnings.length > 0)
{
return output;
return;
}
// - increment skill point for crafting
@ -968,8 +974,6 @@ export class HideoutController
{
pmcData.Hideout.Production[prodId].inProgress = false;
}
return output;
}
/**
@ -1032,7 +1036,9 @@ export class HideoutController
),
);
return this.httpResponse.appendErrorToOutput(output);
this.httpResponse.appendErrorToOutput(output);
return;
}
// Create rewards for scav case

View File

@ -950,14 +950,13 @@ export class HideoutHelper
* @param request Take production request
* @param sessionId Session id
* @param output Output object to update
* @returns IItemEventRouterResponse
*/
public getBTC(
pmcData: IPmcData,
request: IHideoutTakeProductionRequestData,
sessionId: string,
output: IItemEventRouterResponse
): IItemEventRouterResponse
): void
{
// Get how many coins were crafted and ready to pick up
const craftedCoinCount = pmcData.Hideout.Production[HideoutHelper.bitcoinFarm].Products.length;
@ -966,7 +965,9 @@ export class HideoutHelper
const errorMsg = this.localisationService.getText("hideout-no_bitcoins_to_collect");
this.logger.error(errorMsg);
return this.httpResponse.appendErrorToOutput(output, errorMsg);
this.httpResponse.appendErrorToOutput(output, errorMsg);
return;
}
const itemsToAdd: Item[][] = [];
@ -995,7 +996,7 @@ export class HideoutHelper
this.inventoryHelper.addItemsToStash(sessionId, addItemsRequest, pmcData, output);
if (output.warnings.length > 0)
{
return output;
return;
}
// Is at max capacity + we collected all coins - reset production start time
@ -1009,8 +1010,6 @@ export class HideoutHelper
// Remove crafted coins from production in profile now they've been collected
// Can only collect all coins, not individially
pmcData.Hideout.Production[HideoutHelper.bitcoinFarm].Products = [];
return output;
}
/**