feat(chat): port retail client command families

Expand the typed client-command boundary across travel, character queries, local UI and layout controls, AFK and consent, emotes, friends, squelch and filters, and fill-components. Preserve retail packet layouts and queue ownership, import the confirmation dialog, and keep authoritative social state in Core.

Co-Authored-By: Codex <codex@openai.com>
This commit is contained in:
Erik 2026-07-13 14:50:15 +02:00
parent 5a45a7ac7f
commit 9ea579bdd0
47 changed files with 6659 additions and 99 deletions

View file

@ -45,7 +45,7 @@ public class ChatCommandRouterTests
}
[Fact]
public void ClearCommand_DrainsLog_DoesNotPublish()
public void ClearCommand_PublishesTypedRetailCommand()
{
var (vm, log, bus) = Fixture();
log.OnSystemMessage("x", chatType: 0);
@ -53,8 +53,10 @@ public class ChatCommandRouterTests
var outcome = ChatCommandRouter.Submit("/clear", vm, bus, ChatChannelKind.Say);
Assert.Equal(SubmitOutcome.ClientHandled, outcome);
Assert.Empty(bus.Published);
Assert.Empty(log.Snapshot());
var command = Assert.IsType<ExecuteClientCommandCmd>(Assert.Single(bus.Published));
Assert.Equal(ClientCommandId.ClearChat, command.Command);
Assert.Equal("", command.Arguments);
Assert.Single(log.Snapshot());
}
[Theory]

View file

@ -70,7 +70,7 @@ public sealed class ChatPanelInputTests
}
[Fact]
public void Submit_FramerateCommand_PrintsFpsAndDoesNotPublish()
public void Submit_FramerateCommand_PublishesTypedClientCommand()
{
var log = new ChatLog();
var vm = new ChatVM(log) { FpsProvider = () => 60f };
@ -84,13 +84,13 @@ public sealed class ChatPanelInputTests
panel.Render(new PanelContext(0.016f, bus), renderer);
Assert.Empty(bus.Published);
var entry = Assert.Single(log.Snapshot());
Assert.Contains("60.0 FPS", entry.Text);
var command = Assert.IsType<ExecuteClientCommandCmd>(Assert.Single(bus.Published));
Assert.Equal(ClientCommandId.ToggleFrameRate, command.Command);
Assert.Empty(log.Snapshot());
}
[Fact]
public void Submit_LocCommand_PrintsPositionAndDoesNotPublish()
public void Submit_LocCommand_PublishesTypedClientCommand()
{
var log = new ChatLog();
var vm = new ChatVM(log)
@ -107,14 +107,13 @@ public sealed class ChatPanelInputTests
panel.Render(new PanelContext(0.016f, bus), renderer);
Assert.Empty(bus.Published);
var entry = Assert.Single(log.Snapshot());
Assert.Contains("(10.0, 20.0, 30.0)", entry.Text);
var command = Assert.IsType<ExecuteClientCommandCmd>(Assert.Single(bus.Published));
Assert.Equal(ClientCommandId.ShowLocation, command.Command);
Assert.Empty(log.Snapshot());
}
[Theory]
[InlineData("/foo", "@foo")]
[InlineData("/mp /tools/script.py", "@mp /tools/script.py")]
[InlineData("/genio public", "@genio public")]
public void Submit_UnknownSlashCommand_RoutesToExplicitServerCommand(string raw, string expectedText)
{
@ -213,7 +212,7 @@ public sealed class ChatPanelInputTests
}
[Fact]
public void Submit_ClearCommand_DrainsLog_AndDoesNotPublish()
public void Submit_ClearCommand_PublishesTypedClientCommand()
{
var log = new ChatLog();
log.OnSystemMessage("seed line", chatType: 0);
@ -228,8 +227,9 @@ public sealed class ChatPanelInputTests
panel.Render(new PanelContext(0.016f, bus), renderer);
Assert.Empty(bus.Published);
Assert.Empty(log.Snapshot());
var command = Assert.IsType<ExecuteClientCommandCmd>(Assert.Single(bus.Published));
Assert.Equal(ClientCommandId.ClearChat, command.Command);
Assert.Single(log.Snapshot());
}
[Fact]

View file

