RynthCore as of 2026-11-26 (internal 5e4b1f3): release 2026.11.26.1

This commit is contained in:
Tom Bohar 2026-11-26 22:32:30 -05:00
commit 2ff89683f4
75 changed files with 3838 additions and 173 deletions

View file

@ -23,6 +23,7 @@ internal static class Program
PortalSpaceViewIsTheWorld();
FailOpen();
NothingUnderTheMouse();
GameDragsGoThroughUnderUiPanels();
Console.WriteLine();
Console.WriteLine($"{_checks - _failed}/{_checks} checks passed.");
@ -120,6 +121,26 @@ internal static class Program
Console.WriteLine($"-- {name}");
}
private static void GameDragsGoThroughUnderUiPanels()
{
// Problem report R-20261126-194457-f7d8: a panel drawn under AC's UI (the DreamWeave Skills
// window) sat behind AC's inventory. While the button was down it stopped being click-through,
// so every item dragged inside AC's inventory was "released over an ImGui window" and snapped back.
Case("under-UI panel behind an AC window: click-through unless its own press is held");
Check(AcMouseOverRules.UnderUiPanelClickThrough(AcMouseTarget.AcWindow, leftDown: false, pressBelongsToGame: false),
"AC window, no button: click-through");
Check(AcMouseOverRules.UnderUiPanelClickThrough(AcMouseTarget.AcWindow, leftDown: true, pressBelongsToGame: true),
"AC window, a game press held (an AC inventory drag): click-through, the drop is AC's");
Check(!AcMouseOverRules.UnderUiPanelClickThrough(AcMouseTarget.AcWindow, leftDown: true, pressBelongsToGame: false),
"AC window, the panel's own press held: the panel keeps its drag");
Case("under-UI panel over the world (or AC can't tell): the panel takes the mouse");
foreach (AcMouseTarget t in new[] { AcMouseTarget.World, AcMouseTarget.Nothing, AcMouseTarget.Unknown })
foreach (bool down in new[] { false, true })
Check(!AcMouseOverRules.UnderUiPanelClickThrough(t, down, pressBelongsToGame: down),
$"{t}, leftDown={down}: not click-through");
}
private static void Check(bool ok, string what)
{
_checks++;

View file

@ -0,0 +1,22 @@
<Project Sdk="Microsoft.NET.Sdk">
<!--
Offline checks for the RynthNav Arrow window's one target (src\RynthCore.Engine\UI\Data\
ArrowTarget.cs, compiled in): where the target came from (chat coords, a route, the arrow),
its label, and whether the route list under the arrow belongs to it.
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>ArrowTargetTests</RootNamespace>
</PropertyGroup>
<ItemGroup>
<Compile Include="..\..\src\RynthCore.Engine\UI\Data\ArrowTarget.cs" Link="Engine\ArrowTarget.cs" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,113 @@
using RynthCore.Engine.UI.Data;
namespace ArrowTargetTests;
/// <summary>
/// The RynthNav Arrow window's one target (ArrowTarget). 11-24, a player: clicked chat coordinates
/// went to the top of the window while the route list under them was for another place.
/// </summary>
internal static class Program
{
private static int _checks, _failed;
private const double HoltNs = 42.08, HoltEw = 33.60, FarNs = -12.3, FarEw = 45.6;
private static int Main()
{
Sources();
RouteBelongs();
ChatNote();
Labels();
Console.WriteLine(_failed == 0 ? $"PASS ({_checks} checks)" : $"FAIL ({_failed} of {_checks})");
return _failed == 0 && _checks > 0 ? 0 : 1;
}
private static ArrowTargetInput Arrow(string final, double ns, double ew, int steps = 1) =>
new(true, final, ns, ew, steps, false, "", false, 0, 0, false, 0, 0);
private static ArrowTargetInput WithRoute(ArrowTargetInput a, string routeFor, double ns, double ew, bool goal = true) =>
a with { HasRoute = true, RouteFor = routeFor, RouteHasGoal = goal, RouteNs = goal ? ns : 0, RouteEw = goal ? ew : 0,
RouteHasLast = true, LastNs = ns, LastEw = ew };
private static readonly ArrowTargetInput Nothing = new(false, "", 0, 0, 0, false, "", false, 0, 0, false, 0, 0);
private static void Sources()
{
Check(ArrowTarget.Pick(Nothing, chat: false).Source == ArrowTargetSource.None, "nothing: no target");
Check(ArrowTarget.Pick(Arrow("Holtburg", HoltNs, HoltEw), chat: false).Source == ArrowTargetSource.Arrow, "a place: Arrow");
Check(ArrowTarget.Pick(Arrow("42.1N, 33.6E", 42.1, 33.6), chat: true).Source == ArrowTargetSource.Chat, "a chat link: Chat coords");
Check(ArrowTarget.Pick(Arrow("Holtburg", HoltNs, HoltEw, steps: 3), chat: false).Source == ArrowTargetSource.Route,
"an arrow along a route's portals: Route");
// A route to the arrow's own place makes it a route, even from chat ("Route here").
var routed = WithRoute(Arrow("42.1N, 33.6E", 42.1, 33.6), "42.1N, 33.6E", 42.1, 33.6);
Check(ArrowTarget.Pick(routed, chat: true).Source == ArrowTargetSource.Route, "chat coords, then Plan: Route");
// No arrow, a route shown (an older RynthNav after arrow off, or a trip): the route is the target.
var onlyRoute = WithRoute(Nothing, "Rithwic", 10, 59);
Check(ArrowTarget.Pick(onlyRoute, chat: false).Source == ArrowTargetSource.Route, "only a route: Route");
}
private static void RouteBelongs()
{
// The report: chat coords far away, the route list still for Holtburg.
var stale = WithRoute(Arrow("12.3S, 45.6E", FarNs, FarEw), "Holtburg", HoltNs, HoltEw);
ArrowTargetPick p = ArrowTarget.Pick(stale, chat: true);
Check(!p.RouteBelongs, "a route for another place stays out of the window");
Check(p.Source == ArrowTargetSource.Chat, "...and the target is the chat coords");
var same = WithRoute(Arrow("Holtburg", HoltNs, HoltEw), "Holtburg", HoltNs, HoltEw);
Check(ArrowTarget.RouteBelongs(same), "a route to the arrow's place belongs");
// Two places with one name: RynthNav's goal decides.
var namesake = WithRoute(Arrow("Lifestone", HoltNs, HoltEw), "Lifestone", FarNs, FarEw);
Check(!ArrowTarget.RouteBelongs(namesake), "same name, another place: not this target's route");
// An older RynthNav (no goal sent): the name, else the route's last step.
var byName = WithRoute(Arrow("Holtburg", HoltNs, HoltEw), "holtburg", FarNs, FarEw, goal: false);
Check(ArrowTarget.RouteBelongs(byName), "older RynthNav: the same name (any case) belongs");
var byLast = WithRoute(Arrow("42.1N, 33.6E", 42.1, 33.6), "Holtburg Lifestone", HoltNs, HoltEw, goal: false);
Check(ArrowTarget.RouteBelongs(byLast), "older RynthNav: a route ending at the arrow's spot belongs");
var neither = WithRoute(Arrow("Rithwic", 10, 59), "Holtburg", HoltNs, HoltEw, goal: false);
Check(!ArrowTarget.RouteBelongs(neither), "older RynthNav: another name ending elsewhere doesn't");
Check(!ArrowTarget.RouteBelongs(Arrow("Holtburg", HoltNs, HoltEw)), "no route: nothing belongs");
Check(ArrowTarget.SamePlace(42.1, 33.6, HoltNs, HoltEw), "chat coords' one decimal is the same place");
Check(!ArrowTarget.SamePlace(42.2, 33.6, HoltNs, HoltEw), "0.12 degrees off is not");
Check(!ArrowTarget.SamePlace(double.NaN, 33.6, HoltNs, HoltEw), "an unknown spot is never the same place");
}
private static void ChatNote()
{
ArrowTarget.ForgetChat();
Check(!ArrowTarget.FromChat(42.1, 33.6), "nothing noted: not from chat");
int v = ArrowTarget.ChatVersion;
ArrowTarget.NoteChat(42.1, 33.6);
Check(ArrowTarget.ChatVersion != v, "a note bumps the version (the window rebuilds its line)");
// RynthNav gets the coordinates with two decimals and sends them back as numbers.
Check(ArrowTarget.FromChat(42.10, 33.60), "the arrow at the noted spot came from chat");
Check(!ArrowTarget.FromChat(HoltNs, HoltEw), "Holtburg's own spot (0.02 off) did not: the Atlas set it");
ArrowTarget.NoteChat(-12.3, 45.6);
Check(!ArrowTarget.FromChat(42.1, 33.6), "a newer chat link replaces the note");
ArrowTarget.ForgetChat();
Check(!ArrowTarget.FromChat(-12.3, 45.6), "cleared: not from chat any more");
}
private static void Labels()
{
Check(ArrowTarget.Pick(Arrow("42.1N, 33.6E", 42.1, 33.6), chat: true).Label == "Chat coords 42.1N, 33.6E", "chat label");
Check(ArrowTarget.Pick(Arrow("12.3S, 45.6W", -12.3, -45.6), chat: true).Label == "Chat coords 12.3S, 45.6W", "south and west");
Check(ArrowTarget.Pick(Arrow("Holtburg", HoltNs, HoltEw, steps: 2), chat: false).Label == "Route: Holtburg", "route label");
Check(ArrowTarget.Pick(Arrow("Holtburg", HoltNs, HoltEw), chat: false).Label == "Arrow: Holtburg", "arrow label");
Check(ArrowTarget.Pick(Arrow("", HoltNs, HoltEw), chat: false).Label == "Arrow: 42.1N, 33.6E", "no name: the coordinates");
Check(ArrowTarget.Pick(WithRoute(Nothing, "Rithwic", 10, 59), chat: false).Label == "Route: Rithwic", "a route alone");
Check(ArrowTarget.Pick(Nothing, chat: false).Label == "No target", "nothing");
}
private static void Check(bool ok, string what)
{
_checks++;
if (ok) return;
_failed++;
Console.WriteLine(" [FAIL] " + what);
}
}

View file

@ -214,6 +214,13 @@ internal static class Program
Check(ChatCommandReplies.Check("window save").Problem!.StartsWith("Unknown command '/rc window'", StringComparison.Ordinal),
"'/rc window save' (sent by /ub window save) is not an engine verb, and now says so");
Check(ChatCommandReplies.Check(" SKILLS Show ").Problem == null, "case and spaces as IsVerb takes them");
// /rc inv [ac] (2026-11-26): alone toggles RynthCore's Inventory; ac / retail / game open AC's own bags.
foreach (string ok in new[] { "inv", "inventory", "inv ac", "INV AC", "inventory retail", "inv game" })
Check(ChatCommandReplies.Check(ok).Problem == null, $"'/rc {ok}' runs");
ChatVerbCheck badInv = ChatCommandReplies.Check("inv bags");
Check(badInv.Problem != null && badInv.Problem.Contains("/rc inventory ac", StringComparison.Ordinal),
$"'/rc inv bags' answers with the usage, which names /rc inventory ac: {badInv.Problem}");
}
private static void ModuleLinesClassified()

