From fcf99a34644205be2d4f6527e8960de3048980c8 Mon Sep 17 00:00:00 2001 From: Chomp Date: Tue, 7 Oct 2025 11:50:50 +0100 Subject: [PATCH] Added helper method `GetProfileTemplateFlagValue` --- .../Helpers/ProfileHelper.cs | 20 +++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs index 31056b43..491896d4 100644 --- a/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs +++ b/Libraries/SPTarkov.Server.Core/Helpers/ProfileHelper.cs @@ -714,4 +714,24 @@ public class ProfileHelper( ? matchingProfileTemplate.Bear : matchingProfileTemplate.Usec; } + + /// + /// Look up a key inside the `CustomFlags` property from a profile template + /// + /// Edition of profile desired, e.g. "Standard" + /// key stored in CustomFlags dictionary + /// + public bool GetProfileTemplateFlagValue(string accountEdition, string flagKey) + { + var profileTemplates = databaseService.GetProfileTemplates(); + + // Get matching profile 'type' e.g. 'standard' + if (!profileTemplates.TryGetValue(accountEdition, out var matchingProfileTemplate)) + { + logger.Error($"Unable to find profile template for account edition: {accountEdition}"); + return false; + } + + return matchingProfileTemplate.CustomFlags.GetValueOrDefault(flagKey, false); + } }