CWX-mods/Live/CWX_DebugTool/src/itemsConfig.ts

65 lines
2.0 KiB
TypeScript
Raw Normal View History

2022-08-26 20:37:27 +01:00
import { inject, injectable } from "tsyringe";
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"
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()
export class CwxItemsConfig
2022-08-26 20:37:27 +01:00
{
private tables: Record<string, ITemplateItem>;
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,
@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);
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-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.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"];
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
{
if (this.config.removeDevFromBlacklist)
2022-09-17 20:46:11 +01:00
{
this.itemConfig.blacklist.splice(this.itemConfig.blacklist.indexOf("58ac60eb86f77401897560ff"));
}
}
2022-08-26 20:37:27 +01:00
}