Add additional comments and formatting fixes

This commit is contained in:
Dev 2023-06-01 10:46:16 +01:00
parent 92c2da785b
commit 9bf533a1b1
3 changed files with 13 additions and 1 deletions

View File

@ -369,6 +369,7 @@ export class HideoutController
// Find the recipe of the production
const recipe = this.databaseServer.getTables().hideout.production.find(p => p._id === body.recipeId);
// Find the actual amount of items we need to remove because body can send weird data
const requirements = this.jsonUtil.clone(recipe.requirements.filter(i => i.type === "Item"));
@ -379,7 +380,10 @@ export class HideoutController
const itemToCheck = pmcData.Inventory.items.find(i => i._id === itemToDelete.id);
const requirement = requirements.find(requirement => requirement.templateId === itemToCheck._tpl);
if (requirement.count <= 0)
{
continue;
}
this.inventoryHelper.removeItemByCount(pmcData, itemToDelete.id, requirement.count, sessionID, output);
requirement.count -= itemToDelete.count;
}
@ -699,7 +703,7 @@ export class HideoutController
}
/**
* Start area production for item
* Start area production for item by adding production to profiles' Hideout.Production array
* @param pmcData Player profile
* @param request Start production request
* @param sessionID Session id

View File

@ -62,6 +62,13 @@ export class HideoutHelper
this.hideoutConfig = this.configServer.getConfig(ConfigTypes.HIDEOUT);
}
/**
* Add production to profiles' Hideout.Production array
* @param pmcData Profile to add production to
* @param body Production request
* @param sessionID Session id
* @returns client response
*/
public registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse
{
const recipe = this.databaseServer.getTables().hideout.production.find(p => p._id === body.recipeId);

View File

@ -23,6 +23,7 @@ export class ItemBaseClassService
/**
* Create cache and store inside ItemBaseClassService
* Store a dict of an items tpl to the base classes it and its parents have
*/
public hydrateItemBaseClassCache(): void
{