51 lines
1.5 KiB
TypeScript
Raw Normal View History

2022-06-26 12:25:24 -04:00
import { inject, injectable } from "tsyringe";
2022-06-27 00:11:22 -04:00
import type { ILogger } from "@spt-aki/models/spt/utils/ILogger";
2022-06-26 12:25:24 -04:00
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
2022-06-27 00:11:22 -04:00
import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
2022-06-26 12:25:24 -04:00
import { AkiConfigHandler } from "./AkiConfigHandler";
2022-06-26 12:25:24 -04:00
@injectable()
2022-06-27 00:11:22 -04:00
export class Bots
{
2022-06-26 12:25:24 -04:00
constructor(
2022-06-27 00:11:22 -04:00
@inject("AkiConfigHandler") protected configHandler: AkiConfigHandler,
@inject("ConfigServer") protected configServer: ConfigServer,
@inject("WinstonLogger") private logger: ILogger
2022-06-26 12:25:24 -04:00
)
{}
public applyChanges(): void
{
2022-06-27 00:11:22 -04:00
const pmcConfig = this.configHandler.getPmcConfig();
const bots = this.configServer.getConfig<IBotConfig>(ConfigTypes.BOT);
2022-06-27 00:11:22 -04:00
for (const bot in pmcConfig.pmc.types)
2022-06-26 12:25:24 -04:00
{
2022-06-27 00:11:22 -04:00
switch (bot)
{
default:
2022-06-27 00:11:22 -04:00
bots.pmc.types[bot] = pmcConfig.pmc.types[bot];
break;
}
}
2022-06-27 00:11:22 -04:00
for (const options in pmcConfig.pmc)
{
switch (options)
{
case "types":
break;
default:
2022-06-27 00:11:22 -04:00
bots.pmc[options] = pmcConfig.pmc[options];
break;
}
}
2022-06-27 00:11:22 -04:00
for (const bot in pmcConfig.presetBatch)
{
bots.presetBatch[bot] = pmcConfig.presetBatch[bot];
}
}
}