2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-07-01 08:23:42 -04:00

Add Startup Events to Database

Now emit startup events on conneciton
Some events still to add
This commit is contained in:
2024-05-25 19:41:38 +10:00
parent 579b2b115d
commit 68eff73dbd
80 changed files with 586 additions and 229 deletions

View File

@ -13,17 +13,17 @@ public class BackpackFile : JournalBase
/// <summary>
/// List of all items carried.
/// </summary>
public ImmutableList<BackpackItem> Items { get; init; }
public IReadOnlyCollection<BackpackItem> Items { get; init; }
/// <summary>
/// List of all components carried.
/// </summary>
public ImmutableList<BackpackItem> Components { get; init; }
public IReadOnlyCollection<BackpackItem> Components { get; init; }
/// <summary>
/// List of player consumable items carried.
/// </summary>
public ImmutableList<BackpackItem> Consumables { get; init; }
public IReadOnlyCollection<BackpackItem> Consumables { get; init; }
/// <summary>
/// List of all data currently stored by the player.
/// </summary>
public ImmutableList<BackpackItem> Data { get; init; }
public IReadOnlyCollection<BackpackItem> Data { get; init; }
}

View File

@ -21,5 +21,5 @@ public class CargoFile : JournalBase
/// <summary>
/// List of full cargo details.
/// </summary>
public ImmutableList<CargoType> Inventory { get; init; }
public IReadOnlyCollection<CargoType> Inventory { get; init; }
}

View File

@ -9,9 +9,9 @@ namespace Observatory.Framework.Files.Converters;
/// The format used for materials changed from an object with a key for each material to an array of objects containing "name" and "percent".
/// Need to handle both if we're going to read historical data. This reads the old format into a class reflecting the new structure.
/// </summary>
public class MaterialCompositionConverter : JsonConverter<ImmutableList<MaterialComposition>>
public class MaterialCompositionConverter : JsonConverter<IReadOnlyCollection<MaterialComposition>>
{
public override ImmutableList<MaterialComposition> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
public override IReadOnlyCollection<MaterialComposition> Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.StartObject)
{
@ -38,13 +38,14 @@ public class MaterialCompositionConverter : JsonConverter<ImmutableList<Material
break;
}
}
return materialComposition.ToImmutableList();
return materialComposition;
}
return JsonSerializer.Deserialize<ImmutableList<MaterialComposition>>(ref reader, options)!;
return JsonSerializer.Deserialize<IReadOnlyCollection<MaterialComposition>>(ref reader, options)!;
}
public override void Write(Utf8JsonWriter writer, ImmutableList<MaterialComposition> value,
public override void Write(Utf8JsonWriter writer, IReadOnlyCollection<MaterialComposition> value,
JsonSerializerOptions options)
{
JsonSerializer.Serialize(writer, value, options);

View File

@ -9,9 +9,9 @@ namespace Observatory.Framework.Files.Converters;
/// The format used for materials changed from an object with a key for each material to an array of objects containing "name" and "percent".
/// Need to handle both if we're going to read historical data. This reads the old format into a class reflecting the new structure.
/// </summary>
public class MaterialConverter : JsonConverter<ImmutableList<Material>>
public class MaterialConverter : JsonConverter<IReadOnlyCollection<Material>>
{
public override ImmutableList<Material> Read(ref Utf8JsonReader reader, Type typeToConvert,
public override IReadOnlyCollection<Material> Read(ref Utf8JsonReader reader, Type typeToConvert,
JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.StartObject)
@ -41,13 +41,13 @@ public class MaterialConverter : JsonConverter<ImmutableList<Material>>
}
}
return materialComposition.ToImmutableList();
return materialComposition;
}
return JsonSerializer.Deserialize<ImmutableList<Material>>(ref reader, options)!;
return JsonSerializer.Deserialize<IReadOnlyCollection<Material>>(ref reader, options)!;
}
public override void Write(Utf8JsonWriter writer, ImmutableList<Material> value, JsonSerializerOptions options)
public override void Write(Utf8JsonWriter writer, IReadOnlyCollection<Material> value, JsonSerializerOptions options)
{
JsonSerializer.Serialize(writer, value, options);
}

View File

@ -1,22 +0,0 @@
using System.Text.Json;
using System.Text.Json.Serialization;
namespace Observatory.Framework.Files.Converters;
class MutableStringDoubleConverter : JsonConverter<object>
{
public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
if (reader.TokenType == JsonTokenType.String)
return reader.GetString();
return reader.GetDouble();
}
public override void Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options)
{
if (value.GetType() == typeof(string))
writer.WriteStringValue((string)value);
else
writer.WriteNumberValue((double)value);
}
}

View File

@ -0,0 +1,21 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using Observatory.Framework.Files.ParameterTypes;
namespace Observatory.Framework.Files.Converters;
class NumberOrStringConverter : JsonConverter<NumberOrString>
{
public override NumberOrString Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
return reader.TokenType == JsonTokenType.String ? new NumberOrString(reader.GetString()) : new NumberOrString(reader.GetDouble());
}
public override void Write(Utf8JsonWriter writer, NumberOrString value, JsonSerializerOptions options)
{
if (value.IsString)
writer.WriteStringValue(value.StringValue!);
else
writer.WriteNumberValue(value.DoubleValue!.Value);
}
}

View File

@ -1,21 +1,22 @@
using System.Text.Json;
using System.Text.Json.Serialization;
using Observatory.Framework.Files.Journal.Travel;
namespace Observatory.Framework.Files.Converters;
/// <summary>
/// Converting the ordered array of coordinates from the journal to a named tuple for clarity.
/// </summary>
public class StarPosConverter : JsonConverter<(double x, double y, double z)>
public class StarPosConverter : JsonConverter<StarPos>
{
public override (double x, double y, double z) Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
public override StarPos Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var values = (double[])JsonSerializer.Deserialize(ref reader, typeof(double[]));
var values = JsonSerializer.Deserialize<double[]>(ref reader, options)!;
return (x: values[0], y: values[1], z: values[2]);
return new StarPos { X = values[0], Y = values[1], Z = values[2] };
}
public override void Write(Utf8JsonWriter writer, (double x, double y, double z) value, JsonSerializerOptions options)
public override void Write(Utf8JsonWriter writer, StarPos value, JsonSerializerOptions options)
{
JsonSerializer.Serialize(writer, value, options);
}

View File

@ -13,5 +13,5 @@ public class FCMaterialsFile : JournalBase
/// <summary>
/// List of items in stock and in demand from the carrier bartender.
/// </summary>
public ImmutableList<FCMaterial> Items { get; init; }
public IReadOnlyCollection<FCMaterial> Items { get; init; }
}

View File

@ -6,7 +6,7 @@ namespace Observatory.Framework.Files.Journal.Combat;
public class Bounty : JournalBase
{
public override string Event => "Bounty";
public ImmutableList<Rewards> Rewards { get; init; }
public IReadOnlyCollection<Rewards> Rewards { get; init; }
public string PilotName { get; set; }
public string PilotName_Localised { get; set; }
public string Target { get; init; }

View File

@ -10,5 +10,5 @@ public class Died : JournalBase
public string KillerName_Localised { get; init; }
public string KillerShip { get; init; }
public string KillerRank { get; init; }
public ImmutableList<Killer> Killers { get; init; }
public IReadOnlyCollection<Killer> Killers { get; init; }
}

View File

@ -71,7 +71,7 @@ public class CodexEntry : JournalBase
/// <summary>
/// List of trais of the scanned item.
/// </summary>
public ImmutableList<string> Traits { get; init; }
public ICollection<string> Traits { get; init; }
/// <summary>
/// Value of the codex entry when sold to Universal Cartographics.
/// </summary>

View File

@ -12,7 +12,7 @@ public class MultiSellExplorationData : JournalBase
/// <summary>
/// List of all sold first discoveries.
/// </summary>
public ImmutableList<Discovered> Discovered { get; init; }
public IReadOnlyCollection<Discovered> Discovered { get; init; }
/// <summary>
/// Base value of total sold data.
/// </summary>

View File

@ -23,11 +23,11 @@ public class SAAScanComplete : JournalBase
/// <summary>
/// This property is indicated with strikethrough in Frontier's documentation and is likely unused.
/// </summary>
public ImmutableList<string> Discoverers { get; init; }
public ICollection<string> Discoverers { get; init; }
/// <summary>
/// This property is indicated with strikethrough in Frontier's documentation and is likely unused.
/// </summary>
public ImmutableList<string> Mappers { get; init; }
public ICollection<string> Mappers { get; init; }
/// <summary>
/// Number of probes fired to complete the surface scan.
/// </summary>

View File

@ -24,9 +24,9 @@ public class SAASignalsFound : JournalBase
/// <summary>
/// List of signals found.
/// </summary>
public ImmutableList<Signal> Signals { get; init; }
public IReadOnlyCollection<Signal> Signals { get; init; }
/// <summary>
/// List of genuses present.
/// </summary>
public ImmutableList<GenusType> Genuses { get; init; }
public IReadOnlyCollection<GenusType> Genuses { get; init; }
}

View File

