feat: port SK test branch (2026.10.18.24) onto sk

Squash of test/hotbuild-2026-10-16 as merged onto aelrynth main 2026.10.17.1, matching the
2026.10.18.24 test installer. The test branch wins where both changed the same lines; sk-only
changes kept; duplicate definitions from both sides cut to the test branch's copy.

Highlights: Aelrynth Vault in the Classic and Modern inventory, loot "Add to loot profile"
attribute checklist, graphics low-memory safeguard and settings panel, window placement and
borderless fixes, chat coordinate links, launcher DXVK toggle, installer stamps experimental
plugins with the release calver. Changelog/2026-10-18-sk-port-test-branch-2026.10.18.24.md.
This commit is contained in:
BlankenshipG 2026-10-18 16:22:34 -04:00
commit cbd18a6880
357 changed files with 35835 additions and 903 deletions

View file

@ -0,0 +1,25 @@
<Project Sdk="Microsoft.NET.Sdk">
<!--
Offline checks for RynthAi's Settings > Graphics model (2026-10-17):
src\RynthCore.Engine\Graphics\AcGraphicsPrefs.cs, compiled in (it is shared with the launcher).
graphics.json round-trips as a profile per account; one account's save leaves the others alone;
the 2026.10.18.1 shared set is ignored; the window mode drives Display.FullScreen; applying to a
UserPreferences.ini replaces keys in
place, adds missing keys and sections, leaves every other line alone, and writes nothing when
nothing changed. Works on temp files only. Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
-->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<RootNamespace>AcGraphicsPrefsTests</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\src\RynthCore.Engine\Graphics\AcGraphicsPrefs.cs" Link="Engine\AcGraphicsPrefs.cs" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,140 @@
// Offline checks for Graphics/AcGraphicsPrefs.cs (RynthAi Settings > Graphics). See the .csproj.
using RynthCore.Graphics;
int failures = 0, checks = 0;
void Check(bool ok, string what)
{
checks++;
if (ok) return;
failures++;
Console.WriteLine("FAIL " + what);
}
string dir = Path.Combine(Path.GetTempPath(), "AcGraphicsPrefsTests-" + Environment.ProcessId);
Directory.CreateDirectory(dir);
try
{
// ── Per-account profiles: each account's own; FullScreen follows the mode ──
string kelpie = AcGraphicsPrefs.AccountKey("InfiniteLeaftide", "silentkelpie");
string storm = AcGraphicsPrefs.AccountKey("InfiniteLeaftide", "SilentStorm");
Check(kelpie == "infiniteleaftide|silentkelpie" && storm == "infiniteleaftide|silentstorm", "account key is server|account, lower case");
Check(AcGraphicsPrefs.AccountKey("", "X") == "" && AcGraphicsPrefs.AccountKey("S", " ") == "", "no key without server and account");
var kcfg = new AcGraphicsConfig { WindowMode = AcGraphicsPrefs.ModeFullScreen };
kcfg.Values[AcGraphicsPrefs.ResolutionId] = "1280x720";
var scfg = new AcGraphicsConfig { WindowMode = AcGraphicsPrefs.ModeBorderlessFill };
scfg.Values["Render.TextureFiltering"] = "Anisotropic";
var all = new AcGraphicsProfiles();
all.Put(kelpie, kcfg);
all.Put(storm, scfg);
all.Put("x|y", new AcGraphicsConfig());
Check(all.Accounts.Count == 2, "an empty profile isn't kept");
Dictionary<string, string> forKelpie = all.For(kelpie).IniValues();
Check(forKelpie[AcGraphicsPrefs.FullScreenId] == "True" && forKelpie[AcGraphicsPrefs.ResolutionId] == "1280x720",
"Kelpie's profile: full screen at 1280x720");
Dictionary<string, string> forStorm = all.For(storm).IniValues();
Check(forStorm[AcGraphicsPrefs.FullScreenId] == "False" && !forStorm.ContainsKey(AcGraphicsPrefs.ResolutionId),
"Storm's profile: borderless, no resolution of Kelpie's");
Check(forStorm["Render.TextureFiltering"] == "Anisotropic", "render values pass through");
Check(all.For("infiniteleaftide|nobody").IniValues().Count == 0, "an account without a profile writes nothing");
// ── graphics.json round-trip; another account's entry survives a save ──
string json = Path.Combine(dir, "graphics.json");
all.Save(json);
AcGraphicsProfiles back = AcGraphicsProfiles.Load(json);
Check(back.For(kelpie).WindowMode == AcGraphicsPrefs.ModeFullScreen && back.For(kelpie).Values[AcGraphicsPrefs.ResolutionId] == "1280x720",
"Kelpie's profile round-trips");
Check(back.For(storm).Values["render.texturefiltering"] == "Anisotropic", "Storm's profile round-trips (ids case-insensitive)");
Check(!File.Exists(json + "." + Environment.ProcessId + ".tmp"), "no temp file left");
// A client edits only its own account: load, put, save (as AcGraphics.QueueSave does).
AcGraphicsProfiles onDisk = AcGraphicsProfiles.Load(json);
AcGraphicsConfig k2 = onDisk.For(kelpie).Clone();
k2.Values.Remove(AcGraphicsPrefs.ResolutionId);
onDisk.Put(kelpie, k2);
onDisk.Save(json);
AcGraphicsProfiles after = AcGraphicsProfiles.Load(json);
Check(!after.For(kelpie).Values.ContainsKey(AcGraphicsPrefs.ResolutionId), "Kelpie's change saved");
Check(after.For(storm).WindowMode == AcGraphicsPrefs.ModeBorderlessFill, "Storm's profile untouched by Kelpie's save");
// The 2026.10.18.1 single shared set is ignored (it made every client fight over one resolution).
File.WriteAllText(json, "{\"values\":{\"Display.Resolution\":\"1760x990\"},\"windowMode\":\"Windowed\",\"characters\":{}}");
Check(AcGraphicsProfiles.Load(json).Accounts.Count == 0, "old global graphics.json is not applied to anyone");
File.WriteAllText(json, "{\"accounts\":{\"a|b\":{\"windowMode\":\"Bogus\",\"values\":{}}}}");
Check(AcGraphicsProfiles.Load(json).Accounts.Count == 0, "unknown mode dropped; empty profile not kept");
// ── Resolution parsing ──
Check(AcGraphicsPrefs.TryParseResolution("1760x990", out int w, out int h) && w == 1760 && h == 990, "parses 1760x990");
Check(!AcGraphicsPrefs.TryParseResolution("800", out _, out _) && !AcGraphicsPrefs.TryParseResolution("100x50", out _, out _),
"rejects junk and tiny sizes");
Check(AcGraphicsPrefs.FormatFloat(0.891) == "0.89", "floats as AC writes them");
// ── Applying to UserPreferences.ini ──
string ini = Path.Combine(dir, "UserPreferences.ini");
File.WriteAllText(ini,
"[Render]\r\nFieldOfView=160.00\r\nTextureFiltering=Bilinear\r\n[Net]\r\nComputeUniquePort=True\r\n[Display]\r\nResolution=1760x990\r\nFullScreen=False\r\n");
var values = new Dictionary<string, string>
{
["Render.TextureFiltering"] = "Anisotropic",
["Display.Resolution"] = "1920x1080",
["Display.FullScreen"] = "False",
["Render.MultiPassAlpha"] = "False",
["Camera.Stiffness"] = "0.50",
};
List<string> changed = AcPrefsIni.Apply(ini, values);
Dictionary<string, string> now = AcPrefsIni.Read(ini);
Check(changed.Count == 4 && !changed.Contains("Display.FullScreen"), "only changed keys are reported");
Check(now["Render.TextureFiltering"] == "Anisotropic" && now["Display.Resolution"] == "1920x1080", "keys replaced in place");
Check(now["Render.MultiPassAlpha"] == "False", "missing key added to its section");
Check(now["Camera.Stiffness"] == "0.50", "missing section added");
Check(now["Render.FieldOfView"] == "160.00" && now["Net.ComputeUniquePort"] == "True", "other keys untouched");
string[] lines = File.ReadAllLines(ini);
int renderAt = Array.IndexOf(lines, "[Render]"), netAt = Array.IndexOf(lines, "[Net]");
int mpaAt = Array.IndexOf(lines, "MultiPassAlpha=False");
Check(mpaAt > renderAt && mpaAt < netAt, "added key sits inside [Render]");
DateTime stamp = File.GetLastWriteTimeUtc(ini);
Thread.Sleep(30);
Check(AcPrefsIni.Apply(ini, values).Count == 0 && File.GetLastWriteTimeUtc(ini) == stamp, "no write when nothing changed");
string fresh = Path.Combine(dir, "sub", "UserPreferences.ini");
AcPrefsIni.Apply(fresh, new Dictionary<string, string> { ["Display.Resolution"] = "1280x720" });
Check(AcPrefsIni.Read(fresh)["Display.Resolution"] == "1280x720", "creates a missing file");
// ── Which INI files: the game folder's first (the one this install's clients use) ──
string gameDir = Path.Combine(dir, "game");
Directory.CreateDirectory(gameDir);
string gameIni = Path.Combine(gameDir, "UserPreferences.ini");
Check(AcGraphicsPrefs.IniPaths(gameDir)[0] != gameIni || File.Exists(gameIni), "no game-folder INI: listed only as the fallback");
File.WriteAllText(gameIni, "[Display]\r\nResolution=1760x990\r\n");
List<string> paths = AcGraphicsPrefs.IniPaths(gameDir);
Check(paths.Count >= 1 && paths[0] == gameIni, "game folder's INI comes first when it exists");
Check(paths.TrueForAll(File.Exists), "only existing files listed when the game folder has one");
// ── Every Render setting has sane metadata ──
foreach (AcGraphicsSetting s in AcGraphicsPrefs.RenderSettings)
{
Check(s.Section == "Render" && s.Key.Length > 0 && s.Label.Length > 0, $"{s.Id}: section, key, label");
if (s.Kind == AcGraphicsKind.Choice) Check(s.Choices is { Length: > 1 }, $"{s.Id}: has choices");
if (s.Kind == AcGraphicsKind.Float) Check(s.Max > s.Min && s.Step > 0, $"{s.Id}: slider range");
}
Check(AcGraphicsPrefs.WindowModeIds.Length == AcGraphicsPrefs.WindowModeLabels.Length, "a label per window mode");
// ── Memory risk: Adaptive degrade off with a far draw distance (2026-10-18) ──
Check(AcGraphicsPrefs.MemoryRisk("False", "Extreme", null).StartsWith("Warning"), "risk: degrade off, Extreme scenery");
Check(AcGraphicsPrefs.MemoryRisk("false", null, "High").Length > 0, "risk: degrade off, High landscape (any case)");
Check(AcGraphicsPrefs.MemoryRisk("False", "Medium", "Medium").Length == 0, "no risk: degrade off, Medium distances");
Check(AcGraphicsPrefs.MemoryRisk("True", "Extreme", "Extreme").Length == 0, "no risk: degrade on");
Check(AcGraphicsPrefs.MemoryRisk(null, "Extreme", "Extreme").Length == 0, "no risk: degrade at AC's default");
Check(AcGraphicsPrefs.MemoryRisk("False", null, null).Length == 0, "no risk: distances at AC's default");
foreach (string id in new[] { AcGraphicsPrefs.AutomaticDegradesId, AcGraphicsPrefs.SceneryDrawDistanceId, AcGraphicsPrefs.LandscapeDrawDistanceId })
Check(Array.Exists(AcGraphicsPrefs.RenderSettings, s => s.Id == id), $"{id} is a Render setting");
}
finally
{
try { Directory.Delete(dir, recursive: true); } catch { }
}
Console.WriteLine(failures == 0 ? $"PASS ({checks} checks)" : $"{failures} FAILURE(S) of {checks} checks");
return failures == 0 ? 0 : 1;