@ -20,6 +20,81 @@ public sealed class RetailClientCommandCatalogTests
Assert.Empty(match.Arguments);
}
[Theory]
[InlineData("/marketplace", ClientCommandId.MarketplaceRecall)]
[InlineData("@MAR", ClientCommandId.MarketplaceRecall)]
[InlineData("/mp", ClientCommandId.MarketplaceRecall)]
[InlineData("/pkarena", ClientCommandId.PkArenaRecall)]
[InlineData("/pka", ClientCommandId.PkArenaRecall)]
[InlineData("/pklarena", ClientCommandId.PkLiteArenaRecall)]
[InlineData("/pla", ClientCommandId.PkLiteArenaRecall)]
[InlineData("/hor", ClientCommandId.HouseRecall)]
[InlineData("/hr", ClientCommandId.HouseRecall)]
[InlineData("/hom", ClientCommandId.MansionRecall)]
[InlineData("/hoa", ClientCommandId.MansionRecall)]
[InlineData("/age", ClientCommandId.QueryAge)]
[InlineData("/birth", ClientCommandId.QueryBirth)]
[InlineData("/framerate", ClientCommandId.ToggleFrameRate)]
[InlineData("/lockui", ClientCommandId.ToggleUiLock)]
[InlineData("/version", ClientCommandId.ShowVersion)]
[InlineData("/loc", ClientCommandId.ShowLocation)]
[InlineData("/corpse", ClientCommandId.ShowLastCorpseLocation)]
[InlineData("/cor", ClientCommandId.ShowLastCorpseLocation)]
public void AdditionalRetailAliases_Resolve(string input, ClientCommandId expected)
{
Assert.True(RetailClientCommandCatalog.TryMatch(input, out var match));
Assert.Equal(expected, match.Command);
Assert.True(match.HasValidArguments);
}
[Theory]
[InlineData("/clear all", ClientCommandId.ClearChat)]
[InlineData("/saveui hunt", ClientCommandId.SaveUi)]
[InlineData("/loadui hunt", ClientCommandId.LoadUi)]
[InlineData("/saveautoui", ClientCommandId.SaveAutoUi)]
[InlineData("/loadautoui", ClientCommandId.LoadAutoUi)]
[InlineData("/afk msg lunch", ClientCommandId.Away)]
[InlineData("/consent who", ClientCommandId.Consent)]
[InlineData("/e waves", ClientCommandId.Emote)]
[InlineData("/em waves", ClientCommandId.Emote)]
[InlineData("/emote waves", ClientCommandId.Emote)]
[InlineData("/me waves", ClientCommandId.Emote)]
[InlineData("/emotes", ClientCommandId.ListEmotes)]
[InlineData("/friends online", ClientCommandId.Friends)]
[InlineData("/friends_add Alice", ClientCommandId.FriendsAdd)]
[InlineData("/friends_remove Alice", ClientCommandId.FriendsRemove)]
[InlineData("/squelch -tell Alice", ClientCommandId.Squelch)]
[InlineData("/unsquelch Alice", ClientCommandId.Unsquelch)]
[InlineData("/filter -combat", ClientCommandId.Filter)]
[InlineData("/unfilter -combat", ClientCommandId.Unfilter)]
[InlineData("/messagetypes", ClientCommandId.ListMessageTypes)]
[InlineData("/fillcomps scarabs 500", ClientCommandId.FillComponents)]
public void CommandFamilies_ResolveToTypedClientCommands(
string input, ClientCommandId expected)
{
Assert.True(RetailClientCommandCatalog.TryMatch(input, out var match));
Assert.Equal(expected, match.Command);
Assert.True(match.HasValidArguments);
}
[Theory]
[InlineData("/house recall", ClientCommandId.HouseRecall)]
[InlineData("@house mansion_recall", ClientCommandId.MansionRecall)]
[InlineData("/house alleg_recall", ClientCommandId.MansionRecall)]
public void HouseRecallSubcommands_Resolve(string input, ClientCommandId expected)
{
Assert.True(RetailClientCommandCatalog.TryMatch(input, out var match));
Assert.Equal(expected, match.Command);
Assert.True(match.HasValidArguments);
}
[Fact]
public void UnsupportedHouseSubcommand_RemainsClientOwnedAndShowsUsage()
{
Assert.True(RetailClientCommandCatalog.TryMatch("/house nope", out var match));
Assert.False(match.HasValidArguments);
}
[Fact]
public void LifestoneArgument_IsRecognizedButInvalid()
{

View file

@ -202,6 +202,7 @@ public sealed class SettingsStoreTests : System.IDisposable
ShowHelm = false,
LockUI = true,
UseMouseTurning = true,
AcceptLootPermits = false,
};
store.SaveGameplay(original);
@ -434,4 +435,19 @@ public sealed class SettingsStoreTests : System.IDisposable
Assert.Equal(hd, store.LoadWindowLayout("Alice", "1600x900", "chat", default));
Assert.Equal(uhd, store.LoadWindowLayout("Alice", "3200x1800", "chat", default));
}
[Fact]
public void NamedWindowLayouts_RoundTripIndependentlyOfCharacterAndResolution()
{
var store = new SettingsStore(_tempPath);
var hunting = new UiWindowLayout(10f, 20f, 500f, 250f, true, false, true);
var crafting = new UiWindowLayout(30f, 40f, 300f, 400f, false, true, false);
store.SaveNamedWindowLayout("hunting", "chat", hunting);
store.SaveNamedWindowLayout("crafting", "chat", crafting);
Assert.Equal(hunting, store.LoadNamedWindowLayout("hunting", "chat", default));
Assert.Equal(crafting, store.LoadNamedWindowLayout("crafting", "chat", default));
Assert.Null(store.LoadNamedWindowLayout("missing", "chat", default));
}
}