@ -22,7 +22,7 @@ public class Scan : ScanBaryCentre
/// <summary>
/// List which reflects Frontier's JSON structure for the "Parents" object. Use of Parent property is recommended instead.
/// </summary>
public ImmutableList<Parent> Parents {
public IReadOnlyCollection<Parent> Parents {
get => _Parents;
init
{
@ -43,15 +43,16 @@ public class Scan : ScanBaryCentre
ParentList.Add((ParentType.Star, parent.Star.GetValueOrDefault(0)));
}
}
Parent = ParentList.ToImmutableList();
}
Parent = ParentList;
}
}
/// <summary>
/// "Parents" object rearranged into more intuitive structure for ease of use.
/// </summary>
[JsonIgnore]
public ImmutableList<(ParentType ParentType, int Body)> Parent { get; init; }
private ImmutableList<Parent> _Parents;
public IReadOnlyCollection<(ParentType ParentType, int Body)> Parent { get; init; }
private IReadOnlyCollection<Parent> _Parents;
/// <summary>
/// Body distance from system arrival point in light-seconds.
/// </summary>
@ -79,7 +80,7 @@ public class Scan : ScanBaryCentre
/// <summary>
/// List containing full breakdown of atmospheric components and their relative percentages.
/// </summary>
public ImmutableList<MaterialComposition> AtmosphereComposition { get; init; }
public IReadOnlyCollection<MaterialComposition> AtmosphereComposition { get; init; }
/// <summary>
/// Descriptive string for type of volcanism present, or an empty string for none, e.g. "major silicate vapour geysers volcanism".
/// </summary>
@ -112,7 +113,7 @@ public class Scan : ScanBaryCentre
/// List containing full breakdown of prospectable surface materials and their relative percentages.
/// </summary>
[JsonConverter(typeof(MaterialCompositionConverter))]
public ImmutableList<MaterialComposition> Materials { get; init; }
public IReadOnlyCollection<MaterialComposition> Materials { get; init; }
/// <summary>
/// Overall composition of body, expressed as percentages of ice, rock, and metal.
/// </summary>
@ -129,7 +130,7 @@ public class Scan : ScanBaryCentre
/// <summary>
/// List of all planetary or stellar ring systems around the body.
/// </summary>
public ImmutableList<Ring> Rings { get; init; }
public IReadOnlyCollection<Ring> Rings { get; init; }
/// <summary>
/// Description of the minable material abundance.<br/>Possible values inclue "PristineResources", "MajorResources", "CommonResources", "LowResources", and "DepletedResources".
/// </summary>

View File

@ -11,11 +11,11 @@ public class SellExplorationData : JournalBase
/// <summary>
/// List of systems for which data was sold.
/// </summary>
public ImmutableList<string> Systems { get; init; }
public ICollection<string> Systems { get; init; }
/// <summary>
/// List of first discovered bodies.
/// </summary>
public ImmutableList<string> Discovered { get; init; }
public ICollection<string> Discovered { get; init; }
/// <summary>
/// Base value of sold data.
/// </summary>

View File

@ -24,5 +24,5 @@ public class CarrierJump : FSDJump
public StationService StationServices { get; init; }
public string StationEconomy { get; init; }
public string StationEconomy_Localised { get; init; }
public ImmutableList<StationEconomy> StationEconomies { get; init; }
public IReadOnlyCollection<StationEconomy> StationEconomies { get; init; }
}

View File

@ -19,7 +19,7 @@ public class CarrierStats : JournalBase
public bool PendingDecommission { get; init; }
public CarrierSpaceUsage SpaceUsage { get; init; }
public ParameterTypes.CarrierFinance Finance { get; init; }
public ImmutableList<CarrierCrew> Crew { get; init; }
public ImmutableList<CarrierPack> ShipPacks { get; init; }
public ImmutableList<CarrierPack> ModulePacks { get; init; }
public IReadOnlyCollection<CarrierCrew> Crew { get; init; }
public IReadOnlyCollection<CarrierPack> ShipPacks { get; init; }
public IReadOnlyCollection<CarrierPack> ModulePacks { get; init; }
}

View File

@ -6,6 +6,6 @@ namespace Observatory.Framework.Files.Journal.Odyssey;
public class BackpackChange : JournalBase
{
public override string Event => "BackpackChange";
public ImmutableList<BackpackItemChange> Added { get; init; }
public ImmutableList<BackpackItemChange> Removed { get; init; }
public IReadOnlyCollection<BackpackItemChange> Added { get; init; }
public IReadOnlyCollection<BackpackItemChange> Removed { get; init; }
}

View File

@ -6,8 +6,8 @@ namespace Observatory.Framework.Files.Journal.Odyssey;
public class BackpackMaterials : JournalBase
{
public override string Event => "BackpackMaterials";
public ImmutableList<BackpackItem> Items { get; init; }
public ImmutableList<BackpackItem> Components { get; init; }
public ImmutableList<BackpackItem> Consumables { get; init; }
public ImmutableList<BackpackItem> Data { get; init; }
public IReadOnlyCollection<BackpackItem> Items { get; init; }
public IReadOnlyCollection<BackpackItem> Components { get; init; }
public IReadOnlyCollection<BackpackItem> Consumables { get; init; }
public IReadOnlyCollection<BackpackItem> Data { get; init; }
}

View File

@ -15,5 +15,5 @@ public class BuyMicroResources : JournalBase
public int Price { get; init; }
public ulong MarketID { get; init; }
public int TotalCount { get; init; }
public ImmutableList<MicroResource> MicroResources { get; init; }
public IReadOnlyCollection<MicroResource> MicroResources { get; init; }
}

View File

@ -6,6 +6,6 @@ namespace Observatory.Framework.Files.Journal.Odyssey;
public class CreateSuitLoadout : DeleteSuitLoadout
{
public override string Event => "CreateSuitLoadout";
public ImmutableList<SuitModule> Modules { get; init; }
public ImmutableList<string> SuitMods { get; init; }
public IReadOnlyCollection<SuitModule> Modules { get; init; }
public ICollection<string> SuitMods { get; init; }
}

View File

@ -6,7 +6,7 @@ namespace Observatory.Framework.Files.Journal.Odyssey;
public class SellMicroResources : JournalBase
{
public override string Event => "SellMicroResources";
public ImmutableList<MicroResource> MicroResources { get; init; }
public IReadOnlyCollection<MicroResource> MicroResources { get; init; }
public int Price { get; init; }
public ulong MarketID { get; init; }
}

View File

@ -7,5 +7,5 @@ public class SellOrganicData : JournalBase
{
public override string Event => "SellOrganicData";
public ulong MarketID { get; init; }
public ImmutableList<BioData> BioData { get; init; }
public IReadOnlyCollection<BioData> BioData { get; init; }
}

View File

@ -6,8 +6,8 @@ namespace Observatory.Framework.Files.Journal.Odyssey;
public class ShipLockerMaterials : JournalBase
{
public override string Event => "ShipLockerMaterials";
public ImmutableList<BackpackItem> Items { get; init; }
public ImmutableList<BackpackItem> Components { get; init; }
public ImmutableList<BackpackItem> Consumables { get; init; }
public ImmutableList<BackpackItem> Data { get; init; }
public IReadOnlyCollection<BackpackItem> Items { get; init; }
public IReadOnlyCollection<BackpackItem> Components { get; init; }
public IReadOnlyCollection<BackpackItem> Consumables { get; init; }
public IReadOnlyCollection<BackpackItem> Data { get; init; }
}

View File

@ -7,7 +7,7 @@ namespace Observatory.Framework.Files.Journal.Odyssey;
public class TradeMicroResources : JournalBase
{
public override string Event => "TradeMicroResources";
public ImmutableList<MicroResource> Offered { get; init; }
public IReadOnlyCollection<MicroResource> Offered { get; init; }
public string Received { get; init; }
[JsonConverter(typeof(JsonStringEnumConverter))]
public MicroCategory Category { get; init; }

View File

@ -6,5 +6,5 @@ namespace Observatory.Framework.Files.Journal.Odyssey;
public class TransferMicroResources : JournalBase
{
public override string Event => "TransferMicroResources";
public ImmutableList<MicroTransfer> Transfers { get; init; }
public IReadOnlyCollection<MicroTransfer> Transfers { get; init; }
}

View File

@ -16,7 +16,7 @@ public class ApproachSettlement : JournalBase
public float Longitude { get; init; }
public int BodyID { get; init; }
public string BodyName { get; init; }
public ImmutableList<StationEconomy> StationEconomies { get; init; }
public IReadOnlyCollection<StationEconomy> StationEconomies { get; init; }
public string StationEconomy { get; init; }
public string StationEconomy_Localised { get; init; }
public Faction StationFaction { get; init; }

View File

@ -6,5 +6,5 @@ namespace Observatory.Framework.Files.Journal.Other;
public class CargoTransfer : JournalBase
{
public override string Event => "CargoTransfer";
public ImmutableList<CargoTransferDetail> Transfers { get; init; }
public IReadOnlyCollection<CargoTransferDetail> Transfers { get; init; }
}

View File

@ -6,7 +6,7 @@ namespace Observatory.Framework.Files.Journal.Other;
public class ProspectedAsteroid : JournalBase
{
public override string Event => "ProspectedAsteroid";
public ImmutableList<ProspectMaterial> Materials { get; init; }
public IReadOnlyCollection<ProspectMaterial> Materials { get; init; }
public string Content { get; init; }
public string Content_Localised { get; init; }
public string MotherlodeMaterial { get; init; }

View File

@ -5,5 +5,5 @@ namespace Observatory.Framework.Files.Journal.Other;
public class RebootRepair : JournalBase
{
public override string Event => "RebootRepair";
public ImmutableList<string> Modules { get; init; }
public ICollection<string> Modules { get; init; }
}

View File

@ -11,5 +11,5 @@ public class Synthesis : JournalBase
public string Name { get; init; }
[JsonConverter(typeof(MaterialConverter))]
public ImmutableList<Material> Materials { get; init; }
public IReadOnlyCollection<Material> Materials { get; init; }
}

View File

@ -5,5 +5,5 @@ namespace Observatory.Framework.Files.Journal.Other;
public class WingJoin : JournalBase
{
public override string Event => "WingJoin";
public ImmutableList<string> Others { get; init; }
public ICollection<string> Others { get; init; }
}

View File

@ -5,5 +5,5 @@ namespace Observatory.Framework.Files.Journal.Powerplay;
public class PowerplayVoucher : PowerplayJoin
{
public override string Event => "PowerplayVoucher";
public ImmutableList<string> Systems { get; init; }
public ICollection<string> Systems { get; init; }
}

View File

@ -8,5 +8,5 @@ public class Cargo : JournalBase
public override string Event => "Cargo";
public string Vessel { get; init; }
public int Count { get; init; }
public ImmutableList<CargoType> Inventory { get; init; }
public IReadOnlyCollection<CargoType> Inventory { get; init; }
}

View File

