From 226107e25cec928f5a71f9230e5e170e6f11eafd Mon Sep 17 00:00:00 2001 From: Merijn Hendriks Date: Thu, 21 Sep 2023 14:15:29 +0000 Subject: [PATCH] Add trader to ragfair (#12) The default example only adds the trader to the trading menu, but doesn't display the trader in ragfair too (like how the default traders are). With this PR, the trader's inventory is also available in ragfair. Reviewed-on: https://dev.sp-tarkov.com/chomp/ModExamples/pulls/12 Co-authored-by: Merijn Hendriks Co-committed-by: Merijn Hendriks --- TypeScript/13AddTrader/src/mod.ts | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/TypeScript/13AddTrader/src/mod.ts b/TypeScript/13AddTrader/src/mod.ts index 982f376..bff4533 100644 --- a/TypeScript/13AddTrader/src/mod.ts +++ b/TypeScript/13AddTrader/src/mod.ts @@ -10,6 +10,7 @@ import { ImageRouter } from "@spt-aki/routers/ImageRouter"; import { ConfigServer } from "@spt-aki/servers/ConfigServer"; import { ConfigTypes } from "@spt-aki/models/enums/ConfigTypes"; import { ITraderConfig } from "@spt-aki/models/spt/config/ITraderConfig"; +import { IRagfairConfig } from "@spt-aki/models/spt/config/IRagfairConfig"; import { JsonUtil } from "@spt-aki/utils/JsonUtil"; // New trader settings @@ -47,6 +48,7 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod const hashUtil: HashUtil = container.resolve("HashUtil"); const configServer = container.resolve("ConfigServer"); const traderConfig: ITraderConfig = configServer.getConfig(ConfigTypes.TRADER); + const ragfairConfig = configServer.getConfig(ConfigTypes.RAGFAIR); // Create helper class and use it to register our traders image/icon + set its stock refresh time this.traderHelper = new TraderHelper(); @@ -57,6 +59,9 @@ class SampleTrader implements IPreAkiLoadMod, IPostDBLoadMod // Add trader to trader enum Traders[baseJson._id] = baseJson._id; + // Add trader to flea market + ragfairConfig.traders[baseJson._id] = true; + this.logger.debug(`[${this.mod}] preAki Loaded`); }