Snapshot for release 2026.10.31.3 (internal 136d99a)

This commit is contained in:
Tom Bohar 2026-10-31 19:26:44 -04:00
commit 057bb66426
13 changed files with 3674 additions and 0 deletions

View file

@ -0,0 +1,30 @@
<Project Sdk="Microsoft.NET.Sdk">
<!--
Offline checks for the launcher's Headless window, its pure part (src\RynthCore.App\HeadlessMonitor.cs,
compiled in): parsing status files into what the window shows (Samples\ are two live headless status
files with every name replaced by a placeholder and neutral chat), the stale and gone rules and the
status dot, the list's keep-the-last-good rule, the chat filter (combat spam 21/22 hidden) and the
new-lines diff, the command file (name, JSON, atomic write), the opos to map coordinates
conversion, finding and tailing a character's log.
Works in a temp folder, never in C:\Games or %APPDATA%\RynthCore.
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>HeadlessWindowTests</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\src\RynthCore.App\HeadlessMonitor.cs" Link="App\HeadlessMonitor.cs" />
</ItemGroup>
<ItemGroup>
<None Include="Samples\*.json" CopyToOutputDirectory="PreserveNewest" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,445 @@
using System.Text.Json;
using System.Text.Json.Nodes;
using RynthCore.App;
namespace HeadlessWindowTests;
/// <summary>
/// The launcher's Headless window, its pure part (HeadlessMonitor.cs). Samples\status-outdoor.json and
/// status-indoor.json are live headless status files (rynth-headless 2026.10.31.1) with the names, the
/// profile lists and the chat replaced; every field the window reads keeps its real shape.
/// </summary>
internal static class Program
{
private static int _checks, _failed;
private static readonly DateTime SampleTs = new(2026, 10, 31, 22, 0, 0, DateTimeKind.Utc);
private static int Main()
{
string root = Path.Combine(Path.GetTempPath(), "rc-headless-window-tests-" + Guid.NewGuid().ToString("N"));
Directory.CreateDirectory(root);
try
{
Section("parse: outdoor sample", ParseOutdoor);
Section("parse: indoor sample", ParseIndoor);
Section("parse: loading, game client, broken files", ParseOthers);
Section("stale and gone rules, status dot", Rules);
Section("roster keeps the last good status", Roster);
Section("chat filter and new lines", Chat);
Section("command box rules", CommandRules);
Section("command file: name, JSON, atomic write", () => CommandFile(root));
Section("opos to map coordinates", Coords);
Section("formatting", Formatting);
Section("scan a status folder", () => Scan(root));
Section("find and tail a log", () => Logs(root));
}
catch (Exception ex)
{
_failed++;
Console.WriteLine($" FAIL: unexpected {ex.GetType().Name}: {ex.Message}\n{ex.StackTrace}");
}
finally
{
try { Directory.Delete(root, recursive: true); } catch { }
}
Console.WriteLine(_failed == 0 ? $"PASS ({_checks} checks)" : $"FAIL ({_failed} of {_checks} checks)");
return _failed == 0 ? 0 : 1;
}
// ── samples ─────────────────────────────────────────────────────────────
private static string SamplePath(string name) => Path.Combine(AppContext.BaseDirectory, "Samples", name);
private static string Sample(string name) => File.ReadAllText(SamplePath(name));
private static HeadlessCharacterStatus Parse(string json)
{
Check(HeadlessStatusParser.TryParse(json, DateTime.UnixEpoch, out HeadlessCharacterStatus s), "parses");
return s;
}
/// <summary>A sample with some fields changed (bot fields with "bot." in front).</summary>
private static string Edit(string name, params (string Path, JsonNode? Value)[] edits)
{
JsonNode root = JsonNode.Parse(Sample(name))!;
foreach (var (path, value) in edits)
{
if (path.StartsWith("bot.", StringComparison.Ordinal))
root["bot"]![path[4..]] = value?.DeepClone();
else
root[path] = value?.DeepClone();
}
return root.ToJsonString();
}
private static void ParseOutdoor()
{
HeadlessCharacterStatus s = Parse(Sample("status-outdoor.json"));
Check(s.Id == 1006434801, "id from pid");
Check(s.Character == "Character One" && s.Server == "ServerOne", "character and server");
Check(s.Account == "account-one", "account kept (for the log file only)");
Check(s.TimestampUtc == SampleTs && s.TimestampUtc.Kind == DateTimeKind.Utc, "ts is UTC");
Check(s.InWorld && s.HostPid == 64348 && s.HostProcess == "rynth-headless", "inWorld, hostPid, hostProcess");
Check(s.UptimeSec == 221973, "uptime");
Check(!s.Indoor && s.Landblock == "0000A9B3" && s.Cell == "A9B3000E", "outdoors, landblock, cell");
Check(Near(s.WorldX, 32486.4) && Near(s.WorldY, 34500.95) && Near(s.Z, 94) && Near(s.Heading, 244.6), "opos position");
Check(s.HasBot && s.MacroRunning && s.BotAction == "Default", "bot: macro running, action");
Check(s.Health == 100019 && s.MaxHealth == 100019, "health");
Check(s.Stamina == 100039 && s.MaxStamina == 100039, "stamina");
Check(s.Mana == 99888 && s.MaxMana == 100039, "mana");
Check(!s.HasTarget && s.TargetLabel == "NO TARGET", "no target");
Check(Math.Abs(s.BurdenPct - 4.1) < 1e-9 && s.VitaePct == 0 && s.DeathsSession == 0, "burden, vitae, deaths");
Check(s.RecentChat.Count == 57, "all 57 chat lines read");
Check(s.RecentChat[^1] == new HeadlessChatLine("[RynthAi] Macro started.", 5), "chat line text and type");
Check(s.MetaName == "Meta One", "meta name");
}
private static void ParseIndoor()
{
HeadlessCharacterStatus s = Parse(Sample("status-indoor.json"));
Check(s.Id == 1006063601 && s.Character == "Character Two", "id and character");
Check(s.Indoor && s.Cell == "01F501BE", "indoors, from opos");
Check(!s.MacroRunning, "macro off");
Check(s.XpPerHour == 36815639 && s.XpSession == 2450183040, "XP per hour and XP this session (over 2^31)");
Check(Math.Abs(s.BurdenPct - 182.2) < 1e-9, "burden over 100%");
Check(s.Health == 165 && s.MaxStamina == 230 && s.MaxMana == 330, "vitals");
HeadlessCharacterStatus t = Parse(Edit("status-indoor.json",
("bot.currentTargetId", 2147500000L), ("bot.targetLabel", "Monster"), ("bot.targetHealthPercent", 42.5),
("bot.sessionKills", 17), ("bot.killsPerHour", 120.4), ("deathsSession", 2), ("vitaePct", 10.0)));
Check(t.HasTarget && t.TargetId == 2147500000L && t.TargetLabel == "Monster", "target id (above int) and label");
Check(t.TargetHealthPercent == 42.5, "target health");
Check(t.SessionKills == 17 && Math.Abs(t.KillsPerHour - 120.4) < 1e-9, "kills");
Check(t.DeathsSession == 2 && t.VitaePct == 10, "deaths this session, vitae");
}
private static void ParseOthers()
{
// The exporter's OfflineJson (between sessions): bot null, no opos.
string loading = """
{"schema":"rynthcore.client-status/1","ts":"2026-10-31T22:00:00.000Z","host":"TEST-PC","pid":1000000101,
"account":"account-three","character":"Character Three","server":"ServerOne","uptimeSec":12,"fps":0,
"pluginTicksPerSec":0,"workingSetMB":40,"inWorld":false,"bot":null,"headless":true,"hostPid":1234,
"hostProcess":"rynth-headless"}
""";
HeadlessCharacterStatus s = Parse(loading);
Check(!s.InWorld && !s.HasBot && !s.HasVitals, "loading: not in world, no bot, no vitals");
Check(s.RecentChat.Count == 0 && s.WorldX == null && s.Cell == "", "loading: no chat, no position");
Check(HeadlessStatusRules.Activity(s, SampleTs) == HeadlessActivity.Loading, "loading: dot");
string client = Edit("status-outdoor.json", ("headless", null), ("hostPid", null));
Check(!HeadlessStatusParser.TryParse(client, DateTime.UtcNow, out _), "a game client's status (no headless) is not listed");
Check(!HeadlessStatusParser.TryParse(Edit("status-outdoor.json", ("headless", false)), DateTime.UtcNow, out _), "headless false is not listed");
string full = Sample("status-outdoor.json");
Check(!HeadlessStatusParser.TryParse(full[..(full.Length / 2)], DateTime.UtcNow, out _), "half a file is refused");
Check(!HeadlessStatusParser.TryParse("", DateTime.UtcNow, out _), "an empty file is refused");
Check(!HeadlessStatusParser.TryParse("[1,2]", DateTime.UtcNow, out _), "not an object is refused");
Check(HeadlessStatusParser.Parse(full[..(full.Length / 2)], DateTime.UtcNow, out _) == HeadlessParseResult.Broken, "half a file: broken");
Check(HeadlessStatusParser.Parse(" ", DateTime.UtcNow, out _) == HeadlessParseResult.Broken, "blank: broken");
Check(HeadlessStatusParser.Parse(client, DateTime.UtcNow, out _) == HeadlessParseResult.NotHeadless, "game client: not headless");
Check(!HeadlessStatusParser.TryParse(Edit("status-outdoor.json", ("pid", 0)), DateTime.UtcNow, out _), "no id is refused");
DateTime written = new(2026, 10, 31, 23, 0, 0, DateTimeKind.Utc);
Check(HeadlessStatusParser.TryParse(Edit("status-outdoor.json", ("ts", "not a time")), written, out var noTs) &&
noTs.TimestampUtc == written, "unreadable ts: the file's write time");
Check(HeadlessStatusParser.TryParse(Edit("status-outdoor.json", ("bot.recentChat", new JsonArray("plain line"))), written, out var plain) &&
plain.RecentChat.Count == 1 && plain.RecentChat[0].Text == "plain line", "a chat line as a bare string");
Check(HeadlessStatusParser.TryParse(Edit("status-outdoor.json", ("bot.playerHealth", "oops")), written, out var bad) &&
bad.Health == 0, "a wrong-typed field reads as 0");
}
// ── rules ───────────────────────────────────────────────────────────────
private static void Rules()
{
HeadlessCharacterStatus botting = Parse(Sample("status-outdoor.json"));
HeadlessCharacterStatus idle = Parse(Sample("status-indoor.json"));
HeadlessCharacterStatus dead = Parse(Edit("status-outdoor.json", ("bot.playerHealth", 0)));
Check(HeadlessStatusRules.Freshness(TimeSpan.FromSeconds(0)) == HeadlessFreshness.Fresh, "0 s fresh");
Check(HeadlessStatusRules.Freshness(TimeSpan.FromSeconds(10)) == HeadlessFreshness.Fresh, "10 s still fresh");
Check(HeadlessStatusRules.Freshness(TimeSpan.FromSeconds(10.5)) == HeadlessFreshness.Stale, "over 10 s stale");
Check(HeadlessStatusRules.Freshness(TimeSpan.FromSeconds(30)) == HeadlessFreshness.Stale, "30 s still stale");
Check(HeadlessStatusRules.Freshness(TimeSpan.FromSeconds(30.5)) == HeadlessFreshness.Gone, "over 30 s gone");
Check(HeadlessStatusRules.Age(botting, SampleTs.AddSeconds(-5)) == TimeSpan.Zero, "a ts in the future is age 0");
Check(HeadlessStatusRules.Age(botting, SampleTs.AddSeconds(4)) == TimeSpan.FromSeconds(4), "age from ts");
DateTime now = SampleTs.AddSeconds(2);
Check(HeadlessStatusRules.Activity(botting, now) == HeadlessActivity.Botting, "macro on: botting");
Check(HeadlessStatusRules.Activity(idle, now) == HeadlessActivity.Idle, "macro off: idle");
Check(HeadlessStatusRules.Activity(dead, now) == HeadlessActivity.Dead, "no health: dead");
Check(HeadlessStatusRules.Activity(botting, SampleTs.AddSeconds(15)) == HeadlessActivity.Stale, "15 s old: stale, whatever it was doing");
Check(HeadlessStatusRules.Activity(dead, SampleTs.AddSeconds(15)) == HeadlessActivity.Stale, "stale wins over dead");
HeadlessCharacterStatus noBot = Parse(Edit("status-outdoor.json", ("bot", null)));
Check(HeadlessStatusRules.Activity(noBot, now) == HeadlessActivity.Idle, "in world without a bot (no RynthAi): idle, not dead");
Check(HeadlessStatusRules.ActivityText(HeadlessActivity.Stale) == "not answering", "stale text");
}
private static void Roster()
{
var roster = new HeadlessRoster();
HeadlessCharacterStatus a = Parse(Sample("status-outdoor.json")); // Character One
HeadlessCharacterStatus b = Parse(Sample("status-indoor.json")); // Character Two
DateTime now = SampleTs.AddSeconds(1);
List<HeadlessCharacterStatus> list = roster.Update(new[] { b, a }, Array.Empty<int>(), now);
Check(list.Select(s => s.Id).SequenceEqual(new[] { a.Id, b.Id }), "sorted by character name");
list = roster.Update(new[] { a }, new[] { b.Id }, now);
Check(list.Count == 2 && roster.TryGet(b.Id, out var keptB) && ReferenceEquals(keptB, b), "a file mid-replace keeps its last status");
HeadlessCharacterStatus older = Parse(Edit("status-outdoor.json", ("ts", "2026-10-31T21:59:58.000Z"), ("bot.macroRunning", false)));
roster.Update(new[] { older, b }, Array.Empty<int>(), now);
Check(roster.TryGet(a.Id, out var keptA) && keptA.MacroRunning, "an older read never replaces a newer status");
list = roster.Update(new[] { a }, Array.Empty<int>(), now);
Check(list.Count == 1 && list[0].Id == a.Id, "a removed file leaves the list");
list = roster.Update(new[] { a }, Array.Empty<int>(), SampleTs.AddSeconds(20));
Check(list.Count == 1, "stale (20 s) stays listed");
list = roster.Update(new[] { a }, Array.Empty<int>(), SampleTs.AddSeconds(31));
Check(list.Count == 0, "gone (31 s) leaves the list");
}
// ── chat ────────────────────────────────────────────────────────────────
private static void Chat()
{
HeadlessCharacterStatus s = Parse(Sample("status-outdoor.json"));
List<HeadlessChatLine> shown = HeadlessChat.Visible(s.RecentChat);
Check(shown.Count == HeadlessChat.ShownLines, "30 lines shown");
Check(shown.All(l => l.Type != 21 && l.Type != 22), "combat spam (21, 22) hidden");
Check(shown[^1].Text == "[RynthAi] Macro started.", "newest last");
Check(HeadlessChat.Visible(s.RecentChat, 1000).Count == 41, "57 lines, 16 of them combat: 41 left");
Check(HeadlessChat.IsCombatSpam(21) && HeadlessChat.IsCombatSpam(22) && !HeadlessChat.IsCombatSpam(7) &&
!HeadlessChat.IsCombatSpam(18) && !HeadlessChat.IsCombatSpam(0), "only 21 and 22 are spam");
var L = (string t, int c) => new HeadlessChatLine(t, c);
var prev = new List<HeadlessChatLine> { L("a", 1), L("b", 1), L("c", 1) };
Check(HeadlessChat.NewLines(prev, prev).Count == 0, "same list: nothing new");
var shifted = new List<HeadlessChatLine> { L("b", 1), L("c", 1), L("d", 5), L("e", 21) };
Check(HeadlessChat.NewLines(prev, shifted).Select(l => l.Text).SequenceEqual(new[] { "d", "e" }), "ring shifted: the two new lines");
Check(HeadlessChat.FirstReply(HeadlessChat.NewLines(prev, shifted)) == L("d", 5), "first reply skips nothing it shouldn't");
var spamFirst = new List<HeadlessChatLine> { L("c", 1), L("hit", 21), L("ok", 5) };
Check(HeadlessChat.FirstReply(HeadlessChat.NewLines(prev, spamFirst)) == L("ok", 5), "first reply skips combat spam");
Check(HeadlessChat.NewLines(Array.Empty<HeadlessChatLine>(), prev).Count == 3, "no snapshot: all lines new");
Check(HeadlessChat.NewLines(prev, new List<HeadlessChatLine> { L("x", 1) }).Count == 1, "no overlap: all lines new");
// Same text, another type: a different line.
Check(HeadlessChat.NewLines(prev, new List<HeadlessChatLine> { L("c", 2) }).Count == 1, "type is part of the line");
// A repeated line ("Pack full" twice) at the boundary.
var rep = new List<HeadlessChatLine> { L("p", 2), L("p", 2) };
var rep2 = new List<HeadlessChatLine> { L("p", 2), L("p", 2), L("p", 2) };
Check(HeadlessChat.NewLines(rep, rep2).Count == 1, "repeated lines: the longest overlap wins");
Check(HeadlessChat.FirstReply(new[] { L("", 1) }) == null, "an empty line is no reply");
}
// ── commands ────────────────────────────────────────────────────────────
private static void CommandRules()
{
Check(HeadlessCommandFile.ChatCommandProblem("/ra pause") == null, "/ra pause ok");
Check(HeadlessCommandFile.ChatCommandProblem(" /rnav go home ") == null, "/rnav ok, trimmed");
Check(HeadlessCommandFile.ChatCommandProblem("/mt usep x") == null, "/mt ok");
Check(HeadlessCommandFile.ChatCommandProblem("/rn status") == null, "/rn ok");
Check(HeadlessCommandFile.ChatCommandProblem("/RA start") == null, "case-insensitive");
Check(HeadlessCommandFile.ChatCommandProblem("/ra") == null, "bare /ra ok");
Check(HeadlessCommandFile.ChatCommandProblem("/rap") != null, "/rap is not /ra");
Check(HeadlessCommandFile.ChatCommandProblem("/rnavx") != null, "/rnavx is not /rnav");
Check(HeadlessCommandFile.ChatCommandProblem("hello there") != null, "plain chat refused");
Check(HeadlessCommandFile.ChatCommandProblem("@tele x") != null, "server commands refused");
Check(HeadlessCommandFile.ChatCommandProblem("/tell x, hi") != null, "tells refused");
Check(HeadlessCommandFile.ChatCommandProblem("") != null && HeadlessCommandFile.ChatCommandProblem(null) != null, "empty refused");
Check(HeadlessCommandFile.ChatCommandProblem("/ra a\n/ra b") != null, "two lines refused");
Check(HeadlessCommandFile.ChatCommandProblem("/ra " + new string('x', 500)) != null, "too long refused");
}
private static void CommandFile(string root)
{
DateTime now = new(2026, 10, 31, 22, 1, 2, 345, DateTimeKind.Utc);
var guid = Guid.Parse("0123456789abcdef0123456789abcdef");
string name = HeadlessCommandFile.FileName(1006434801, now, guid);
Check(name == $"RynthCore.1006434801.{now.Ticks:D19}-0123456789abcdef0123456789abcdef.cmd.json", "name: id, 19-digit ticks, guid");
Check(string.CompareOrdinal(HeadlessCommandFile.FileName(5, now, guid), HeadlessCommandFile.FileName(5, now.AddTicks(1), Guid.Empty)) < 0,
"names sort in submit order");
using (JsonDocument doc = JsonDocument.Parse(HeadlessCommandFile.Json(1006434801, "sendChat", "/ra pause \"x\"", now)))
{
JsonElement r = doc.RootElement;
Check(r.GetProperty("schema").GetString() == "rynthcore.command/1", "schema");
Check(r.GetProperty("pid").GetInt32() == 1006434801, "pid = the character id");
Check(r.GetProperty("action").GetString() == "sendChat", "action");
Check(r.GetProperty("value").GetString() == "/ra pause \"x\"", "value, quotes escaped");
Check(r.GetProperty("ts").GetDateTimeOffset() == new DateTimeOffset(now), "ts");
}
string dir = Path.Combine(root, "status", HeadlessCommandFile.CommandsFolderName);
string path = HeadlessCommandFile.Write(dir, 1006434801, HeadlessCommandFile.MacroAction, "off", now);
Check(File.Exists(path) && Path.GetDirectoryName(path) == dir, "written into the commands folder (created)");
Check(Directory.GetFiles(dir).Length == 1, "no temp file left behind");
// What the headless drain matches (StatusExporter.DrainCommands).
Check(Directory.GetFiles(dir, "RynthCore.1006434801.*.cmd.json").Length == 1, "the character's drain pattern finds it");
Check(Directory.GetFiles(dir, "RynthCore.1006063601.*.cmd.json").Length == 0, "another character's pattern doesn't");
using (JsonDocument doc = JsonDocument.Parse(File.ReadAllText(path)))
Check(doc.RootElement.GetProperty("action").GetString() == "macro" && doc.RootElement.GetProperty("value").GetString() == "off",
"file content");
Check(!File.ReadAllBytes(path).AsSpan().StartsWith(new byte[] { 0xEF, 0xBB, 0xBF }), "UTF-8 without BOM");
// A temp file of a write in progress is never matched by the drain.
File.WriteAllText(Path.Combine(dir, HeadlessCommandFile.FileName(1006434801, now, Guid.NewGuid()) + ".tmp"), "{");
Check(Directory.GetFiles(dir, "RynthCore.1006434801.*.cmd.json").Length == 1, "a .tmp is not drained");
string second = HeadlessCommandFile.Write(dir, 1006434801, "sendChat", "/ra start", now);
Check(second != path && File.Exists(second), "same instant: a second file (guid)");
Check(Throws(() => HeadlessCommandFile.Write(dir, 0, "x", "", now)), "id 0 refused");
Check(Throws(() => HeadlessCommandFile.Write(dir, 5, " ", "", now)), "no action refused");
}
// ── coordinates, formatting ─────────────────────────────────────────────
private static void Coords()
{
var (ns, ew) = HeadlessCoords.FromWorld((33.6 * 10 + 1019.5) * 24, (42.1 * 10 + 1019.5) * 24);
Check(Math.Abs(ns - 42.1) < 1e-9 && Math.Abs(ew - 33.6) < 1e-9, "round trip 42.1N 33.6E");
Check(HeadlessCoords.Text(42.1, 33.6) == "42.1N 33.6E", "text");
Check(HeadlessCoords.Text(-12.34, -5.06) == "12.3S 5.1W", "south and west");
var (zns, zew) = HeadlessCoords.FromWorld(1019.5 * 24, 1019.5 * 24);
Check(Math.Abs(zns) < 1e-12 && Math.Abs(zew) < 1e-12, "the map's centre is 0, 0");
Check(HeadlessCoords.Text(-0.04, 0.04) == "0.0S 0.0E", "near zero keeps its sign letter");
// Landblock 0x0000: the far south-west corner.
var (cns, cew) = HeadlessCoords.FromWorld(0, 0);
Check(Math.Abs(cns + 101.95) < 1e-9 && Math.Abs(cew + 101.95) < 1e-9, "world 0,0 is 101.95S 101.95W");
HeadlessCharacterStatus outdoor = Parse(Sample("status-outdoor.json"));
Check(HeadlessCoords.Where(outdoor) == "Outdoors 41.8N 33.4E (landblock A9B3)", "outdoor sample: " + HeadlessCoords.Where(outdoor));
HeadlessCharacterStatus indoor = Parse(Sample("status-indoor.json"));
Check(HeadlessCoords.Where(indoor) == "Indoors (landblock 01F5, cell 01F501BE)", "indoor sample: no map coordinates");
HeadlessCharacterStatus none = Parse(Edit("status-outdoor.json", ("opos", null), ("landblock", "")));
Check(HeadlessCoords.Where(none) == "unknown", "no position: unknown");
}
private static void Formatting()
{
Check(HeadlessFormat.Number(950) == "950" && HeadlessFormat.Number(12_345) == "12.3k", "small numbers");
Check(HeadlessFormat.Number(36_815_639) == "36.8M" && HeadlessFormat.Number(2_450_183_040) == "2.5B", "millions, billions");
Check(HeadlessFormat.Duration(45) == "45s" && HeadlessFormat.Duration(725) == "12m 05s", "seconds, minutes");
Check(HeadlessFormat.Duration(3 * 3600 + 12 * 60) == "3h 12m" && HeadlessFormat.Duration(221973) == "2d 13h", "hours, days");
Check(HeadlessFormat.Duration(-3) == "0s", "negative = 0");
Check(HeadlessFormat.Vital(165, 230) == "165 / 230" && HeadlessFormat.Vital(0, 0) == "-", "vital text");
Check(HeadlessFormat.Fraction(5, 10) == 0.5 && HeadlessFormat.Fraction(20, 10) == 1 && HeadlessFormat.Fraction(1, 0) == 0, "bar fraction");
}
// ── files ───────────────────────────────────────────────────────────────
private static void Scan(string root)
{
string dir = Path.Combine(root, "scan");
Directory.CreateDirectory(dir);
DateTime now = DateTime.UtcNow;
string fresh = Edit("status-outdoor.json", ("ts", now.ToString("yyyy-MM-ddTHH:mm:ss.fffZ")));
File.WriteAllText(Path.Combine(dir, "RynthCore.1006434801.status.json"), fresh);
File.WriteAllText(Path.Combine(dir, "RynthCore.1006063601.status.json"), Sample("status-indoor.json")[..200]); // mid-write
File.WriteAllText(Path.Combine(dir, "RynthCore.17132.status.json"), Edit("status-outdoor.json", ("headless", null))); // a game client
string old = Path.Combine(dir, "RynthCore.10684.status.json");
File.WriteAllText(old, fresh);
File.SetLastWriteTimeUtc(old, now.AddHours(-3)); // left over from an old session: not even opened
File.WriteAllText(Path.Combine(dir, "RynthCore.1006434801.inventory.json"), "{}");
File.WriteAllText(Path.Combine(dir, "RynthCore.x.status.json"), fresh);
List<HeadlessCharacterStatus> found = HeadlessStatusScanner.Scan(dir, now, out List<int> unreadable);
Check(found.Count == 1 && found[0].Id == 1006434801, "one headless character read");
Check(unreadable.SequenceEqual(new[] { 1006063601 }), "the half-written headless file is reported unreadable");
Check(HeadlessStatusScanner.Scan(Path.Combine(root, "missing"), now, out var none).Count == 0 && none.Count == 0, "missing folder: nothing");
// Read while another handle holds it open for writing (as the exporter's replace may).
string held = Path.Combine(dir, "RynthCore.1006434801.status.json");
using (new FileStream(held, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite | FileShare.Delete))
Check(HeadlessStatusScanner.ReadShared(held) != null, "read while held open for writing");
Check(HeadlessStatusScanner.ReadShared(Path.Combine(dir, "nope.json")) == null, "missing file: null");
Check(HeadlessStatusScanner.TryIdOf(@"C:\x\RynthCore.1006434801.status.json", out int id) && id == 1006434801, "id from the name");
Check(!HeadlessStatusScanner.TryIdOf("RynthCore.-5.status.json", out _) && !HeadlessStatusScanner.TryIdOf("RynthCore.5.inventory.json", out _),
"bad names refused");
}
private static void Logs(string root)
{
Check(HeadlessLogs.LogFileName("account-one") == "headless-account_one.log", "letters and digits kept, the rest _");
Check(HeadlessLogs.LogFileName("Account2") == "headless-Account2.log", "case kept");
string cfgDir = Path.Combine(root, "appdata", "headless");
string suiteA = Path.Combine(root, "suiteA"), suiteDefault = Path.Combine(root, "default"), configured = Path.Combine(root, "configured");
Directory.CreateDirectory(cfgDir);
File.WriteAllText(Path.Combine(cfgDir, "launch_a.json"),
$$"""{"host":"h","port":1,"suiteDir":{{JsonSerializer.Serialize(suiteA)}},"sessions":[{"launcherProfileId":"p1","account":"account-one"}]}""");
File.WriteAllText(Path.Combine(cfgDir, "launch_b.json"),
"""{"host":"h","port":1,"sessions":[{"launcherProfileId":"p2","account":"account-two"}]}""");
File.WriteAllText(Path.Combine(cfgDir, "launch_c.json"), "{ broken");
List<string> dirsA = HeadlessLogs.CandidateSuiteDirs("ACCOUNT-ONE", cfgDir, configured, suiteDefault, legacySuiteDir: null);
Check(dirsA.SequenceEqual(new[] { suiteA, configured, suiteDefault }), "config's suiteDir first, then configured, default");
List<string> dirsB = HeadlessLogs.CandidateSuiteDirs("account-two", cfgDir, "", suiteDefault, legacySuiteDir: null);
Check(dirsB.SequenceEqual(new[] { suiteDefault }), "config without suiteDir = the default (once)");
List<string> dirsC = HeadlessLogs.CandidateSuiteDirs("account-three", Path.Combine(root, "nothing"), null, suiteDefault);
Check(dirsC.SequenceEqual(new[] { suiteDefault, HeadlessLogs.LegacySuiteDir }), "no config: default, legacy");
Directory.CreateDirectory(suiteDefault);
Directory.CreateDirectory(suiteA);
string logA = Path.Combine(suiteDefault, "headless-account_one.log");
Check(HeadlessLogs.Find("account-one", dirsA) == null, "no log yet: null");
File.WriteAllText(logA, "x\n");
Check(HeadlessLogs.Find("account-one", dirsA) == logA, "found in a later folder");
// Tail: last 50 lines, only the end read, the partial first line dropped.
var sb = new System.Text.StringBuilder();
for (int i = 1; i <= 5000; i++) sb.Append($"22:00:00.000 line {i}\r\n");
sb.Append("22:00:01.000 unfinished");
File.WriteAllText(logA, sb.ToString());
List<string>? tail = HeadlessLogs.Tail(logA, 50, 4096);
Check(tail != null && tail.Count == 50, "50 lines");
Check(tail != null && tail[^1] == "22:00:01.000 unfinished" && tail[^2] == "22:00:00.000 line 5000", "newest last, no \\r, unfinished line kept");
Check(tail != null && tail.All(l => l.StartsWith("22:00:0", StringComparison.Ordinal)), "no partial first line");
using (var writer = new FileStream(logA, FileMode.Append, FileAccess.Write, FileShare.Read))
{
// The writer (rynth-headless's StreamWriter) shares read only; the tail must still open it.
writer.Write("\nmore\n"u8);
writer.Flush();
List<string>? live = HeadlessLogs.Tail(logA, 2);
Check(live != null && live.SequenceEqual(new[] { "22:00:01.000 unfinished", "more" }), "tailed while the writer has it open");
}
Check(HeadlessLogs.Tail(Path.Combine(root, "missing.log")) == null, "missing log: null");
Check(HeadlessLogs.LastLines("a\nb\n", 10, startsMidFile: false).SequenceEqual(new[] { "a", "b" }), "short file whole");
Check(HeadlessLogs.LastLines("", 10, false).Count == 0, "empty file: no lines");
}
// ── helpers ─────────────────────────────────────────────────────────────
private static void Section(string name, Action body)
{
int before = _failed;
try { body(); }
catch (Exception ex)
{
_failed++;
Console.WriteLine($" FAIL: {name}: {ex.GetType().Name}: {ex.Message}");
}
Console.WriteLine($"{(_failed == before ? "ok " : "FAIL")} {name}");
}
private static bool Near(double? a, double b) => a is double v && Math.Abs(v - b) < 1e-9;
private static bool Throws(Action a)
{
try { a(); return false; }
catch { return true; }
}
private static void Check(bool ok, string what)
{
_checks++;
if (ok) return;
_failed++;
Console.WriteLine($" FAIL: {what}");
}
}

