From a912f7c9cd9a6b775f6cedcbf5fb3b7f1cbfbfdb Mon Sep 17 00:00:00 2001 From: Dev Date: Mon, 31 Jul 2023 15:41:10 +0100 Subject: [PATCH] When bsg flea blacklsit is disabled, set all items as sellable on flea --- project/src/controllers/GameController.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/project/src/controllers/GameController.ts b/project/src/controllers/GameController.ts index cd4a3603..a397197d 100644 --- a/project/src/controllers/GameController.ts +++ b/project/src/controllers/GameController.ts @@ -20,6 +20,7 @@ import { Traders } from "../models/enums/Traders"; import { ICoreConfig } from "../models/spt/config/ICoreConfig"; import { IHttpConfig } from "../models/spt/config/IHttpConfig"; import { ILocationConfig } from "../models/spt/config/ILocationConfig"; +import { IRagfairConfig } from "../models/spt/config/IRagfairConfig"; import { ILocationData } from "../models/spt/server/ILocations"; import { ILogger } from "../models/spt/utils/ILogger"; import { ConfigServer } from "../servers/ConfigServer"; @@ -42,6 +43,7 @@ export class GameController protected httpConfig: IHttpConfig; protected coreConfig: ICoreConfig; protected locationConfig: ILocationConfig; + protected ragfairConfig: IRagfairConfig; constructor( @inject("WinstonLogger") protected logger: ILogger, @@ -66,6 +68,7 @@ export class GameController this.httpConfig = this.configServer.getConfig(ConfigTypes.HTTP); this.coreConfig = this.configServer.getConfig(ConfigTypes.CORE); this.locationConfig = this.configServer.getConfig(ConfigTypes.LOCATION); + this.ragfairConfig = this.configServer.getConfig(ConfigTypes.RAGFAIR); } /** @@ -173,6 +176,12 @@ export class GameController { this.warnOnActiveBotReloadSkill(pmcProfile); } + + // Flea bsg blacklist is off + if (!this.ragfairConfig.dynamic.blacklist.enableBsgList) + { + this.flagAllItemsInDbAsSellableOnFlea(); + } } } @@ -334,6 +343,18 @@ export class GameController } } + protected flagAllItemsInDbAsSellableOnFlea(): void + { + const dbItems = Object.values(this.databaseServer.getTables().templates.items); + for (const item of dbItems) + { + if (item._type === "Item" && !item._props?.CanSellOnRagfair) + { + item._props.CanSellOnRagfair = true; + } + } + } + /** * When player logs in, iterate over all active effects and reduce timer * TODO - add body part HP regen