View file

@ -22,6 +22,9 @@ internal static class Program
One("Your location is: 0xA9B40019 [84.000 7.100 42.005] 0.0 0.0 0.0 1.0 = 42.1N, 33.6E", 42.1, 33.6, "42.1N, 33.6E");
One("drudges at 42N 33E", 42, 33, "42.0N, 33.0E");
One("0.0N, 101.9W", 0, -101.9, "0.0N, 101.9W");
// Pasted the way players often type them (lowercase, no space): RynthChat makes these links.
One("82.3n,34.2e", 82.3, 34.2, "82.3N, 34.2E");
One("Bob says, \"meet at 82.3n, 34.2e\"", 82.3, 34.2, "82.3N, 34.2E");
// Two in one line, in order.
var two = ChatCoords.Find("from 42.1N, 33.6E to 21.5S, 1.8W");

View file

@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<!--
Offline checks for src\RynthCore.Engine\Compatibility\LazyImportSlotScanner.cs (2026-10-15):
the 2025 ACClient.exe resolves kernel32!CreateFileW into a private slot on first use and opens
its DAT files through it, so the DAT share hook has to find that slot as well as the import
slots. Synthetic images cover the stub shape and the near misses that must not match; when the
2025 client is on this PC (or RYNTH_ACCLIENT points at one) its real slot is checked too.
Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
-->
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<InvariantGlobalization>true</InvariantGlobalization>
<RootNamespace>DatShareSlotTests</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\LazyImportSlotScanner.cs" Link="Engine\LazyImportSlotScanner.cs" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,241 @@
using System.Text;
using RynthCore.Engine.Compatibility;
namespace DatShareSlotTests;
/// <summary>
/// LazyImportSlotScanner: finds the private CreateFileW slot the 2025 ACClient.exe fills on first
/// use. Without it the DAT share hook missed every DAT open and a second client failed with
/// "Can't open the data files" (2026-10-15).
/// </summary>
internal static class Program
{
private static int _checks, _failed;
private static string _case = "";
// Synthetic image layout: headers, .text at 0x1000 (code), .rdata at 0x2000 (strings + slots).
private const uint ImageBase = 0x00400000;
private const uint TextRva = 0x1000;
private const uint DataRva = 0x2000;
private const int ImageSize = 0x3000;
private const uint DllRva = DataRva + 0x10;
private const uint NameRva = DataRva + 0x40;
private const uint SlotRva = DataRva + 0x100;
private static int Main()
{
ReadsSections();
FindsTheStub();
UnresolvedOrResolvedSlotIsFoundTheSame();
RejectsJmpThroughAnotherSlot();
RejectsAnotherDll();
RejectsNameAsTailOfLongerName();
RejectsBrokenStubShape();
OtherFunctionHasNoSlot();
Real2025Client();
Console.WriteLine($"{_checks} check(s), {_failed} failed.");
return _failed == 0 ? 0 : 1;
}
private static void Check(bool ok, string what)
{
_checks++;
if (ok) return;
_failed++;
Console.WriteLine($"[FAIL] {_case}: {what}");
}
// ── synthetic image ──────────────────────────────────────────────────────
/// <summary>A minimal PE32 header with .text and .rdata, plus "kernel32.dll" and the name.</summary>
private static byte[] NewImage(string functionName = "CreateFileW", string dllName = "kernel32.dll")
{
var img = new byte[ImageSize];
const int pe = 0x80;
BitConverter.TryWriteBytes(img.AsSpan(0x3C), pe);
Encoding.ASCII.GetBytes("PE\0\0").CopyTo(img, pe);
BitConverter.TryWriteBytes(img.AsSpan(pe + 6), (ushort)2); // NumberOfSections
BitConverter.TryWriteBytes(img.AsSpan(pe + 20), (ushort)0xE0); // SizeOfOptionalHeader
BitConverter.TryWriteBytes(img.AsSpan(pe + 24), (ushort)0x10B); // PE32
int table = pe + 24 + 0xE0;
WriteSection(img, table, ".text", TextRva, 0x1000, 0x60000020);
WriteSection(img, table + 40, ".rdata", DataRva, 0x1000, 0x40000040);
Encoding.ASCII.GetBytes(dllName + "\0").CopyTo(img, DllRva);
Encoding.ASCII.GetBytes(functionName + "\0").CopyTo(img, NameRva);
return img;
}
private static void WriteSection(byte[] img, int at, string name, uint rva, uint size, uint flags)
{
Encoding.ASCII.GetBytes(name.PadRight(8, '\0')).CopyTo(img, at);
BitConverter.TryWriteBytes(img.AsSpan(at + 8), size);
BitConverter.TryWriteBytes(img.AsSpan(at + 12), rva);
BitConverter.TryWriteBytes(img.AsSpan(at + 16), size);
BitConverter.TryWriteBytes(img.AsSpan(at + 20), rva);
BitConverter.TryWriteBytes(img.AsSpan(at + 36), flags);
}
/// <summary>Writes the stub at <paramref name="stubRva"/>, the same bytes the 2025 client has.</summary>
private static void WriteStub(byte[] img, uint stubRva, uint slotVa, uint nameVa, uint dllVa, uint jmpSlotVa)
{
var code = new List<byte>();
code.Add(0x68); code.AddRange(BitConverter.GetBytes(0x00405BB3u)); // push fallback
code.Add(0xFF); code.Add(0x35); code.AddRange(BitConverter.GetBytes(0x00906788u)); // push [handle cache]
code.Add(0x68); code.AddRange(BitConverter.GetBytes(slotVa));
code.Add(0x68); code.AddRange(BitConverter.GetBytes(nameVa));
code.Add(0x68); code.AddRange(BitConverter.GetBytes(dllVa));
code.Add(0xE8); code.AddRange(BitConverter.GetBytes(0xFFD4CD41u)); // call resolver
code.Add(0xFF); code.Add(0x25); code.AddRange(BitConverter.GetBytes(jmpSlotVa)); // jmp [slot]
code.CopyTo(img, (int)stubRva);
}
private static List<LazyImportSlot> Scan(byte[] img, string function = "CreateFileW") =>
LazyImportSlotScanner.FindSlots(img, ImageBase, LazyImportSlotScanner.ReadSections(img), "kernel32.dll", function);
// ── cases ────────────────────────────────────────────────────────────────
private static void ReadsSections()
{
_case = "sections";
var s = LazyImportSlotScanner.ReadSections(NewImage());
Check(s.Count == 2, $"two sections, got {s.Count}");
Check(s.Count == 2 && s[0].Name == ".text" && s[0].Executable && s[0].Rva == TextRva, ".text is code at 0x1000");
Check(s.Count == 2 && s[1].Name == ".rdata" && !s[1].Executable && s[1].Rva == DataRva, ".rdata is data at 0x2000");
Check(LazyImportSlotScanner.ReadSections(new byte[0x100]).Count == 0, "no PE signature: nothing");
}
private static void FindsTheStub()
{
_case = "stub";
var img = NewImage();
WriteStub(img, TextRva + 0x20, ImageBase + SlotRva, ImageBase + NameRva, ImageBase + DllRva, ImageBase + SlotRva);
var found = Scan(img);
Check(found.Count == 1, $"one slot, got {found.Count}");
Check(found.Count == 1 && found[0].SlotVa == ImageBase + SlotRva, $"slot 0x{ImageBase + SlotRva:X8}");
Check(found.Count == 1 && found[0].StubVa == ImageBase + TextRva + 0x20, $"stub at 0x{ImageBase + TextRva + 0x20:X8}, got 0x{(found.Count == 1 ? found[0].StubVa : 0):X8}");
}
private static void UnresolvedOrResolvedSlotIsFoundTheSame()
{
_case = "slot contents";
var img = NewImage();
WriteStub(img, TextRva + 0x20, ImageBase + SlotRva, ImageBase + NameRva, ImageBase + DllRva, ImageBase + SlotRva);
BitConverter.TryWriteBytes(img.AsSpan((int)SlotRva), ImageBase + TextRva + 0x20); // still points at its stub
Check(Scan(img).Count == 1, "unresolved (slot points at the stub)");
BitConverter.TryWriteBytes(img.AsSpan((int)SlotRva), 0x76ACEA10u); // resolved to kernel32
Check(Scan(img).Count == 1, "resolved (slot points into kernel32)");
}
private static void RejectsJmpThroughAnotherSlot()
{
_case = "jmp slot";
var img = NewImage();
WriteStub(img, TextRva + 0x20, ImageBase + SlotRva, ImageBase + NameRva, ImageBase + DllRva, ImageBase + SlotRva + 8);
Check(Scan(img).Count == 0, "the jmp must go through the slot the stub fills");
}
private static void RejectsAnotherDll()
{
_case = "dll";
var img = NewImage(dllName: "user32.dll");
WriteStub(img, TextRva + 0x20, ImageBase + SlotRva, ImageBase + NameRva, ImageBase + DllRva, ImageBase + SlotRva);
Check(Scan(img).Count == 0, "a stub resolving from user32.dll is not kernel32's CreateFileW");
var upper = NewImage(dllName: "KERNEL32.DLL");
WriteStub(upper, TextRva + 0x20, ImageBase + SlotRva, ImageBase + NameRva, ImageBase + DllRva, ImageBase + SlotRva);
Check(Scan(upper).Count == 1, "the DLL name matches in any case");
}
private static void RejectsNameAsTailOfLongerName()
{
_case = "longer name";
var img = NewImage(functionName: "MyCreateFileW");
// Points at the "CreateFileW" tail of "MyCreateFileW".
WriteStub(img, TextRva + 0x20, ImageBase + SlotRva, ImageBase + NameRva + 2, ImageBase + DllRva, ImageBase + SlotRva);
Check(Scan(img).Count == 0, "\"MyCreateFileW\" is not CreateFileW");
}
private static void RejectsBrokenStubShape()
{
_case = "shape";
var img = NewImage();
WriteStub(img, TextRva + 0x20, ImageBase + SlotRva, ImageBase + NameRva, ImageBase + DllRva, ImageBase + SlotRva);
img[TextRva + 0x20 + 26] = 0x90; // the call becomes a nop
Check(Scan(img).Count == 0, "no call to the resolver: not a stub");
var outside = NewImage();
WriteStub(outside, TextRva + 0x20, 0x12345678, ImageBase + NameRva, ImageBase + DllRva, 0x12345678);
Check(Scan(outside).Count == 0, "a slot outside the image is never written");
var atStart = NewImage();
WriteStub(atStart, TextRva + 0x20, ImageBase + SlotRva, ImageBase + NameRva, ImageBase + DllRva, ImageBase + SlotRva);
// A lone push of the name at the very start of .text has no stub around it.
atStart[TextRva] = 0x68;
BitConverter.TryWriteBytes(atStart.AsSpan((int)TextRva + 1), ImageBase + NameRva);
Check(Scan(atStart).Count == 1, "a lone push of the name is skipped, the real stub still found");
}
private static void OtherFunctionHasNoSlot()
{
_case = "other function";
var img = NewImage();
WriteStub(img, TextRva + 0x20, ImageBase + SlotRva, ImageBase + NameRva, ImageBase + DllRva, ImageBase + SlotRva);
Check(Scan(img, "CreateFileA").Count == 0, "only the named function's slot is returned");
}
// ── the real client ──────────────────────────────────────────────────────
private static void Real2025Client()
{
_case = "ACClient.exe 0.0.11.6096";
string? path = Environment.GetEnvironmentVariable("RYNTH_ACCLIENT");
if (string.IsNullOrEmpty(path))
path = @"C:\Turbine\Asheron's Call-ryn\ACClient.exe";
if (!File.Exists(path))
{
Console.WriteLine($" skip: {path} not found (set RYNTH_ACCLIENT to check a client)");
return;
}
byte[] mapped = MapImage(File.ReadAllBytes(path), out uint imageBase);
var sections = LazyImportSlotScanner.ReadSections(mapped);
var w = LazyImportSlotScanner.FindSlots(mapped, imageBase, sections, "kernel32.dll", "CreateFileW");
var a = LazyImportSlotScanner.FindSlots(mapped, imageBase, sections, "kernel32.dll", "CreateFileA");
Console.WriteLine($" {path}: CreateFileW slots {string.Join(", ", w.Select(s => $"0x{s.SlotVa:X8} (stub 0x{s.StubVa:X8})"))}; CreateFileA slots {a.Count}");
// Read from the running client on 2026-10-15: slot 0x00837374 held kernel32!CreateFileW.
if (imageBase == 0x00400000 && FileVersion(path) == "00.00.11.6096")
{
Check(w.Count == 1 && w[0].SlotVa == 0x00837374, "the CreateFileW slot is 0x00837374");
Check(w.Count == 1 && w[0].StubVa == 0x006B8D00, "filled by the stub at 0x006B8D00");
Check(a.Count == 0, "CreateFileA is a normal import, no private slot");
}
}
private static string FileVersion(string path) =>
System.Diagnostics.FileVersionInfo.GetVersionInfo(path).FileVersion ?? "";
/// <summary>Lays a PE file out the way the loader maps it (headers, then each section at its RVA).</summary>
private static byte[] MapImage(byte[] file, out uint imageBase)
{
int pe = BitConverter.ToInt32(file, 0x3C);
int opt = pe + 24;
imageBase = BitConverter.ToUInt32(file, opt + 28);
uint sizeOfImage = BitConverter.ToUInt32(file, opt + 56);
uint sizeOfHeaders = BitConverter.ToUInt32(file, opt + 60);
var img = new byte[sizeOfImage];
Array.Copy(file, img, Math.Min(sizeOfHeaders, (uint)file.Length));
int count = BitConverter.ToUInt16(file, pe + 6);
int table = opt + BitConverter.ToUInt16(file, pe + 20);
for (int i = 0; i < count; i++)
{
int h = table + 40 * i;
uint rva = BitConverter.ToUInt32(file, h + 12);
uint rawSize = BitConverter.ToUInt32(file, h + 16);
uint raw = BitConverter.ToUInt32(file, h + 20);
uint n = Math.Min(rawSize, Math.Min(sizeOfImage - rva, (uint)file.Length - raw));
Array.Copy(file, raw, img, rva, n);
}
return img;
}
}