View file

@ -0,0 +1,523 @@
{
"schema": "rynthcore.client-status/1",
"ts": "2026-10-31T22:00:00.000Z",
"host": "TEST-PC",
"pid": 1006063601,
"engineVersion": "headless 1.0.0.0",
"apiVersion": 92,
"account": "account-two",
"character": "Character Two",
"server": "ServerTwo",
"uptimeSec": 239593,
"fps": 49,
"pluginTicksPerSec": 49,
"workingSetMB": 54,
"inWorld": true,
"queueDropped": 0,
"reconciles": 0,
"forceClears": 0,
"mainThreadFrozen": false,
"mainThreadStallMs": 0,
"pluginTicksPausedMs": 0,
"deaths": 0,
"deathsSession": 0,
"vitaePct": 0,
"xpPerHour": 36815639,
"luminancePerHour": 0,
"xpSession": 2450183040,
"burdenPct": 182.2,
"area": "01F5",
"landblock": "000001F5",
"indoor": true,
"wx": 230.18,
"wy": 46992.82,
"pz": -18,
"opos": {
"cell": "01F501BE",
"indoor": true,
"wx": 230.18,
"wy": 46992.82,
"z": -18,
"heading": 282.6
},
"lastIssue": null,
"lastIssueAgeSec": -1,
"bot": {
"macroRunning": false,
"currentState": "Default",
"botAction": "Default",
"botActionControl": "Default",
"selectedProfile": "Default",
"profiles": [
"None",
"profile 1",
"profile 2"
],
"navProfiles": [
"None"
],
"lootProfiles": [
"None",
"lootProfile 1"
],
"metaProfiles": [
"None",
"metaProfile 1"
],
"buffProfiles": [
"None"
],
"currentBuffName": "Built-in",
"selectedBuffIdx": 0,
"currentNavName": "None",
"currentLootName": "None",
"currentLootPath": "",
"vendorProfilePath": "",
"currentMetaName": "None",
"selectedNavIdx": 0,
"selectedLootIdx": 0,
"selectedMetaIdx": 0,
"selectedProfileIdx": 0,
"combatEnabled": false,
"buffingEnabled": true,
"navigationEnabled": false,
"lootingEnabled": false,
"metaEnabled": false,
"currentTargetId": 0,
"targetLabel": "NO TARGET",
"targetHealthPercent": 0,
"targetHealthDisplay": "0",
"targetHealth": 0,
"targetMaxHealth": 0,
"targetStamina": 0,
"targetMaxStamina": 0,
"targetMana": 0,
"targetMaxMana": 0,
"playerHealth": 165,
"playerMaxHealth": 165,
"playerStamina": 230,
"playerMaxStamina": 230,
"playerMana": 330,
"playerMaxMana": 330,
"showTargetStaminaMana": false,
"isLocked": false,
"isMinimized": false,
"bgOpacity": 0.95,
"killsPerHour": 0,
"sessionKills": 0,
"secsSinceLastKill": -1,
"freeSlots": 0,
"scanTotal": -1,
"scanRing": -1,
"scanPossible": -1,
"scanLosBlocked": -1,
"sessionAttackCasts": 0,
"castsSinceLastKill": 0,
"castsPerKill": 0,
"uiHidden": false,
"scarabs": 325,
"tapers": 2000,
"scarabsByType": [
{
"name": "Lead Scarab",
"count": 20
},
{
"name": "Iron Scarab",
"count": 20
},
{
"name": "Copper Scarab",
"count": 20
},
{
"name": "Silver Scarab",
"count": 20
},
{
"name": "Gold Scarab",
"count": 20
},
{
"name": "Pyreal Scarab",
"count": 50
},
{
"name": "Mechanical Scarab",
"count": 1
},
{
"name": "Platinum Scarab",
"count": 150
},
{
"name": "Mana Scarab",
"count": 24
}
],
"equipment": [
{
"name": "Shirt",
"id": 2147994752,
"slot": 30,
"armorLevel": 0,
"value": 15,
"burden": 75,
"workmanship": 0,
"material": 0,
"maxMana": 0,
"curMana": 0,
"damage": 0,
"damageType": 0,
"weaponDef": 0,
"missileDef": 0,
"magicDef": 0,
"variance": 0,
"elementalMod": 0,
"spells": [],
"longDesc": ""
},
{
"name": "Trousers",
"id": 2147994753,
"slot": 196,
"armorLevel": 0,
"value": 30,
"burden": 135,
"workmanship": 0,
"material": 0,
"maxMana": 0,
"curMana": 0,
"damage": 0,
"damageType": 0,
"weaponDef": 0,
"missileDef": 0,
"magicDef": 0,
"variance": 0,
"elementalMod": 0,
"spells": [],
"longDesc": ""
},
{
"name": "Pathwarden Robe",
"id": 2147987767,
"slot": 32513,
"armorLevel": 50,
"resist": [
0.8,
0.8,
1,
0.2,
0.2,
0.1,
0.2
],
"value": 1,
"burden": 200,
"workmanship": 0,
"material": 0,
"maxMana": 1000,
"curMana": 0,
"damage": 0,
"damageType": 0,
"weaponDef": 0,
"missileDef": 0,
"magicDef": 0,
"variance": 0,
"elementalMod": 0,
"spells": [
"Strength Self II",
"Endurance Self II",
"Focus Self II",
"Willpower Self II",
"Impenetrability II"
],
"longDesc": ""
},
{
"name": "Academy Wand",
"id": 2147749219,
"slot": 16777216,
"armorLevel": 0,
"value": 200,
"burden": 50,
"workmanship": 0,
"material": 0,
"maxMana": 400,
"curMana": 0,
"damage": 0,
"damageType": 0,
"weaponDef": 1,
"missileDef": 0,
"magicDef": 0,
"variance": 0,
"elementalMod": 0,
"spells": [
"Mana Conversion Mastery Other I",
"Focus Other I",
"Willpower Other I"
],
"longDesc": ""
},
{
"name": "Pathwarden Trinket",
"id": 2147987763,
"slot": 67108864,
"armorLevel": 0,
"value": 50,
"burden": 60,
"workmanship": 0,
"material": 0,
"maxMana": 6000,
"curMana": 0,
"damage": 0,
"damageType": 0,
"weaponDef": 0,
"missileDef": 0,
"magicDef": 0,
"variance": 0,
"elementalMod": 0,
"spells": [
"Augmented Understanding II"
],
"longDesc": "A gearwork compass, may it guide your way."
}
],
"recentChat": [
{
"t": "Line 1 of system text",
"c": 1
},
{
"t": "Line 2 of system text",
"c": 1
},
{
"t": "Line 3 of system text",
"c": 7
},
{
"t": "Line 4 of system text",
"c": 1
},
{
"t": "Line 5 of system text",
"c": 1
},
{
"t": "You hit the monster for 5 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 5 points of damage!",
"c": 22
},
{
"t": "Line 6 of system text",
"c": 7
},
{
"t": "Line 7 of system text",
"c": 1
},
{
"t": "Line 8 of system text",
"c": 1
},
{
"t": "Line 9 of system text",
"c": 7
},
{
"t": "Line 10 of system text",
"c": 1
},
{
"t": "You hit the monster for 10 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 10 points of damage!",
"c": 22
},
{
"t": "Line 11 of system text",
"c": 1
},
{
"t": "Line 12 of system text",
"c": 7
},
{
"t": "Line 13 of system text",
"c": 1
},
{
"t": "Line 14 of system text",
"c": 1
},
{
"t": "Line 15 of system text",
"c": 7
},
{
"t": "You hit the monster for 15 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 15 points of damage!",
"c": 22
},
{
"t": "Line 16 of system text",
"c": 1
},
{
"t": "Line 17 of system text",
"c": 1
},
{
"t": "Line 18 of system text",
"c": 7
},
{
"t": "Line 19 of system text",
"c": 1
},
{
"t": "Line 20 of system text",
"c": 1
},
{
"t": "You hit the monster for 20 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 20 points of damage!",
"c": 22
},
{
"t": "Line 21 of system text",
"c": 7
},
{
"t": "Line 22 of system text",
"c": 1
},
{
"t": "Line 23 of system text",
"c": 1
},
{
"t": "Line 24 of system text",
"c": 7
},
{
"t": "Line 25 of system text",
"c": 1
},
{
"t": "You hit the monster for 25 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 25 points of damage!",
"c": 22
},
{
"t": "Line 26 of system text",
"c": 1
},
{
"t": "Line 27 of system text",
"c": 7
},
{
"t": "Line 28 of system text",
"c": 1
},
{
"t": "Line 29 of system text",
"c": 1
},
{
"t": "Line 30 of system text",
"c": 7
},
{
"t": "You hit the monster for 30 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 30 points of damage!",
"c": 22
},
{
"t": "Line 31 of system text",
"c": 1
},
{
"t": "Line 32 of system text",
"c": 1
},
{
"t": "Line 33 of system text",
"c": 7
},
{
"t": "Line 34 of system text",
"c": 1
},
{
"t": "Line 35 of system text",
"c": 1
},
{
"t": "You hit the monster for 35 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 35 points of damage!",
"c": 22
},
{
"t": "Line 36 of system text",
"c": 7
},
{
"t": "Line 37 of system text",
"c": 1
},
{
"t": "Line 38 of system text",
"c": 1
},
{
"t": "Line 39 of system text",
"c": 7
},
{
"t": "Line 40 of system text",
"c": 1
},
{
"t": "You hit the monster for 40 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 40 points of damage!",
"c": 22
},
{
"t": "[RynthAi] Macro started.",
"c": 5
}
]
},
"enchantments": [],
"raiseXp": false,
"moveProto": 2,
"headless": true,
"hostPid": 60636,
"hostProcess": "rynth-headless"
}

