feat(ui+net): #16 LiveCommandBus + WorldSession.Send{Talk,Tell,Channel} + SendChatCmd wiring
Replaces NullCommandBus.Instance in PanelContext with a real LiveCommandBus when a live session is active. Panels publish SendChatCmd; the host routes it to the right wire opcode + emits a ChatLog.OnSelfSent local echo (optimistic; retail-equivalent for Talk). Pieces: - ChatChannelKind enum (UI.Abstractions) - mirrors holtburger's ChatChannelKind (references/holtburger/.../client/types.rs:35-49). - SendChatCmd record (UI.Abstractions) - (Channel, TargetName?, Text). - LiveCommandBus (UI.Abstractions) - single-handler-per-type; Register<T> throws on double-register; Publish<T> logs missing handler but does not throw. - ChannelResolver (UI.Abstractions) - port of holtburger's resolve_legacy_channel (client/commands.rs:50-62) mapping ChatChannelKind to legacy ChatChannel ids verbatim from holtburger-protocol/.../chat/types.rs:8-24 (Fellow=0x0800, AllegianceBroadcast=0x02000000, Vassals=0x1000, Patron=0x2000, Monarch=0x4000, CoVassals=0x01000000). - WorldSession.SendTalk / SendTell / SendChannel - 3-line wrappers around existing ChatRequests.Build* + SendGameAction. Internal GameActionCapture seam + InternalsVisibleTo for tests. - GameWindow registers SendChatCmd handler: Say -> SendTalk + ChatLog echo, Tell -> SendTell + echo, channel kinds -> ChannelResolver.Resolve -> SendChannel + echo. 12 new tests across SendChatCmd + LiveCommandBus + ChannelResolver + WorldSessionChat. NullCommandBus.Instance retained for back-compat when no live session. Solution total: 893 green (51 + 229 + 613). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
ff5ed9ec0b
commit
8e6e5a0b61
10 changed files with 457 additions and 1 deletions
33
tests/AcDream.UI.Abstractions.Tests/SendChatCmdTests.cs
Normal file
33
tests/AcDream.UI.Abstractions.Tests/SendChatCmdTests.cs
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
namespace AcDream.UI.Abstractions.Tests;
|
||||
|
||||
public sealed class SendChatCmdTests
|
||||
{
|
||||
[Fact]
|
||||
public void Construct_DefaultsTargetNameToNull_ForNonTellChannels()
|
||||
{
|
||||
var cmd = new SendChatCmd(ChatChannelKind.Say, TargetName: null, Text: "hello");
|
||||
|
||||
Assert.Equal(ChatChannelKind.Say, cmd.Channel);
|
||||
Assert.Null(cmd.TargetName);
|
||||
Assert.Equal("hello", cmd.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equality_HoldsForRecordsWithSameValues()
|
||||
{
|
||||
var a = new SendChatCmd(ChatChannelKind.Tell, "Alice", "hi");
|
||||
var b = new SendChatCmd(ChatChannelKind.Tell, "Alice", "hi");
|
||||
|
||||
Assert.Equal(a, b);
|
||||
Assert.Equal(a.GetHashCode(), b.GetHashCode());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Equality_DiffersWhenChannelDiffers()
|
||||
{
|
||||
var a = new SendChatCmd(ChatChannelKind.Fellowship, null, "raid time");
|
||||
var b = new SendChatCmd(ChatChannelKind.Allegiance, null, "raid time");
|
||||
|
||||
Assert.NotEqual(a, b);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue