2022-08-26 20:37:27 +01:00
|
|
|
import { inject, injectable } from "tsyringe";
|
|
|
|
|
2022-10-19 17:27:45 +01:00
|
|
|
import { CwxConfigHandler } from "./configHandler";
|
2022-08-26 20:37:27 +01:00
|
|
|
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-10-19 17:27:45 +01:00
|
|
|
import { ItemsConfig } 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()
|
2022-10-19 17:27:45 +01:00
|
|
|
export class CwxItemsConfig
|
2022-08-26 20:37:27 +01:00
|
|
|
{
|
|
|
|
private tables: Record<string, ITemplateItem>;
|
2022-10-19 17:27:45 +01:00
|
|
|
private config: ItemsConfig;
|
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-10-19 17:27:45 +01:00
|
|
|
@inject("CwxConfigHandler") private configHandler: CwxConfigHandler
|
2022-08-26 20:37:27 +01:00
|
|
|
)
|
|
|
|
{}
|
|
|
|
|
|
|
|
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-10-19 17:27:45 +01:00
|
|
|
this.config = this.configHandler.getConfig().itemsConfig;
|
2022-08-26 20:37:27 +01:00
|
|
|
|
2022-10-23 20:21:00 +01:00
|
|
|
//this.changeShrapProps();
|
|
|
|
//this.changeMaxAmmoForKS23();
|
|
|
|
//this.removeDevFromBlacklist();
|
2022-12-25 15:41:36 +00:00
|
|
|
this.inspectAllItems();
|
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"];
|
|
|
|
|
2022-10-19 17:27:45 +01:00
|
|
|
if (this.config.changeShrapProps)
|
2022-08-26 20:37:27 +01:00
|
|
|
{
|
|
|
|
shrap._props.Damage = 200;
|
|
|
|
shrap._props.InitialSpeed = 1000;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private changeMaxAmmoForKS23(): void
|
|
|
|
{
|
|
|
|
const ks23 = this.tables["5f647d9f8499b57dc40ddb93"];
|
|
|
|
|
2022-10-19 17:27:45 +01:00
|
|
|
if (this.config.changeMaxAmmoForKS23)
|
2022-08-26 20:37:27 +01:00
|
|
|
{
|
|
|
|
ks23._props.Cartridges[0]._max_count = 30;
|
|
|
|
}
|
|
|
|
}
|
2022-09-17 20:46:11 +01:00
|
|
|
|
|
|
|
private removeDevFromBlacklist(): void
|
|
|
|
{
|
2022-10-19 17:27:45 +01:00
|
|
|
if (this.config.removeDevFromBlacklist)
|
2022-09-17 20:46:11 +01:00
|
|
|
{
|
|
|
|
this.itemConfig.blacklist.splice(this.itemConfig.blacklist.indexOf("58ac60eb86f77401897560ff"));
|
|
|
|
}
|
|
|
|
}
|
2022-12-25 15:41:36 +00:00
|
|
|
|
|
|
|
private inspectAllItems(): void
|
|
|
|
{
|
|
|
|
if (this.config.inspectAllItems)
|
|
|
|
{
|
|
|
|
for (const item in this.tables)
|
|
|
|
{
|
|
|
|
this.tables[item]._props.ExaminedByDefault = true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-08-26 20:37:27 +01:00
|
|
|
}
|