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 <noreply@anthropic.com>
This commit is contained in:
parent
ac555572c7
commit
24e0ec3683
4 changed files with 26 additions and 4 deletions
|
|
@ -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");
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue