diff --git a/project/assets/configs/insurance.json b/project/assets/configs/insurance.json index e9877c5f..0ed8d8f8 100644 --- a/project/assets/configs/insurance.json +++ b/project/assets/configs/insurance.json @@ -6,6 +6,7 @@ "blacklistedEquipment": ["SpecialSlot1", "SpecialSlot2", "SpecialSlot3"], "slotIdsToAlwaysRemove": ["cartridges", "patron_in_weapon"], "returnTimeOverrideSeconds": 0, + "storageTimeOverrideSeconds": 0, "runIntervalSeconds": 600, "minAttachmentRoublePriceToBeTaken": 2000, "chanceNoAttachmentsTakenPercent": 10, diff --git a/project/src/models/spt/config/IInsuranceConfig.ts b/project/src/models/spt/config/IInsuranceConfig.ts index 704207b2..b3f4e5d2 100644 --- a/project/src/models/spt/config/IInsuranceConfig.ts +++ b/project/src/models/spt/config/IInsuranceConfig.ts @@ -8,8 +8,10 @@ export interface IInsuranceConfig extends IBaseConfig { blacklistedEquipment: string[]; /** Some slots should always be removed, e.g. 'cartridges' */ slotIdsToAlwaysRemove: string[]; - /** Override to control how quickly insurance is processed/returned in second */ + /** Override to control how quickly insurance is processed/returned in seconds */ returnTimeOverrideSeconds: number; + /** Override to control how long insurance returns stay in mail before expiring - in seconds */ + storageTimeOverrideSeconds: number; /** How often server should process insurance in seconds */ runIntervalSeconds: number; // Lowest rouble price for an attachment to be allowed to be taken diff --git a/project/src/services/InsuranceService.ts b/project/src/services/InsuranceService.ts index 37cd4451..339dbca9 100644 --- a/project/src/services/InsuranceService.ts +++ b/project/src/services/InsuranceService.ts @@ -114,7 +114,7 @@ export class InsuranceService { this.saveServer.getProfile(sessionID).insurance.push({ scheduledTime: this.getInsuranceReturnTimestamp(pmcData, traderBase), traderId: traderId, - maxStorageTime: this.timeUtil.getHoursAsSeconds(traderBase.insurance.max_storage_time), + maxStorageTime: this.getMaxInsuranceStorageTime(traderBase), systemData: systemData, messageType: MessageType.INSURANCE_RETURN, messageTemplateId: this.randomUtil.getArrayValue(dialogueTemplates.insuranceFound), @@ -191,6 +191,15 @@ export class InsuranceService { } } + protected getMaxInsuranceStorageTime(traderBase: ITraderBase): number { + if (this.insuranceConfig.storageTimeOverrideSeconds > 0) { + // Override exists, use instead of traders value + return this.insuranceConfig.storageTimeOverrideSeconds; + } + + return this.timeUtil.getHoursAsSeconds(traderBase.insurance.max_storage_time); + } + /** * Store lost gear post-raid inside profile, ready for later code to pick it up and mail it * @param equipmentPkg Gear to store - generated by getGearLostInRaid()