From ac555572c758e7a4f07ba9e23c9154b3b14abf0c Mon Sep 17 00:00:00 2001 From: Daniel Wallace Date: Sun, 15 Nov 2026 08:28:04 -0800 Subject: [PATCH 1/2] DreamWeave: declare the Dereth Network chat tab ServerPackInfo gains ChatTabs (ServerChatTab / ServerChatRule records); BuildSectionsJson writes "chatTabs" after "windows" only when non-empty. DreamWeave declares the pinned Network tab: tells from name@world speakers (in and out) plus the discovered Global room. Needs the RynthCore chatTabs manifest parser (branch chat/server-tabs). Co-Authored-By: Claude Opus 5.5 --- .../ServerData.cs | 11 +++++ Plugins/Shared/ServerPack/ServerPackInfo.cs | 18 +++++++ Plugins/Shared/ServerPack/ServerPackModel.cs | 30 +++++++++++- .../ServerPackModelTests.cs | 47 +++++++++++++++++++ 4 files changed, 104 insertions(+), 2 deletions(-) diff --git a/Plugins/RynthCore.Plugin.RynthDreamWeave/ServerData.cs b/Plugins/RynthCore.Plugin.RynthDreamWeave/ServerData.cs index 78f21a7..7c2f57a 100644 --- a/Plugins/RynthCore.Plugin.RynthDreamWeave/ServerData.cs +++ b/Plugins/RynthCore.Plugin.RynthDreamWeave/ServerData.cs @@ -69,6 +69,17 @@ internal static class ServerData new ServerCommand("/charsheet", "publish a web character sheet (off, rotate)"), new ServerCommand("/fi", "resend nearby monsters and NPCs (invisible creatures), once a minute"), }, + // The Network tab: tells that come from another world (name@world, or a Discord relay) and + // the live Global room (RynthChat finds which one by a remote speaker's line). + ChatTabs = new[] + { + new ServerChatTab("dereth-network", "Network", true, "Roleplay", new[] + { + new ServerChatRule("copy", "type:3", "", "^[^\"]+@[a-z0-9-]+( \\(discord\\))? tells you, \""), + new ServerChatRule("copy", "type:4", "", "^You tell [^\"]+@[a-z0-9-]+( \\(discord\\))?, \""), + new ServerChatRule("copy", "", "startswith", "", GlobalRoom: true), + }), + }, Discord = "https://discord.gg/p2h3yca4BD", Wiki = "https://wiki.acdreamweave.com", Source = "public AC server list (acresources/serverslist), checked 2026-10-13; features and commands from " + diff --git a/Plugins/Shared/ServerPack/ServerPackInfo.cs b/Plugins/Shared/ServerPack/ServerPackInfo.cs index b7a6d8f..7692f95 100644 --- a/Plugins/Shared/ServerPack/ServerPackInfo.cs +++ b/Plugins/Shared/ServerPack/ServerPackInfo.cs @@ -45,6 +45,22 @@ internal sealed record ServerSalvage(string Bench, int Material, string Effect, bool Prepared = false, int Order = 0, bool AfterCap = false, string StackGroup = "", int StackCap = 0); +/// +/// One rule of a default chat tab the server declares (RynthChat reads it from the sections manifest's +/// "chatTabs"). is regex text when is empty. +/// +/// "copy" (the line also stays in Chat) or "move". +/// The engine's When condition ("type:3" = a tell to you, "type:4" = a tell you sent); "" = any line. +/// "" = regex; "startswith" and the engine's other literal modes. +/// The text or regex; "" for a Global room rule (the engine fills it in). +/// The engine discovers which Global room is live and writes its prefix as the pattern. +internal sealed record ServerChatRule(string Action, string When, string Mode, string Pattern, bool GlobalRoom = false); + +/// A default chat tab the server declares: a named tab with its rules, optionally pinned. +/// Stable id within this server (lowercase letters, digits, dashes); owns the tab's rules. +/// The Global room used until one is discovered: "General", "Trade", "LFG" or "Roleplay". +internal sealed record ServerChatTab(string Id, string Name, bool Pinned, string GlobalRoomFallback, ServerChatRule[] Rules); + internal sealed class ServerPackInfo { public ServerPackInfo(string id, string name, string[] hosts, string[] worldNames) @@ -78,6 +94,8 @@ internal sealed class ServerPackInfo public ServerCommand[] Commands { get; init; } = Array.Empty(); /// The server's own tinkering salvage (only recipes known to exist); empty = none defined. public ServerSalvage[] Salvage { get; init; } = Array.Empty(); + /// Default chat tabs for RynthChat (sections manifest "chatTabs"); empty = none, and no key is written. + public ServerChatTab[] ChatTabs { get; init; } = Array.Empty(); /// /// Jewelry that is a trinket on this server (the Crafting tab's Trinkets bench, not Jewelry): name /// words, case-insensitive, and words that rule a name out again ("top" but not "topaz"). Empty: diff --git a/Plugins/Shared/ServerPack/ServerPackModel.cs b/Plugins/Shared/ServerPack/ServerPackModel.cs index a863365..53bf499 100644 --- a/Plugins/Shared/ServerPack/ServerPackModel.cs +++ b/Plugins/Shared/ServerPack/ServerPackModel.cs @@ -205,8 +205,34 @@ internal sealed class ServerPackModel sb.Append('}'); // The server's own windows (ServerWindows, ServerPackWindows.cs, 2026-11-07). if (windows != null) sb.Append(ServerPackWindows.Json(windows, info.Id, frameless)); - sb.Append("]}"); - return sb.ToString(); + sb.Append(']'); + // The server's default RynthChat tabs; an engine without chatTabs support ignores the key. + if (info.ChatTabs.Length > 0) + { + sb.Append(",\"chatTabs\":["); + for (int i = 0; i < info.ChatTabs.Length; i++) + { + ServerChatTab tab = info.ChatTabs[i]; + sb.Append(i == 0 ? "" : ",").Append("{\"server\":").Append(Q(info.Id)); + sb.Append(",\"id\":").Append(Q(tab.Id)); + sb.Append(",\"name\":").Append(Q(tab.Name)); + sb.Append(",\"pinned\":").Append(tab.Pinned ? "true" : "false"); + sb.Append(",\"globalRoomFallback\":").Append(Q(tab.GlobalRoomFallback)); + sb.Append(",\"rules\":["); + for (int j = 0; j < tab.Rules.Length; j++) + { + ServerChatRule rule = tab.Rules[j]; + sb.Append(j == 0 ? "" : ",").Append("{\"action\":").Append(Q(rule.Action)); + sb.Append(",\"when\":").Append(Q(rule.When)); + sb.Append(",\"mode\":").Append(Q(rule.Mode)); + sb.Append(",\"pattern\":").Append(Q(rule.Pattern)); + sb.Append(",\"globalRoom\":").Append(rule.GlobalRoom ? "true" : "false").Append('}'); + } + sb.Append("]}"); + } + sb.Append(']'); + } + sb.Append('}'); return sb.ToString(); } /// diff --git a/Tools/RynthServerPack.Tests/ServerPackModelTests.cs b/Tools/RynthServerPack.Tests/ServerPackModelTests.cs index 7339d87..3aa3066 100644 --- a/Tools/RynthServerPack.Tests/ServerPackModelTests.cs +++ b/Tools/RynthServerPack.Tests/ServerPackModelTests.cs @@ -20,6 +20,7 @@ internal static class ServerPackModelTests r.Add("server pack: before any push the world name decides", WorldFallback); r.Add("server pack: override commands are checked before sending", ForceCommands); r.Add("server pack: the sections manifest declares the server and a server-only card", SectionsJson); + r.Add("server pack: a declared chat tab reaches the engine parser as given", SectionsJson_ChatTabs); r.Add("server pack: no bar menu writes no barMenu key", NoBarMenuKey); r.Add("server pack: the bar menu items reach the engine parser as given", BarMenuRoundTrip); r.Add("server pack: a bar menu tooltip with quotes and backslashes round-trips", BarMenuEscapes); @@ -229,6 +230,52 @@ internal static class ServerPackModelTests new ServerBarMenuItem("abilities", "Class Abilities", ((char)0xE6A2).ToString(), "/rserver abilities"), }; + private static void SectionsJson_ChatTabs() + { + // The two tell patterns, as raw regex text (what the engine compiles), asserted byte for byte. + const string TellIn = @"^[^""]+@[a-z0-9-]+( \(discord\))? tells you, """; + const string TellOut = @"^You tell [^""]+@[a-z0-9-]+( \(discord\))?, """; + Check.Eq(TellIn, "^[^\"]+@[a-z0-9-]+( \\(discord\\))? tells you, \"", "tell-in literal, two spellings"); + Check.Eq(TellOut, "^You tell [^\"]+@[a-z0-9-]+( \\(discord\\))?, \"", "tell-out literal, two spellings"); + + ServerPackInfo info = new("dreamweave", "DreamWeave", new[] { "play.example" }, new[] { "DreamWeave" }) + { + ChatTabs = new[] + { + new ServerChatTab("dereth-network", "Network", true, "Roleplay", new[] + { + new ServerChatRule("copy", "type:3", "", TellIn), + new ServerChatRule("copy", "type:4", "", TellOut), + new ServerChatRule("copy", "", "startswith", "", GlobalRoom: true), + }), + }, + }; + string json = ServerPackModel.BuildSectionsJson(info, "RynthDreamWeave"); + Console.WriteLine("chatTabs json: " + json.Substring(json.IndexOf("\"chatTabs\"", StringComparison.Ordinal))); + SectionManifest m = SectionManifestParser.Parse("RynthDreamWeave", json, out string error); + Check.Eq(error, string.Empty, "parses clean: " + error); + Check.Eq(m.ChatTabs.Length, 1, "one chat tab"); + SectionChatTabDecl t = m.ChatTabs[0]; + Check.Eq(t.Server, info.Id, "server is the info id"); + Check.Eq(t.Id, "dereth-network", "id"); + Check.Eq(t.Name, "Network", "name"); + Check.True(t.Pinned, "pinned"); + Check.Eq(t.GlobalRoomFallback, "Roleplay", "fallback room"); + Check.Eq(t.Rules.Length, 3, "three rules"); + Check.Eq(t.Rules[0].Pattern, TellIn, "tell-in pattern byte for byte"); + Check.Eq(t.Rules[1].Pattern, TellOut, "tell-out pattern byte for byte"); + Check.Eq(t.Rules[0].When, "type:3", "tell-in when"); + Check.Eq(t.Rules[1].When, "type:4", "tell-out when"); + Check.Eq(t.Rules[0].Action, "copy", "action"); + Check.True(t.Rules[2].GlobalRoom, "third rule is the Global room rule"); + Check.False(t.Rules[0].GlobalRoom, "first rule is not"); + Check.Eq(t.Rules[2].Mode, "startswith", "global mode"); + Check.Eq(t.Rules[2].Pattern, string.Empty, "global pattern empty"); + + // A pack without chat tabs emits no key. + Check.False(ServerPackModel.BuildSectionsJson(Coldeve(), "RynthColdeve").Contains("chatTabs"), "no chatTabs key by default"); + } + private static void NoBarMenuKey() { string plain = ServerPackModel.BuildSectionsJson(Coldeve(), "RynthColdeve"); -- 2.43.0 From 24e0ec36838da7b94ed9eb4e05ec6c0889626af7 Mon Sep 17 00:00:00 2001 From: Daniel Wallace Date: Sun, 15 Nov 2026 10:23:30 -0800 Subject: [PATCH 2/2] DreamWeave: declare the Dereth network on the Network tab ServerChatTab gains an optional ServerChatNetwork (kind, command); BuildSectionsJson writes "network" inside the entry only when set. DreamWeave sets ("dereth", "derethnetwork"). Co-Authored-By: Claude Opus 5.5 --- .../ServerData.cs | 2 +- Plugins/Shared/ServerPack/ServerPackInfo.cs | 7 ++++++- Plugins/Shared/ServerPack/ServerPackModel.cs | 5 ++++- .../ServerPackModelTests.cs | 16 +++++++++++++++- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/Plugins/RynthCore.Plugin.RynthDreamWeave/ServerData.cs b/Plugins/RynthCore.Plugin.RynthDreamWeave/ServerData.cs index 7c2f57a..a1ad55c 100644 --- a/Plugins/RynthCore.Plugin.RynthDreamWeave/ServerData.cs +++ b/Plugins/RynthCore.Plugin.RynthDreamWeave/ServerData.cs @@ -78,7 +78,7 @@ internal static class ServerData new ServerChatRule("copy", "type:3", "", "^[^\"]+@[a-z0-9-]+( \\(discord\\))? tells you, \""), new ServerChatRule("copy", "type:4", "", "^You tell [^\"]+@[a-z0-9-]+( \\(discord\\))?, \""), new ServerChatRule("copy", "", "startswith", "", GlobalRoom: true), - }), + }, new ServerChatNetwork("dereth", "derethnetwork")), }, Discord = "https://discord.gg/p2h3yca4BD", Wiki = "https://wiki.acdreamweave.com", diff --git a/Plugins/Shared/ServerPack/ServerPackInfo.cs b/Plugins/Shared/ServerPack/ServerPackInfo.cs index 7692f95..911ebc0 100644 --- a/Plugins/Shared/ServerPack/ServerPackInfo.cs +++ b/Plugins/Shared/ServerPack/ServerPackInfo.cs @@ -56,10 +56,15 @@ internal sealed record ServerSalvage(string Bench, int Material, string Effect, /// The engine discovers which Global room is live and writes its prefix as the pattern. internal sealed record ServerChatRule(string Action, string When, string Mode, string Pattern, bool GlobalRoom = false); +/// The cross-world network a chat tab fronts: "dereth" with the server command that joins and sends (without the slash). +internal sealed record ServerChatNetwork(string Kind, string Command); + /// A default chat tab the server declares: a named tab with its rules, optionally pinned. /// Stable id within this server (lowercase letters, digits, dashes); owns the tab's rules. /// The Global room used until one is discovered: "General", "Trade", "LFG" or "Roleplay". -internal sealed record ServerChatTab(string Id, string Name, bool Pinned, string GlobalRoomFallback, ServerChatRule[] Rules); +/// The network the tab fronts (join, status and sends go through its command); null = none. +internal sealed record ServerChatTab(string Id, string Name, bool Pinned, string GlobalRoomFallback, ServerChatRule[] Rules, + ServerChatNetwork? Network = null); internal sealed class ServerPackInfo { diff --git a/Plugins/Shared/ServerPack/ServerPackModel.cs b/Plugins/Shared/ServerPack/ServerPackModel.cs index 53bf499..603b076 100644 --- a/Plugins/Shared/ServerPack/ServerPackModel.cs +++ b/Plugins/Shared/ServerPack/ServerPackModel.cs @@ -228,7 +228,10 @@ internal sealed class ServerPackModel sb.Append(",\"pattern\":").Append(Q(rule.Pattern)); sb.Append(",\"globalRoom\":").Append(rule.GlobalRoom ? "true" : "false").Append('}'); } - sb.Append("]}"); + sb.Append(']'); + if (tab.Network != null) + sb.Append(",\"network\":{\"kind\":").Append(Q(tab.Network.Kind)).Append(",\"command\":").Append(Q(tab.Network.Command)).Append('}'); + sb.Append('}'); } sb.Append(']'); } diff --git a/Tools/RynthServerPack.Tests/ServerPackModelTests.cs b/Tools/RynthServerPack.Tests/ServerPackModelTests.cs index 3aa3066..436790a 100644 --- a/Tools/RynthServerPack.Tests/ServerPackModelTests.cs +++ b/Tools/RynthServerPack.Tests/ServerPackModelTests.cs @@ -247,7 +247,7 @@ internal static class ServerPackModelTests new ServerChatRule("copy", "type:3", "", TellIn), new ServerChatRule("copy", "type:4", "", TellOut), new ServerChatRule("copy", "", "startswith", "", GlobalRoom: true), - }), + }, new ServerChatNetwork("dereth", "derethnetwork")), }, }; string json = ServerPackModel.BuildSectionsJson(info, "RynthDreamWeave"); @@ -272,6 +272,20 @@ internal static class ServerPackModelTests Check.Eq(t.Rules[2].Mode, "startswith", "global mode"); Check.Eq(t.Rules[2].Pattern, string.Empty, "global pattern empty"); + Check.True(t.Network != null, "network parsed"); + Check.Eq(t.Network!.Kind, "dereth", "network kind"); + Check.Eq(t.Network.Command, "derethnetwork", "network command"); + Check.True(json.Contains("\"network\":{\"kind\":\"dereth\",\"command\":\"derethnetwork\"}"), "network key written"); + + // An entry without a network emits no network key. + ServerPackInfo plain = new("dreamweave", "DreamWeave", new[] { "play.example" }, new[] { "DreamWeave" }) + { + ChatTabs = new[] { new ServerChatTab("t", "T", false, "General", new[] { new ServerChatRule("copy", "", "startswith", "x") }) }, + }; + string plainJson = ServerPackModel.BuildSectionsJson(plain, "RynthDreamWeave"); + Check.False(plainJson.Contains("\"network\""), "no network key without a network"); + Check.True(SectionManifestParser.Parse("RynthDreamWeave", plainJson, out string e2).ChatTabs[0].Network == null && e2 == string.Empty, "no network parsed: " + e2); + // A pack without chat tabs emits no key. Check.False(ServerPackModel.BuildSectionsJson(Coldeve(), "RynthColdeve").Contains("chatTabs"), "no chatTabs key by default"); } -- 2.43.0