feat(chat): Campaign CH slice CH1 — retail LogTextType color table

Retail colors chat lines by the 34-value wire LogTextType (ACE's
ChatMessageType), NOT by acdream's synthetic 9-value ChatKind. The old
ChatWindowController.RetailChatColor(ChatKind) collapsed distinct retail
colors onto one bucket per ChatKind — e.g. every Channel line rendered
colorLightBlue (Magic's slot) when retail's actual palette spans five
different colors across the Turbine rooms and legacy allegiance family.

Ports ChatInterface::BuildChatColorLookupTable @0x004F31C0 verbatim
(RetailChatColorTable, all 34 RGBA floats read from the PDB-paired
binary's .data section) and threads a new ChatEntry.LogTextType field
through every ingestion site to the correct retail wire value:
HearSpeech/Tell pass the wire chatType through verbatim; Emote/SoulEmote
hard-code 0x0C; the Tell self-echo hard-codes 0x04; legacy ChatChannel
broadcasts derive their type from the channel bit via the new
LegacyChannelChatType helper (ported from the decompiled
Handle_Communication__ChannelBroadcast dispatch, hear vs. own-send);
TurbineChat rooms map through TurbineChatDisplayNames.LogTextType;
CombatChatTranslator's hit/miss/evade lines map to ACE's CombatSelf/
CombatEnemy per Player_Combat.cs; kill/death lines use retail's
decompiled 0x00 Default (not a combat color). ChatWindowController's
transcript now folds LogTextType through RetailChatColorTable with
retail's exact "out-of-range keeps the previous line's color" carry
rule; ChatPanel's combat highlighting sources the same table.

Corrects HearSpeech.cs's doc-comment ChatType legend (4 of 6 entries
were wrong). Adds register row AP-175 for the pre-existing (unchanged)
Popup-renders-in-chat divergence and updates AP-39's stale per-ChatKind
description. Narrows ISSUES #139 — its chat-colors half is done.

Retail renders no chat timestamp prefix path exists in acdream today,
so the "timestamp is always colorGrey 0x0C" rule has nothing to attach
to; noted here per the research doc rather than left silent.

Research: docs/research/2026-08-09-chat-retail-color-table.md
Full Release suite: 11,833 passed / 4 skipped / 0 failed.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-09 15:23:31 +02:00
parent 8df35d1e18
commit 172c6f9aa3
26 changed files with 1360 additions and 85 deletions

View file

@ -102,21 +102,28 @@ public static class GameEventWiring
registrar.Register(GameEventType.ChannelBroadcast, e =>
{
var p = GameEvents.ParseChannelBroadcast(e.Payload.Span);
// logTextType left unset — ChatLog.OnChannelBroadcast derives it
// from ChannelId via LegacyChannelChatType.Resolve(ownSend: false),
// the correct branch for this inbound (hear) 0x0147 handler.
if (p is not null) chat.OnChannelBroadcast(p.Value.ChannelId, p.Value.SenderName, p.Value.Message);
});
registrar.Register(GameEventType.Tell, e =>
{
var p = GameEvents.ParseTell(e.Payload.Span);
if (p is not null) chat.OnTellReceived(p.Value.SenderName, p.Value.Message, p.Value.SenderGuid);
// p.Value.ChatType is the wire LogTextType (normally 0x03 Tell) —
// passed through verbatim, matching HearSpeech's zero-remap rule.
if (p is not null)
chat.OnTellReceived(p.Value.SenderName, p.Value.Message, p.Value.SenderGuid, p.Value.ChatType);
});
registrar.Register(GameEventType.CommunicationTransientString, e =>
{
// 0x02EB carries no chat type on the wire (see ParseTransient).
// 0 is ACE's ChatMessageType.Broadcast, which its own
// LogTextTypeEnumMapper comment names "Default" — the right
// stand-in for a message the server sends untyped. The exact
// retail rendering style for transient strings belongs to the
// chat colour/text work, not to this parser.
// stand-in for a message the server sends untyped. Left at 0x00
// by Campaign CH slice CH1 (retail color table): this is
// server-driven text, not client-local, so it keeps the
// Default/green color rather than moving to 0x1A.
var s = GameEvents.ParseTransient(e.Payload.Span);
if (s is not null) chat.OnSystemMessage(s, chatType: 0u);
});
@ -132,6 +139,10 @@ public static class GameEventWiring
string text = string.IsNullOrEmpty(p.Value.Name)
? $"You have played for {p.Value.Age}."
: $"{p.Value.Name} has played for {p.Value.Age}.";
// Decomp-confirmed 0x00 Default:
// CM_Character::DispatchUI_QueryAgeResponse @0x006A2E40 ->
// Handle_Character__QueryAgeResponse @0x005711D0 ->
// AddTextToScroll(..., 0, 1, 0), pc:382186.
chat.OnSystemMessage(text, chatType: 0u);
});
if (onConfirmationRequest is not null)
@ -247,7 +258,12 @@ public static class GameEventWiring
registrar.Register(GameEventType.VictimNotification, e =>
{
var p = GameEvents.ParseVictimNotification(e.Payload.Span);
if (p is not null) chat.OnCombatLine(p.Value.DeathMessage, CombatLineKind.Error);
// VictimNotification (0x01AC) and KillerNotification (0x01AD)
// both dispatch through the SAME retail handler,
// ClientCombatSystem::HandleKillerNotificationEvent @0x0056C410
// (pc:359548-359559), which calls AddTextToScroll(..., 0, 1, 0)
// — LogTextType 0x00 Default, not a combat color.
if (p is not null) chat.OnCombatLine(p.Value.DeathMessage, CombatLineKind.Error, logTextType: 0x00u);
});
registrar.Register(GameEventType.DefenderNotification, e =>
{
@ -285,7 +301,8 @@ public static class GameEventWiring
registrar.Register(GameEventType.KillerNotification, e =>
{
var p = GameEvents.ParseKillerNotification(e.Payload.Span);
if (p is not null) chat.OnCombatLine(p.Value.DeathMessage, CombatLineKind.Info);
// Same handler/type as VictimNotification above — 0x00 Default.
if (p is not null) chat.OnCombatLine(p.Value.DeathMessage, CombatLineKind.Info, logTextType: 0x00u);
});
// ── Spells ────────────────────────────────────────────────
@ -526,6 +543,10 @@ public static class GameEventWiring
if (err is null) return;
Console.WriteLine($"[use-done] err=0x{err.Value:X4}");
onUseDone?.Invoke(err.Value);
// chatType 0x00 (Default): this text is client-formatted from a
// WeenieError CODE, the same shape as HandleFailureEvent's
// per-code switch (@0x00571990), whose majority case is 0x00 —
// see the identical reasoning on ChatLog.OnWeenieError.
if (err.Value != 0)
chat.OnSystemMessage(WeenieErrorText.For(err.Value), chatType: 0);
});

