From 22d158f8a4a052d48de34e58d1aec18d5510d2d6 Mon Sep 17 00:00:00 2001 From: Dev Date: Wed, 14 Feb 2024 14:01:27 +0000 Subject: [PATCH] Remove second call to `this.saveServer.getProfiles()` + only run offer processing for profiles that have the necessary level to create flea offers --- project/src/controllers/RagfairController.ts | 8 +++++++- project/src/helpers/RagfairOfferHelper.ts | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/project/src/controllers/RagfairController.ts b/project/src/controllers/RagfairController.ts index 7fd3ed8b..765f9fa2 100644 --- a/project/src/controllers/RagfairController.ts +++ b/project/src/controllers/RagfairController.ts @@ -308,9 +308,15 @@ export class RagfairController */ public update(): void { + const profilesDict = this.saveServer.getProfiles(); for (const sessionID in this.saveServer.getProfiles()) { - if (this.saveServer.getProfile(sessionID).characters.pmc.RagfairInfo !== undefined) + // Check profile is capable of creating offers + const pmcProfile = profilesDict[sessionID].characters.pmc; + if ( + pmcProfile.RagfairInfo !== undefined + && pmcProfile.Info.Level >= this.databaseServer.getTables().globals.config.RagFair.minUserLevel + ) { this.ragfairOfferHelper.processOffersOnProfile(sessionID); } diff --git a/project/src/helpers/RagfairOfferHelper.ts b/project/src/helpers/RagfairOfferHelper.ts index 8843dd39..48ed067b 100644 --- a/project/src/helpers/RagfairOfferHelper.ts +++ b/project/src/helpers/RagfairOfferHelper.ts @@ -701,7 +701,7 @@ export class RagfairOfferHelper return false; } - // weapon/equipment search + offer is preset + // Weapon/equipment search + offer is preset if ( Object.keys(searchRequest.buildItems).length === 0 // Prevent equipment loadout searches filtering out presets && searchRequest.buildCount