Format Style Fixes
This commit is contained in:
@@ -11,11 +11,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <param name="itemWidthX">Width of item</param>
|
||||
/// <param name="itemHeightY">Height of item</param>
|
||||
/// <returns>Location to place item in container</returns>
|
||||
public static FindSlotResult FindSlotForItem(
|
||||
this int[,] container2D,
|
||||
int? itemWidthX,
|
||||
int? itemHeightY
|
||||
)
|
||||
public static FindSlotResult FindSlotForItem(this int[,] container2D, int? itemWidthX, int? itemHeightY)
|
||||
{
|
||||
// Assume not rotated
|
||||
var rotation = false;
|
||||
@@ -45,15 +41,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
for (var column = 0; column < limitX; column++)
|
||||
{
|
||||
// Does item fit
|
||||
if (
|
||||
CanItemBePlacedInContainerAtPosition(
|
||||
container2D,
|
||||
row,
|
||||
column,
|
||||
itemWidthX.Value,
|
||||
itemHeightY.Value
|
||||
)
|
||||
)
|
||||
if (CanItemBePlacedInContainerAtPosition(container2D, row, column, itemWidthX.Value, itemHeightY.Value))
|
||||
{
|
||||
// Success, found a spot it fits
|
||||
return new FindSlotResult(true, column, row, rotation);
|
||||
|
||||
@@ -93,13 +93,7 @@
|
||||
/// <param name="endMonth">Upper bound for month</param>
|
||||
/// <param name="endDay">Upper bound for day</param>
|
||||
/// <returns>True when inside date range</returns>
|
||||
public static bool DateIsBetweenTwoDates(
|
||||
this DateTime dateToCheck,
|
||||
int startMonth,
|
||||
int startDay,
|
||||
int endMonth,
|
||||
int endDay
|
||||
)
|
||||
public static bool DateIsBetweenTwoDates(this DateTime dateToCheck, int startMonth, int startDay, int endMonth, int endDay)
|
||||
{
|
||||
var eventStartDate = new DateTime(dateToCheck.Year, startMonth, startDay);
|
||||
var eventEndDate = new DateTime(dateToCheck.Year, endMonth, endDay, 23, 59, 0);
|
||||
@@ -113,10 +107,7 @@
|
||||
/// <param name="dateTime">Date to get closest monday of</param>
|
||||
/// <param name="startDay">Starting day of week - Default = Monday</param>
|
||||
/// <returns>Monday as DateTime</returns>
|
||||
public static DateTime GetClosestDate(
|
||||
this DateTime dateTime,
|
||||
DayOfWeek startDay = DayOfWeek.Monday
|
||||
)
|
||||
public static DateTime GetClosestDate(this DateTime dateTime, DayOfWeek startDay = DayOfWeek.Monday)
|
||||
{
|
||||
// Calculate difference from current day to Monday
|
||||
var diff = (7 + (dateTime.DayOfWeek - startDay)) % 7;
|
||||
@@ -132,11 +123,7 @@
|
||||
/// <param name="desiredDay">Desired day to find</param>
|
||||
/// <param name="inclusiveOfToday">Should today be included in check, default = true</param>
|
||||
/// <returns>Datetime of desired day</returns>
|
||||
public static DateTime GetMostRecentPreviousDay(
|
||||
this DateTime dateTime,
|
||||
DayOfWeek desiredDay,
|
||||
bool inclusiveOfToday = true
|
||||
)
|
||||
public static DateTime GetMostRecentPreviousDay(this DateTime dateTime, DayOfWeek desiredDay, bool inclusiveOfToday = true)
|
||||
{
|
||||
// Get difference in day count from today to what day we want
|
||||
var dayDifferenceCount = (dateTime.DayOfWeek - desiredDay + 7) % 7;
|
||||
|
||||
@@ -12,20 +12,13 @@ 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,
|
||||
IEnumerable<MongoId> clothingIds
|
||||
)
|
||||
public static void AddSuitsToProfile(this SptProfile fullProfile, IEnumerable<MongoId> clothingIds)
|
||||
{
|
||||
fullProfile.CustomisationUnlocks ??= [];
|
||||
|
||||
foreach (var suitId in clothingIds)
|
||||
{
|
||||
if (
|
||||
!fullProfile.CustomisationUnlocks.Exists(customisation =>
|
||||
customisation.Id == suitId
|
||||
)
|
||||
)
|
||||
if (!fullProfile.CustomisationUnlocks.Exists(customisation => customisation.Id == suitId))
|
||||
{
|
||||
// Clothing item doesn't exist in profile, add it
|
||||
fullProfile.CustomisationUnlocks.Add(
|
||||
@@ -207,11 +200,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <param name="fullProfile">Profile to add the extra repeatable to</param>
|
||||
/// <param name="repeatableId">The ID of the type of repeatable to increase</param>
|
||||
/// <param name="rewardValue">The number of extra repeatables to add</param>
|
||||
public static void AddExtraRepeatableQuest(
|
||||
this SptProfile fullProfile,
|
||||
MongoId repeatableId,
|
||||
double rewardValue
|
||||
)
|
||||
public static void AddExtraRepeatableQuest(this SptProfile fullProfile, MongoId repeatableId, double rewardValue)
|
||||
{
|
||||
fullProfile.SptData.ExtraRepeatableQuests ??= new Dictionary<MongoId, double>();
|
||||
|
||||
@@ -228,8 +217,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <returns>True if account is developer</returns>
|
||||
public static bool IsDeveloperAccount(this SptProfile fullProfile)
|
||||
{
|
||||
return fullProfile?.ProfileInfo?.Edition?.ToLowerInvariant().StartsWith("spt developer")
|
||||
?? false;
|
||||
return fullProfile?.ProfileInfo?.Edition?.ToLowerInvariant().StartsWith("spt developer") ?? false;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,11 +12,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <param name="output">Response to add item change event into</param>
|
||||
/// <param name="sessionId">Session id</param>
|
||||
/// <param name="item">Item that was adjusted</param>
|
||||
public static void AddItemStackSizeChangeIntoEventResponse(
|
||||
this ItemEventRouterResponse output,
|
||||
MongoId sessionId,
|
||||
Item item
|
||||
)
|
||||
public static void AddItemStackSizeChangeIntoEventResponse(this ItemEventRouterResponse output, MongoId sessionId, Item item)
|
||||
{
|
||||
// TODO: replace with something safer like TryGet
|
||||
output
|
||||
|
||||
@@ -17,11 +17,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <param name="item2">second item to compare</param>
|
||||
/// <param name="compareUpdProperties">Upd properties to compare between the items</param>
|
||||
/// <returns>true if they are the same</returns>
|
||||
public static bool IsSameItem(
|
||||
this Item item1,
|
||||
Item item2,
|
||||
ISet<string>? compareUpdProperties = null
|
||||
)
|
||||
public static bool IsSameItem(this Item item1, Item item2, ISet<string>? compareUpdProperties = null)
|
||||
{
|
||||
// Different tpl == different item
|
||||
if (item1.Template != item2.Template)
|
||||
@@ -51,48 +47,23 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
var comparers = new Dictionary<string, Func<Upd, Upd, bool>>
|
||||
{
|
||||
{ "Key", (upd1, upd2) => upd1.Key?.NumberOfUsages == upd2.Key?.NumberOfUsages },
|
||||
{
|
||||
"Buff",
|
||||
(upd1, upd2) =>
|
||||
upd1.Buff?.Value == upd2.Buff?.Value
|
||||
&& upd1.Buff?.BuffType == upd2.Buff?.BuffType
|
||||
},
|
||||
{
|
||||
"CultistAmulet",
|
||||
(upd1, upd2) =>
|
||||
upd1.CultistAmulet?.NumberOfUsages == upd2.CultistAmulet?.NumberOfUsages
|
||||
},
|
||||
{ "Buff", (upd1, upd2) => upd1.Buff?.Value == upd2.Buff?.Value && upd1.Buff?.BuffType == upd2.Buff?.BuffType },
|
||||
{ "CultistAmulet", (upd1, upd2) => upd1.CultistAmulet?.NumberOfUsages == upd2.CultistAmulet?.NumberOfUsages },
|
||||
{ "Dogtag", (upd1, upd2) => upd1.Dogtag?.ProfileId == upd2.Dogtag?.ProfileId },
|
||||
{ "FaceShield", (upd1, upd2) => upd1.FaceShield?.Hits == upd2.FaceShield?.Hits },
|
||||
{
|
||||
"Foldable",
|
||||
(upd1, upd2) =>
|
||||
upd1.Foldable?.Folded.GetValueOrDefault(false)
|
||||
== upd2.Foldable?.Folded.GetValueOrDefault(false)
|
||||
},
|
||||
{
|
||||
"FoodDrink",
|
||||
(upd1, upd2) => upd1.FoodDrink?.HpPercent == upd2.FoodDrink?.HpPercent
|
||||
(upd1, upd2) => upd1.Foldable?.Folded.GetValueOrDefault(false) == upd2.Foldable?.Folded.GetValueOrDefault(false)
|
||||
},
|
||||
{ "FoodDrink", (upd1, upd2) => upd1.FoodDrink?.HpPercent == upd2.FoodDrink?.HpPercent },
|
||||
{ "MedKit", (upd1, upd2) => upd1.MedKit?.HpResource == upd2.MedKit?.HpResource },
|
||||
{
|
||||
"RecodableComponent",
|
||||
(upd1, upd2) =>
|
||||
upd1.RecodableComponent?.IsEncoded == upd2.RecodableComponent?.IsEncoded
|
||||
},
|
||||
{
|
||||
"RepairKit",
|
||||
(upd1, upd2) => upd1.RepairKit?.Resource == upd2.RepairKit?.Resource
|
||||
},
|
||||
{
|
||||
"Resource",
|
||||
(upd1, upd2) => upd1.Resource?.UnitsConsumed == upd2.Resource?.UnitsConsumed
|
||||
},
|
||||
{ "RecodableComponent", (upd1, upd2) => upd1.RecodableComponent?.IsEncoded == upd2.RecodableComponent?.IsEncoded },
|
||||
{ "RepairKit", (upd1, upd2) => upd1.RepairKit?.Resource == upd2.RepairKit?.Resource },
|
||||
{ "Resource", (upd1, upd2) => upd1.Resource?.UnitsConsumed == upd2.Resource?.UnitsConsumed },
|
||||
};
|
||||
|
||||
// Choose above keys or passed in keys to compare items with
|
||||
var valuesToCompare =
|
||||
compareUpdProperties?.Count > 0 ? compareUpdProperties : comparers.Keys.ToHashSet();
|
||||
var valuesToCompare = compareUpdProperties?.Count > 0 ? compareUpdProperties : comparers.Keys.ToHashSet();
|
||||
foreach (var propertyName in valuesToCompare)
|
||||
{
|
||||
if (!comparers.TryGetValue(propertyName, out var comparer))
|
||||
@@ -117,11 +88,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <param name="desiredContainerSlotId">Name of slot to check item is in e.g. SecuredContainer/Backpack</param>
|
||||
/// <param name="items">Inventory with child parent items to check</param>
|
||||
/// <returns>True when item is in container</returns>
|
||||
public static bool ItemIsInsideContainer(
|
||||
this Item itemToCheck,
|
||||
string desiredContainerSlotId,
|
||||
IEnumerable<Item> items
|
||||
)
|
||||
public static bool ItemIsInsideContainer(this Item itemToCheck, string desiredContainerSlotId, IEnumerable<Item> items)
|
||||
{
|
||||
// Get items parent
|
||||
var parent = items.FirstOrDefault(item => item.Id.Equals(itemToCheck.ParentId));
|
||||
@@ -199,10 +166,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <param name="items">List of items (item + possible children)</param>
|
||||
/// <param name="baseItemId">Parent item's id</param>
|
||||
/// <returns>list of child item ids</returns>
|
||||
public static List<MongoId> GetItemWithChildrenTpls(
|
||||
this IEnumerable<Item> items,
|
||||
MongoId baseItemId
|
||||
)
|
||||
public static List<MongoId> GetItemWithChildrenTpls(this IEnumerable<Item> items, MongoId baseItemId)
|
||||
{
|
||||
List<MongoId> list = [];
|
||||
|
||||
@@ -226,8 +190,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <returns>true if it has buy restrictions</returns>
|
||||
public static bool HasBuyRestrictions(this Item itemToCheck)
|
||||
{
|
||||
return itemToCheck.Upd?.BuyRestrictionCurrent is not null
|
||||
&& itemToCheck.Upd?.BuyRestrictionMax is not null;
|
||||
return itemToCheck.Upd?.BuyRestrictionCurrent is not null && itemToCheck.Upd?.BuyRestrictionMax is not null;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -273,11 +236,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <param name="baseItemId">Parent item's id</param>
|
||||
/// <param name="excludeStoredItems">OPTIONAL - Include only mod items, exclude items stored inside root item</param>
|
||||
/// <returns>list of Item objects</returns>
|
||||
public static List<Item> GetItemWithChildren(
|
||||
this IEnumerable<Item> items,
|
||||
MongoId baseItemId,
|
||||
bool excludeStoredItems = false
|
||||
)
|
||||
public static List<Item> GetItemWithChildren(this IEnumerable<Item> items, MongoId baseItemId, bool excludeStoredItems = false)
|
||||
{
|
||||
// Use dictionary to make key lookup faster, convert to list before being returned
|
||||
var itemList = items.ToList();
|
||||
@@ -416,10 +375,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <param name="itemWithChildren">Item to update root items _id property</param>
|
||||
/// <param name="newId">Optional: new id to use</param>
|
||||
/// <returns>New root id</returns>
|
||||
public static MongoId RemapRootItemId(
|
||||
this IEnumerable<Item> itemWithChildren,
|
||||
MongoId? newId = null
|
||||
)
|
||||
public static MongoId RemapRootItemId(this IEnumerable<Item> itemWithChildren, MongoId? newId = null)
|
||||
{
|
||||
newId ??= new MongoId();
|
||||
|
||||
@@ -458,11 +414,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
.GroupBy(item => new MongoId(item.ParentId))
|
||||
.ToDictionary(kvp => kvp.Key, group => group.ToHashSet());
|
||||
|
||||
return new InventoryItemHash
|
||||
{
|
||||
ByItemId = inventoryItems.ToDictionary(item => item.Id),
|
||||
ByParentId = byParentId,
|
||||
};
|
||||
return new InventoryItemHash { ByItemId = inventoryItems.ToDictionary(item => item.Id), ByParentId = byParentId };
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,16 +7,9 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// </summary>
|
||||
public static class LootContainerSettingsExtensions
|
||||
{
|
||||
public static double GetRoubleValue(
|
||||
this LootContainerSettings settings,
|
||||
int botLevel,
|
||||
string? locationId
|
||||
)
|
||||
public static double GetRoubleValue(this LootContainerSettings settings, int botLevel, string? locationId)
|
||||
{
|
||||
var roubleTotalByLevel = GetContainerRoubleTotalByLevel(
|
||||
botLevel,
|
||||
settings.TotalRubByLevel
|
||||
);
|
||||
var roubleTotalByLevel = GetContainerRoubleTotalByLevel(botLevel, settings.TotalRubByLevel);
|
||||
|
||||
if (locationId is null)
|
||||
{
|
||||
@@ -42,10 +35,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <param name="botLevel">level of the bot</param>
|
||||
/// <param name="containerLootValuesPool">Pocket/vest/backpack</param>
|
||||
/// <returns>rouble amount</returns>
|
||||
private static double GetContainerRoubleTotalByLevel(
|
||||
int botLevel,
|
||||
IEnumerable<MinMaxLootValue> containerLootValuesPool
|
||||
)
|
||||
private static double GetContainerRoubleTotalByLevel(int botLevel, IEnumerable<MinMaxLootValue> containerLootValuesPool)
|
||||
{
|
||||
var matchingValue = containerLootValuesPool.FirstOrDefault(minMaxValue =>
|
||||
botLevel >= minMaxValue.Min && botLevel <= minMaxValue.Max
|
||||
|
||||
@@ -28,8 +28,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
for (var i = 0; i < 24; i++)
|
||||
{
|
||||
var c = span[i];
|
||||
var isHex =
|
||||
(c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
|
||||
var isHex = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
|
||||
|
||||
if (!isHex)
|
||||
{
|
||||
@@ -58,8 +57,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
for (var i = 0; i < 24; i++)
|
||||
{
|
||||
var c = span[i];
|
||||
var isHex =
|
||||
(c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
|
||||
var isHex = (c >= '0' && c <= '9') || (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F');
|
||||
|
||||
if (!isHex)
|
||||
{
|
||||
|
||||
@@ -14,9 +14,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <returns>List of item objects</returns>
|
||||
public static IEnumerable<Item> GetQuestItemsInProfile(this PmcData profile)
|
||||
{
|
||||
return profile
|
||||
?.Inventory?.Items.Where(i => i.ParentId == profile.Inventory.QuestRaidItems)
|
||||
.ToList();
|
||||
return profile?.Inventory?.Items.Where(i => i.ParentId == profile.Inventory.QuestRaidItems).ToList();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -26,15 +24,9 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
public static void UnlockHideoutWallInProfile(this PmcData profile)
|
||||
{
|
||||
var profileHideoutAreas = profile.Hideout.Areas;
|
||||
var waterCollector = profileHideoutAreas.FirstOrDefault(x =>
|
||||
x.Type == HideoutAreas.WaterCollector
|
||||
);
|
||||
var medStation = profileHideoutAreas.FirstOrDefault(x =>
|
||||
x.Type == HideoutAreas.MedStation
|
||||
);
|
||||
var wall = profileHideoutAreas.FirstOrDefault(x =>
|
||||
x.Type == HideoutAreas.EmergencyWall
|
||||
);
|
||||
var waterCollector = profileHideoutAreas.FirstOrDefault(x => x.Type == HideoutAreas.WaterCollector);
|
||||
var medStation = profileHideoutAreas.FirstOrDefault(x => x.Type == HideoutAreas.MedStation);
|
||||
var wall = profileHideoutAreas.FirstOrDefault(x => x.Type == HideoutAreas.EmergencyWall);
|
||||
|
||||
// No collector or med station, skip
|
||||
if (waterCollector is null && medStation is null)
|
||||
@@ -151,10 +143,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <param name="pmcProfile">Player profile</param>
|
||||
/// <param name="desiredBonus">Bonus to sum up</param>
|
||||
/// <returns>Summed bonus value or 0 if no bonus found</returns>
|
||||
public static double GetBonusValueFromProfile(
|
||||
this PmcData pmcProfile,
|
||||
BonusType desiredBonus
|
||||
)
|
||||
public static double GetBonusValueFromProfile(this PmcData pmcProfile, BonusType desiredBonus)
|
||||
{
|
||||
var bonuses = pmcProfile?.Bonuses?.Where(b => b.Type == desiredBonus);
|
||||
if (!bonuses.Any())
|
||||
@@ -168,9 +157,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
|
||||
public static bool PlayerIsFleaBanned(this PmcData pmcProfile, long currentTimestamp)
|
||||
{
|
||||
return pmcProfile?.Info?.Bans?.Any(b =>
|
||||
b.BanType == BanType.RagFair && currentTimestamp < b.DateTime
|
||||
) ?? false;
|
||||
return pmcProfile?.Info?.Bans?.Any(b => b.BanType == BanType.RagFair && currentTimestamp < b.DateTime) ?? false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -221,9 +208,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
}
|
||||
|
||||
// Otherwise get the parent item
|
||||
currentItem = pmcData.Inventory.Items.FirstOrDefault(item =>
|
||||
item.Id == currentItem.ParentId
|
||||
);
|
||||
currentItem = pmcData.Inventory.Items.FirstOrDefault(item => item.Id == currentItem.ParentId);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -251,12 +236,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
{
|
||||
foreach (var (partKey, bodyPart) in profile.Health.BodyParts)
|
||||
{
|
||||
bodyPart.Health.Maximum = profileTemplate
|
||||
.Character
|
||||
.Health
|
||||
.BodyParts[partKey]
|
||||
.Health
|
||||
.Maximum;
|
||||
bodyPart.Health.Maximum = profileTemplate.Character.Health.BodyParts[partKey].Health.Maximum;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,11 +11,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
{
|
||||
public static string GetModPath(this SptMod sptMod)
|
||||
{
|
||||
var relativeModPath = Path.GetRelativePath(
|
||||
Directory.GetCurrentDirectory(),
|
||||
sptMod.Directory
|
||||
)
|
||||
.Replace('\\', '/');
|
||||
var relativeModPath = Path.GetRelativePath(Directory.GetCurrentDirectory(), sptMod.Directory).Replace('\\', '/');
|
||||
|
||||
return relativeModPath;
|
||||
}
|
||||
|
||||
@@ -5,10 +5,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
{
|
||||
public static class TemplateItemExtensions
|
||||
{
|
||||
public static IEnumerable<TemplateItem> OfClass(
|
||||
this Dictionary<MongoId, TemplateItem> templates,
|
||||
params MongoId[] baseClasses
|
||||
)
|
||||
public static IEnumerable<TemplateItem> OfClass(this Dictionary<MongoId, TemplateItem> templates, params MongoId[] baseClasses)
|
||||
{
|
||||
return templates.Where(x => baseClasses.Contains(x.Value.Parent)).Select(x => x.Value);
|
||||
}
|
||||
@@ -19,9 +16,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
params MongoId[] baseClasses
|
||||
)
|
||||
{
|
||||
return templates
|
||||
.Where(x => baseClasses.Contains(x.Value.Parent) && pred(x.Value))
|
||||
.Select(x => x.Value);
|
||||
return templates.Where(x => baseClasses.Contains(x.Value.Parent) && pred(x.Value)).Select(x => x.Value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -13,11 +13,7 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// <param name="itemId">Id of item to remove from assort</param>
|
||||
/// <param name="isFlea">Is the assort being modified the flea market assort</param>
|
||||
/// <returns>Modified assort</returns>
|
||||
public static TraderAssort RemoveItemFromAssort(
|
||||
this TraderAssort assort,
|
||||
MongoId itemId,
|
||||
bool isFlea = false
|
||||
)
|
||||
public static TraderAssort RemoveItemFromAssort(this TraderAssort assort, MongoId itemId, bool isFlea = false)
|
||||
{
|
||||
// Flea assort needs special handling, item must remain in assort but be flagged as locked
|
||||
if (isFlea && assort.BarterScheme.TryGetValue(itemId, out var listToUse))
|
||||
@@ -45,15 +41,10 @@ namespace SPTarkov.Server.Core.Extensions
|
||||
/// </summary>
|
||||
/// <param name="assortToFilter">Trader assort to modify</param>
|
||||
/// <param name="itemsTplsToRemove">Item TPLs the assort should not have</param>
|
||||
public static void RemoveItemsFromAssort(
|
||||
this TraderAssort assortToFilter,
|
||||
HashSet<MongoId> itemsTplsToRemove
|
||||
)
|
||||
public static void RemoveItemsFromAssort(this TraderAssort assortToFilter, HashSet<MongoId> itemsTplsToRemove)
|
||||
{
|
||||
assortToFilter.Items = assortToFilter
|
||||
.Items.Where(item =>
|
||||
item.ParentId == "hideout" && itemsTplsToRemove.Contains(item.Template)
|
||||
)
|
||||
.Items.Where(item => item.ParentId == "hideout" && itemsTplsToRemove.Contains(item.Template))
|
||||
.ToList();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,10 +2,7 @@
|
||||
{
|
||||
public static class UtilityExtensions
|
||||
{
|
||||
public static IEnumerable<T> IntersectWith<T>(
|
||||
this IEnumerable<T> first,
|
||||
IEnumerable<T> second
|
||||
)
|
||||
public static IEnumerable<T> IntersectWith<T>(this IEnumerable<T> first, IEnumerable<T> second)
|
||||
{
|
||||
//a.Intersect(x => b.Contains(x)).ToList();
|
||||
// gives error Delegate type could not be inferred
|
||||
|
||||
Reference in New Issue
Block a user