Converted collections to their frozen counterparts for improved lookup speed
This commit is contained in:
@@ -28,7 +28,7 @@ public class BtrDeliveryService(
|
||||
configServer.GetConfig<BtrDeliveryConfig>();
|
||||
protected readonly TraderConfig _traderConfig = configServer.GetConfig<TraderConfig>();
|
||||
|
||||
protected static readonly List<string> _transferTypes = new() { "btr", "transit" };
|
||||
protected static readonly List<string> _transferTypes = ["btr", "transit"];
|
||||
|
||||
/// <summary>
|
||||
/// Check if player used BTR or transit item sending service and send items to player via mail if found
|
||||
@@ -42,7 +42,7 @@ public class BtrDeliveryService(
|
||||
var rootId = $"{Traders.BTR}_{transferType}";
|
||||
List<Item>? itemsToSend = null;
|
||||
|
||||
// if rootId doesnt exist in TransferItems, skip
|
||||
// if rootId doesn't exist in TransferItems, skip
|
||||
if (!request?.TransferItems?.TryGetValue(rootId, out itemsToSend) ?? false)
|
||||
{
|
||||
continue;
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Frozen;
|
||||
using SPTarkov.Common.Extensions;
|
||||
using SPTarkov.DI.Annotations;
|
||||
using SPTarkov.Server.Core.Extensions;
|
||||
@@ -44,7 +45,7 @@ public class FenceService(
|
||||
/// </summary>
|
||||
protected TraderAssort? fenceDiscountAssort;
|
||||
|
||||
protected readonly HashSet<string> fenceItemUpdCompareProperties =
|
||||
protected readonly FrozenSet<string> fenceItemUpdCompareProperties =
|
||||
[
|
||||
"Buff",
|
||||
"Repairable",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Frozen;
|
||||
using SPTarkov.DI.Annotations;
|
||||
using SPTarkov.Server.Core.Extensions;
|
||||
using SPTarkov.Server.Core.Helpers;
|
||||
@@ -29,12 +30,12 @@ public class MailSendService(
|
||||
)
|
||||
{
|
||||
private const string _systemSenderId = "59e7125688a45068a6249071";
|
||||
protected readonly HashSet<MessageType> _messageTypes =
|
||||
protected readonly FrozenSet<MessageType> _messageTypes =
|
||||
[
|
||||
MessageType.NpcTraderMessage,
|
||||
MessageType.FleamarketMessage,
|
||||
];
|
||||
protected readonly HashSet<string> _slotNames = ["hideout", "main"];
|
||||
protected readonly FrozenSet<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
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Frozen;
|
||||
using SPTarkov.DI.Annotations;
|
||||
using SPTarkov.Server.Core.Constants;
|
||||
using SPTarkov.Server.Core.Models.Eft.Common.Tables;
|
||||
@@ -14,7 +15,7 @@ namespace SPTarkov.Server.Core.Services;
|
||||
[Injectable(InjectionType.Singleton)]
|
||||
public class MatchBotDetailsCacheService(ISptLogger<MatchBotDetailsCacheService> logger)
|
||||
{
|
||||
private static readonly HashSet<string> _sidesToCache = [Sides.PmcUsec, Sides.PmcBear];
|
||||
private static readonly FrozenSet<string> _sidesToCache = [Sides.PmcUsec, Sides.PmcBear];
|
||||
|
||||
protected readonly ConcurrentDictionary<string, BotDetailsForChatMessages> BotDetailsCache =
|
||||
new();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Frozen;
|
||||
using System.Text.RegularExpressions;
|
||||
using SPTarkov.DI.Annotations;
|
||||
using SPTarkov.Server.Core.Extensions;
|
||||
@@ -29,7 +30,7 @@ public class ProfileFixerService(
|
||||
InventoryHelper inventoryHelper
|
||||
)
|
||||
{
|
||||
protected readonly List<string> _areas = ["hideout", "main"];
|
||||
protected readonly FrozenSet<string> _areas = ["hideout", "main"];
|
||||
protected readonly CoreConfig _coreConfig = configServer.GetConfig<CoreConfig>();
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Frozen;
|
||||
using SPTarkov.Common.Extensions;
|
||||
using SPTarkov.DI.Annotations;
|
||||
using SPTarkov.Server.Core.Extensions;
|
||||
@@ -28,7 +29,7 @@ public class SeasonalEventService(
|
||||
{
|
||||
private bool _christmasEventActive;
|
||||
|
||||
protected readonly HashSet<MongoId> _christmasEventItems =
|
||||
protected readonly FrozenSet<MongoId> _christmasEventItems =
|
||||
[
|
||||
ItemTpl.ARMOR_6B13_M_ASSAULT_ARMOR_CHRISTMAS_EDITION,
|
||||
ItemTpl.BACKPACK_SANTAS_BAG,
|
||||
@@ -61,7 +62,7 @@ public class SeasonalEventService(
|
||||
|
||||
private List<SeasonalEvent> _currentlyActiveEvents = [];
|
||||
|
||||
protected readonly HashSet<EquipmentSlots> _equipmentSlotsToFilter =
|
||||
protected readonly FrozenSet<EquipmentSlots> _equipmentSlotsToFilter =
|
||||
[
|
||||
EquipmentSlots.FaceCover,
|
||||
EquipmentSlots.Headwear,
|
||||
@@ -71,7 +72,7 @@ public class SeasonalEventService(
|
||||
|
||||
private bool _halloweenEventActive;
|
||||
|
||||
protected readonly HashSet<MongoId> _halloweenEventItems =
|
||||
protected readonly FrozenSet<MongoId> _halloweenEventItems =
|
||||
[
|
||||
ItemTpl.HEADWEAR_JACKOLANTERN_TACTICAL_PUMPKIN_HELMET,
|
||||
ItemTpl.FACECOVER_FACELESS_MASK,
|
||||
@@ -88,12 +89,6 @@ public class SeasonalEventService(
|
||||
|
||||
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>();
|
||||
@@ -103,7 +98,7 @@ public class SeasonalEventService(
|
||||
/// Get an array of christmas items found in bots inventories as loot
|
||||
/// </summary>
|
||||
/// <returns>array</returns>
|
||||
public HashSet<MongoId> GetChristmasEventItems()
|
||||
public FrozenSet<MongoId> GetChristmasEventItems()
|
||||
{
|
||||
return _christmasEventItems;
|
||||
}
|
||||
@@ -112,7 +107,7 @@ public class SeasonalEventService(
|
||||
/// Get an array of halloween items found in bots inventories as loot
|
||||
/// </summary>
|
||||
/// <returns>array</returns>
|
||||
public HashSet<MongoId> GetHalloweenEventItems()
|
||||
public FrozenSet<MongoId> GetHalloweenEventItems()
|
||||
{
|
||||
return _halloweenEventItems;
|
||||
}
|
||||
@@ -207,7 +202,7 @@ public class SeasonalEventService(
|
||||
/// <summary>
|
||||
/// Get a dictionary of gear changes to apply to bots for a specific event e.g. Christmas/Halloween
|
||||
/// </summary>
|
||||
/// <param name="eventName">Name of event to get gear changes for</param>
|
||||
/// <param name="eventType">Name of event to get gear changes for</param>
|
||||
/// <returns>bots with equipment changes</returns>
|
||||
protected Dictionary<string, Dictionary<string, Dictionary<MongoId, int>>>? GetEventBotGear(
|
||||
SeasonalEventType eventType
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System.Collections.Frozen;
|
||||
using SPTarkov.Common.Extensions;
|
||||
using SPTarkov.DI.Annotations;
|
||||
using SPTarkov.Server.Core.Models.Utils;
|
||||
@@ -20,8 +21,9 @@ public class ServerLocalisationService(
|
||||
{
|
||||
private readonly Dictionary<string, LazyLoad<Dictionary<string, string>>> _loadedLocales = [];
|
||||
private string _serverLocale = localeService.GetDesiredServerLocale();
|
||||
private readonly Dictionary<string, string> _localeFallbacks =
|
||||
localeService.GetLocaleFallbacks();
|
||||
private readonly FrozenDictionary<string, string> _localeFallbacks = localeService
|
||||
.GetLocaleFallbacks()
|
||||
.ToFrozenDictionary();
|
||||
|
||||
private const string DefaultLocale = "en";
|
||||
private const string LocaleDirectory = "./SPT_Data/database/locales/server";
|
||||
|
||||
Reference in New Issue
Block a user