From 2a3839f6de0c018e9c9a229c1a39df25ebdcfe6a Mon Sep 17 00:00:00 2001 From: Dev Date: Fri, 1 Dec 2023 09:03:14 +0000 Subject: [PATCH] Move `trainArrivalDelaySeconds` value into config --- project/assets/configs/location.json | 351 +++++++++--------- .../src/models/spt/config/ILocationConfig.ts | 61 +-- .../src/services/RaidTimeAdjustmentService.ts | 6 +- 3 files changed, 217 insertions(+), 201 deletions(-) diff --git a/project/assets/configs/location.json b/project/assets/configs/location.json index 8c13f9e0..049a211f 100644 --- a/project/assets/configs/location.json +++ b/project/assets/configs/location.json @@ -841,190 +841,195 @@ "allowDuplicateItemsInStaticContainers": true, "looseLootBlacklist": {}, "scavRaidTimeSettings": { - "bigmap": { - "reduceLootByPercent": true, - "minDynamicLootPercent": 50, - "minStaticLootPercent": 40, - "reducedChancePercent": 70, - "reductionPercentWeights": { - "20": 1, - "25": 2, - "30": 4, - "35": 4, - "40": 4, - "45": 4, - "50": 4, - "60": 2, - "70": 2, - "80": 1 - }, - "adjustWaves": true + "settings": { + "trainArrivalDelaySeconds": 90 }, - "factory4_day": { - "reduceLootByPercent": true, - "minDynamicLootPercent": 50, - "minStaticLootPercent": 40, - "reducedChancePercent": 80, - "reductionPercentWeights": { - "5": 2, - "20": 3, - "25": 3, - "30": 5, - "40": 5, - "50": 5, - "60": 2, - "70": 2, - "80": 2, - "85": 1 + "maps": { + "bigmap": { + "reduceLootByPercent": true, + "minDynamicLootPercent": 50, + "minStaticLootPercent": 40, + "reducedChancePercent": 70, + "reductionPercentWeights": { + "20": 1, + "25": 2, + "30": 4, + "35": 4, + "40": 4, + "45": 4, + "50": 4, + "60": 2, + "70": 2, + "80": 1 + }, + "adjustWaves": true }, - "adjustWaves": true - }, - "factory4_night": { - "reduceLootByPercent": true, - "minDynamicLootPercent": 50, - "minStaticLootPercent": 40, - "reducedChancePercent": 70, - "reductionPercentWeights": { - "20": 4, - "30": 3, - "40": 3, - "60": 2, - "70": 2, - "80": 1 + "factory4_day": { + "reduceLootByPercent": true, + "minDynamicLootPercent": 50, + "minStaticLootPercent": 40, + "reducedChancePercent": 80, + "reductionPercentWeights": { + "5": 2, + "20": 3, + "25": 3, + "30": 5, + "40": 5, + "50": 5, + "60": 2, + "70": 2, + "80": 2, + "85": 1 + }, + "adjustWaves": true }, - "adjustWaves": true - }, - "interchange": { - "reduceLootByPercent": true, - "minDynamicLootPercent": 50, - "minStaticLootPercent": 40, - "reducedChancePercent": 70, - "reductionPercentWeights": { - "20": 5, - "25": 5, - "30": 5, - "35": 5, - "40": 5, - "50": 5, - "60": 2, - "80": 1 + "factory4_night": { + "reduceLootByPercent": true, + "minDynamicLootPercent": 50, + "minStaticLootPercent": 40, + "reducedChancePercent": 70, + "reductionPercentWeights": { + "20": 4, + "30": 3, + "40": 3, + "60": 2, + "70": 2, + "80": 1 + }, + "adjustWaves": true }, - "adjustWaves": true - }, - "rezervbase": { - "reduceLootByPercent": true, - "minDynamicLootPercent": 50, - "minStaticLootPercent": 40, - "reducedChancePercent": 70, + "interchange": { + "reduceLootByPercent": true, + "minDynamicLootPercent": 50, + "minStaticLootPercent": 40, + "reducedChancePercent": 70, + "reductionPercentWeights": { + "20": 5, + "25": 5, + "30": 5, + "35": 5, + "40": 5, + "50": 5, + "60": 2, + "80": 1 + }, + "adjustWaves": true + }, + "rezervbase": { + "reduceLootByPercent": true, + "minDynamicLootPercent": 50, + "minStaticLootPercent": 40, + "reducedChancePercent": 70, - "reductionPercentWeights": { - "20": 3, - "30": 3, - "40": 4, - "50": 4, - "60": 2, - "70": 1, - "80": 1 + "reductionPercentWeights": { + "20": 3, + "30": 3, + "40": 4, + "50": 4, + "60": 2, + "70": 1, + "80": 1 + }, + "adjustWaves": true }, - "adjustWaves": true - }, - "laboratory": { - "reduceLootByPercent": true, - "minDynamicLootPercent": 50, - "minStaticLootPercent": 40, - "reducedChancePercent": 70, - "reductionPercentWeights": { - "20": 3, - "30": 5, - "40": 5, - "50": 5, - "60": 2, - "80": 1 + "laboratory": { + "reduceLootByPercent": true, + "minDynamicLootPercent": 50, + "minStaticLootPercent": 40, + "reducedChancePercent": 70, + "reductionPercentWeights": { + "20": 3, + "30": 5, + "40": 5, + "50": 5, + "60": 2, + "80": 1 + }, + "adjustWaves": true }, - "adjustWaves": true - }, - "lighthouse": { - "reduceLootByPercent": true, - "minDynamicLootPercent": 50, - "minStaticLootPercent": 40, - "reducedChancePercent": 60, - "reductionPercentWeights": { - "20": 2, - "25": 2, - "30": 4, - "40": 4, - "50": 4, - "60": 2, - "80": 1 + "lighthouse": { + "reduceLootByPercent": true, + "minDynamicLootPercent": 50, + "minStaticLootPercent": 40, + "reducedChancePercent": 60, + "reductionPercentWeights": { + "20": 2, + "25": 2, + "30": 4, + "40": 4, + "50": 4, + "60": 2, + "80": 1 + }, + "adjustWaves": true }, - "adjustWaves": true - }, - "shoreline": { - "reduceLootByPercent": true, - "minDynamicLootPercent": 50, - "minStaticLootPercent": 40, - "reducedChancePercent": 60, - "reductionPercentWeights": { - "20": 2, - "25": 3, - "30": 5, - "35": 5, - "40": 5, - "50": 5, - "60": 2, - "70": 1, - "80": 1 + "shoreline": { + "reduceLootByPercent": true, + "minDynamicLootPercent": 50, + "minStaticLootPercent": 40, + "reducedChancePercent": 60, + "reductionPercentWeights": { + "20": 2, + "25": 3, + "30": 5, + "35": 5, + "40": 5, + "50": 5, + "60": 2, + "70": 1, + "80": 1 + }, + "adjustWaves": true }, - "adjustWaves": true - }, - "tarkovstreets": { - "reduceLootByPercent": true, - "minDynamicLootPercent": 50, - "minStaticLootPercent": 40, - "reducedChancePercent": 70, - "reductionPercentWeights": { - "20": 2, - "30": 4, - "40": 4, - "50": 4, - "60": 4, - "70": 1, - "80": 1 + "tarkovstreets": { + "reduceLootByPercent": true, + "minDynamicLootPercent": 50, + "minStaticLootPercent": 40, + "reducedChancePercent": 70, + "reductionPercentWeights": { + "20": 2, + "30": 4, + "40": 4, + "50": 4, + "60": 4, + "70": 1, + "80": 1 + }, + "adjustWaves": true }, - "adjustWaves": true - }, - "woods": { - "reduceLootByPercent": true, - "minDynamicLootPercent": 50, - "minStaticLootPercent": 40, - "reducedChancePercent": 60, - "reductionPercentWeights": { - "20": 3, - "30": 5, - "40": 5, - "50": 5, - "60": 1, - "70": 1, - "80": 1 + "woods": { + "reduceLootByPercent": true, + "minDynamicLootPercent": 50, + "minStaticLootPercent": 40, + "reducedChancePercent": 60, + "reductionPercentWeights": { + "20": 3, + "30": 5, + "40": 5, + "50": 5, + "60": 1, + "70": 1, + "80": 1 + }, + "adjustWaves": true }, - "adjustWaves": true - }, - "default": { - "reduceLootByPercent": true, - "minDynamicLootPercent": 50, - "minStaticLootPercent": 50, - "reducedChancePercent": 50, - "reductionPercentWeights": { - "10": 1, - "20": 2, - "30": 5, - "40": 5, - "50": 5, - "60": 2, - "70": 1, - "80": 1 - }, - "adjustWaves": true + "default": { + "reduceLootByPercent": true, + "minDynamicLootPercent": 50, + "minStaticLootPercent": 50, + "reducedChancePercent": 50, + "reductionPercentWeights": { + "10": 1, + "20": 2, + "30": 5, + "40": 5, + "50": 5, + "60": 2, + "70": 1, + "80": 1 + }, + "adjustWaves": true + } } } } diff --git a/project/src/models/spt/config/ILocationConfig.ts b/project/src/models/spt/config/ILocationConfig.ts index 172f390e..292388f4 100644 --- a/project/src/models/spt/config/ILocationConfig.ts +++ b/project/src/models/spt/config/ILocationConfig.ts @@ -39,31 +39,7 @@ export interface ILocationConfig extends IBaseConfig /** Key: map, value: loose loot ids to ignore */ looseLootBlacklist: Record; /** Key: map, value: settings to control how long scav raids are*/ - scavRaidTimeSettings: Record; -} - -export interface IScavRaidTimeLocationSettings -{ - /** Should loot be reduced by same percent length of raid is reduced by */ - reduceLootByPercent: boolean; - minStaticLootPercent: number; - minDynamicLootPercent: number; - /** Chance raid time is reduced */ - reducedChancePercent: number; - reductionPercentWeights: Record; - /** Should bot waves be removed / spawn times be adjusted */ - adjustWaves: boolean; -} - -export interface IContainerRandomistionSettings -{ - enabled: boolean; - /** What maps can use the container randomisation feature */ - maps: Record; - /** Some container types don't work when randomised */ - containerTypesToNotRandomise: string[]; - containerGroupMinSizeMultiplier: number; - containerGroupMaxSizeMultiplier: number; + scavRaidTimeSettings: IScavRaidTimeSettings; } export interface IFixEmptyBotWavesSettings @@ -119,3 +95,38 @@ export interface LootMultiplier terminal: number; town: number; } + +export interface IContainerRandomistionSettings +{ + enabled: boolean; + /** What maps can use the container randomisation feature */ + maps: Record; + /** Some container types don't work when randomised */ + containerTypesToNotRandomise: string[]; + containerGroupMinSizeMultiplier: number; + containerGroupMaxSizeMultiplier: number; +} + +export interface IScavRaidTimeSettings +{ + settings: IScavRaidTimeConfigSettings + maps: Record +} + +export interface IScavRaidTimeConfigSettings +{ + trainArrivalDelaySeconds: number +} + +export interface IScavRaidTimeLocationSettings +{ + /** Should loot be reduced by same percent length of raid is reduced by */ + reduceLootByPercent: boolean; + minStaticLootPercent: number; + minDynamicLootPercent: number; + /** Chance raid time is reduced */ + reducedChancePercent: number; + reductionPercentWeights: Record; + /** Should bot waves be removed / spawn times be adjusted */ + adjustWaves: boolean; +} diff --git a/project/src/services/RaidTimeAdjustmentService.ts b/project/src/services/RaidTimeAdjustmentService.ts index a62b2384..a5b7fc68 100644 --- a/project/src/services/RaidTimeAdjustmentService.ts +++ b/project/src/services/RaidTimeAdjustmentService.ts @@ -171,11 +171,11 @@ export class RaidTimeAdjustmentService */ protected getMapSettings(location: string): IScavRaidTimeLocationSettings { - const mapSettings = this.locationConfig.scavRaidTimeSettings[location.toLowerCase()]; + const mapSettings = this.locationConfig.scavRaidTimeSettings.maps[location.toLowerCase()]; if (!mapSettings) { this.logger.warning(`Unable to find scav raid time settings for map: ${location}, using defaults`); - return this.locationConfig.scavRaidTimeSettings.default; + return this.locationConfig.scavRaidTimeSettings.maps.default; } return mapSettings; @@ -226,7 +226,7 @@ export class RaidTimeAdjustmentService // // I added 2 seconds just to be safe... // - const trainArrivalDelaySeconds = 90; + const trainArrivalDelaySeconds = this.locationConfig.scavRaidTimeSettings.settings.trainArrivalDelaySeconds; // Determine the earliest possible time in the raid when the train would leave const earliestPossibleDepartureMinutes = (exit.MinTime + exit.Count + exit.ExfiltrationTime + trainArrivalDelaySeconds) / 60;