Fixed example 3 using an incorrect config property

This commit is contained in:
Dev 2024-04-26 14:24:17 +01:00
parent 082d87ddc8
commit 361af8a9d3

View File

@ -4,29 +4,30 @@ import { IPostAkiLoadMod } from "@spt-aki/models/external/IPostAkiLoadMod";
import { ILogger } from "@spt-aki/models/spt/utils/ILogger"; import { ILogger } from "@spt-aki/models/spt/utils/ILogger";
import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { ConfigServer } from "@spt-aki/servers/ConfigServer";
import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes";
import { IBotConfig } from "@spt-aki/models/spt/config/IBotConfig"; import { ILocationConfig } from "@spt-aki/models/spt/config/ILocationConfig";
class Mod implements IPostAkiLoadMod class Mod implements IPostAkiLoadMod
{ {
public postAkiLoad(container: DependencyContainer): void { public postAkiLoad(container: DependencyContainer): void
{
// get logger // get logger
const logger = container.resolve<ILogger>("WinstonLogger"); const logger = container.resolve<ILogger>("WinstonLogger");
// get the config server // get the config server so we can get a config with it
const configServer = container.resolve<ConfigServer>("ConfigServer"); const configServer = container.resolve<ConfigServer>("ConfigServer");
// Request bot config // Request the map location config
// Required - ConfigTypes.BOT is the enum of the config we want, others include ConfigTypes.Airdrop // Required - ConfigTypes.LOCATION is the enum of the config we want, others include ConfigTypes.Airdrop
const botConfig = configServer.getConfig<IBotConfig>(ConfigTypes.BOT); const locationConfig: ILocationConfig = configServer.getConfig<ILocationConfig>(ConfigTypes.LOCATION);
// log the original pmc difficulty // Log the original customs loose loot multipler
logger.info(`here is the original bot pmc difficulty: ${botConfig.pmc.difficulty}`) logger.info(`Here is the original customs map loose loot multipler: ${locationConfig.looseLootMultiplier.bigmap}`)
// adjust the difficulty // Adjust the multipler (customs is called bigmap in bsg land)
botConfig.pmc.difficulty = "easy"; locationConfig.looseLootMultiplier.bigmap = 10;
// log the new pmc difficulty // Log the new multipler
logger.info(`here is the altered bot pmc difficulty: ${botConfig.pmc.difficulty}`) logger.info(`Here is the altered customs map loose loot multipler: ${locationConfig.looseLootMultiplier.bigmap}`)
} }
} }