@ -19,5 +19,5 @@ public class Loadout : JournalBase
public double MaxJumpRange { get; init; }
public ulong Rebuy { get; init; }
public bool Hot { get; init; }
public ImmutableList<Modules> Modules { get; init; }
public IReadOnlyCollection<Modules> Modules { get; init; }
}

View File

@ -1,13 +1,13 @@
using System.Collections.Immutable;
using Observatory.Framework.Files.ParameterTypes;
namespace Observatory.Framework.Files.Journal.Startup;
namespace Observatory.Framework.Files.Journal.Startup;
using System.Collections.Immutable;
using ParameterTypes;
public class Materials : JournalBase
{
public override string Event => "Materials";
public ImmutableList<Material> Raw { get; init; }
public ImmutableList<Material> Manufactured { get; init; }
public ImmutableList<Material> Encoded { get; init; }
public virtual IReadOnlyCollection<Material> Raw { get; init; }
public virtual IReadOnlyCollection<Material> Manufactured { get; init; }
public virtual IReadOnlyCollection<Material> Encoded { get; init; }
}

View File

@ -6,7 +6,7 @@ namespace Observatory.Framework.Files.Journal.Startup;
public class Missions : JournalBase
{
public override string Event => "Missions";
public ImmutableList<Mission> Active { get; init; }
public ImmutableList<Mission> Failed { get; init; }
public ImmutableList<Mission> Complete { get; init; }
public IReadOnlyCollection<Mission> Active { get; init; }
public IReadOnlyCollection<Mission> Failed { get; init; }
public IReadOnlyCollection<Mission> Complete { get; init; }
}

View File

@ -1,6 +1,38 @@
namespace Observatory.Framework.Files.Journal.Startup;
public class Progress : Rank
public class Progress : JournalBase
{
public override string Event => "Progress";
/// <summary>
/// percent progress towards next rank
/// </summary>
public int Combat { get; init; }
/// <summary>
/// percent progress towards next rank
/// </summary>
public int Trade { get; init; }
/// <summary>
/// percent progress towards next rank
/// </summary>
public int Explore { get; init; }
/// <summary>
/// percent progress towards next rank
/// </summary>
public int CQC { get; init; }
/// <summary>
/// percent progress towards next rank
/// </summary>
public int Soldier { get; init; }
/// <summary>
/// percent progress towards next rank
/// </summary>
public int Exobiologist { get; init; }
/// <summary>
/// percent progress towards next rank
/// </summary>
public int Empire { get; init; }
/// <summary>
/// percent progress towards next rank
/// </summary>
public int Federation { get; init; }
}

View File

@ -21,11 +21,11 @@ public class Statistics : JournalBase
public Crew Crew { get; init; }
public Multicrew Multicrew { get; init; }
[JsonPropertyName("TG_ENCOUNTERS")]
public Thargoid Thargoid { get; init; }
public Thargoid? Thargoid { get; init; }
[JsonPropertyName("Material_Trader_Stats")]
public MaterialTrader MaterialTrader { get; init; }
public CQC CQC { get; init; }
public CQC? CQC { get; init; }
[JsonPropertyName("FLEETCARRIER")]
public ParameterTypes.FleetCarrier FleetCarrier { get; init; }
public ParameterTypes.FleetCarrier? FleetCarrier { get; init; }
public Exobiology Exobiology { get; init; }
}

View File

@ -6,5 +6,5 @@ namespace Observatory.Framework.Files.Journal.StationServices;
public class CommunityGoal : JournalBase
{
public override string Event => "CommunityGoal";
public ImmutableList<CurrentGoal> CurrentGoals { get; init; }
public IReadOnlyCollection<CurrentGoal> CurrentGoals { get; init; }
}

View File

@ -21,6 +21,6 @@ public class EngineerCraft : JournalBase
public float Quality { get; init; }
public string ApplyExperimentalEffect { get; init; }
[JsonConverter(typeof(MaterialConverter))]
public ImmutableList<Material> Ingredients { get; init; }
public ImmutableList<Modifier> Modifiers { get; init; }
public IReadOnlyCollection<Material> Ingredients { get; init; }
public IReadOnlyCollection<Modifier> Modifiers { get; init; }
}

View File