View file

@ -186,14 +186,18 @@ namespace EngineSettingsTests
Eq(after.GetProperty("SomeNumber").GetRawText(), "1.50", "a number keeps its exact text");
Eq(after.GetProperty("Unicode").GetString(), "Dereth \u00e9 \u2014", "non-ASCII text intact");
// The engine's own keys: written from memory as before.
// The engine's own keys: only the one changed (DisabledUiHooks) is written; every other
// key keeps exactly what the file had (since 2026-10-17: another client's change to
// those must not be overwritten with this client's stale copy).
Eq(string.Join(",", after.GetProperty("DisabledUiHooks").EnumerateArray().Select(e => e.GetString())), "StartTooltip", "DisabledUiHooks written");
Eq(Raw(after.GetProperty("PluginPaths")), Raw(before.GetProperty("PluginPaths")), "PluginPaths kept");
Eq(after.GetProperty("EnableImGuiShell").GetBoolean(), false, "EnableImGuiShell kept (read, written back)");
Eq(after.GetProperty("EnableImGuiShell").GetBoolean(), false, "EnableImGuiShell kept");
Eq(after.GetProperty("DecalBridge").GetString(), "On", "DecalBridge On kept");
Check(!after.TryGetProperty("DecalInGameImGui", out _), "DecalInGameImGui at its default is left out, as before");
foreach (JsonProperty p in before.EnumerateObject())
if (p.Name != "DisabledUiHooks")
Check(after.TryGetProperty(p.Name, out JsonElement kept) && JsonElement.DeepEquals(kept, p.Value), $"unchanged key {p.Name} keeps the file's value");
foreach (string key in new[] { "EnablePlugins", "EnableDatShareHook", "EnableAvaloniaOverlay", "EnableD3D9Hook", "EnableEngine", "EngineHookCount", "EnableHangMinidump", "PreventIdleLogoff" })
Check(after.TryGetProperty(key, out _), $"owned key {key} written as before");
Check(after.TryGetProperty(key, out _) == before.TryGetProperty(key, out _), $"owned key {key} not added or dropped by an unrelated save");
// No key twice.
var names = after.EnumerateObject().Select(p => p.Name).ToList();
@ -207,6 +211,17 @@ namespace EngineSettingsTests
Eq(after.GetProperty("EnableImGuiBackend").GetBoolean(), false, "EnableImGuiBackend saved");
Check(after.TryGetProperty("EnableDcompOverlay", out _) && after.TryGetProperty("LauncherWindow", out _), "launcher keys survive a second save");
Eq(after.GetProperty("DisabledUiHooks").GetArrayLength(), 1, "first save's DisabledUiHooks kept");
// Two clients: one saved EnableImGuiBackend=false above; "another client" now turns the
// shell back on in the file. A later save of a different key here must not put the
// stale EnableImGuiShell back (the last-writer-wins reset of 2026-10-16).
var doc = System.Text.Json.Nodes.JsonNode.Parse(File.ReadAllText(path))!.AsObject();
doc["EnableImGuiShell"] = true;
File.WriteAllText(path, doc.ToJsonString());
(exit, output) = RunChild(path, "hook-off", "AnotherHook");
Eq(exit, 0, "third child exit code (" + output.Trim() + ")");
after = ReadJson(path);
Eq(after.GetProperty("EnableImGuiShell").GetBoolean(), true, "another client's EnableImGuiShell survives this client's save");
}
private static void SaveRoundTripsOwnedKeys()