View file

@ -5,7 +5,9 @@
src\RynthCore.Engine\Compatibility\TellMemory.cs - who to reply / retell to, read off the
chat lines, and the rewrite of "/r text" into "/tell Name, text";
src\RynthCore.Engine\UI\Data\ChatInputPaste.cs - clipboard text made into one input line;
src\RynthCore.Engine\Compatibility\ChatLineRoute.cs - which lines are AC emotes, not speech.
src\RynthCore.Engine\Compatibility\ChatLineRoute.cs - which lines are AC emotes, not speech;
src\RynthCore.Engine\Compatibility\ChatSlashEmote.cs - "/wave" as AC's "*Wave*";
src\RynthCore.Engine\UI\Data\ChatTextSelection.cs - the chat's selected text and item lines as one.
Nothing native: no AC, no engine state.
Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
-->
@ -22,6 +24,8 @@
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\TellMemory.cs" Link="Engine\TellMemory.cs" />
<Compile Include="..\..\src\RynthCore.Engine\UI\Data\ChatInputPaste.cs" Link="Engine\ChatInputPaste.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\ChatLineRoute.cs" Link="Engine\ChatLineRoute.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\ChatSlashEmote.cs" Link="Engine\ChatSlashEmote.cs" />
<Compile Include="..\..\src\RynthCore.Engine\UI\Data\ChatTextSelection.cs" Link="Engine\ChatTextSelection.cs" />
</ItemGroup>
</Project>

View file

