diff --git a/Libraries/SPTarkov.Server.Core/Extensions/ItemExtensions.cs b/Libraries/SPTarkov.Server.Core/Extensions/ItemExtensions.cs
index d8ae838e..efeb0532 100644
--- a/Libraries/SPTarkov.Server.Core/Extensions/ItemExtensions.cs
+++ b/Libraries/SPTarkov.Server.Core/Extensions/ItemExtensions.cs
@@ -198,12 +198,12 @@ namespace SPTarkov.Server.Core.Extensions
/// List of items (item + possible children)
/// Parent item's id
/// list of child item ids
- public static List FindAndReturnChildrenByItems(
+ public static List FindAndReturnChildrenByItems(
this IEnumerable- items,
- string baseItemId
+ MongoId baseItemId
)
{
- List list = [];
+ List list = [];
foreach (var childItem in items)
{
@@ -312,7 +312,7 @@ namespace SPTarkov.Server.Core.Extensions
if (
!result.ContainsKey(childItem.Id)
&& childItem.ParentId != "hideout"
- && childItem.ParentId == baseItemId
+ && childItem.ParentId == baseItemId.ToString()
)
{
foreach (var item in FindAndReturnChildrenAsItems(items, childItem.Id))
@@ -367,7 +367,7 @@ namespace SPTarkov.Server.Core.Extensions
///
/// Inventory items to look for secure container in
/// List of ids
- public static List GetSecureContainerItems(this List
- items)
+ public static List GetSecureContainerItems(this List
- items)
{
var secureContainer = items.First(x => x.SlotId == "SecuredContainer");
diff --git a/Libraries/SPTarkov.Server.Core/Generators/RagfairOfferGenerator.cs b/Libraries/SPTarkov.Server.Core/Generators/RagfairOfferGenerator.cs
index cece78b4..59d941da 100644
--- a/Libraries/SPTarkov.Server.Core/Generators/RagfairOfferGenerator.cs
+++ b/Libraries/SPTarkov.Server.Core/Generators/RagfairOfferGenerator.cs
@@ -761,7 +761,7 @@ public class RagfairOfferGenerator(
if (!(profileHelper.IsPlayer(userID) || ragfairServerHelper.IsTrader(userID)))
{
var parentId = GetDynamicConditionIdForTpl(itemDetails.Id);
- if (string.IsNullOrEmpty(parentId))
+ if (parentId == null)
// No condition details found, don't proceed with modifying item conditions
{
return;
@@ -770,11 +770,11 @@ public class RagfairOfferGenerator(
// Roll random chance to randomise item condition
if (
randomUtil.GetChance100(
- ragfairConfig.Dynamic.Condition[parentId].ConditionChance * 100
+ ragfairConfig.Dynamic.Condition[parentId.Value].ConditionChance * 100
)
)
{
- RandomiseItemCondition(parentId, itemWithMods, itemDetails);
+ RandomiseItemCondition(parentId.Value, itemWithMods, itemDetails);
}
}
}
@@ -784,7 +784,7 @@ public class RagfairOfferGenerator(
///
/// Item to look for matching condition object
/// Condition ID
- protected string? GetDynamicConditionIdForTpl(MongoId tpl)
+ protected MongoId? GetDynamicConditionIdForTpl(MongoId tpl)
{
// Get keys from condition config dictionary
var configConditions = ragfairConfig.Dynamic.Condition.Keys;
@@ -806,7 +806,7 @@ public class RagfairOfferGenerator(
/// Item to adjust condition details of
/// DB Item details of first item in list
protected void RandomiseItemCondition(
- string conditionSettingsId,
+ MongoId conditionSettingsId,
List
- itemWithMods,
TemplateItem itemDetails
)
diff --git a/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs b/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs
index bc4c1d45..e5ff2177 100644
--- a/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs
+++ b/Libraries/SPTarkov.Server.Core/Helpers/ItemHelper.cs
@@ -1856,29 +1856,33 @@ public class ItemHelper(
return GetRemovablePlateSlotIds().Contains(slotName.ToLowerInvariant());
}
- // Get a list of slot names that hold removable plates
- // Returns Array of slot ids (e.g. front_plate)
+ ///
+ /// Get a list of slot names that hold removable plates
+ ///
+ /// Array of slot ids (e.g. front_plate)
public FrozenSet GetRemovablePlateSlotIds()
{
return _removablePlateSlotIds;
}
- // Generate new unique ids for child items while preserving hierarchy
- // Base/primary item
- // Primary item + children of primary item
- // Returns Item array with updated IDs
+ ///
+ /// Generate new unique ids for child items while preserving hierarchy
+ ///
+ /// Base/primary item
+ /// Primary item + children of primary item
+ /// Item array with updated IDs
public List
- ReparentItemAndChildren(Item rootItem, List
- itemWithChildren)
{
var oldRootId = itemWithChildren[0].Id;
- Dictionary idMappings = new();
+ Dictionary idMappings = [];
- idMappings[oldRootId] = rootItem.Id;
+ idMappings[oldRootId.ToString()] = rootItem.Id;
foreach (var mod in itemWithChildren)
{
if (!idMappings.ContainsKey(mod.Id))
{
- idMappings[mod.Id] = new MongoId();
+ idMappings[mod.Id.ToString()] = new MongoId();
}
// Has parentId + no remapping exists for its parent
@@ -1891,7 +1895,7 @@ public class ItemHelper(
idMappings[mod.ParentId] = new MongoId();
}
- mod.Id = idMappings[mod.Id];
+ mod.Id = idMappings[mod.Id.ToString()];
if (mod.ParentId != null)
{
mod.ParentId = idMappings[mod.ParentId];
diff --git a/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs b/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs
index ccf09392..607320b5 100644
--- a/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs
+++ b/Libraries/SPTarkov.Server.Core/Servers/ConfigServer.cs
@@ -1,3 +1,4 @@
+using System.Collections.Frozen;
using SPTarkov.DI.Annotations;
using SPTarkov.Server.Core.Models.Enums;
using SPTarkov.Server.Core.Models.Spt.Config;
@@ -10,7 +11,7 @@ namespace SPTarkov.Server.Core.Servers;
[Injectable(InjectionType.Singleton)]
public class ConfigServer
{
- protected readonly string[] acceptableFileExtensions = ["json", "jsonc"];
+ protected readonly FrozenSet acceptableFileExtensions = ["json", "jsonc"];
protected readonly FileUtil _fileUtil;
protected readonly JsonUtil _jsonUtil;
protected readonly ISptLogger _logger;
diff --git a/Libraries/SPTarkov.Server.Core/Services/FenceService.cs b/Libraries/SPTarkov.Server.Core/Services/FenceService.cs
index eda5dbc6..a378037d 100644
--- a/Libraries/SPTarkov.Server.Core/Services/FenceService.cs
+++ b/Libraries/SPTarkov.Server.Core/Services/FenceService.cs
@@ -1472,7 +1472,7 @@ public class FenceService(
protected void RemoveRandomModsOfItem(List
- itemAndMods)
{
// Items to be removed from inventory
- var toDelete = new HashSet();
+ var toDelete = new HashSet();
// Find mods to remove from item that could've been scavenged by other players in-raid
foreach (var itemMod in itemAndMods)
@@ -1507,7 +1507,7 @@ public class FenceService(
/// Weapon mod being checked
/// Current list of items on weapon being deleted
/// True if item will be removed
- protected bool PresetModItemWillBeRemoved(Item weaponMod, HashSet itemsBeingDeleted)
+ protected bool PresetModItemWillBeRemoved(Item weaponMod, HashSet itemsBeingDeleted)
{
var slotIdsThatCanFail = traderConfig.Fence.PresetSlotsToRemoveChancePercent;
if (
diff --git a/Libraries/SPTarkov.Server.Core/Services/RagfairPriceService.cs b/Libraries/SPTarkov.Server.Core/Services/RagfairPriceService.cs
index 03dbb57c..d0d2108d 100644
--- a/Libraries/SPTarkov.Server.Core/Services/RagfairPriceService.cs
+++ b/Libraries/SPTarkov.Server.Core/Services/RagfairPriceService.cs
@@ -312,7 +312,7 @@ public class RagfairPriceService(
// Make adjustments for unreasonably priced items.
foreach (var (key, value) in _ragfairConfig.Dynamic.UnreasonableModPrices)
{
- if (!itemHelper.IsOfBaseclass(itemTemplateId, key) || !value.Enabled)
+ if (!value.Enabled || !itemHelper.IsOfBaseclass(itemTemplateId, key))
{
continue;
}