Add additional comments and formatting fixes
This commit is contained in:
parent
92c2da785b
commit
9bf533a1b1
@ -369,6 +369,7 @@ export class HideoutController
|
|||||||
|
|
||||||
// Find the recipe of the production
|
// Find the recipe of the production
|
||||||
const recipe = this.databaseServer.getTables().hideout.production.find(p => p._id === body.recipeId);
|
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
|
// 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"));
|
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 itemToCheck = pmcData.Inventory.items.find(i => i._id === itemToDelete.id);
|
||||||
const requirement = requirements.find(requirement => requirement.templateId === itemToCheck._tpl);
|
const requirement = requirements.find(requirement => requirement.templateId === itemToCheck._tpl);
|
||||||
if (requirement.count <= 0)
|
if (requirement.count <= 0)
|
||||||
|
{
|
||||||
continue;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
this.inventoryHelper.removeItemByCount(pmcData, itemToDelete.id, requirement.count, sessionID, output);
|
this.inventoryHelper.removeItemByCount(pmcData, itemToDelete.id, requirement.count, sessionID, output);
|
||||||
requirement.count -= itemToDelete.count;
|
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 pmcData Player profile
|
||||||
* @param request Start production request
|
* @param request Start production request
|
||||||
* @param sessionID Session id
|
* @param sessionID Session id
|
||||||
|
@ -62,6 +62,13 @@ export class HideoutHelper
|
|||||||
this.hideoutConfig = this.configServer.getConfig(ConfigTypes.HIDEOUT);
|
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
|
public registerProduction(pmcData: IPmcData, body: IHideoutSingleProductionStartRequestData | IHideoutContinuousProductionStartRequestData, sessionID: string): IItemEventRouterResponse
|
||||||
{
|
{
|
||||||
const recipe = this.databaseServer.getTables().hideout.production.find(p => p._id === body.recipeId);
|
const recipe = this.databaseServer.getTables().hideout.production.find(p => p._id === body.recipeId);
|
||||||
|
@ -23,6 +23,7 @@ export class ItemBaseClassService
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Create cache and store inside 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
|
public hydrateItemBaseClassCache(): void
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user