@ -25,6 +25,10 @@ internal static class Program
PasteClean();
PasteInsert();
EmoteLines();
MeAndAtCommands();
SlashEmotes();
SelectionText();
ItemInfoOneLine();
Console.WriteLine();
Console.WriteLine($"{_checks - _failed}/{_checks} checks passed.");
@ -196,6 +200,176 @@ internal static class Program
Check(!ChatLineRoute.IsAcEmoteLine(""), "empty");
}
// ── /me and @commands (ChatLineRoute.cs, 2026-11-26) ────────────────────
private static void MeAndAtCommands()
{
Case("/me is AC's @emote");
Check(ChatLineRoute.IsMeEmote("/me looks menacingly at the mob", out string t) && t == "looks menacingly at the mob", "/me text");
Check(ChatLineRoute.IsMeEmote("/ME waves ", out t) && t == "waves", "any case, trimmed");
Check(ChatLineRoute.IsMeEmote("/me", out t) && t.Length == 0, "/me alone");
Check(!ChatLineRoute.IsMeEmote("/meet you there", out _), "/meet is not /me");
Check(!ChatLineRoute.IsMeEmote("/menu", out _), "/menu is not /me");
Check(!ChatLineRoute.IsMeEmote("me too", out _), "plain words");
Check(!ChatLineRoute.IsMeEmote("", out _), "empty");
Case("@commands go to AC's parser");
Check(ChatLineRoute.IsAtCommand("@loc"), "@loc (a client command)");
Check(ChatLineRoute.IsAtCommand("@friends add Someone"), "@friends with arguments");
Check(ChatLineRoute.IsAtCommand("@myquests"), "@myquests (a server command: AC passes it on)");
Check(!ChatLineRoute.IsAtCommand("@"), "a lone @");
Check(!ChatLineRoute.IsAtCommand("@ everyone"), "@ then a space: speech");
Check(!ChatLineRoute.IsAtCommand("@@"), "@@");
Check(!ChatLineRoute.IsAtCommand("/loc"), "a / command is not an @ one (it takes the / path)");
Check(!ChatLineRoute.IsAtCommand("hello @Bob"), "an @ inside a line");
}
// ── /wave as *Wave* (ChatSlashEmote.cs, 2026-11-26) ─────────────────────
private static void SlashEmotes()
{
Case("/emote word is AC's *Emote*");
Check(ChatSlashEmote.TryMatch("/wave", out string a) && a == "*Wave*", "/wave");
Check(ChatSlashEmote.TryMatch("/WAVE", out a) && a == "*Wave*", "any case");
Check(ChatSlashEmote.TryMatch("/ymca", out a) && a == "*YMCA*", "/ymca, AC's capitals");
Check(ChatSlashEmote.TryMatch("/BeSeeingYou", out a) && a == "*BeSeeingYou*", "/BeSeeingYou");
Check(ChatSlashEmote.TryMatch("/wavehigh", out a) && a == "*WaveHigh*", "/wavehigh is WaveHigh, not Wave");
Check(ChatSlashEmote.TryMatch("/teapot", out a) && a == "*Teapot*", "/teapot");
int all = 0;
foreach (string name in ChatSlashEmote.Names)
if (ChatSlashEmote.TryMatch("/" + name.Replace(" ", ""), out a) && a == "*" + name + "*"
&& ChatLineRoute.IsAcEmoteLine(a))
all++;
Check(all == ChatSlashEmote.Names.Length && all == 41, $"every one of AC's 41 emotes, as an asterisk line AC's parser path takes ({all})");
Case("two-word emotes, run together or apart");
Check(ChatSlashEmote.TryMatch("/warmhands", out a) && a == "*Warm Hands*", "/warmhands");
Check(ChatSlashEmote.TryMatch("/warm hands", out a) && a == "*Warm Hands*", "/warm hands");
Check(ChatSlashEmote.TryMatch("/Warm Hands", out a) && a == "*Warm Hands*", "/Warm Hands, two spaces");
Check(ChatSlashEmote.TryMatch("/scratch head", out a) && a == "*Scratch Head*", "/scratch head");
Check(ChatSlashEmote.TryMatch("/SHAKEHEAD", out a) && a == "*Shake Head*", "/SHAKEHEAD");
Check(!ChatSlashEmote.TryMatch("/warm", out _), "/warm alone");
Check(!ChatSlashEmote.TryMatch("/shake", out _), "/shake alone");
Check(!ChatSlashEmote.TryMatch("/wave high", out _), "/wave high: WaveHigh is one word, so text after /wave");
Case("anything else is left as it is");
Check(!ChatSlashEmote.TryMatch("/wave hello", out a) && a.Length == 0, "/wave hello: text after the emote");
Check(!ChatSlashEmote.TryMatch("/warm hands now", out _), "/warm hands now");
Check(!ChatSlashEmote.TryMatch("/waves", out _), "/waves");
Check(!ChatSlashEmote.TryMatch("/wav", out _), "/wav");
Check(!ChatSlashEmote.TryMatch("/ wave", out _), "/ wave");
Check(!ChatSlashEmote.TryMatch("wave", out _), "no slash: speech");
Check(!ChatSlashEmote.TryMatch("*wave*", out _), "*wave* takes its own route");
Check(!ChatSlashEmote.TryMatch("@wave", out _), "@wave");
Check(!ChatSlashEmote.TryMatch("/", out _) && !ChatSlashEmote.TryMatch("", out _) && !ChatSlashEmote.TryMatch(null, out _), "/, empty, null");
Case("claimed commands win");
// AC's own client command words (its command table in acclient.exe, 2026-11-26): AC's
// parser runs them, so none may be an emote word.
string[] acCommands =
[
"abandon", "boot_all", "ma", "alleg_recall", "mansion_recall", "re", "recall", "rt", "clist", "index",
"log", "unfilter", "filter", "text", "lockui", "loadautoui", "saveautoui", "loadui", "saveui", "version",
"render", "pkl", "pklite", "loc", "framerate", "endurance", "day", "birth", "age", "status", "msg_types",
"msgtypes", "message_types", "messagetypes", "unsquelch", "squelch", "hoa", "hom", "hr", "hor", "hslist",
"hou", "friends_remove", "friends_add", "friends", "loadfile", "fillcomps", "emotes", "me", "emote", "em",
"e", "pla", "pklarena", "pka", "pkarena", "permit", "mp", "mar", "marketplace", "ls", "lif", "lifestone",
"die", "cor", "corpse", "consent", "death", "afk", "whisper", "send", "t", "tell", "say", "retell", "pr",
"mr", "rp", "notell", "chatting", "leave", "join", "vassal", "vassals", "patron", "monarch", "party", "g",
"group", "fellow", "fellows", "fellowship", "covassal", "covassals", "co-vassals", "channels", "speaker",
"ah", "alh", "ab", "allegiance", "allegiances", "commands", "help", "house", "lock", "motd", "ho",
"hometown", "title", "officer", "ban", "br", "broadcast", "ch", "chat", "info", "boot", "who", "olthoi",
"soc", "society", "crp", "roleplay", "clfg", "lfg", "ct", "trade", "cg", "general", "gu", "guild",
// and the routes and commands the dispatcher hands out before the emote
"a", "f", "r", "reply", "s", "rc", "ra", "vt", "ub", "mt", "lua", "rl",
];
int stolen = 0;
foreach (string cmd in acCommands)
if (ChatSlashEmote.TryMatch("/" + cmd, out _)) { stolen++; Console.WriteLine($" an emote name is a command: /{cmd}"); }
Check(stolen == 0, "no AC, engine or plugin command word is an emote");
Check(!ChatSlashEmote.TryMatch("/rc ui", out _) && !ChatSlashEmote.TryMatch("/ra start", out _), "/rc and /ra lines");
Check(!ChatSlashEmote.TryMatch("/e waves", out _) && !ChatSlashEmote.TryMatch("/a hi", out _)
&& !ChatSlashEmote.TryMatch("/f hi", out _) && !ChatSlashEmote.TryMatch("/r hi", out _), "/e /a /f /r lines");
Check(TellMemory.Parse("/wave", out _) == TellShortcut.None, "the /r rewrite (asked before the emote) leaves /wave alone");
}
// ── text selection (ChatTextSelection.cs) ───────────────────────────────
private static void SelectionText()
{
Case("ends in reading order");
int al = 5, ac = 3, bl = 2, bc = 9;
ChatTextSelection.Order(ref al, ref ac, ref bl, ref bc);
Check(al == 2 && ac == 9 && bl == 5 && bc == 3, "later line first: swapped");
al = 4; ac = 8; bl = 4; bc = 2;
ChatTextSelection.Order(ref al, ref ac, ref bl, ref bc);
Check(al == 4 && ac == 2 && bl == 4 && bc == 8, "same line, backwards drag: swapped");
al = 1; ac = 0; bl = 3; bc = 0;
ChatTextSelection.Order(ref al, ref ac, ref bl, ref bc);
Check(al == 1 && bl == 3, "already in order: kept");
Case("the part of a line that is copied");
const string line = "Bob says, \"meet at 42.1N, 33.6E\"";
Check(ChatTextSelection.Part(line, "12:01:33", 0, line.Length) == "12:01:33 " + line, "whole line keeps its timestamp");
Check(ChatTextSelection.Part(line, null, 0, line.Length) == line, "timestamps off: just the text");
Check(ChatTextSelection.Part(line, "12:01:33", 19, 31) == "42.1N, 33.6E", "the middle: no timestamp");
Check(ChatTextSelection.Part(line, "12:01:33", 0, 3) == "12:01:33 Bob", "from the start: timestamp too");
Check(ChatTextSelection.Part(line, null, 31, 19) == "42.1N, 33.6E", "ends the wrong way round");
Check(ChatTextSelection.Part(line, null, -4, 999) == line, "out of range: clamped");
Check(ChatTextSelection.Part("", "12:00:00", 0, 0) == "12:00:00 ", "an empty line");
Case("surrogate pairs are never split");
string smile = "a\U0001F600b"; // a, high, low, b
Check(ChatTextSelection.Clamp(smile, 2) == 1, "between the halves: to the pair's start");
Check(ChatTextSelection.Clamp(smile, 3) == 3, "after the pair: kept");
Check(ChatTextSelection.Part(smile, null, 0, 2) == "a", "a cut inside the pair drops the half");
Case("the character under the mouse");
Func<int, float> w = _ => 10f; // every character 10 wide
Check(ChatTextSelection.CharAtX("hello", 0, 5, -3f, w) == 0, "left of the row: its start");
Check(ChatTextSelection.CharAtX("hello", 0, 5, 4f, w) == 0, "left half of the first character");
Check(ChatTextSelection.CharAtX("hello", 0, 5, 6f, w) == 1, "right half: after it");
Check(ChatTextSelection.CharAtX("hello", 0, 5, 26f, w) == 3, "26 px: between l and l");
Check(ChatTextSelection.CharAtX("hello", 0, 5, 500f, w) == 5, "right of the row: its end");
Check(ChatTextSelection.CharAtX("hello world", 6, 11, 12f, w) == 7, "a later row starts at its own start");
Check(ChatTextSelection.CharAtX(smile, 0, smile.Length, 16f, w) == 3, "a pair is one character");
}
// ── an item's info lines as one (ChatTextSelection.cs) ──────────────────
private static void ItemInfoOneLine()
{
const string P = ChatTextSelection.ItemPrefix;
var lines = new List<string>
{
"You say, \"look at this\"",
P + "Ornate Long Sword, Gold, Craft 6, Value 4,200",
P + " Slash, 80-120, +5% Melee D",
P + " Damage Rating 3 Wield 300",
P + " Spells: Blood Drinker VI, Swift Killer VI",
P + "Pearl of Blood Drinking, Rare",
"Bob says, \"nice\"",
};
Case("which lines are one item's");
Check(ChatTextSelection.ItemRun(lines, 1, out int f, out int l) && f == 1 && l == 4, "from its name line: the 3 lines under it");
Check(ChatTextSelection.ItemRun(lines, 3, out f, out l) && f == 1 && l == 4, "from a line under it: back to its name");
Check(ChatTextSelection.ItemRun(lines, 5, out f, out l) && f == 5 && l == 5, "the next item: its own line only");
Check(!ChatTextSelection.ItemRun(lines, 0, out _, out _), "a say line is no item");
Check(!ChatTextSelection.ItemRun(lines, 99, out _, out _), "out of range");
Check(ChatTextSelection.IsItemDetail(lines[2]) && !ChatTextSelection.IsItemDetail(lines[1]), "detail = indented under the name");
Case("joined into one line");
ChatTextSelection.ItemRun(lines, 2, out f, out l);
Check(ChatTextSelection.ItemOneLine(lines, f, l)
== "Ornate Long Sword, Gold, Craft 6, Value 4,200, Slash, 80-120, +5% Melee D, Damage Rating 3, Wield 300, Spells: Blood Drinker VI, Swift Killer VI",
"tags gone, lines and two-space gaps joined with commas");
Check(ChatTextSelection.ItemOneLine(lines, 5, 5) == "Pearl of Blood Drinking, Rare", "one line: just without its tag");
var orphan = new List<string> { P + " Slash, 80-120", P + " Wield 300" };
Check(ChatTextSelection.ItemRun(orphan, 1, out f, out l) && f == 0 && l == 1, "name line scrolled away: the lines that are there");
}
private static void Case(string name)
{
_case = name;

View file

@ -35,6 +35,7 @@ namespace CombatSettingsTests
("KiteTagFirst", typeof(bool?), "true"),
("MeleeThroughWalls", typeof(bool?), "true"), // Combat > Targeting > Melee through walls (2026-11-15)
("DebuffAllBeforeAttacking", typeof(bool?), "false"), // Combat > Targeting > Debuff every monster in range before attacking (2026-11-22)
("ShowLosLine", typeof(bool?), "false"), // Combat > Line Of Sight > Show Line of Sight (2026-11-26)
};
private static int Main()
@ -103,11 +104,12 @@ namespace CombatSettingsTests
("Combat", "Magic Response", "Combo", 0, 0, 3), // beside Missile Response since 2026-11-11
("Combat", "Melee through walls", "Bool", 1, 0, 1), // on by default (2026-11-15)
("Combat", "Debuff every monster in range before attacking", "Bool", 0, 0, 1), // off by default (2026-11-22)
("Combat", "Show Line of Sight", "Bool", 0, 0, 1), // off by default (2026-11-26)
};
object older = Parse("{\"BoostNavPriority\":true}"); // what an older RynthAi sends
object newer = Parse("{\"VariablePowerMin\":50,\"VariablePowerMax\":100,\"MissileEnvironmentResponse\":0,\"MagicEnvironmentResponse\":0," +
"\"EnvironmentImpactLimit\":2,\"EnvironmentImpactWindowSec\":20,\"EnvironmentApproachMeters\":6,\"EnvironmentMinDistance\":3," +
"\"EnvironmentSkipSec\":30,\"KitePullMeters\":20,\"KiteTagFirst\":true,\"MeleeThroughWalls\":true,\"DebuffAllBeforeAttacking\":false}"); // the plugin's own defaults
"\"EnvironmentSkipSec\":30,\"KitePullMeters\":20,\"KiteTagFirst\":true,\"MeleeThroughWalls\":true,\"DebuffAllBeforeAttacking\":false,\"ShowLosLine\":false}"); // the plugin's own defaults
foreach (var (tab, label, kind, def, min, max) in rows)
{
object? row = Row(tab, label, kind);
@ -147,9 +149,12 @@ namespace CombatSettingsTests
Set(Row("Combat", "Magic Response", "Combo")!, edit, 1);
Set(Row("Combat", "Melee through walls", "Bool")!, edit, 0);
Set(Row("Combat", "Debuff every monster in range before attacking", "Bool")!, edit, 1);
Set(Row("Combat", "Show Line of Sight", "Bool")!, edit, 1);
string after = JsonSerializer.Serialize(edit, info);
Check(after.Contains("\"MeleeThroughWalls\":false"), "Melee through walls unticked saves false (RynthAi turns it off)");
Check(after.Contains("\"DebuffAllBeforeAttacking\":true"), "Debuff every monster ticked saves true (RynthAi turns it on)");
Check(after.Contains("\"ShowLosLine\":true"), "Show Line of Sight ticked saves true (RynthAi turns it on)");
Check(JsonSerializer.Serialize(Parse("{\"BoostNavPriority\":true}"), info).Contains("\"ShowLosLine\":null"), "an older RynthAi's Show Line of Sight is sent back absent (unchanged)");
Check(after.Contains("\"KitePullMeters\":55") && after.Contains("\"KiteTagFirst\":true") && after.Contains("\"MagicEnvironmentResponse\":1"), "the edits land on their own properties");
Check(after.Contains("\"BoostNavPriority\":true") && after.Contains("\"EnvironmentSkipSec\":60") && after.Contains("\"MissileEnvironmentResponse\":2"), "the other settings ride along unchanged");
@ -208,9 +213,91 @@ namespace CombatSettingsTests
foreach (string f in voidFields)
Check(ruleJson.Contains($"\"{f}\":true"), $"the panel sends \"{f}\":true");
// ── Settings > Spell Combat > Attack Spell Shapes (2026-11-26) ─────────────
DefaultShapes(engine, tabs, rule, Lst);
return Finish();
}
// The DEFAULT monster line's shapes as Settings rows (UI/Data/DefaultSpellShapes.cs): "use streaks
// instead of bolts" where the attack-spell settings are, and the monsters that keep their own.
private static void DefaultShapes(Assembly engine, Dictionary<string, List<object>> tabs, Type rule, Func<object[], IList> lst)
{
Type shapes = engine.GetType(Ns + "DefaultSpellShapes", throwOnError: true)!;
var defs = ((string Field, string Label, string Tip)[])shapes.GetField("Rows", All)!.GetValue(null)!;
static string Label(object r) => (string?)r.GetType().GetProperty("Label")!.GetValue(r) ?? "";
static string Kind(object r) => r.GetType().GetProperty("Kind")!.GetValue(r)!.ToString()!;
// The rows: the streak one first, every shape once, on Spell Combat, before Casting.
Check(defs.Length == 6 && defs[0].Field == "UseStreak" && defs[0].Label == "Use streaks instead of bolts", "the first row is Use streaks instead of bolts");
Check(defs.Select(d => d.Field).OrderBy(f => f).SequenceEqual(new[] { "UseArc", "UseBlast", "UseBolt", "UseRing", "UseStreak", "UseWall" }),
"every shape of a monster rule has a row (arc, blast, bolt, ring, streak, wall)");
List<object> spell = tabs["Spell Combat"];
int section = spell.FindIndex(r => Label(r) == (string)shapes.GetField("SectionLabel", All)!.GetValue(null)! && Kind(r) == "Section");
int casting = spell.FindIndex(r => Label(r) == "Casting" && Kind(r) == "Section");
Check(section == 0 && casting > section, "Attack Spell Shapes is the first section of Spell Combat, above Casting");
foreach (var d in defs)
{
object? row = spell.FirstOrDefault(r => Label(r) == d.Label && Kind(r) == "Bool");
Check(row != null, $"Spell Combat has the Bool row '{d.Label}'");
Check((bool)shapes.GetMethod("IsShapeLabel", All)!.Invoke(null, new object?[] { d.Label })!, $"'{d.Label}' is known as a shape row (the My settings drawer polls the rules for it)");
Check(d.Tip.Length > 20, $"'{d.Label}' has a tooltip");
}
Check(!(bool)shapes.GetMethod("IsShapeLabel", All)!.Invoke(null, new object?[] { "Min Ring Targets" })!, "other rows aren't shape rows");
Check(spell.Any(r => Label(r) == (string)shapes.GetField("OpenMonstersLabel", All)!.GetValue(null)! && Kind(r) == "Button"), "a button opens the per-monster place");
object Rule(string name, bool arc = false, bool bolt = true, bool ring = false, bool streak = false, bool blast = false, bool wall = false)
{
object r = Activator.CreateInstance(rule, nonPublic: true)!;
rule.GetProperty("Name")!.SetValue(r, name);
rule.GetProperty("UseArc")!.SetValue(r, arc);
rule.GetProperty("UseBolt")!.SetValue(r, bolt);
rule.GetProperty("UseRing")!.SetValue(r, ring);
rule.GetProperty("UseStreak")!.SetValue(r, streak);
rule.GetProperty("UseBlast")!.SetValue(r, blast);
rule.GetProperty("UseWall")!.SetValue(r, wall);
return r;
}
bool Flag(object r, string f) => (bool)rule.GetProperty(f)!.GetValue(r)!;
void Set(object r, string f, bool on) => shapes.GetMethod("Set", All)!.Invoke(null, new object[] { r, f, on });
string Casts(object r) => (string)shapes.GetMethod("Casts", All)!.Invoke(null, new[] { r })!;
string Summary(params object[] rules) => (string)shapes.GetMethod("Summary", All)!.Invoke(null, new object?[] { lst(rules) })!;
// Setting a shape.
object def = Rule("Default");
Set(def, "UseStreak", true);
Check(Flag(def, "UseStreak") && Flag(def, "UseBolt") && Casts(def) == "Streak", "Use streaks on: streaks are cast instead of bolts");
Set(def, "UseArc", true);
Check(Casts(def) == "Arc", "arcs come first (RynthAi's order: Arc, Streak, Blast, Bolt)");
Set(def, "UseArc", false);
Set(def, "UseRing", true);
Check(Casts(def) == "Streak, Ring when enough are near", "a ring is told as the override it is: " + Casts(def));
object only = Rule("Default", bolt: false, streak: true);
Set(only, "UseStreak", false);
Check(Flag(only, "UseBolt") && !Flag(only, "UseStreak"), "turning the last shape off turns bolts back on (never no shape: RynthAi wouldn't cast)");
object blastBolt = Rule("Default", blast: true);
Check(Casts(blastBolt) == "Blast", "a blast wins over the bolt");
Set(blastBolt, "Fester", true);
Check(!Flag(blastBolt, "Fester"), "Set only touches shapes");
// The line under the rows: what the Default line casts, and the monsters with their own entry.
object d1 = Rule("Default", streak: true);
string none = Summary(d1);
Check(none == "Every monster casts Streak.", "no monster has its own entry: " + none);
string three = Summary(d1, Rule("Drudge"), Rule("Mite Squire", arc: true), Rule("Tusker", bolt: false, streak: true, ring: true), Rule("Olthoi", streak: true));
Check(three.StartsWith("Monsters without their own entry cast Streak. 3 monsters have their own setting: Drudge, Mite Squire, Tusker.", StringComparison.Ordinal),
"three monsters with other shapes are counted and named: " + three);
Check(three.Contains(" 1 more has its own entry, set the same for now.", StringComparison.Ordinal), "one set the same is counted apart: " + three);
Check(three.EndsWith("Those keep their own shapes: change one in Monsters (click its name).", StringComparison.Ordinal), "and says where to change them: " + three);
string many = Summary(d1, Rule("A"), Rule("B"), Rule("C"), Rule("D"), Rule("E"));
Check(many.Contains("5 monsters have their own setting: A, B, C (+2 more).", StringComparison.Ordinal), "past three names: +N more: " + many);
string same = Summary(d1, Rule("Drudge", streak: true));
Check(same.Contains("1 monster has its own entry, set the same for now. It keeps its own shapes", StringComparison.Ordinal), "one the same, singular: " + same);
Check(Summary(Rule("Drudge")) == "", "no Default rule: no line (the rows are hidden)");
object lower = Rule("default", streak: true);
Check(Summary(lower, Rule("Drudge", streak: true)).StartsWith("Monsters without", StringComparison.Ordinal), "Default is found in any case");
}
private static int Finish()
{
Console.WriteLine(_fails == 0 ? $"All {_asserts} checks passed." : $"{_fails} of {_asserts} checks FAILED.");

View file

@ -46,6 +46,7 @@
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\WorldTransitionState.cs" Link="Engine\WorldTransitionState.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\AddressSpace.cs" Link="Engine\AddressSpace.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\ActionRing.cs" Link="Engine\ActionRing.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\GestureDeferRule.cs" Link="Engine\GestureDeferRule.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\CastStopRules.cs" Link="Engine\CastStopRules.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\MutatorGate.cs" Link="Engine\MutatorGate.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\ReleasedObjectRetention.cs" Link="Engine\ReleasedObjectRetention.cs" />

View file

@ -11,6 +11,8 @@ internal static partial class Program
private static void RunRingAndGateTests()
{
RingTakesAStopWhenFullOfStarts();
GestureDeferWaitsForAPlayingMotion();
GestureDeferStopsWaitingOnAStuckMotion();
RingRefusesStartsDuringATransition();
RingStopRunsFirstAfterTheWindow();
CastStopFindsAnOutOfOrderStop();
@ -43,6 +45,43 @@ internal static partial class Program
private readonly record struct Act(string What, long At, bool Teardown);
// ---- the gesture defer (GestureDeferRule, R-20261123-152528-b02d) --------------------
private static void GestureDeferWaitsForAPlayingMotion()
{
_case = "gesture defer";
var r = new GestureDeferRule(2_500);
Check(!r.Defer(0, 1_000, out _), "an empty motion list: nothing waits");
Check(r.Defer(0x100, 1_000, out _), "a motion in flight: the ring waits");
Check(r.Defer(0x100, 3_400, out _), "2.4 s on it: still waiting");
// Swing after swing: a new motion at the head each time keeps the waits, capped as before.
Check(r.Defer(0x200, 3_450, out bool w1) && !w1, "the next swing: still waiting, not stuck");
Check(!r.Defer(0x300, 3_502, out bool w2) && !w2, "the wait is 2.5 s at most: then the ring runs (not stuck)");
Check(r.Defer(0x400, 3_503, out _), "and a new wait starts");
r.RingEmptied();
Check(r.Defer(0x500, 7_000, out _), "after the ring emptied, a full wait again");
}
private static void GestureDeferStopsWaitingOnAStuckMotion()
{
_case = "gesture defer stuck";
var r = new GestureDeferRule(2_500);
Check(r.Defer(0x100, 10_000, out _), "a motion at the head: the ring waits");
Check(r.Defer(0x100, 12_400, out bool w1) && !w1, "2.4 s on the same motion: still waiting");
Check(!r.Defer(0x100, 12_501, out bool w2) && w2 && r.Wedged, "the same motion there past 2.5 s: taken as stuck (logged once), the ring runs");
int waits = 0;
bool again = false;
for (long t = 12_600; t < 20_000; t += 33)
{
if (r.Defer(0x100, t, out bool w)) waits++;
again |= w;
}
Check(waits == 0 && !again, $"while it stays stuck the ring never waits on it (was a 2.5 s wait each time; {waits} waits)");
Check(r.Defer(0x200, 20_000, out _) && !r.Wedged, "a new motion at the head: waited on again");
Check(!r.Defer(0, 20_100, out _) && !r.Wedged, "an empty list clears it");
Check(r.Defer(0x200, 20_200, out _), "the same pointer coming back after an empty read is a new motion");
}
private static void RingTakesAStopWhenFullOfStarts()
{
_case = "ring reserve";

View file

@ -70,6 +70,7 @@ namespace EngineSettingsTests
Run(nameof(PlacementSaveNeedsAStableInWorldRect), PlacementSaveNeedsAStableInWorldRect);
Run(nameof(AcWindowChromeNeverResizes), AcWindowChromeNeverResizes);
Run(nameof(PlacementSizeIsAcsResolution), PlacementSizeIsAcsResolution);
Run(nameof(BorderlessFullScreenFillsMonitor), BorderlessFullScreenFillsMonitor);
Run(nameof(SavedSizeIgnoredLine), SavedSizeIgnoredLine);
Run(nameof(PlacementFilesArePerClient), PlacementFilesArePerClient);
Run(nameof(PlacementFileRoundTrips), PlacementFileRoundTrips);
@ -956,11 +957,14 @@ namespace EngineSettingsTests
bool keepsSize = call.Contains("SwpNosize");
bool forResolution = call.Contains("d.Width, d.Height");
bool keepsClient = call.Contains("outerW, outerH");
bool fillsMonitor = call.Contains("fill.Width, fill.Height"); // borderless full screen (2026-11-26)
if (!keepsSize) sized++;
Check(keepsSize || forResolution || keepsClient, "SetWindowPos keeps AC's size or sizes it for AC's resolution: " + call);
Check(keepsSize || forResolution || keepsClient || fillsMonitor, "SetWindowPos keeps AC's size or sizes it for AC's resolution: " + call);
Check(!Regex.IsMatch(call, @"\b(saved|sv|from|_saved|_reference|rf)\b"), "SetWindowPos never uses a saved rect: " + call);
}
Eq(sized, 2, "two calls size the window (the restore for AC's resolution, the borderless style change)");
Eq(sized, 3, "three calls size the window (the restore for AC's resolution, the borderless style change, borderless full screen)");
// The full screen rect is the monitor's, from BorderlessFill: never a saved rect.
Check(Regex.IsMatch(source, @"BorderlessFill(Needed)?\(outer, client, DrawSize\(\), monitor\)"), "the full screen rect comes from the monitor");
// The restore plan's size is AC's resolution plus the frame, never the saved size.
string policy = File.ReadAllText(FindUp(Path.Combine("src", "RynthCore.Engine", "UI", "AcWindowChromePolicy.cs")));
Check(policy.Contains("OuterForDrawSize(d, current, client)"), "the resize target comes from the back buffer's size");
@ -1047,6 +1051,54 @@ namespace EngineSettingsTests
Eq(SaveRefusedForSize(new Size(1600, 899), Draw1600), "its client area 1600x899 is not AC's resolution 1600x900", "one pixel off is still stretched");
}
// ── 2026-11-26: borderless full screen fills its monitor ────────────
// Discord 11-26: since 2026.11.23.1 a 1920x1080 game made borderless kept its picture at (3,26),
// under where the caption had been: a gap at the top and the taskbar showing.
private static readonly Rect Monitor1080 = new(0, 0, 1920, 1080);
private static readonly Rect Monitor2Right = new(1920, 0, 1920 + 2560, 1440); // a second monitor
private static readonly Size Draw1080 = new(1920, 1080);
private static void BorderlessFullScreenFillsMonitor()
{
// The report: AC at the monitor's resolution, its framed window at (0,0) (client at (3,26)).
var framed = new Rect(0, 0, 1926, 1109);
Eq(BorderlessFill(framed, Draw1080, Draw1080, Monitor1080), Monitor1080, "1920x1080 game on a 1920x1080 monitor: fills the monitor, taskbar included");
// The 11.23 result itself (borderless at the client's old spot) is put back on the monitor.
var gap = new Rect(3, 26, 3 + 1920, 26 + 1080);
Eq(BorderlessFillNeeded(gap, Draw1080, Draw1080, Monitor1080), Monitor1080, "borderless with the caption-high gap: moved back onto the monitor");
Eq(BorderlessFillNeeded(Monitor1080, Draw1080, Draw1080, Monitor1080), (Rect?)null, "already exactly on the monitor: nothing to do");
// Centred by AC, framed window hanging off every edge: still the monitor it is on.
Eq(BorderlessFill(new Rect(-3, -14, 1923, 1095), new Size(1920, 1080), Draw1080, Monitor1080), Monitor1080, "centred framed window: fills");
// Windows clamped the framed window, so the client is smaller than the game: the game's size decides.
Eq(BorderlessFill(new Rect(0, 0, 1926, 1092), new Size(1920, 1063), Draw1080, Monitor1080), Monitor1080, "clamped framed window: fills");
// Back buffer not read yet: the client area decides, and so does a window covering the monitor.
Eq(BorderlessFill(framed, Draw1080, null, Monitor1080), Monitor1080, "resolution unknown, client at the monitor's size: fills");
Eq(BorderlessFill(new Rect(-8, -31, 1928, 1088), new Size(1920, 1050), null, Monitor1080), Monitor1080, "resolution unknown, framed window covers the monitor: fills");
// An older borderless window a few pixels bigger than the monitor (the strip kept the outer rect): snapped exactly.
Eq(BorderlessFillNeeded(new Rect(0, 0, 1926, 1109), new Size(1926, 1109), Draw1080, Monitor1080), Monitor1080, "a borderless window past the monitor's edges: snapped onto it");
// A game bigger than the monitor: fills (the best a borderless window can do).
Eq(BorderlessFill(new Rect(0, 0, 1926, 1109), new Size(1920, 1080), new Size(2560, 1440), Monitor1080), Monitor1080, "game above the monitor's size: fills");
// The monitor the window is on, not the primary one.
var onSecond = new Rect(1920, 0, 1920 + 2566, 1469);
Eq(BorderlessFill(onSecond, new Size(2560, 1440), new Size(2560, 1440), Monitor2Right), Monitor2Right, "second monitor: fills that monitor");
// Normal borderless windowed (2026-11-21) is unchanged: a smaller game keeps its client area.
Eq(BorderlessFill(At1600, Client1600, Draw1600, Monitor1080), (Rect?)null, "1600x900 on 1920x1080: no fill, the client area stays");
Eq(BorderlessFillNeeded(new Rect(203, 129, 1803, 1029), Client1600, Draw1600, Monitor1080), (Rect?)null, "1600x900 borderless: never moved or resized");
Eq(BorderlessFill(new Rect(0, 0, 1926, 1109), Draw1080, Draw1080, new Rect(0, 0, 1920, 1200)), (Rect?)null, "1920x1080 on a 1920x1200 monitor: not full screen, no stretch");
Eq(BorderlessFill(new Rect(0, 0, 1926, 1109), new Size(1920, 1080), new Size(1920, 1080), new Rect(0, 0, 2560, 1440)), (Rect?)null, "1920x1080 on 2560x1440: no fill");
Eq(BorderlessFill(new Rect(0, 0, 1926, 1109), Draw1080, Draw1080, new Rect(0, 0, 0, 0)), (Rect?)null, "no monitor information: no fill");
// One dimension at the monitor's size is not full screen.
Eq(BorderlessFill(new Rect(0, 0, 1926, 909), new Size(1920, 880), new Size(1920, 880), Monitor1080), (Rect?)null, "full width, short: no fill");
// Once filled, the window is what LooksExclusiveFullscreen calls full screen, so the strip is not
// repeated and the restore / save stand down (the existing guards).
Eq(DecideBorderless(true, 0x00CF0000, 0x00CF0000 & ~BorderChromeMask, true).Action, ChromeAction.None, "filled and ours: no further strip");
Eq(DecideRestore(Saved1940, false, true, Monitor1080, Draw1080, Draw1080, S(30), S(30), Screen2560).Resize, false, "filled: the restore never resizes it");
}
// The launcher's shared line for the ignored size (AcWindowPlacementRule.SavedSizeIgnored).
private static void SavedSizeIgnoredLine()
{

View file

@ -27,6 +27,8 @@
<Compile Include="..\..\src\RynthCore.Engine\UI\BarLayout.cs" Link="Engine\BarLayout.cs" />
<!-- Where a docked window draws versus its home (the saved spot): 2026-11-12, panels moving on reload/login. -->
<Compile Include="..\..\src\RynthCore.Engine\UI\PanelPlacement.cs" Link="Engine\PanelPlacement.cs" />
<!-- Pop-outs follow the game window and stay on the screen; "bring windows back" (2026-11-24 report). -->
<Compile Include="..\..\src\RynthCore.Engine\UI\PopOutPlacement.cs" Link="Engine\PopOutPlacement.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Plugins\EngineSettingsFile.cs" Link="Engine\EngineSettingsFile.cs" />
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\ChatCommandReplies.cs" Link="Engine\ChatCommandReplies.cs" />
<!-- ChatCommandReplies' /rc sense row names SenseLayout (the Sense views, feature/sense-compact). -->

View file

@ -69,6 +69,8 @@ namespace PanelLayoutTests
Run(PulledOnScreenNeverMovesTheSavedSpot);
Run(TheBarKeepsItsHome);
Run(HomeSurvivesAReloadThroughTheStore);
Run(PopOutsFollowTheGameWindowAndStayOnScreen);
Run(BringWindowsBack);
}
finally
{
@ -913,16 +915,17 @@ namespace PanelLayoutTests
Eq(PanelLayoutPolicy.ParseCommand("default"), LayoutCommand.MakeDefault, "default");
Eq(PanelLayoutPolicy.ParseCommand("reset"), LayoutCommand.ResetAsk, "reset alone asks");
Eq(PanelLayoutPolicy.ParseCommand("reset Confirm"), LayoutCommand.ResetConfirm, "reset confirm, any spacing and case");
Eq(PanelLayoutPolicy.ParseCommand(" HERE "), LayoutCommand.BringHere, "here: bring the popped-out windows back");
foreach (string bad in new[] { "frob", "default now", "reset now", "confirm", "reset confirm please" })
Eq(PanelLayoutPolicy.ParseCommand(bad), LayoutCommand.Invalid, $"'{bad}' is not a form");
Case("/rc layout: the check before it runs (ChatCommandReplies)");
foreach (string ok in new[] { "layout", "layout status", "layout default", "layout reset", "layout reset confirm", "LAYOUT Reset confirm" })
foreach (string ok in new[] { "layout", "layout status", "layout default", "layout reset", "layout reset confirm", "LAYOUT Reset confirm", "layout here" })
{
ChatVerbCheck c = ChatCommandReplies.Check(ok);
Check(c.Problem == null && c.Verb?.Name == "layout", $"'/rc {ok}' runs");
}
foreach (string bad in new[] { "layout frob", "layout default now", "layout reset please" })
foreach (string bad in new[] { "layout frob", "layout default now", "layout reset please", "layout here now" })
{
ChatVerbCheck c = ChatCommandReplies.Check(bad);
Check(c.Verb?.Name == "layout" && c.Problem == PanelLayoutPolicy.Usage, $"'/rc {bad}' answers with the usage");
@ -1007,6 +1010,99 @@ namespace PanelLayoutTests
Eq(PanelLayoutPolicy.ParseCommand("reset confirm"), LayoutCommand.ResetConfirm, "the button's command is reset confirm");
}
// ── pop-outs: following the game window, on the screen (2026-11-24 report) ──
private static void PopOutsFollowTheGameWindowAndStayOnScreen()
{
Case("pop-outs: the anchor text");
var client = ScreenRect.FromSize(100, 50, 1600, 900);
string text = PopOutPlacement.FormatAnchor(client);
Eq(text, "100,50,1600,900", "left,top,width,height");
Check(PopOutPlacement.TryParseAnchor(text, out ScreenRect back) && back == client, "reads back");
Check(PopOutPlacement.TryParseAnchor(" -1920 , 0 , 1920 , 1080 ", out ScreenRect left) && left == ScreenRect.FromSize(-1920, 0, 1920, 1080),
"a monitor left of the main one, any spacing");
foreach (string bad in new[] { "", " ", "1,2,3", "1,2,3,4,5", "a,b,c,d", "1,2,0,5", "1,2,5,-3" })
Check(!PopOutPlacement.TryParseAnchor(bad, out _), $"'{bad}' isn't an anchor");
Eq(PopOutPlacement.AnchorKey("RynthChat"), "popout.anchor.RynthChat", "the panel_state value's key");
Case("pop-outs: a saved spot over the game window moves with it");
var was = ScreenRect.FromSize(0, 0, 1600, 900);
var now = ScreenRect.FromSize(1920, 100, 1600, 900); // the launcher opened it on the second monitor
int l = 1200, t = 600;
Check(PopOutPlacement.FollowGameWindow(ref l, ref t, 300, 200, was, now), "it moves");
Eq((l, t), (3120, 700), "the same place on the game window");
l = 1500; t = 850; // only its corner was over the game window: still "on it"
Check(PopOutPlacement.FollowGameWindow(ref l, ref t, 300, 200, was, now) && (l, t) == (3420, 950), "a pop-out half over the edge follows too");
Case("pop-outs: a spot away from the game window stays where the player put it");
l = 2000; t = 100; // on the second monitor, beside the game window
Check(!PopOutPlacement.FollowGameWindow(ref l, ref t, 300, 200, was, now) && (l, t) == (2000, 100), "not over the game window: kept");
l = 1600; t = 0; // touching the right edge (right is exclusive): not over it
Check(!PopOutPlacement.FollowGameWindow(ref l, ref t, 300, 200, was, now) && (l, t) == (1600, 0), "touching the edge isn't over it");
Case("pop-outs: nothing known, nothing moved");
l = 1200; t = 600;
Check(!PopOutPlacement.FollowGameWindow(ref l, ref t, 300, 200, null, now), "no anchor saved (a spot from an older engine)");
Check(!PopOutPlacement.FollowGameWindow(ref l, ref t, 300, 200, was, null), "no game window now (minimized)");
Check(!PopOutPlacement.FollowGameWindow(ref l, ref t, 300, 200, was, was), "the game window didn't move");
Check(!PopOutPlacement.FollowGameWindow(ref l, ref t, 300, 200, default(ScreenRect), now), "an empty anchor");
Eq((l, t), (1200, 600), "...and the spot is as saved");
Case("pop-outs: onto the monitor's work area");
var work = new ScreenRect(0, 0, 1920, 1040); // a 1080p monitor above a 40 px taskbar
l = 100; t = 100;
Check(!PopOutPlacement.ClampInside(ref l, ref t, 400, 300, work) && (l, t) == (100, 100), "already on it: unchanged");
l = 1800; t = 950;
Check(PopOutPlacement.ClampInside(ref l, ref t, 400, 300, work) && (l, t) == (1520, 740), "hanging off the bottom-right: wholly on it");
l = -5000; t = -3000;
Check(PopOutPlacement.ClampInside(ref l, ref t, 400, 300, work) && (l, t) == (0, 0), "far off (a monitor since unplugged): its corner");
l = 3000; t = 2000;
Check(PopOutPlacement.ClampInside(ref l, ref t, 2400, 1200, work) && (l, t) == (0, 0),
"bigger than the screen: the top-left corner, so the title bar is there to drag");
l = 10; t = 10;
Check(!PopOutPlacement.ClampInside(ref l, ref t, 400, 300, default), "no work area known: unchanged");
Case("pop-outs: followed off the screen, then pulled back on");
var wide = ScreenRect.FromSize(0, 0, 3840, 1080);
var moved = ScreenRect.FromSize(-1700, 0, 1600, 900); // the game window now on a monitor left of it
l = 200; t = 200;
PopOutPlacement.FollowGameWindow(ref l, ref t, 400, 300, wide, moved);
Eq((l, t), (-1500, 200), "it followed to the left monitor");
var leftWork = new ScreenRect(-1920, 0, 0, 1040);
Check(!PopOutPlacement.ClampInside(ref l, ref t, 400, 300, leftWork), "and that monitor has it whole");
}
private static void BringWindowsBack()
{
Case("bring windows back: a cascade on the game window");
var client = ScreenRect.FromSize(100, 50, 1600, 900);
var first = PopOutPlacement.GatherSpot(0, 300, 200, client);
Eq(first, (100 + PopOutPlacement.GatherInset, 50 + PopOutPlacement.GatherInset), "the first one near the top-left");
var second = PopOutPlacement.GatherSpot(1, 300, 200, client);
Eq(second, (first.Left + PopOutPlacement.GatherStep, first.Top + PopOutPlacement.GatherStep), "the next one a step down and right");
var spots = new HashSet<(int, int)>();
for (int i = 0; i < 40; i++)
{
var (x, y) = PopOutPlacement.GatherSpot(i, 300, 200, client);
Check(x >= client.Left && y >= client.Top && x + 300 <= client.Right && y + 200 <= client.Bottom, $"window {i} is wholly on the game window");
spots.Add((x, y));
}
Eq(spots.Count, 40, "forty windows: forty spots (title bars don't stack)");
var scaled = PopOutPlacement.GatherSpot(1, 300, 200, client, 2f);
Eq(scaled, (100 + 2 * PopOutPlacement.GatherInset + 2 * PopOutPlacement.GatherStep, 50 + 2 * PopOutPlacement.GatherInset + 2 * PopOutPlacement.GatherStep),
"UI scale 2: twice the steps");
var tiny = ScreenRect.FromSize(0, 0, 640, 480);
var big = PopOutPlacement.GatherSpot(3, 900, 700, tiny);
Eq(big, (0, 0), "a window bigger than the game window: its corner on the game window's");
Eq(PopOutPlacement.GatherSpot(0, 300, 200, client, float.NaN), first, "a bad scale counts as 1");
Case("bring windows back: the answer");
Check(PopOutPlacement.GatherReply(0, 0).StartsWith("No popped-out windows", StringComparison.Ordinal), "none open says so");
Eq(PopOutPlacement.GatherReply(1, 1), "Brought 1 popped-out window onto the game window.", "one");
Eq(PopOutPlacement.GatherReply(3, 2), "Brought 3 popped-out windows onto the game window (1 already there).", "some already there");
Check(ChatCommandReplies.KindOfLine(PopOutPlacement.GatherReply(3, 3)) != ChatReplyKind.Fail, "a success isn't red");
}
// ── helpers ────────────────────────────────────────────────────────
private static void NoTempFiles(string dir)

View file

@ -60,6 +60,7 @@ internal static class Program
Run(nameof(TrainingStructsMirror), TrainingStructsMirror);
Run(nameof(ContainerOrderSlots), ContainerOrderSlots);
Run(nameof(WebPanelFieldsAppended), WebPanelFieldsAppended);
Run(nameof(CameraFieldAppended), CameraFieldAppended);
Run(nameof(WebPanelStructsMatch), WebPanelStructsMatch);
Run(nameof(WebPanelCodesMatch), WebPanelCodesMatch);
Run(nameof(HasWebPanel_FalseOnOldOrPartialTable), HasWebPanel_FalseOnOldOrPartialTable);
@ -608,8 +609,20 @@ internal static class Program
(int)Marshal.OffsetOf<RynthCore.PluginSdk.RynthCoreApiNative>(prev) + IntPtr.Size, "SDK " + slot + " right after " + prev);
prev = slot;
}
Eq(typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).SkipLast(4).Last(), "GetMonsterHealthFn", "engine table: GetMonsterHealthFn precedes the four");
Eq(typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).SkipLast(4).Last(), "GetMonsterHealthFn", "SDK table: GetMonsterHealthFn precedes the four");
// v99's CameraActionFn follows the four (see CameraFieldAppended).
Eq(typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).SkipLast(5).Last(), "GetMonsterHealthFn", "engine table: GetMonsterHealthFn precedes the four");
Eq(typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).SkipLast(5).Last(), "GetMonsterHealthFn", "SDK table: GetMonsterHealthFn precedes the four");
}
// v99: CameraActionFn is appended right after v94's WebPanelGetStateFn and ends the table, on both sides.
private static void CameraFieldAppended()
{
Eq((int)Marshal.OffsetOf<RynthCore.Engine.Plugins.RynthCoreAPI>("CameraActionFn"),
(int)Marshal.OffsetOf<RynthCore.Engine.Plugins.RynthCoreAPI>("WebPanelGetStateFn") + IntPtr.Size, "engine CameraActionFn right after WebPanelGetStateFn");
Eq((int)Marshal.OffsetOf<RynthCore.PluginSdk.RynthCoreApiNative>("CameraActionFn"),
(int)Marshal.OffsetOf<RynthCore.PluginSdk.RynthCoreApiNative>("WebPanelGetStateFn") + IntPtr.Size, "SDK CameraActionFn right after WebPanelGetStateFn");
Eq(typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).Last(), "CameraActionFn", "engine table ends with CameraActionFn");
Eq(typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).Last(), "CameraActionFn", "SDK table ends with CameraActionFn");
}
private static void StructMirror(Type engine, Type sdk, int size)
@ -758,11 +771,11 @@ internal static class Program
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-v91 follow:
// eleven slots to v89, then v90's thirteen, v91's two, v93's one and v94's four).
var names = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).SkipLast(31).TakeLast(6).ToArray();
// eleven slots to v89, then v90's thirteen, v91's two, v93's one, v94's four and v99's one).
var names = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).SkipLast(32).TakeLast(6).ToArray();
Check(names.SequenceEqual(new[] { "GetTrainingInfoFn", "RaiseFn", "TrainSkillFn", "GetContainerOrderFn", "PutItemInContainerFn", "GetMergeStackResultFn" }),
"v79, v80 then v81 slots last: " + string.Join(",", names));
var sdkNames = typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).SkipLast(31).TakeLast(6).ToArray();
var sdkNames = typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).SkipLast(32).TakeLast(6).ToArray();
Check(sdkNames.SequenceEqual(names), "SDK v79, v80 and v81 slots in the same order");
}
@ -773,7 +786,12 @@ internal static class Program
{
var all = typeof(RynthCore.Engine.Plugins.RynthCoreAPI).GetFields().Select(f => f.Name).ToArray();
var sdkAll = typeof(RynthCore.PluginSdk.RynthCoreApiNative).GetFields().Select(f => f.Name).ToArray();
// v94: the web panel's four slots end the table; the checks after these are on the table before them.
// v99: CameraActionFn ends the table; the checks after it are on the table before it.
Check(all.Last() == "CameraActionFn", "v99 slot last: " + all.Last());
Check(sdkAll.Last() == "CameraActionFn", "SDK v99 slot last: " + sdkAll.Last());
all = all.SkipLast(1).ToArray();
sdkAll = sdkAll.SkipLast(1).ToArray();
// v94: the web panel's four slots come next; the checks after these are on the table before them.
string[] v94 = { "WebPanelOpenFn", "WebPanelNavigateFn", "WebPanelCloseFn", "WebPanelGetStateFn" };
Check(all.TakeLast(v94.Length).SequenceEqual(v94), "v94 slots last: " + string.Join(",", all.TakeLast(v94.Length)));
Check(sdkAll.TakeLast(v94.Length).SequenceEqual(v94), "SDK v94 slots last: " + string.Join(",", sdkAll.TakeLast(v94.Length)));

View file

@ -25,6 +25,9 @@ internal static class Program
Matching();
VirindiSenseList();
ListCommands();
ExactMatching();
ExactInTheFile();
ExactCommands();
Console.WriteLine($"{_checks} checks, {_failed} failed");
return _failed == 0 ? 0 : 1;
@ -302,4 +305,88 @@ internal static class Program
Check(!SenseLayout.IsLayoutCommand("import") && !SenseLayout.IsLayoutCommand("addselected"), "they aren't look commands");
Check(SenseLayout.Usage.Contains("addselected", StringComparison.Ordinal) && SenseLayout.Usage.Contains("import [file]", StringComparison.Ordinal), "the usage names them");
}
// ── Exact match (2026-11-26) ───────────────────────────────────────
private static void ExactMatching()
{
var drake = new SensePattern("Drake", true, exact: true);
Check(drake.Exact && !drake.IsGlob && drake.MatchKind == "exact", "an exact term says so");
Check(drake.Matches("Drake") && drake.Matches("drake") && drake.Matches("DRAKE"), "exact: the whole name, any case");
Check(!drake.Matches("Dragon's Isle Drake") && !drake.Matches("Drake Hatchling") && !drake.Matches("Drakes"), "exact: not a name that only contains it");
Check(drake.Matches(" Drake "), "exact: spaces around the name don't count");
Check(!drake.Matches("") && !new SensePattern("", true, exact: true).Matches("Drake"), "exact: empty never matches");
var literal = new SensePattern("Drake*", true, exact: true);
Check(!literal.IsGlob && literal.Matches("drake*") && !literal.Matches("Drake Hatchling"), "exact: * and ? are plain letters");
var plain = new SensePattern("Drake", true);
Check(!plain.Exact && plain.MatchKind == "contains" && plain.Matches("Dragon's Isle Drake"), "a term without Exact still contains (the old behaviour)");
Check(new SensePattern("Drake*", true).MatchKind == "wildcards", "wildcards say so");
SensePattern off = drake.WithEnabled(false);
Check(!off.Enabled && off.Exact && off.Text == "Drake", "switching a term off keeps Exact");
SensePattern loose = off.WithExact(false);
Check(!loose.Exact && !loose.Enabled && loose.Matches("Isle Drake") , "switching Exact off keeps on/off (off terms are skipped by the scan, not by Matches)");
Check(ReferenceEquals(drake.WithExact(true), drake) && ReferenceEquals(drake.WithEnabled(true), drake), "no change: the same term");
Check(loose.WithExact(true).IsGlob == false && new SensePattern("D?ake", true).WithExact(true).Matches("D?ake")
&& !new SensePattern("D?ake", true).WithExact(true).Matches("Drake"), "a wildcard term made exact takes its letters as they are");
Check(new SensePattern("D?ake", true, exact: true).WithExact(false).Matches("Drake"), "and back to wildcards");
Check(SenseFile.ExactReply("Drake", true).Contains("exact", StringComparison.Ordinal)
&& SenseFile.ExactReply("Drake", false).Contains("containing", StringComparison.Ordinal), "the line after the = is clicked");
}
private static void ExactInTheFile()
{
var terms = new List<SensePattern> { new("Drake", true, exact: true), new("Golem", true), new("Mattekar*", false), new("Olthoi", false, exact: true) };
string text = SenseFile.Format(terms, false, false, SenseLayoutMode.Full);
Check(text.Contains("term=1|Drake\nexact=Drake", StringComparison.Ordinal) || text.Contains("term=1|Drake\r\nexact=Drake", StringComparison.Ordinal),
"an exact term is written as its term line, then an exact line");
Check(!text.Contains("exact=Golem", StringComparison.Ordinal) && !text.Contains("exact=Mattekar", StringComparison.Ordinal), "only exact terms get one");
SenseFileData back = SenseFile.Parse(Lines(text));
Check(back.Terms.Count == 4, $"four terms come back ({back.Terms.Count})");
Check(back.Terms[0].Exact && back.Terms[0].Enabled && !back.Terms[1].Exact && !back.Terms[2].Exact && back.Terms[2].IsGlob
&& back.Terms[3].Exact && !back.Terms[3].Enabled, "Exact comes back on the right terms, with on/off and wildcards");
// A file from before Exact: every term matches as before.
SenseFileData old = SenseFile.Parse(new[] { "alertChat=0", "term=1|Drake", "term=0|Golem*" });
Check(old.Terms.TrueForAll(t => !t.Exact) && old.Terms[1].IsGlob, "an older file: no term is exact");
// An engine from before Exact skips the exact lines and still has every term (as contains): what it keeps.
var withoutExact = Lines(text).Where(l => !l.StartsWith("exact=", StringComparison.Ordinal));
SenseFileData olderEngine = SenseFile.Parse(withoutExact);
Check(olderEngine.Terms.Count == 4 && olderEngine.Terms[0].Text == "Drake" && !olderEngine.Terms[0].Exact,
"the term lines alone are the whole list (an older engine reads them as contains terms)");
// By hand: an exact line before its term, any case, or with no term at all.
SenseFileData hand = SenseFile.Parse(new[] { "exact=drake", "term=1|Drake", "exact= Banderling ", "exact=", "exact=Drake" });
Check(hand.Terms.Count == 2, $"an exact line for a term already there adds nothing ({hand.Terms.Count})");
Check(hand.Terms[0].Text == "Drake" && hand.Terms[0].Exact, "an exact line before its term, any case, still makes it exact");
Check(hand.Terms[1].Text == "Banderling" && hand.Terms[1].Exact && hand.Terms[1].Enabled, "an exact line alone adds an exact term, on, trimmed");
var many = new List<string>();
for (int i = 0; i < SenseFile.MaxTerms; i++) many.Add("term=1|name" + i);
many.Add("exact=one too many");
many.Add("exact=name7");
SenseFileData full = SenseFile.Parse(many);
Check(full.Terms.Count == SenseFile.MaxTerms && full.Terms[7].Exact, "a full list: an exact line still marks its term, and adds none past the cap");
// The Virindi Sense import: patterns.txt has no match-type field, so its names stay contains.
SenseMerge m = SenseImport.Merge(new List<SensePattern> { new("Drake", true, exact: true) }, new[] { "drake", "Sand Caves" });
Check(m.Terms[0].Exact && !m.Terms[1].Exact, "importing keeps an exact term exact and adds contains terms, as Virindi Sense matched");
}
private static void ExactCommands()
{
Check(SenseLayout.IsAddSelected("addselected", out bool e1) && e1, "addselected adds the exact name");
Check(SenseLayout.IsAddSelected("add selected exact", out bool e2) && e2, "addselected exact");
Check(SenseLayout.IsAddSelected("ADDSEL Contains", out bool e3) && !e3, "addselected contains: a contains term (any case)");
Check(SenseLayout.IsAddSelected("add selected contains", out bool e4) && !e4, "spacing");
Check(!SenseLayout.IsAddSelected("addselected maybe", out _) && !SenseLayout.IsAddSelected("addselectedcontains", out _), "only exact or contains after it");
foreach (string ok in new[] { "addselected contains", "addselected exact", "add selected contains" })
Check(SenseLayout.IsValidArgs(ok), $"'/rc sense {ok}' runs");
Check(!SenseLayout.IsValidArgs("addselected maybe"), "'/rc sense addselected maybe' gets the usage");
Check(SenseLayout.Usage.Contains("addselected [contains]", StringComparison.Ordinal), "the usage names contains");
}
}

