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:
parent
8df35d1e18
commit
172c6f9aa3
26 changed files with 1360 additions and 85 deletions
|
|
@ -141,4 +141,19 @@ public sealed class ChatVMTests
|
|||
Assert.Single(after);
|
||||
Assert.Equal("Caith says, \"hello\"", after[0]);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ShowSystemMessage_UsesClientLocalLogTextType()
|
||||
{
|
||||
// Campaign CH slice CH1: client-local command output (/help, /clear,
|
||||
// /framerate, /loc, ...) never reaches the wire — retail's own
|
||||
// client-local text is LogTextType 0x1A (bright red).
|
||||
var log = new ChatLog();
|
||||
var vm = new ChatVM(log);
|
||||
|
||||
vm.ShowSystemMessage("Unknown command: foo");
|
||||
|
||||
var entry = Assert.Single(log.Snapshot());
|
||||
Assert.Equal(0x1Au, entry.LogTextType);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,7 +71,11 @@ public sealed class ChatVMCombatTests
|
|||
|
||||
panel.Render(new PanelContext(0.016f, bus), renderer);
|
||||
|
||||
// Plain LocalSpeech entry → Text; combat entry → TextColored.
|
||||
// Plain LocalSpeech entry → Text; combat entry → TextColored, now
|
||||
// sourced from RetailChatColorTable (Campaign CH slice CH1) keyed
|
||||
// by LogTextType, not ChatPanel.ColorForCombat's severity bucket.
|
||||
// OnCombatLine's default logTextType (0x06, generic Combat slot,
|
||||
// colorDarkRed) applies here since no explicit type was passed.
|
||||
Assert.Contains(renderer.Calls, c =>
|
||||
c.Method == "Text" && (string?)c.Args[0] == "Alice says, \"hi\"");
|
||||
var coloredCall = Assert.Single(
|
||||
|
|
@ -80,8 +84,9 @@ public sealed class ChatVMCombatTests
|
|||
Assert.Equal(
|
||||
"You hit Mosswart for 5 slashing damage (50.0%).",
|
||||
(string?)coloredCall.Args[1]);
|
||||
RetailChatColorTable.TryGetColor(0x06u, out var expectedColor);
|
||||
Assert.Equal(
|
||||
ChatPanel.ColorForCombat(CombatLineKind.Info),
|
||||
expectedColor,
|
||||
(System.Numerics.Vector4)coloredCall.Args[0]!);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,103 @@
|
|||
using System.Numerics;
|
||||
using AcDream.UI.Abstractions.Panels.Chat;
|
||||
using Xunit;
|
||||
|
||||
namespace AcDream.UI.Abstractions.Tests.Panels.Chat;
|
||||
|
||||
/// <summary>
|
||||
/// Campaign CH slice CH1: pins every entry of the 34-value retail chat
|
||||
/// color table (<c>ChatInterface::BuildChatColorLookupTable @0x004F31C0</c>)
|
||||
/// against the exact floats recovered from the PDB-paired binary's
|
||||
/// <c>.data</c> section (research doc
|
||||
/// <c>docs/research/2026-08-09-chat-retail-color-table.md</c> §1.2/§2.1),
|
||||
/// plus the 7 slots retail's builder never overwrites (stay green) and the
|
||||
/// out-of-range "keep previous color" rule.
|
||||
/// </summary>
|
||||
public sealed class RetailChatColorTableTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(0x00u, 0.5f, 1f, 0.498f, 1f)] // Default (default-fill)
|
||||
[InlineData(0x01u, 0.5f, 1f, 0.498f, 1f)] // All (default-fill)
|
||||
[InlineData(0x02u, 1f, 1f, 1f, 1f)] // Speech — colorWhite
|
||||
[InlineData(0x03u, 1f, 1f, 0.247f, 1f)] // Tell — yellow
|
||||
[InlineData(0x04u, 0.824f, 0.824f, 0.392f, 1f)] // Speech_Direct_Send — dark yellow
|
||||
[InlineData(0x05u, 1f, 0.498f, 1f, 1f)] // System — colorBrightPurple
|
||||
[InlineData(0x06u, 1f, 0.247f, 0.247f, 1f)] // Combat — colorDarkRed
|
||||
[InlineData(0x07u, 0.247f, 0.749f, 1f, 1f)] // Magic — colorLightBlue
|
||||
[InlineData(0x08u, 1f, 0.588f, 0.588f, 1f)] // Channel — colorPink
|
||||
[InlineData(0x09u, 1f, 0.588f, 0.588f, 1f)] // Channel_Send — colorPink
|
||||
[InlineData(0x0Au, 1f, 1f, 0.247f, 1f)] // Social — yellow
|
||||
[InlineData(0x0Bu, 0.824f, 0.824f, 0.392f, 1f)] // Social_Send — dark yellow
|
||||
[InlineData(0x0Cu, 0.824f, 0.824f, 0.784f, 1f)] // Emote — colorGrey
|
||||
[InlineData(0x0Du, 0.247f, 0.863f, 0.863f, 1f)] // Advancement — colorCyan
|
||||
[InlineData(0x0Eu, 0.706f, 0.863f, 0.941f, 1f)] // Abuse — colorBlueGrey
|
||||
[InlineData(0x0Fu, 1f, 0.247f, 0.247f, 1f)] // Help — colorDarkRed
|
||||
[InlineData(0x10u, 0.5f, 1f, 0.498f, 1f)] // Appraisal (default-fill)
|
||||
[InlineData(0x11u, 0.247f, 0.749f, 1f, 1f)] // Spellcasting — colorLightBlue
|
||||
[InlineData(0x12u, 0.933f, 0.573f, 0.118f, 1f)] // Allegiance — orange
|
||||
[InlineData(0x13u, 1f, 1f, 0.247f, 1f)] // Fellowship — yellow
|
||||
[InlineData(0x14u, 0.5f, 1f, 0.498f, 1f)] // World_Broadcast (default-fill)
|
||||
[InlineData(0x15u, 1f, 0.247f, 0.247f, 1f)] // Combat_Enemy — colorDarkRed
|
||||
[InlineData(0x16u, 0.96f, 0.459f, 0.447f, 1f)] // Combat_Self — colorLightRed
|
||||
[InlineData(0x17u, 0.5f, 1f, 0.498f, 1f)] // Recall (default-fill)
|
||||
[InlineData(0x18u, 0.5f, 1f, 0.498f, 1f)] // Craft (default-fill)
|
||||
[InlineData(0x19u, 0.5f, 1f, 0.498f, 1f)] // Salvaging (default-fill)
|
||||
[InlineData(0x1Au, 1f, 0f, 0f, 1f)] // client-local text — colorBrightRed
|
||||
[InlineData(0x1Bu, 0.706f, 0.863f, 0.941f, 1f)] // Turbine General — colorBlueGrey
|
||||
[InlineData(0x1Cu, 0.706f, 0.863f, 0.941f, 1f)] // Turbine Trade — colorBlueGrey
|
||||
[InlineData(0x1Du, 0.706f, 0.863f, 0.941f, 1f)] // Turbine LFG — colorBlueGrey
|
||||
[InlineData(0x1Eu, 0.706f, 0.863f, 0.941f, 1f)] // Turbine Roleplay — colorBlueGrey
|
||||
[InlineData(0x1Fu, 1f, 1f, 0.247f, 1f)] // Admin_Tell — yellow
|
||||
[InlineData(0x20u, 0.706f, 0.863f, 0.941f, 1f)] // Turbine Society — colorBlueGrey
|
||||
[InlineData(0x21u, 0.933f, 0.573f, 0.118f, 1f)] // reserved — orange
|
||||
public void TryGetColor_PinsExactRetailFloat(
|
||||
uint logTextType, float r, float g, float b, float a)
|
||||
{
|
||||
Assert.True(RetailChatColorTable.TryGetColor(logTextType, out Vector4 color));
|
||||
Assert.Equal(new Vector4(r, g, b, a), color);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Colors_HasExactlyThirtyFourEntries()
|
||||
{
|
||||
// The builder's default-fill loop runs 0x22 (34) iterations,
|
||||
// covering indices 0x00-0x21 inclusive — independently confirmed
|
||||
// by the squelch enumerator's `for (uint i = 0; i < 0x22; i++)`.
|
||||
Assert.Equal(34, RetailChatColorTable.Colors.Count);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0x00u)]
|
||||
[InlineData(0x01u)]
|
||||
[InlineData(0x10u)]
|
||||
[InlineData(0x14u)]
|
||||
[InlineData(0x17u)]
|
||||
[InlineData(0x18u)]
|
||||
[InlineData(0x19u)]
|
||||
public void SevenUnoverwrittenSlots_StayDefaultGreen(uint logTextType)
|
||||
{
|
||||
RetailChatColorTable.TryGetColor(logTextType, out Vector4 color);
|
||||
Assert.Equal(new Vector4(0.5f, 1f, 0.498f, 1f), color);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0x22u)] // one past the last valid slot
|
||||
[InlineData(0x23u)]
|
||||
[InlineData(100u)]
|
||||
[InlineData(uint.MaxValue)]
|
||||
public void TryGetColor_OutOfRange_ReturnsFalse(uint logTextType)
|
||||
{
|
||||
// SetFontColorHelper @0x00466AC0's bound check (arg4 < arg2) falls
|
||||
// through without touching m_curFontColor for an out-of-range
|
||||
// index — the caller must keep whatever color the PREVIOUS line
|
||||
// resolved to, not substitute a default (research doc §3.2).
|
||||
Assert.False(RetailChatColorTable.TryGetColor(logTextType, out _));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void EveryAlphaChannelIsOne()
|
||||
{
|
||||
foreach (Vector4 color in RetailChatColorTable.Colors)
|
||||
Assert.Equal(1f, color.W);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue