Send correct data to client to inform it craft has been cancelled
This commit is contained in:
parent
ce50c88b87
commit
cc86ecce2b
@ -983,7 +983,7 @@ export class HideoutController
|
|||||||
* @param sessionId Session id
|
* @param sessionId Session id
|
||||||
* @param pmcData Profile with craft to cancel
|
* @param pmcData Profile with craft to cancel
|
||||||
* @param request Cancel production request data
|
* @param request Cancel production request data
|
||||||
* @returns
|
* @returns IItemEventRouterResponse
|
||||||
*/
|
*/
|
||||||
public cancelProduction(sessionId: string, pmcData: IPmcData, request: IHideoutCancelProductionRequestData): IItemEventRouterResponse
|
public cancelProduction(sessionId: string, pmcData: IPmcData, request: IHideoutCancelProductionRequestData): IItemEventRouterResponse
|
||||||
{
|
{
|
||||||
@ -998,8 +998,8 @@ export class HideoutController
|
|||||||
return this.httpResponse.appendErrorToOutput(output, errorMessage);
|
return this.httpResponse.appendErrorToOutput(output, errorMessage);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Remove production from profile
|
// Null out production data so client gets informed when response send back
|
||||||
delete pmcData.Hideout.Production[request.recipeId];
|
pmcData.Hideout.Production[request.recipeId] = null;
|
||||||
|
|
||||||
// TODO - handle timestamp somehow?
|
// TODO - handle timestamp somehow?
|
||||||
|
|
||||||
|
@ -227,6 +227,11 @@ export class HideoutHelper
|
|||||||
for (const prodId in pmcData.Hideout.Production)
|
for (const prodId in pmcData.Hideout.Production)
|
||||||
{
|
{
|
||||||
const craft = pmcData.Hideout.Production[prodId];
|
const craft = pmcData.Hideout.Production[prodId];
|
||||||
|
if (!craft)
|
||||||
|
{
|
||||||
|
// Craft value is null, get rid of it (could be from cancelling craft that needs cleaning up)
|
||||||
|
delete pmcData.Hideout.Production[prodId];
|
||||||
|
}
|
||||||
|
|
||||||
// Craft complete, skip processing (Don't skip continious crafts like bitcoin farm)
|
// Craft complete, skip processing (Don't skip continious crafts like bitcoin farm)
|
||||||
if (craft.Progress >= craft.ProductionTime && prodId !== HideoutHelper.bitcoinFarm)
|
if (craft.Progress >= craft.ProductionTime && prodId !== HideoutHelper.bitcoinFarm)
|
||||||
|
@ -153,8 +153,14 @@ export class EventOutputHolder
|
|||||||
{
|
{
|
||||||
for (const productionKey in productions)
|
for (const productionKey in productions)
|
||||||
{
|
{
|
||||||
// Skip completed
|
|
||||||
const production = productions[productionKey];
|
const production = productions[productionKey];
|
||||||
|
if (!production)
|
||||||
|
{
|
||||||
|
// Could be cancelled production, skip item to save processing
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Skip completed
|
||||||
if (!production.inProgress)
|
if (!production.inProgress)
|
||||||
{
|
{
|
||||||
continue;
|
continue;
|
||||||
|
Loading…
Reference in New Issue
Block a user