added returnChancePercent tweak

This commit is contained in:
Baptiste Boulongne 2024-07-15 21:51:43 +02:00
parent f8303dd051
commit 2ae704839c
No known key found for this signature in database
3 changed files with 28 additions and 13 deletions

View File

@ -3,9 +3,11 @@
"PraporMinReturn": 2,
"PraporMaxReturn": 4,
"PraporMaxStorageTime": 72,
"PraporReturnChancePercent": 50,
//Therapist
"TherapistMinReturn": 1,
"TherapistMaxReturn": 2,
"TherapistMaxStorageTime": 72
"TherapistMaxStorageTime": 72,
"TherapistReturnChancePercent": 75
}

BIN
icon.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.0 KiB

View File

@ -10,14 +10,20 @@ import { IPostDBLoadMod } from "@spt/models/external/IPostDBLoadMod";
import { VFS } from "@spt/utils/VFS";
import * as path from "node:path";
import { ConfigServer } from "@spt/servers/ConfigServer";
import { ConfigTypes } from "@spt/models/enums/ConfigTypes";
import { IInsuranceConfig } from "@spt/models/spt/config/IInsuranceConfig";
type ModConfig = {
PraporMinReturn: number,
PraporMaxReturn: number,
PraporMaxStorageTime: number,
TherapistMinReturn: number,
TherapistMaxReturn: number,
TherapistMaxStorageTime: number
PraporMinReturn: number;
PraporMaxReturn: number;
PraporMaxStorageTime: number;
PraporReturnChancePercent: number;
TherapistMinReturn: number;
TherapistMaxReturn: number;
TherapistMaxStorageTime: number;
TherapistReturnChancePercent: number;
}
class InsuranceTweaks implements IPreSptLoadMod, IPostDBLoadMod
@ -25,6 +31,7 @@ class InsuranceTweaks implements IPreSptLoadMod, IPostDBLoadMod
public logger: ILogger;
public tables: IDatabaseTables;
public modConfig: ModConfig;
public configServer: ConfigServer;
public preSptLoad(container: DependencyContainer): void
{
@ -36,21 +43,27 @@ class InsuranceTweaks implements IPreSptLoadMod, IPostDBLoadMod
public postDBLoad(container: DependencyContainer): void
{
this.tables = container.resolve<DatabaseServer>("DatabaseServer").getTables();
this.configServer = container.resolve<ConfigServer>("ConfigServer");
this.traderTweaks(this.modConfig);
}
private traderTweaks(modConfig: ModConfig): void
{
const traders = this.tables.traders;
const PRAPOR = "54cb50c76803fa8b248b4571";
const THERAPIST = "54cb57776803fa99248b456e";
const insuranceConfig = this.configServer.getConfig<IInsuranceConfig>(ConfigTypes.INSURANCE);
// Prapor
traders["54cb50c76803fa8b248b4571"].base.insurance.min_return_hour = modConfig.PraporMinReturn
traders["54cb50c76803fa8b248b4571"].base.insurance.max_return_hour = modConfig.PraporMaxReturn
traders["54cb50c76803fa8b248b4571"].base.insurance.max_storage_time = modConfig.PraporMaxStorageTime
traders[PRAPOR].base.insurance.min_return_hour = modConfig.PraporMinReturn;
traders[PRAPOR].base.insurance.max_return_hour = modConfig.PraporMaxReturn;
traders[PRAPOR].base.insurance.max_storage_time = modConfig.PraporMaxStorageTime;
insuranceConfig.returnChancePercent[PRAPOR] = modConfig.PraporReturnChancePercent;
// Therapist
traders["54cb57776803fa99248b456e"].base.insurance.min_return_hour = modConfig.TherapistMinReturn
traders["54cb57776803fa99248b456e"].base.insurance.max_return_hour = modConfig.TherapistMaxReturn
traders["54cb57776803fa99248b456e"].base.insurance.max_storage_time = modConfig.TherapistMaxStorageTime
traders[THERAPIST].base.insurance.min_return_hour = modConfig.TherapistMinReturn;
traders[THERAPIST].base.insurance.max_return_hour = modConfig.TherapistMaxReturn;
traders[THERAPIST].base.insurance.max_storage_time = modConfig.TherapistMaxStorageTime;
insuranceConfig.returnChancePercent[THERAPIST] = modConfig.TherapistReturnChancePercent;
this.logger.logWithColor("[InsuranceTweaks] Applied insurance settings", LogTextColor.GREEN);
}