diff --git a/Core/Models/Spt/Config/QuestConfig.cs b/Core/Models/Spt/Config/QuestConfig.cs index 7994515c..addc2ce4 100644 --- a/Core/Models/Spt/Config/QuestConfig.cs +++ b/Core/Models/Spt/Config/QuestConfig.cs @@ -12,254 +12,255 @@ public class QuestConfig : BaseConfig // Hours to get/redeem items from quest mail keyed by profile type [JsonPropertyName("mailRedeemTimeHours")] - public Dictionary MailRedeemTimeHours { get; set; } + public Dictionary? MailRedeemTimeHours { get; set; } [JsonPropertyName("questTemplateIds")] - public PlayerTypeQuestIds QuestTemplateIds { get; set; } + public PlayerTypeQuestIds? QuestTemplateIds { get; set; } /** Show non-seasonal quests be shown to player */ [JsonPropertyName("showNonSeasonalEventQuests")] - public bool ShowNonSeasonalEventQuests { get; set; } + public bool? ShowNonSeasonalEventQuests { get; set; } [JsonPropertyName("eventQuests")] - public Dictionary EventQuests { get; set; } + public Dictionary? EventQuests { get; set; } [JsonPropertyName("repeatableQuests")] - public List RepeatableQuests { get; set; } + public List? RepeatableQuests { get; set; } [JsonPropertyName("locationIdMap")] - public Dictionary LocationIdMap { get; set; } + public Dictionary? LocationIdMap { get; set; } [JsonPropertyName("bearOnlyQuests")] - public List BearOnlyQuests { get; set; } + public List? BearOnlyQuests { get; set; } [JsonPropertyName("usecOnlyQuests")] - public List UsecOnlyQuests { get; set; } + public List? UsecOnlyQuests { get; set; } /** Quests that the keyed game version do not see/access */ [JsonPropertyName("profileBlacklist")] - public Dictionary> ProfileBlacklist { get; set; } + public Dictionary>? ProfileBlacklist { get; set; } /** key=questid, gameversions that can see/access quest */ [JsonPropertyName("profileWhitelist")] - public Dictionary> ProfileWhitelist { get; set; } + public Dictionary>? ProfileWhitelist { get; set; } } public class PlayerTypeQuestIds { [JsonPropertyName("pmc")] - public QuestTypeIds Pmc { get; set; } + public QuestTypeIds? Pmc { get; set; } [JsonPropertyName("scav")] - public QuestTypeIds Scav { get; set; } + public QuestTypeIds? Scav { get; set; } } public class QuestTypeIds { [JsonPropertyName("elimination")] - public string Elimination { get; set; } + public string? Elimination { get; set; } [JsonPropertyName("completion")] - public string Completion { get; set; } + public string? Completion { get; set; } [JsonPropertyName("exploration")] - public string Exploration { get; set; } + public string? Exploration { get; set; } [JsonPropertyName("pickup")] - public string Pickup { get; set; } + public string? Pickup { get; set; } } public class EventQuestData { [JsonPropertyName("name")] - public string Name { get; set; } + public string? Name { get; set; } [JsonPropertyName("season")] - public SeasonalEventType Season { get; set; } + public SeasonalEventType? Season { get; set; } [JsonPropertyName("startTimestamp")] - public long StartTimestamp { get; set; } + public long? StartTimestamp { get; set; } [JsonPropertyName("endTimestamp")] [JsonConverter(typeof(StringToNumberFactoryConverter))] public long? EndTimestamp { get; set; } [JsonPropertyName("yearly")] - public bool Yearly { get; set; } + public bool? Yearly { get; set; } } public class RepeatableQuestConfig { [JsonPropertyName("id")] - public string Id { get; set; } + public string? Id { get; set; } [JsonPropertyName("name")] - public string Name { get; set; } + public string? Name { get; set; } [JsonPropertyName("side")] - public string Side { get; set; } + public string? Side { get; set; } [JsonPropertyName("types")] - public List Types { get; set; } + public List? Types { get; set; } [JsonPropertyName("resetTime")] - public long ResetTime { get; set; } + public long? ResetTime { get; set; } [JsonPropertyName("numQuests")] - public int NumQuests { get; set; } + public int? NumQuests { get; set; } [JsonPropertyName("minPlayerLevel")] - public int MinPlayerLevel { get; set; } + public int? MinPlayerLevel { get; set; } [JsonPropertyName("rewardScaling")] - public RewardScaling RewardScaling { get; set; } + public RewardScaling? RewardScaling { get; set; } [JsonPropertyName("locations")] - public Dictionary> Locations { get; set; } + public Dictionary>? Locations { get; set; } [JsonPropertyName("traderWhitelist")] - public List TraderWhitelist { get; set; } + public List? TraderWhitelist { get; set; } [JsonPropertyName("questConfig")] - public RepeatableQuestTypesConfig QuestConfig { get; set; } + public RepeatableQuestTypesConfig? QuestConfig { get; set; } /** Item base types to block when generating rewards */ [JsonPropertyName("rewardBaseTypeBlacklist")] - public List RewardBaseTypeBlacklist { get; set; } + public List? RewardBaseTypeBlacklist { get; set; } /** Item tplIds to ignore when generating rewards */ [JsonPropertyName("rewardBlacklist")] - public List RewardBlacklist { get; set; } + public List? RewardBlacklist { get; set; } [JsonPropertyName("rewardAmmoStackMinSize")] - public int RewardAmmoStackMinSize { get; set; } + public int? RewardAmmoStackMinSize { get; set; } [JsonPropertyName("freeChangesAvailable")] - public int FreeChangesAvailable { get; set; } + public int? FreeChangesAvailable { get; set; } [JsonPropertyName("freeChanges")] - public int FreeChanges { get; set; } + public int? FreeChanges { get; set; } [JsonPropertyName("keepDailyQuestTypeOnReplacement")] - public bool KeepDailyQuestTypeOnReplacement { get; set; } + public bool? KeepDailyQuestTypeOnReplacement { get; set; } } public class RewardScaling { [JsonPropertyName("levels")] - public List Levels { get; set; } + public List? Levels { get; set; } [JsonPropertyName("experience")] - public List Experience { get; set; } + public List? Experience { get; set; } [JsonPropertyName("roubles")] - public List Roubles { get; set; } + public List? Roubles { get; set; } [JsonPropertyName("gpCoins")] - public List GpCoins { get; set; } + public List? GpCoins { get; set; } [JsonPropertyName("items")] - public List Items { get; set; } + public List? Items { get; set; } [JsonPropertyName("reputation")] - public List Reputation { get; set; } + public List? Reputation { get; set; } [JsonPropertyName("rewardSpread")] - public double RewardSpread { get; set; } + public double? RewardSpread { get; set; } [JsonPropertyName("skillRewardChance")] - public List SkillRewardChance { get; set; } + public List? SkillRewardChance { get; set; } [JsonPropertyName("skillPointReward")] - public List SkillPointReward { get; set; } + public List? SkillPointReward { get; set; } } public class TraderWhitelist { [JsonPropertyName("name")] - public string Name { get; set; } + public string? Name { get; set; } + [JsonPropertyName("traderId")] - public string TraderId { get; set; } + public string? TraderId { get; set; } [JsonPropertyName("questTypes")] - public List QuestTypes { get; set; } + public List? QuestTypes { get; set; } [JsonPropertyName("rewardBaseWhitelist")] - public List RewardBaseWhitelist { get; set; } + public List? RewardBaseWhitelist { get; set; } [JsonPropertyName("rewardCanBeWeapon")] - public bool RewardCanBeWeapon { get; set; } + public bool? RewardCanBeWeapon { get; set; } [JsonPropertyName("weaponRewardChancePercent")] - public double WeaponRewardChancePercent { get; set; } + public double? WeaponRewardChancePercent { get; set; } } public class RepeatableQuestTypesConfig { [JsonPropertyName("Exploration")] - public Exploration Exploration { get; set; } + public Exploration? Exploration { get; set; } [JsonPropertyName("Completion")] - public Completion Completion { get; set; } + public Completion? Completion { get; set; } [JsonPropertyName("Pickup")] - public Pickup Pickup { get; set; } + public Pickup? Pickup { get; set; } [JsonPropertyName("Elimination")] - public List Elimination { get; set; } + public List? Elimination { get; set; } } public class Exploration : BaseQuestConfig { [JsonPropertyName("maxExtracts")] - public int MaximumExtracts { get; set; } + public int? MaximumExtracts { get; set; } [JsonPropertyName("maxExtractsWithSpecificExit")] - public int MaximumExtractsWithSpecificExit { get; set; } + public int? MaximumExtractsWithSpecificExit { get; set; } [JsonPropertyName("specificExits")] - public SpecificExits SpecificExits { get; set; } + public SpecificExits? SpecificExits { get; set; } } public class SpecificExits { [JsonPropertyName("probability")] - public double Probability { get; set; } + public double? Probability { get; set; } [JsonPropertyName("passageRequirementWhitelist")] - public List PassageRequirementWhitelist { get; set; } + public List? PassageRequirementWhitelist { get; set; } } public class Completion : BaseQuestConfig { [JsonPropertyName("minRequestedAmount")] - public int MinimumRequestedAmount { get; set; } + public int? MinimumRequestedAmount { get; set; } [JsonPropertyName("maxRequestedAmount")] - public int MaximumRequestedAmount { get; set; } + public int? MaximumRequestedAmount { get; set; } [JsonPropertyName("uniqueItemCount")] - public int UniqueItemCount { get; set; } + public int? UniqueItemCount { get; set; } [JsonPropertyName("minRequestedBulletAmount")] - public int MinimumRequestedBulletAmount { get; set; } + public int? MinimumRequestedBulletAmount { get; set; } [JsonPropertyName("maxRequestedBulletAmount")] - public int MaximumRequestedBulletAmount { get; set; } + public int? MaximumRequestedBulletAmount { get; set; } [JsonPropertyName("useWhitelist")] - public bool UseWhitelist { get; set; } + public bool? UseWhitelist { get; set; } [JsonPropertyName("useBlacklist")] - public bool UseBlacklist { get; set; } + public bool? UseBlacklist { get; set; } } public class Pickup : BaseQuestConfig { [JsonPropertyName("ItemTypeToFetchWithMaxCount")] - public List ItemTypeToFetchWithMaxCount { get; set; } + public List? ItemTypeToFetchWithMaxCount { get; set; } - public List ItemTypesToFetch { get; set; } + public List? ItemTypesToFetch { get; set; } [JsonPropertyName("maxItemFetchCount")] public int? MaxItemFetchCount { get; set; } @@ -268,116 +269,116 @@ public class Pickup : BaseQuestConfig public class PickupTypeWithMaxCount { [JsonPropertyName("itemType")] - public string ItemType { get; set; } + public string? ItemType { get; set; } [JsonPropertyName("maxPickupCount")] - public int MaximumPickupCount { get; set; } + public int? MaximumPickupCount { get; set; } [JsonPropertyName("minPickupCount")] - public int MinimumPickupCount { get; set; } + public int? MinimumPickupCount { get; set; } } public class EliminationConfig : BaseQuestConfig { [JsonPropertyName("levelRange")] - public MinMax LevelRange { get; set; } + public MinMax? LevelRange { get; set; } [JsonPropertyName("targets")] - public List Targets { get; set; } + public List? Targets { get; set; } [JsonPropertyName("bodyPartProb")] - public double BodyPartProbability { get; set; } + public double? BodyPartProbability { get; set; } [JsonPropertyName("bodyParts")] - public List BodyParts { get; set; } + public List? BodyParts { get; set; } [JsonPropertyName("specificLocationProb")] - public double SpecificLocationProbability { get; set; } + public double? SpecificLocationProbability { get; set; } [JsonPropertyName("distLocationBlacklist")] - public List DistLocationBlacklist { get; set; } + public List? DistLocationBlacklist { get; set; } [JsonPropertyName("distProb")] - public double DistanceProbability { get; set; } + public double? DistanceProbability { get; set; } [JsonPropertyName("maxDist")] - public double MaxDistance { get; set; } + public double? MaxDistance { get; set; } [JsonPropertyName("minDist")] - public double MinDistance { get; set; } + public double? MinDistance { get; set; } [JsonPropertyName("maxKills")] - public int MaxKills { get; set; } + public int? MaxKills { get; set; } [JsonPropertyName("minKills")] - public int MinKills { get; set; } + public int? MinKills { get; set; } [JsonPropertyName("minBossKills")] - public int MinBossKills { get; set; } + public int? MinBossKills { get; set; } [JsonPropertyName("maxBossKills")] - public int MaxBossKills { get; set; } + public int? MaxBossKills { get; set; } [JsonPropertyName("minPmcKills")] - public int MinPmcKills { get; set; } + public int? MinPmcKills { get; set; } [JsonPropertyName("maxPmcKills")] - public int MaxPmcKills { get; set; } + public int? MaxPmcKills { get; set; } [JsonPropertyName("weaponCategoryRequirementProb")] - public double WeaponCategoryRequirementProbability { get; set; } + public double? WeaponCategoryRequirementProbability { get; set; } [JsonPropertyName("weaponCategoryRequirements")] - public List WeaponCategoryRequirements { get; set; } + public List? WeaponCategoryRequirements { get; set; } [JsonPropertyName("weaponRequirementProb")] - public double WeaponRequirementProbability { get; set; } + public double? WeaponRequirementProbability { get; set; } [JsonPropertyName("weaponRequirements")] - public List WeaponRequirements { get; set; } + public List? WeaponRequirements { get; set; } } public class BaseQuestConfig { [JsonPropertyName("possibleSkillRewards")] - public List PossibleSkillRewards { get; set; } + public List? PossibleSkillRewards { get; set; } } public class Target : ProbabilityObject { [JsonPropertyName("data")] - public BossInfo Data { get; set; } + public BossInfo? Data { get; set; } } public class BossInfo { [JsonPropertyName("isBoss")] - public bool IsBoss { get; set; } + public bool? IsBoss { get; set; } [JsonPropertyName("isPmc")] - public bool IsPmc { get; set; } + public bool? IsPmc { get; set; } } public class BodyPart : ProbabilityObject { [JsonPropertyName("data")] - public string[] Data { get; set; } + public List? Data { get; set; } } public class WeaponRequirement : ProbabilityObject { [JsonPropertyName("data")] - public string[] Data { get; set; } + public List? Data { get; set; } } public class ProbabilityObject { [JsonPropertyName("key")] - public string Key { get; set; } + public string? Key { get; set; } [JsonPropertyName("relativeProbability")] - public double RelativeProbability { get; set; } + public double? RelativeProbability { get; set; } [JsonPropertyName("data")] - public object Data { get; set; } + public object? Data { get; set; } } diff --git a/Core/Services/BotLootCacheService.cs b/Core/Services/BotLootCacheService.cs index 5eb35955..e88fe152 100644 --- a/Core/Services/BotLootCacheService.cs +++ b/Core/Services/BotLootCacheService.cs @@ -236,8 +236,8 @@ public class BotLootCacheService // Assign whitelisted special items to bot if any exist var specialLootItems = - botJsonTemplate.BotGeneration.Items.SpecialItems.Whitelist.Count > 0 - ? botJsonTemplate.BotGeneration.Items.SpecialItems.Whitelist + botJsonTemplate.BotGeneration?.Items?.SpecialItems?.Whitelist?.Count > 0 + ? botJsonTemplate.BotGeneration?.Items?.SpecialItems?.Whitelist : new Dictionary(); // no whitelist, find and assign from combined item pool @@ -256,8 +256,8 @@ public class BotLootCacheService // Assign whitelisted healing items to bot if any exist var healingItems = - botJsonTemplate.BotGeneration.Items.Healing.Whitelist.Count > 0 - ? botJsonTemplate.BotGeneration.Items.Healing.Whitelist + botJsonTemplate.BotGeneration?.Items?.Healing?.Whitelist?.Count > 0 + ? botJsonTemplate.BotGeneration?.Items?.Healing?.Whitelist : new Dictionary(); // No whitelist, find and assign from combined item pool @@ -279,7 +279,7 @@ public class BotLootCacheService } // Assign whitelisted drugs to bot if any exist - var drugItems = botJsonTemplate.BotGeneration.Items.Drugs.Whitelist ?? new Dictionary(); + var drugItems = botJsonTemplate.BotGeneration?.Items?.Drugs?.Whitelist ?? new Dictionary(); // no drugs whitelist, find and assign from combined item pool if (!drugItems.Any()) { @@ -294,7 +294,7 @@ public class BotLootCacheService } // Assign whitelisted food to bot if any exist - var foodItems = botJsonTemplate.BotGeneration.Items.Food.Whitelist ?? new Dictionary(); + var foodItems = botJsonTemplate.BotGeneration?.Items?.Food?.Whitelist ?? new Dictionary(); // No food whitelist, find and assign from combined item pool if (!foodItems.Any()) { @@ -309,7 +309,7 @@ public class BotLootCacheService } // Assign whitelisted drink to bot if any exist - var drinkItems = botJsonTemplate.BotGeneration.Items.Food.Whitelist ?? new Dictionary(); + var drinkItems = botJsonTemplate.BotGeneration?.Items?.Food?.Whitelist ?? new Dictionary(); // No drink whitelist, find and assign from combined item pool if (!drinkItems.Any()) { @@ -324,7 +324,7 @@ public class BotLootCacheService } // Assign whitelisted currency to bot if any exist - var currencyItems = botJsonTemplate.BotGeneration.Items.Currency.Whitelist ?? new Dictionary(); + var currencyItems = botJsonTemplate.BotGeneration?.Items?.Currency?.Whitelist ?? new Dictionary(); // No currency whitelist, find and assign from combined item pool if (!currencyItems.Any()) { @@ -339,7 +339,7 @@ public class BotLootCacheService } // Assign whitelisted stims to bot if any exist - var stimItems = botJsonTemplate.BotGeneration.Items.Stims.Whitelist ?? new Dictionary(); + var stimItems = botJsonTemplate.BotGeneration?.Items?.Stims?.Whitelist ?? new Dictionary(); // No whitelist, find and assign from combined item pool if (!stimItems.Any()) { @@ -354,7 +354,7 @@ public class BotLootCacheService } // Assign whitelisted grenades to bot if any exist - var grenadeItems = botJsonTemplate.BotGeneration.Items.Grenades.Whitelist ?? new Dictionary(); + var grenadeItems = botJsonTemplate.BotGeneration?.Items?.Grenades?.Whitelist ?? new Dictionary(); // no whitelist, find and assign from combined item pool if (!grenadeItems.Any()) { diff --git a/Core/Services/MailSendService.cs b/Core/Services/MailSendService.cs index 3ee5033d..cf4b6360 100644 --- a/Core/Services/MailSendService.cs +++ b/Core/Services/MailSendService.cs @@ -130,8 +130,8 @@ public class MailSendService string messageLocaleId, List? items, long? maxStorageTimeSeconds, - SystemData? systemData, - MessageContentRagfair? ragfair + SystemData? systemData = null, + MessageContentRagfair? ragfair = null ) { if (trader is null)