2022-08-20 13:36:46 +01:00
|
|
|
import { inject, injectable } from "tsyringe";
|
|
|
|
|
|
|
|
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
|
|
|
|
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
|
|
|
|
import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig";
|
|
|
|
|
2022-10-19 17:27:45 +01:00
|
|
|
import { CwxConfigHandler } from "./configHandler";
|
|
|
|
import { RagfairConfig } from "models/IConfig";
|
2022-08-20 13:36:46 +01:00
|
|
|
|
|
|
|
@injectable()
|
2022-10-19 17:27:45 +01:00
|
|
|
export class CwxRagfairConfig
|
2022-08-20 13:36:46 +01:00
|
|
|
{
|
|
|
|
private tables: IRagfairConfig;
|
2022-10-19 17:27:45 +01:00
|
|
|
private config: RagfairConfig;
|
2022-08-20 13:36:46 +01:00
|
|
|
|
|
|
|
constructor(
|
|
|
|
@inject("ConfigServer") private configServer: ConfigServer,
|
2022-10-19 17:27:45 +01:00
|
|
|
@inject("CwxConfigHandler") private configHandler: CwxConfigHandler
|
2022-08-20 13:36:46 +01:00
|
|
|
)
|
|
|
|
{}
|
|
|
|
|
|
|
|
public applyChanges(): void
|
|
|
|
{
|
|
|
|
this.config = this.configHandler.getConfig().ragfairConfig;
|
|
|
|
this.tables = this.configServer.getConfig(ConfigTypes.RAGFAIR);
|
|
|
|
|
2022-11-18 19:45:42 +00:00
|
|
|
//this.staticTrader();
|
2022-10-19 17:27:45 +01:00
|
|
|
this.roublesOnly();
|
|
|
|
this.disableBSGBlacklist();
|
2022-08-20 13:36:46 +01:00
|
|
|
}
|
|
|
|
|
2022-10-19 17:27:45 +01:00
|
|
|
private staticTrader(): void
|
2022-08-20 13:36:46 +01:00
|
|
|
{
|
|
|
|
if (this.config.staticTrader)
|
|
|
|
{
|
|
|
|
this.tables.traders["ragfair"] = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-19 17:27:45 +01:00
|
|
|
private roublesOnly(): void
|
2022-08-20 13:36:46 +01:00
|
|
|
{
|
|
|
|
if (this.config.roublesOnly)
|
|
|
|
{
|
|
|
|
this.tables.dynamic.currencies["5449016a4bdc2d6f028b456f"] = 100;
|
|
|
|
this.tables.dynamic.currencies["5696686a4bdc2da3298b456a"] = 0;
|
|
|
|
this.tables.dynamic.currencies["569668774bdc2da2298b4568"] = 0;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2022-10-19 17:27:45 +01:00
|
|
|
private disableBSGBlacklist(): void
|
2022-08-20 13:36:46 +01:00
|
|
|
{
|
|
|
|
if (this.config.disableBSGBlacklist)
|
|
|
|
{
|
|
|
|
this.tables.dynamic.blacklist.enableBsgList = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|