Updated various methods to accept IEnumerable instead of List

This commit is contained in:
Chomp
2025-07-23 10:57:49 +01:00
parent a4c2c80810
commit db34eaa501
17 changed files with 106 additions and 99 deletions
@@ -12,7 +12,10 @@ namespace SPTarkov.Server.Core.Extensions
/// </summary>
/// <param name="fullProfile">Profile to add clothing to</param>
/// <param name="clothingIds">Clothing Ids to add to profile</param>
public static void AddSuitsToProfile(this SptProfile fullProfile, List<MongoId> clothingIds)
public static void AddSuitsToProfile(
this SptProfile fullProfile,
IEnumerable<MongoId> clothingIds
)
{
fullProfile.CustomisationUnlocks ??= [];
@@ -234,7 +234,7 @@ namespace SPTarkov.Server.Core.Extensions
/// Gets the identifier for a child using slotId, locationX and locationY.
/// </summary>
/// <param name="item">Item.</param>
/// <returns>SlotId OR slotid, locationX, locationY.</returns>
/// <returns>SlotId OR slotId, locationX, locationY.</returns>
public static string GetChildId(this Item item)
{
if (item.Location is null)
@@ -365,7 +365,7 @@ namespace SPTarkov.Server.Core.Extensions
/// </summary>
/// <param name="items">Inventory items to look for secure container in</param>
/// <returns>List of ids</returns>
public static List<MongoId> GetSecureContainerItems(this List<Item> items)
public static List<MongoId> GetSecureContainerItems(this IEnumerable<Item> items)
{
var secureContainer = items.First(x => x.SlotId == "SecuredContainer");
@@ -417,7 +417,7 @@ namespace SPTarkov.Server.Core.Extensions
/// <param name="newId">Optional: new id to use</param>
/// <returns>New root id</returns>
public static MongoId RemapRootItemId(
this List<Item> itemWithChildren,
this IEnumerable<Item> itemWithChildren,
MongoId? newId = null
)
{
@@ -450,7 +450,7 @@ namespace SPTarkov.Server.Core.Extensions
/// </summary>
/// <param name="inventoryItems">Items to hash</param>
/// <returns>InventoryItemHash</returns>
public static InventoryItemHash GetInventoryItemHash(this List<Item> inventoryItems)
public static InventoryItemHash GetInventoryItemHash(this IEnumerable<Item> inventoryItems)
{
// Group by parentId + turn value into mongoId as we've filtered out non-mongoId values
var byParentId = inventoryItems
@@ -44,7 +44,7 @@ namespace SPTarkov.Server.Core.Extensions
/// <returns>rouble amount</returns>
private static double GetContainerRoubleTotalByLevel(
int botLevel,
List<MinMaxLootValue> containerLootValuesPool
IEnumerable<MinMaxLootValue> containerLootValuesPool
)
{
var matchingValue = containerLootValuesPool.FirstOrDefault(minMaxValue =>
@@ -12,7 +12,7 @@ namespace SPTarkov.Server.Core.Extensions
/// </summary>
/// <param name="profile">Profile to get quest items from</param>
/// <returns>List of item objects</returns>
public static List<Item> GetQuestItemsInProfile(this PmcData profile)
public static IEnumerable<Item> GetQuestItemsInProfile(this PmcData profile)
{
return profile
?.Inventory?.Items.Where(i => i.ParentId == profile.Inventory.QuestRaidItems)
@@ -11,7 +11,7 @@ namespace SPTarkov.Server.Core.Extensions
/// <param name="furtherFilter">OPTIONAL - Additional filter code to run</param>
/// <returns></returns>
public static List<QuestCondition> GetQuestConditions(
this List<QuestCondition> questConditions,
this IEnumerable<QuestCondition> questConditions,
Func<QuestCondition, List<QuestCondition>>? furtherFilter = null
)
{
@@ -19,7 +19,7 @@ namespace SPTarkov.Server.Core.Extensions
}
public static List<QuestCondition> GetLevelConditions(
this List<QuestCondition> questConditions,
this IEnumerable<QuestCondition> questConditions,
Func<QuestCondition, List<QuestCondition>>? furtherFilter = null
)
{
@@ -27,7 +27,7 @@ namespace SPTarkov.Server.Core.Extensions
}
public static List<QuestCondition> GetLoyaltyConditions(
this List<QuestCondition> questConditions,
this IEnumerable<QuestCondition> questConditions,
Func<QuestCondition, List<QuestCondition>>? furtherFilter = null
)
{
@@ -35,7 +35,7 @@ namespace SPTarkov.Server.Core.Extensions
}
public static List<QuestCondition> GetStandingConditions(
this List<QuestCondition> questConditions,
this IEnumerable<QuestCondition> questConditions,
Func<QuestCondition, List<QuestCondition>>? furtherFilter = null
)
{
@@ -43,7 +43,7 @@ namespace SPTarkov.Server.Core.Extensions
}
private static List<QuestCondition> FilterConditions(
List<QuestCondition> questConditions,
IEnumerable<QuestCondition> questConditions,
string questType,
Func<QuestCondition, List<QuestCondition>>? furtherFilter = null
)