View file

@ -7,7 +7,9 @@
the mouse and when clicks go to the game), the collapsed line, /rc sense's look commands
(compact on|off, collapse on|off, view ...: the look they lead to and their replies, and the
argument check), sense.txt read and written (terms, alerts and the look, a file from before
the look, bad values), and the term matching. No file I/O, no AC, no ImGui.
the look, bad values), and the term matching (contains, wildcards, and Exact: the whole name,
2026-11-26, with its exact= lines in sense.txt and /rc sense addselected [contains]).
No file I/O, no AC, no ImGui.
Run: dotnet run -c Release (exit 0 = pass, 1 = fail)
-->
<PropertyGroup>

View file

@ -53,9 +53,87 @@ namespace SettingsLayoutTests
Moves();
HuntAndDirtyFighting();
LootProfileRow();
NavmeshViewRows();
return Finish();
}
// ── Settings > Navigation > Navmesh View: RynthNav's navmesh switches (2026-11-26) ─────────────
private static void NavmeshViewRows()
{
object? nav = Tabs.Cast<object>().FirstOrDefault(t => Name(t) == "Navigation");
Check(nav != null, "there is a Navigation tab");
if (nav == null) return;
List<object> rows = Rows(nav).Cast<object>().ToList();
int Index(string kind, string label) => rows.FindIndex(r => Kind(r) == kind && Label(r).Trim() == label);
// Right after Nav Marker Display (it ends with Guide Line), before Doors.
int guide = Index("Bool", "Guide Line"), section = Index("Section", "Navmesh View"), doors = Index("Section", "Doors");
Check(guide >= 0 && section > guide && doors > section, $"Navmesh View sits between Guide Line and Doors (Guide Line {guide}, Navmesh View {section}, Doors {doors})");
Check(section > guide && rows.Skip(guide + 1).Take(section - guide - 1).All(r => Kind(r) == "Spacer"), "...with only a spacer between Guide Line and it");
if (section < 0 || doors < 0) return;
List<object> mine = rows.Skip(section + 1).Take(doors - section - 1).ToList();
object? Mine(string kind, string label) => mine.FirstOrDefault(r => Kind(r) == kind && Label(r).Trim() == label);
double D(object row, string prop) => (double)row.GetType().GetProperty(prop)!.GetValue(row)!;
string? Tip(object row) => (string?)row.GetType().GetProperty("Tooltip")!.GetValue(row);
foreach (var (kind, label, min, max, step, tipStart) in new[]
{
("Bool", "Show Navmesh", 0.0, 0.0, 1.0, "Draw the navigation mesh in the world"),
("Bool", "Green Floor", 0, 0, 1, "The walkable ground, in green."),
("Bool", "Red Walls", 0, 0, 1, "Upright red strips along every edge nav will not cross."),
("Int", "Mesh Radius (m)", 10, 150, 10, "How far around you the mesh is drawn."),
("Int", "Mesh Detail (triangles)", 200, 7000, 500, "The most triangles the mesh may use."),
})
{
object? row = Mine(kind, label);
Check(row != null, $"Navmesh View has a {kind} row '{label}'");
if (row == null) continue;
if (kind == "Int") Check(D(row, "Min") == min && D(row, "Max") == max && D(row, "Step") == step, $"{label}: {min}..{max}, step {step} (the Go tab's)");
Check(Tip(row)?.StartsWith(tipStart, StringComparison.Ordinal) == true, $"{label}: the Go tab's tooltip");
Check(Tip(row)?.Contains("not in the RynthAi profile") == true, $"{label}: the tooltip says it is RynthNav's, not the profile's");
Check(KeyOf(row) == "Navigation/Navmesh View/" + label, $"{label} can be pinned under Navmesh View (got {KeyOf(row)})");
}
Check(mine.Count(r => Kind(r) is "Bool" or "Int") == 5, "five switches and steppers, no more");
// Without RynthNav (no status here): the rows hide and a note says why.
Type settings = _engine.GetType("RynthCore.Engine.UI.Data.RynthAiSettings", throwOnError: true)!;
object s = Activator.CreateInstance(settings, true)!;
bool Visible(object row) => (bool)row.GetType().GetMethod("IsVisible")!.Invoke(row, new[] { s })!;
Check(mine.Where(r => Kind(r) is "Bool" or "Int" or "Status").All(r => !Visible(r)), "no RynthNav: the switches, steppers and status line hide");
List<object> notes = mine.Where(r => Kind(r) == "Note" && Visible(r)).ToList();
Check(notes.Count == 1 && Label(notes[0]).Contains("RynthNav plugin"), $"...and one note says RynthNav is needed (got {string.Join(" | ", notes.Select(Label))})");
Check(Visible(rows[section]), "...under the Navmesh View heading, which stays");
double Get(object row) => (double)((Delegate)row.GetType().GetProperty("Get")!.GetValue(row)!).DynamicInvoke(s)!;
Check(Get(Mine("Bool", "Show Navmesh")!) == 0 && Get(Mine("Int", "Mesh Radius (m)")!) == 40 && Get(Mine("Int", "Mesh Detail (triangles)")!) == 3000,
"reading them with no RynthNav doesn't throw (off, RynthNav's defaults)");
// Not RynthAi settings: nothing about the mesh in the payload.
Type ctxType = _engine.GetType("RynthCore.Engine.UI.Data.RynthAiSettingsJsonContext", throwOnError: true)!;
object ctx = ctxType.GetProperty("Default", All)!.GetValue(null)!;
var info = (System.Text.Json.Serialization.Metadata.JsonTypeInfo)ctxType.GetProperty("RynthAiSettings", All)!.GetValue(ctx)!;
string json = System.Text.Json.JsonSerializer.Serialize(s, info);
Check(!json.Contains("Mesh", StringComparison.OrdinalIgnoreCase) && !json.Contains("Navmesh", StringComparison.OrdinalIgnoreCase),
"the RynthAi settings payload has no navmesh fields");
// The rules behind the rows (UI/Data/NavmeshView.cs).
Type view = _engine.GetType("RynthCore.Engine.UI.Data.NavmeshView", throwOnError: true)!;
Type statusType = _engine.GetType("RynthCore.Engine.UI.Data.RynthNavStatus", throwOnError: true)!;
object? Parse(string j) => statusType.GetMethod("Parse", All)!.Invoke(null, new object[] { j });
object? V(string name, params object?[] a) => view.GetMethod(name, All)!.Invoke(null, a);
object? older = Parse("{\"hasPose\":1}"), newer = Parse("{\"hasPose\":1,\"mesh\":{\"on\":1,\"floor\":0,\"walls\":1,\"radius\":70,\"triangles\":4200,\"drawn\":1840}}");
Check(older != null && newer != null, "RynthNav statuses parse");
Check(!(bool)V("Available", (object?)null)! && !(bool)V("Available", older)! && (bool)V("Available", newer)!, "the rows show only for a RynthNav that sends its mesh state (0.6.7+)");
Check(((string)V("Unavailable", older)!).Contains("0.6.7"), "an older RynthNav: the note says which version is needed");
Check((string)V("Unavailable", newer)! == "", "a new one: no note");
Check((bool)V("GetSwitch", newer, "Show Navmesh")! && !(bool)V("GetSwitch", newer, "Green Floor")! && (bool)V("GetSwitch", newer, "Red Walls")!, "the switches read RynthNav's on / floor / walls");
Check((string)V("Drawn", newer)! == "1840 triangles drawn now." && (string)V("Drawn", older)! == "", "the status line: triangles drawn while on");
Check((string)V("SwitchCommand", "Show Navmesh", true)! == "mesh on" && (string)V("SwitchCommand", "Show Navmesh", false)! == "mesh off", "Show Navmesh sends /rnav mesh on|off");
Check((string)V("SwitchCommand", "Green Floor", false)! == "mesh floor off" && (string)V("SwitchCommand", "Red Walls", true)! == "mesh walls on", "Green Floor / Red Walls send mesh floor|walls on|off");
Check((string)V("RadiusCommand", 70)! == "mesh radius 70" && (string)V("RadiusCommand", 999)! == "mesh radius 150" && (string)V("RadiusCommand", 0)! == "mesh radius 10", "Mesh Radius sends mesh radius N, 10..150");
Check((string)V("DetailCommand", 3700)! == "mesh triangles 3700" && (string)V("DetailCommand", 9000)! == "mesh triangles 7000" && (string)V("DetailCommand", 1)! == "mesh triangles 200", "Mesh Detail sends mesh triangles N, 200..7000");
Check((bool)V("IsMeshLabel", "Mesh Radius (m)")! && !(bool)V("IsMeshLabel", "Guide Line")! && !(bool)V("IsMeshLabel", (object?)null)!, "the drawer knows a pinned navmesh row");
}
// ── Settings > Looting's Loot Profile picker (2026-11-22) ──────────────────────────────
private static void LootProfileRow()
{
@ -273,6 +351,7 @@ namespace SettingsLayoutTests
("Targeting", "Combat/Targeting/Targeting"),
("Attempts Before Blacklist", "Combat/Targeting/Attempts Before Blacklist"),
("Enable Raycasting", "Combat/Line Of Sight/Enable Raycasting"),
("Show Line of Sight", "Combat/Line Of Sight/Show Line of Sight"), // 2026-11-26, next to Enable Raycasting
("Magic Response", "Combat/Hitting the Environment/Magic Response"),
("Enable Missile Crafting", "Combat/Missile Ammo Crafting/Enable Missile Crafting"),
("Enable Autostack", "Inventory/Packs/Enable Autostack"),

View file

@ -24,6 +24,8 @@ internal static class Program
Pricing();
WiringPinned();
BuyBox();
BuyBoxWiringPinned();
Console.WriteLine(_failed == 0 ? $"PASS ({_checks} checks)" : $"FAIL ({_failed} of {_checks} checks failed)");
return _failed == 0 ? 0 : 1;
@ -77,6 +79,100 @@ internal static class Program
Check(text.Contains(needle, StringComparison.Ordinal), "VendorTrade.cs contains: " + needle);
}
// The Inventory panel's "Buy how many?" box (VendorBuyMath, 2026-11-26).
private static void BuyBox()
{
static long Linear12(int n) => 12L * n;
const int Max = VendorBuyMath.MaxAmount;
// Stock and money.
Eq(VendorBuyMath.MaxBuy(-1, -1, Linear12), Max, "unlimited stock, money unknown: the engine's limit");
Eq(VendorBuyMath.MaxBuy(0, 1000, Linear12), 0, "the vendor has none");
Eq(VendorBuyMath.MaxBuy(50, -1, Linear12), 50, "50 in stock, money unknown: 50");
Eq(VendorBuyMath.MaxBuy(-1, 1000, Linear12), 83, "12 each, 1,000 to spend: 83");
Eq(VendorBuyMath.MaxBuy(-1, 11, Linear12), 0, "12 each, 11 to spend: none");
Eq(VendorBuyMath.MaxBuy(-1, 12, Linear12), 1, "12 each, 12 to spend: one");
Eq(VendorBuyMath.MaxBuy(100, 1200, Linear12), 100, "exactly enough for the whole stock");
Eq(VendorBuyMath.MaxBuy(100, 1_000_000, Linear12), 100, "rich: the stock");
Eq(VendorBuyMath.MaxBuy(Max + 5, -1, Linear12), Max, "a stock past the limit is capped");
Eq(VendorBuyMath.MaxBuy(-1, 0, _ => 0), Max, "a free vendor (cost 0): the engine's limit");
Eq(VendorBuyMath.MaxBuy(-1, 100, _ => -1), 0, "a cost that overflowed to negative counts as too much");
// ACE's per-stack pricing (each created stack rounds up, floor 1): searched, not divided.
foreach (float rate in new[] { 1.15f, 0.9f, 2.5f })
foreach (int maxStack in new[] { 1, 7, 100 })
{
long StackCost(int n)
{
long full = n / maxStack, rem = n % maxStack;
return full * VendorRatePolicy.PlayerPaysForStack(rate, Misc, 3L * maxStack)
+ (rem > 0 ? VendorRatePolicy.PlayerPaysForStack(rate, Misc, 3L * rem) : 0);
}
foreach (long money in new long[] { 0, 1, 3, 4, 100, 345, 1000, 9999 })
{
int got = VendorBuyMath.MaxBuy(5000, money, StackCost);
bool fits = got == 0 || StackCost(got) <= money;
bool most = got == 5000 || StackCost(got + 1) > money;
Check(fits && most, $"rate {rate}, stacks of {maxStack}, {money} to spend: {got} is the most that fits");
}
}
// Where the number starts and how a typed one is kept.
Eq(VendorBuyMath.Prefill(50, 200), 50, "the toolbar's 50, 200 buyable: 50");
Eq(VendorBuyMath.Prefill(500, 200), 200, "the toolbar's 500, 200 buyable: 200");
Eq(VendorBuyMath.Prefill(1, 200), 1, "the toolbar's 1: 1");
Eq(VendorBuyMath.Prefill(0, 200), 1, "no toolbar number: 1");
Eq(VendorBuyMath.Prefill(-7, 200), 1, "a junk toolbar number: 1");
Eq(VendorBuyMath.Prefill(50, 0), 1, "nothing buyable: 1 (Buy is off)");
Eq(VendorBuyMath.Clamp(0, 10), 1, "typed 0: 1");
Eq(VendorBuyMath.Clamp(-3, 10), 1, "typed -3: 1");
Eq(VendorBuyMath.Clamp(11, 10), 10, "typed 11 of 10: 10");
Eq(VendorBuyMath.Clamp(7, 10), 7, "typed 7 of 10: 7");
Eq(VendorBuyMath.Clamp(7, 0), 1, "nothing buyable: 1");
Eq(VendorBuyMath.Half(0), 1, "half of 0: 1");
Eq(VendorBuyMath.Half(1), 1, "half of 1: 1");
Eq(VendorBuyMath.Half(9), 4, "half of 9: 4");
}
// The box and the split-globals fix must use what is tested here.
private static void BuyBoxWiringPinned()
{
string? box = FindUp(Path.Combine("src", "RynthCore.Engine", "ImGui", "Panels", "InventoryFace.VendorBuy.cs"));
Check(box != null, "found InventoryFace.VendorBuy.cs");
if (box != null)
{
string text = File.ReadAllText(box);
foreach (string needle in new[]
{
"VendorBuyMath.Prefill(toolbar, MaxBuy(snap, item))",
"VendorBuyMath.MaxBuy(item.Unlimited ? -1 : item.Amount, VendorTrade.MoneyFor(snap)",
"VendorBuyMath.Clamp(_buyAmount, max)",
"UiDropTargets.Publish(VendorDropKey, Title, origin, origin + size, snap != null, IsVendorItem)",
"VendorTrade.RequestBuy(_buyVendor, [_buyItem], [_buyAmount])",
})
Check(text.Contains(needle, StringComparison.Ordinal), "InventoryFace.VendorBuy.cs contains: " + needle);
}
string? hooks = FindUp(Path.Combine("src", "RynthCore.Engine", "Compatibility", "ClientHelperHooks.cs"));
Check(hooks != null, "found ClientHelperHooks.cs");
if (hooks != null)
{
string text = File.ReadAllText(hooks);
int reads = CountOf(text, "SplitGlobals keep = SplitGlobals.Read();");
int restores = CountOf(text, "keep.Restore();");
Check(reads == 2 && restores == 2, $"MoveItemInternal and SplitStackInternal both keep AC's split globals (reads {reads}, restores {restores})");
Check(!text.Contains("try { Marshal.WriteInt32(new IntPtr(_splitAmountAddr), 1); } catch { }", StringComparison.Ordinal),
"SplitStackInternal no longer leaves split_amount at 1 after it");
}
}
private static int CountOf(string text, string needle)
{
int n = 0;
for (int i = text.IndexOf(needle, StringComparison.Ordinal); i >= 0; i = text.IndexOf(needle, i + needle.Length, StringComparison.Ordinal)) n++;
return n;
}
private static string? FindUp(string relative)
{
for (DirectoryInfo? d = new(AppContext.BaseDirectory); d != null; d = d.Parent)

View file

@ -19,6 +19,8 @@
<ItemGroup>
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\VendorRatePolicy.cs" Link="Engine\VendorRatePolicy.cs" />
<!-- 2026-11-26: the Inventory panel's "Buy how many?" box (max, prefill, clamp). -->
<Compile Include="..\..\src\RynthCore.Engine\Compatibility\VendorBuyMath.cs" Link="Engine\VendorBuyMath.cs" />
</ItemGroup>
</Project>