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:
parent
5a45a7ac7f
commit
9ea579bdd0
47 changed files with 6659 additions and 99 deletions
57
tests/AcDream.Core.Tests/Social/SocialStateTests.cs
Normal file
57
tests/AcDream.Core.Tests/Social/SocialStateTests.cs
Normal file
|
|
@ -0,0 +1,57 @@
|
|||
using AcDream.Core.Social;
|
||||
|
||||
namespace AcDream.Core.Tests.Social;
|
||||
|
||||
public sealed class SocialStateTests
|
||||
{
|
||||
[Fact]
|
||||
public void FriendsState_AppliesRetailIncrementalUpdateKindsByObjectId()
|
||||
{
|
||||
var state = new FriendsState();
|
||||
state.Apply(Update(FriendsUpdateType.Full,
|
||||
Friend(1u, "Alice", online: false),
|
||||
Friend(2u, "Bjørn", online: true)));
|
||||
state.Apply(Update(FriendsUpdateType.OnlineStatus,
|
||||
Friend(1u, "Alice", online: true)));
|
||||
state.Apply(Update(FriendsUpdateType.Add,
|
||||
Friend(3u, "Cara", online: true)));
|
||||
state.Apply(Update(FriendsUpdateType.RemoveSilent,
|
||||
Friend(2u, "Bjørn", online: false)));
|
||||
|
||||
Assert.Collection(
|
||||
state.Snapshot(),
|
||||
alice =>
|
||||
{
|
||||
Assert.Equal(1u, alice.Id);
|
||||
Assert.True(alice.Online);
|
||||
},
|
||||
cara => Assert.Equal(3u, cara.Id));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SquelchState_ReplacesDatabaseAtomically()
|
||||
{
|
||||
var state = new SquelchState();
|
||||
var expected = new SquelchDatabase(
|
||||
new Dictionary<string, uint>(StringComparer.OrdinalIgnoreCase)
|
||||
{
|
||||
["Account"] = 7u,
|
||||
},
|
||||
new Dictionary<uint, SquelchInfo>
|
||||
{
|
||||
[42u] = new("Character", false, new HashSet<uint> { 2u }),
|
||||
},
|
||||
new SquelchInfo(string.Empty, false, new HashSet<uint> { 7u }));
|
||||
|
||||
state.Replace(expected);
|
||||
|
||||
Assert.Same(expected, state.Snapshot());
|
||||
}
|
||||
|
||||
private static FriendEntry Friend(uint id, string name, bool online) =>
|
||||
new(id, name, online, AppearOffline: false, [], []);
|
||||
|
||||
private static FriendsUpdate Update(
|
||||
FriendsUpdateType type, params FriendEntry[] entries) =>
|
||||
new(type, entries);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue