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

API & WebSocket now working

Can Read Status File & Broadcast contents via websocket
This commit is contained in:
2024-04-18 14:45:16 +10:00
parent aa368471fe
commit ac30d3cd2a
18 changed files with 345 additions and 383 deletions

View File

@ -7,13 +7,13 @@ class PipConverter : JsonConverter<(int Sys, int Eng, int Wep)>
{
public override (int Sys, int Eng, int Wep) Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options)
{
var values = (int[])JsonSerializer.Deserialize(ref reader, typeof(int[]));
var values = JsonSerializer.Deserialize<int[]>(ref reader);
return (Sys: values[0], Eng: values[1], Wep: values[2]);
}
public override void Write(Utf8JsonWriter writer, (int Sys, int Eng, int Wep) value, JsonSerializerOptions options)
{
throw new NotImplementedException();
JsonSerializer.Serialize(writer, new[] { value.Sys, value.Eng, value.Wep });
}
}

View File

@ -18,84 +18,84 @@ public class Status : JournalBase
/// Additional set of flags representing current player state.
/// Added in later versions of Elite Dangerous.
/// </summary>
public StatusFlags2 Flags2 { get; init; }
public StatusFlags2? Flags2 { get; init; }
/// <summary>
/// Current allocation of power distribution (pips) between SYS, ENG, and WEP, in "half pip" increments.
/// </summary>
[JsonConverter(typeof(PipConverter))]
public (int Sys, int Eng, int Wep) Pips { get; init; }
public (int Sys, int Eng, int Wep)? Pips { get; init; }
/// <summary>
/// Currently selected fire group.
/// </summary>
public int Firegroup { get; init; }
public int? Firegroup { get; init; }
/// <summary>
/// UI component currently focused by the player.
/// </summary>
public FocusStatus GuiFocus { get; init; }
public FocusStatus? GuiFocus { get; init; }
/// <summary>
/// Fuel remaining in the current ship.
/// </summary>
public FuelType Fuel { get; init; }
public FuelType? Fuel { get; init; }
/// <summary>
/// Amount of cargo currently carried.
/// </summary>
public float Cargo { get; init; }
public float? Cargo { get; init; }
/// <summary>
/// Legal status in the current jurisdiction.
/// </summary>
[JsonConverter(typeof(JsonStringEnumConverter))]
public LegalStatus LegalState { get; init; }
public LegalStatus? LegalState { get; init; }
/// <summary>
/// <para>Current altitude.</para>
/// <para>Check if RadialAltitude is set in StatusFlags to determine if altitude is based on planetary radius (set) or raycast to ground (unset).</para>
/// </summary>
public int Altitude { get; init; }
public int? Altitude { get; init; }
/// <summary>
/// Latitude of current surface location.
/// </summary>
public double Latitude { get; init; }
public double? Latitude { get; init; }
/// <summary>
/// Longitude of current surface location.
/// </summary>
public double Longitude { get; init; }
public double? Longitude { get; init; }
/// <summary>
/// Current heading for surface direction.
/// </summary>
public int Heading { get; init; }
public int? Heading { get; init; }
/// <summary>
/// Body name of current location.
/// </summary>
public string BodyName { get; init; }
public string? BodyName { get; init; }
/// <summary>
/// Radius of current planet.
/// </summary>
public double PlanetRadius { get; init; }
public double? PlanetRadius { get; init; }
/// <summary>
/// Oxygen remaining on foot, range from 0.0 - 1.0.
/// </summary>
public float Oxygen { get; init; }
public float? Oxygen { get; init; }
/// <summary>
/// Health remaining on foot, range from 0.0 - 1.0.
/// </summary>
public float Health { get; init; }
public float? Health { get; init; }
/// <summary>
/// Current environmental temperature in K while on foot.
/// </summary>
public float Temperature { get; init; }
public float? Temperature { get; init; }
/// <summary>
/// Name of currently selected personal weapon.
/// </summary>
public string SelectedWeapon { get; init; }
public string? SelectedWeapon { get; init; }
/// <summary>
/// Current strength of gravity while on foot, in g.
/// </summary>
public float Gravity { get; init; }
public float? Gravity { get; init; }
/// <summary>
/// Current credit balance of player.
/// </summary>
public long Balance { get; init; }
public long? Balance { get; init; }
/// <summary>
/// Currently set destination.
/// </summary>
public Destination Destination { get; init; }
public Destination? Destination { get; init; }
}