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

@ -93,7 +93,15 @@ public sealed class ChatLog
/// Port from holtburger
/// <c>references/holtburger/.../client/messages.rs</c> lines 476-487.
/// </remarks>
public void OnLocalSpeech(string sender, string text, uint senderGuid, bool isRanged)
/// <param name="logTextType">
/// The wire <c>chatType</c> carried by HearSpeech/HearRangedSpeech
/// (<c>speech.ChatType</c>) — passed through VERBATIM, with zero
/// remapping, matching retail's <c>Handle_Communication__HearSpeech
/// @0x005712A0</c> (the raw <c>arg5</c> feeds <c>AddTextToScroll</c>
/// directly). Defaults to <c>0x02</c> (Speech) for callers that
/// don't have a wire value in hand.
/// </param>
public void OnLocalSpeech(string sender, string text, uint senderGuid, bool isRanged, uint logTextType = 0x02u)
{
// Phase J: ACE's HandleActionTalk broadcasts a HearSpeech echo
// back to the sender too. Detect own echo by guid match and
@ -107,7 +115,10 @@ public sealed class ChatLog
Sender: effectiveSender,
Text: text,
SenderGuid: senderGuid,
ChannelId: 0));
ChannelId: 0)
{
LogTextType = logTextType,
});
}
/// <summary>EmoteText (0x01E0) — server-driven third-person emote.</summary>
@ -118,7 +129,13 @@ public sealed class ChatLog
Sender: senderName,
Text: text,
SenderGuid: senderGuid,
ChannelId: 0));
ChannelId: 0)
{
// Retail hard-codes Emote (0x0C) for every HearEmote line —
// ClientCommunicationSystem::HearEmote @0x0057CBE0, the
// literal constant at 0x0057CF94. Not a wire value.
LogTextType = 0x0Cu,
});
}
/// <summary>SoulEmote (0x01E2) — complex emote (chat + paired animation).</summary>
@ -129,7 +146,12 @@ public sealed class ChatLog
Sender: senderName,
Text: text,
SenderGuid: senderGuid,
ChannelId: 0));
ChannelId: 0)
{
// HearSoulEmote tail-calls HearEmote @0x0057D096 — same
// hard-coded 0x0C.
LogTextType = 0x0Cu,
});
}
/// <summary>PlayerKilled (0x019E) — death announcement.</summary>
@ -147,7 +169,18 @@ public sealed class ChatLog
Sender: "",
Text: deathMessage,
SenderGuid: victimGuid,
ChannelId: killerGuid));
ChannelId: killerGuid)
{
// Inferred by analogy from the sibling GameEvents this opcode
// shares a dispatch pattern with: VictimNotification (0x01AC)
// and KillerNotification (0x01AD) both route through the SAME
// retail handler, ClientCombatSystem::HandleKillerNotification
// Event @0x0056C410 (cases 0xa/0xb of the combat-envelope
// switch, pc:359548-359559), which calls
// AddTextToScroll(..., 0, 1, 0) — type 0x00 Default. No direct
// decomp citation was traced for 0x019E PlayerKilled itself.
LogTextType = 0x00u,
});
}
/// <summary>WeenieError (0x028A) / WeenieErrorWithString (0x028B).</summary>
@ -178,7 +211,15 @@ public sealed class ChatLog
Sender: "",
Text: text,
SenderGuid: 0,
ChannelId: errorId));
ChannelId: errorId)
{
// Retail's HandleFailureEvent @0x00571990 dispatches per ERROR
// CODE across an ~87-case switch, mostly AddTextToScroll(...,
// 0, ...) with a scattered handful at 0x1a (client-local red).
// A full per-code port is future work; 0x00 (Default) matches
// the switch's majority behavior and is the safe baseline.
LogTextType = 0x00u,
});
}
/// <summary>
@ -190,7 +231,21 @@ public sealed class ChatLog
/// <c>ChatVM</c> formatter renders entries as
/// <c>"[ChannelName] Sender says, \"text\""</c> when set.
/// </summary>
public void OnChannelBroadcast(uint channelId, string sender, string text, string channelName = "")
/// <param name="logTextType">
/// The retail <c>LogTextType</c> for this line. When
/// <see langword="null"/> (the legacy 0x0147 default), it is derived
/// from <paramref name="channelId"/> via
/// <see cref="LegacyChannelChatType.Resolve"/> as a HEARD (not
/// own-send) message — correct for this method's only production
/// caller, the inbound <c>ChannelBroadcast</c> GameEvent handler.
/// TurbineChat-sourced calls MUST pass an explicit value computed
/// from the room's <c>TurbineChat.ChatType</c> instead — the wire
/// <paramref name="channelId"/> there is an opaque per-session room
/// GUID, not a legacy channel bitflag, and the two id spaces must
/// never be conflated.
/// </param>
public void OnChannelBroadcast(
uint channelId, string sender, string text, uint? logTextType = null, string channelName = "")
{
Append(new ChatEntry(
Kind: ChatKind.Channel,
@ -200,18 +255,28 @@ public sealed class ChatLog
ChannelId: channelId)
{
ChannelName = channelName,
LogTextType = logTextType ?? LegacyChannelChatType.Resolve(channelId, ownSend: false),
});
}
/// <summary>GameEvent Tell (0x02BD) — whisper received.</summary>
public void OnTellReceived(string sender, string text, uint senderGuid)
/// <param name="logTextType">
/// The wire <c>chatType</c> from the Tell GameEvent payload
/// (<c>GameEvents.Tell.ChatType</c>) — retail's normal value is
/// <c>0x03</c> (Tell), which is also this parameter's default for
/// callers without a wire value in hand.
/// </param>
public void OnTellReceived(string sender, string text, uint senderGuid, uint logTextType = 0x03u)
{
Append(new ChatEntry(
Kind: ChatKind.Tell,
Sender: sender,
Text: text,
SenderGuid: senderGuid,
ChannelId: 0));
ChannelId: 0)
{
LogTextType = logTextType,
});
}
/// <summary>
@ -241,10 +306,28 @@ public sealed class ChatLog
Sender: "",
Text: text,
SenderGuid: 0,
ChannelId: chatType));
ChannelId: chatType)
{
// `chatType` IS the retail LogTextType here — every caller
// (ServerMessage.ChatType, GameEventWiring's transient/
// query-age/use-done sites, App's client-command echoes)
// already passes the wire/retail-correct value.
LogTextType = chatType,
});
}
/// <summary>GameEvent PopupString (0x0004) — modal dialog text.</summary>
/// <summary>
/// GameEvent PopupString (0x0004) — modal dialog text.
/// </summary>
/// <remarks>
/// Retail shows PopUpString as a MODAL DIALOG
/// (<c>Handle_Communication__PopUpString @0x0057FE80</c>), never as a
/// chat-log line — acdream's choice to render it in chat at all is a
/// registered divergence (register row AP-175). Fixed at LogTextType
/// <c>0x00</c> (Default/green) to preserve the color this entry has
/// always rendered with; retail has no chat color for this type since
/// it never reaches the chat log.
/// </remarks>
public void OnPopup(string text)
{
Append(new ChatEntry(
@ -252,7 +335,10 @@ public sealed class ChatLog
Sender: "",
Text: text,
SenderGuid: 0,
ChannelId: 0));
ChannelId: 0)
{
LogTextType = 0x00u,
});
}
/// <summary>
@ -266,7 +352,19 @@ public sealed class ChatLog
/// <c>warning().combat()</c> / <c>error().combat()</c> tag flow at
/// <c>chat.rs:221-308</c>.
/// </summary>
public void OnCombatLine(string text, Combat.CombatLineKind kind = Combat.CombatLineKind.Info)
/// <param name="logTextType">
/// The retail <c>LogTextType</c> for this combat line. Callers should
/// pass one of the ACE-cited combat types (<c>0x16</c> Combat_Self for
/// lines about the local player's OWN offensive action, <c>0x15</c>
/// Combat_Enemy for lines about an enemy's action against the local
/// player — see <see cref="CombatChatTranslator"/>) or <c>0x00</c>
/// Default for retail's decompiled kill/death-notification color
/// (<c>HandleKillerNotificationEvent @0x0056C410</c>). Defaults to
/// <c>0x06</c> (the generic Combat slot) for callers with no more
/// specific classification in hand.
/// </param>
public void OnCombatLine(
string text, Combat.CombatLineKind kind = Combat.CombatLineKind.Info, uint logTextType = 0x06u)
{
Append(new ChatEntry(
Kind: ChatKind.Combat,
@ -276,6 +374,7 @@ public sealed class ChatLog
ChannelId: 0)
{
CombatKind = kind,
LogTextType = logTextType,
});
}
@ -300,7 +399,18 @@ public sealed class ChatLog
/// discriminator the formatter uses to render outgoing-vs-incoming
/// (a real incoming Tell carries the sender's player guid).
/// </remarks>
public void OnSelfSent(ChatKind kind, string text, string targetOrChannel = "")
/// <param name="logTextType">
/// The retail <c>LogTextType</c> for this self-sent line. When
/// <see langword="null"/>, defaults to <c>0x04</c> Speech_Direct_Send
/// for Tell (retail's own-echo "You tell ..." type — cross-check
/// ACE's <c>ChatMessageType.OutgoingTell</c> comment "You tell ...") or
/// <c>0x0B</c> Social_Send for Channel (the simplified own-send default
/// research doc §3.3 records; the LiveSessionCommandRouter production
/// caller overrides this with the precise per-channel-bit value from
/// <see cref="LegacyChannelChatType.Resolve"/> instead of relying on
/// this fallback).
/// </param>
public void OnSelfSent(ChatKind kind, string text, string targetOrChannel = "", uint? logTextType = null)
{
Append(new ChatEntry(
Kind: kind,
@ -315,6 +425,7 @@ public sealed class ChatLog
ChannelId: 0)
{
ChannelName = kind == ChatKind.Channel ? targetOrChannel : "",
LogTextType = logTextType ?? (kind == ChatKind.Tell ? 0x04u : 0x0Bu),
});
}
@ -378,4 +489,17 @@ public readonly record struct ChatEntry(
/// Falls back to <c>"ch {ChannelId}"</c> if not populated.
/// </summary>
public string ChannelName { get; init; } = "";
/// <summary>
/// Campaign CH slice CH1: the retail wire <c>LogTextType</c>
/// (<c>0x00</c>-<c>0x21</c>) that keys
/// <c>RetailChatColorTable</c>/<c>ChatInterface::BuildChatColorLookupTable
/// @0x004F31C0</c>. This is the FULL 34-value retail index space, NOT
/// <see cref="Kind"/> — retail colors by this integer, never by our
/// synthetic 9-value <see cref="ChatKind"/>. Populated by every
/// <c>OnXxx</c> ingestion method above; defaults to <c>0x00</c>
/// (Default/green, retail's own unfilled-slot default) for any entry
/// constructed without setting it explicitly.
/// </summary>
public uint LogTextType { get; init; } = 0x00u;
}