Remove second call to this.saveServer.getProfiles() + only run offer processing for profiles that have the necessary level to create flea offers

This commit is contained in:
Dev 2024-02-14 14:01:27 +00:00
parent 991ee312bd
commit 22d158f8a4
2 changed files with 8 additions and 2 deletions

View File

@ -308,9 +308,15 @@ export class RagfairController
*/ */
public update(): void public update(): void
{ {
const profilesDict = this.saveServer.getProfiles();
for (const sessionID in 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); this.ragfairOfferHelper.processOffersOnProfile(sessionID);
} }

View File

@ -701,7 +701,7 @@ export class RagfairOfferHelper
return false; return false;
} }
// weapon/equipment search + offer is preset // Weapon/equipment search + offer is preset
if ( if (
Object.keys(searchRequest.buildItems).length === 0 // Prevent equipment loadout searches filtering out presets Object.keys(searchRequest.buildItems).length === 0 // Prevent equipment loadout searches filtering out presets
&& searchRequest.buildCount && searchRequest.buildCount