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
|
|
@ -9255,27 +9255,24 @@ See divergence register **AP-59**.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
## #139 — D.2b retail UI polish: chat text colors + buttons
|
## #139 — D.2b retail UI polish: chat buttons
|
||||||
|
|
||||||
**Status:** OPEN
|
**Status:** OPEN (narrowed 2026-08-09 — the chat-text-colors half CLOSED, see below)
|
||||||
**Severity:** LOW (cosmetic fit-and-finish — the widget generalization works and matches the prior hand-made build; this is polish vs a side-by-side retail client)
|
**Severity:** LOW (cosmetic fit-and-finish — the widget generalization works and matches the prior hand-made build; this is polish vs a side-by-side retail client)
|
||||||
**Filed:** 2026-06-16
|
**Filed:** 2026-06-16
|
||||||
**Component:** ui — D.2b retail UI (chat window + buttons)
|
**Component:** ui — D.2b retail UI (chat buttons)
|
||||||
|
|
||||||
**Description (user):** After the widget-generalization pass landed (2026-06-16), two areas want a polish pass against retail:
|
**Description (user):** After the widget-generalization pass landed (2026-06-16), two areas wanted a polish pass against retail. Item 1 (chat text colors) is now DONE — see below. Item 2 remains open:
|
||||||
1. **Chat text colors** — the per-`ChatKind` transcript text colors need tuning to match retail more precisely. Current values come from a live cdb dump of the named `RGBAColor` constants (colorWhite / BrightPurple / LightBlue / Green / LightRed / Grey) mapped per `ChatKind` in `ChatWindowController.RetailChatColor`. The four common kinds (speech/tell/channel/system) are confirmed; the rarer kinds (emote, soul-emote, combat, popup) map to the nearest named color and may be off — verify each against a side-by-side retail client.
|
1. ~~**Chat text colors**~~ — **CLOSED 2026-08-09, Campaign CH slice CH1.** `ChatWindowController.RetailChatColor(ChatKind)` (the old best-effort per-`ChatKind` map) is deleted; coloring now keys off the entry's retail wire `LogTextType` through the exact 34-entry `RetailChatColorTable`, a faithful port of `ChatInterface::BuildChatColorLookupTable @0x004F31C0` with every RGBA float read from the PDB-paired binary's `.data` section — see `docs/research/2026-08-09-chat-retail-color-table.md` and `docs/plans/2026-08-09-chat-parity-campaign.md`.
|
||||||
2. **Buttons** — the chat buttons (Send, Max/Min, and the channel "Chat ▸" menu button) want visual polish: **pressed / hover state feedback** (`UiButton` currently draws only its default-state sprite; the dat carries `Normal`/`Pressed`/`Highlight` states it does not yet switch on), plus a check that the face 3-slice + autosize read cleanly at all widths.
|
2. **Buttons** — the chat buttons (Send, Max/Min, and the channel "Chat ▸" menu button) want visual polish: **pressed / hover state feedback** (`UiButton` currently draws only its default-state sprite; the dat carries `Normal`/`Pressed`/`Highlight` states it does not yet switch on), plus a check that the face 3-slice + autosize read cleanly at all widths.
|
||||||
|
|
||||||
**Root cause / status:** Deferred polish, NOT a regression — the generalized chat matches the prior hand-made build (user-confirmed 2026-06-16). `UiButton` intentionally mirrors `UiDatElement`'s single-state render (pressed-state was out of the generalization's scope); chat colors are best-effort from the cdb dump.
|
**Root cause / status:** Deferred polish, NOT a regression — the generalized chat matches the prior hand-made build (user-confirmed 2026-06-16). `UiButton` intentionally mirrors `UiDatElement`'s single-state render (pressed-state was out of the generalization's scope).
|
||||||
|
|
||||||
**Files:**
|
**Files:**
|
||||||
- `src/AcDream.App/UI/Layout/ChatWindowController.cs` — `RetailChatColor(ChatKind)` per-kind color map.
|
|
||||||
- `src/AcDream.App/UI/UiButton.cs` — `ActiveFile()` / `OnEvent` (no pressed-state swap yet; dat has Normal/Pressed/Highlight).
|
- `src/AcDream.App/UI/UiButton.cs` — `ActiveFile()` / `OnEvent` (no pressed-state swap yet; dat has Normal/Pressed/Highlight).
|
||||||
- `src/AcDream.App/UI/UiMenu.cs` — `DrawButtonFace` (Normal vs Pressed sprite) for the channel button.
|
- `src/AcDream.App/UI/UiMenu.cs` — `DrawButtonFace` (Normal vs Pressed sprite) for the channel button.
|
||||||
|
|
||||||
**Research:** `claude-memory/reference_retail_chat_colors.md` (the cdb chat-color dump + recipe).
|
**Acceptance:** Button (pressed/hover) states match a side-by-side retail client — user's visual sign-off. (Chat text colors already user-gated at Campaign CH's campaign-level gate.)
|
||||||
|
|
||||||
**Acceptance:** Chat text colors and button (pressed/hover) states match a side-by-side retail client — user's visual sign-off.
|
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -99,7 +99,7 @@ implementer per slice against a pinned contract (per
|
||||||
| Slice | Commit | Suite | Review | User gate |
|
| Slice | Commit | Suite | Review | User gate |
|
||||||
|---|---|---|---|---|
|
|---|---|---|---|---|
|
||||||
| R1–R4 research | — | — | — | — |
|
| R1–R4 research | — | — | — | — |
|
||||||
| CH1 colors | — | — | — | — |
|
| CH1 colors | `06f448fc` | 11,833 passed / 4 skipped / 0 failed | — | pending |
|
||||||
| CH2 interface text | — | — | — | — |
|
| CH2 interface text | — | — | — | — |
|
||||||
| CH3 side channels | — | — | — | — |
|
| CH3 side channels | — | — | — | — |
|
||||||
| CH4 commands | — | — | — | — |
|
| CH4 commands | — | — | — | — |
|
||||||
|
|
|
||||||
485
docs/research/2026-08-09-chat-retail-color-table.md
Normal file
485
docs/research/2026-08-09-chat-retail-color-table.md
Normal file
|
|
@ -0,0 +1,485 @@
|
||||||
|
# Retail chat color table — the exact type→color lookup
|
||||||
|
|
||||||
|
**Date:** 2026-08-09
|
||||||
|
**Status:** RESEARCH ONLY — no production code changed.
|
||||||
|
**Primary source:** `docs/research/named-retail/acclient_2013_pseudo_c.txt`
|
||||||
|
(Binary Ninja pseudo-C of the Sept 2013 EoR `acclient.exe`, PDB-named) +
|
||||||
|
direct byte-read of the PDB-paired binary `C:\Users\erikn\Downloads\acclient.exe`
|
||||||
|
(v11.4186, CodeView GUID `9e847e2f-777c-4bd9-886c-22256bb87f32`).
|
||||||
|
**Ghidra MCP:** not reachable this session (ports 8080 and 8081 both refused);
|
||||||
|
everything below comes from the committed static decomp plus the binary itself.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 0. TL;DR
|
||||||
|
|
||||||
|
- The lookup table has **exactly 34 entries**, indices `0x00`–`0x21`.
|
||||||
|
- The index is the **`LogTextType`** value — the same integer that arrives on
|
||||||
|
the wire as ACE's `ChatMessageType`. **There is no remapping anywhere**:
|
||||||
|
the wire byte is passed hand-to-hand from the message handler down to the
|
||||||
|
font-color setter and used as a raw array index.
|
||||||
|
- The table's **default fill is `colorGreen`** (0.5, 1, 0.498). Seven indices
|
||||||
|
are never overwritten and therefore stay green.
|
||||||
|
- The colors are **hard-coded C++ constants**. There is no chat-color option,
|
||||||
|
no registry key, no DAT override. What retail *did* let the player configure
|
||||||
|
is which text types go to which chat *window* (a 64-bit bitfield), not what
|
||||||
|
color they are.
|
||||||
|
- All 13 cdb-dumped RGBA values are confirmed byte-for-byte against the binary,
|
||||||
|
and the one address the 2026-06-16 cdb session missed (`0x81c4d8`) is
|
||||||
|
resolved here.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 1. The builder — `ChatInterface::BuildChatColorLookupTable @ 0x004F31C0`
|
||||||
|
|
||||||
|
Called unconditionally from `ChatInterface::PostInit @ 0x004F3DD0` (call site
|
||||||
|
`0x004F3F13`), once per chat-window construction.
|
||||||
|
|
||||||
|
### 1.1 What it actually does
|
||||||
|
|
||||||
|
```
|
||||||
|
if (m_chatLog == null) return;
|
||||||
|
|
||||||
|
var list = new BaseProperty(name = 0x1B); // the font-color LIST property
|
||||||
|
var color = new BaseProperty(name = 0x19); // one RGBAColor-valued element
|
||||||
|
|
||||||
|
color.SetColor(&colorGreen); // 0x81C578
|
||||||
|
for (i = 0x22; i != 1; i--) // 34 iterations
|
||||||
|
list.Append(color); // → indices 0..0x21 all green
|
||||||
|
|
||||||
|
color.SetColor(&colorWhite); list.SetValue(0x02, color);
|
||||||
|
color.SetColor(&colorGrey); list.SetValue(0x0C, color);
|
||||||
|
color.SetColor(&yellow); list.SetValue(0x03, 0x1F, 0x0A, 0x13);
|
||||||
|
color.SetColor(&darkYellow); list.SetValue(0x04, 0x0B);
|
||||||
|
color.SetColor(&colorPink); list.SetValue(0x08, 0x09);
|
||||||
|
color.SetColor(&orange); list.SetValue(0x12, 0x21);
|
||||||
|
color.SetColor(&colorBlueGrey); list.SetValue(0x1B, 0x1C, 0x1D, 0x1E, 0x20, 0x0E);
|
||||||
|
color.SetColor(&colorDarkRed); list.SetValue(0x0F, 0x06, 0x15);
|
||||||
|
color.SetColor(&colorLightRed); list.SetValue(0x16);
|
||||||
|
color.SetColor(&colorLightBlue); list.SetValue(0x07, 0x11);
|
||||||
|
color.SetColor(&colorCyan); list.SetValue(0x0D);
|
||||||
|
color.SetColor(&colorBrightPurple); list.SetValue(0x05);
|
||||||
|
color.SetColor(&colorBrightRed); list.SetValue(0x1A);
|
||||||
|
|
||||||
|
m_chatLog->SetProperty(list); // 0x004F3799
|
||||||
|
```
|
||||||
|
|
||||||
|
Decoding notes for anyone re-reading the raw pseudo-C:
|
||||||
|
|
||||||
|
- `var_18` is the list property (`SetPropertyName(&var_18, 0x1b)`), `var_10` is
|
||||||
|
the single color property (`SetPropertyName(&var_10, 0x19)`).
|
||||||
|
- vtable slot `+0x9C` on the color property = "set value to this `RGBAColor*`";
|
||||||
|
the argument is a raw `.data` address.
|
||||||
|
- vtable slot `+0xFC` on the list = **Append** (one arg); slot `+0xF8` =
|
||||||
|
**SetValue(index, value)** (two args). This is how you tell the default-fill
|
||||||
|
loop from the per-index overrides.
|
||||||
|
- Loop trip count: `i_1 = 0x22; do { append; i = i_1; i_1--; } while (i != 1);`
|
||||||
|
runs 34 times → indices `0x00`–`0x21`. The highest index the function ever
|
||||||
|
writes is `0x21`. Independent confirmation of the 34-value space is the
|
||||||
|
squelch enumerator at `0x00589DEB`: `for (uint i = 0; i < 0x22; i++)`.
|
||||||
|
- 27 indices are written explicitly; 7 (`0x00, 0x01, 0x10, 0x14, 0x17, 0x18,
|
||||||
|
0x19`) keep the green default.
|
||||||
|
- The function builds property `0x1B` only — the **main font-color list**.
|
||||||
|
It does *not* build property `0x1D`, the *tag* font-color list that
|
||||||
|
`UIElement_Text::SetFontColorHelper` also consults; that one comes from the
|
||||||
|
LayoutDesc.
|
||||||
|
|
||||||
|
### 1.2 The color constants (verified against the binary)
|
||||||
|
|
||||||
|
Read from `.data` (image base `0x400000`, `.data` VA `0x80A000` → raw
|
||||||
|
`0x40A000`). Each is a 16-byte `RGBAColor` = four little-endian floats
|
||||||
|
R, G, B, A. **Every alpha is 1.0.**
|
||||||
|
|
||||||
|
| Address | Symbol | R | G | B | A | ≈8-bit |
|
||||||
|
|---|---|---|---|---|---|---|
|
||||||
|
| `0x0081C4A8` | `colorBrightRed` | 1.0 | 0.0 | 0.0 | 1.0 | `#FF0000` |
|
||||||
|
| `0x0081C4B8` | `colorWhite` | 1.0 | 1.0 | 1.0 | 1.0 | `#FFFFFF` |
|
||||||
|
| `0x0081C4C8` | *(unnamed)* **yellow** | 1.0 | 1.0 | 0.247 | 1.0 | `#FFFF3F` |
|
||||||
|
| `0x0081C4D8` | *(unnamed)* **dark yellow** | 0.824 | 0.824 | 0.392 | 1.0 | `#D2D264` |
|
||||||
|
| `0x0081C4E8` | `colorBrightPurple` | 1.0 | 0.498 | 1.0 | 1.0 | `#FF7FFF` |
|
||||||
|
| `0x0081C4F8` | `colorDarkRed` | 1.0 | 0.247 | 0.247 | 1.0 | `#FF3F3F` |
|
||||||
|
| `0x0081C508` | `colorLightRed` | 0.96 | 0.459 | 0.447 | 1.0 | `#F57572` |
|
||||||
|
| `0x0081C518` | `colorLightBlue` | 0.247 | 0.749 | 1.0 | 1.0 | `#3FBFFF` |
|
||||||
|
| `0x0081C528` | `colorPink` | 1.0 | 0.588 | 0.588 | 1.0 | `#FF9696` |
|
||||||
|
| `0x0081C538` | `colorCyan` | 0.247 | 0.863 | 0.863 | 1.0 | `#3FDCDC` |
|
||||||
|
| `0x0081C548` | `colorBlueGrey` | 0.706 | 0.863 | 0.941 | 1.0 | `#B4DCF0` |
|
||||||
|
| `0x0081C558` | `colorGrey` | 0.824 | 0.824 | 0.784 | 1.0 | `#D2D2C8` |
|
||||||
|
| `0x0081C568` | *(unnamed)* **orange** | 0.933 | 0.573 | 0.118 | 1.0 | `#EE921E` |
|
||||||
|
| `0x0081C578` | `colorGreen` | 0.5 | 1.0 | 0.498 | 1.0 | `#80FF7F` |
|
||||||
|
|
||||||
|
**`0x0081C4D8` is new** — the 2026-06-16 cdb session skipped it, and it is
|
||||||
|
used by two table slots (`0x04` Speech_Direct_Send and `0x0B` Social_Send).
|
||||||
|
Its exact bytes are `aa f1 52 3f aa f1 52 3f 39 b4 c8 3e 00 00 80 3f`;
|
||||||
|
`0.8235294` and `0.39215687` are exactly 210/255 and 100/255, so retail
|
||||||
|
authored it as RGB(210, 210, 100). Adjacent entries not used by the chat
|
||||||
|
table: `0x0081C588` = white again, `0x0081C598` = black.
|
||||||
|
|
||||||
|
Ship the **float** values, not the 8-bit approximations — several
|
||||||
|
(`colorLightRed`, `orange`) are not integral /255 and were authored as
|
||||||
|
decimal floats.
|
||||||
|
|
||||||
|
**Provenance rule:** these 14 addresses appear in the whole 66 MB pseudo-C
|
||||||
|
dump exactly 14 times, and every one of those occurrences is inside
|
||||||
|
`BuildChatColorLookupTable`. Nothing else in the client reads or writes them.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 2. The index enum — `LogTextType`
|
||||||
|
|
||||||
|
`docs/research/named-retail/acclient.h` has an `enum eChatTypes`
|
||||||
|
(line 4935) that stops at `eTextTypeTotalNumChannels = 0x19`. **That header
|
||||||
|
enum is stale** — it predates the 2013 build and does not cover the table.
|
||||||
|
The authoritative 2013 names come from
|
||||||
|
`LogTextTypeEnumMapper::LogTextTypeToString @ 0x006AFF90`, which is a literal
|
||||||
|
`switch` over `0x00`–`0x1F` emitting the canonical strings; anything `> 0x1F`
|
||||||
|
(and `0x1A`–`0x1E`, which fall through) returns `"Unknown"`.
|
||||||
|
|
||||||
|
The field name `ChatDisplayInfo::m_ltt` (acclient.h line 40739,
|
||||||
|
written at `0x005CD89A`) is what pins the enum's name: **L**og**T**ext**T**ype.
|
||||||
|
|
||||||
|
### 2.1 The complete table
|
||||||
|
|
||||||
|
| Idx | `LogTextType` name | Color symbol | RGBA (float) | Hex | Source |
|
||||||
|
|---:|---|---|---|---|---|
|
||||||
|
| `0x00` | `Default` | `colorGreen` | 0.5, 1, 0.498, 1 | `#80FF7F` | default fill |
|
||||||
|
| `0x01` | `All` | `colorGreen` | 0.5, 1, 0.498, 1 | `#80FF7F` | default fill |
|
||||||
|
| `0x02` | `Speech` | `colorWhite` | 1, 1, 1, 1 | `#FFFFFF` | explicit |
|
||||||
|
| `0x03` | `Tell` | yellow `0x81C4C8` | 1, 1, 0.247, 1 | `#FFFF3F` | explicit |
|
||||||
|
| `0x04` | `Speech_Direct_Send` | dark yellow `0x81C4D8` | 0.824, 0.824, 0.392, 1 | `#D2D264` | explicit |
|
||||||
|
| `0x05` | `System` | `colorBrightPurple` | 1, 0.498, 1, 1 | `#FF7FFF` | explicit |
|
||||||
|
| `0x06` | `Combat` | `colorDarkRed` | 1, 0.247, 0.247, 1 | `#FF3F3F` | explicit |
|
||||||
|
| `0x07` | `Magic` | `colorLightBlue` | 0.247, 0.749, 1, 1 | `#3FBFFF` | explicit |
|
||||||
|
| `0x08` | `Channel` | `colorPink` | 1, 0.588, 0.588, 1 | `#FF9696` | explicit |
|
||||||
|
| `0x09` | `Channel_Send` | `colorPink` | 1, 0.588, 0.588, 1 | `#FF9696` | explicit |
|
||||||
|
| `0x0A` | `Social` | yellow `0x81C4C8` | 1, 1, 0.247, 1 | `#FFFF3F` | explicit |
|
||||||
|
| `0x0B` | `Social_Send` | dark yellow `0x81C4D8` | 0.824, 0.824, 0.392, 1 | `#D2D264` | explicit |
|
||||||
|
| `0x0C` | `Emote` | `colorGrey` | 0.824, 0.824, 0.784, 1 | `#D2D2C8` | explicit |
|
||||||
|
| `0x0D` | `Advancement` | `colorCyan` | 0.247, 0.863, 0.863, 1 | `#3FDCDC` | explicit |
|
||||||
|
| `0x0E` | `Abuse` | `colorBlueGrey` | 0.706, 0.863, 0.941, 1 | `#B4DCF0` | explicit |
|
||||||
|
| `0x0F` | `Help` | `colorDarkRed` | 1, 0.247, 0.247, 1 | `#FF3F3F` | explicit |
|
||||||
|
| `0x10` | `Appraisal` | `colorGreen` | 0.5, 1, 0.498, 1 | `#80FF7F` | default fill |
|
||||||
|
| `0x11` | `Spellcasting` | `colorLightBlue` | 0.247, 0.749, 1, 1 | `#3FBFFF` | explicit |
|
||||||
|
| `0x12` | `Allegiance` | orange `0x81C568` | 0.933, 0.573, 0.118, 1 | `#EE921E` | explicit |
|
||||||
|
| `0x13` | `Fellowship` | yellow `0x81C4C8` | 1, 1, 0.247, 1 | `#FFFF3F` | explicit |
|
||||||
|
| `0x14` | `World_Broadcast` | `colorGreen` | 0.5, 1, 0.498, 1 | `#80FF7F` | default fill |
|
||||||
|
| `0x15` | `Combat_Enemy` | `colorDarkRed` | 1, 0.247, 0.247, 1 | `#FF3F3F` | explicit |
|
||||||
|
| `0x16` | `Combat_Self` | `colorLightRed` | 0.96, 0.459, 0.447, 1 | `#F57572` | explicit |
|
||||||
|
| `0x17` | `Recall` | `colorGreen` | 0.5, 1, 0.498, 1 | `#80FF7F` | default fill |
|
||||||
|
| `0x18` | `Craft` | `colorGreen` | 0.5, 1, 0.498, 1 | `#80FF7F` | default fill |
|
||||||
|
| `0x19` | `Salvaging` | `colorGreen` | 0.5, 1, 0.498, 1 | `#80FF7F` | default fill |
|
||||||
|
| `0x1A` | *(no string; "Unknown")* — **client-local text** | `colorBrightRed` | 1, 0, 0, 1 | `#FF0000` | explicit |
|
||||||
|
| `0x1B` | *(no string)* — **Turbine General** | `colorBlueGrey` | 0.706, 0.863, 0.941, 1 | `#B4DCF0` | explicit |
|
||||||
|
| `0x1C` | *(no string)* — **Turbine Trade** | `colorBlueGrey` | 0.706, 0.863, 0.941, 1 | `#B4DCF0` | explicit |
|
||||||
|
| `0x1D` | *(no string)* — **Turbine LFG** | `colorBlueGrey` | 0.706, 0.863, 0.941, 1 | `#B4DCF0` | explicit |
|
||||||
|
| `0x1E` | *(no string)* — **Turbine Roleplay** | `colorBlueGrey` | 0.706, 0.863, 0.941, 1 | `#B4DCF0` | explicit |
|
||||||
|
| `0x1F` | `Admin_Tell` | yellow `0x81C4C8` | 1, 1, 0.247, 1 | `#FFFF3F` | explicit |
|
||||||
|
| `0x20` | *(no string)* — **Turbine Society** (all 4 rooms) | `colorBlueGrey` | 0.706, 0.863, 0.941, 1 | `#B4DCF0` | explicit |
|
||||||
|
| `0x21` | *(no string; no producer found)* | orange `0x81C568` | 0.933, 0.573, 0.118, 1 | `#EE921E` | explicit |
|
||||||
|
|
||||||
|
### 2.2 Notes on the unnamed slots
|
||||||
|
|
||||||
|
- **`0x1A`** is not dead. `LogTextTypeToString` has no name for it, but it is
|
||||||
|
the single most-used literal in the client: **client-local text that never
|
||||||
|
reaches the wire** — `"You need an open vendor."`, the three
|
||||||
|
`cant_jump_*` strings, most command-parser errors. It also has a special
|
||||||
|
path in `AddTextToScroll` (§3.2): type `0x1A` skips the timestamp prefix
|
||||||
|
**and** skips the chat log file. Color: bright red.
|
||||||
|
- **`0x1B`–`0x1E`, `0x20`** are the Turbine (global community) chat rooms.
|
||||||
|
Their identity is not guesswork — `ChatRoomTracker::GetChatFormat @
|
||||||
|
0x005CD7C0` writes `ChatDisplayInfo::m_ltt` directly:
|
||||||
|
|
||||||
|
| room field | `m_ltt` |
|
||||||
|
|---|---|
|
||||||
|
| `m_allegianceRoomID` | `0x12` (Allegiance) |
|
||||||
|
| `mGeneralChatRoomID` | `0x1B` |
|
||||||
|
| `mTradeChatRoomID` | `0x1C` |
|
||||||
|
| `mLFGChatRoomID` | `0x1D` |
|
||||||
|
| `mRoleplayChatRoomID` | `0x1E` |
|
||||||
|
| `mOlthoiChatRoomID` | `0x12` (reuses Allegiance) |
|
||||||
|
| `mSocietyChatRoomID`, `mSocietyCelHanChatRoomID`, `mSocietyEldWebChatRoomID`, `mSocietyRadBloChatRoomID` | `0x20` |
|
||||||
|
|
||||||
|
This is why ACE's `ChatMessageType.cs` labels `0x1B`/`0x1E` "light cyan,
|
||||||
|
unknown purpose" — they are the Turbine rooms, and `colorBlueGrey` is
|
||||||
|
exactly that sky-blue.
|
||||||
|
- **`0x21`** has a color slot and a filter bit but **no producer anywhere in
|
||||||
|
the 2013 client**: `LogTextTypeToString` returns `"Unknown"`,
|
||||||
|
`IsLegalChannel` returns 0, no `AddTextToScroll` / `m_ltt` site emits it.
|
||||||
|
Treat it as reserved. Its orange matches `0x12` Allegiance, which hints at
|
||||||
|
an allegiance-adjacent type that was never shipped (or was server-only).
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 3. Consumption trace — wire byte → pixel color
|
||||||
|
|
||||||
|
### 3.1 The chain
|
||||||
|
|
||||||
|
```
|
||||||
|
<inbound game message>
|
||||||
|
└─ ClientCommunicationSystem::Handle_Communication__* (type comes off the wire)
|
||||||
|
└─ ClientSystem::AddTextToScroll(text, type, fireToPlugin, windowId) @0x00563C50
|
||||||
|
└─ ECM_UI::SendNotice_DisplayFinalStringInfo(type, body, prefix, windowId) @0x00692550
|
||||||
|
└─ ChatInterface::RecvNotice_DisplayFinalStringInfo(type, body, prefix, windowId) @0x004F4640
|
||||||
|
├─ AppendStringInfoWithFont(m_chatLog, prefix, font=0, colorIdx=0x0C) ← timestamp, ALWAYS grey
|
||||||
|
└─ AppendStringInfoWithFont(m_chatLog, body, font=0, colorIdx=type)
|
||||||
|
└─ UIElement_Text::SetFontColorHelper(this, prop 0x1B, &m_curFontColor, type) @0x00466AC0
|
||||||
|
└─ list.GetValue(type) → m_curFontColor
|
||||||
|
```
|
||||||
|
|
||||||
|
`type` is never transformed. It is the wire value, used as the array index.
|
||||||
|
|
||||||
|
### 3.2 Two details worth porting
|
||||||
|
|
||||||
|
**Timestamp prefix is hard-coded to index `0x0C`.** In
|
||||||
|
`RecvNotice_DisplayFinalStringInfo @0x004F46E9` the second `StringInfo` (the
|
||||||
|
`"%#H:%M:%S "` prefix built in `AddTextToScroll` when
|
||||||
|
`PlayerModule::DisplayTimeStamps()` is on) is appended with color index
|
||||||
|
`0x0C` — i.e. `colorGrey`, regardless of the message's own type. Retail's
|
||||||
|
timestamps are always grey.
|
||||||
|
|
||||||
|
**Out-of-range index leaves the color alone.** `SetFontColorHelper` reads the
|
||||||
|
list's element count into `arg2`, then `if (arg4 < arg2) { GetValue(arg4) ... }`.
|
||||||
|
If the index is `>= 34`, it falls through without touching `m_curFontColor`,
|
||||||
|
so the run inherits the *previous* line's color. It does **not** fall back to
|
||||||
|
a default. (The green default only applies to the seven in-range slots the
|
||||||
|
builder never overwrites.)
|
||||||
|
|
||||||
|
**Type `0x1A` bypasses the timestamp and the log file.** `AddTextToScroll`
|
||||||
|
branches on `arg3 == 0x1a` at `0x00563DE6`; the non-`0x1A` path is the one
|
||||||
|
that formats the timestamp and `fprintf`s to `ClientSystem::s_pLogFile`.
|
||||||
|
|
||||||
|
### 3.3 Wire → type for the message kinds you asked about
|
||||||
|
|
||||||
|
Anchors are the `ClientCommunicationSystem::Handle_Communication__*` handlers.
|
||||||
|
|
||||||
|
| Inbound kind | Opcode (ACE) | Handler | Type passed |
|
||||||
|
|---|---|---|---|
|
||||||
|
| Local speech | `0x02BB` | `Handle_Communication__HearSpeech @0x005712A0` | **`arg5` verbatim from the wire** (`AddTextToScroll(..., arg5, ...)` at `0x0057154D` for "X says", `0x00571325` for the "You say" self-echo) |
|
||||||
|
| Ranged speech | `0x02BC` | `Handle_Communication__HearRangedSpeech @0x0056E550` → `gmCCommunicationSystem::HandleRangedTalkEvent @0x00589F60` | wire type (`arg6`) |
|
||||||
|
| Tell | `0x02BD` | `Handle_Communication__HearDirectSpeech @0x005715A0` | **`arg6` verbatim** (`AddTextToScroll(..., arg6, ...)` at `0x005718D8` / `0x00571834` / `0x0057160C`) |
|
||||||
|
| Emote / soul emote | `0x01E0` / `0x01E2` | `Handle_Communication__HearEmote @0x0057CBE0` (soul emote tail-calls it) | **hard-coded `0x0C`** at `0x0057CF94` |
|
||||||
|
| Legacy channel speech | `0x0147` `ChannelBroadcast` | `Handle_Communication__ChannelBroadcast @0x00570B90` | derived from the channel bit — see below |
|
||||||
|
| Turbine room speech | `0xF7DE` | `ChatRoomTracker::GetChatFormat @0x005CD7C0` → `m_ltt` | `0x12` / `0x1B`–`0x1E` / `0x20` — table in §2.2 |
|
||||||
|
| Server message / system | `0xF7E0` | dispatched through `RecvNotice_DisplayStringInfo @0x0056E890` | **wire type verbatim** |
|
||||||
|
| Client-local errors, command output | *(none)* | many sites | `0x1A` (or `0x00` for informational command output) |
|
||||||
|
| Combat / magic / advancement / recall / craft / salvage / appraisal | `0xF7E0` and friends | server-chosen | wire type verbatim — `0x06`/`0x15`/`0x16`, `0x07`/`0x11`, `0x0D`, `0x17`, `0x18`, `0x19`, `0x10` |
|
||||||
|
| Death messages | `0x019E` etc. | server-chosen | wire type verbatim (retail carries no special client-side death color) |
|
||||||
|
|
||||||
|
`Handle_Communication__ChannelBroadcast` channel-bit → type (the `m_buffer_5`
|
||||||
|
variable feeding `AddTextToScroll` at `0x00571169`):
|
||||||
|
|
||||||
|
| Channel bit | Prefix retail prints | Type |
|
||||||
|
|---|---|---|
|
||||||
|
| `0x0800` Fellowship | `[Fellowship]` | `0x13` |
|
||||||
|
| `0x1000` Patron / `0x2000` Vassal | `Your patron …` / `Your vassal …` | `0x0A` |
|
||||||
|
| `0x4000` Follower/Monarch | `Your follower …` | `0x0A` (hear) / `0x0B` (own send) |
|
||||||
|
| `0x1000000` Co-Vassals | `[Co-Vassals]` | `0x0A` |
|
||||||
|
| `0x2000000` Allegiance Broadcast | `[Allegiance Broadcast]` | `0x0A` |
|
||||||
|
| `0x4000000` | — | `0x13` |
|
||||||
|
| admin/audit/sentinel channels | `[<name>]` | `0x0E` / `0x0F` |
|
||||||
|
|
||||||
|
Note the split that surprises people: **legacy allegiance-family chat arrives
|
||||||
|
as `Social` (`0x0A`, yellow) / `Social_Send` (`0x0B`, dark yellow)**, while
|
||||||
|
`Allegiance` (`0x12`, orange) is reserved for the *Turbine* allegiance room.
|
||||||
|
|
||||||
|
### 3.4 The plugin hook sees the same integer
|
||||||
|
|
||||||
|
`AddTextToScroll` calls `IACPlugin::OnChatWindowText(bstr, type, &suppress)`
|
||||||
|
at `0x00563CA4` **before** any formatting, and a plugin returning
|
||||||
|
`suppress != 0` drops the line entirely. Relevant if acdream's plugin chat
|
||||||
|
API wants retail parity: the plugin contract is `(text, LogTextType, out
|
||||||
|
bool eaten)`.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 4. Configurability — colors are NOT user-settable; filters are
|
||||||
|
|
||||||
|
**Colors: hard-coded, no override path.**
|
||||||
|
|
||||||
|
1. The 14 `RGBAColor` addresses are referenced from exactly one function in
|
||||||
|
the entire binary (§1.2).
|
||||||
|
2. `BuildChatColorLookupTable` runs unconditionally at `PostInit` and ends with
|
||||||
|
`m_chatLog->SetProperty(list)`, which **replaces** property `0x1B` wholesale
|
||||||
|
— so even a LayoutDesc that authored a color list would be overwritten.
|
||||||
|
3. `ChatInterface::RecvNotice_GameplayOptionChanged @0x004F30E0` and
|
||||||
|
`ChatInterface::OnSetAttribute @0x004F3F60` handle only the window's text-type
|
||||||
|
filter and the two opacity values. Neither touches color.
|
||||||
|
|
||||||
|
Conclusion: **the table above is the shipped behavior, not a default.**
|
||||||
|
There is nothing for acdream to make configurable for retail parity.
|
||||||
|
|
||||||
|
**Filters: genuinely user-settable, per window.**
|
||||||
|
|
||||||
|
`ChatInterface::UpdateFromPlayerModule @0x004F3920` reads
|
||||||
|
`PlayerModule::InqChatWindowOption(windowId, 0x1000007F, …)` into a 64-bit
|
||||||
|
`m_llTextTypeFilter`, and `RecvNotice_GameplayOptionChanged` live-updates it
|
||||||
|
when the option changes. `ChatInterface::TypeIsActive @0x004F2F10` tests
|
||||||
|
`(1ULL << type) & m_llTextTypeFilter`. Two consequences:
|
||||||
|
|
||||||
|
- `UpdateFromPlayerModule` early-returns when `m_eWindowID == 0`, so the
|
||||||
|
**main window has no user filter** — it keeps the `PostInit` default.
|
||||||
|
- `RecvNotice_DisplayFinalStringInfo` displays when
|
||||||
|
`windowId == m_eWindowID` (explicitly addressed — e.g. command output uses
|
||||||
|
`m_idCurrentCommandSource`) **or** `windowId == 0 && TypeIsActive(type)`
|
||||||
|
(broadcast).
|
||||||
|
|
||||||
|
`PostInit` default filters (`0x004F3DF9` switch on `m_oldState`; Binary Ninja
|
||||||
|
mis-attributes the low dword to `m_chatNewNonVisibleTextIndicator` — it is the
|
||||||
|
low half of the 64-bit filter, and the following `m_llTextTypeFilter = 0`
|
||||||
|
is the high half):
|
||||||
|
|
||||||
|
| `m_oldState` | Low dword | Types |
|
||||||
|
|---|---|---|
|
||||||
|
| 1, 8 | `0xFBFFFFFF` | everything `0x00`–`0x1F` except `0x1A` |
|
||||||
|
| 2 | `0x0000101C` | `0x02` Speech, `0x03` Tell, `0x04` Speech_Direct_Send, `0x0C` Emote |
|
||||||
|
| 3 | `0x00040C00` | `0x0A` Social, `0x0B` Social_Send, `0x12` Allegiance |
|
||||||
|
| 4 | `0x00080000` | `0x13` Fellowship |
|
||||||
|
| 5 | `0x78000000` | `0x1B` General, `0x1C` Trade, `0x1D` LFG, `0x1E` Roleplay |
|
||||||
|
|
||||||
|
Every default sets the **high** dword to 0, so `0x20` (Society) and `0x21` are
|
||||||
|
in no window's default filter — Society chat only appears once the player
|
||||||
|
enables it, which matches retail's opt-in Society channel.
|
||||||
|
|
||||||
|
Squelching is a separate axis: `LogTextTypeEnumMapper::IsLegalChannel @
|
||||||
|
0x006AFF40` whitelists exactly `0x02, 0x03, 0x06, 0x07, 0x0C, 0x10, 0x11,
|
||||||
|
0x12, 0x13, 0x15, 0x16, 0x17, 0x18, 0x19` as squelchable.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 5. acdream correction list
|
||||||
|
|
||||||
|
**Current code:**
|
||||||
|
`src/AcDream.App/UI/Layout/ChatWindowController.cs:542`
|
||||||
|
(`RetailChatColor(ChatKind)`), driven from line 462. The `ChatKind` enum is
|
||||||
|
`src/AcDream.Core/Chat/ChatLog.cs:337`. (`ChatChannelKind` in
|
||||||
|
`src/AcDream.UI.Abstractions/ChatChannelKind.cs` is the **outbound** channel
|
||||||
|
selector and never reaches the color path — it needs no color change.)
|
||||||
|
|
||||||
|
### 5.1 Per-arm verdict
|
||||||
|
|
||||||
|
| `ChatKind` | acdream RGBA now | Retail type it represents | Retail RGBA | Verdict |
|
||||||
|
|---|---|---|---|---|
|
||||||
|
| `LocalSpeech` | 1, 1, 1, 1 `colorWhite` | `0x02` Speech | 1, 1, 1, 1 | ✅ **CONFIRMED** |
|
||||||
|
| `RangedSpeech` | 1, 1, 1, 1 `colorWhite` | wire type on `0x02BC`; ACE's own header documents `0x0C` for this opcode | 0.824, 0.824, 0.784, 1 `colorGrey` | ❌ **CHANGE** — must follow the wire type, not a constant |
|
||||||
|
| `Channel` | 0.247, 0.749, 1, 1 `colorLightBlue` | Turbine rooms `0x1B`–`0x1E`/`0x20`; legacy `0x0A`/`0x0B`/`0x13`; Turbine allegiance `0x12` | Turbine rooms 0.706, 0.863, 0.941 `colorBlueGrey`; Social 1, 1, 0.247; Social_Send 0.824, 0.824, 0.392; Fellowship 1, 1, 0.247; Allegiance 0.933, 0.573, 0.118 | ❌ **CHANGE** — `colorLightBlue` is `0x07` Magic / `0x11` Spellcasting, never a channel |
|
||||||
|
| `Tell` | 1, 0.498, 1, 1 `colorBrightPurple` | `0x03` Tell (incoming), `0x04` Speech_Direct_Send (own "You tell …") | incoming 1, 1, 0.247 `yellow`; own send 0.824, 0.824, 0.392 `dark yellow` | ❌ **CHANGE** — `colorBrightPurple` is `0x05` System |
|
||||||
|
| `System` | 0.5, 1, 0.498, 1 `colorGreen` | wire type; ACE `0xF7E0` uses `0x00`, `0x03`, `0x04`, `0x05`, `0x06`, `0x07`, `0x0D`, `0x10`, `0x11`, `0x17`, `0x18` | `0x00` → 0.5, 1, 0.498 (green, matches today); `0x05` → 1, 0.498, 1 (purple) | ❌ **CHANGE** — green is right only for wire type `0x00`; the collapse to one color is the bug |
|
||||||
|
| `Popup` | 0.5, 1, 0.498, 1 `colorGreen` | `0x0004 PopUpString` → `Handle_Communication__PopUpString @0x0057FE80` — a modal dialog, **not** a chat-log line in retail | n/a | ⚪ **OUT OF SCOPE** — no retail color; acdream's choice to render it in chat is an acdream divergence |
|
||||||
|
| `Emote` | 0.824, 0.824, 0.784, 1 `colorGrey` | `0x0C` Emote (hard-coded by `HearEmote`) | 0.824, 0.824, 0.784, 1 | ✅ **CONFIRMED** |
|
||||||
|
| `SoulEmote` | 0.824, 0.824, 0.784, 1 `colorGrey` | `0x0C` — `HearSoulEmote` tail-calls `HearEmote` at `0x0057D096` | 0.824, 0.824, 0.784, 1 | ✅ **CONFIRMED** |
|
||||||
|
| `Combat` | 0.96, 0.459, 0.447, 1 `colorLightRed` | `0x06` Combat, `0x15` Combat_Enemy, `0x16` Combat_Self | `0x06`/`0x15` → 1, 0.247, 0.247 `colorDarkRed`; `0x16` → 0.96, 0.459, 0.447 `colorLightRed` | ❌ **CHANGE** — today's value is correct only for `Combat_Self` |
|
||||||
|
| `_` fallback | 0.824, 0.824, 0.784, 1 `colorGrey` | unassigned in-range slots | 0.5, 1, 0.498, 1 `colorGreen` | ❌ **CHANGE** — retail's unset default is green; out-of-range indices keep the *previous* line's color |
|
||||||
|
|
||||||
|
**Score: 3 confirmed, 6 changed, 1 out of scope.**
|
||||||
|
|
||||||
|
### 5.2 The structural correction
|
||||||
|
|
||||||
|
Every "CHANGE" above has the same root cause: acdream colors by a **synthetic
|
||||||
|
9-value `ChatKind`**, while retail colors by the **34-value wire
|
||||||
|
`LogTextType`**. Keeping `ChatKind` for routing/formatting is fine, but the
|
||||||
|
color must key off the wire integer.
|
||||||
|
|
||||||
|
The wire value is already parsed and already in hand — no new parsing needed:
|
||||||
|
|
||||||
|
- `HearSpeech.Parsed.ChatType` (`src/AcDream.Core.Net/Messages/HearSpeech.cs:64`)
|
||||||
|
— parsed today and **discarded** at the `OnLocalSpeech` call site
|
||||||
|
(`src/AcDream.Runtime/Session/LiveSessionEventRouter.cs:260`).
|
||||||
|
- `ServerMessage.Parsed.ChatType` (`src/AcDream.Core.Net/Messages/ServerMessage.cs:33`)
|
||||||
|
— already threaded through as
|
||||||
|
`social.Chat.OnSystemMessage(message.Message, message.ChatType)`
|
||||||
|
(`LiveSessionEventRouter.cs:268`), where `ChatLog.OnSystemMessage` parks it
|
||||||
|
in `ChatEntry.ChannelId`. It is available; it just is not used for color.
|
||||||
|
- `TurbineChat.ChatType` — available at
|
||||||
|
`LiveSessionEventRouter.RouteTurbineChat` (line 484), already used for the
|
||||||
|
display name via `TurbineChatDisplayNames.Resolve`.
|
||||||
|
- `GameEvents` tell/emote payloads (`src/AcDream.Core.Net/Messages/GameEvents.cs:53`)
|
||||||
|
carry `ChatType` too.
|
||||||
|
|
||||||
|
The retail-faithful shape is a 34-entry `Vector4[]` built once (exactly as
|
||||||
|
`BuildChatColorLookupTable` does), indexed by the wire type, with
|
||||||
|
"index ≥ 34 → keep the previous run's color". Several call sites that
|
||||||
|
currently pass a made-up type would need the real one:
|
||||||
|
`ChatLog.OnSystemMessage(text, 0x1Au)` appears at five App composition sites
|
||||||
|
and `chatType: 0u` at three `GameEventWiring` sites — those are placeholders,
|
||||||
|
and `0x1A` happens to be the *correct* retail type for client-local text
|
||||||
|
(bright red), so those five are already right by accident.
|
||||||
|
|
||||||
|
### 5.3 Coverage gap
|
||||||
|
|
||||||
|
acdream has no representation at all for 22 of the 34 retail types:
|
||||||
|
`All`(0x01), `Speech_Direct_Send`(0x04), `Channel`(0x08), `Channel_Send`(0x09),
|
||||||
|
`Social`(0x0A), `Social_Send`(0x0B), `Advancement`(0x0D), `Abuse`(0x0E),
|
||||||
|
`Help`(0x0F), `Appraisal`(0x10), `Spellcasting`(0x11), `Allegiance`(0x12),
|
||||||
|
`Fellowship`(0x13), `World_Broadcast`(0x14), `Combat_Enemy`(0x15),
|
||||||
|
`Combat_Self`(0x16), `Recall`(0x17), `Craft`(0x18), `Salvaging`(0x19),
|
||||||
|
`Admin_Tell`(0x1F), Turbine `0x1B`–`0x1E`/`0x20`, and reserved `0x21`.
|
||||||
|
A table keyed by the wire integer closes all of them at once.
|
||||||
|
|
||||||
|
### 5.4 Two documentation defects found in passing
|
||||||
|
|
||||||
|
1. **`src/AcDream.Core.Net/Messages/HearSpeech.cs:39-48`** — the `ChatType`
|
||||||
|
legend in the XML doc comment is wrong on 4 of 6 entries. It claims
|
||||||
|
`0x02 = Combat`, `0x0B = Speech`, `0x0F = Emote`, `0x10 = Tell`. Retail:
|
||||||
|
`0x02 = Speech`, `0x0B = Social_Send`, `0x0F = Help`, `0x10 = Appraisal`,
|
||||||
|
`0x03 = Tell`, `0x0C = Emote`. Only `0x01` (Broadcast/AllChannels — retail
|
||||||
|
calls it `All`) and `0x11` (Spellcasting, the comment's "Syllables") are
|
||||||
|
close.
|
||||||
|
2. **`ChatWindowController.cs:536-541`** — the doc comment asserts "the four
|
||||||
|
common kinds (speech/tell/channel/system) are confirmed by the named
|
||||||
|
symbols". Speech is confirmed; tell, channel and system are all wrong.
|
||||||
|
That sentence should be deleted along with the fix.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 6. Cross-check against ACE
|
||||||
|
|
||||||
|
`references/ACE/Source/ACE.Entity/Enum/ChatMessageType.cs` is the same index
|
||||||
|
space (its `LogTextTypeEnumMapper:` doc lines are literally the strings from
|
||||||
|
`LogTextTypeToString`), and its informal color notes independently corroborate
|
||||||
|
the decompiled table on every entry it comments:
|
||||||
|
|
||||||
|
| ACE note | Retail table | Agrees? |
|
||||||
|
|---|---|---|
|
||||||
|
| `0x08` Channel "Light Pink Text" | `colorPink` | ✅ |
|
||||||
|
| `0x0A` Social "Bright Yellow Text" | yellow `#FFFF3F` | ✅ |
|
||||||
|
| `0x0B` Social_Send "Light Yellow Text" | dark yellow `#D2D264` | ✅ |
|
||||||
|
| `0x0E` Abuse "Light Cyan (skyblue?)" | `colorBlueGrey` | ✅ |
|
||||||
|
| `0x0F` Help "Red Text" | `colorDarkRed` | ✅ |
|
||||||
|
| `0x13` Fellowship "Bright Yellow Text" | yellow | ✅ |
|
||||||
|
| `0x14` WorldBroadcast "Green Text" | `colorGreen` (default fill) | ✅ |
|
||||||
|
| `0x15` CombatEnemy "Red Text" | `colorDarkRed` | ✅ |
|
||||||
|
| `0x16` CombatSelf "Pink Text" | `colorLightRed` (salmon) | ✅ |
|
||||||
|
| `0x19` Salvaging "Green Text" | `colorGreen` (default fill) | ✅ |
|
||||||
|
| `0x1B`, `0x1E` "Light cyan (sky blue)" | `colorBlueGrey` | ✅ |
|
||||||
|
| `0x1F` AdminTell "Bright Yellow Text" | yellow | ✅ |
|
||||||
|
|
||||||
|
ACE stops at `0x1F` and comments `0x1A` out as "client doesn't display it" —
|
||||||
|
both are ACE gaps, not retail behavior: retail has 34 slots and `0x1A` is its
|
||||||
|
busiest client-local type.
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
## 7. Reproduction commands
|
||||||
|
|
||||||
|
```bash
|
||||||
|
# The builder
|
||||||
|
grep -n "BuildChatColorLookupTable" docs/research/named-retail/acclient_2013_pseudo_c.txt
|
||||||
|
sed -n '246117,246440p' docs/research/named-retail/acclient_2013_pseudo_c.txt
|
||||||
|
|
||||||
|
# The 2013 type names
|
||||||
|
sed -n '695462,695790p' docs/research/named-retail/acclient_2013_pseudo_c.txt # LogTextTypeToString
|
||||||
|
sed -n '695397,695425p' docs/research/named-retail/acclient_2013_pseudo_c.txt # IsLegalChannel
|
||||||
|
|
||||||
|
# Turbine room -> m_ltt
|
||||||
|
sed -n '479725,479870p' docs/research/named-retail/acclient_2013_pseudo_c.txt
|
||||||
|
|
||||||
|
# Consumption
|
||||||
|
sed -n '247282,247330p' docs/research/named-retail/acclient_2013_pseudo_c.txt # RecvNotice_DisplayFinalStringInfo
|
||||||
|
sed -n '113699,113760p' docs/research/named-retail/acclient_2013_pseudo_c.txt # SetFontColorHelper
|
||||||
|
sed -n '368347,368520p' docs/research/named-retail/acclient_2013_pseudo_c.txt # AddTextToScroll
|
||||||
|
```
|
||||||
|
|
||||||
|
The RGBA quads were read straight out of the PDB-paired binary by walking the
|
||||||
|
PE section table (`.data` VA `0x80A000` → raw `0x40A000`) and unpacking
|
||||||
|
`<4f` at each 16-byte stride from `0x0081C4A8`. Re-run
|
||||||
|
`py tools/pdb-extract/check_exe_pdb.py "C:/Users/erikn/Downloads/acclient.exe"`
|
||||||
|
first — it must report `MATCH` before any address in this document is valid.
|
||||||
|
|
@ -240,7 +240,11 @@ internal sealed class LiveSessionCommandRouter : ILiveSessionCommandRouting
|
||||||
bindings.Chat.OnSelfSent(
|
bindings.Chat.OnSelfSent(
|
||||||
ChatKind.Tell,
|
ChatKind.Tell,
|
||||||
command.Text,
|
command.Text,
|
||||||
targetOrChannel: command.TargetName);
|
targetOrChannel: command.TargetName,
|
||||||
|
// Retail's own "You tell ..." echo is Speech_Direct_Send
|
||||||
|
// (0x04), distinct from an incoming Tell's 0x03 — see
|
||||||
|
// ChatMessageType.OutgoingTell's "You tell ..." comment.
|
||||||
|
logTextType: 0x04u);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -283,7 +287,11 @@ internal sealed class LiveSessionCommandRouter : ILiveSessionCommandRouting
|
||||||
bindings.Chat.OnSelfSent(
|
bindings.Chat.OnSelfSent(
|
||||||
ChatKind.Channel,
|
ChatKind.Channel,
|
||||||
command.Text,
|
command.Text,
|
||||||
targetOrChannel: legacy.Value.DisplayName);
|
targetOrChannel: legacy.Value.DisplayName,
|
||||||
|
// Precise per-bit own-send type (LegacyChannelChatType.Resolve's
|
||||||
|
// ownSend:true branch) — e.g. Fellowship keeps 0x13, Patron/
|
||||||
|
// Vassal/Follower become 0x0B, the admin catch-all stays 0x0E.
|
||||||
|
logTextType: LegacyChannelChatType.Resolve(legacy.Value.ChannelId, ownSend: true));
|
||||||
}
|
}
|
||||||
|
|
||||||
private ClientCommandController.Bindings BuildGuardedClientCommands(
|
private ClientCommandController.Bindings BuildGuardedClientCommands(
|
||||||
|
|
|
||||||
|
|
@ -327,8 +327,10 @@ internal sealed class LiveSessionRuntimeFactory
|
||||||
ToggleUiLock: () =>
|
ToggleUiLock: () =>
|
||||||
_interaction.Settings.SetUiLocked(
|
_interaction.Settings.SetUiLocked(
|
||||||
!_interaction.Settings.Gameplay.LockUI),
|
!_interaction.Settings.Gameplay.LockUI),
|
||||||
|
// Client-local text (never reaches the wire), 0x1A — same
|
||||||
|
// category as ChatVM.ShowSystemMessage.
|
||||||
ShowSystemMessage:
|
ShowSystemMessage:
|
||||||
text => _domain.Communication.Chat.OnSystemMessage(text, 0u),
|
text => _domain.Communication.Chat.OnSystemMessage(text, 0x1Au),
|
||||||
ShowWeenieError:
|
ShowWeenieError:
|
||||||
code => _domain.Communication.Chat.OnWeenieError(code, null),
|
code => _domain.Communication.Chat.OnWeenieError(code, null),
|
||||||
PlayerPublicWeenieBitfield: () =>
|
PlayerPublicWeenieBitfield: () =>
|
||||||
|
|
|
||||||
|
|
@ -423,8 +423,9 @@ public sealed class ChatWindowController : IRetainedWindowStateController, IReta
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Convert the ChatVM's detailed lines to the transcript's
|
/// Convert the ChatVM's detailed lines to the transcript's
|
||||||
/// <see cref="UiText.Line"/> record format, applying retail-faithful
|
/// <see cref="UiText.Line"/> record format, applying retail's exact
|
||||||
/// per-<see cref="ChatKind"/> colors.
|
/// <see cref="RetailChatColorTable"/> colors keyed by each entry's
|
||||||
|
/// <see cref="ChatEntry.LogTextType"/> (NOT <see cref="ChatKind"/>).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
private IReadOnlyList<UiText.Line> GetTranscriptLines(ChatVM vm)
|
private IReadOnlyList<UiText.Line> GetTranscriptLines(ChatVM vm)
|
||||||
{
|
{
|
||||||
|
|
@ -456,12 +457,19 @@ public sealed class ChatWindowController : IRetainedWindowStateController, IReta
|
||||||
: debugFont is { } bf ? s => bf.MeasureWidth(s)
|
: debugFont is { } bf ? s => bf.MeasureWidth(s)
|
||||||
: static s => s.Length * 7f;
|
: static s => s.Length * 7f;
|
||||||
|
|
||||||
|
// Retail's font-color state (m_curFontColor) persists across every
|
||||||
|
// appended line — an out-of-range LogTextType leaves it unchanged
|
||||||
|
// rather than reverting to a default (research doc §3.2). Seed the
|
||||||
|
// carry with retail's own unfilled-slot default (colorGreen, index
|
||||||
|
// 0x00) and fold forward across the transcript in order.
|
||||||
|
RetailChatColorTable.TryGetColor(0x00u, out Vector4 currentColor);
|
||||||
var result = new List<UiText.Line>(detailed.Count);
|
var result = new List<UiText.Line>(detailed.Count);
|
||||||
foreach (var d in detailed)
|
foreach (var d in detailed)
|
||||||
{
|
{
|
||||||
var color = RetailChatColor(d.Kind);
|
if (RetailChatColorTable.TryGetColor(d.LogTextType, out Vector4 resolved))
|
||||||
|
currentColor = resolved;
|
||||||
foreach (var frag in WrapText(d.Text, maxW, measure))
|
foreach (var frag in WrapText(d.Text, maxW, measure))
|
||||||
result.Add(new UiText.Line(frag, color));
|
result.Add(new UiText.Line(frag, currentColor));
|
||||||
}
|
}
|
||||||
return StoreTranscriptLayout(result, revision, maxW, datFont, debugFont);
|
return StoreTranscriptLayout(result, revision, maxW, datFont, debugFont);
|
||||||
}
|
}
|
||||||
|
|
@ -531,28 +539,6 @@ public sealed class ChatWindowController : IRetainedWindowStateController, IReta
|
||||||
if (line.Length > 0) yield return line.ToString();
|
if (line.Length > 0) yield return line.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Per-<see cref="ChatKind"/> text color — the EXACT retail RGBA values read from a
|
|
||||||
/// live retail client via cdb (the named <c>RGBAColor</c> constants at acclient
|
|
||||||
/// 0x81c4a8+, e.g. <c>colorWhite</c>/<c>colorBrightPurple</c>/<c>colorLightBlue</c>/
|
|
||||||
/// <c>colorGreen</c>, used by <c>ChatInterface::BuildChatColorLookupTable @0x4f31c0</c>).
|
|
||||||
/// The four common kinds (speech/tell/channel/system) are confirmed by the named
|
|
||||||
/// symbols + universal AC convention; the rarer kinds map to the nearest named color.
|
|
||||||
/// </summary>
|
|
||||||
private static Vector4 RetailChatColor(ChatKind kind) => kind switch
|
|
||||||
{
|
|
||||||
ChatKind.LocalSpeech => new(1f, 1f, 1f, 1f), // colorWhite
|
|
||||||
ChatKind.RangedSpeech => new(1f, 1f, 1f, 1f), // colorWhite (shout)
|
|
||||||
ChatKind.Channel => new(0.247f, 0.749f, 1f, 1f), // colorLightBlue
|
|
||||||
ChatKind.Tell => new(1f, 0.498f, 1f, 1f), // colorBrightPurple
|
|
||||||
ChatKind.System => new(0.5f, 1f, 0.498f, 1f), // colorGreen
|
|
||||||
ChatKind.Popup => new(0.5f, 1f, 0.498f, 1f), // colorGreen (server broadcast)
|
|
||||||
ChatKind.Emote => new(0.824f, 0.824f, 0.784f, 1f), // colorGrey
|
|
||||||
ChatKind.SoulEmote => new(0.824f, 0.824f, 0.784f, 1f), // colorGrey
|
|
||||||
ChatKind.Combat => new(0.96f, 0.459f, 0.447f, 1f), // colorLightRed
|
|
||||||
_ => new(0.824f, 0.824f, 0.784f, 1f), // colorGrey (fallback)
|
|
||||||
};
|
|
||||||
|
|
||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
if (_disposed) return;
|
if (_disposed) return;
|
||||||
|
|
|
||||||
|
|
@ -102,21 +102,28 @@ public static class GameEventWiring
|
||||||
registrar.Register(GameEventType.ChannelBroadcast, e =>
|
registrar.Register(GameEventType.ChannelBroadcast, e =>
|
||||||
{
|
{
|
||||||
var p = GameEvents.ParseChannelBroadcast(e.Payload.Span);
|
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);
|
if (p is not null) chat.OnChannelBroadcast(p.Value.ChannelId, p.Value.SenderName, p.Value.Message);
|
||||||
});
|
});
|
||||||
registrar.Register(GameEventType.Tell, e =>
|
registrar.Register(GameEventType.Tell, e =>
|
||||||
{
|
{
|
||||||
var p = GameEvents.ParseTell(e.Payload.Span);
|
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 =>
|
registrar.Register(GameEventType.CommunicationTransientString, e =>
|
||||||
{
|
{
|
||||||
// 0x02EB carries no chat type on the wire (see ParseTransient).
|
// 0x02EB carries no chat type on the wire (see ParseTransient).
|
||||||
// 0 is ACE's ChatMessageType.Broadcast, which its own
|
// 0 is ACE's ChatMessageType.Broadcast, which its own
|
||||||
// LogTextTypeEnumMapper comment names "Default" — the right
|
// LogTextTypeEnumMapper comment names "Default" — the right
|
||||||
// stand-in for a message the server sends untyped. The exact
|
// stand-in for a message the server sends untyped. Left at 0x00
|
||||||
// retail rendering style for transient strings belongs to the
|
// by Campaign CH slice CH1 (retail color table): this is
|
||||||
// chat colour/text work, not to this parser.
|
// 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);
|
var s = GameEvents.ParseTransient(e.Payload.Span);
|
||||||
if (s is not null) chat.OnSystemMessage(s, chatType: 0u);
|
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)
|
string text = string.IsNullOrEmpty(p.Value.Name)
|
||||||
? $"You have played for {p.Value.Age}."
|
? $"You have played for {p.Value.Age}."
|
||||||
: $"{p.Value.Name} has 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);
|
chat.OnSystemMessage(text, chatType: 0u);
|
||||||
});
|
});
|
||||||
if (onConfirmationRequest is not null)
|
if (onConfirmationRequest is not null)
|
||||||
|
|
@ -247,7 +258,12 @@ public static class GameEventWiring
|
||||||
registrar.Register(GameEventType.VictimNotification, e =>
|
registrar.Register(GameEventType.VictimNotification, e =>
|
||||||
{
|
{
|
||||||
var p = GameEvents.ParseVictimNotification(e.Payload.Span);
|
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 =>
|
registrar.Register(GameEventType.DefenderNotification, e =>
|
||||||
{
|
{
|
||||||
|
|
@ -285,7 +301,8 @@ public static class GameEventWiring
|
||||||
registrar.Register(GameEventType.KillerNotification, e =>
|
registrar.Register(GameEventType.KillerNotification, e =>
|
||||||
{
|
{
|
||||||
var p = GameEvents.ParseKillerNotification(e.Payload.Span);
|
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 ────────────────────────────────────────────────
|
// ── Spells ────────────────────────────────────────────────
|
||||||
|
|
@ -526,6 +543,10 @@ public static class GameEventWiring
|
||||||
if (err is null) return;
|
if (err is null) return;
|
||||||
Console.WriteLine($"[use-done] err=0x{err.Value:X4}");
|
Console.WriteLine($"[use-done] err=0x{err.Value:X4}");
|
||||||
onUseDone?.Invoke(err.Value);
|
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)
|
if (err.Value != 0)
|
||||||
chat.OnSystemMessage(WeenieErrorText.For(err.Value), chatType: 0);
|
chat.OnSystemMessage(WeenieErrorText.For(err.Value), chatType: 0);
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -36,16 +36,24 @@ namespace AcDream.Core.Net.Messages;
|
||||||
/// </para>
|
/// </para>
|
||||||
///
|
///
|
||||||
/// <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">
|
/// <list type="bullet">
|
||||||
/// <item><description>0x01 = Broadcast</description></item>
|
/// <item><description>0x01 = All (Broadcast/AllChannels)</description></item>
|
||||||
/// <item><description>0x02 = Combat</description></item>
|
/// <item><description>0x02 = Speech</description></item>
|
||||||
/// <item><description>0x0B = Speech</description></item>
|
/// <item><description>0x03 = Tell</description></item>
|
||||||
/// <item><description>0x0F = Emote</description></item>
|
/// <item><description>0x0B = Social_Send</description></item>
|
||||||
/// <item><description>0x10 = Tell</description></item>
|
/// <item><description>0x0C = Emote</description></item>
|
||||||
/// <item><description>0x11 = Syllables (spell casting)</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>
|
/// <item><description>other values in ACE ChatMessageType.cs</description></item>
|
||||||
/// </list>
|
/// </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>
|
/// </para>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static class HearSpeech
|
public static class HearSpeech
|
||||||
|
|
|
||||||
|
|
@ -93,7 +93,15 @@ public sealed class ChatLog
|
||||||
/// Port from holtburger
|
/// Port from holtburger
|
||||||
/// <c>references/holtburger/.../client/messages.rs</c> lines 476-487.
|
/// <c>references/holtburger/.../client/messages.rs</c> lines 476-487.
|
||||||
/// </remarks>
|
/// </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
|
// Phase J: ACE's HandleActionTalk broadcasts a HearSpeech echo
|
||||||
// back to the sender too. Detect own echo by guid match and
|
// back to the sender too. Detect own echo by guid match and
|
||||||
|
|
@ -107,7 +115,10 @@ public sealed class ChatLog
|
||||||
Sender: effectiveSender,
|
Sender: effectiveSender,
|
||||||
Text: text,
|
Text: text,
|
||||||
SenderGuid: senderGuid,
|
SenderGuid: senderGuid,
|
||||||
ChannelId: 0));
|
ChannelId: 0)
|
||||||
|
{
|
||||||
|
LogTextType = logTextType,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>EmoteText (0x01E0) — server-driven third-person emote.</summary>
|
/// <summary>EmoteText (0x01E0) — server-driven third-person emote.</summary>
|
||||||
|
|
@ -118,7 +129,13 @@ public sealed class ChatLog
|
||||||
Sender: senderName,
|
Sender: senderName,
|
||||||
Text: text,
|
Text: text,
|
||||||
SenderGuid: senderGuid,
|
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>
|
/// <summary>SoulEmote (0x01E2) — complex emote (chat + paired animation).</summary>
|
||||||
|
|
@ -129,7 +146,12 @@ public sealed class ChatLog
|
||||||
Sender: senderName,
|
Sender: senderName,
|
||||||
Text: text,
|
Text: text,
|
||||||
SenderGuid: senderGuid,
|
SenderGuid: senderGuid,
|
||||||
ChannelId: 0));
|
ChannelId: 0)
|
||||||
|
{
|
||||||
|
// HearSoulEmote tail-calls HearEmote @0x0057D096 — same
|
||||||
|
// hard-coded 0x0C.
|
||||||
|
LogTextType = 0x0Cu,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>PlayerKilled (0x019E) — death announcement.</summary>
|
/// <summary>PlayerKilled (0x019E) — death announcement.</summary>
|
||||||
|
|
@ -147,7 +169,18 @@ public sealed class ChatLog
|
||||||
Sender: "",
|
Sender: "",
|
||||||
Text: deathMessage,
|
Text: deathMessage,
|
||||||
SenderGuid: victimGuid,
|
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>
|
/// <summary>WeenieError (0x028A) / WeenieErrorWithString (0x028B).</summary>
|
||||||
|
|
@ -178,7 +211,15 @@ public sealed class ChatLog
|
||||||
Sender: "",
|
Sender: "",
|
||||||
Text: text,
|
Text: text,
|
||||||
SenderGuid: 0,
|
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>
|
/// <summary>
|
||||||
|
|
@ -190,7 +231,21 @@ public sealed class ChatLog
|
||||||
/// <c>ChatVM</c> formatter renders entries as
|
/// <c>ChatVM</c> formatter renders entries as
|
||||||
/// <c>"[ChannelName] Sender says, \"text\""</c> when set.
|
/// <c>"[ChannelName] Sender says, \"text\""</c> when set.
|
||||||
/// </summary>
|
/// </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(
|
Append(new ChatEntry(
|
||||||
Kind: ChatKind.Channel,
|
Kind: ChatKind.Channel,
|
||||||
|
|
@ -200,18 +255,28 @@ public sealed class ChatLog
|
||||||
ChannelId: channelId)
|
ChannelId: channelId)
|
||||||
{
|
{
|
||||||
ChannelName = channelName,
|
ChannelName = channelName,
|
||||||
|
LogTextType = logTextType ?? LegacyChannelChatType.Resolve(channelId, ownSend: false),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>GameEvent Tell (0x02BD) — whisper received.</summary>
|
/// <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(
|
Append(new ChatEntry(
|
||||||
Kind: ChatKind.Tell,
|
Kind: ChatKind.Tell,
|
||||||
Sender: sender,
|
Sender: sender,
|
||||||
Text: text,
|
Text: text,
|
||||||
SenderGuid: senderGuid,
|
SenderGuid: senderGuid,
|
||||||
ChannelId: 0));
|
ChannelId: 0)
|
||||||
|
{
|
||||||
|
LogTextType = logTextType,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -241,10 +306,28 @@ public sealed class ChatLog
|
||||||
Sender: "",
|
Sender: "",
|
||||||
Text: text,
|
Text: text,
|
||||||
SenderGuid: 0,
|
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)
|
public void OnPopup(string text)
|
||||||
{
|
{
|
||||||
Append(new ChatEntry(
|
Append(new ChatEntry(
|
||||||
|
|
@ -252,7 +335,10 @@ public sealed class ChatLog
|
||||||
Sender: "",
|
Sender: "",
|
||||||
Text: text,
|
Text: text,
|
||||||
SenderGuid: 0,
|
SenderGuid: 0,
|
||||||
ChannelId: 0));
|
ChannelId: 0)
|
||||||
|
{
|
||||||
|
LogTextType = 0x00u,
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
@ -266,7 +352,19 @@ public sealed class ChatLog
|
||||||
/// <c>warning().combat()</c> / <c>error().combat()</c> tag flow at
|
/// <c>warning().combat()</c> / <c>error().combat()</c> tag flow at
|
||||||
/// <c>chat.rs:221-308</c>.
|
/// <c>chat.rs:221-308</c>.
|
||||||
/// </summary>
|
/// </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(
|
Append(new ChatEntry(
|
||||||
Kind: ChatKind.Combat,
|
Kind: ChatKind.Combat,
|
||||||
|
|
@ -276,6 +374,7 @@ public sealed class ChatLog
|
||||||
ChannelId: 0)
|
ChannelId: 0)
|
||||||
{
|
{
|
||||||
CombatKind = kind,
|
CombatKind = kind,
|
||||||
|
LogTextType = logTextType,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -300,7 +399,18 @@ public sealed class ChatLog
|
||||||
/// discriminator the formatter uses to render outgoing-vs-incoming
|
/// discriminator the formatter uses to render outgoing-vs-incoming
|
||||||
/// (a real incoming Tell carries the sender's player guid).
|
/// (a real incoming Tell carries the sender's player guid).
|
||||||
/// </remarks>
|
/// </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(
|
Append(new ChatEntry(
|
||||||
Kind: kind,
|
Kind: kind,
|
||||||
|
|
@ -315,6 +425,7 @@ public sealed class ChatLog
|
||||||
ChannelId: 0)
|
ChannelId: 0)
|
||||||
{
|
{
|
||||||
ChannelName = kind == ChatKind.Channel ? targetOrChannel : "",
|
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.
|
/// Falls back to <c>"ch {ChannelId}"</c> if not populated.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ChannelName { get; init; } = "";
|
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;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -115,7 +115,11 @@ public sealed class CombatChatTranslator : IDisposable
|
||||||
// grows that field, append " Critical hit." here.
|
// grows that field, append " Critical hit." here.
|
||||||
"",
|
"",
|
||||||
FormatAttackConditionsSuffix(0));
|
FormatAttackConditionsSuffix(0));
|
||||||
_chat.OnCombatLine(line, CombatLineKind.Info);
|
// Combat_Self (0x16): retail squelch-checks the attacker's OWN
|
||||||
|
// outgoing-hit notification against ChatMessageType.CombatSelf —
|
||||||
|
// references/ACE/Source/ACE.Server/WorldObjects/Player_Combat.cs:162-163
|
||||||
|
// (GameEventAttackerNotification, "You hit X...").
|
||||||
|
_chat.OnCombatLine(line, CombatLineKind.Info, logTextType: 0x16u);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleDamageTaken(CombatState.DamageIncoming e)
|
private void HandleDamageTaken(CombatState.DamageIncoming e)
|
||||||
|
|
@ -138,21 +142,33 @@ public sealed class CombatChatTranslator : IDisposable
|
||||||
sb.Append('.');
|
sb.Append('.');
|
||||||
if (e.Critical) sb.Append(" Critical hit.");
|
if (e.Critical) sb.Append(" Critical hit.");
|
||||||
sb.Append(FormatAttackConditionsSuffix(0));
|
sb.Append(FormatAttackConditionsSuffix(0));
|
||||||
_chat.OnCombatLine(sb.ToString(), CombatLineKind.Warning);
|
// Combat_Enemy (0x15): retail squelch-checks the defender's
|
||||||
|
// incoming-hit notification against ChatMessageType.CombatEnemy —
|
||||||
|
// references/ACE/Source/ACE.Server/WorldObjects/Player_Combat.cs:541
|
||||||
|
// (GameEventDefenderNotification, "X hit you...").
|
||||||
|
_chat.OnCombatLine(sb.ToString(), CombatLineKind.Warning, logTextType: 0x15u);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleMissedOutgoing(string defenderName)
|
private void HandleMissedOutgoing(string defenderName)
|
||||||
{
|
{
|
||||||
// chat.rs:286-291 — EvasionAttackerNotification:
|
// chat.rs:286-291 — EvasionAttackerNotification:
|
||||||
// "{} evaded your attack."
|
// "{} evaded your attack."
|
||||||
_chat.OnCombatLine($"{defenderName} evaded your attack.", CombatLineKind.Info);
|
// Combat_Self (0x16): this is about the LOCAL PLAYER'S OWN attack
|
||||||
|
// missing — retail squelch-checks GameEventEvasionAttackerNotification
|
||||||
|
// against CombatSelf, same family as the hit-dealt line above —
|
||||||
|
// references/ACE/Source/ACE.Server/WorldObjects/Player_Combat.cs:150.
|
||||||
|
_chat.OnCombatLine($"{defenderName} evaded your attack.", CombatLineKind.Info, logTextType: 0x16u);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleEvadedIncoming(string attackerName)
|
private void HandleEvadedIncoming(string attackerName)
|
||||||
{
|
{
|
||||||
// chat.rs:292-297 — EvasionDefenderNotification:
|
// chat.rs:292-297 — EvasionDefenderNotification:
|
||||||
// "You evaded {}'s attack."
|
// "You evaded {}'s attack."
|
||||||
_chat.OnCombatLine($"You evaded {attackerName}'s attack.", CombatLineKind.Info);
|
// Combat_Enemy (0x15): this is about an ENEMY'S attack (that the
|
||||||
|
// local player evaded) — retail squelch-checks
|
||||||
|
// GameEventEvasionDefenderNotification against CombatEnemy —
|
||||||
|
// references/ACE/Source/ACE.Server/WorldObjects/Player_Combat.cs:345.
|
||||||
|
_chat.OnCombatLine($"You evaded {attackerName}'s attack.", CombatLineKind.Info, logTextType: 0x15u);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleKillLanded(string victimName, uint victimGuid)
|
private void HandleKillLanded(string victimName, uint victimGuid)
|
||||||
|
|
@ -164,7 +180,12 @@ public sealed class CombatChatTranslator : IDisposable
|
||||||
// synthesize a minimal "You killed Foo." line here. The
|
// synthesize a minimal "You killed Foo." line here. The
|
||||||
// detailed sentence (used by retail) arrives separately via
|
// detailed sentence (used by retail) arrives separately via
|
||||||
// ChatLog.OnPlayerKilled and is rendered as ChatKind.System.
|
// ChatLog.OnPlayerKilled and is rendered as ChatKind.System.
|
||||||
_chat.OnCombatLine($"You killed {victimName}.", CombatLineKind.Info);
|
// LogTextType 0x00 Default: retail's own kill/death notification
|
||||||
|
// handler (VictimNotification 0x01AC + KillerNotification 0x01AD,
|
||||||
|
// both via ClientCombatSystem::HandleKillerNotificationEvent
|
||||||
|
// @0x0056C410) calls AddTextToScroll(..., 0, 1, 0) — see
|
||||||
|
// ChatLog.OnPlayerKilled's identical citation.
|
||||||
|
_chat.OnCombatLine($"You killed {victimName}.", CombatLineKind.Info, logTextType: 0x00u);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ── Formatters (ported VERBATIM from chat.rs:561-595) ───────────────────
|
// ── Formatters (ported VERBATIM from chat.rs:561-595) ───────────────────
|
||||||
|
|
|
||||||
77
src/AcDream.Core/Chat/LegacyChannelChatType.cs
Normal file
77
src/AcDream.Core/Chat/LegacyChannelChatType.cs
Normal file
|
|
@ -0,0 +1,77 @@
|
||||||
|
namespace AcDream.Core.Chat;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Maps a legacy <c>ChatChannel (0x0147)</c> bitflag id to retail's wire
|
||||||
|
/// <c>LogTextType</c> for the chat color table.
|
||||||
|
///
|
||||||
|
/// <para>
|
||||||
|
/// Faithful port of <c>ClientCommunicationSystem::Handle_Communication__
|
||||||
|
/// ChannelBroadcast @0x00570B90</c> (Sept 2013 EoR build). Retail branches
|
||||||
|
/// on the channel bit AND on whether the sender-name buffer is the
|
||||||
|
/// single-char "self" sentinel (<c>m_buffer->m_len == 1</c>) — i.e.
|
||||||
|
/// whether this is the local player's OWN outgoing message
|
||||||
|
/// ("You say to your patron, ...") vs. hearing someone else
|
||||||
|
/// ("Your patron X tells you, ..."). <see cref="Resolve"/>'s
|
||||||
|
/// <paramref name="ownSend"/> models that same branch.
|
||||||
|
/// </para>
|
||||||
|
///
|
||||||
|
/// <para>
|
||||||
|
/// Per-bit findings from the decompiled dispatch (not all bits behave
|
||||||
|
/// the same for own-send — only Patron/Vassal/Follower get a distinct
|
||||||
|
/// send-color; Fellowship, Co-Vassals, Allegiance Broadcast, and the
|
||||||
|
/// generic/admin catch-all use the SAME type for hear and send):
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
public static class LegacyChannelChatType
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Resolve <paramref name="channelBit"/> (the <c>ChannelBroadcast</c>
|
||||||
|
/// wire channel id, a single flag bit) to a <c>LogTextType</c>.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="channelBit">The wire channel id / bitflag.</param>
|
||||||
|
/// <param name="ownSend">
|
||||||
|
/// <see langword="true"/> when this is the local player's own outgoing
|
||||||
|
/// message (retail's <c>m_buffer->m_len == 1</c> self-sentinel
|
||||||
|
/// branch); <see langword="false"/> when hearing another sender.
|
||||||
|
/// </param>
|
||||||
|
public static uint Resolve(uint channelBit, bool ownSend) => channelBit switch
|
||||||
|
{
|
||||||
|
// Fellowship: same type ("[Fellowship] ...") for hear and send.
|
||||||
|
// pc:00570e48 (hear, m_buffer_5=0x13) / pc:00570d08 (send, 0x13).
|
||||||
|
0x0800u => 0x13u,
|
||||||
|
|
||||||
|
// Patron / Vassal / Follower(Monarch): hear = Social (0xA,
|
||||||
|
// "Your patron/vassal/follower X tells you..."); OWN send =
|
||||||
|
// Social_Send (0xB, "You say to your patron/vassal/follower...").
|
||||||
|
// pc:00570e50/00570e58 (Patron/Vassal hear, 0xa) + pc:00570e40
|
||||||
|
// (Follower hear, 0xa); pc:00570c07/00570c21 (all three own-send
|
||||||
|
// via the shared label_570c21, 0xb).
|
||||||
|
0x1000u => ownSend ? 0x0Bu : 0x0Au, // Patron
|
||||||
|
0x2000u => ownSend ? 0x0Bu : 0x0Au, // Vassal
|
||||||
|
0x4000u => ownSend ? 0x0Bu : 0x0Au, // Follower / Monarch
|
||||||
|
|
||||||
|
// Co-Vassals / Allegiance Broadcast: same type for hear and send.
|
||||||
|
// pc:00571025/00571014 (hear, 0xa) / pc:00570e17/00570df7 (send, 0xa).
|
||||||
|
0x1000000u => 0x0Au, // Co-Vassals
|
||||||
|
0x2000000u => 0x0Au, // Allegiance Broadcast
|
||||||
|
|
||||||
|
// Unnamed bit — no producer traced, but retail's own dispatch
|
||||||
|
// assigns it 0x13 (Fellowship's slot) for both hear and send.
|
||||||
|
// pc:00570d43 (send, 0x13); the hear branch mirrors it via the
|
||||||
|
// same ebp==0x4000000 special case one level up in the dispatch.
|
||||||
|
0x4000000u => 0x13u,
|
||||||
|
|
||||||
|
// The single named non-family bit inside the generic catch-all:
|
||||||
|
// 0x400 gets its OWN color (Help, 0xF) where every other
|
||||||
|
// unmatched bit gets the catch-all (Abuse, 0xE). Both branches
|
||||||
|
// (hear label_570f0a and send label_570d4f) test `ebp != 0x400`
|
||||||
|
// with the identical 0xe/0xf split.
|
||||||
|
0x0400u => 0x0Fu,
|
||||||
|
|
||||||
|
// Generic/admin/audit/sentinel catch-all: retail's
|
||||||
|
// "<Tell> says on the X channel" / "You say on the X channel"
|
||||||
|
// template, color 0xE (Abuse). pc:00570f1d (hear) / pc:00570d62
|
||||||
|
// (send) — both compute the same constant 0xe.
|
||||||
|
_ => 0x0Eu,
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
@ -223,10 +223,12 @@ internal sealed class HeadlessGameplayOperations
|
||||||
session!.SendCastTargetedSpell(targetId, spellId);
|
session!.SendCastTargetedSpell(targetId, spellId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Client-local text (a bot script's own injected message, never
|
||||||
|
// reaches the wire), 0x1A — same category as ChatVM.ShowSystemMessage.
|
||||||
public void DisplayMessage(string message) =>
|
public void DisplayMessage(string message) =>
|
||||||
RequireRuntime().CommunicationOwner.Chat.OnSystemMessage(
|
RequireRuntime().CommunicationOwner.Chat.OnSystemMessage(
|
||||||
message,
|
message,
|
||||||
chatType: 0u);
|
chatType: 0x1Au);
|
||||||
|
|
||||||
public void IncrementBusy() =>
|
public void IncrementBusy() =>
|
||||||
RequireRuntime().ActionOwner.Transactions
|
RequireRuntime().ActionOwner.Transactions
|
||||||
|
|
|
||||||
|
|
@ -261,7 +261,12 @@ public sealed class LiveSessionEventRouter : ILiveSessionEventRouting
|
||||||
speech.SenderName,
|
speech.SenderName,
|
||||||
speech.Text,
|
speech.Text,
|
||||||
speech.SenderGuid,
|
speech.SenderGuid,
|
||||||
speech.IsRanged));
|
speech.IsRanged,
|
||||||
|
// speech.ChatType is passed through VERBATIM — retail's
|
||||||
|
// Handle_Communication__HearSpeech @0x005712A0 feeds the
|
||||||
|
// raw wire word straight into AddTextToScroll with zero
|
||||||
|
// remapping (research doc §3.3 / HearSpeech.cs doc).
|
||||||
|
speech.ChatType));
|
||||||
Subscribe<ServerMessage.Parsed>(
|
Subscribe<ServerMessage.Parsed>(
|
||||||
h => session.ServerMessageReceived += h,
|
h => session.ServerMessageReceived += h,
|
||||||
h => session.ServerMessageReceived -= h,
|
h => session.ServerMessageReceived -= h,
|
||||||
|
|
@ -481,11 +486,16 @@ public sealed class LiveSessionEventRouter : ILiveSessionEventRouting
|
||||||
if (parsed.Body is not TurbineChat.Payload.EventSendToRoom message)
|
if (parsed.Body is not TurbineChat.Payload.EventSendToRoom message)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
// message.RoomId is an opaque per-session Turbine room GUID, not a
|
||||||
|
// legacy channel bitflag — ChatLog.OnChannelBroadcast's default
|
||||||
|
// (legacy-bit) LogTextType derivation would misclassify it, so the
|
||||||
|
// room's own ChatType maps to LogTextType explicitly here instead.
|
||||||
chat.OnChannelBroadcast(
|
chat.OnChannelBroadcast(
|
||||||
message.RoomId,
|
message.RoomId,
|
||||||
message.SenderName,
|
message.SenderName,
|
||||||
message.Message,
|
message.Message,
|
||||||
TurbineChatDisplayNames.Resolve(message.RoomId, message.ChatType));
|
logTextType: TurbineChatDisplayNames.LogTextType(message.ChatType),
|
||||||
|
channelName: TurbineChatDisplayNames.Resolve(message.RoomId, message.ChatType));
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void Validate(
|
private static void Validate(
|
||||||
|
|
|
||||||
|
|
@ -19,4 +19,31 @@ internal static class TurbineChatDisplayNames
|
||||||
TurbineChat.ChatType.Olthoi => "Olthoi",
|
TurbineChat.ChatType.Olthoi => "Olthoi",
|
||||||
_ => $"Room 0x{roomId:X8}",
|
_ => $"Room 0x{roomId:X8}",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Map a Turbine room's <c>TurbineChat.ChatType</c> to retail's wire
|
||||||
|
/// <c>LogTextType</c> for the chat color table. Faithful port of
|
||||||
|
/// <c>ChatRoomTracker::GetChatFormat @0x005CD7C0</c>, which writes
|
||||||
|
/// <c>ChatDisplayInfo::m_ltt</c> directly per room field (research doc
|
||||||
|
/// <c>docs/research/2026-08-09-chat-retail-color-table.md</c> §2.2):
|
||||||
|
/// General/Trade/LFG/Roleplay each get their OWN dedicated slot
|
||||||
|
/// (<c>0x1B</c>-<c>0x1E</c>); every Society variant collapses to the
|
||||||
|
/// SAME slot (<c>0x20</c>); Allegiance and Olthoi both reuse the
|
||||||
|
/// Allegiance slot (<c>0x12</c>) rather than getting their own.
|
||||||
|
/// </summary>
|
||||||
|
public static uint LogTextType(uint chatType) =>
|
||||||
|
(TurbineChat.ChatType)chatType switch
|
||||||
|
{
|
||||||
|
TurbineChat.ChatType.Allegiance => 0x12u,
|
||||||
|
TurbineChat.ChatType.General => 0x1Bu,
|
||||||
|
TurbineChat.ChatType.Trade => 0x1Cu,
|
||||||
|
TurbineChat.ChatType.Lfg => 0x1Du,
|
||||||
|
TurbineChat.ChatType.Roleplay => 0x1Eu,
|
||||||
|
TurbineChat.ChatType.Society => 0x20u,
|
||||||
|
TurbineChat.ChatType.SocietyCelHan => 0x20u,
|
||||||
|
TurbineChat.ChatType.SocietyEldWeb => 0x20u,
|
||||||
|
TurbineChat.ChatType.SocietyRadBlo => 0x20u,
|
||||||
|
TurbineChat.ChatType.Olthoi => 0x12u,
|
||||||
|
_ => 0x00u,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -153,9 +153,19 @@ public sealed class ChatPanel : IPanel
|
||||||
for (int i = 0; i < lines.Count; i++)
|
for (int i = 0; i < lines.Count; i++)
|
||||||
{
|
{
|
||||||
var line = lines[i];
|
var line = lines[i];
|
||||||
if (line.Kind == ChatKind.Combat && line.CombatKind is { } ck)
|
if (line.Kind == ChatKind.Combat)
|
||||||
{
|
{
|
||||||
renderer.TextColored(ColorForCombat(ck), line.Text);
|
// Campaign CH slice CH1: color combat lines from the
|
||||||
|
// retail LogTextType table (Combat_Self/Combat_Enemy/
|
||||||
|
// Default per CombatChatTranslator's ACE-cited
|
||||||
|
// mapping) instead of the CombatLineKind info/
|
||||||
|
// warning/error severity bucket. Every LogTextType
|
||||||
|
// CombatChatTranslator emits is in-range (<0x22), so
|
||||||
|
// the fallback below is defensive only.
|
||||||
|
Vector4 color = RetailChatColorTable.TryGetColor(line.LogTextType, out var resolved)
|
||||||
|
? resolved
|
||||||
|
: ColorForCombat(line.CombatKind ?? CombatLineKind.Info);
|
||||||
|
renderer.TextColored(color, line.Text);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -112,7 +112,13 @@ public sealed class ChatVM : IDisposable
|
||||||
/// client-handled commands (/help, /clear, future) to surface
|
/// client-handled commands (/help, /clear, future) to surface
|
||||||
/// local feedback without round-tripping the server.
|
/// local feedback without round-tripping the server.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void ShowSystemMessage(string text) => _log.OnSystemMessage(text, chatType: 0);
|
/// <remarks>
|
||||||
|
/// LogTextType <c>0x1A</c>: this text never reaches the wire — the
|
||||||
|
/// same "client-local text" category as retail's own command-parser
|
||||||
|
/// errors and <c>cant_jump_*</c> strings (research doc
|
||||||
|
/// <c>docs/research/2026-08-09-chat-retail-color-table.md</c> §2.2).
|
||||||
|
/// </remarks>
|
||||||
|
public void ShowSystemMessage(string text) => _log.OnSystemMessage(text, chatType: 0x1Au);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Drain the chat log. Used by the /clear client-side command.
|
/// Drain the chat log. Used by the /clear client-side command.
|
||||||
|
|
@ -256,7 +262,9 @@ public sealed class ChatVM : IDisposable
|
||||||
/// <see cref="ChatPanel"/> can pick the right rendering primitive
|
/// <see cref="ChatPanel"/> can pick the right rendering primitive
|
||||||
/// per entry (plain <c>Text</c> for most kinds; <c>TextColored</c>
|
/// per entry (plain <c>Text</c> for most kinds; <c>TextColored</c>
|
||||||
/// for combat lines, with the rgba chosen from
|
/// for combat lines, with the rgba chosen from
|
||||||
/// <see cref="ChatEntry.CombatKind"/>).
|
/// <see cref="ChatEntry.CombatKind"/>). Campaign CH slice CH1 also
|
||||||
|
/// carries <see cref="ChatEntry.LogTextType"/> through — the retail
|
||||||
|
/// color key, keyed independently of <see cref="ChatKind"/>.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public IReadOnlyList<FormattedLine> RecentLinesDetailed()
|
public IReadOnlyList<FormattedLine> RecentLinesDetailed()
|
||||||
{
|
{
|
||||||
|
|
@ -272,7 +280,8 @@ public sealed class ChatVM : IDisposable
|
||||||
lines[i] = new FormattedLine(
|
lines[i] = new FormattedLine(
|
||||||
Text: FormatEntry(entry),
|
Text: FormatEntry(entry),
|
||||||
Kind: entry.Kind,
|
Kind: entry.Kind,
|
||||||
CombatKind: entry.CombatKind);
|
CombatKind: entry.CombatKind,
|
||||||
|
LogTextType: entry.LogTextType);
|
||||||
}
|
}
|
||||||
return lines;
|
return lines;
|
||||||
}
|
}
|
||||||
|
|
@ -284,7 +293,12 @@ public sealed class ChatVM : IDisposable
|
||||||
/// <see cref="CombatKind"/> to pick a rendering primitive
|
/// <see cref="CombatKind"/> to pick a rendering primitive
|
||||||
/// (<c>Text</c> vs <c>TextColored(rgba)</c>).
|
/// (<c>Text</c> vs <c>TextColored(rgba)</c>).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
/// <param name="LogTextType">
|
||||||
|
/// Campaign CH slice CH1: the retail wire <c>LogTextType</c> that keys
|
||||||
|
/// <see cref="RetailChatColorTable"/> — see <see cref="ChatEntry.LogTextType"/>.
|
||||||
|
/// </param>
|
||||||
public readonly record struct FormattedLine(
|
public readonly record struct FormattedLine(
|
||||||
string Text,
|
string Text,
|
||||||
ChatKind Kind,
|
ChatKind Kind,
|
||||||
CombatLineKind? CombatKind);
|
CombatLineKind? CombatKind,
|
||||||
|
uint LogTextType);
|
||||||
|
|
|
||||||
109
src/AcDream.UI.Abstractions/Panels/Chat/RetailChatColorTable.cs
Normal file
109
src/AcDream.UI.Abstractions/Panels/Chat/RetailChatColorTable.cs
Normal file
|
|
@ -0,0 +1,109 @@
|
||||||
|
using System.Numerics;
|
||||||
|
|
||||||
|
namespace AcDream.UI.Abstractions.Panels.Chat;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The exact retail chat font-color lookup table, indexed by the wire
|
||||||
|
/// <c>LogTextType</c> (the same integer ACE calls <c>ChatMessageType</c>).
|
||||||
|
///
|
||||||
|
/// <para>
|
||||||
|
/// Faithful port of <c>ChatInterface::BuildChatColorLookupTable @0x004F31C0</c>
|
||||||
|
/// (Sept 2013 EoR build; verified against the PDB-paired binary's <c>.data</c>
|
||||||
|
/// section, image base <c>0x400000</c>, RGBAColor constants at <c>0x0081C4A8</c>+).
|
||||||
|
/// Retail default-fills all 34 slots (indices <c>0x00</c>-<c>0x21</c>, 34 loop
|
||||||
|
/// iterations) with <c>colorGreen</c>, then overwrites 27 of them with 13 named
|
||||||
|
/// colors; the 7 slots retail never overwrites (<c>0x00, 0x01, 0x10, 0x14, 0x17,
|
||||||
|
/// 0x18, 0x19</c>) stay green. Every color's alpha is 1.0 in the source data.
|
||||||
|
/// Full derivation: <c>docs/research/2026-08-09-chat-retail-color-table.md</c> §1-2.
|
||||||
|
/// </para>
|
||||||
|
///
|
||||||
|
/// <para>
|
||||||
|
/// <b>Out-of-range rule.</b> Retail's consumer,
|
||||||
|
/// <c>UIElement_Text::SetFontColorHelper @0x00466AC0</c>, reads the list's
|
||||||
|
/// element count and only applies a new color when the index is IN range;
|
||||||
|
/// an index >= 34 falls through leaving <c>m_curFontColor</c> untouched — the
|
||||||
|
/// line inherits whatever color the PREVIOUS line resolved to, not a default.
|
||||||
|
/// <see cref="TryGetColor"/> models this: it returns <see langword="false"/>
|
||||||
|
/// for an out-of-range index instead of substituting a fallback color, so
|
||||||
|
/// callers can implement the same "keep the last color" carry-forward.
|
||||||
|
/// </para>
|
||||||
|
/// </summary>
|
||||||
|
public static class RetailChatColorTable
|
||||||
|
{
|
||||||
|
// Named RGBAColor constants (retail .data, 0x0081C4A8-0x0081C578).
|
||||||
|
private static readonly Vector4 ColorWhite = new(1f, 1f, 1f, 1f);
|
||||||
|
private static readonly Vector4 Yellow = new(1f, 1f, 0.247f, 1f);
|
||||||
|
private static readonly Vector4 DarkYellow = new(0.824f, 0.824f, 0.392f, 1f);
|
||||||
|
private static readonly Vector4 ColorBrightPurple = new(1f, 0.498f, 1f, 1f);
|
||||||
|
private static readonly Vector4 ColorDarkRed = new(1f, 0.247f, 0.247f, 1f);
|
||||||
|
private static readonly Vector4 ColorLightRed = new(0.96f, 0.459f, 0.447f, 1f);
|
||||||
|
private static readonly Vector4 ColorLightBlue = new(0.247f, 0.749f, 1f, 1f);
|
||||||
|
private static readonly Vector4 ColorPink = new(1f, 0.588f, 0.588f, 1f);
|
||||||
|
private static readonly Vector4 ColorCyan = new(0.247f, 0.863f, 0.863f, 1f);
|
||||||
|
private static readonly Vector4 ColorBlueGrey = new(0.706f, 0.863f, 0.941f, 1f);
|
||||||
|
private static readonly Vector4 ColorGrey = new(0.824f, 0.824f, 0.784f, 1f);
|
||||||
|
private static readonly Vector4 Orange = new(0.933f, 0.573f, 0.118f, 1f);
|
||||||
|
private static readonly Vector4 ColorGreen = new(0.5f, 1f, 0.498f, 1f);
|
||||||
|
private static readonly Vector4 ColorBrightRed = new(1f, 0f, 0f, 1f);
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The 34-entry table, index == <c>LogTextType</c> (<c>0x00</c>-<c>0x21</c>).
|
||||||
|
/// Default-fill is <c>colorGreen</c>; explicit overrides match the builder's
|
||||||
|
/// <c>SetValue</c> calls verbatim.
|
||||||
|
/// </summary>
|
||||||
|
public static readonly IReadOnlyList<Vector4> Colors = new[]
|
||||||
|
{
|
||||||
|
/* 0x00 Default */ ColorGreen,
|
||||||
|
/* 0x01 All */ ColorGreen,
|
||||||
|
/* 0x02 Speech */ ColorWhite,
|
||||||
|
/* 0x03 Tell */ Yellow,
|
||||||
|
/* 0x04 Speech_Direct_Send */ DarkYellow,
|
||||||
|
/* 0x05 System */ ColorBrightPurple,
|
||||||
|
/* 0x06 Combat */ ColorDarkRed,
|
||||||
|
/* 0x07 Magic */ ColorLightBlue,
|
||||||
|
/* 0x08 Channel */ ColorPink,
|
||||||
|
/* 0x09 Channel_Send */ ColorPink,
|
||||||
|
/* 0x0A Social */ Yellow,
|
||||||
|
/* 0x0B Social_Send */ DarkYellow,
|
||||||
|
/* 0x0C Emote */ ColorGrey,
|
||||||
|
/* 0x0D Advancement */ ColorCyan,
|
||||||
|
/* 0x0E Abuse */ ColorBlueGrey,
|
||||||
|
/* 0x0F Help */ ColorDarkRed,
|
||||||
|
/* 0x10 Appraisal */ ColorGreen,
|
||||||
|
/* 0x11 Spellcasting */ ColorLightBlue,
|
||||||
|
/* 0x12 Allegiance */ Orange,
|
||||||
|
/* 0x13 Fellowship */ Yellow,
|
||||||
|
/* 0x14 World_Broadcast */ ColorGreen,
|
||||||
|
/* 0x15 Combat_Enemy */ ColorDarkRed,
|
||||||
|
/* 0x16 Combat_Self */ ColorLightRed,
|
||||||
|
/* 0x17 Recall */ ColorGreen,
|
||||||
|
/* 0x18 Craft */ ColorGreen,
|
||||||
|
/* 0x19 Salvaging */ ColorGreen,
|
||||||
|
/* 0x1A (client-local text) */ ColorBrightRed,
|
||||||
|
/* 0x1B (Turbine General) */ ColorBlueGrey,
|
||||||
|
/* 0x1C (Turbine Trade) */ ColorBlueGrey,
|
||||||
|
/* 0x1D (Turbine LFG) */ ColorBlueGrey,
|
||||||
|
/* 0x1E (Turbine Roleplay) */ ColorBlueGrey,
|
||||||
|
/* 0x1F Admin_Tell */ Yellow,
|
||||||
|
/* 0x20 (Turbine Society) */ ColorBlueGrey,
|
||||||
|
/* 0x21 (reserved) */ Orange,
|
||||||
|
};
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Resolve <paramref name="logTextType"/> to its retail color.
|
||||||
|
/// Returns <see langword="false"/> for an out-of-range index (>=
|
||||||
|
/// <see cref="Colors"/>.Count) — per retail's <c>SetFontColorHelper</c>,
|
||||||
|
/// the caller should keep whatever color the previous line resolved to
|
||||||
|
/// rather than substitute a default.
|
||||||
|
/// </summary>
|
||||||
|
public static bool TryGetColor(uint logTextType, out Vector4 color)
|
||||||
|
{
|
||||||
|
if (logTextType < (uint)Colors.Count)
|
||||||
|
{
|
||||||
|
color = Colors[(int)logTextType];
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
color = default;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -154,6 +154,9 @@ public sealed class GameEventWiringTests
|
||||||
var entry = chat.Snapshot()[0];
|
var entry = chat.Snapshot()[0];
|
||||||
Assert.Equal(ChatKind.Channel, entry.Kind);
|
Assert.Equal(ChatKind.Channel, entry.Kind);
|
||||||
Assert.Equal("Alice", entry.Sender);
|
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]
|
[Fact]
|
||||||
|
|
@ -584,6 +587,10 @@ public sealed class GameEventWiringTests
|
||||||
Assert.Equal(ChatKind.Combat, entry.Kind);
|
Assert.Equal(ChatKind.Combat, entry.Kind);
|
||||||
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
||||||
Assert.Equal("You killed the drudge!", entry.Text);
|
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]
|
[Fact]
|
||||||
|
|
|
||||||
|
|
@ -211,4 +211,158 @@ public sealed class ChatLogTests
|
||||||
CombatLineKind.Error);
|
CombatLineKind.Error);
|
||||||
Assert.Equal(CombatLineKind.Error, log.Snapshot()[1].CombatKind);
|
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(ChatKind.Combat, entry.Kind);
|
||||||
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
||||||
Assert.Equal("You hit Mosswart Defiler for 12 slashing damage (54.0%).", entry.Text);
|
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]
|
[Fact]
|
||||||
|
|
@ -50,6 +53,9 @@ public sealed class CombatChatTranslatorTests
|
||||||
Assert.Equal(ChatKind.Combat, entry.Kind);
|
Assert.Equal(ChatKind.Combat, entry.Kind);
|
||||||
Assert.Equal(CombatLineKind.Warning, entry.CombatKind);
|
Assert.Equal(CombatLineKind.Warning, entry.CombatKind);
|
||||||
Assert.Equal("Mosswart Stalker hit you for 7 fire damage to your chest.", entry.Text);
|
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]
|
[Fact]
|
||||||
|
|
@ -77,6 +83,8 @@ public sealed class CombatChatTranslatorTests
|
||||||
Assert.Equal(ChatKind.Combat, entry.Kind);
|
Assert.Equal(ChatKind.Combat, entry.Kind);
|
||||||
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
||||||
Assert.Equal("Mosswart Sniper evaded your attack.", entry.Text);
|
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]
|
[Fact]
|
||||||
|
|
@ -88,6 +96,8 @@ public sealed class CombatChatTranslatorTests
|
||||||
var entry = Assert.Single(chat.Snapshot());
|
var entry = Assert.Single(chat.Snapshot());
|
||||||
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
||||||
Assert.Equal("You evaded Drudge Slinker's attack.", entry.Text);
|
Assert.Equal("You evaded Drudge Slinker's attack.", entry.Text);
|
||||||
|
// Combat_Enemy (0x15) — about an ENEMY'S attack.
|
||||||
|
Assert.Equal(0x15u, entry.LogTextType);
|
||||||
}
|
}
|
||||||
|
|
||||||
[Fact]
|
[Fact]
|
||||||
|
|
@ -121,6 +131,9 @@ public sealed class CombatChatTranslatorTests
|
||||||
Assert.Equal(ChatKind.Combat, entry.Kind);
|
Assert.Equal(ChatKind.Combat, entry.Kind);
|
||||||
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
Assert.Equal(CombatLineKind.Info, entry.CombatKind);
|
||||||
Assert.Equal("You killed Phyntos Wasp.", entry.Text);
|
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]
|
[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.Single(after);
|
||||||
Assert.Equal("Caith says, \"hello\"", after[0]);
|
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);
|
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 =>
|
Assert.Contains(renderer.Calls, c =>
|
||||||
c.Method == "Text" && (string?)c.Args[0] == "Alice says, \"hi\"");
|
c.Method == "Text" && (string?)c.Args[0] == "Alice says, \"hi\"");
|
||||||
var coloredCall = Assert.Single(
|
var coloredCall = Assert.Single(
|
||||||
|
|
@ -80,8 +84,9 @@ public sealed class ChatVMCombatTests
|
||||||
Assert.Equal(
|
Assert.Equal(
|
||||||
"You hit Mosswart for 5 slashing damage (50.0%).",
|
"You hit Mosswart for 5 slashing damage (50.0%).",
|
||||||
(string?)coloredCall.Args[1]);
|
(string?)coloredCall.Args[1]);
|
||||||
|
RetailChatColorTable.TryGetColor(0x06u, out var expectedColor);
|
||||||
Assert.Equal(
|
Assert.Equal(
|
||||||
ChatPanel.ColorForCombat(CombatLineKind.Info),
|
expectedColor,
|
||||||
(System.Numerics.Vector4)coloredCall.Args[0]!);
|
(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