View file

@ -0,0 +1,902 @@
{
"schema": "rynthcore.client-status/1",
"ts": "2026-10-31T22:00:00.000Z",
"host": "TEST-PC",
"pid": 1006434801,
"engineVersion": "headless 1.0.0.0",
"apiVersion": 92,
"account": "account-one",
"character": "Character One",
"server": "ServerOne",
"uptimeSec": 221973,
"fps": 34,
"pluginTicksPerSec": 34,
"workingSetMB": 67,
"inWorld": true,
"queueDropped": 0,
"reconciles": 0,
"forceClears": 0,
"mainThreadFrozen": false,
"mainThreadStallMs": 0,
"pluginTicksPausedMs": 0,
"deaths": 19,
"deathsSession": 0,
"vitaePct": 0,
"xpPerHour": 0,
"luminancePerHour": 0,
"xpSession": 0,
"burdenPct": 4.1,
"area": "A9B3",
"landblock": "0000A9B3",
"indoor": false,
"opos": {
"cell": "A9B3000E",
"indoor": false,
"wx": 32486.4,
"wy": 34500.95,
"z": 94,
"heading": 244.6
},
"lastIssue": null,
"lastIssueAgeSec": -1,
"bot": {
"macroRunning": true,
"currentState": "Default",
"botAction": "Default",
"botActionControl": "Default",
"selectedProfile": "Default",
"profiles": [
"None",
"profile 1",
"profile 2"
],
"navProfiles": [
"None",
"navProfile 1",
"navProfile 2",
"navProfile 3"
],
"lootProfiles": [
"None",
"lootProfile 1",
"lootProfile 2"
],
"metaProfiles": [
"None",
"metaProfile 1",
"metaProfile 2",
"metaProfile 3"
],
"buffProfiles": [
"None"
],
"currentBuffName": "Built-in",
"selectedBuffIdx": 0,
"currentNavName": "None",
"currentLootName": "Loot One",
"currentLootPath": "C:\\Placeholder\\LootProfiles\\Loot One.utl",
"vendorProfilePath": "",
"currentMetaName": "Meta One",
"selectedNavIdx": 0,
"selectedLootIdx": 0,
"selectedMetaIdx": 0,
"selectedProfileIdx": 0,
"combatEnabled": true,
"buffingEnabled": true,
"navigationEnabled": true,
"lootingEnabled": true,
"metaEnabled": false,
"currentTargetId": 0,
"targetLabel": "NO TARGET",
"targetHealthPercent": 0,
"targetHealthDisplay": "0",
"targetHealth": 0,
"targetMaxHealth": 0,
"targetStamina": 0,
"targetMaxStamina": 0,
"targetMana": 0,
"targetMaxMana": 0,
"playerHealth": 100019,
"playerMaxHealth": 100019,
"playerStamina": 100039,
"playerMaxStamina": 100039,
"playerMana": 99888,
"playerMaxMana": 100039,
"showTargetStaminaMana": true,
"isLocked": false,
"isMinimized": false,
"bgOpacity": 0.1,
"killsPerHour": 0,
"sessionKills": 0,
"secsSinceLastKill": -1,
"freeSlots": 0,
"scanTotal": 13,
"scanRing": 0,
"scanPossible": 0,
"scanLosBlocked": 0,
"sessionAttackCasts": 5,
"castsSinceLastKill": 5,
"castsPerKill": 0,
"uiHidden": false,
"scarabs": 236,
"tapers": 582,
"scarabsByType": [
{
"name": "Lead Scarab",
"count": 0
},
{
"name": "Iron Scarab",
"count": 100
},
{
"name": "Copper Scarab",
"count": 0
},
{
"name": "Silver Scarab",
"count": 0
},
{
"name": "Gold Scarab",
"count": 0
},
{
"name": "Pyreal Scarab",
"count": 0
},
{
"name": "Platinum Scarab",
"count": 38
},
{
"name": "Diamond Scarab",
"count": 98
}
],
"equipment": [
{
"name": "Teardrop Crown",
"id": 2147487072,
"slot": 1,
"armorLevel": 523,
"resist": [
2,
2,
2,
2,
1.9,
2,
2
],
"value": 27048,
"burden": 82,
"workmanship": 7,
"material": 60,
"maxMana": 2001,
"curMana": 2001,
"damage": 0,
"damageType": 0,
"weaponDef": 0,
"missileDef": 0,
"magicDef": 0,
"variance": 0,
"elementalMod": 0,
"spells": [
"Impenetrability VI",
"Major Jumping Prowess",
"Major Salvaging Aptitude",
"Incantation of Focus Self",
"Epic Bludgeoning Ward",
"Epic Piercing Ward"
],
"longDesc": "Teardrop Crown of Focus"
},
{
"name": "Sollerets",
"id": 2147491080,
"slot": 256,
"armorLevel": 523,
"resist": [
2,
2,
2,
2,
1.9,
2,
2
],
"value": 23220,
"burden": 307,
"workmanship": 6,
"material": 60,
"maxMana": 1618,
"curMana": 1618,
"damage": 0,
"damageType": 4,
"weaponDef": 0,
"missileDef": 0,
"magicDef": 0,
"variance": 0,
"elementalMod": 0,
"spells": [
"Olthoi's Bane",
"Brogard's Defiance",
"Major Weapon Tinkering Expertise",
"Incantation of Flame Bane",
"Epic Healing Prowess"
],
"longDesc": "Sollerets"
},
{
"name": "Academy Coat",
"id": 2147483882,
"slot": 7680,
"armorLevel": 250,
"resist": [
2,
2,
2,
2,
1.53,
2,
2
],
"value": 150,
"burden": 600,
"workmanship": 0,
"material": 0,
"maxMana": 0,
"curMana": 0,
"damage": 0,
"damageType": 0,
"weaponDef": 0,
"missileDef": 0,
"magicDef": 0,
"variance": 0,
"elementalMod": 0,
"spells": [],
"longDesc": "A fur coat awarded by the Academy to those who complete their training."
},
{
"name": "Nariyid Leggings",
"id": 2147486638,
"slot": 24576,
"armorLevel": 488,
"resist": [
2,
2,
2,
2,
1.9,
2,
2
],
"value": 26361,
"burden": 929,
"workmanship": 8,
"material": 63,
"maxMana": 747,
"curMana": 747,
"damage": 0,
"damageType": 0,
"weaponDef": 0,
"missileDef": 0,
"magicDef": 0,
"variance": 0,
"elementalMod": 0,
"spells": [
"Acid Bane VI",
"Hastening",
"Gelidite's Bane",
"Brogard's Defiance",
"Major Magic Resistance"
],
"longDesc": "Nariyid Leggings of Quickness"
},
{
"name": "Heavy Necklace",
"id": 2147485391,
"slot": 32768,
"armorLevel": 0,
"value": 5592,
"burden": 90,
"workmanship": 7,
"material": 58,
"maxMana": 1984,
"curMana": 1984,
"damage": 0,
"damageType": 0,
"weaponDef": 0,
"missileDef": 0,
"magicDef": 0,
"variance": 0,
"elementalMod": 0,
"spells": [
"Armor Tinkering Expertise Self VI",
"Epic Arcane Prowess"
],
"longDesc": "Heavy Necklace of Armor Tinkering"
},
{
"name": "Heavy Bracelet",
"id": 2147484698,
"slot": 131072,
"armorLevel": 0,
"value": 12240,
"burden": 150,
"workmanship": 9,
"material": 51,
"maxMana": 2513,
"curMana": 2513,
"damage": 0,
"damageType": 0,
"weaponDef": 0,
"missileDef": 0,
"magicDef": 0,
"variance": 0,
"elementalMod": 0,
"spells": [
"Lightning Protection Self VI",
"Epic Impregnability"
],
"longDesc": "Heavy Bracelet of Lightning Protection"
},
{
"name": "Deadly Prismatic Arrow",
"id": 2147485881,
"slot": 8388608,
"armorLevel": 0,
"value": 100000,
"burden": 1000,
"workmanship": 0,
"material": 0,
"maxMana": 0,
"curMana": 0,
"damage": 40,
"damageType": 268435456,
"weaponDef": 1,
"missileDef": 0,
"magicDef": 0,
"variance": 0.3,
"elementalMod": 0,
"spells": [],
"longDesc": "Deadly, crystaline arrows that draw the elemental energies from elementally attuned bows to damage their target."
},
{
"name": "Sceptre",
"id": 2147485312,
"slot": 16777216,
"armorLevel": 0,
"value": 5369,
"burden": 50,
"workmanship": 4,
"material": 58,
"maxMana": 2500,
"curMana": 0,
"damage": 0,
"damageType": 0,
"weaponDef": 1.18,
"missileDef": 0,
"magicDef": 0,
"variance": 0,
"elementalMod": 0,
"spells": [
"Acid Stream V",
"Aura of Hermetic Link Self V"
],
"longDesc": "Sceptre of Acid Stream"
},
{
"name": "Puzzle Box",
"id": 2147486645,
"slot": 67108864,
"armorLevel": 0,
"value": 11784,
"burden": 100,
"workmanship": 7,
"material": 64,
"maxMana": 2667,
"curMana": 2667,
"damage": 0,
"damageType": 0,
"weaponDef": 0,
"missileDef": 0,
"magicDef": 0,
"variance": 0,
"elementalMod": 0,
"spells": [
"Battlemage's Blessing",
"Major Finesse Weapon Aptitude",
"Incantation of Piercing Protection Self"
],
"longDesc": "Puzzle Box of Piercing Protection"
}
],
"recentChat": [
{
"t": "Line 1 of system text",
"c": 1
},
{
"t": "Line 2 of system text",
"c": 1
},
{
"t": "Line 3 of system text",
"c": 7
},
{
"t": "Line 4 of system text",
"c": 1
},
{
"t": "Line 5 of system text",
"c": 1
},
{
"t": "You hit the monster for 5 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 5 points of damage!",
"c": 22
},
{
"t": "Line 6 of system text",
"c": 7
},
{
"t": "Line 7 of system text",
"c": 1
},
{
"t": "Line 8 of system text",
"c": 1
},
{
"t": "Line 9 of system text",
"c": 7
},
{
"t": "Line 10 of system text",
"c": 1
},
{
"t": "You hit the monster for 10 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 10 points of damage!",
"c": 22
},
{
"t": "Line 11 of system text",
"c": 1
},
{
"t": "Line 12 of system text",
"c": 7
},
{
"t": "Line 13 of system text",
"c": 1
},
{
"t": "Line 14 of system text",
"c": 1
},
{
"t": "Line 15 of system text",
"c": 7
},
{
"t": "You hit the monster for 15 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 15 points of damage!",
"c": 22
},
{
"t": "Line 16 of system text",
"c": 1
},
{
"t": "Line 17 of system text",
"c": 1
},
{
"t": "Line 18 of system text",
"c": 7
},
{
"t": "Line 19 of system text",
"c": 1
},
{
"t": "Line 20 of system text",
"c": 1
},
{
"t": "You hit the monster for 20 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 20 points of damage!",
"c": 22
},
{
"t": "Line 21 of system text",
"c": 7
},
{
"t": "Line 22 of system text",
"c": 1
},
{
"t": "Line 23 of system text",
"c": 1
},
{
"t": "Line 24 of system text",
"c": 7
},
{
"t": "Line 25 of system text",
"c": 1
},
{
"t": "You hit the monster for 25 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 25 points of damage!",
"c": 22
},
{
"t": "Line 26 of system text",
"c": 1
},
{
"t": "Line 27 of system text",
"c": 7
},
{
"t": "Line 28 of system text",
"c": 1
},
{
"t": "Line 29 of system text",
"c": 1
},
{
"t": "Line 30 of system text",
"c": 7
},
{
"t": "You hit the monster for 30 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 30 points of damage!",
"c": 22
},
{
"t": "Line 31 of system text",
"c": 1
},
{
"t": "Line 32 of system text",
"c": 1
},
{
"t": "Line 33 of system text",
"c": 7
},
{
"t": "Line 34 of system text",
"c": 1
},
{
"t": "Line 35 of system text",
"c": 1
},
{
"t": "You hit the monster for 35 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 35 points of damage!",
"c": 22
},
{
"t": "Line 36 of system text",
"c": 7
},
{
"t": "Line 37 of system text",
"c": 1
},
{
"t": "Line 38 of system text",
"c": 1
},
{
"t": "Line 39 of system text",
"c": 7
},
{
"t": "Line 40 of system text",
"c": 1
},
{
"t": "You hit the monster for 40 points of damage!",
"c": 21
},
{
"t": "The monster hits you for 40 points of damage!",
"c": 22
},
{
"t": "[RynthAi] Macro started.",
"c": 5
}
]
},
"enchantments": [
{
"spellId": 2215,
"secondsRemaining": 1247.3
},
{
"spellId": 2091,
"secondsRemaining": 1248.8
},
{
"spellId": 1616,
"secondsRemaining": 1994
},
{
"spellId": 1480,
"secondsRemaining": 1997.2
},
{
"spellId": 3258,
"secondsRemaining": 2003.7
},
{
"spellId": 1627,
"secondsRemaining": 2006.9
},
{
"spellId": 1605,
"secondsRemaining": 2010.1
},
{
"spellId": 2067,
"secondsRemaining": 2817.5
},
{
"spellId": 2267,
"secondsRemaining": 2818.9
},
{
"spellId": 2087,
"secondsRemaining": 2820.3
},
{
"spellId": 2061,
"secondsRemaining": 2821.7
},
{
"spellId": 2059,
"secondsRemaining": 2823.1
},
{
"spellId": 2081,
"secondsRemaining": 2824.6
},
{
"spellId": 2281,
"secondsRemaining": 2826
},
{
"spellId": 2245,
"secondsRemaining": 2827.4
},
{
"spellId": 2243,
"secondsRemaining": 2828.9
},
{
"spellId": 2309,
"secondsRemaining": 2830.3
},
{
"spellId": 2203,
"secondsRemaining": 2831.7
},
{
"spellId": 2223,
"secondsRemaining": 2833.1
},
{
"spellId": 2207,
"secondsRemaining": 2834.5
},
{
"spellId": 5105,
"secondsRemaining": 2836
},
{
"spellId": 5857,
"secondsRemaining": 2837.4
},
{
"spellId": 5809,
"secondsRemaining": 2838.8
},
{
"spellId": 5833,
"secondsRemaining": 2840.2
},
{
"spellId": 5881,
"secondsRemaining": 2841.6
},
{
"spellId": 5785,
"secondsRemaining": 2843.1
},
{
"spellId": 2289,
"secondsRemaining": 2844.5
},
{
"spellId": 2293,
"secondsRemaining": 2845.9
},
{
"spellId": 2195,
"secondsRemaining": 2847.3
},
{
"spellId": 2197,
"secondsRemaining": 2848.7
},
{
"spellId": 2251,
"secondsRemaining": 2850.1
},
{
"spellId": 2277,
"secondsRemaining": 2851.6
},
{
"spellId": 2325,
"secondsRemaining": 2853
},
{
"spellId": 3505,
"secondsRemaining": 2854.4
},
{
"spellId": 2301,
"secondsRemaining": 2855.8
},
{
"spellId": 2257,
"secondsRemaining": 2857.3
},
{
"spellId": 2233,
"secondsRemaining": 2858.7
},
{
"spellId": 2263,
"secondsRemaining": 2860.1
},
{
"spellId": 2227,
"secondsRemaining": 2861.5
},
{
"spellId": 2241,
"secondsRemaining": 2862.9
},
{
"spellId": 2271,
"secondsRemaining": 2864.3
},
{
"spellId": 2211,
"secondsRemaining": 2865.8
},
{
"spellId": 2237,
"secondsRemaining": 2867.2
},
{
"spellId": 2191,
"secondsRemaining": 2868.6
},
{
"spellId": 2287,
"secondsRemaining": 2870
},
{
"spellId": 2249,
"secondsRemaining": 2871.4
},
{
"spellId": 2323,
"secondsRemaining": 2872.9
},
{
"spellId": 5417,
"secondsRemaining": 2874.3
},
{
"spellId": 6122,
"secondsRemaining": 2875.7
},
{
"spellId": 2185,
"secondsRemaining": 2877
},
{
"spellId": 2187,
"secondsRemaining": 2878.4
},
{
"spellId": 2183,
"secondsRemaining": 2879.7
},
{
"spellId": 2053,
"secondsRemaining": 2881.1
},
{
"spellId": 2149,
"secondsRemaining": 2882.5
},
{
"spellId": 2157,
"secondsRemaining": 2883.9
},
{
"spellId": 2155,
"secondsRemaining": 2885.3
},
{
"spellId": 2159,
"secondsRemaining": 2886.6
},
{
"spellId": 2151,
"secondsRemaining": 2888
},
{
"spellId": 2161,
"secondsRemaining": 2889.4
},
{
"spellId": 2153,
"secondsRemaining": 2890.8
},
{
"spellId": 2106,
"secondsRemaining": 2900.5
},
{
"spellId": 3811,
"secondsRemaining": 14042.8
}
],
"raiseXp": false,
"moveProto": 2,
"headless": true,
"hostPid": 64348,
"hostProcess": "rynth-headless"
}

