Include Predicted Level after next Voyage in submarine stats

This commit is contained in:
Liza 2024-02-19 11:27:21 +01:00
parent 5670ef060d
commit 520f7373e6
Signed by: liza
GPG Key ID: 7199F8D727D55F67
5 changed files with 18 additions and 2 deletions

View File

@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net7.0-windows</TargetFramework>
<Version>0.3</Version>
<Version>0.4</Version>
<LangVersion>11.0</LangVersion>
<Nullable>enable</Nullable>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>

View File

@ -217,6 +217,7 @@ internal sealed class InfluxStatisticsClient : IDisposable
.Tag("part_bridge", sub.Bridge)
.Tag("build", sub.Build)
.Field("level", sub.Level)
.Field("predicted_level", sub.PredictedLevel)
.Timestamp(date, WritePrecision.S));
}
}

View File

@ -1,4 +1,6 @@
namespace Influx.SubmarineTracker;
using System;
namespace Influx.SubmarineTracker;
public sealed class Submarine
{
@ -7,9 +9,20 @@ public sealed class Submarine
Name = (string)@delegate.GetType().GetProperty("Name")!.GetValue(@delegate)!;
Level = (ushort)@delegate.GetType().GetProperty("Rank")!.GetValue(@delegate)!;
Build = new Build(@delegate.GetType().GetProperty("Build")!.GetValue(@delegate)!);
try
{
(uint predictedLevel, double _) = ((uint, double))@delegate.GetType().GetMethod("PredictExpGrowth")!.Invoke(@delegate, Array.Empty<object?>())!;
PredictedLevel = (ushort)predictedLevel;
}
catch (Exception)
{
PredictedLevel = Level;
}
}
public string Name { get; }
public ushort Level { get; }
public ushort PredictedLevel { get; }
public Build Build { get; }
}

View File

@ -5,6 +5,7 @@ public sealed class SubmarineStats
public required string Name { get; init; }
public required int Id { get; init; }
public required ushort Level { get; init; }
public required ushort PredictedLevel { get; init; }
public required string Hull { get; init; }
public required string Stern { get; init; }

View File

@ -46,6 +46,7 @@ internal sealed class SubmarineTrackerIpc
Id = x.Subs.IndexOf(y),
Name = y.Name,
Level = y.Level,
PredictedLevel = y.PredictedLevel,
Hull = y.Build.HullIdentifier,
Stern = y.Build.SternIdentifier,
Bow = y.Build.BowIdentifier,