Updated properties to not be nullable + various fixes

This commit is contained in:
Chomp
2025-07-16 14:57:24 +01:00
parent dfe39a0395
commit 42d2e3f7ea
7 changed files with 39 additions and 41 deletions
@@ -275,7 +275,7 @@ public class RagfairController(
var playerHasFleaUnlocked =
pmcProfile.Info.Level
>= databaseService.GetGlobals().Configuration.RagFair.MinUserLevel;
List<RagfairOffer> offerPool = [];
List<RagfairOffer> offerPool;
if (IsLinkedSearch(searchRequest) || IsRequiredSearch(searchRequest))
{
offerPool = offers;
@@ -847,9 +847,6 @@ public class HideoutHelper(
filterDrainRate
);
// Production hasn't completed
var pointsConsumed = 0D;
// Check progress against the productions craft time (don't use base time as it doesn't include any time bonuses profile has)
if (production.Progress > production.ProductionTime)
// Craft is complete nothing to do
@@ -866,10 +863,11 @@ public class HideoutHelper(
continue;
}
var waterFilterItemInSlot = waterFilterArea.Slots[i].Items[0];
var waterFilterItemInSlot = waterFilterArea.Slots[i].Items.FirstOrDefault();
// How many units of filter are left
var resourceValue = waterFilterItemInSlot.Upd?.Resource?.Value;
var resourceValue = waterFilterItemInSlot?.Upd?.Resource?.Value;
double pointsConsumed;
if (resourceValue is null)
{
// Missing, is new filter, add default and subtract usage
@@ -911,7 +909,7 @@ public class HideoutHelper(
logger.Debug($"Water filter has: {resourceValue} units left in slot {i + 1}");
}
break; // Break here to avoid iterating other filters now w're done
break; // Break here to avoid iterating other filters now we're done
}
// Filter ran out / used up
@@ -12,13 +12,13 @@ public record Trader
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("assort")]
public TraderAssort? Assort { get; set; }
public TraderAssort Assort { get; set; }
[JsonPropertyName("base")]
public TraderBase? Base { get; set; }
public TraderBase Base { get; set; }
[JsonPropertyName("dialogue")]
public Dictionary<string, List<string>?>? Dialogue { get; set; }
public Dictionary<string, List<string>?> Dialogue { get; set; }
[JsonPropertyName("questassort")]
public Dictionary<string, Dictionary<string, string>>? QuestAssort { get; set; }
@@ -257,13 +257,13 @@ public record TraderAssort
public double? NextResupply { get; set; }
[JsonPropertyName("items")]
public List<Item>? Items { get; set; }
public List<Item> Items { get; set; }
[JsonPropertyName("barter_scheme")]
public Dictionary<MongoId, List<List<BarterScheme>>>? BarterScheme { get; set; }
public Dictionary<MongoId, List<List<BarterScheme>>> BarterScheme { get; set; }
[JsonPropertyName("loyal_level_items")]
public Dictionary<MongoId, int>? LoyalLevelItems { get; set; }
public Dictionary<MongoId, int> LoyalLevelItems { get; set; }
}
public record BarterScheme
@@ -9,20 +9,20 @@ public record Hideout
public Dictionary<string, object>? ExtensionData { get; set; }
[JsonPropertyName("areas")]
public List<HideoutArea>? Areas { get; set; }
public List<HideoutArea> Areas { get; set; }
[JsonPropertyName("customAreas")]
public List<HideoutArea>? CustomAreas { get; set; }
[JsonPropertyName("customisation")]
public HideoutCustomisation? Customisation { get; set; }
public HideoutCustomisation Customisation { get; set; }
[JsonPropertyName("production")]
public HideoutProductionData? Production { get; set; }
public HideoutProductionData Production { get; set; }
[JsonPropertyName("settings")]
public HideoutSettingsBase? Settings { get; set; }
public HideoutSettingsBase Settings { get; set; }
[JsonPropertyName("qte")]
public List<QteData>? Qte { get; set; }
public List<QteData> Qte { get; set; }
}
@@ -10,23 +10,23 @@ public record DatabaseTables
[JsonExtensionData]
public Dictionary<string, object>? ExtensionData { get; set; }
public Bots.Bots? Bots { get; set; }
public Bots.Bots Bots { get; set; }
public Hideout.Hideout? Hideout { get; set; }
public Hideout.Hideout Hideout { get; set; }
public LocaleBase? Locales { get; set; }
public LocaleBase Locales { get; set; }
public Locations? Locations { get; set; }
public Locations Locations { get; set; }
public Match? Match { get; set; }
public Match Match { get; set; }
public Templates.Templates? Templates { get; set; }
public Templates.Templates Templates { get; set; }
public Dictionary<MongoId, Trader> Traders { get; set; }
public Globals? Globals { get; set; }
public Globals Globals { get; set; }
public ServerBase? Server { get; set; }
public ServerBase Server { get; set; }
public SettingsBase? Settings { get; set; }
public SettingsBase Settings { get; set; }
}
@@ -61,46 +61,46 @@ public record Locations
private Dictionary<string, Eft.Common.Location>? _locationDictionaryCache;
[JsonPropertyName("bigmap")]
public Eft.Common.Location? Bigmap { get; set; }
public Eft.Common.Location Bigmap { get; set; }
[JsonPropertyName("develop")]
public Eft.Common.Location? Develop { get; set; }
[JsonPropertyName("factory4_day")]
public Eft.Common.Location? Factory4Day { get; set; }
public Eft.Common.Location Factory4Day { get; set; }
[JsonPropertyName("factory4_night")]
public Eft.Common.Location? Factory4Night { get; set; }
public Eft.Common.Location Factory4Night { get; set; }
[JsonPropertyName("hideout")]
public Eft.Common.Location? Hideout { get; set; }
[JsonPropertyName("interchange")]
public Eft.Common.Location? Interchange { get; set; }
public Eft.Common.Location Interchange { get; set; }
[JsonPropertyName("laboratory")]
public Eft.Common.Location? Laboratory { get; set; }
public Eft.Common.Location Laboratory { get; set; }
[JsonPropertyName("lighthouse")]
public Eft.Common.Location? Lighthouse { get; set; }
public Eft.Common.Location Lighthouse { get; set; }
[JsonPropertyName("privatearea")]
public Eft.Common.Location? PrivateArea { get; set; }
[JsonPropertyName("rezervbase")]
public Eft.Common.Location? RezervBase { get; set; }
public Eft.Common.Location RezervBase { get; set; }
[JsonPropertyName("shoreline")]
public Eft.Common.Location? Shoreline { get; set; }
public Eft.Common.Location Shoreline { get; set; }
[JsonPropertyName("suburbs")]
public Eft.Common.Location? Suburbs { get; set; }
[JsonPropertyName("tarkovstreets")]
public Eft.Common.Location? TarkovStreets { get; set; }
public Eft.Common.Location TarkovStreets { get; set; }
[JsonPropertyName("labyrinth")]
public Eft.Common.Location? Labyrinth { get; set; }
public Eft.Common.Location Labyrinth { get; set; }
[JsonPropertyName("terminal")]
public Eft.Common.Location? Terminal { get; set; }
@@ -109,13 +109,13 @@ public record Locations
public Eft.Common.Location? Town { get; set; }
[JsonPropertyName("woods")]
public Eft.Common.Location? Woods { get; set; }
public Eft.Common.Location Woods { get; set; }
[JsonPropertyName("sandbox")]
public Eft.Common.Location? Sandbox { get; set; }
public Eft.Common.Location Sandbox { get; set; }
[JsonPropertyName("sandbox_high")]
public Eft.Common.Location? SandboxHigh { get; set; }
public Eft.Common.Location SandboxHigh { get; set; }
/// <summary>
/// Holds a mapping of the linkages between locations on the UI
@@ -59,7 +59,7 @@ public class SptHttpListener(
|| compressHeader != "0";
var requestCompressed = req.Method == "PUT" || requestIsCompressed;
var body = string.Empty;
string body;
using MemoryStream bufferStream = new();
var buffer = new byte[BodyReadBufferSize];