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 <noreply@anthropic.com>
This commit is contained in:
Daniel Wallace 2026-11-15 08:28:04 -08:00
commit ac555572c7
4 changed files with 104 additions and 2 deletions

View file

@ -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");