Snapshot for release 2026.10.15.2 (internal 2d4b0af)
This commit is contained in:
parent
a89ae04005
commit
d5e0b50de7
224 changed files with 17914 additions and 1182 deletions
|
|
@ -47,6 +47,7 @@ internal static partial class Program
|
|||
TestCleanup();
|
||||
TestKillCounter();
|
||||
TestSessionStats();
|
||||
TestRynthAiSnapshot();
|
||||
|
||||
Console.WriteLine($"\n{_asserts} assertions, {_fails} failed.");
|
||||
if (_asserts == 0) { Console.WriteLine("ABORT: zero assertions ran."); return 1; }
|
||||
|
|
@ -56,6 +57,50 @@ internal static partial class Program
|
|||
|
||||
private static readonly DateTime Now = new(2026, 10, 1, 3, 0, 0, DateTimeKind.Utc);
|
||||
|
||||
/// <summary>
|
||||
/// One session (2026-10-13): RynthTracker shows RynthAi's session ("RynthAi.Hub" SessionStats and
|
||||
/// SessionStatsMore) when RynthAi answers; its rates are rounded, not cut off.
|
||||
/// </summary>
|
||||
private static void TestRynthAiSnapshot()
|
||||
{
|
||||
Console.WriteLine("-- RynthAi's session in the Tracker panel");
|
||||
var s = new RynthCore.Plugin.Shared.SessionStatsV1
|
||||
{
|
||||
StartUtcTicks = Now.AddHours(-2).Ticks, SessionSeconds = 7200, Xp = 5_000_000, XpPerHour = 2_499_999.6,
|
||||
Lum = 9000, LumPerHour = 4500.5, LumLast5Min = 120, PassUpTracked = 1, LumPassUp = 300, PassUpPerHour = 149.4,
|
||||
Kills = 40, KillsPerHour = 20,
|
||||
};
|
||||
var more = new RynthCore.Plugin.Shared.SessionStatsMoreV1 { XpPerKill = 125_000, Deaths = 1, MaxLevel = 0, Rad = 77, RadPerHour = 38.5 };
|
||||
var v = RynthCore.Plugin.RynthTracker.TrackerSnapshot.FromRynthAi(s, more, null);
|
||||
Eq(v.SessionStartUtc, Now.AddHours(-2), "RynthAi's session start");
|
||||
Check(v.Xp == 5_000_000 && v.Lum == 9000 && v.Kills == 40 && v.PassUpTracked && v.LumPassUp == 300, "RynthAi's totals");
|
||||
Check(v.XpPerKill == 125_000 && v.Deaths == 1 && v.Rad == 77 && !v.MaxLevel, "and the rest from SessionStatsMore");
|
||||
|
||||
string json = RynthCore.Plugin.RynthTracker.TrackerSnapshot.Build(v, Now);
|
||||
Check(json.Contains("\"ss\":7200.0"), "the clock runs from RynthAi's start: " + json);
|
||||
Check(json.Contains("\"xh\":2500000") && json.Contains("\"lh\":4501") && json.Contains("\"ph\":149") && json.Contains("\"rh\":39"),
|
||||
"rates rounded, not cut off: " + json);
|
||||
Check(json.Contains("\"kt\":40") && json.Contains("\"xk\":125000") && json.Contains("\"dt\":1") && json.Contains("\"pk\":1"), "panel fields: " + json);
|
||||
|
||||
// An older RynthAi (no SessionStatsMore): those fields from the Tracker's own session, else zero.
|
||||
var own = new SessionStatsView(Now.AddHours(-1), 3600, 1, 1, 1, 1, 0, 0, 0, false, 3, 3, 999, 4, 5, 6, true);
|
||||
var old = RynthCore.Plugin.RynthTracker.TrackerSnapshot.FromRynthAi(s, null, own);
|
||||
Check(old.Xp == 5_000_000 && old.XpPerKill == 999 && old.Deaths == 4 && old.Rad == 5 && old.MaxLevel,
|
||||
"older RynthAi: RynthAi's totals, the Tracker's own deaths / Radiance / XP per kill");
|
||||
var bare = RynthCore.Plugin.RynthTracker.TrackerSnapshot.FromRynthAi(s, null, null);
|
||||
Check(bare.XpPerKill == 0 && bare.Deaths == 0 && bare.Rad == 0 && !bare.MaxLevel, "and zero with no own session");
|
||||
|
||||
Eq(RynthCore.Plugin.RynthTracker.TrackerSnapshot.PerHour(double.NaN), 0L, "NaN rate is 0");
|
||||
Eq(RynthCore.Plugin.RynthTracker.TrackerSnapshot.PerHour(-5), 0L, "negative rate is 0");
|
||||
Eq(RynthCore.Plugin.RynthTracker.TrackerSnapshot.PerHour(0.5), 1L, "half rounds up");
|
||||
unsafe
|
||||
{
|
||||
Eq(RynthCore.Plugin.Shared.RynthAiHubApiV1.BaseStructSize, (uint)(8 + 10 * sizeof(nint)), "the hub table's base size (10 functions)");
|
||||
Eq((uint)sizeof(RynthCore.Plugin.Shared.RynthAiHubApiV1), RynthCore.Plugin.Shared.RynthAiHubApiV1.BaseStructSize + (uint)sizeof(nint),
|
||||
"SessionStatsMore appended right after the base");
|
||||
}
|
||||
}
|
||||
|
||||
private static TrackerSessionState Sample() => new()
|
||||
{
|
||||
ProcessId = 4321,
|
||||
|
|
|
|||
Loading…
Reference in a new issue