0
0
mirror of https://github.com/sp-tarkov/server.git synced 2025-02-13 09:50:43 -05:00

Added ability to control storage time of insurance returns to insurance.json config

This commit is contained in:
Dev 2024-10-28 09:36:13 +00:00
parent 30db370423
commit d519907566
3 changed files with 14 additions and 2 deletions

View File

@ -6,6 +6,7 @@
"blacklistedEquipment": ["SpecialSlot1", "SpecialSlot2", "SpecialSlot3"],
"slotIdsToAlwaysRemove": ["cartridges", "patron_in_weapon"],
"returnTimeOverrideSeconds": 0,
"storageTimeOverrideSeconds": 0,
"runIntervalSeconds": 600,
"minAttachmentRoublePriceToBeTaken": 2000,
"chanceNoAttachmentsTakenPercent": 10,

View File

@ -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

View File

@ -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()