View file

@ -29,6 +29,7 @@
<Compile Include="..\..\src\RynthCore.App\LaunchAccountProfile.cs" Link="App\LaunchAccountProfile.cs" />
<Compile Include="..\..\src\RynthCore.App\AccountPasswordProtection.cs" Link="App\AccountPasswordProtection.cs" />
<Compile Include="..\..\src\RynthCore.App\LaunchServerProfile.cs" Link="App\LaunchServerProfile.cs" />
<Compile Include="..\..\src\RynthCore.App\KnownServerCatalog.cs" Link="App\KnownServerCatalog.cs" />
<Compile Include="..\..\src\RynthCore.App\AcLaunchArgumentBuilder.cs" Link="App\AcLaunchArgumentBuilder.cs" />
<Compile Include="..\..\src\RynthCore.App\FirstLoginRules.cs" Link="App\FirstLoginRules.cs" />
<Compile Include="..\..\src\RynthCore.App\UserPrefsSwapRecovery.cs" Link="App\UserPrefsSwapRecovery.cs" />

View file

@ -292,6 +292,37 @@ internal static class Program
CheckNoPlainText("LEAK-CHECK-PW");
});
Scenario("known servers: picking one fills the profile, saved profiles find theirs", root, () =>
{
var all = KnownServerCatalog.All;
Check(all.Count == 17, $"17 known servers (16 + ILT), got {all.Count}");
Check(all.Select(s => s.Id).Distinct(StringComparer.OrdinalIgnoreCase).Count() == all.Count, "ids unique");
Check(all.Select(s => s.Host).Distinct(StringComparer.OrdinalIgnoreCase).Count() == all.Count, "hosts unique");
Check(all.All(s => s.Port is > 0 and < 65536 && s.PluginName.StartsWith("Rynth", StringComparison.Ordinal)),
"every entry has a port and a Rynth plugin");
Check(all.Select(s => s.Name).SequenceEqual(all.Select(s => s.Name).OrderBy(n => n, StringComparer.OrdinalIgnoreCase)),
"listed by name");
KnownServer? reef = KnownServerCatalog.FindById("REEFCULL");
Check(reef?.Emulator == AcEmulatorKind.Gdle, "Reefcull is GDLE (id lookup ignores case)");
Check(KnownServerCatalog.FindById("portalstorm")?.Port == 9020, "PortalStorm uses 9020");
var p = new LaunchServerProfile { Id = "keep", Alias = "Main", RodatEnabled = true, Host = "x", Port = 1 };
KnownServerCatalog.ApplyTo(KnownServerCatalog.FindById("ilt")!, p);
Check(p.Name == "Infinite Leaftide" && p.ConnectionString == "game.infiniteleaftide.online:9000" && p.Emulator == AcEmulatorKind.Ace,
"ILT fills name, host, port, emulator: " + p.ConnectionString);
Check(p.Id == "keep" && p.Alias == "Main" && p.RodatEnabled, "id, alias and Rodat kept");
Check(KnownServerCatalog.FindByHost("PLAY.COLDEVE.AC.")?.Id == "coldeve", "exact host (case, trailing dot)");
Check(KnownServerCatalog.FindByHost("infiniteleaftide.online")?.Id == "ilt", "ILT's parent domain finds ILT");
Check(KnownServerCatalog.FindByHost("aelrynth.com")?.Id == "aelrynth", "Aelrynth");
Check(KnownServerCatalog.FindByHost("other.ddns.net") == null, "a shared dynamic-DNS domain matches nothing");
Check(KnownServerCatalog.FindByHost("harvestbud.gdleac.com") == null, "Reefcull's shared host domain isn't Reefcull");
Check(KnownServerCatalog.FindByHost("172.111.230.12") == null, "an IP matches only itself");
Check(KnownServerCatalog.FindByHost("172.111.230.127")?.Id == "frostace", "FrostACE by IP");
Check(KnownServerCatalog.FindByHost("") == null && KnownServerCatalog.FindByHost(null) == null, "empty host");
});
// ── First Login dialog rules (a new server: no password, no characters yet) ──
Scenario("first login on a new server", root, () =>
{
@ -382,50 +413,6 @@ internal static class Program
Check(!File.Exists(swap.LivePath), "live file removed so the game writes its defaults");
});
// ── First Login dialog rules (a new server: no password, no characters yet) ──
Scenario("first login on a new server", root, () =>
{
var withPw = new LaunchAccountProfile { Id = "ilt", AccountName = "silentkelpie" };
withPw.SetPassword(Pw);
var noPwSame = new LaunchAccountProfile { Id = "other", AccountName = "SilentKelpie" };
var conquest = new LaunchAccountProfile { Id = "new", AccountName = "SK", CharacterName = LaunchAccountProfile.NoneOption };
var all = new List<LaunchAccountProfile> { withPw, noPwSame, conquest };
Check(FirstLoginRules.KnownAccountNames(all, "new").SequenceEqual(new[] { "silentkelpie" }),
"known names: the others, distinct ignoring case, not this profile's own");
Check(FirstLoginRules.SavedPasswordSource(all, "SILENTKELPIE", "new")?.Id == "ilt",
"the same name with a saved password can be reused (case ignored)");
Check(FirstLoginRules.SavedPasswordSource(all, "SK", "new") == null, "a new name has none to reuse");
Check(FirstLoginRules.SavedPasswordSource(all, "silentkelpie", "ilt") == null, "never the profile itself");
var copy = new LaunchAccountProfile { AccountName = "silentkelpie" };
copy.CopyPasswordFrom(withPw);
Check(copy.PasswordProtected == withPw.PasswordProtected && copy.TryGetPasswordForLaunch(out string reused, out _) && reused == Pw,
"reuse copies the encrypted blob, and it decrypts");
var none = new List<string>();
List<string> firstChoices = FirstLoginRules.LoginChoices(none, conquest.CharacterName);
Check(firstChoices.SequenceEqual(new[] { FirstLoginRules.StopAtCharacterSelect }),
"no characters yet: only stop at character select (the old (None) isn't listed)");
Check(FirstLoginRules.CharacterNameFor(FirstLoginRules.StopAtCharacterSelect, none) == "",
"stop with none known saves \"\" so the first character created is picked next time");
var chars = new List<string> { "Alpha", "Beta" };
Check(FirstLoginRules.LoginChoices(chars, "Gamma").SequenceEqual(new[] { FirstLoginRules.StopAtCharacterSelect, "Gamma", "Alpha", "Beta" }),
"several characters: all listed, the saved one kept even if not seen yet");
Check(FirstLoginRules.CharacterNameFor("Beta", chars) == "Beta", "picking a character saves it");
Check(FirstLoginRules.CharacterNameFor(FirstLoginRules.StopAtCharacterSelect, chars) == LaunchAccountProfile.NoneOption,
"stop with characters known saves the explicit (None)");
Check(FirstLoginRules.Problem("SK", "", "", false, AcEmulatorKind.Ace)?.StartsWith("Enter the password") == true, "a password is required");
Check(FirstLoginRules.Problem("SK", "a", "b", false, AcEmulatorKind.Ace)?.Contains("don't match") == true, "the confirmation must match");
Check(FirstLoginRules.Problem("SK", "pw", "pw", false, AcEmulatorKind.Ace) == null, "name + matching password: ready");
Check(FirstLoginRules.Problem("silentkelpie", "", "", true, AcEmulatorKind.Ace) == null, "reusing a saved password needs no typing");
Check(FirstLoginRules.Problem("a:b", "pw", "pw", false, AcEmulatorKind.Gdle) != null, "GDLE name with a colon refused");
Check(FirstLoginRules.Problem("", "pw", "pw", false, AcEmulatorKind.Ace) != null, "a name is required");
});
// A kill while createdump.exe / WerFault.exe writes a client's crash dump cuts the dump
// short; the launcher's kills wait for the writer, then Grace more, at most MaxHold.
Scenario("crash dump writers: which client a command line names", root, () =>

View file

@ -54,7 +54,7 @@ internal static class Program
Run(nameof(ServerBlockRejectsBadIds), ServerBlockRejectsBadIds);
Run(nameof(ServerHostMatching), ServerHostMatching);
Run(nameof(ServerGateKeepsOnlyTheHostsPlugin), ServerGateKeepsOnlyTheHostsPlugin);
Run(nameof(ServerGateUnclaimedHost), ServerGateUnclaimedHost);
Run(nameof(ServerGateFailsOpen), ServerGateFailsOpen);
Run(nameof(ServerGatePlanFromFiles), ServerGatePlanFromFiles);
Run(nameof(SdkApiVersionCannotDrift), SdkApiVersionCannotDrift);
Run(nameof(TrainingStructsMirror), TrainingStructsMirror);
@ -519,7 +519,7 @@ internal static class Program
Eq(PluginManifestGate.SelectServerPlugins(list, "leafdawn.hopto.org", true, log).Count, 0, "LoadAllServerPlugins keeps every one");
}
private static void ServerGateUnclaimedHost()
private static void ServerGateFailsOpen()
{
var list = new List<PluginCandidate>
{
@ -528,7 +528,7 @@ internal static class Program
};
var log = new List<string>();
Eq(PluginManifestGate.SelectServerPlugins(list, "", false, log).Count, 0, "no connect host: all load");
Eq(PluginManifestGate.SelectServerPlugins(list, "10.0.0.5", false, log).Count, 2, "a host nobody lists: none load now (late load by world name or a pick)");
Eq(PluginManifestGate.SelectServerPlugins(list, "10.0.0.5", false, log).Count, 0, "a host nobody lists: all load");
Check(log.Any(l => l.Contains("none lists host 10.0.0.5")), "said why");
}
@ -591,7 +591,8 @@ internal static class Program
Eq((int)Marshal.OffsetOf<RynthCore.PluginSdk.TrainingEntryNative>(f.Name), (int)Marshal.OffsetOf<RynthCore.Engine.Plugins.TrainingEntryNative>(f.Name), "TrainingEntryNative." + f.Name + " offset");
Eq(RynthCore.PluginSdk.TrainingInfoFlags.Busy, RynthCore.Engine.Plugins.TrainingInfoFlags.Busy, "info flag bits");
Eq(RynthCore.PluginSdk.TrainingEntryFlags.Trainable, RynthCore.Engine.Plugins.TrainingEntryFlags.Trainable, "entry flag bits");
// The three v79 slots follow v78's, then v80's two and v81's GetMergeStackResultFn (v82-v85 follow).
// The three v79 slots follow v78's, then v80's two and v81's GetMergeStackResultFn (v82's one, v83's two,
// v84's one, v85's two and v86's one come after: 7 slots).
var names = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).SkipLast(7).TakeLast(6).ToArray();
Check(names.SequenceEqual(new[] { "GetTrainingInfoFn", "RaiseFn", "TrainSkillFn", "GetContainerOrderFn", "PutItemInContainerFn", "GetMergeStackResultFn" }),
"v79, v80 then v81 slots last: " + string.Join(",", names));
@ -600,24 +601,26 @@ internal static class Program
}
// v80: GetContainerOrder and PutItemInContainer come right before v81's slot, engine and SDK alike;
// v81: GetMergeStackResult, then v82: SalvageDirect, v83's two and v84's GetObjectProperties last. The whole table has the same field names in the same
// order on both sides, and the same size.
// v81: GetMergeStackResult, v82: SalvageDirect, v83: the ghost-creature pair, v84: GetObjectProperties,
// v85: the confirmation pair, v86: GetServerStateJson last.
// The whole table has the same field names in the same order on both sides, and the same size.
private static void ContainerOrderSlots()
{
var names = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).ToArray();
var sdkNames = typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).ToArray();
var allNames = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).ToArray();
// v86: GetServerStateJson ends the table; the checks below count back from the v85 slots before it.
Check(allNames.Last() == "GetServerStateJsonFn", "v86 slot last: " + allNames.Last());
var names = allNames.SkipLast(1).ToArray();
var sdkNames = typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).SkipLast(1).ToArray();
// v81's GetMergeStackResultFn follows v80's two slots.
Check(names.SkipLast(8).TakeLast(2).SequenceEqual(new[] { "GetContainerOrderFn", "PutItemInContainerFn" }), "v80 slots before v81's to v85's: " + string.Join(",", names.SkipLast(8).TakeLast(2)));
Check(sdkNames.SkipLast(8).TakeLast(2).SequenceEqual(names.SkipLast(8).TakeLast(2)), "SDK v80 slots in the same order");
Check(names.SkipLast(6).Last() == "SalvageDirectFn", "v82 slot before v83's");
// v83: GetObjectServerAge and RemoveClientObject (ghost creatures), then v84's slot.
Check(names.SkipLast(4).TakeLast(2).SequenceEqual(new[] { "GetObjectServerAgeFn", "RemoveClientObjectFn" }), "v83 slots before v84's: " + string.Join(",", names.SkipLast(4).TakeLast(2)));
// v84: GetObjectProperties (every property of an object, /ub propertydump), then v85's two.
Check(names.SkipLast(3).Last() == "GetObjectPropertiesFn", "v84 slot before v85's: " + names.SkipLast(3).Last());
// v85: ArmConfirmation and GetLastConfirmation (the server's yes/no prompts), then v86's slot.
Check(names.SkipLast(1).TakeLast(2).SequenceEqual(new[] { "ArmConfirmationFn", "GetLastConfirmationFn" }), "v85 slots before v86's: " + string.Join(",", names.SkipLast(1).TakeLast(2)));
// v86: GetServerStateJson ends the table (which server this is, for every plugin).
Check(names.Last() == "GetServerStateJsonFn", "v86 slot last: " + names.Last());
Check(names.SkipLast(7).TakeLast(2).SequenceEqual(new[] { "GetContainerOrderFn", "PutItemInContainerFn" }), "v80 slots before v81's to v85's: " + string.Join(",", names.SkipLast(7).TakeLast(2)));
Check(sdkNames.SkipLast(7).TakeLast(2).SequenceEqual(names.SkipLast(7).TakeLast(2)), "SDK v80 slots in the same order");
Check(names.SkipLast(5).Last() == "SalvageDirectFn", "v82 slot before v83's");
// v83: GetObjectServerAge and RemoveClientObject (ghost creatures).
Check(names.SkipLast(3).TakeLast(2).SequenceEqual(new[] { "GetObjectServerAgeFn", "RemoveClientObjectFn" }), "v83 slots before v84's: " + string.Join(",", names.SkipLast(3).TakeLast(2)));
// v84: GetObjectProperties (every property of an object, /ub propertydump).
Check(names.SkipLast(2).Last() == "GetObjectPropertiesFn", "v84 slot before v85's: " + names.SkipLast(2).Last());
// v85: ArmConfirmation and GetLastConfirmation (answer the craft-chance prompt), before v86's slot.
Check(names.TakeLast(2).SequenceEqual(new[] { "ArmConfirmationFn", "GetLastConfirmationFn" }), "v85 slots before v86's: " + string.Join(",", names.TakeLast(2)));
Check(typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).SequenceEqual(typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name)), "SDK table has the engine's slots in the same order");
Eq(Marshal.SizeOf<RynthCore.PluginSdk.RynthCoreApiNative>(), Marshal.SizeOf<RynthCore.Engine.Plugins.RynthCoreAPI>(), "SDK table size = engine table size");
Eq((int)Marshal.OffsetOf<RynthCore.PluginSdk.RynthCoreApiNative>("PutItemInContainerFn"),

View file

@ -28,6 +28,9 @@ internal static class Program
SelectionCurrentPick();
SelectionActiveAndOwner();
StateJson();
RatesRises();
RatesBank();
RatesChat();
Console.WriteLine();
Console.WriteLine($"{_checks - _failed}/{_checks} checks passed.");
@ -325,19 +328,6 @@ internal static class Program
Check(load.Count == 1 && load[0] == "coldeve", "only the server forced On asks for its plugin");
forces["coldeve"] = ServerForce.Off;
Check(NotLoadedServers.ForcedOn(notLoaded, Force).Count == 0, "Off loads nothing");
// The connect host is nobody's (none load at start); the world name the server announces
// loads its plugin late, unless that server is forced Off.
var byWorld = new[]
{
new NotLoadedServer("frost", "Frosthaven", "RynthFrostACE", new[] { "Frosthaven*" }),
new NotLoadedServer("coldeve", "Coldeve", "RynthColdeve", new[] { "Coldeve" }),
};
Check(NotLoadedServers.ToLoad(byWorld, Force, null).Count == 0, "before login: nothing loads by world name");
var hit = NotLoadedServers.ToLoad(byWorld, Force, "Frosthaven PvE");
Check(hit.Count == 1 && hit[0] == "frost", "the announced world name loads its server's plugin");
Check(NotLoadedServers.ToLoad(byWorld, Force, "Coldeve").Count == 0, "a server forced Off isn't loaded by its world name");
Check(NotLoadedServers.ToLoad(byWorld, Force, "Somewhere Else").Count == 0, "a world nobody lists loads nothing");
}
private static void SelectionCurrentPick()
@ -434,6 +424,79 @@ internal static class Program
Check(System.Text.Encoding.UTF8.GetString(big, 0, length) == json && big[length] == 0, "fits: text and NUL");
}
// ── Session rates (status feed / Session Stats) ────────────────────
private static readonly DateTime T0 = new(2026, 10, 13, 12, 0, 0, DateTimeKind.Utc);
/// <summary>XP and character luminance: only rises count, the first read is the baseline.</summary>
private static void RatesRises()
{
Case("rates rises");
var r = new SessionRates();
Check(r.View(T0).Xp == 0 && r.View(T0).Seconds == 0, "zeros before the first sample");
r.Sample(0, new SessionRatesSample(100, 5, null, null, null), T0);
Check(r.Character == 0, "character 0 is ignored");
r.Sample(7, new SessionRatesSample(1_000, 50, null, null, null), T0);
Check(r.View(T0).Xp == 0 && r.View(T0).Lum == 0, "first read is the baseline");
r.Sample(7, new SessionRatesSample(4_000, 80, null, null, null), T0.AddMinutes(30));
r.Sample(7, new SessionRatesSample(4_000, 10, null, null, null), T0.AddMinutes(45)); // spent 70 lum
r.Sample(7, new SessionRatesSample(5_000, 30, null, null, null), T0.AddHours(1));
SessionRatesView v = r.View(T0.AddHours(1));
Check(v.Xp == 4_000, "xp is the sum of rises: " + v.Xp);
Check(v.Lum == 50, "a spend moves the baseline, it doesn't take earnings back: " + v.Lum);
Check(Math.Abs(v.XpPerHour - 4_000) < 0.001 && Math.Abs(v.LumPerHour - 50) < 0.001, "per hour over one hour");
Check(r.View(T0).Seconds == 1, "a session is at least one second long");
r.Sample(8, new SessionRatesSample(9_000, 1, null, null, null), T0.AddHours(2));
v = r.View(T0.AddHours(2));
Check(r.Character == 8 && v.Xp == 0 && v.Lum == 0 && v.StartUtc == T0.AddHours(2), "a new character starts a new session");
}
/// <summary>ACECustom's bank (9005) and Aelrynth's banked (9102) / drawn (9103) totals.</summary>
private static void RatesBank()
{
Case("rates bank");
var r = new SessionRates();
r.Sample(1, new SessionRatesSample(null, 100, 1_000, null, null), T0);
r.Sample(1, new SessionRatesSample(null, 100, 1_500, null, null), T0.AddMinutes(1));
Check(r.View(T0.AddMinutes(1)).Lum == 500, "a bank rise is income");
r.Sample(1, new SessionRatesSample(null, 400, 1_200, null, null), T0.AddMinutes(2));
Check(r.View(T0.AddMinutes(2)).Lum == 500, "a withdrawal (bank down, character up) isn't income once the bank is tracked");
var a = new SessionRates();
a.Sample(2, new SessionRatesSample(null, 10, null, 0, 0), T0);
a.Sample(2, new SessionRatesSample(null, 10, null, 300, 0), T0.AddMinutes(1));
Check(a.View(T0.AddMinutes(1)).Lum == 300, "auto-banked luminance was earned");
a.Sample(2, new SessionRatesSample(null, 210, null, 300, 200), T0.AddMinutes(2));
Check(a.View(T0.AddMinutes(2)).Lum == 300, "drawn luminance landing on the character isn't earned");
a.Sample(2, new SessionRatesSample(null, 260, null, 300, 200), T0.AddMinutes(3));
Check(a.View(T0.AddMinutes(3)).Lum == 350, "a real character rise after a draw still counts");
}
/// <summary>Deposits and incoming transfers seen in chat aren't income; the marker expires.</summary>
private static void RatesChat()
{
Case("rates chat");
Check(SessionRates.TryMovedIntoBank("Deposited 1,234 luminance into your bank.", out long n) && n == 1_234, "a deposit line");
Check(SessionRates.TryMovedIntoBank(" Received 50 luminance from Kelpie.", out n) && n == 50, "a transfer line, padded");
Check(!SessionRates.TryMovedIntoBank("Kelpie tells you, \"Deposited 5 luminance\"", out _), "a quoted line isn't a deposit");
Check(!SessionRates.TryMovedIntoBank("Deposited luminance", out _) && !SessionRates.TryMovedIntoBank(null, out _), "no amount, null");
Check(!SessionRates.TryMovedIntoBank("Deposited 99999999999999999999 luminance", out _), "overflow is rejected");
var r = new SessionRates();
r.Sample(1, new SessionRatesSample(null, 1_000, 0, null, null), T0);
r.OnChat("Deposited 600 luminance", T0.AddSeconds(5));
r.Sample(1, new SessionRatesSample(null, 400, 600, null, null), T0.AddSeconds(6));
Check(r.View(T0.AddSeconds(6)).Lum == 0, "a deposit is moved money");
r.Sample(1, new SessionRatesSample(null, 400, 700, null, null), T0.AddSeconds(7));
Check(r.View(T0.AddSeconds(7)).Lum == 100, "the next bank rise after the deposit is income");
r.OnChat("Received 50 luminance from Someone", T0.AddSeconds(10));
r.Sample(1, new SessionRatesSample(null, 400, 800, null, null), T0.AddSeconds(100));
Check(r.View(T0.AddSeconds(100)).Lum == 200, "the marker expires after 60 seconds");
}
// ── Harness ────────────────────────────────────────────────────────
private static void Case(string name)

View file

@ -31,6 +31,7 @@
<!-- Installed server plugins the connect host left out: listed in the picker, loaded when forced On. -->
<Compile Include="..\..\src\RynthCore.Engine\UI\Sections\NotLoadedServers.cs" Link="Engine\NotLoadedServers.cs" />
<!-- The status feed's / Session Stats' XP and luminance session formula (pure). -->
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\SessionRates.cs" Link="Engine\SessionRates.cs" />
</ItemGroup>
</Project>