2022-08-26 20:37:27 +01:00
|
|
|
import { inject, injectable } from "tsyringe";
|
|
|
|
|
|
|
|
import { CWX_ConfigHandler } from "./configHandler";
|
|
|
|
import { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
|
|
|
import { ITemplateItem } from "@spt-aki/models/eft/common/tables/ITemplateItem";
|
2022-09-17 20:46:11 +01:00
|
|
|
import { IItemConfig } from "@spt-aki/models/spt/config/IItemConfig"
|
2022-08-26 20:37:27 +01:00
|
|
|
import { IConfig } from "models/IConfig";
|
2022-09-17 20:46:11 +01:00
|
|
|
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
|
|
|
|
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
|
2022-08-26 20:37:27 +01:00
|
|
|
|
|
|
|
@injectable()
|
|
|
|
export class CWX_ItemsConfig
|
|
|
|
{
|
|
|
|
private tables: Record<string, ITemplateItem>;
|
|
|
|
private config: IConfig;
|
2022-09-17 20:46:11 +01:00
|
|
|
private itemConfig: IItemConfig;
|
2022-08-26 20:37:27 +01:00
|
|
|
|
|
|
|
constructor(
|
|
|
|
@inject("DatabaseServer") private databaseServer: DatabaseServer,
|
2022-09-17 20:46:11 +01:00
|
|
|
@inject("ConfigServer") private configServer: ConfigServer,
|
2022-08-26 20:37:27 +01:00
|
|
|
@inject("CWX_ConfigHandler") private configHandler: CWX_ConfigHandler
|
|
|
|
)
|
|
|
|
{}
|
|
|
|
|
|
|
|
public applyChanges(): void
|
|
|
|
{
|
|
|
|
this.tables = this.databaseServer.getTables().templates.items;
|
2022-09-17 20:46:11 +01:00
|
|
|
this.itemConfig = this.configServer.getConfig(ConfigTypes.ITEM);
|
2022-08-26 20:37:27 +01:00
|
|
|
this.config = this.configHandler.getConfig();
|
|
|
|
|
|
|
|
this.changeShrapProps();
|
|
|
|
this.changeMaxAmmoForKS23();
|
2022-09-17 20:46:11 +01:00
|
|
|
this.removeDevFromBlacklist();
|
2022-08-26 20:37:27 +01:00
|
|
|
}
|
2022-09-17 20:46:11 +01:00
|
|
|
|
2022-08-26 20:37:27 +01:00
|
|
|
|
|
|
|
private changeShrapProps(): void
|
|
|
|
{
|
|
|
|
const shrap = this.tables["5e85a9a6eacf8c039e4e2ac1"];
|
|
|
|
|
|
|
|
if (this.config.itemsConfig.changeShrapProps)
|
|
|
|
{
|
|
|
|
shrap._props.Damage = 200;
|
|
|
|
shrap._props.InitialSpeed = 1000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private changeMaxAmmoForKS23(): void
|
|
|
|
{
|
|
|
|
const ks23 = this.tables["5f647d9f8499b57dc40ddb93"];
|
|
|
|
|
|
|
|
if (this.config.itemsConfig.changeMaxAmmoForKS23)
|
|
|
|
{
|
|
|
|
ks23._props.Cartridges[0]._max_count = 30;
|
|
|
|
}
|
|
|
|
}
|
2022-09-17 20:46:11 +01:00
|
|
|
|
|
|
|
private removeDevFromBlacklist(): void
|
|
|
|
{
|
|
|
|
if (this.config.itemsConfig.removeDevFromBlacklist)
|
|
|
|
{
|
|
|
|
this.itemConfig.blacklist.splice(this.itemConfig.blacklist.indexOf("58ac60eb86f77401897560ff"));
|
|
|
|
}
|
|
|
|
}
|
2022-08-26 20:37:27 +01:00
|
|
|
}
|