View file

@ -291,6 +291,21 @@ internal static class Program
Check(OldLauncherCanRead(Main_) && BridgeLauncherCanRead(Main_), "older launchers still read the file");
});
Scenario("headless window: its size and place round trip", root, () =>
{
AppSettings fresh = new();
Check(fresh.HeadlessWindowX == null && fresh.HeadlessWindowY == null &&
fresh.HeadlessWindowWidth == null && fresh.HeadlessWindowHeight == null, "defaults: none (centred)");
AppSettings s = SampleWithHeadless();
s.HeadlessWindowX = 120; s.HeadlessWindowY = -40; s.HeadlessWindowWidth = 1180; s.HeadlessWindowHeight = 790;
AppSettingsStore.Save(s);
AppSettings loaded = AppSettingsStore.Load();
Check(loaded.HeadlessWindowX == 120 && loaded.HeadlessWindowY == -40 &&
loaded.HeadlessWindowWidth == 1180 && loaded.HeadlessWindowHeight == 790, "saved and loaded");
Check(loaded.WindowX == s.WindowX && loaded.WindowWidth == s.WindowWidth, "the launcher's own place untouched");
Check(OldLauncherCanRead(Main_) && BridgeLauncherCanRead(Main_), "older launchers still read the file");
});
Scenario("headless: run config, arguments, exe path, stop event", root, () =>
{
const string HeadlessPw = "Headless-Test-Pw-7 \"q\"";