@ -7,13 +7,38 @@ namespace Observatory.Framework.Files.Journal.StationServices;
public class EngineerProgress : JournalBase
{
public override string Event => "EngineerProgress";
public string Engineer { get; init; }
public ulong EngineerID { get; init; }
public int Rank { get; init; }
public int RankProgress { get; init; }
public string? Engineer { get; set; }
public ulong? EngineerID { get; set; }
public int? Rank { get; set; }
public int? RankProgress { get; set; }
[JsonConverter(typeof(JsonStringEnumConverter))]
public Progress Progress { get; init; }
public Progress? Progress { get; set; }
public ImmutableList<EngineerType> Engineers { get; init; }
}
public IReadOnlyCollection<EngineerType> Engineers { get; set; }
}
//{ "timestamp":"2024-05-25T04:44:34Z", "event":"EngineerProgress",
//"Engineers":[
//{ "Engineer":"Hera Tani", "EngineerID":300090, "Progress":"Known" },
//{ "Engineer":"Professor Palin", "EngineerID":300220, "Progress":"Invited" },
//{ "Engineer":"Felicity Farseer", "EngineerID":300100, "Progress":"Unlocked", "RankProgress":0, "Rank":5 },
//{ "Engineer":"Eleanor Bresa", "EngineerID":400011, "Progress":"Known" },
//{ "Engineer":"Hero Ferrari", "EngineerID":400003, "Progress":"Known" },
//{ "Engineer":"Jude Navarro", "EngineerID":400001, "Progress":"Known" },
//{ "Engineer":"Etienne Dorn", "EngineerID":300290, "Progress":"Unlocked", "RankProgress":0, "Rank":5 },
//{ "Engineer":"Lori Jameson", "EngineerID":300230, "Progress":"Known" },
//{ "Engineer":"Liz Ryder", "EngineerID":300080, "Progress":"Unlocked", "RankProgress":86, "Rank":3 },
//{ "Engineer":"Rosa Dayette", "EngineerID":400012, "Progress":"Known" },
//{ "Engineer":"Juri Ishmaak", "EngineerID":300250, "Progress":"Unlocked", "RankProgress":0, "Rank":1 },
//{ "Engineer":"Zacariah Nemo", "EngineerID":300050, "Progress":"Known" },
//{ "Engineer":"Mel Brandon", "EngineerID":300280, "Progress":"Known" },
//{ "Engineer":"Selene Jean", "EngineerID":300210, "Progress":"Unlocked", "RankProgress":11, "Rank":3 },
//{ "Engineer":"Marco Qwent", "EngineerID":300200, "Progress":"Unlocked", "RankProgress":27, "Rank":4 },
//{ "Engineer":"Chloe Sedesi", "EngineerID":300300, "Progress":"Invited" },
//{ "Engineer":"Baltanos", "EngineerID":400010, "Progress":"Known" },
//{ "Engineer":"Petra Olmanova", "EngineerID":300130, "Progress":"Unlocked", "RankProgress":0, "Rank":5 },
//{ "Engineer":"The Dweller", "EngineerID":300180, "Progress":"Unlocked", "RankProgress":0, "Rank":1 },
//{ "Engineer":"Elvira Martuuk", "EngineerID":300160, "Progress":"Unlocked", "RankProgress":52, "Rank":3 },
//{ "Engineer":"Tod 'The Blaster' McQuinn", "EngineerID":300260, "Progress":"Unlocked", "RankProgress":15, "Rank":4 },
//{ "Engineer":"Domino Green", "EngineerID":400002, "Progress":"Invited" } ] }
//

View File

@ -9,5 +9,5 @@ public class MassModuleStore : JournalBase
public ulong MarketID { get; init; }
public string Ship { get; init; }
public ulong ShipID { get; init; }
public ImmutableList<Item> Items { get; init; }
public IReadOnlyCollection<Item> Items { get; init; }
}

View File

@ -23,9 +23,9 @@ public class MissionCompleted : JournalBase
[JsonConverter(typeof(StringIntConverter))]
public int Donation { get; init; }
public long Donated { get; init; }
public ImmutableList<string> PermitsAwarded { get; init; }
public ImmutableList<CommodityReward> CommodityReward { get; init; }
public ImmutableList<MaterialReward> MaterialsReward { get; init; }
public ICollection<string> PermitsAwarded { get; init; }
public IReadOnlyCollection<CommodityReward> CommodityReward { get; init; }
public IReadOnlyCollection<MaterialReward> MaterialsReward { get; init; }
public string DestinationSystem { get; init; }
public string DestinationStation { get; init; }
public string DestinationSettlement { get; init; }
@ -33,5 +33,5 @@ public class MissionCompleted : JournalBase
public string NewDestinationStation { get; init; }
public int KillCount { get; init; }
public string TargetFaction { get; init; }
public ImmutableList<FactionEffect> FactionEffects { get; init; }
public IReadOnlyCollection<FactionEffect> FactionEffects { get; init; }
}

View File

@ -13,6 +13,6 @@ public class RedeemVoucher : JournalBase
public long Amount { get; init; }
public string Faction { get; init; }
public float BrokerPercentage { get; init; }
public ImmutableList<VoucherFaction> Factions { get; init; }
public IReadOnlyCollection<VoucherFaction> Factions { get; init; }
}

View File

@ -7,5 +7,5 @@ public class Repair : JournalBase
public override string Event => "Repair";
public string Item { get; init; }
public int Cost { get; init; }
public ImmutableList<string> Items { get; init; }
public ICollection<string> Items { get; init; }
}

View File

@ -12,5 +12,5 @@ public class StoredModules : JournalBase
/// </summary>
public string StationName { get; init; }
public ulong MarketID { get; init; }
public ImmutableList<StoredItem> Items { get; init; }
public IReadOnlyCollection<StoredItem> Items { get; init; }
}

View File

@ -12,6 +12,6 @@ public class StoredShips : JournalBase
/// </summary>
public string StationName { get; init; }
public string StarSystem { get; init; }
public ImmutableList<StoredShip> ShipsHere { get; init; }
public ImmutableList<StoredShip> ShipsRemote { get; init; }
public IReadOnlyCollection<StoredShip> ShipsHere { get; init; }
public IReadOnlyCollection<StoredShip> ShipsRemote { get; init; }
}

