Merge branch 'main' of https://github.com/sp-tarkov/server-csharp
This commit is contained in:
@@ -132,7 +132,7 @@ public class InventoryHelper(
|
||||
try
|
||||
{
|
||||
if (request.Callback is not null)
|
||||
request.Callback(rootItemToAdd.Upd.StackObjectsCount.Value);
|
||||
request.Callback((int) (rootItemToAdd.Upd.StackObjectsCount ?? 0));
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
||||
@@ -56,7 +56,7 @@ public class TradeHelper(
|
||||
)
|
||||
{
|
||||
List<Item> offerItems = [];
|
||||
Action<double>? buyCallback;
|
||||
Action<int>? buyCallback;
|
||||
|
||||
if (buyRequestData.TransactionId.ToLower() == "ragfair")
|
||||
{
|
||||
|
||||
@@ -15,7 +15,7 @@ public record AddItemDirectRequest
|
||||
public bool? FoundInRaid { get; set; }
|
||||
|
||||
[JsonPropertyName("callback")]
|
||||
public Action<double>? Callback { get; set; }
|
||||
public Action<int>? Callback { get; set; }
|
||||
|
||||
[JsonPropertyName("useSortingTable")]
|
||||
public bool? UseSortingTable { get; set; }
|
||||
|
||||
@@ -16,7 +16,7 @@ public record AddItemsDirectRequest
|
||||
|
||||
/// Runs after EACH item with children is added
|
||||
[JsonPropertyName("callback")]
|
||||
public Action<double>? Callback { get; set; }
|
||||
public Action<int>? Callback { get; set; }
|
||||
|
||||
/// Should sorting table be used when no space found in stash
|
||||
[JsonPropertyName("useSortingTable")]
|
||||
|
||||
@@ -83,7 +83,7 @@ public record FenceConfig
|
||||
|
||||
/** Key: item tpl */
|
||||
[JsonPropertyName("itemStackSizeOverrideMinMax")]
|
||||
public Dictionary<string, MinMax> ItemStackSizeOverrideMinMax { get; set; }
|
||||
public Dictionary<string, MinMax?> ItemStackSizeOverrideMinMax { get; set; }
|
||||
|
||||
[JsonPropertyName("itemTypeLimits")]
|
||||
public Dictionary<string, int> ItemTypeLimits { get; set; }
|
||||
@@ -97,11 +97,11 @@ public record FenceConfig
|
||||
|
||||
/** Max rouble price before item is not listed on flea */
|
||||
[JsonPropertyName("itemCategoryRoublePriceLimit")]
|
||||
public Dictionary<string, double> ItemCategoryRoublePriceLimit { get; set; }
|
||||
public Dictionary<string, double?> ItemCategoryRoublePriceLimit { get; set; }
|
||||
|
||||
/** Each slotid with % to be removed prior to listing on fence */
|
||||
[JsonPropertyName("presetSlotsToRemoveChancePercent")]
|
||||
public Dictionary<string, double> PresetSlotsToRemoveChancePercent { get; set; }
|
||||
public Dictionary<string, double?> PresetSlotsToRemoveChancePercent { get; set; }
|
||||
|
||||
/** Block seasonal items from appearing when season is inactive */
|
||||
[JsonPropertyName("blacklistSeasonalItems")]
|
||||
|
||||
+1413
-320
File diff suppressed because it is too large
Load Diff
@@ -468,9 +468,16 @@ public class RandomUtil(ISptLogger<RandomUtil> _logger, ICloner _cloner)
|
||||
: 0;
|
||||
}
|
||||
|
||||
public T GetArrayValue<T>(IEnumerable<T> list)
|
||||
public T? GetArrayValue<T>(IEnumerable<T> list)
|
||||
{
|
||||
var rand = new Random();
|
||||
return list.ElementAt(rand.Next(0, list.Count()));
|
||||
try
|
||||
{
|
||||
return list.ElementAt(rand.Next(0, list.Count()));
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user