diff --git a/Libraries/Core/Controllers/BotController.cs b/Libraries/Core/Controllers/BotController.cs index 9ffdbc12..8c31cd26 100644 --- a/Libraries/Core/Controllers/BotController.cs +++ b/Libraries/Core/Controllers/BotController.cs @@ -388,7 +388,7 @@ public class BotController( }; } - private MinMax? GetPmcConversionMinMaxForLocation(string? requestedBotRole, string? location) + private MinMaxDouble? GetPmcConversionMinMaxForLocation(string? requestedBotRole, string? location) { return _pmcConfig.ConvertIntoPmcChance!.TryGetValue(location?.ToLower() ?? "", out var mapSpecificConversionValues) ? mapSpecificConversionValues.GetValueOrDefault(requestedBotRole?.ToLower()) @@ -409,7 +409,7 @@ public class BotController( return raidSettings; } - private MinMax? GetPmcLevelRangeForMap(string? location) + private MinMaxDouble? GetPmcLevelRangeForMap(string? location) { return _pmcConfig.LocationSpecificPmcLevelOverride!.GetValueOrDefault(location?.ToLower() ?? "", null); } diff --git a/Libraries/Core/Controllers/RagfairController.cs b/Libraries/Core/Controllers/RagfairController.cs index 96b2be38..36f054fc 100644 --- a/Libraries/Core/Controllers/RagfairController.cs +++ b/Libraries/Core/Controllers/RagfairController.cs @@ -369,7 +369,7 @@ public class RagfairController if (offers.Count > 0) { // These get calculated while iterating through the list below - var minMax = new MinMax(int.MaxValue, 0); + var minMax = new MinMaxDouble(int.MaxValue, 0); // Get the average offer price, excluding barter offers var average = GetAveragePriceFromOffers(offers, minMax, ignoreTraderOffers); @@ -398,7 +398,7 @@ public class RagfairController }; } - private double GetAveragePriceFromOffers(List offers, MinMax minMax, bool ignoreTraderOffers) + private double GetAveragePriceFromOffers(List offers, MinMaxDouble minMax, bool ignoreTraderOffers) { var sum = 0d; var totalOfferCount = 0; diff --git a/Libraries/Core/Generators/BotEquipmentModGenerator.cs b/Libraries/Core/Generators/BotEquipmentModGenerator.cs index 34c8f9eb..bae44d27 100644 --- a/Libraries/Core/Generators/BotEquipmentModGenerator.cs +++ b/Libraries/Core/Generators/BotEquipmentModGenerator.cs @@ -360,7 +360,7 @@ public class BotEquipmentModGenerator( return result; } - private MinMax GetMinMaxArmorPlateClass(List platePool) + private MinMaxDouble GetMinMaxArmorPlateClass(List platePool) { platePool.Sort( (x, y) => @@ -379,7 +379,7 @@ public class BotEquipmentModGenerator( } ); - return new MinMax + return new MinMaxDouble { Min = platePool[0].Properties.ArmorClass, Max = platePool[platePool.Count - 1].Properties.ArmorClass diff --git a/Libraries/Core/Generators/BotGenerator.cs b/Libraries/Core/Generators/BotGenerator.cs index e435bc57..4c58b864 100644 --- a/Libraries/Core/Generators/BotGenerator.cs +++ b/Libraries/Core/Generators/BotGenerator.cs @@ -318,7 +318,7 @@ public class BotGenerator( /// the killed bots difficulty /// Role of bot (optional, used for error logging) /// Experience for kill - public double GetExperienceRewardForKillByDifficulty(Dictionary experiences, string botDifficulty, string role) + public double GetExperienceRewardForKillByDifficulty(Dictionary experiences, string botDifficulty, string role) { if (!experiences.TryGetValue(botDifficulty.ToLower(), out var result)) { @@ -624,7 +624,7 @@ public class BotGenerator( foreach (var prop in props) { - var value = (MinMax) prop.GetValue(bodyPart); + var value = (MinMaxDouble) prop.GetValue(bodyPart); hpTotal += value.Max; } @@ -662,7 +662,7 @@ public class BotGenerator( /// Skills to randomise /// Are the skills 'common' skills /// Skills with randomised progress values as an array - public List GetSkillsWithRandomisedProgressValue(Dictionary? skills, bool isCommonSkills) + public List GetSkillsWithRandomisedProgressValue(Dictionary? skills, bool isCommonSkills) { if (skills is null) { diff --git a/Libraries/Core/Generators/BotLevelGenerator.cs b/Libraries/Core/Generators/BotLevelGenerator.cs index 04c0d4af..62b89381 100644 --- a/Libraries/Core/Generators/BotLevelGenerator.cs +++ b/Libraries/Core/Generators/BotLevelGenerator.cs @@ -24,7 +24,7 @@ public class BotLevelGenerator( /// Details to help generate a bot /// Bot the level is being generated for /// IRandomisedBotLevelResult object - public RandomisedBotLevelResult GenerateBotLevel(MinMax levelDetails, BotGenerationDetails botGenerationDetails, BotBase bot) + public RandomisedBotLevelResult GenerateBotLevel(MinMaxDouble levelDetails, BotGenerationDetails botGenerationDetails, BotBase bot) { if (!botGenerationDetails.IsPmc.GetValueOrDefault(false)) { @@ -74,7 +74,7 @@ public class BotLevelGenerator( /// /// Max level allowed /// A MinMax of the lowest and highest level to generate the bots - public MinMax GetRelativePmcBotLevelRange(BotGenerationDetails botGenerationDetails, MinMax levelDetails, int maxAvailableLevel) + public MinMaxDouble GetRelativePmcBotLevelRange(BotGenerationDetails botGenerationDetails, MinMaxDouble levelDetails, int maxAvailableLevel) { var levelOverride = botGenerationDetails.LocationSpecificPmcLevelOverride; @@ -105,6 +105,6 @@ public class BotLevelGenerator( maxLevel = Math.Min(Math.Max(maxLevel, minPossibleLevel), maxPossibleLevel); minLevel = Math.Min(Math.Max(minLevel, minPossibleLevel), maxPossibleLevel); - return new MinMax(minLevel, maxLevel); + return new MinMaxDouble(minLevel, maxLevel); } } diff --git a/Libraries/Core/Generators/LootGenerator.cs b/Libraries/Core/Generators/LootGenerator.cs index 549cf383..60d73322 100644 --- a/Libraries/Core/Generators/LootGenerator.cs +++ b/Libraries/Core/Generators/LootGenerator.cs @@ -41,7 +41,7 @@ public class LootGenerator( var itemTypeCounts = InitItemLimitCounter(options.ItemLimits); // Handle sealed weapon containers - var sealedWeaponCrateCount = _randomUtil.GetDouble( + var sealedWeaponCrateCount = _randomUtil.GetInt( options.WeaponCrateCount.Min.Value, options.WeaponCrateCount.Max.Value ); @@ -84,7 +84,7 @@ public class LootGenerator( // Pool has items we could add as loot, proceed if (rewardPoolResults.ItemPool.Count > 0) { - var randomisedItemCount = _randomUtil.GetDouble(options.ItemCount.Min.Value, options.ItemCount.Max.Value); + var randomisedItemCount = _randomUtil.GetInt(options.ItemCount.Min.Value, options.ItemCount.Max.Value); for (var index = 0; index < randomisedItemCount; index++) { if (!FindAndAddRandomItemToLoot(rewardPoolResults.ItemPool, itemTypeCounts, options, result)) @@ -98,7 +98,7 @@ public class LootGenerator( var globalDefaultPresets = _presetHelper.GetDefaultPresets().Values; // Filter default presets to just weapons - var randomisedWeaponPresetCount = _randomUtil.GetDouble( + var randomisedWeaponPresetCount = _randomUtil.GetInt( options.WeaponPresetCount.Min.Value, options.WeaponPresetCount.Max.Value ); @@ -131,7 +131,7 @@ public class LootGenerator( } // Filter default presets to just armors and then filter again by protection level - var randomisedArmorPresetCount = _randomUtil.GetDouble( + var randomisedArmorPresetCount = _randomUtil.GetInt( options.ArmorPresetCount.Min.Value, options.ArmorPresetCount.Max.Value ); @@ -177,7 +177,7 @@ public class LootGenerator( /// /// Dictionary of item tpls with minmax values /// Array of Item - public List CreateForcedLoot(Dictionary forcedLootDict) + public List CreateForcedLoot(Dictionary forcedLootDict) { var result = new List(); @@ -186,7 +186,7 @@ public class LootGenerator( foreach (var forcedItemKvP in forcedItems) { var details = forcedLootDict[forcedItemKvP.Key]; - var randomisedItemCount = _randomUtil.GetDouble(details.Min.Value, details.Max.Value); + var randomisedItemCount = _randomUtil.GetInt(details.Min.Value, details.Max.Value); // Add forced loot item to result var newLootItem = new Item @@ -296,7 +296,7 @@ public class LootGenerator( /// /// limits as defined in config /// record, key: item tplId, value: current/max item count allowed - private Dictionary InitItemLimitCounter(Dictionary limits) + private Dictionary InitItemLimitCounter(Dictionary limits) { var itemTypeCounts = new Dictionary(); foreach (var itemTypeId in limits) @@ -380,8 +380,8 @@ public class LootGenerator( if (options.ItemStackLimits.TryGetValue(item.Id, out var itemLimits)) { - min = (int?) itemLimits.Min; - max = (int?) itemLimits.Max; + min = itemLimits.Min; + max = itemLimits.Max; } return _randomUtil.GetInt(min ?? 1, max ?? 1); @@ -542,8 +542,7 @@ public class LootGenerator( foreach (var (rewardKey, settings) in containerSettings.RewardTypeLimits) { - var rewardCount = _randomUtil.GetDouble(settings.Min.Value, settings.Max.Value); - + var rewardCount = _randomUtil.GetInt(settings.Min.Value, settings.Max.Value); if (rewardCount == 0) { continue; @@ -552,7 +551,7 @@ public class LootGenerator( // Edge case - ammo boxes if (rewardKey == BaseClasses.AMMO_BOX) { - // Get ammoboxes from db + // Get ammo boxes from db var ammoBoxesDetails = containerSettings.AmmoBoxWhitelist.Select( tpl => { @@ -650,7 +649,7 @@ public class LootGenerator( foreach (var (rewardKey, settings) in containerSettings.WeaponModRewardLimits) { - var rewardCount = _randomUtil.GetDouble(settings.Min.Value, settings.Max.Value); + var rewardCount = _randomUtil.GetInt(settings.Min.Value, settings.Max.Value); // Nothing to add, skip reward type if (rewardCount == 0) @@ -775,14 +774,14 @@ public class LootGenerator( public class ItemLimit { [JsonPropertyName("current")] - public double Current + public int Current { get; set; } [JsonPropertyName("max")] - public double Max + public int Max { get; set; diff --git a/Libraries/Core/Generators/ScavCaseRewardGenerator.cs b/Libraries/Core/Generators/ScavCaseRewardGenerator.cs index 74e0d88d..76388d70 100644 --- a/Libraries/Core/Generators/ScavCaseRewardGenerator.cs +++ b/Libraries/Core/Generators/ScavCaseRewardGenerator.cs @@ -464,20 +464,20 @@ public class ScavCaseRewardGenerator( amountToGive = itemToCalculate.Id switch { Money.ROUBLES => _randomUtil.GetInt( - (int) _scavCaseConfig.MoneyRewards.RubCount.GetByJsonProp(rarity).Min, - (int) _scavCaseConfig.MoneyRewards.RubCount.GetByJsonProp(rarity).Max + (int) _scavCaseConfig.MoneyRewards.RubCount.GetByJsonProp(rarity).Min, + (int) _scavCaseConfig.MoneyRewards.RubCount.GetByJsonProp(rarity).Max ), Money.EUROS => _randomUtil.GetInt( - (int) _scavCaseConfig.MoneyRewards.EurCount.GetByJsonProp(rarity).Min, - (int) _scavCaseConfig.MoneyRewards.EurCount.GetByJsonProp(rarity).Max + (int) _scavCaseConfig.MoneyRewards.EurCount.GetByJsonProp(rarity).Min, + (int) _scavCaseConfig.MoneyRewards.EurCount.GetByJsonProp(rarity).Max ), Money.DOLLARS => _randomUtil.GetInt( - (int) _scavCaseConfig.MoneyRewards.UsdCount.GetByJsonProp(rarity).Min, - (int) _scavCaseConfig.MoneyRewards.UsdCount.GetByJsonProp(rarity).Max + (int) _scavCaseConfig.MoneyRewards.UsdCount.GetByJsonProp(rarity).Min, + (int) _scavCaseConfig.MoneyRewards.UsdCount.GetByJsonProp(rarity).Max ), Money.GP => _randomUtil.GetInt( - (int) _scavCaseConfig.MoneyRewards.GpCount.GetByJsonProp(rarity).Min, - (int) _scavCaseConfig.MoneyRewards.GpCount.GetByJsonProp(rarity).Max + (int) _scavCaseConfig.MoneyRewards.GpCount.GetByJsonProp(rarity).Min, + (int) _scavCaseConfig.MoneyRewards.GpCount.GetByJsonProp(rarity).Max ), _ => amountToGive }; diff --git a/Libraries/Core/Helpers/BotHelper.cs b/Libraries/Core/Helpers/BotHelper.cs index b3588e47..82543aba 100644 --- a/Libraries/Core/Helpers/BotHelper.cs +++ b/Libraries/Core/Helpers/BotHelper.cs @@ -112,17 +112,17 @@ public class BotHelper( } } - public bool RollChanceToBePmc(MinMax botConvertMinMax) + public bool RollChanceToBePmc(MinMaxDouble botConvertMinMax) { return _randomUtil.GetChance100(_randomUtil.GetDouble(botConvertMinMax.Min.Value, botConvertMinMax.Max.Value)); } - protected Dictionary GetPmcConversionValuesForLocation(string location) + protected Dictionary GetPmcConversionValuesForLocation(string location) { var result = _pmcConfig.ConvertIntoPmcChance[location.ToLower()]; if (result is null) { - _pmcConfig.ConvertIntoPmcChance = new Dictionary>(); + _pmcConfig.ConvertIntoPmcChance = new Dictionary>(); } return result; diff --git a/Libraries/Core/Helpers/TraderHelper.cs b/Libraries/Core/Helpers/TraderHelper.cs index 4c5f6387..5c4ddbc6 100644 --- a/Libraries/Core/Helpers/TraderHelper.cs +++ b/Libraries/Core/Helpers/TraderHelper.cs @@ -394,7 +394,7 @@ public class TraderHelper( // create temporary entry to prevent logger spam { TraderId = traderId, - Seconds = new MinMax(_traderConfig.UpdateTimeDefault, _traderConfig.UpdateTimeDefault) + Seconds = new MinMaxDouble(_traderConfig.UpdateTimeDefault, _traderConfig.UpdateTimeDefault) } ); diff --git a/Libraries/Core/Models/Common/MinMax.cs b/Libraries/Core/Models/Common/MinMaxDouble.cs similarity index 80% rename from Libraries/Core/Models/Common/MinMax.cs rename to Libraries/Core/Models/Common/MinMaxDouble.cs index 772f8712..2090632b 100644 --- a/Libraries/Core/Models/Common/MinMax.cs +++ b/Libraries/Core/Models/Common/MinMaxDouble.cs @@ -2,15 +2,15 @@ using System.Text.Json.Serialization; namespace Core.Models.Common; -public record MinMax +public record MinMaxDouble { - public MinMax(double min, double max) + public MinMaxDouble(double min, double max) { Min = min; Max = max; } - public MinMax() + public MinMaxDouble() { } diff --git a/Libraries/Core/Models/Common/MinMaxInt.cs b/Libraries/Core/Models/Common/MinMaxInt.cs new file mode 100644 index 00000000..36ca6710 --- /dev/null +++ b/Libraries/Core/Models/Common/MinMaxInt.cs @@ -0,0 +1,37 @@ +using System.Text.Json.Serialization; + +namespace Core.Models.Common; + +public record MinMaxInt +{ + public MinMaxInt(int min, int max) + { + Min = min; + Max = max; + } + + public MinMaxInt() + { + } + + [JsonPropertyName("type")] + public string? Type + { + get; + set; + } + + [JsonPropertyName("max")] + public int? Max + { + get; + set; + } + + [JsonPropertyName("min")] + public int? Min + { + get; + set; + } +} diff --git a/Libraries/Core/Models/Eft/Common/LocationBase.cs b/Libraries/Core/Models/Eft/Common/LocationBase.cs index 561853a3..f2c603de 100644 --- a/Libraries/Core/Models/Eft/Common/LocationBase.cs +++ b/Libraries/Core/Models/Eft/Common/LocationBase.cs @@ -870,7 +870,7 @@ public record NonWaveGroupScenario } } -public record Limit : MinMax +public record Limit : MinMaxDouble { [JsonPropertyName("items")] public object[] Items @@ -1383,7 +1383,7 @@ public record ChancedEnemy } } -public record MinMaxBot : MinMax +public record MinMaxBot : MinMaxDouble { [JsonPropertyName("WildSpawnType")] public string? WildSpawnType diff --git a/Libraries/Core/Models/Eft/Common/Tables/BotType.cs b/Libraries/Core/Models/Eft/Common/Tables/BotType.cs index d0821b54..a133dfb3 100644 --- a/Libraries/Core/Models/Eft/Common/Tables/BotType.cs +++ b/Libraries/Core/Models/Eft/Common/Tables/BotType.cs @@ -446,7 +446,7 @@ public record Experience } [JsonPropertyName("level")] - public MinMax? Level + public MinMaxDouble? Level { get; set; @@ -456,7 +456,7 @@ public record Experience * key = bot difficulty */ [JsonPropertyName("reward")] - public Dictionary? Reward + public Dictionary? Reward { get; set; @@ -616,19 +616,19 @@ public record BotTypeHealth set; } - public MinMax? Energy + public MinMaxDouble? Energy { get; set; } - public MinMax? Hydration + public MinMaxDouble? Hydration { get; set; } - public MinMax? Temperature + public MinMaxDouble? Temperature { get; set; @@ -637,43 +637,43 @@ public record BotTypeHealth public record BodyPart { - public MinMax? Chest + public MinMaxDouble? Chest { get; set; } - public MinMax? Head + public MinMaxDouble? Head { get; set; } - public MinMax? LeftArm + public MinMaxDouble? LeftArm { get; set; } - public MinMax? LeftLeg + public MinMaxDouble? LeftLeg { get; set; } - public MinMax? RightArm + public MinMaxDouble? RightArm { get; set; } - public MinMax? RightLeg + public MinMaxDouble? RightLeg { get; set; } - public MinMax? Stomach + public MinMaxDouble? Stomach { get; set; @@ -832,13 +832,13 @@ public record ItemPools public record BotDbSkills { - public Dictionary? Common + public Dictionary? Common { get; set; } - public Dictionary? Mastering + public Dictionary? Mastering { get; set; diff --git a/Libraries/Core/Models/Eft/Hideout/HideoutProduction.cs b/Libraries/Core/Models/Eft/Hideout/HideoutProduction.cs index aa63d720..2f2eca50 100644 --- a/Libraries/Core/Models/Eft/Hideout/HideoutProduction.cs +++ b/Libraries/Core/Models/Eft/Hideout/HideoutProduction.cs @@ -232,21 +232,21 @@ public record ScavRecipe public record EndProducts { [JsonPropertyName("Common")] - public MinMax? Common + public MinMaxDouble? Common { get; set; } [JsonPropertyName("Rare")] - public MinMax? Rare + public MinMaxDouble? Rare { get; set; } [JsonPropertyName("Superrare")] - public MinMax? Superrare + public MinMaxDouble? Superrare { get; set; diff --git a/Libraries/Core/Models/Eft/Ragfair/GetItemPriceResult.cs b/Libraries/Core/Models/Eft/Ragfair/GetItemPriceResult.cs index 19d41446..f427c289 100644 --- a/Libraries/Core/Models/Eft/Ragfair/GetItemPriceResult.cs +++ b/Libraries/Core/Models/Eft/Ragfair/GetItemPriceResult.cs @@ -3,7 +3,7 @@ using Core.Models.Common; namespace Core.Models.Eft.Ragfair; -public record GetItemPriceResult : MinMax +public record GetItemPriceResult : MinMaxDouble { [JsonPropertyName("avg")] public double? Avg diff --git a/Libraries/Core/Models/Spt/Bots/BotGenerationDetails.cs b/Libraries/Core/Models/Spt/Bots/BotGenerationDetails.cs index 4123d629..6d1c2e64 100644 --- a/Libraries/Core/Models/Spt/Bots/BotGenerationDetails.cs +++ b/Libraries/Core/Models/Spt/Bots/BotGenerationDetails.cs @@ -56,7 +56,7 @@ public record BotGenerationDetails /// Level specific overrides for PMC level /// [JsonPropertyName("locationSpecificPmcLevelOverride")] - public MinMax? LocationSpecificPmcLevelOverride + public MinMaxDouble? LocationSpecificPmcLevelOverride { get; set; diff --git a/Libraries/Core/Models/Spt/Config/AirdropConfig.cs b/Libraries/Core/Models/Spt/Config/AirdropConfig.cs index aeca7d4c..12c9078b 100644 --- a/Libraries/Core/Models/Spt/Config/AirdropConfig.cs +++ b/Libraries/Core/Models/Spt/Config/AirdropConfig.cs @@ -117,7 +117,7 @@ public record AirdropLoot /// Min/max of weapons inside crate /// [JsonPropertyName("weaponPresetCount")] - public MinMax? WeaponPresetCount + public MinMaxInt? WeaponPresetCount { get; set; @@ -127,7 +127,7 @@ public record AirdropLoot /// Min/max of armors (head/chest/rig) inside crate /// [JsonPropertyName("armorPresetCount")] - public MinMax? ArmorPresetCount + public MinMaxInt? ArmorPresetCount { get; set; @@ -137,7 +137,7 @@ public record AirdropLoot /// Min/max of items inside crate /// [JsonPropertyName("itemCount")] - public MinMax ItemCount + public MinMaxInt ItemCount { get; set; @@ -147,7 +147,7 @@ public record AirdropLoot /// Min/max of sealed weapon boxes inside crate /// [JsonPropertyName("weaponCrateCount")] - public MinMax WeaponCrateCount + public MinMaxInt WeaponCrateCount { get; set; @@ -177,7 +177,7 @@ public record AirdropLoot /// Item type/ item tpls to limit count of inside crate - key: item base type: value: max count /// [JsonPropertyName("itemLimits")] - public Dictionary ItemLimits + public Dictionary ItemLimits { get; set; @@ -187,7 +187,7 @@ public record AirdropLoot /// Items to limit stack size of key: item tpl value: min/max stack size /// [JsonPropertyName("itemStackLimits")] - public Dictionary ItemStackLimits + public Dictionary ItemStackLimits { get; set; @@ -221,7 +221,7 @@ public record AirdropLoot } [JsonPropertyName("forcedLoot")] - public Dictionary? ForcedLoot + public Dictionary? ForcedLoot { get; set; diff --git a/Libraries/Core/Models/Spt/Config/BotConfig.cs b/Libraries/Core/Models/Spt/Config/BotConfig.cs index 8c41cbce..b890e871 100644 --- a/Libraries/Core/Models/Spt/Config/BotConfig.cs +++ b/Libraries/Core/Models/Spt/Config/BotConfig.cs @@ -251,7 +251,7 @@ public record AssaultToBossConversion } [JsonPropertyName("bossConvertMinMax")] - public Dictionary BossConvertMinMax + public Dictionary BossConvertMinMax { get; set; @@ -599,7 +599,7 @@ public record WalletLootSettings } [JsonPropertyName("itemCount")] - public MinMax ItemCount + public MinMaxDouble ItemCount { get; set; @@ -843,7 +843,7 @@ public record RandomisationDetails /// Between what levels do these randomisation setting apply to /// [JsonPropertyName("levelRange")] - public MinMax LevelRange + public MinMaxDouble LevelRange { get; set; @@ -950,7 +950,7 @@ public record EquipmentFilterDetails /// Between what levels do these equipment filter setting apply to /// [JsonPropertyName("levelRange")] - public MinMax LevelRange + public MinMaxDouble LevelRange { get; set; @@ -993,7 +993,7 @@ public record WeightingAdjustmentDetails /// Between what levels do these weight settings apply to /// [JsonPropertyName("levelRange")] - public MinMax LevelRange + public MinMaxDouble LevelRange { get; set; @@ -1050,7 +1050,7 @@ public record AdjustmentDetails public class ArmorPlateWeights { [JsonPropertyName("levelRange")] - public MinMax LevelRange + public MinMaxDouble LevelRange { get; set; diff --git a/Libraries/Core/Models/Spt/Config/HideoutConfig.cs b/Libraries/Core/Models/Spt/Config/HideoutConfig.cs index 0c62c8f7..e37c30f5 100644 --- a/Libraries/Core/Models/Spt/Config/HideoutConfig.cs +++ b/Libraries/Core/Models/Spt/Config/HideoutConfig.cs @@ -127,7 +127,7 @@ public record CultistCircleSettings } [JsonPropertyName("rewardPriceMultiplerMinMax")] - public MinMax RewardPriceMultiplerMinMax + public MinMaxDouble RewardPriceMultiplerMinMax { get; set; @@ -211,7 +211,7 @@ public record CultistCircleSettings /// Overrides for reward stack sizes, keyed by item tpl /// [JsonPropertyName("directRewardStackSize")] - public Dictionary DirectRewardStackSize + public Dictionary DirectRewardStackSize { get; set; @@ -238,14 +238,14 @@ public record CultistCircleSettings } [JsonPropertyName("currencyRewards")] - public Dictionary CurrencyRewards + public Dictionary CurrencyRewards { get; set; } } -public record CraftTimeThreshold : MinMax +public record CraftTimeThreshold : MinMaxDouble { [JsonPropertyName("craftTimeSeconds")] public int CraftTimeSeconds diff --git a/Libraries/Core/Models/Spt/Config/InventoryConfig.cs b/Libraries/Core/Models/Spt/Config/InventoryConfig.cs index 9f7c1923..46bbe6fc 100644 --- a/Libraries/Core/Models/Spt/Config/InventoryConfig.cs +++ b/Libraries/Core/Models/Spt/Config/InventoryConfig.cs @@ -132,14 +132,14 @@ public record SealedAirdropContainerSettings } [JsonPropertyName("weaponModRewardLimits")] - public Dictionary WeaponModRewardLimits + public Dictionary WeaponModRewardLimits { get; set; } [JsonPropertyName("rewardTypeLimits")] - public Dictionary RewardTypeLimits + public Dictionary RewardTypeLimits { get; set; diff --git a/Libraries/Core/Models/Spt/Config/LocationConfig.cs b/Libraries/Core/Models/Spt/Config/LocationConfig.cs index b744961a..3bd45809 100644 --- a/Libraries/Core/Models/Spt/Config/LocationConfig.cs +++ b/Libraries/Core/Models/Spt/Config/LocationConfig.cs @@ -341,7 +341,7 @@ public record CustomWaves } } -public record BotTypeLimit : MinMax +public record BotTypeLimit : MinMaxDouble { [JsonPropertyName("type")] public string Type diff --git a/Libraries/Core/Models/Spt/Config/PmcConfig.cs b/Libraries/Core/Models/Spt/Config/PmcConfig.cs index 46dbd7ad..244fe80f 100644 --- a/Libraries/Core/Models/Spt/Config/PmcConfig.cs +++ b/Libraries/Core/Models/Spt/Config/PmcConfig.cs @@ -115,7 +115,7 @@ public record PmcConfig : BaseConfig * MinMax count of weapons to have in backpack */ [JsonPropertyName("looseWeaponInBackpackLootMinMax")] - public MinMax LooseWeaponInBackpackLootMinMax + public MinMaxDouble LooseWeaponInBackpackLootMinMax { get; set; @@ -200,7 +200,7 @@ public record PmcConfig : BaseConfig * Percentage chance a bot from a wave is converted into a PMC, first key = map, second key = bot wildspawn type (assault/exusec), value: min+max chance to be converted */ [JsonPropertyName("convertIntoPmcChance")] - public Dictionary> ConvertIntoPmcChance + public Dictionary> ConvertIntoPmcChance { get; set; @@ -251,7 +251,7 @@ public record PmcConfig : BaseConfig } [JsonPropertyName("locationSpecificPmcLevelOverride")] - public Dictionary LocationSpecificPmcLevelOverride + public Dictionary LocationSpecificPmcLevelOverride { get; set; @@ -383,7 +383,7 @@ public record SlotLootSettings } } -public record MinMaxLootValue : MinMax +public record MinMaxLootValue : MinMaxDouble { [JsonPropertyName("value")] public double Value @@ -393,24 +393,24 @@ public record MinMaxLootValue : MinMax } } -public record MinMaxLootItemValue : MinMax +public record MinMaxLootItemValue : MinMaxDouble { [JsonPropertyName("backpack")] - public MinMax Backpack + public MinMaxDouble Backpack { get; set; } [JsonPropertyName("pocket")] - public MinMax Pocket + public MinMaxDouble Pocket { get; set; } [JsonPropertyName("vest")] - public MinMax Vest + public MinMaxDouble Vest { get; set; diff --git a/Libraries/Core/Models/Spt/Config/QuestConfig.cs b/Libraries/Core/Models/Spt/Config/QuestConfig.cs index 59a0af99..e84418b2 100644 --- a/Libraries/Core/Models/Spt/Config/QuestConfig.cs +++ b/Libraries/Core/Models/Spt/Config/QuestConfig.cs @@ -596,7 +596,7 @@ public record PickupTypeWithMaxCount public record EliminationConfig : BaseQuestConfig { [JsonPropertyName("levelRange")] - public MinMax? LevelRange + public MinMaxDouble? LevelRange { get; set; diff --git a/Libraries/Core/Models/Spt/Config/RagfairConfig.cs b/Libraries/Core/Models/Spt/Config/RagfairConfig.cs index b6143f29..57ea196d 100644 --- a/Libraries/Core/Models/Spt/Config/RagfairConfig.cs +++ b/Libraries/Core/Models/Spt/Config/RagfairConfig.cs @@ -93,7 +93,7 @@ public record Sell * Settings to control how long it takes for a player offer to sell */ [JsonPropertyName("time")] - public MinMax Time + public MinMaxDouble Time { get; set; @@ -204,7 +204,7 @@ public record Dynamic [JsonPropertyName("offerItemCount")] /** How many offers should be listed */ - public MinMax OfferItemCount + public MinMaxDouble OfferItemCount { get; set; @@ -235,7 +235,7 @@ public record Dynamic } [JsonPropertyName("endTimeSeconds")] - public MinMax EndTimeSeconds + public MinMaxDouble EndTimeSeconds { get; set; @@ -251,7 +251,7 @@ public record Dynamic [JsonPropertyName("stackablePercent")] /** Size stackable items should be listed for in percent of max stack size */ - public MinMax StackablePercent + public MinMaxDouble StackablePercent { get; set; @@ -259,7 +259,7 @@ public record Dynamic [JsonPropertyName("nonStackableCount")] /** Items that cannot be stacked can have multiples sold in one offer, what range of values can be listed */ - public MinMax NonStackableCount + public MinMaxDouble NonStackableCount { get; set; @@ -267,7 +267,7 @@ public record Dynamic [JsonPropertyName("rating")] /** Range of rating offers for items being listed */ - public MinMax Rating + public MinMaxDouble Rating { get; set; @@ -348,21 +348,21 @@ public record Dynamic public record PriceRanges { [JsonPropertyName("default")] - public MinMax Default + public MinMaxDouble Default { get; set; } [JsonPropertyName("preset")] - public MinMax Preset + public MinMaxDouble Preset { get; set; } [JsonPropertyName("pack")] - public MinMax Pack + public MinMaxDouble Pack { get; set; @@ -541,14 +541,14 @@ public record Condition } [JsonPropertyName("current")] - public MinMax Current + public MinMaxDouble Current { get; set; } [JsonPropertyName("max")] - public MinMax Max + public MinMaxDouble Max { get; set; diff --git a/Libraries/Core/Models/Spt/Config/RepairConfig.cs b/Libraries/Core/Models/Spt/Config/RepairConfig.cs index c4f9fdb0..704b206f 100644 --- a/Libraries/Core/Models/Spt/Config/RepairConfig.cs +++ b/Libraries/Core/Models/Spt/Config/RepairConfig.cs @@ -219,7 +219,7 @@ public record BonusSettings public record BonusValues { [JsonPropertyName("valuesMinMax")] - public MinMax ValuesMinMax + public MinMaxDouble ValuesMinMax { get; set; @@ -229,7 +229,7 @@ public record BonusValues * What dura is buff active between (min max of current max) */ [JsonPropertyName("activeDurabilityPercentMinMax")] - public MinMax ActiveDurabilityPercentMinMax + public MinMaxDouble ActiveDurabilityPercentMinMax { get; set; diff --git a/Libraries/Core/Models/Spt/Config/ScavCaseConfig.cs b/Libraries/Core/Models/Spt/Config/ScavCaseConfig.cs index 121880ec..a3bb1965 100644 --- a/Libraries/Core/Models/Spt/Config/ScavCaseConfig.cs +++ b/Libraries/Core/Models/Spt/Config/ScavCaseConfig.cs @@ -13,7 +13,7 @@ public record ScavCaseConfig : BaseConfig } = "spt-scavcase"; [JsonPropertyName("rewardItemValueRangeRub")] - public Dictionary RewardItemValueRangeRub + public Dictionary RewardItemValueRangeRub { get; set; @@ -110,21 +110,21 @@ public record MoneyRewards public record MoneyLevels { [JsonPropertyName("common")] - public MinMax Common + public MinMaxDouble Common { get; set; } [JsonPropertyName("rare")] - public MinMax Rare + public MinMaxDouble Rare { get; set; } [JsonPropertyName("superrare")] - public MinMax SuperRare + public MinMaxDouble SuperRare { get; set; @@ -148,7 +148,7 @@ public record AmmoRewards } [JsonPropertyName("ammoRewardValueRangeRub")] - public Dictionary AmmoRewardValueRangeRub + public Dictionary AmmoRewardValueRangeRub { get; set; diff --git a/Libraries/Core/Models/Spt/Config/TraderConfig.cs b/Libraries/Core/Models/Spt/Config/TraderConfig.cs index 3429bda3..ad2fad45 100644 --- a/Libraries/Core/Models/Spt/Config/TraderConfig.cs +++ b/Libraries/Core/Models/Spt/Config/TraderConfig.cs @@ -86,7 +86,7 @@ public record UpdateTime * Seconds between trader resets */ [JsonPropertyName("seconds")] - public MinMax Seconds + public MinMaxDouble Seconds { get; set; @@ -124,14 +124,14 @@ public record FenceConfig } [JsonPropertyName("weaponPresetMinMax")] - public MinMax WeaponPresetMinMax + public MinMaxDouble WeaponPresetMinMax { get; set; } [JsonPropertyName("equipmentPresetMinMax")] - public MinMax EquipmentPresetMinMax + public MinMaxDouble EquipmentPresetMinMax { get; set; @@ -179,7 +179,7 @@ public record FenceConfig * Key: item tpl */ [JsonPropertyName("itemStackSizeOverrideMinMax")] - public Dictionary ItemStackSizeOverrideMinMax + public Dictionary ItemStackSizeOverrideMinMax { get; set; @@ -294,14 +294,14 @@ public record FenceConfig public record ItemDurabilityCurrentMax { [JsonPropertyName("current")] - public MinMax Current + public MinMaxDouble Current { get; set; } [JsonPropertyName("max")] - public MinMax Max + public MinMaxDouble Max { get; set; @@ -363,14 +363,14 @@ public record DiscountOptions } [JsonPropertyName("weaponPresetMinMax")] - public MinMax WeaponPresetMinMax + public MinMaxDouble WeaponPresetMinMax { get; set; } [JsonPropertyName("equipmentPresetMinMax")] - public MinMax EquipmentPresetMinMax + public MinMaxDouble EquipmentPresetMinMax { get; set; diff --git a/Libraries/Core/Models/Spt/Config/WeatherConfig.cs b/Libraries/Core/Models/Spt/Config/WeatherConfig.cs index 42370ae4..6ff11611 100644 --- a/Libraries/Core/Models/Spt/Config/WeatherConfig.cs +++ b/Libraries/Core/Models/Spt/Config/WeatherConfig.cs @@ -146,7 +146,7 @@ public record SeasonalValues } [JsonPropertyName("windGustiness")] - public MinMax? WindGustiness + public MinMaxDouble? WindGustiness { get; set; @@ -160,7 +160,7 @@ public record SeasonalValues } [JsonPropertyName("rainIntensity")] - public MinMax? RainIntensity + public MinMaxDouble? RainIntensity { get; set; @@ -181,7 +181,7 @@ public record SeasonalValues } [JsonPropertyName("pressure")] - public MinMax? Pressure + public MinMaxDouble? Pressure { get; set; @@ -191,14 +191,14 @@ public record SeasonalValues public record TempDayNight { [JsonPropertyName("day")] - public MinMax? Day + public MinMaxDouble? Day { get; set; } [JsonPropertyName("night")] - public MinMax? Night + public MinMaxDouble? Night { get; set; diff --git a/Libraries/Core/Models/Spt/Services/LootRequest.cs b/Libraries/Core/Models/Spt/Services/LootRequest.cs index 4c43715f..a5bf0ef4 100644 --- a/Libraries/Core/Models/Spt/Services/LootRequest.cs +++ b/Libraries/Core/Models/Spt/Services/LootRequest.cs @@ -10,7 +10,7 @@ public record LootRequest /// Count of weapons to generate /// [JsonPropertyName("weaponPresetCount")] - public MinMax? WeaponPresetCount + public MinMaxInt? WeaponPresetCount { get; set; @@ -20,7 +20,7 @@ public record LootRequest /// Count of armor to generate /// [JsonPropertyName("armorPresetCount")] - public MinMax? ArmorPresetCount + public MinMaxInt? ArmorPresetCount { get; set; @@ -30,7 +30,7 @@ public record LootRequest /// Count of items to generate /// [JsonPropertyName("itemCount")] - public MinMax? ItemCount + public MinMaxInt? ItemCount { get; set; @@ -40,7 +40,7 @@ public record LootRequest /// Count of sealed weapon crates to generate /// [JsonPropertyName("weaponCrateCount")] - public MinMax? WeaponCrateCount + public MinMaxInt? WeaponCrateCount { get; set; @@ -70,14 +70,14 @@ public record LootRequest /// key: item base type: value: max count /// [JsonPropertyName("itemLimits")] - public Dictionary? ItemLimits + public Dictionary? ItemLimits { get; set; } [JsonPropertyName("itemStackLimits")] - public Dictionary? ItemStackLimits + public Dictionary? ItemStackLimits { get; set; @@ -127,7 +127,7 @@ public record LootRequest /// Item tpls + count of items to force include /// [JsonPropertyName("forcedLoot")] - public Dictionary? ForcedLoot + public Dictionary? ForcedLoot { get; set; diff --git a/Libraries/Core/Services/AirdropService.cs b/Libraries/Core/Services/AirdropService.cs index eb1776a7..483226c9 100644 --- a/Libraries/Core/Services/AirdropService.cs +++ b/Libraries/Core/Services/AirdropService.cs @@ -49,7 +49,7 @@ public class AirdropService( /// List of LootItem objects public GetAirdropLootResponse GenerateAirdropLoot(SptAirdropTypeEnum? forcedAirdropType = null) { - var airdropType = forcedAirdropType != null ? forcedAirdropType : ChooseAirdropType(); + var airdropType = forcedAirdropType ?? ChooseAirdropType(); if (_logger.IsLogEnabled(LogLevel.Debug)) { _logger.Debug($"Chose: {airdropType} for airdrop loot"); @@ -64,12 +64,12 @@ public class AirdropService( : _lootGenerator.CreateRandomLoot(airdropConfig); // Create airdrop crate and add to result in first spot - var airdropCrateItem = GetAirdropCrateItem((SptAirdropTypeEnum) airdropType); + var airdropCrateItem = GetAirdropCrateItem(airdropType); // Add crate to front of list crateLoot.Insert(0, airdropCrateItem); - // Reparent loot items to crate we added above + // Re-parent loot items to crate we added above foreach (var item in crateLoot) { if (item.Id == airdropCrateItem.Id) @@ -78,7 +78,7 @@ public class AirdropService( continue; } - // no parentId = root item, make item have create as parent + // no parentId = root item, make item have crate as parent if (item.ParentId is null) { item.ParentId = airdropCrateItem.Id; @@ -103,7 +103,7 @@ public class AirdropService( var airdropContainer = new Item { Id = _hashUtil.Generate(), - Template = "", // picked later + Template = string.Empty, // Picked later Upd = new Upd { SpawnedInSession = true, diff --git a/Libraries/Core/Services/BotLootCacheService.cs b/Libraries/Core/Services/BotLootCacheService.cs index 65e19d8e..60efad75 100644 --- a/Libraries/Core/Services/BotLootCacheService.cs +++ b/Libraries/Core/Services/BotLootCacheService.cs @@ -47,7 +47,7 @@ public class BotLootCacheService( bool isPmc, string lootType, BotType botJsonTemplate, - MinMax? itemPriceMinMax = null) + MinMaxDouble? itemPriceMinMax = null) { lock (_lock) { diff --git a/Libraries/Core/Services/FenceService.cs b/Libraries/Core/Services/FenceService.cs index b2d65df0..4d83720e 100644 --- a/Libraries/Core/Services/FenceService.cs +++ b/Libraries/Core/Services/FenceService.cs @@ -1336,7 +1336,7 @@ public class FenceService( */ protected int GetSingleItemStackCount(TemplateItem itemDbDetails) { - MinMax? overrideValues; + MinMaxDouble? overrideValues; if (itemHelper.IsOfBaseclass(itemDbDetails.Id, BaseClasses.AMMO)) { overrideValues = traderConfig.Fence.ItemStackSizeOverrideMinMax[itemDbDetails.Parent]; diff --git a/Libraries/Core/Services/RagfairPriceService.cs b/Libraries/Core/Services/RagfairPriceService.cs index 9483ec93..3275e36c 100644 --- a/Libraries/Core/Services/RagfairPriceService.cs +++ b/Libraries/Core/Services/RagfairPriceService.cs @@ -356,7 +356,7 @@ public class RagfairPriceService( /// Offer is a preset /// Offer is a pack /// MinMax values - protected MinMax GetOfferTypeRangeValues(bool isPreset, bool isPack) + protected MinMaxDouble GetOfferTypeRangeValues(bool isPreset, bool isPack) { // Use different min/max values if the item is a preset or pack var priceRanges = _ragfairConfig.Dynamic.PriceRanges; @@ -406,7 +406,7 @@ public class RagfairPriceService( /// price to alter /// min and max to adjust price by /// multiplied price - protected double RandomiseOfferPrice(double existingPrice, MinMax rangeValues) + protected double RandomiseOfferPrice(double existingPrice, MinMaxDouble rangeValues) { // Multiply by 100 to get 2 decimal places of precision var multiplier = _randomUtil.GetBiasedRandomNumber(rangeValues.Min.Value * 100, rangeValues.Max.Value * 100, 2, 2);