Applies the Opus review findings on CH1 (172c6f9a), the exact retail chat
color table. Two blockers plus should-fixes/nits, one commit:
BLOCKER 1 — LegacyChannelChatType.Resolve's channel-bit table was wrong.
Binary Ninja renders retail's `neg esi; sbb esi, esi` idiom (a branchless
select between Channel 0x08 and Channel_Send 0x09) as the trivial pseudo-C
`esi - esi` (always 0), hiding the real values. Corrected by decoding the
raw bytes at the PDB-paired binary: HEAR sbb site VA 0x00570F0A (mask -6 ->
0x08), SEND sbb site VA 0x00570D4F (mask -5 -> 0x09). The generic
admin/audit/sentinel catch-all is Channel/Channel_Send, NOT Abuse (0x0E) —
Abuse is retail's ONLY 0x0E producer (bit 0x0001). The unnamed
FellowBroadcast bit (0x4000000) is hear=Channel(0x08)/send=Fellowship(0x13),
not a flat 0x13. ACE's PDB-sourced Channel enum corroborates. Introduces
`RetailLogTextType`, the 34-value named enum for the wire LogTextType space
(values only, no color — Core stays presentation-free).
BLOCKER 2 — three ChatLog.OnSystemMessage sinks (ChatVM.ShowSystemMessage,
LiveSessionRuntimeFactory's ShowSystemMessage delegate,
HeadlessGameplayOperations.DisplayMessage) were typing ALL
ClientCommandController output 0x1A (bright red), including informational
command output (@version, /loc, friends list, usage lines). Retail types
the great majority of that output 0x00 Default (green) and reserves 0x1A
for genuine refusals/errors. Reverted to 0x00 with a comment noting the
refusal-vs-info split lands with CH2's SpewBox producer rewiring. The five
App composition sites that pass 0x1A for actual refusal text
(InteractionRetainedUiComposition, SessionPlayerComposition) were already
correct and are untouched (aside from converting the literal to the new
enum).
Also: AP-176 divergence-register row for OnWeenieError/OnCombatLine's
single-type approximation of retail's per-code/per-message dispatch; a
carry-forward test for the out-of-range LogTextType color fallback in
ChatWindowController; decomp-confirmed anchors replacing ACE-inferred
citations in CombatChatTranslator and ChatLog.OnPlayerKilled; required
(non-optional) logTextType parameters on OnLocalSpeech/OnTellReceived/
OnCombatLine/OnSelfSent since no production caller relied on a default;
LegacyChannelChatType.Resolve's parameter renamed channelBit -> channelId
with a doc note on multi-bit ids; corrections to the color-table research
doc's §3.3 wire tables; and issue #359 for the pre-existing (not
CH1-introduced) 0x019E PlayerKilled participant-suppression gap retail has
and acdream lacks.
dotnet build clean; full Release suite 11,835 passed / 4 skipped / 0 failed
(11,839 total), up from the CH1 baseline of 11,833/4/0.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
79 lines
2.9 KiB
C#
79 lines
2.9 KiB
C#
using AcDream.Core.Chat;
|
|
|
|
namespace AcDream.Core.Tests.Chat;
|
|
|
|
/// <summary>
|
|
/// Phase J: <see cref="ChatLog.SetLocalPlayerGuid"/> teaches the log
|
|
/// to recognize ACE's HearSpeech echo of the local player's own /say
|
|
/// — the server broadcasts to all in range INCLUDING the sender, so
|
|
/// we'd otherwise see both our optimistic "You say" and the
|
|
/// third-person "+Acdream says" from the server. Substituting the
|
|
/// sender to "" routes through the formatter's IsOwnSpeaker path so
|
|
/// only the singular first-person line shows.
|
|
/// </summary>
|
|
public sealed class ChatLogLocalGuidTests
|
|
{
|
|
[Fact]
|
|
public void OnLocalSpeech_OwnGuidMatch_SubstitutesYou()
|
|
{
|
|
var log = new ChatLog();
|
|
log.SetLocalPlayerGuid(0x5000_000A);
|
|
|
|
log.OnLocalSpeech("+Acdream", "hello world",
|
|
senderGuid: 0x5000_000A, isRanged: false, logTextType: 0x02u);
|
|
|
|
var entry = log.Snapshot()[0];
|
|
Assert.Equal(ChatKind.LocalSpeech, entry.Kind);
|
|
Assert.Equal("You", entry.Sender);
|
|
Assert.Equal("hello world", entry.Text);
|
|
}
|
|
|
|
[Fact]
|
|
public void OnLocalSpeech_DifferentGuid_KeepsSenderName()
|
|
{
|
|
var log = new ChatLog();
|
|
log.SetLocalPlayerGuid(0x5000_000A);
|
|
|
|
log.OnLocalSpeech("Caith", "hi",
|
|
senderGuid: 0x5000_0042, isRanged: false, logTextType: 0x02u);
|
|
|
|
Assert.Equal("Caith", log.Snapshot()[0].Sender);
|
|
}
|
|
|
|
[Fact]
|
|
public void OnLocalSpeech_NoLocalGuidSet_FallsBackToEmptySubstitution()
|
|
{
|
|
// Pre-login (guid not yet known), the existing empty-sender
|
|
// substitution still applies — server-driven ranged echoes
|
|
// arrive with sender="" before the player has a guid.
|
|
var log = new ChatLog();
|
|
log.OnLocalSpeech("", "anyone home?",
|
|
senderGuid: 0u, isRanged: true, logTextType: 0x02u);
|
|
|
|
Assert.Equal("You", log.Snapshot()[0].Sender);
|
|
Assert.Equal(ChatKind.RangedSpeech, log.Snapshot()[0].Kind);
|
|
}
|
|
|
|
[Fact]
|
|
public void ResetSessionIdentity_RetainsTranscriptButClearsGuidAndDedupeWindow()
|
|
{
|
|
var log = new ChatLog();
|
|
const uint oldGuid = 0x50000001u;
|
|
const uint newGuid = 0x50000002u;
|
|
log.SetLocalPlayerGuid(oldGuid);
|
|
log.OnSystemMessage("session boundary", 1u);
|
|
log.OnLocalSpeech("Old", "before", oldGuid, isRanged: false, logTextType: 0x02u);
|
|
|
|
log.ResetSessionIdentity();
|
|
log.OnSystemMessage("session boundary", 1u);
|
|
log.OnLocalSpeech("Old", "after", oldGuid, isRanged: false, logTextType: 0x02u);
|
|
log.SetLocalPlayerGuid(newGuid);
|
|
log.OnLocalSpeech("New", "new", newGuid, isRanged: false, logTextType: 0x02u);
|
|
|
|
ChatEntry[] entries = log.Snapshot();
|
|
Assert.Equal(5, entries.Length);
|
|
Assert.Equal("You", entries[1].Sender);
|
|
Assert.Equal("Old", entries[3].Sender);
|
|
Assert.Equal("You", entries[4].Sender);
|
|
}
|
|
}
|