made properties readonly

This commit is contained in:
Chomp
2025-06-28 12:53:21 +01:00
parent 42e79c981b
commit da5644cfa2
63 changed files with 119 additions and 102 deletions
@@ -14,7 +14,7 @@ public class AchievementController(
ConfigServer configServer
)
{
protected CoreConfig coreConfig = configServer.GetConfig<CoreConfig>();
protected readonly CoreConfig coreConfig = configServer.GetConfig<CoreConfig>();
/// <summary>
/// Get base achievements
@@ -27,8 +27,8 @@ public class DialogueController(
IEnumerable<IDialogueChatBot> dialogueChatBots
)
{
protected CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
protected List<IDialogueChatBot> _dialogueChatBots = dialogueChatBots.ToList();
protected readonly CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
protected readonly List<IDialogueChatBot> _dialogueChatBots = dialogueChatBots.ToList();
/// <summary>
/// </summary>
@@ -15,8 +15,8 @@ public class InRaidController(
ConfigServer _configServer
)
{
protected BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected InRaidConfig _inRaidConfig = _configServer.GetConfig<InRaidConfig>();
protected readonly BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected readonly InRaidConfig _inRaidConfig = _configServer.GetConfig<InRaidConfig>();
/// <summary>
/// Save locationId to active profiles in-raid object AND app context
@@ -44,7 +44,8 @@ public class InsuranceController(
ICloner _cloner
)
{
protected InsuranceConfig _insuranceConfig = _configServer.GetConfig<InsuranceConfig>();
protected readonly InsuranceConfig _insuranceConfig =
_configServer.GetConfig<InsuranceConfig>();
/// <summary>
/// Process insurance items of all profiles prior to being given back to the player through the mail service
@@ -28,7 +28,7 @@ public class LauncherController(
ConfigServer _configServer
)
{
protected CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
protected readonly CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
/// <summary>
/// Handle launcher connecting to server
@@ -25,7 +25,7 @@ public class LauncherV2Controller(
Watermark _watermark
)
{
protected CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
protected readonly CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
/// <summary>
/// Returns a simple string of Pong!
@@ -46,7 +46,7 @@ public class RepeatableQuestController(
)
{
protected static readonly List<string> _questTypes = ["PickUp", "Exploration", "Elimination"];
protected QuestConfig QuestConfig = _configServer.GetConfig<QuestConfig>();
protected readonly QuestConfig QuestConfig = _configServer.GetConfig<QuestConfig>();
/// <summary>
/// Handle the client accepting a repeatable quest and starting it
@@ -38,8 +38,8 @@ public class TradeController(
ConfigServer _configServer
)
{
protected RagfairConfig _ragfairConfig = _configServer.GetConfig<RagfairConfig>();
protected TraderConfig _traderConfig = _configServer.GetConfig<TraderConfig>();
protected readonly RagfairConfig _ragfairConfig = _configServer.GetConfig<RagfairConfig>();
protected readonly TraderConfig _traderConfig = _configServer.GetConfig<TraderConfig>();
/// <summary>
/// Handle TradingConfirm event
@@ -85,7 +85,7 @@ public class BotEquipmentModGenerator(
"cartridges",
];
protected BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected readonly BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
/// <summary>
/// Check mods are compatible and add to array
@@ -37,8 +37,8 @@ public class BotGenerator(
ICloner _cloner
)
{
protected BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected PmcConfig _pmcConfig = _configServer.GetConfig<PmcConfig>();
protected readonly BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected readonly PmcConfig _pmcConfig = _configServer.GetConfig<PmcConfig>();
/// <summary>
/// Generate a player scav bot object
@@ -32,8 +32,8 @@ public class BotLootGenerator(
ICloner _cloner
)
{
protected BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected PmcConfig _pmcConfig = _configServer.GetConfig<PmcConfig>();
protected readonly BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected readonly PmcConfig _pmcConfig = _configServer.GetConfig<PmcConfig>();
/// <summary>
/// </summary>
@@ -35,12 +35,12 @@ public class BotWeaponGenerator(
)
{
protected const string _modMagazineSlotId = "mod_magazine";
protected BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected IEnumerable<IInventoryMagGen> _inventoryMagGenComponents = MagGenSetUp(
protected readonly BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected readonly IEnumerable<IInventoryMagGen> _inventoryMagGenComponents = MagGenSetUp(
inventoryMagGenComponents
);
protected PmcConfig _pmcConfig = _configServer.GetConfig<PmcConfig>();
protected RepairConfig _repairConfig = _configServer.GetConfig<RepairConfig>();
protected readonly PmcConfig _pmcConfig = _configServer.GetConfig<PmcConfig>();
protected readonly RepairConfig _repairConfig = _configServer.GetConfig<RepairConfig>();
protected static List<IInventoryMagGen> MagGenSetUp(IEnumerable<IInventoryMagGen> components)
{
@@ -27,7 +27,7 @@ public class FenceBaseAssortGenerator(
ICloner _cloner
)
{
protected TraderConfig traderConfig = configServer.GetConfig<TraderConfig>();
protected readonly TraderConfig traderConfig = configServer.GetConfig<TraderConfig>();
/// <summary>
/// Create base fence assorts dynamically and store in memory
@@ -37,7 +37,8 @@ public class PlayerScavGenerator(
TimeUtil _timeUtil
)
{
protected PlayerScavConfig _playerScavConfig = _configServer.GetConfig<PlayerScavConfig>();
protected readonly PlayerScavConfig _playerScavConfig =
_configServer.GetConfig<PlayerScavConfig>();
/// <summary>
/// Update a player profile to include a new player scav profile
@@ -40,12 +40,12 @@ public class RagfairOfferGenerator(
)
{
protected List<TplWithFleaPrice>? allowedFleaPriceItemsForBarter;
protected BotConfig botConfig = configServer.GetConfig<BotConfig>();
protected readonly BotConfig botConfig = configServer.GetConfig<BotConfig>();
/// Internal counter to ensure each offer created has a unique value for its intId property
protected int offerCounter;
protected RagfairConfig ragfairConfig = configServer.GetConfig<RagfairConfig>();
protected readonly RagfairConfig ragfairConfig = configServer.GetConfig<RagfairConfig>();
/// <summary>
/// Create a flea offer and store it in the Ragfair server offers array
@@ -33,7 +33,7 @@ public class ScavCaseRewardGenerator(
{
protected List<TemplateItem> _dbAmmoItemsCache = [];
protected List<TemplateItem> _dbItemsCache = [];
protected ScavCaseConfig _scavCaseConfig = _configServer.GetConfig<ScavCaseConfig>();
protected readonly ScavCaseConfig _scavCaseConfig = _configServer.GetConfig<ScavCaseConfig>();
/// <summary>
/// Create an array of rewards that will be given to the player upon completing their scav case build
@@ -19,7 +19,7 @@ public class WeatherGenerator(
RandomUtil _randomUtil
)
{
protected WeatherConfig _weatherConfig = _configServer.GetConfig<WeatherConfig>();
protected readonly WeatherConfig _weatherConfig = _configServer.GetConfig<WeatherConfig>();
/// <summary>
/// Get current + raid datetime and format into correct BSG format.
@@ -21,7 +21,7 @@ public class BotDifficultyHelper(
ICloner _cloner
)
{
protected PmcConfig _pmcConfig = _configServer.GetConfig<PmcConfig>();
protected readonly PmcConfig _pmcConfig = _configServer.GetConfig<PmcConfig>();
/// <summary>
/// Get difficulty settings for desired bot type, if not found use assault bot types
@@ -14,8 +14,8 @@ public abstract class AbstractDialogChatBot(
IEnumerable<IChatCommand> chatCommands
) : IDialogueChatBot
{
protected IDictionary<string, IChatCommand> _chatCommands = chatCommands.ToDictionary(command =>
command.GetCommandPrefix()
protected readonly IDictionary<string, IChatCommand> _chatCommands = chatCommands.ToDictionary(
command => command.GetCommandPrefix()
);
public abstract UserDialogInfo GetChatBot();
@@ -40,7 +40,7 @@ public class GiveSptCommand(
ItemTpl.FLARE_RSP30_REACTIVE_SIGNAL_CARTRIDGE_YELLOW,
];
protected Dictionary<string, SavedCommand> _savedCommand = new();
protected readonly Dictionary<string, SavedCommand> _savedCommand = new();
public string GetCommand()
{
@@ -21,7 +21,7 @@ public class TraderSptCommand(
MailSendService _mailSendService
) : ISptCommand
{
protected Regex _commandRegex = new(
protected readonly Regex _commandRegex = new(
@"^spt trader (?<trader>[\w]+) (?<command>rep|spend) (?<quantity>(?!0+)[0-9]+)$"
);
@@ -18,7 +18,7 @@ public class CommandoDialogChatBot(
IEnumerable<IChatCommand> chatCommands
) : AbstractDialogChatBot(logger, mailSendService, localisationService, chatCommands)
{
protected CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
protected readonly CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
public override UserDialogInfo GetChatBot()
{
@@ -21,10 +21,9 @@ public class SptDialogueChatBot(
IEnumerable<IChatMessageHandler> chatMessageHandlers
) : IDialogueChatBot
{
protected IEnumerable<IChatMessageHandler> _chatMessageHandlers = ChatMessageHandlerSetup(
chatMessageHandlers
);
protected CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
protected readonly IEnumerable<IChatMessageHandler> _chatMessageHandlers =
ChatMessageHandlerSetup(chatMessageHandlers);
protected readonly CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
public UserDialogInfo GetChatBot()
{
@@ -11,7 +11,7 @@ public class HttpServerHelper(ConfigServer configServer)
{
protected readonly HttpConfig _httpConfig = configServer.GetConfig<HttpConfig>();
protected Dictionary<string, string> mime = new()
protected readonly Dictionary<string, string> mime = new()
{
{ "css", "text/css" },
{ "bin", "application/octet-stream" },
@@ -8,7 +8,7 @@ namespace SPTarkov.Server.Core.Helpers;
[Injectable(InjectionType.Singleton)]
public class NotifierHelper(HttpServerHelper httpServerHelper, HashUtil hashUtil)
{
protected static WsPing ping = new();
protected static readonly WsPing ping = new();
public WsNotificationEvent GetDefaultNotification()
{
@@ -34,7 +34,8 @@ public class ProfileHelper(
"edge_of_darkness",
"unheard_edition",
];
protected InventoryConfig _inventoryConfig = _configServer.GetConfig<InventoryConfig>();
protected readonly InventoryConfig _inventoryConfig =
_configServer.GetConfig<InventoryConfig>();
/// <summary>
/// Remove/reset a completed quest condtion from players profile quest data
@@ -27,7 +27,7 @@ public class QuestRewardHelper(
/// Value can be modified by modders by overriding this value with new traders.
/// Ensure to add Lightkeeper's ID (638f541a29ffd1183d187f57) and BTR Driver's ID (656f0f98d80a697f855d34b1)
/// </summary>
protected string[] InGameTraders = [Traders.LIGHTHOUSEKEEPER, Traders.BTR];
protected readonly string[] InGameTraders = [Traders.LIGHTHOUSEKEEPER, Traders.BTR];
/// <summary>
/// Give player quest rewards - Skills/exp/trader standing/items/assort unlocks - Returns reward items player earned
@@ -18,7 +18,7 @@ public class RagfairSellHelper(
ConfigServer _configServer
)
{
protected RagfairConfig _ragfairConfig = _configServer.GetConfig<RagfairConfig>();
protected readonly RagfairConfig _ragfairConfig = _configServer.GetConfig<RagfairConfig>();
/// <summary>
/// Get the percent chance to sell an item based on its average listed price vs player chosen listing price
@@ -19,7 +19,7 @@ public class RepeatableQuestHelper(
ConfigServer configServer
)
{
protected QuestConfig QuestConfig = configServer.GetConfig<QuestConfig>();
protected readonly QuestConfig QuestConfig = configServer.GetConfig<QuestConfig>();
/// <summary>
/// Get the relevant elimination config based on the current players PMC level
@@ -30,9 +30,13 @@ public class TraderHelper(
ConfigServer _configServer
)
{
protected List<string> _gameVersions = [GameEditions.EDGE_OF_DARKNESS, GameEditions.UNHEARD];
protected Dictionary<string, double> _highestTraderPriceItems = new();
protected TraderConfig _traderConfig = _configServer.GetConfig<TraderConfig>();
protected readonly List<string> _gameVersions =
[
GameEditions.EDGE_OF_DARKNESS,
GameEditions.UNHEARD,
];
protected readonly Dictionary<string, double> _highestTraderPriceItems = new();
protected readonly TraderConfig _traderConfig = _configServer.GetConfig<TraderConfig>();
public TraderBase? GetTraderByNickName(string traderName)
{
@@ -14,7 +14,7 @@ public class WeatherHelper(
ConfigServer _configServer
)
{
protected WeatherConfig _weatherConfig = _configServer.GetConfig<WeatherConfig>();
protected readonly WeatherConfig _weatherConfig = _configServer.GetConfig<WeatherConfig>();
/// <summary>
/// Assumes current time
@@ -6,8 +6,8 @@ namespace SPTarkov.Server.Core.Routers;
[Injectable]
public class HttpRouter
{
protected IEnumerable<DynamicRouter> _dynamicRoutes;
protected IEnumerable<StaticRouter> _staticRouters;
protected readonly IEnumerable<DynamicRouter> _dynamicRoutes;
protected readonly IEnumerable<StaticRouter> _staticRouters;
public HttpRouter(
IEnumerable<StaticRouter> staticRouters,
@@ -29,8 +29,8 @@ public class SaveServer(
protected readonly Dictionary<string, Func<SptProfile, SptProfile>> onBeforeSaveCallbacks =
new();
protected ConcurrentDictionary<string, SptProfile> profiles = new();
protected ConcurrentDictionary<string, string> saveMd5 = new();
protected readonly ConcurrentDictionary<string, SptProfile> profiles = new();
protected readonly ConcurrentDictionary<string, string> saveMd5 = new();
/// <summary>
/// Add callback to occur prior to saving profile changes
@@ -20,8 +20,8 @@ public class SptWebSocketConnectionHandler(
IEnumerable<ISptWebSocketMessageHandler> _messageHandlers
) : IWebSocketConnectionHandler
{
protected Dictionary<string, Dictionary<string, WebSocket>> _sockets = new();
protected Lock _socketsLock = new();
protected readonly Dictionary<string, Dictionary<string, WebSocket>> _sockets = new();
protected readonly Lock _socketsLock = new();
public string GetHookUrl()
{
@@ -13,7 +13,7 @@ public class BotGenerationCacheService(
)
{
protected Queue<BotBase> _activeBotsInRaid = [];
protected ConcurrentDictionary<string, List<BotBase>> _storedBots = new();
protected readonly ConcurrentDictionary<string, List<BotBase>> _storedBots = new();
/// <summary>
/// Store list of bots in cache, shuffle results before storage
@@ -20,7 +20,7 @@ public class BotLootCacheService(
ICloner _cloner
)
{
protected ConcurrentDictionary<string, BotLootCache> _lootCache = new();
protected readonly ConcurrentDictionary<string, BotLootCache> _lootCache = new();
private readonly Lock _drugLock = new();
private readonly Lock _foodLock = new();
private readonly Lock _drinkLock = new();
@@ -21,8 +21,8 @@ public class BotNameService(
)
{
protected readonly Lock _lockObject = new();
protected BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected HashSet<string> _usedNameCache = new();
protected readonly BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected readonly HashSet<string> _usedNameCache = new();
/// <summary>
/// Clear out any entries in Name Set
@@ -17,7 +17,7 @@ public class BotWeaponModLimitService(
ItemHelper _itemHelper
)
{
protected BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected readonly BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
/// <summary>
/// Initalise mod limits to be used when generating a weapon
@@ -24,10 +24,11 @@ public class BtrDeliveryService(
LocalisationService _localisationService
)
{
protected BtrDeliveryConfig _btrDeliveryConfig = _configServer.GetConfig<BtrDeliveryConfig>();
protected TraderConfig _traderConfig = _configServer.GetConfig<TraderConfig>();
protected readonly BtrDeliveryConfig _btrDeliveryConfig =
_configServer.GetConfig<BtrDeliveryConfig>();
protected readonly TraderConfig _traderConfig = _configServer.GetConfig<TraderConfig>();
protected static List<string> _transferTypes = new() { "btr", "transit" };
protected static readonly List<string> _transferTypes = new() { "btr", "transit" };
/// <summary>
/// Check if player used BTR or transit item sending service and send items to player via mail if found
@@ -14,7 +14,7 @@ public class CustomLocationWaveService(
ConfigServer _configServer
)
{
protected LocationConfig _locationConfig = _configServer.GetConfig<LocationConfig>();
protected readonly LocationConfig _locationConfig = _configServer.GetConfig<LocationConfig>();
/// <summary>
/// Add a boss wave to a map
@@ -44,7 +44,7 @@ public class FenceService(
/// </summary>
protected TraderAssort? fenceDiscountAssort;
protected HashSet<string> fenceItemUpdCompareProperties =
protected readonly HashSet<string> fenceItemUpdCompareProperties =
[
"Buff",
"Repairable",
@@ -62,7 +62,7 @@ public class FenceService(
/// </summary>
protected long nextPartialRefreshTimestamp;
protected TraderConfig traderConfig = configServer.GetConfig<TraderConfig>();
protected readonly TraderConfig traderConfig = configServer.GetConfig<TraderConfig>();
/// <summary>
/// Replace main fence assort with new assort
@@ -22,7 +22,7 @@ public class GiftService(
ConfigServer _configServer
)
{
protected GiftsConfig _giftConfig = _configServer.GetConfig<GiftsConfig>();
protected readonly GiftsConfig _giftConfig = _configServer.GetConfig<GiftsConfig>();
/// <summary>
/// Does a gift with a specific ID exist in db
@@ -5,7 +5,7 @@ namespace SPTarkov.Server.Core.Services.Image;
[Injectable(InjectionType.Singleton)]
public class ImageRouterService
{
protected Dictionary<string, string> routes = new();
protected readonly Dictionary<string, string> routes = new();
public void AddRoute(string urlKey, string route)
{
@@ -6,7 +6,7 @@ namespace SPTarkov.Server.Core.Services;
[Injectable(InjectionType.Singleton)]
public class InMemoryCacheService(ICloner _cloner)
{
protected Dictionary<string, object?> _cacheData = new();
protected readonly Dictionary<string, object?> _cacheData = new();
/// <summary>
/// Store data into an in-memory object
@@ -34,7 +34,7 @@ public class InsuranceService(
{
protected readonly InsuranceConfig _insuranceConfig =
_configServer.GetConfig<InsuranceConfig>();
protected Dictionary<string, Dictionary<string, List<Item>>?> _insured = new();
protected readonly Dictionary<string, Dictionary<string, List<Item>>?> _insured = new();
/// <summary>
/// Does player have insurance dictionary exists
@@ -16,10 +16,10 @@ public class ItemFilterService(
ConfigServer _configServer
)
{
protected HashSet<string>? _itemBlacklistCache = [];
protected ItemConfig _itemConfig = _configServer.GetConfig<ItemConfig>();
protected readonly HashSet<string>? _itemBlacklistCache = [];
protected readonly ItemConfig _itemConfig = _configServer.GetConfig<ItemConfig>();
protected HashSet<string>? _lootableItemBlacklistCache = [];
protected readonly HashSet<string>? _lootableItemBlacklistCache = [];
/// <summary>
/// Check if the provided template id is blacklisted in config/item.json/blacklist
@@ -30,12 +30,12 @@ public class MailSendService(
)
{
private const string _systemSenderId = "59e7125688a45068a6249071";
protected HashSet<MessageType> _messageTypes =
protected readonly HashSet<MessageType> _messageTypes =
[
MessageType.NpcTraderMessage,
MessageType.FleamarketMessage,
];
protected HashSet<string> _slotNames = ["hideout", "main"];
protected readonly HashSet<string> _slotNames = ["hideout", "main"];
/// <summary>
/// Send a message from an NPC (e.g. prapor) to the player with or without items using direct message text, do not look up any locale
@@ -6,7 +6,7 @@ namespace SPTarkov.Server.Core.Services;
[Injectable(InjectionType.Singleton)]
public class MatchLocationService
{
protected Dictionary<string, MatchGroup> _locations = new();
protected readonly Dictionary<string, MatchGroup> _locations = new();
/// <summary>
/// DisbandRaidGroup
@@ -6,7 +6,7 @@ namespace SPTarkov.Server.Core.Services;
[Injectable(InjectionType.Singleton)]
public class NotificationService
{
protected Dictionary<string, List<WsNotificationEvent>> _messageQueue = new();
protected readonly Dictionary<string, List<WsNotificationEvent>> _messageQueue = new();
public Dictionary<string, List<WsNotificationEvent>> GetMessageQueue()
{
@@ -16,7 +16,7 @@ public class OpenZoneService(
ConfigServer _configServer
)
{
protected LocationConfig _locationConfig = _configServer.GetConfig<LocationConfig>();
protected readonly LocationConfig _locationConfig = _configServer.GetConfig<LocationConfig>();
/// <summary>
/// Add open zone to specified map
@@ -29,7 +29,8 @@ public class PaymentService(
ConfigServer _configServer
)
{
protected InventoryConfig _inventoryConfig = _configServer.GetConfig<InventoryConfig>();
protected readonly InventoryConfig _inventoryConfig =
_configServer.GetConfig<InventoryConfig>();
/// <summary>
/// Take money and insert items into return to server request
@@ -28,7 +28,8 @@ public class PmcChatResponseService(
)
{
protected GiftsConfig _giftConfig = _configServer.GetConfig<GiftsConfig>();
protected PmcChatResponse _pmcResponsesConfig = _configServer.GetConfig<PmcChatResponse>();
protected readonly PmcChatResponse _pmcResponsesConfig =
_configServer.GetConfig<PmcChatResponse>();
/// <summary>
/// For each PMC victim of the player, have a chance to send a message to the player, can be positive or negative
@@ -24,14 +24,14 @@ public class PostDbLoadService(
ICloner _cloner
)
{
protected BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
protected HideoutConfig _hideoutConfig = _configServer.GetConfig<HideoutConfig>();
protected ItemConfig _itemConfig = _configServer.GetConfig<ItemConfig>();
protected LocationConfig _locationConfig = _configServer.GetConfig<LocationConfig>();
protected LootConfig _lootConfig = _configServer.GetConfig<LootConfig>();
protected PmcConfig _pmcConfig = _configServer.GetConfig<PmcConfig>();
protected RagfairConfig _ragfairConfig = _configServer.GetConfig<RagfairConfig>();
protected readonly BotConfig _botConfig = _configServer.GetConfig<BotConfig>();
protected readonly CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
protected readonly HideoutConfig _hideoutConfig = _configServer.GetConfig<HideoutConfig>();
protected readonly ItemConfig _itemConfig = _configServer.GetConfig<ItemConfig>();
protected readonly LocationConfig _locationConfig = _configServer.GetConfig<LocationConfig>();
protected readonly LootConfig _lootConfig = _configServer.GetConfig<LootConfig>();
protected readonly PmcConfig _pmcConfig = _configServer.GetConfig<PmcConfig>();
protected readonly RagfairConfig _ragfairConfig = _configServer.GetConfig<RagfairConfig>();
public void PerformPostDbLoadActions()
{
@@ -30,8 +30,8 @@ public class ProfileFixerService(
InventoryHelper _inventoryHelper
)
{
protected List<string> _areas = ["hideout", "main"];
protected CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
protected readonly List<string> _areas = ["hideout", "main"];
protected readonly CoreConfig _coreConfig = _configServer.GetConfig<CoreConfig>();
/// <summary>
/// Find issues in the pmc profile data that may cause issues and fix them
@@ -31,7 +31,7 @@ public class RagfairOfferService(
)
{
private bool _playerOffersLoaded;
protected RagfairConfig _ragfairConfig = configServer.GetConfig<RagfairConfig>();
protected readonly RagfairConfig _ragfairConfig = configServer.GetConfig<RagfairConfig>();
/// <summary>
/// Get all offers
@@ -21,7 +21,10 @@ public class RagfairTaxService(
ICloner _cloner
)
{
protected Dictionary<string, StorePlayerOfferTaxAmountRequestData> _playerOfferTaxCache = new();
protected readonly Dictionary<
string,
StorePlayerOfferTaxAmountRequestData
> _playerOfferTaxCache = new();
public void StoreClientOfferTaxValue(
string sessionId,
@@ -21,7 +21,7 @@ public class RaidTimeAdjustmentService(
ConfigServer _configServer
)
{
protected LocationConfig _locationConfig = _configServer.GetConfig<LocationConfig>();
protected readonly LocationConfig _locationConfig = _configServer.GetConfig<LocationConfig>();
/// <summary>
/// Make alterations to the base map data passed in
@@ -18,8 +18,8 @@ public class RaidWeatherService(
ConfigServer _configServer
)
{
protected WeatherConfig _weatherConfig = _configServer.GetConfig<WeatherConfig>();
protected List<Weather> _weatherForecast = [];
protected readonly WeatherConfig _weatherConfig = _configServer.GetConfig<WeatherConfig>();
protected readonly List<Weather> _weatherForecast = [];
/// <summary>
/// Generate 24 hours of weather data starting from midnight today
@@ -34,7 +34,7 @@ public class RepairService(
WeightedRandomHelper _weightedRandomHelper
)
{
protected RepairConfig _repairConfig = _configServer.GetConfig<RepairConfig>();
protected readonly RepairConfig _repairConfig = _configServer.GetConfig<RepairConfig>();
/// <summary>
/// Use trader to repair an items durability
@@ -84,13 +84,18 @@ public class SeasonalEventService(
ItemTpl.RANDOMLOOTCONTAINER_PUMPKIN_RAND_LOOT_CONTAINER,
];
protected HttpConfig _httpConfig = _configServer.GetConfig<HttpConfig>();
protected LocationConfig _locationConfig = _configServer.GetConfig<LocationConfig>();
protected HashSet<string> _lootContainersToFilter = ["Backpack", "Pockets", "TacticalVest"];
protected QuestConfig _questConfig = _configServer.GetConfig<QuestConfig>();
protected SeasonalEventConfig _seasonalEventConfig =
protected readonly HttpConfig _httpConfig = _configServer.GetConfig<HttpConfig>();
protected readonly LocationConfig _locationConfig = _configServer.GetConfig<LocationConfig>();
protected readonly HashSet<string> _lootContainersToFilter =
[
"Backpack",
"Pockets",
"TacticalVest",
];
protected readonly QuestConfig _questConfig = _configServer.GetConfig<QuestConfig>();
protected readonly SeasonalEventConfig _seasonalEventConfig =
_configServer.GetConfig<SeasonalEventConfig>();
protected WeatherConfig _weatherConfig = _configServer.GetConfig<WeatherConfig>();
protected readonly WeatherConfig _weatherConfig = _configServer.GetConfig<WeatherConfig>();
/// <summary>
/// Get an array of christmas items found in bots inventories as loot
@@ -18,7 +18,7 @@ public class TraderPurchasePersisterService(
ConfigServer _configServer
)
{
protected TraderConfig _traderConfig = _configServer.GetConfig<TraderConfig>();
protected readonly TraderConfig _traderConfig = _configServer.GetConfig<TraderConfig>();
/// <summary>
/// Get the purchases made from a trader for this profile before the last trader reset
@@ -14,7 +14,7 @@ public class HttpResponseUtil
protected readonly JsonUtil _jsonUtil;
protected readonly LocalisationService _localisationService;
protected ImmutableList<Regex> _cleanupRegexList =
protected readonly ImmutableList<Regex> _cleanupRegexList =
[
new("[\\b]"),
new("[\\f]"),
@@ -6,7 +6,7 @@ namespace SPTarkov.Server.Core.Utils;
[Injectable]
public class TimerUtil
{
protected Stopwatch _stopwatch;
protected readonly Stopwatch _stopwatch;
public TimerUtil()
{