View file

@ -36,16 +36,24 @@ namespace AcDream.Core.Net.Messages;
/// </para>
///
/// <para>
/// ChatType (from ACE):
/// ChatType (LogTextType — corrected 2026-08-09, Campaign CH slice CH1;
/// the previous legend here had 4 of 6 entries wrong, cf. research doc
/// <c>docs/research/2026-08-09-chat-retail-color-table.md</c> §5.4.1):
/// <list type="bullet">
/// <item><description>0x01 = Broadcast</description></item>
/// <item><description>0x02 = Combat</description></item>
/// <item><description>0x0B = Speech</description></item>
/// <item><description>0x0F = Emote</description></item>
/// <item><description>0x10 = Tell</description></item>
/// <item><description>0x11 = Syllables (spell casting)</description></item>
/// <item><description>0x01 = All (Broadcast/AllChannels)</description></item>
/// <item><description>0x02 = Speech</description></item>
/// <item><description>0x03 = Tell</description></item>
/// <item><description>0x0B = Social_Send</description></item>
/// <item><description>0x0C = Emote</description></item>
/// <item><description>0x0F = Help</description></item>
/// <item><description>0x10 = Appraisal</description></item>
/// <item><description>0x11 = Spellcasting (syllables)</description></item>
/// <item><description>other values in ACE ChatMessageType.cs</description></item>
/// </list>
/// This value is passed through VERBATIM as the chat line's
/// <c>LogTextType</c> — zero remapping (retail's
/// <c>Handle_Communication__HearSpeech @0x005712A0</c> feeds the raw
/// wire word straight into <c>AddTextToScroll</c>).
/// </para>
/// </summary>
public static class HearSpeech