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
|
|
@ -154,6 +154,9 @@ public sealed class GameEventWiringTests
|
|||
var entry = chat.Snapshot()[0];
|
||||
Assert.Equal(ChatKind.Channel, entry.Kind);
|
||||
Assert.Equal("Alice", entry.Sender);
|
||||
// channelId 42 (0x2A) matches no named legacy bit — generic
|
||||
// admin/audit catch-all (LegacyChannelChatType.Resolve → 0x0E).
|
||||
Assert.Equal(0x0Eu, entry.LogTextType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -584,6 +587,10 @@ public sealed class GameEventWiringTests
|
|||
Assert.Equal(ChatKind.Combat, entry.Kind);
|
||||
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
||||
Assert.Equal("You killed the drudge!", entry.Text);
|
||||
// Default (0x00), not a combat color — HandleKillerNotificationEvent
|
||||
// @0x0056C410 calls AddTextToScroll(..., 0, 1, 0) for both
|
||||
// VictimNotification and KillerNotification.
|
||||
Assert.Equal(0x00u, entry.LogTextType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,9 @@ public sealed class CombatChatTranslatorTests
|
|||
Assert.Equal(ChatKind.Combat, entry.Kind);
|
||||
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
||||
Assert.Equal("You hit Mosswart Defiler for 12 slashing damage (54.0%).", entry.Text);
|
||||
// Combat_Self (0x16) — retail's own-attack squelch type,
|
||||
// references/ACE/.../Player_Combat.cs:162-163.
|
||||
Assert.Equal(0x16u, entry.LogTextType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -50,6 +53,9 @@ public sealed class CombatChatTranslatorTests
|
|||
Assert.Equal(ChatKind.Combat, entry.Kind);
|
||||
Assert.Equal(CombatLineKind.Warning, entry.CombatKind);
|
||||
Assert.Equal("Mosswart Stalker hit you for 7 fire damage to your chest.", entry.Text);
|
||||
// Combat_Enemy (0x15) — retail's incoming-attack squelch type,
|
||||
// references/ACE/.../Player_Combat.cs:541.
|
||||
Assert.Equal(0x15u, entry.LogTextType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -77,6 +83,8 @@ public sealed class CombatChatTranslatorTests
|
|||
Assert.Equal(ChatKind.Combat, entry.Kind);
|
||||
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
||||
Assert.Equal("Mosswart Sniper evaded your attack.", entry.Text);
|
||||
// Combat_Self (0x16) — about the local player's OWN attack missing.
|
||||
Assert.Equal(0x16u, entry.LogTextType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -88,6 +96,8 @@ public sealed class CombatChatTranslatorTests
|
|||
var entry = Assert.Single(chat.Snapshot());
|
||||
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
||||
Assert.Equal("You evaded Drudge Slinker's attack.", entry.Text);
|
||||
// Combat_Enemy (0x15) — about an ENEMY'S attack.
|
||||
Assert.Equal(0x15u, entry.LogTextType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
@ -121,6 +131,9 @@ public sealed class CombatChatTranslatorTests
|
|||
Assert.Equal(ChatKind.Combat, entry.Kind);
|
||||
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
||||
Assert.Equal("You killed Phyntos Wasp.", entry.Text);
|
||||
// Default (0x00) — retail's decompiled kill/death color, not a
|
||||
// combat color; see HandleKillerNotificationEvent @0x0056C410.
|
||||
Assert.Equal(0x00u, entry.LogTextType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
39
tests/AcDream.Core.Tests/Chat/LegacyChannelChatTypeTests.cs
Normal file
39
tests/AcDream.Core.Tests/Chat/LegacyChannelChatTypeTests.cs
Normal file
|
|
@ -0,0 +1,39 @@
|
|||
using AcDream.Core.Chat;
|
||||
using Xunit;
|
||||
|
||||
namespace AcDream.Core.Tests.Chat;
|
||||
|
||||
/// <summary>
|
||||
/// Campaign CH slice CH1: pins <see cref="LegacyChannelChatType.Resolve"/>
|
||||
/// against the decompiled dispatch in
|
||||
/// <c>ClientCommunicationSystem::Handle_Communication__ChannelBroadcast
|
||||
/// @0x00570B90</c> — both the HEAR (someone else's message) and OWN-SEND
|
||||
/// (the local player's own outgoing message) branches, which diverge for
|
||||
/// exactly three bits (Patron/Vassal/Follower).
|
||||
/// </summary>
|
||||
public sealed class LegacyChannelChatTypeTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(0x0800u, 0x13u)] // Fellowship
|
||||
[InlineData(0x1000000u, 0x0Au)] // Co-Vassals
|
||||
[InlineData(0x2000000u, 0x0Au)] // Allegiance Broadcast
|
||||
[InlineData(0x4000000u, 0x13u)] // unnamed bit
|
||||
[InlineData(0x0400u, 0x0Fu)] // Help
|
||||
[InlineData(0x0100u, 0x0Eu)] // generic/admin catch-all
|
||||
[InlineData(0xDEADu, 0x0Eu)] // any other unmatched bit
|
||||
public void Resolve_SameForHearAndSend(uint channelBit, uint expected)
|
||||
{
|
||||
Assert.Equal(expected, LegacyChannelChatType.Resolve(channelBit, ownSend: false));
|
||||
Assert.Equal(expected, LegacyChannelChatType.Resolve(channelBit, ownSend: true));
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(0x1000u)] // Patron
|
||||
[InlineData(0x2000u)] // Vassal
|
||||
[InlineData(0x4000u)] // Follower / Monarch
|
||||
public void Resolve_HearIsSocial_SendIsSocialSend(uint channelBit)
|
||||
{
|
||||
Assert.Equal(0x0Au, LegacyChannelChatType.Resolve(channelBit, ownSend: false));
|
||||
Assert.Equal(0x0Bu, LegacyChannelChatType.Resolve(channelBit, ownSend: true));
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
using AcDream.Core.Net.Messages;
|
||||
using AcDream.Runtime.Session;
|
||||
using Xunit;
|
||||
|
||||
namespace AcDream.Runtime.Tests.Session;
|
||||
|
||||
/// <summary>
|
||||
/// Campaign CH slice CH1: pins <see cref="TurbineChatDisplayNames.LogTextType"/>
|
||||
/// against retail's <c>ChatRoomTracker::GetChatFormat @0x005CD7C0</c>, which
|
||||
/// writes <c>ChatDisplayInfo::m_ltt</c> directly per Turbine room field —
|
||||
/// General/Trade/LFG/Roleplay each get their OWN slot, every Society variant
|
||||
/// collapses to one slot, and Allegiance/Olthoi share the Allegiance slot.
|
||||
/// </summary>
|
||||
public sealed class TurbineChatDisplayNamesTests
|
||||
{
|
||||
[Theory]
|
||||
[InlineData(TurbineChat.ChatType.Allegiance, 0x12u)]
|
||||
[InlineData(TurbineChat.ChatType.General, 0x1Bu)]
|
||||
[InlineData(TurbineChat.ChatType.Trade, 0x1Cu)]
|
||||
[InlineData(TurbineChat.ChatType.Lfg, 0x1Du)]
|
||||
[InlineData(TurbineChat.ChatType.Roleplay, 0x1Eu)]
|
||||
[InlineData(TurbineChat.ChatType.Society, 0x20u)]
|
||||
[InlineData(TurbineChat.ChatType.SocietyCelHan, 0x20u)]
|
||||
[InlineData(TurbineChat.ChatType.SocietyEldWeb, 0x20u)]
|
||||
[InlineData(TurbineChat.ChatType.SocietyRadBlo, 0x20u)]
|
||||
[InlineData(TurbineChat.ChatType.Olthoi, 0x12u)]
|
||||
public void LogTextType_MatchesRetailChatFormat(TurbineChat.ChatType chatType, uint expected)
|
||||
{
|
||||
Assert.Equal(expected, TurbineChatDisplayNames.LogTextType((uint)chatType));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void LogTextType_UnknownChatType_FallsBackToDefault()
|
||||
{
|
||||
Assert.Equal(0x00u, TurbineChatDisplayNames.LogTextType((uint)TurbineChat.ChatType.Undef));
|
||||
}
|
||||
}
|
||||
|
|
@ -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