View File

@ -8,7 +8,7 @@ public class TechnologyBroker : JournalBase
public override string Event => "TechnologyBroker";
public string BrokerType { get; init; }
public ulong MarketID { get; init; }
public ImmutableList<ItemName> ItemsUnlocked { get; init; }
public ImmutableList<CommodityReward> Commodities { get; init; }
public ImmutableList<MaterialReward> Materials { get; init; }
public IReadOnlyCollection<ItemName> ItemsUnlocked { get; init; }
public IReadOnlyCollection<CommodityReward> Commodities { get; init; }
public IReadOnlyCollection<MaterialReward> Materials { get; init; }
}

View File

@ -81,7 +81,7 @@ public class Docked : JournalBase
private get => StationEconomy_Localised;
init => StationEconomy_Localised = value;
}
public ImmutableList<StationEconomy> StationEconomies { get; init; }
public IReadOnlyCollection<StationEconomy> StationEconomies { get; init; }
[Obsolete("StationState is a rundundant property. Use StationEconomy to potentially reduce unnecessary checks.")]
public string StationState { get; init; }

View File

@ -11,7 +11,7 @@ public class FSDJump : JournalBase
public string StarSystem { get; init; }
public ulong SystemAddress { get; init; }
[JsonConverter(typeof(StarPosConverter))]
public (double x, double y, double z) StarPos { get; init; }
public StarPos StarPos { get; init; }
public string Body { get; init; }
public int BodyID { get; init; }
public string BodyType { get; init; }
@ -33,9 +33,9 @@ public class FSDJump : JournalBase
public string SystemSecurity_Localised { get; init; }
public long Population { get; init; }
public bool Wanted { get; init; }
public ImmutableList<SystemFaction> Factions { get; init; }
public ImmutableList<Conflict> Conflicts { get; init; }
public ImmutableList<string> Powers { get; init; }
public IReadOnlyCollection<SystemFaction> Factions { get; init; }
public IReadOnlyCollection<Conflict> Conflicts { get; init; }
public ICollection<string> Powers { get; init; }
public string PowerplayState { get; init; }
public bool Taxi { get; init; }
public bool Multicrew { get; init; }

View File

@ -8,14 +8,17 @@ namespace Observatory.Framework.Files.Journal.Travel;
public class Location : JournalBase
{
public override string Event => "Location";
[JsonConverter(typeof(IntBoolFlexConverter))]
public bool Docked { get; init; }
public double DistFromStarLS { get; init; }
/// <summary>
/// Name of the station at which this event occurred.
/// </summary>
public string StationName { get; init; }
public string StationType { get; init; }
public float Longitude { get; init; }
public float Latitude { get; init; }
@ -23,18 +26,20 @@ public class Location : JournalBase
[JsonConverter(typeof(LegacyFactionConverter<Faction>))]
public Faction StationFaction { get; init; }
public string StationGovernment { get; init; }
public string StationGovernment_Localised { get; init; }
public string StationAllegiance { get; init; }
public ImmutableList<string> StationServices { get; init; }
public ICollection<string> StationServices { get; init; }
public string StationEconomy { get; init; }
public string StationEconomy_Localised { get; init; }
public ImmutableList<StationEconomy> StationEconomies { get; init; }
public IReadOnlyCollection<StationEconomy> StationEconomies { get; init; }
public string StarSystem { get; init; }
public ulong SystemAddress { get; init; }
[JsonConverter(typeof(StarPosConverter))]
public (double x, double y, double z) StarPos { get; init; }
public StarPos StarPos { get; init; }
public string SystemAllegiance { get; init; }
public string SystemEconomy { get; init; }
public string SystemEconomy_Localised { get; init; }
@ -48,16 +53,24 @@ public class Location : JournalBase
public string Body { get; init; }
public int BodyID { get; init; }
public string BodyType { get; init; }
public ImmutableList<DetailedFaction> Factions { get; init; }
public IReadOnlyCollection<DetailedFaction> Factions { get; init; }
[JsonConverter(typeof(LegacyFactionConverter<DetailedFaction>))]
public DetailedFaction SystemFaction { get; init; }
public ImmutableList<Conflict> Conflicts { get; init; }
public ImmutableList<string> Powers { get; init; }
public IReadOnlyCollection<Conflict> Conflicts { get; init; }
public ICollection<string> Powers { get; init; }
public string PowerplayState { get; init; }
public bool Taxi { get; init; }
public bool Multicrew { get; init; }
public bool OnFoot { get; init; }
public bool InSRV { get; init; }
public ThargoidWar ThargoidWar { get; init; }
}
public class StarPos
{
public double X { get; set; }
public double Y { get; set; }
public double Z { get; set; }
}

View File

@ -29,5 +29,5 @@ public class MarketFile : JournalBase
/// <summary>
/// List of all commodities available in the market.
/// </summary>
public ImmutableList<MarketItem> Items { get; init; }
public IReadOnlyCollection<MarketItem> Items { get; init; }
}

View File

@ -13,5 +13,5 @@ public class ModuleInfoFile : JournalBase
/// <summary>
/// List of all equipped modules.
/// </summary>
public ImmutableList<Module> Modules { get; init; }
public IReadOnlyCollection<Module> Modules { get; init; }
}

View File

@ -13,5 +13,5 @@ public class NavRouteFile : JournalBase
/// <summary>
/// List of star systems and their locations in the current route.
/// </summary>
public ImmutableList<Route> Route { get; init; }
public IReadOnlyCollection<Route> Route { get; init; }
}

View File

@ -29,5 +29,5 @@ public class OutfittingFile : JournalBase
/// <summary>
/// List of all available parts in shipyard.
/// </summary>
public ImmutableList<OutfittingModule> Items { get; init; }
public IReadOnlyCollection<OutfittingModule> Items { get; init; }
}

View File

@ -10,6 +10,6 @@ public class DetailedFaction : Faction
public string Happiness { get; init; }
public string Happiness_Localised { get; init; }
public float MyReputation { get; init; }
public ImmutableList<FactionStateTrend> RecoveringStates { get; init; }
public ImmutableList<FactionState> ActiveStates { get; init; }
public IReadOnlyCollection<FactionStateTrend> RecoveringStates { get; init; }
public IReadOnlyCollection<FactionState> ActiveStates { get; init; }
}

View File

@ -18,5 +18,5 @@ public class Engineering
public string ExperimentalEffect { get; init; }
public ImmutableList<Modifiers> Modifiers { get; init; }
public IReadOnlyCollection<Modifiers> Modifiers { get; init; }
}

View File

@ -7,8 +7,8 @@ namespace Observatory.Framework.Files.ParameterTypes;
public class FactionEffect
{
public string Faction { get; init; }
public ImmutableList<EffectType> Effects { get; init; }
public ImmutableList<InfluenceType> Influence { get; init; }
public IReadOnlyCollection<EffectType> Effects { get; init; }
public IReadOnlyCollection<InfluenceType> Influence { get; init; }
[JsonConverter(typeof(RepInfConverter))]
public int Reputation { get; init; }
[JsonConverter(typeof(JsonStringEnumConverter))]

View File

@ -7,30 +7,33 @@ public class Modifiers
{
public string Label { get; init; }
[JsonConverter(typeof(MutableStringDoubleConverter))]
public object Value
{
get
{
if (!string.IsNullOrEmpty(ValueString))
return ValueString;
return ValueNumeric;
}
init
{
if (value.GetType() == typeof(string))
ValueString = value.ToString();
else
ValueNumeric = (double)value;
}
}
[JsonConverter(typeof(NumberOrStringConverter))]
public NumberOrString Value { get; set; }
public double OriginalValue { get; init; }
[JsonConverter(typeof(IntBoolConverter))]
public bool LessIsGood { get; init; }
}
private double ValueNumeric;
private string ValueString;
public class NumberOrString
{
public NumberOrString()
{ }
public NumberOrString(string value)
{
StringValue = value;
IsString = true;
}
public NumberOrString(double value)
{
DoubleValue = value;
IsDouble = true;
}
public string? StringValue { get; init; }
public bool IsString { get; init; }
public double? DoubleValue { get; init; }
public bool IsDouble { get; init; }
}

View File

@ -1,5 +1,6 @@
using System.Text.Json.Serialization;
using Observatory.Framework.Files.Converters;
using Observatory.Framework.Files.Journal.Travel;
namespace Observatory.Framework.Files.ParameterTypes;
@ -8,6 +9,6 @@ public class Route
public string StarSystem { get; init; }
public ulong SystemAddress { get; init; }
[JsonConverter(typeof(StarPosConverter))]
public (double x, double y, double z) StarPos { get; init; }
public StarPos StarPos { get; init; }
public string StarClass { get; init; }
}

View File

@ -8,5 +8,5 @@ public class SuitModule
public string ModuleName { get; init; }
public ulong SuitModuleID { get; init; }
public int Class { get; init; }
public ImmutableList<string> WeaponMods { get; init; }
public ICollection<string> WeaponMods { get; init; }
}

View File

@ -14,11 +14,11 @@ public class SystemFaction : Faction
public double MyReputation { get; init; }
public ImmutableList<FactionStateTrend> PendingStates { get; init; }
public IReadOnlyCollection<FactionStateTrend> PendingStates { get; init; }
public ImmutableList<FactionStateTrend> RecoveringStates { get; init; }
public IReadOnlyCollection<FactionStateTrend> RecoveringStates { get; init; }
public ImmutableList<FactionState> ActiveStates { get; init; }
public IReadOnlyCollection<FactionState> ActiveStates { get; init; }
public bool? SquadronFaction { get; init; }

View File

@ -34,5 +34,5 @@ public class ShipyardFile : JournalBase
/// <summary>
/// List of all ships and prices for them at the current shipyard.
/// </summary>
public ImmutableList<ShipyardPrice> PriceList { get; init; }
public IReadOnlyCollection<ShipyardPrice> PriceList { get; init; }
}