2022-06-26 12:25:24 -04:00
|
|
|
import { inject, injectable } from "tsyringe";
|
|
|
|
import type { DatabaseServer } from "@spt-aki/servers/DatabaseServer";
|
|
|
|
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig";
|
|
|
|
import { AkiConfigHandler } from "./AkiConfigHandler";
|
2022-06-25 23:48:21 -04:00
|
|
|
|
2022-06-26 12:25:24 -04:00
|
|
|
@injectable()
|
|
|
|
export class bots
|
2022-06-25 23:48:21 -04:00
|
|
|
{
|
2022-06-26 12:25:24 -04:00
|
|
|
constructor(
|
|
|
|
@inject("AkiConfigHandler") private configHandler: AkiConfigHandler,
|
|
|
|
@inject("DatabaseServer") private database: DatabaseServer
|
|
|
|
)
|
|
|
|
{}
|
|
|
|
|
|
|
|
public applyChanges(): void
|
2022-06-25 23:48:21 -04:00
|
|
|
{
|
2022-06-26 12:25:24 -04:00
|
|
|
const configServer = container.resolve<ConfigServer>("ConfigServer");
|
|
|
|
const BotConfig = configServer.getConfig<IBotConfig>(ConfigTypes.BOT);
|
2022-06-25 23:48:21 -04:00
|
|
|
|
2022-06-26 12:25:24 -04:00
|
|
|
const pmcsConfig = this.configHandler.getPmcConfig().pmc.types
|
|
|
|
for (const bot in pmcsConfig)
|
|
|
|
{
|
2022-06-25 23:48:21 -04:00
|
|
|
switch (bot) {
|
|
|
|
default:
|
|
|
|
bots.pmc.types[bot] = pmcsConfig[bot]
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for(const options in config.pmc){
|
|
|
|
switch(options){
|
|
|
|
case "types":
|
|
|
|
break;
|
|
|
|
default:
|
|
|
|
bots.pmc[options] = config.pmc[options]
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
for (const bot in config.presetBatch) {
|
|
|
|
bots.presetBatch[bot] = config.presetBatch[bot]
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = bots;
|