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

@ -211,4 +211,158 @@ public sealed class ChatLogTests
CombatLineKind.Error);
Assert.Equal(CombatLineKind.Error, log.Snapshot()[1].CombatKind);
}
// ── Campaign CH slice CH1: LogTextType ingestion-site mapping ──────────
[Fact]
public void OnLocalSpeech_DefaultsLogTextType_ToSpeech()
{
var log = new ChatLog();
log.OnLocalSpeech("Alice", "hi", 0xAA, isRanged: false);
Assert.Equal(0x02u, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnLocalSpeech_PassesWireChatTypeVerbatim()
{
// HearSpeech/HearRangedSpeech carry the LogTextType on the wire —
// zero remapping (research doc §3.3 / HearSpeech.cs doc comment).
var log = new ChatLog();
log.OnLocalSpeech("Mosswart", "grumble", 0x5000_1234u, isRanged: false, logTextType: 0x0Cu);
Assert.Equal(0x0Cu, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnEmote_HardCodesLogTextType_0x0C()
{
var log = new ChatLog();
log.OnEmote("Caith", "waves at you", 0xCAFE);
Assert.Equal(0x0Cu, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnSoulEmote_HardCodesLogTextType_0x0C()
{
var log = new ChatLog();
log.OnSoulEmote("Bob", "dances", 0xBEEF);
Assert.Equal(0x0Cu, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnPlayerKilled_LogTextType_IsDefault()
{
var log = new ChatLog();
log.OnPlayerKilled("Caith was killed by a Drudge.", 0x1u, 0x2u);
Assert.Equal(0x00u, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnWeenieError_LogTextType_IsDefault()
{
var log = new ChatLog();
log.OnWeenieError(errorId: 0x1234, param: null);
Assert.Equal(0x00u, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnPopup_LogTextType_IsDefault()
{
var log = new ChatLog();
log.OnPopup("A modal message.");
var e = log.Snapshot()[0];
Assert.Equal(ChatKind.Popup, e.Kind);
Assert.Equal(0x00u, e.LogTextType);
}
[Fact]
public void OnTellReceived_DefaultsLogTextType_ToTell()
{
var log = new ChatLog();
log.OnTellReceived("Alice", "psst", 0xAA);
Assert.Equal(0x03u, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnTellReceived_PassesWireChatTypeVerbatim()
{
var log = new ChatLog();
log.OnTellReceived("Alice", "psst", 0xAA, logTextType: 0x1Fu);
Assert.Equal(0x1Fu, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnSelfSent_Tell_DefaultsLogTextType_ToSpeechDirectSend()
{
var log = new ChatLog();
log.OnSelfSent(ChatKind.Tell, "hey", targetOrChannel: "Alice");
Assert.Equal(0x04u, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnSelfSent_Channel_DefaultsLogTextType_ToSocialSend()
{
var log = new ChatLog();
log.OnSelfSent(ChatKind.Channel, "hi all", targetOrChannel: "Fellowship");
Assert.Equal(0x0Bu, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnSelfSent_ExplicitLogTextType_Overrides()
{
var log = new ChatLog();
log.OnSelfSent(ChatKind.Channel, "hi all", targetOrChannel: "Fellowship", logTextType: 0x13u);
Assert.Equal(0x13u, log.Snapshot()[0].LogTextType);
}
[Theory]
// Fellowship — same type hear + send.
[InlineData(0x0800u, "Fellowship", 0x13u)]
// Patron/Vassal/Follower — hear is Social (0xA).
[InlineData(0x1000u, "Patron", 0x0Au)]
[InlineData(0x2000u, "Vassal", 0x0Au)]
[InlineData(0x4000u, "Follower", 0x0Au)]
// Co-Vassals / Allegiance Broadcast.
[InlineData(0x1000000u, "Co-Vassals", 0x0Au)]
[InlineData(0x2000000u, "Allegiance Broadcast", 0x0Au)]
// Unnamed bit reuses Fellowship's slot.
[InlineData(0x4000000u, "?", 0x13u)]
// The one named non-family bit inside the generic bucket (Help).
[InlineData(0x0400u, "Help", 0x0Fu)]
// Generic admin/audit/sentinel catch-all.
[InlineData(0x0900u, "Audit", 0x0Eu)]
public void OnChannelBroadcast_DerivesLogTextType_FromLegacyChannelBit(
uint channelBit, string channelName, uint expectedLogTextType)
{
var log = new ChatLog();
log.OnChannelBroadcast(channelBit, sender: "Someone", text: "hi", channelName: channelName);
Assert.Equal(expectedLogTextType, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnChannelBroadcast_ExplicitLogTextType_OverridesLegacyDerivation()
{
// TurbineChat rooms share the ChannelId slot with an opaque room
// GUID (not a legacy bitflag) — callers MUST override.
var log = new ChatLog();
log.OnChannelBroadcast(
channelId: 0x7000_0001u, sender: "Someone", text: "hi",
logTextType: 0x1Bu, channelName: "General");
Assert.Equal(0x1Bu, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnSystemMessage_LogTextType_MatchesChatType()
{
var log = new ChatLog();
log.OnSystemMessage("Your spell fizzled!", chatType: 5);
Assert.Equal(5u, log.Snapshot()[0].LogTextType);
}
[Fact]
public void OnCombatLine_DefaultLogTextType_IsGenericCombat()
{
var log = new ChatLog();
log.OnCombatLine("You hit Mosswart for 5 slashing damage (50.0%).");
Assert.Equal(0x06u, log.Snapshot()[0].LogTextType);
}
}