Merge branch '3.8.0' of https://dev.sp-tarkov.com/SPT-AKI/Server into 3.8.0
This commit is contained in:
commit
5ea7d7b97d
@ -24,17 +24,38 @@ export class ItemEventCallbacks
|
||||
): IGetBodyResponseData<IItemEventRouterResponse>
|
||||
{
|
||||
const eventResponse = this.itemEventRouter.handleEvents(info, sessionID);
|
||||
const result = (eventResponse.warnings.length > 0)
|
||||
const result = (this.isCriticalError(eventResponse.warnings))
|
||||
? this.httpResponse.getBody(
|
||||
eventResponse,
|
||||
this.getErrorCode(eventResponse.warnings),
|
||||
eventResponse.warnings[0].errmsg,
|
||||
) // TODO: map 228 to its enum value
|
||||
)
|
||||
: this.httpResponse.getBody(eventResponse);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return true if the passed in list of warnings contains critical issues
|
||||
* @param warnings The list of warnings to check for critical errors
|
||||
* @returns
|
||||
*/
|
||||
private isCriticalError(warnings: Warning[]): boolean
|
||||
{
|
||||
// List of non-critical error codes, we return true if any error NOT included is passed in
|
||||
const nonCriticalErrorCodes: BackendErrorCodes[] = [BackendErrorCodes.NOTENOUGHSPACE];
|
||||
|
||||
for (const warning of warnings)
|
||||
{
|
||||
if (!nonCriticalErrorCodes.includes(+warning.code))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
protected getErrorCode(warnings: Warning[]): number
|
||||
{
|
||||
if (warnings[0]?.code)
|
||||
|
@ -35,6 +35,7 @@ import { IRecordShootingRangePoints } from "@spt-aki/models/eft/hideout/IRecordS
|
||||
import { IAddItemDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemDirectRequest";
|
||||
import { IAddItemsDirectRequest } from "@spt-aki/models/eft/inventory/IAddItemsDirectRequest";
|
||||
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
|
||||
import { BackendErrorCodes } from "@spt-aki/models/enums/BackendErrorCodes";
|
||||
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
|
||||
import { HideoutAreas } from "@spt-aki/models/enums/HideoutAreas";
|
||||
import { SkillTypes } from "@spt-aki/models/enums/SkillTypes";
|
||||
@ -674,9 +675,11 @@ export class HideoutController
|
||||
}
|
||||
|
||||
// @Important: Here we need to be very exact:
|
||||
// - normal recipe: Production time value is stored in attribute "productionType" with small "p"
|
||||
// - scav case recipe: Production time value is stored in attribute "ProductionType" with capital "P"
|
||||
const modifiedScavCaseTime = this.getScavCaseTime(pmcData, recipe.ProductionTime);
|
||||
// - normal recipe: Production time value is stored in attribute "productionTime" with small "p"
|
||||
// - scav case recipe: Production time value is stored in attribute "ProductionTime" with capital "P"
|
||||
const adjustedCraftTime = recipe.ProductionTime
|
||||
- this.hideoutHelper.getCraftingSkillProductionTimeReduction(pmcData, recipe.ProductionTime);
|
||||
const modifiedScavCaseTime = this.getScavCaseTime(pmcData, adjustedCraftTime);
|
||||
|
||||
pmcData.Hideout.Production[body.recipeId] = this.hideoutHelper.initProduction(
|
||||
body.recipeId,
|
||||
@ -949,7 +952,11 @@ export class HideoutController
|
||||
const totalResultItems = toolsToSendToPlayer.concat(itemAndChildrenToSendToPlayer);
|
||||
if (!this.inventoryHelper.canPlaceItemsInInventory(sessionID, totalResultItems))
|
||||
{
|
||||
this.httpResponse.appendErrorToOutput(output, this.localisationService.getText("inventory-no_stash_space"));
|
||||
this.httpResponse.appendErrorToOutput(
|
||||
output,
|
||||
this.localisationService.getText("inventory-no_stash_space"),
|
||||
BackendErrorCodes.NOTENOUGHSPACE,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -999,7 +999,7 @@ export class HideoutHelper
|
||||
* @param productionTime Time to complete hideout craft in seconds
|
||||
* @returns Adjusted craft time in seconds
|
||||
*/
|
||||
protected getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number
|
||||
public getCraftingSkillProductionTimeReduction(pmcData: IPmcData, productionTime: number): number
|
||||
{
|
||||
const craftingSkill = pmcData.Skills.Common.find((skill) => skill.Id === SkillTypes.CRAFTING);
|
||||
if (!craftingSkill)
|
||||
|
@ -20,6 +20,7 @@ import { IInventoryRemoveRequestData } from "@spt-aki/models/eft/inventory/IInve
|
||||
import { IInventorySplitRequestData } from "@spt-aki/models/eft/inventory/IInventorySplitRequestData";
|
||||
import { IInventoryTransferRequestData } from "@spt-aki/models/eft/inventory/IInventoryTransferRequestData";
|
||||
import { IItemEventRouterResponse } from "@spt-aki/models/eft/itemEvent/IItemEventRouterResponse";
|
||||
import { BackendErrorCodes } from "@spt-aki/models/enums/BackendErrorCodes";
|
||||
import { BaseClasses } from "@spt-aki/models/enums/BaseClasses";
|
||||
import { BonusType } from "@spt-aki/models/enums/BonusType";
|
||||
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
|
||||
@ -88,7 +89,11 @@ export class InventoryHelper
|
||||
if (!this.canPlaceItemsInInventory(sessionId, request.itemsWithModsToAdd))
|
||||
{
|
||||
// No space, exit
|
||||
this.httpResponse.appendErrorToOutput(output, this.localisationService.getText("inventory-no_stash_space"));
|
||||
this.httpResponse.appendErrorToOutput(
|
||||
output,
|
||||
this.localisationService.getText("inventory-no_stash_space"),
|
||||
BackendErrorCodes.NOTENOUGHSPACE,
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
@ -470,7 +475,11 @@ export class InventoryHelper
|
||||
}
|
||||
else
|
||||
{
|
||||
this.httpResponse.appendErrorToOutput(output, this.localisationService.getText("inventory-no_stash_space"));
|
||||
this.httpResponse.appendErrorToOutput(
|
||||
output,
|
||||
this.localisationService.getText("inventory-no_stash_space"),
|
||||
BackendErrorCodes.NOTENOUGHSPACE,
|
||||
);
|
||||
|
||||
return;
|
||||
}
|
||||
|
@ -63,6 +63,7 @@ export enum BackendErrorCodes
|
||||
BANNEDERRORCODE = 1513,
|
||||
INSUFFICIENTNUMBERINSTOCK = 1516,
|
||||
TOOMANYITEMSTOSELL = 1517,
|
||||
INCORRECTCLIENTPRICE = 1519,
|
||||
EXAMINATIONFAILED = 22001,
|
||||
ITEMALREADYEXAMINED = 22002,
|
||||
UNKNOWNNGINXERROR = 9000,
|
||||
@ -83,4 +84,5 @@ export enum BackendErrorCodes
|
||||
PLAYERALREADYLOOKINGFORGAME = 503001,
|
||||
PLAYERINRAID = 503002,
|
||||
LIMITFORPRESETSREACHED = 504001,
|
||||
PLAYERPROFILENOTFOUND = 505001,
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user