fix(chat): CH2 rework — SpewBox tick-driven visibility + binary-derived error table

Reworks Campaign CH slice CH2 per the REJECT-review findings doc
(docs/research/2026-08-09-ch2-review-findings.md).

BLOCKER 1 — SpewBoxController never rendered a line and leaked its
pending queue. LinesProvider only ran through UiText.OnDraw, which
gates on Visible — and the box started invisible, so the provider (the
sole caller of SpewBoxState.Tick) never ran. Gave the controller an
explicit per-frame Tick(now) driven by UiRoot's global-message-3
broadcast (a zero-size GlobalTimeSink child, the same pattern
VendorUiController.DragOverGlobalTimeSink already uses), matching
retail's gmSpewBoxUI::Update. LinesProvider now only returns the
cache. Tests rewritten to drive root.Tick(...) instead of calling the
provider directly, plus new coverage for visibility-without-a-draw,
queue-drain-without-a-draw, and bounded-queue-across-many-ticks.

BLOCKER 2 — re-derived the HandleFailureEvent routing table from the
PDB-paired binary instead of the pseudo-C's ~33-char string previews.
tools/pdb-extract/sweep_weenie_strings.py sweeps every push imm32 in
VA 0x571990-0x575480, dereferences into .rdata/.data, and decodes the
full UTF-16LE literal. Added the 5 ids dispatched via else-if (missed
by case-label enumeration), resolved 0x4F8 (previously excluded),
fixed 18 wrong strings (16 the review flagged + 2 more — 0x4E9 and
0x518 — an automated diff between every swept literal and the landed
table found). Every changed row cross-checked against ACE's
WeenieError/WeenieErrorWithString enum doc comments; both oracles
agreed on every row, including a case where the review's own proposed
text for the new 0x4E8 row was itself wrong (it was 0x4E9's text) —
corrected via the else-if block's own instruction address plus the ACE
cross-check. Pinned table count: 344 (338 + 5 + 0x4F8).

SHOULD-FIX 1 — RuntimeCommunicationState.ResetSpewBox was dead code;
folded into the ChatIdentity generation-reset stage (same lifetime
boundary), with a reset assertion added to the existing populated-reset
test.

SHOULD-FIX 2 — AddText trimmed only the trailing end and invented an
empty-string early return; retail's AddTextToScroll trims both ends
(trim(&str, 1, 1, ws)) and has no empty guard. Both retired.

SHOULD-FIX 3 — ShowWeenieError bypassed the AddText chokepoint via
ChatLog.OnWeenieError (hardcoded LogTextType 0x00); routed through
Communication.AddText(Resolve(code, param)) instead, and
ChatLog.OnWeenieError is deleted — GameEventWiring's legacy no-router
fallback now resolves + calls OnSystemMessage directly.

SHOULD-FIX 4 — retail's HandleFailureEvent switch has no default case;
an unmapped id now resolves to a null Text (silence toward the
player) instead of the invented "WeenieError 0xNNNN" hex fallback,
with a diagnostics-only console log line for the id.

NITs — AP-TBD placeholders corrected to their real register rows
(AP-178, not the unrelated AP-177 lifetime row); filed AP-180 for the
windowId dual-destination gap and corrected three stale "lands with
CH2" comments; extended SpewBoxLayoutDumpDiagnostic from dats.Portal
to dats.Local and found the SpewBox element for real — LayoutDesc
0x21000011, element 0x10000048, size 450x72, MaxConcurrentItems
(ListBox property 0x10000028) = 4, not retail's code default of 1.
AP-178 narrowed accordingly; SpewBoxState.MaxConcurrentItems and
SpewBoxController's extent/anchor/OneLine are now authored rather than
placeholder (absolute screen position and colour remain open); fixed
the "19 ids... lists 18" miscount by retiring the stale paragraph in
the class doc rewrite; aligned the UseDone handler's silent-status
check with the other two WeenieError handlers.

Full Release suite: 11,914 passed / 4 skipped / 0 failed (build 0
errors).

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
Erik 2026-08-09 18:14:08 +02:00
parent b3ba4c6663
commit e0e7888308
22 changed files with 1164 additions and 336 deletions

View file

@ -332,13 +332,34 @@ internal sealed class LiveSessionRuntimeFactory
// Default, NOT 0x1A (corrected 2026-08-09, Opus review of
// 172c6f9a). Retail types command output like @version/@loc
// green; 0x1A (bright red) is reserved for genuine refusals.
// The refusal-vs-informational split lands with CH2's producer
// rewiring (SpewBox routing) — see
// docs/research/2026-08-09-chat-retail-interface-text.md §7.2.
//
// Comment corrected 2026-08-09, CH2 REJECT-review rework
// (NIT 2, docs/research/2026-08-09-ch2-review-findings.md):
// CH2's SpewBox routing covers WeenieError/WeenieErrorWithString
// ids (see ShowWeenieError below), which carry their own
// resolved RetailLogTextType — it did NOT reach this sink,
// which takes plain pre-formatted text with no error code
// attached. Per-call-site refusal-vs-informational
// classification of this sink's callers, plus retail's
// windowId dual-destination echo (register row AP-180), remain
// unstarted — CH4/CH5 scope at the earliest, not CH2.
ShowSystemMessage:
text => _domain.Communication.Chat.OnSystemMessage(text, 0x00u),
// SHOULD-FIX 3 (docs/research/2026-08-09-ch2-review-findings.md):
// route through the AddText chokepoint instead of the deleted
// ChatLog.OnWeenieError, which hardcoded LogTextType 0x00 —
// several ShowWeenieError call sites (e.g. 0x0561, the friends-
// list-full refusal) resolve to ClientLocal and belong in the
// SpewBox, not green in chat. An id WeenieErrorMessages has no
// row for resolves to a null Text — retail's switch has no
// default case, so it produces no player-facing text.
ShowWeenieError:
code => _domain.Communication.Chat.OnWeenieError(code, null),
code =>
{
(string? text, RetailLogTextType type) = WeenieErrorMessages.Resolve(code, null);
if (text is not null)
_domain.Communication.AddText(text, type);
},
PlayerPublicWeenieBitfield: () =>
_domain.EntityObjects.Objects.Get(_player.Identity.ServerGuid)?
.PublicWeenieBitfield,

View file

@ -10,37 +10,98 @@ namespace AcDream.App.UI;
/// <c>ClickThrough</c> <see cref="UiText"/> block at a high
/// <see cref="UiElement.ZOrder"/>. Unlike that controller's single
/// overwrite-only slot, this reads <see cref="SpewBoxVM"/>'s bounded,
/// newest-on-top, per-entry-expiring queue every frame — the retained UI
/// tree has no separate per-frame "Update(dt)" hook, so
/// <see cref="UiText.LinesProvider"/> (already polled once per render pass)
/// doubles as this controller's tick source.
/// newest-on-top, per-entry-expiring queue every frame.
/// </summary>
/// <remarks>
/// <b>Position / font / colour / max-items are PLACEHOLDERS.</b> The task
/// C.7 LayoutDesc dump (<c>SpewBoxLayoutDumpDiagnostic</c>) was attempted
/// and completed EXHAUSTIVELY against the installed DAT's entire LayoutDesc
/// id range (<c>0x21000000</c>-<c>0x21000075</c>, 101 of 118 possible ids
/// populated, sanity-checked against 3 independently-known ids) and found
/// ZERO elements of class <c>0x10000016</c> anywhere — <c>gmSpewBoxUI</c> is
/// mounted directly from C++ code, not resolved from any authored
/// LayoutDesc tree, so its screen position/extent/font/colour and the
/// authored <c>MaxConcurrentItems</c> ListBox property are simply not
/// recoverable this way. See the divergence register rows this class cites
/// for each specific placeholder.
/// <b>CH2 REJECT-review rework, BLOCKER 1
/// (<c>docs/research/2026-08-09-ch2-review-findings.md</c>):</b> the
/// original landing drove the queue drain from
/// <see cref="UiText.LinesProvider"/>, which <c>UiText.OnDraw</c> only
/// calls when the element is ALREADY <c>Visible</c> — and the element
/// starts invisible, so the provider was never invoked, no line ever drew,
/// and <see cref="SpewBoxState"/>'s pending queue never drained (an
/// unbounded per-session leak). Retail's own <c>gmSpewBoxUI::Update</c>
/// drains off the UI tick (global message 3,
/// <c>UIElementManager::UseTime @0x0045CFD0</c>), not off drawing —
/// <see cref="GlobalTimeSink"/> reproduces that: it is a zero-size child
/// mounted alongside <see cref="_text"/> purely so <see cref="UiRoot"/>'s
/// per-frame <c>BroadcastGlobalUiTime</c> walk reaches it (the same
/// pattern <c>VendorUiController.DragOverGlobalTimeSink</c> uses for
/// <c>gmVendorUI::ListenToGlobalMessage</c>). <see cref="Tick"/> pulls
/// <see cref="SpewBoxVM.Lines"/>, caches the resulting lines, and sets
/// <see cref="_text"/>'s <c>Visible</c> flag; <see cref="UiText.LinesProvider"/>
/// now only ever returns the cache — it is polled by drawing, but no
/// longer double-duties as the tick source, so lines become visible and
/// the queue drains even across a frame where nothing gets drawn (headless,
/// a hidden window, or simply before the first render pass).
/// </remarks>
/// <remarks>
/// <b>Position / font / colour are still PLACEHOLDERS; extent and
/// max-items are now AUTHORED.</b> CH2 REJECT-review rework, NIT 3
/// (<c>docs/research/2026-08-09-ch2-review-findings.md</c>): the task C.7
/// LayoutDesc dump (<c>SpewBoxLayoutDumpDiagnostic</c>) originally searched
/// only <c>dats.Portal</c> — EXHAUSTIVELY, against the entire installed
/// LayoutDesc id range (<c>0x21000000</c>-<c>0x21000075</c>, 101 of 118
/// possible ids populated, sanity-checked against 3 independently-known
/// ids) — and found ZERO elements of class <c>0x10000016</c> there.
/// Extending the identical sweep to <c>dats.Local</c>
/// (<c>client_local_English.dat</c>) found it: LayoutDesc
/// <c>0x21000011</c>, element <c>0x10000048</c> (<c>gmSpewBoxUI</c>),
/// position <c>(0,0)</c> RELATIVE TO ITS PARENT (edge codes
/// <c>leftEdge=3/rightEdge=3</c> — <c>ElementReader.ToAnchors</c>'s own doc
/// comment names 3 as "centered", a mode that projection cannot represent;
/// <c>topEdge=1</c> — top-anchored per that same helper), size
/// <c>450×72</c>, one child (ListBox <c>0x10000049</c>, matching
/// <c>gmSpewBoxUI::PostInit</c>'s <c>GetChildRecursive(0x10000049)</c>
/// verbatim) carrying <c>MaxConcurrentItems</c> (property
/// <c>0x10000028</c>) = <c>4</c>, not retail's code-default <c>1</c>. The
/// PARENT this element mounts under (and therefore the ABSOLUTE screen
/// position) is still unresolved — <c>(0,0)</c> is parent-relative, and the
/// parent is presumably assigned by the same C++ code the research doc's
/// §1.1 describes, not by another LayoutDesc this sweep can walk to. See
/// the divergence register rows this class cites for each remaining
/// placeholder.
/// </remarks>
internal sealed class SpewBoxController : IDisposable
{
/// <summary>
/// Register row AP-TBD (position/extent): retail's authored screen
/// position for the SpewBox host is unknown (see class remarks); this
/// centered-top placement is acdream's own choice, not a retail value.
/// Register row AP-178 (screen position): retail's authored ABSOLUTE
/// screen position is still unknown — the LayoutDesc dump (see class
/// remarks) recovered the element's position as <c>(0,0)</c> relative
/// to a PARENT this sweep could not identify, so this centered-top
/// placement remains acdream's own choice, not a resolved retail value.
/// (The SIBLING row AP-177 — the invented line-lifetime timeout — lives
/// in <see cref="SpewBoxState.DefaultLifetime"/>'s own doc comment, not
/// here; this controller does not own that concern.)
/// </summary>
private const float TopOffset = 60f;
private const float BoxHeight = 40f;
/// <summary>
/// Register row AP-TBD (colour): the chat colour table's <c>0x1A</c>
/// entry (<c>colorBrightRed</c>) is explicitly NOT this — retail's own
/// Register row AP-178 (extent): AUTHORED, not a placeholder — the
/// LayoutDesc dump (see class remarks) found the SpewBox element sized
/// <c>450×72</c> in <c>dats.Local</c>. Retail's own edge codes
/// (<c>leftEdge=3</c>/<c>rightEdge=3</c>, "centered" per
/// <c>ElementReader.ToAnchors</c>'s doc comment) mean the box is a
/// FIXED-width block horizontally centered in its parent, not a
/// full-viewport stretch — the constructor below anchors it that way
/// (a one-time centered <see cref="UiText.Left"/> computed against
/// <see cref="UiRoot.Width"/>, <see cref="AnchorEdges.Top"/> only) since
/// <see cref="AnchorEdges"/> has no "centered, fixed-width" flag
/// combination to express retail's mode 3 directly.
/// </summary>
private const float SpewBoxWidth = 450f;
private const float SpewBoxHeight = 72f;
/// <summary>
/// Register row AP-178 (colour): retail's authored colour for THIS
/// element remains unresolved — the LayoutDesc dump (see class remarks)
/// found only two direct-state properties on the SpewBox element/ListBox
/// (a bool at <c>0x3B</c> and the <c>MaxConcurrentItems</c> integer at
/// <c>0x10000028</c>); no colour property surfaced in that direct-state
/// dump, and the per-<c>UIStateId</c> <c>States</c> dictionary (hover/
/// pressed/etc. variants, which could carry it) was not walked this
/// pass. The chat colour table's <c>0x1A</c> entry
/// (<c>colorBrightRed</c>) is explicitly NOT this — retail's own
/// <c>BuildChatColorLookupTable</c> writes to <c>ChatInterface::m_chatLog</c>,
/// a completely different element tree the SpewBox never touches
/// (research doc §3.2.3). This warm-yellow placeholder follows the
@ -53,6 +114,8 @@ internal sealed class SpewBoxController : IDisposable
private readonly UiRoot _root;
private readonly UiText _text;
private readonly SpewBoxVM _vm;
private readonly GlobalTimeSink _timeSink;
private UiText.Line[] _lines = Array.Empty<UiText.Line>();
private bool _disposed;
public SpewBoxController(UiRoot root, SpewBoxVM vm)
@ -62,43 +125,63 @@ internal sealed class SpewBoxController : IDisposable
_text = new UiText
{
Name = "SpewBox",
Left = 0f,
// Centered fixed-width block (retail's "mode 3" edge code on
// both left and right) — see the AP-178 extent comment above.
Left = (root.Width - SpewBoxWidth) / 2f,
Top = TopOffset,
Width = root.Width,
Height = BoxHeight,
Anchors = AnchorEdges.Left | AnchorEdges.Top | AnchorEdges.Right,
Width = SpewBoxWidth,
Height = SpewBoxHeight,
Anchors = AnchorEdges.Top,
Centered = true,
OneLine = true,
// AUTHORED MaxConcurrentItems is 4, not retail's code-default 1
// (see SpewBoxState.MaxConcurrentItems) — OneLine=true would
// silently collapse the box back down to showing only the
// newest of up to 4 concurrent lines.
OneLine = false,
ClickThrough = true,
ZOrder = int.MaxValue,
DefaultColor = SpewBoxColor,
Visible = false,
};
_text.LinesProvider = ComputeLines;
_text.LinesProvider = () => _lines;
_root.AddChild(_text);
_timeSink = new GlobalTimeSink(Tick);
_root.AddChild(_timeSink);
}
/// <summary>
/// Polled once per render pass by <see cref="UiText"/> — this IS the
/// SpewBox's per-frame tick (drains <c>SpewBoxState</c>'s pending queue
/// and prunes expired entries; see <see cref="SpewBoxVM.Lines"/>).
/// <see cref="SpewBoxVM.Lines"/> returns newest-first, matching retail's
/// <c>InsertItem(item, 0)</c>; <c>OneLine</c> mode only ever draws
/// index 0, so with retail's code-default
/// <c>MaxConcurrentItems == 1</c> this always shows the current line.
/// The SpewBox's per-frame tick, driven by <see cref="UiRoot"/>'s
/// global-message-3 broadcast via <see cref="GlobalTimeSink"/> — the
/// direct analogue of <c>gmSpewBoxUI::Update</c>. Drains
/// <see cref="SpewBoxState"/>'s pending queue and prunes expired
/// entries (see <see cref="SpewBoxVM.Lines"/>), caches the resulting
/// display lines, and sets <see cref="_text"/>'s visibility. Runs
/// whether or not a draw pass follows.
/// </summary>
private IReadOnlyList<UiText.Line> ComputeLines()
/// <param name="nowSeconds">
/// <see cref="UiRoot"/>'s own per-frame clock — <b>not</b>
/// <c>Environment.TickCount64</c> — matching every other
/// <see cref="IUiGlobalTimeListener"/> consumer's time source.
/// </param>
private void Tick(double nowSeconds)
{
double nowSeconds = Environment.TickCount64 / 1000.0;
// SpewBoxVM.Lines returns newest-first, matching retail's
// InsertItem(item, 0) — with OneLine now false and the AUTHORED
// MaxConcurrentItems == 4 (see SpewBoxState.MaxConcurrentItems),
// up to 4 lines render, newest on top.
IReadOnlyList<SpewBoxLine> lines = _vm.Lines(nowSeconds);
_text.Visible = lines.Count > 0;
if (lines.Count == 0)
return Array.Empty<UiText.Line>();
{
_lines = Array.Empty<UiText.Line>();
return;
}
var result = new UiText.Line[lines.Count];
for (int i = 0; i < lines.Count; i++)
result[i] = new UiText.Line(lines[i].Text, SpewBoxColor);
return result;
_lines = result;
}
public void Dispose()
@ -107,6 +190,24 @@ internal sealed class SpewBoxController : IDisposable
return;
_root.RemoveChild(_text);
_root.RemoveChild(_timeSink);
_disposed = true;
}
/// <summary>
/// A runtime-only, zero-size, always-invisible-to-hit-testing helper
/// that opts this controller into retail's global UI message 3 — see
/// the class remarks and <c>VendorUiController.DragOverGlobalTimeSink</c>
/// for the identical pattern. <see cref="SpewBoxController"/> is not
/// itself a <see cref="UiElement"/> (it wraps one), so it cannot
/// directly implement <see cref="IUiGlobalTimeListener"/> the way
/// <see cref="UiButton"/> does — <see cref="UiRoot.Tick"/>'s broadcast
/// walks the ELEMENT tree, not arbitrary controllers.
/// </summary>
private sealed class GlobalTimeSink : UiElement, IUiGlobalTimeListener
{
private readonly Action<double> _onGlobalUiTime;
public GlobalTimeSink(Action<double> onGlobalUiTime) => _onGlobalUiTime = onGlobalUiTime;
public void OnGlobalUiTime(double nowSeconds) => _onGlobalUiTime(nowSeconds);
}
}

View file

@ -248,39 +248,53 @@ public static class GameEventWiring
// Campaign CH slice CH2: retail resolves BOTH the display text and
// the AddTextToScroll destination type from the SAME per-id switch
// (ClientCommunicationSystem::HandleFailureEvent @0x00571990 — see
// WeenieErrorMessages' full 338-row port). When a router is wired
// WeenieErrorMessages' full 344-row port). When a router is wired
// (the production path), the resolved type decides chat vs SpewBox;
// otherwise this falls back to the legacy chat-only path so callers
// that don't wire the router (older tests) keep their prior shape.
// otherwise this falls back to a direct chat append so callers that
// don't wire the router (older tests) keep a working, if
// SpewBox-less, path.
//
// REJECT-review rework (SHOULD-FIX 3/4,
// docs/research/2026-08-09-ch2-review-findings.md): the legacy
// fallback no longer routes through the deleted ChatLog.OnWeenieError
// (SHOULD-FIX 3 — that chokepoint bypass is retired everywhere, not
// just at the ShowWeenieError call site) and an unmapped id resolves
// to a null Text — retail's switch has no default case, so it
// produces NO text toward the player (SHOULD-FIX 4). Both branches
// below skip display for a null Text and log the raw id instead, so
// an unmapped code stays visible to US without ever reaching chat.
registrar.Register(GameEventType.WeenieError, e =>
{
var code = GameEvents.ParseWeenieError(e.Payload.Span);
if (code is null) return;
if (WeenieErrorMessages.IsSilentClientControlStatus(code.Value)) return;
var (text, type) = WeenieErrorMessages.Resolve(code.Value, null);
if (text is null)
{
Console.WriteLine($"[weenie-error] unmapped code=0x{code.Value:X4}");
return;
}
if (onInterfaceText is not null)
{
if (WeenieErrorMessages.IsSilentClientControlStatus(code.Value)) return;
var (text, type) = WeenieErrorMessages.Resolve(code.Value, null);
onInterfaceText(text, type);
}
else
{
chat.OnWeenieError(code.Value, param: null);
}
chat.OnSystemMessage(text, chatType: (uint)type);
});
registrar.Register(GameEventType.WeenieErrorWithString, e =>
{
var p = GameEvents.ParseWeenieErrorWithString(e.Payload.Span);
if (p is null) return;
if (WeenieErrorMessages.IsSilentClientControlStatus(p.Value.ErrorCode)) return;
var (text, type) = WeenieErrorMessages.Resolve(p.Value.ErrorCode, p.Value.Interpolation);
if (text is null)
{
Console.WriteLine(
$"[weenie-error] unmapped code=0x{p.Value.ErrorCode:X4} param={p.Value.Interpolation}");
return;
}
if (onInterfaceText is not null)
{
if (WeenieErrorMessages.IsSilentClientControlStatus(p.Value.ErrorCode)) return;
var (text, type) = WeenieErrorMessages.Resolve(p.Value.ErrorCode, p.Value.Interpolation);
onInterfaceText(text, type);
}
else
{
chat.OnWeenieError(p.Value.ErrorCode, p.Value.Interpolation);
}
chat.OnSystemMessage(text, chatType: (uint)type);
});
// ── Combat ────────────────────────────────────────────────
@ -590,11 +604,27 @@ public static class GameEventWiring
+ $"err={(err is null ? "n/a" : $"0x{err.Value:X4}")}");
}
if (err is null) return;
// Already the diagnostics-only log line SHOULD-FIX 4 asks for —
// it fires unconditionally, so an unmapped code below stays
// visible to US even though it produces no player-facing text.
Console.WriteLine($"[use-done] err=0x{err.Value:X4}");
onUseDone?.Invoke(err.Value);
if (err.Value == 0) return;
// NIT 6 (docs/research/2026-08-09-ch2-review-findings.md):
// aligned with the WeenieError/WeenieErrorWithString handlers
// above, which check this before resolving. Harmless either
// way today — 0x3B/0x3C have no HandleFailureEvent case, so
// WeenieErrorMessages.Resolve already returns a null Text for
// them — but an explicit early-out here is more direct than
// relying on that coincidence, and guards against a future
// table addition accidentally making one of these two
// resolvable when retail's own switch genuinely has no case
// for either.
if (WeenieErrorMessages.IsSilentClientControlStatus(err.Value)) return;
var (text, type) = WeenieErrorMessages.Resolve(err.Value, null);
if (text is null) return;
if (onInterfaceText is not null)
onInterfaceText(text, type);
else

View file

@ -183,45 +183,20 @@ public sealed class ChatLog
});
}
/// <summary>WeenieError (0x028A) / WeenieErrorWithString (0x028B).</summary>
/// <remarks>
/// Phase I.5: previously-orphaned parser. The server fires this when a
/// game-logic action fails (e.g. "you don't have enough mana", "you
/// can't pick that up"). Routed as <see cref="ChatKind.System"/>; the
/// <c>ChannelId</c> field carries the WeenieError code so plugins can
/// filter or react. <paramref name="param"/> is the interpolated
/// substring (null for plain WeenieError, set for WeenieErrorWithString).
/// </remarks>
public void OnWeenieError(uint errorId, string? param)
{
if (WeenieErrorMessages.IsSilentClientControlStatus(errorId))
return;
// Phase I (post-launch fix): translate the wire code into the
// retail-faithful template via WeenieErrorMessages. Many codes
// are *informational* (e.g. 0x051B "You have entered the X
// channel.", 0x051D "Turbine Chat is enabled.") not errors;
// the old "WeenieError 0xNNNN" framing was misleading. Unknown
// codes still fall back to the raw "WeenieError 0xNNNN[: param]"
// form so nothing is silently lost. See
// WeenieErrorMessages.Format for the templates + lookup table.
string text = WeenieErrorMessages.Format(errorId, param);
Append(new ChatEntry(
Kind: ChatKind.System,
Sender: "",
Text: text,
SenderGuid: 0,
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 (register row AP-176);
// 0x00 (Default) matches the switch's majority behavior and is
// the safe baseline.
LogTextType = 0x00u,
});
}
// WeenieError (0x028A) / WeenieErrorWithString (0x028B) used to have a
// dedicated OnWeenieError entry point here (Phase I.5, hardcoded at
// LogTextType 0x00 pending register row AP-176). REJECT-review rework
// (SHOULD-FIX 3, docs/research/2026-08-09-ch2-review-findings.md):
// AP-176 retired at Campaign CH slice CH2 — WeenieErrorMessages.Resolve
// now resolves BOTH the display text AND the real per-code retail
// RetailLogTextType (chat vs SpewBox) from the full 344-row
// HandleFailureEvent port. Every producer of WeenieError text — the
// inbound GameEventWiring handlers AND the client-command
// ShowWeenieError sink — now resolves through WeenieErrorMessages and
// calls the AddText chokepoint (RuntimeCommunicationState.AddText /
// ChatLog.OnSystemMessage) directly instead of through a dedicated
// ChatLog method, so the single-fixed-color OnWeenieError entry point
// is deleted rather than kept as a second, narrower routing path.
/// <summary>
/// Channel broadcast — legacy <c>ChatChannel (0x0147)</c> or the

View file

@ -35,21 +35,39 @@ public readonly record struct SpewBoxEntry(string Text, double ExpiresAtSeconds)
/// Retail decouples enqueue (<c>RecvNotice_DisplayFinalStringInfo
/// @0x004D60A0</c>, type-filtered to <c>0x1A</c> only) from display
/// (<c>Update @0x004D5DF0</c>, driven once per UI tick by global message
/// <c>3</c>) by exactly one frame. <see cref="Tick"/> reproduces that: it
/// drains whatever is pending into the visible list (applying retail's
/// dedupe-against-index-0 and <c>MaxConcurrentItems</c> overflow rules) and
/// prunes expired entries, all in the caller's own per-frame cadence.
/// <c>3</c>) — NOT by exactly one frame (fixed 2026-08-09, CH2 REJECT-review
/// rework NIT 5: the earlier wording overstated this). A message that
/// arrives just before the tick fires waits ~0 frames; one that arrives
/// just after waits nearly a full frame — retail's own gap is 0-1 frames,
/// bounded by tick cadence, not a fixed one-frame delay. <see cref="Tick"/>
/// reproduces the SAME-CALL shape: it drains whatever is pending into the
/// visible list (applying retail's dedupe-against-index-0 and
/// <c>MaxConcurrentItems</c> overflow rules) and prunes expired entries in
/// one call, so a caller invoking <see cref="Enqueue"/> then immediately
/// <see cref="Tick"/> and <see cref="Snapshot"/> in the same frame sees the
/// line SAME-frame — the decoupling only shows up when the caller's own
/// tick cadence spans multiple frames, exactly like retail's.
/// </para>
/// </summary>
public sealed class SpewBoxState
{
/// <summary>
/// Retail's own code default (<c>gmSpewBoxUI::PostInit @0x004D5AB0</c>)
/// when ListBox property <c>0x10000028</c> is absent or unreadable. The
/// shipped LayoutDesc's authored value was not resolved in this slice —
/// see the divergence register.
/// The shipped LayoutDesc's AUTHORED value — no longer a placeholder.
/// CH2 REJECT-review rework, NIT 3
/// (<c>docs/research/2026-08-09-ch2-review-findings.md</c>): the
/// original C.7 sweep only searched <c>dats.Portal</c>, which has no
/// <c>0x10000016</c> (gmSpewBoxUI) element anywhere; extending the same
/// sweep to <c>dats.Local</c> (<c>client_local_English.dat</c>) found
/// it — LayoutDesc <c>0x21000011</c>, element <c>0x10000048</c>, whose
/// sole child (ListBox <c>0x10000049</c>, matching
/// <c>gmSpewBoxUI::PostInit</c>'s <c>GetChildRecursive(0x10000049)</c>
/// call verbatim) carries ListBox property <c>0x10000028</c> = the
/// integer <c>4</c>. Retail's own code default
/// (<c>gmSpewBoxUI::PostInit @0x004D5AB0</c>), used only when this
/// property is absent or unreadable, was <c>1</c> — the shipped layout
/// overrides it with <c>4</c>.
/// </summary>
public const int MaxConcurrentItems = 1;
public const int MaxConcurrentItems = 4;
/// <summary>
/// Retail's own client never raises the expiry element message

View file

@ -13,58 +13,97 @@ namespace AcDream.Core.Chat;
/// (Sept 2013 EoR build), the 339-case switch that decides BOTH the display
/// string and the <c>AddTextToScroll</c> type argument for every
/// <c>WeenieError</c>/<c>WeenieErrorWithString</c> id retail's client knows
/// about. Transcribed from
/// about. Originally transcribed from
/// <c>docs/research/2026-08-09-chat-retail-interface-text.md</c> Appendix A
/// (itself read off the named retail decomp), with the following
/// corrections made directly against
/// <c>docs/research/named-retail/acclient_2013_pseudo_c.txt</c> rather than
/// trusting the appendix's markdown transcription wholesale:
/// (itself read off the named retail decomp's ~33-char inline string
/// previews).
/// </para>
///
/// <para>
/// <b>REJECT-review rework (2026-08-09, <c>docs/research/2026-08-09-ch2-review-findings.md</c>
/// BLOCKER 2):</b> the Appendix A transcription — "enumerate <c>case</c>
/// labels, read the truncated preview" — turned out to be structurally
/// unsound: it missed 5 ids dispatched via <c>else if (arg2 == N)</c> rather
/// than a <c>case</c> label, and it silently trusted several truncated
/// previews whose full text differs materially from the 33-char prefix.
/// This rework re-derives the table MECHANICALLY: a Python sweep
/// (<c>tools/pdb-extract/sweep_weenie_strings.py</c>) walks the PE section
/// table of the PDB-paired binary (<c>C:\Users\erikn\Downloads\acclient.exe</c>,
/// verified via <c>check_exe_pdb.py</c>) and every <c>push imm32</c>
/// (opcode <c>0x68</c>) operand in VA <c>0x571990</c>-<c>0x575480</c> that
/// dereferences into <c>.rdata</c>/<c>.data</c> is read as a UTF-16LE
/// literal to its NUL terminator — the FULL string, never the pseudo-C's
/// truncated preview. Every changed row was additionally cross-checked
/// against ACE's own <c>WeenieError.cs</c>/<c>WeenieErrorWithString.cs</c>
/// enum doc comments (<c>references/ACE/Source/ACE.Entity/Enum/</c>); the
/// two independent oracles agreed on every row.
/// </para>
///
/// <list type="bullet">
/// <item>7 ids the appendix marked "no literal — shared string global"
/// <item><b>5 ids added</b> that Appendix A missed entirely because they
/// dispatch via <c>else if (arg2 == N)</c> chains ABOVE the main switch,
/// not a <c>case</c> label: <c>0x04F</c> (Magic), <c>0x3EE</c>
/// (ClientLocal), <c>0x408</c> (ClientLocal), <c>0x48A</c> (Default),
/// <c>0x4E8</c> (Default). <c>0x43</c> remains correctly absent — its
/// only retail effect is <c>ClientCombatSystem::AbortAutomaticAttack</c>,
/// no display text.</item>
/// <item><b>18 existing rows corrected</b> — the swept binary literal
/// disagreed with the previously-landed text for
/// <c>0x051</c>/<c>0x053</c>/<c>0x054</c>/<c>0x466</c>/<c>0x4A3</c>/
/// <c>0x4B5</c>/<c>0x4E0</c>/<c>0x4E9</c>/<c>0x4F7</c>/<c>0x518</c>/
/// <c>0x544</c>/<c>0x54E</c>/<c>0x552</c>/<c>0x553</c>/<c>0x554</c>/
/// <c>0x555</c>/<c>0x57F</c>/<c>0x582</c>. Two of these (<c>0x4E9</c>,
/// <c>0x518</c>) were NOT in the review's own flagged list — they surfaced
/// from an automated diff between every swept literal and the landed
/// table, confirming the review's own "sweep may find more" prediction.
/// <c>0x4E9</c> is the sharpest case: the review's own findings doc
/// proposed the wrong text for the NEW <c>0x4E8</c> row (attributing
/// <c>0x4E9</c>'s genuine text to it) — the corrected mechanical anchor
/// (the <c>else if (arg2 == 0x4e8)</c> block's OWN instruction address,
/// not proximity to a neighboring <c>case</c> label in the printed
/// listing) plus the ACE cross-check together overrule that proposal:
/// <c>0x4E8</c> = "...and only the owner may open the hook.", <c>0x4E9</c>
/// = "...use the '@house hooks on' command to make the hook openable." —
/// the previously-landed table had them reversed (0x4E9 held 0x4E8's
/// text; 0x4E8 did not exist as a row at all).</item>
/// <item><c>0x4F8</c> now resolves for real (see below) — no id is
/// deliberately excluded any more. New pinned count: 344 rows
/// (338 landed + 5 added + <c>0x4F8</c>).</item>
/// <item>7 ids Appendix A marked "no literal — shared string global"
/// (<c>0x024</c>, <c>0x048</c>, <c>0x049</c>, <c>0x4DE</c>, <c>0x4DF</c>,
/// <c>0x55A</c>, <c>0x55E</c>) were resolved by reading the case bodies
/// directly: <c>0x024</c>/<c>0x048</c>/<c>0x049</c> reuse the same
/// <c>0x55A</c>, <c>0x55E</c>) remain resolved exactly as the prior pass
/// found: <c>0x024</c>/<c>0x048</c>/<c>0x049</c> reuse the same
/// process-lifetime globals as the local jump-refusal family (see
/// <see cref="ClientTextRefusals"/>); <c>0x4DE</c>/<c>0x4DF</c> are
/// <c>arg3 + "\n"</c>; <c>0x55A</c> is <c>sprintf("%s\n", arg3)</c>;
/// <c>0x55E</c> passes <c>arg3</c> straight through with no format string
/// at all.</item>
/// <item>Appendix A's markdown table trims leading whitespace from every
/// cell, which silently ate the leading <c>" "</c> retail's
/// <c>arg3 + literal</c> CONCATENATION sites (as opposed to a real
/// <c>sprintf("%s...")</c> site) depend on. 19 ids
/// (<c>0x02B</c>, <c>0x3EF</c>, <c>0x46A</c>, <c>0x4CE</c>, <c>0x4CF</c>,
/// <c>0x4F7</c>, <c>0x4F9</c>, <c>0x4FA</c>, <c>0x4FF</c>, <c>0x509</c>,
/// <c>0x50B</c>, <c>0x50C</c>, <c>0x50D</c>, <c>0x517</c>, <c>0x518</c>,
/// <c>0x51E</c>, <c>0x521</c>, <c>0x522</c>) were fixed by re-reading their
/// case bodies and prepending the <c>%s</c> the concatenation implies.
/// Several of these (and the <c>%s</c>-prefixed but truncated
/// <c>0x4F4</c>-<c>0x4F6</c>, <c>0x530</c>, <c>0x534</c>, <c>0x53E</c>,
/// <c>0x541</c>, <c>0x543</c>, <c>0x54B</c>, <c>0x562</c>, <c>0x56D</c>,
/// <c>0x57A</c>, <c>0x57B</c>, <c>0x580</c>) were also truncated by the
/// pseudo-C's ~33-char inline preview; the full text was recovered from a
/// SECOND, non-truncated <c>data_XXXXXXXX</c> dump elsewhere in the same
/// oracle file — reading the oracle again, not guessing.</item>
/// <item><c>0x4F4</c>'s retail literal is
/// <c>"%s fails to affect you because $s cannot affect anyone!"</c> —
/// note <c>$s</c>, not <c>%s</c>, for the second placeholder. That is a
/// genuine retail typo/bug (only the first <c>%s</c> substitutes; the
/// literal <c>$s</c> prints as-is) and is preserved verbatim rather than
/// corrected, per the "the client is probably right" rule.</item>
/// <item><c>0x4F7</c>'s retail string is itself incomplete — it
/// concatenates <c>arg3</c> with a literal that dangles on
/// <c>"...as "</c> with no closing word. Confirmed via exact byte-count
/// against the declared array size (not a display artifact); preserved
/// verbatim.</item>
/// <item><c>0x4F8</c> could not be resolved with confidence — its case
/// body is a tangled multi-<c>operator+</c> concatenation chain full of
/// decompiler self-referential artifacts (see
/// <c>claude-memory/feedback_bn_decomp_field_names.md</c>). Deliberately
/// EXCLUDED from the table rather than guessed; falls back to the generic
/// <c>WeenieError 0xNNNN[: param]</c> form like any other unmapped id.
/// </item>
/// corrected, per the "the client is probably right" rule. <c>0x04F</c>
/// preserves the same <c>$s</c> typo pattern.</item>
/// <item><c>0x4F7</c>'s retail string is a normal, COMPLETE
/// <c>arg3 + literal</c> concatenation — "%s fails to affect you because
/// you are not a player killer!" — with no dangling text. The prior
/// pass's class-doc claim that <c>0x4F7</c>'s literal "dangles" was a
/// misattribution of <c>0x4F8</c>'s FIRST operand (which does end
/// mid-clause, on "...as ", by design — see <c>0x4F8</c> below), not a
/// genuine truncation in <c>0x4F7</c> itself.</item>
/// <item><c>0x4F8</c> resolves cleanly once traced correctly: its case
/// body concatenates <c>arg3 + " fails to affect you because you are not
/// the same sort of player killer as " + arg3 + "!\n"</c> across three
/// <c>operator+</c> calls whose decompiled operand names are BN
/// self-referential artifacts (see
/// <c>claude-memory/feedback_bn_decomp_field_names.md</c>) — the sweep's
/// direct dereference of both literal data pointers
/// (<c>data_7d2ee8</c> = <c>" fails to affect you because you are not the
/// same sort of player killer as "</c>, <c>data_7d2f80</c> =
/// <c>"!\n"</c>) resolves the ambiguity without needing to trust the
/// confusing decompiler naming. Both <c>%s</c> placeholders take the SAME
/// parameter (retail only has one <c>arg3</c> to substitute twice).</item>
/// </list>
///
/// <para>
@ -106,16 +145,31 @@ public static class WeenieErrorMessages
/// <param name="errorCode">The wire error code.</param>
/// <param name="param">The interpolated substring (null for plain
/// <c>WeenieError</c>, set for <c>WeenieErrorWithString</c>).</param>
public static string Format(uint errorCode, string? param) => Resolve(errorCode, param).Text;
/// <returns>
/// The retail display text, or <see langword="null"/> for an id
/// <c>HandleFailureEvent</c>'s switch has no case for — see
/// <see cref="Resolve"/>.
/// </returns>
public static string? Format(uint errorCode, string? param) => Resolve(errorCode, param).Text;
/// <summary>
/// Resolve a WeenieError / WeenieErrorWithString code into its retail
/// display text AND the retail <see cref="RetailLogTextType"/> it routes
/// to. Unmapped codes fall back to the raw
/// <c>WeenieError 0xNNNN[: param]</c> form at
/// <see cref="RetailLogTextType.Default"/> so nothing is silently lost.
/// to.
/// </summary>
public static (string Text, RetailLogTextType Type) Resolve(uint errorCode, string? param)
/// <remarks>
/// CH2 REJECT-review rework, SHOULD-FIX 4
/// (<c>docs/research/2026-08-09-ch2-review-findings.md</c>): retail's
/// <c>HandleFailureEvent</c> switch has NO <c>default:</c> case — an id
/// it does not recognize produces NO text at all, silently, toward the
/// player. The prior pass's <c>WeenieError 0xNNNN[: param]</c> hex
/// fallback was acdream's own invention with no retail counterpart (an
/// unregistered divergence). Callers must treat a <see langword="null"/>
/// <c>Text</c> as "retail shows nothing here" and skip display entirely;
/// they should still log the raw id to a diagnostics-only sink so an
/// unmapped code is not silently invisible to US, only to the player.
/// </remarks>
public static (string? Text, RetailLogTextType Type) Resolve(uint errorCode, string? param)
{
if (Table.TryGetValue(errorCode, out Entry entry))
{
@ -125,17 +179,17 @@ public static class WeenieErrorMessages
return (text, entry.Type);
}
string fallback = string.IsNullOrEmpty(param)
? $"WeenieError 0x{errorCode:X4}"
: $"WeenieError 0x{errorCode:X4}: {param}";
return (fallback, RetailLogTextType.Default);
return (null, RetailLogTextType.Default);
}
/// <summary>
/// The full retail routing table, transcribed from
/// <c>ClientCommunicationSystem::HandleFailureEvent @0x00571990</c> (338
/// of its 339 cases — see the class doc comment for the one deliberate
/// exclusion and every correction made against the raw decomp).
/// <c>ClientCommunicationSystem::HandleFailureEvent @0x00571990</c> — 344
/// rows (338 landed at the prior pass + 5 ids the prior pass's
/// case-label enumeration missed + <c>0x4F8</c>, which now resolves for
/// real; every id the switch dispatches has a row here). See the class
/// doc comment for the binary-sweep + ACE cross-check methodology and
/// every correction made against it.
/// </summary>
private static readonly Dictionary<uint, Entry> Table = new()
{
@ -162,11 +216,20 @@ public static class WeenieErrorMessages
[0x04Au] = new("Ack! You killed yourself!", RetailLogTextType.Default),
[0x04Du] = new("Invalid PK status!", RetailLogTextType.ClientLocal),
[0x04Eu] = new("You fail to affect %s because you cannot affect anyone!", RetailLogTextType.Magic),
// 0x04F added — BLOCKER2: else-if dispatch (arg2 == 0x4f), missed by
// the prior case-label enumeration. Preserves retail's own $s typo,
// same pattern as 0x4F4.
[0x04Fu] = new("You fail to affect %s because $s cannot be harmed!", RetailLogTextType.Magic),
[0x050u] = new("You fail to affect %s because beneficial spells do not affect %s!", RetailLogTextType.Magic),
[0x051u] = new("You fail to affect %s because you cannot affect anyone!", RetailLogTextType.Magic),
// 0x051/0x053/0x054 corrected — BLOCKER2: the prior pass copied
// 0x04E's/0x053's template across all four "You fail to affect"
// Magic-family ids; each is in fact a DISTINCT retail literal.
[0x051u] = new("You fail to affect %s because you are not a player killer!", RetailLogTextType.Magic),
[0x052u] = new("You fail to affect %s because %s is not a player killer!", RetailLogTextType.Magic),
[0x053u] = new("You fail to affect %s because you cannot affect anyone!", RetailLogTextType.Magic),
[0x054u] = new("You fail to affect %s because you cannot affect anyone!", RetailLogTextType.Magic),
[0x053u] = new("You fail to affect %s because you are not the same sort of player killer as %s!", RetailLogTextType.Magic),
[0x054u] = new("You fail to affect %s because you are acting across a house boundary!", RetailLogTextType.Magic),
// 0x3EE added — BLOCKER2: else-if dispatch (arg2 == 0x3ee).
[0x3EEu] = new("The container is closed!", RetailLogTextType.ClientLocal),
[0x3EFu] = new("%s is not accepting gifts right now.", RetailLogTextType.Default),
[0x3F1u] = new("You failed to go to non-combat mode.", RetailLogTextType.ClientLocal),
[0x3F7u] = new("You are too fatigued to attack!", RetailLogTextType.ClientLocal),
@ -181,6 +244,10 @@ public static class WeenieErrorMessages
[0x403u] = new("Your spell's target is missing!", RetailLogTextType.ClientLocal),
[0x404u] = new("Your projectile spell mislaunched!", RetailLogTextType.ClientLocal),
[0x407u] = new("Your spell cannot be cast outside", RetailLogTextType.ClientLocal),
// 0x408 added — BLOCKER2: else-if dispatch (arg2 == 0x408), sibling
// of 0x407 above (both lack trailing punctuation in retail's own
// literal — not a display artifact).
[0x408u] = new("Your spell cannot be cast inside", RetailLogTextType.ClientLocal),
[0x40Au] = new("You are unprepared to cast a spell", RetailLogTextType.ClientLocal),
[0x40Bu] = new("You've already sworn your Allegiance", RetailLogTextType.ClientLocal),
[0x40Cu] = new("You don't have enough experience available to swear Allegiance", RetailLogTextType.ClientLocal),
@ -215,7 +282,10 @@ public static class WeenieErrorMessages
[0x45Du] = new("Non-player killers may not interact with that portal!", RetailLogTextType.Magic),
[0x45Eu] = new("You do not own a house!", RetailLogTextType.ClientLocal),
[0x45Fu] = new("You do not own a house!", RetailLogTextType.ClientLocal),
[0x466u] = new("You must purchase Asheron's Call -- Dark Majesty to use this function.", RetailLogTextType.Magic),
// 0x466 corrected — BLOCKER2: retail's colon-separated "Asheron's
// Call: Dark Majesty..." wording, distinct from the "--"-separated
// Throne of Destiny family at 0x552-0x555 below.
[0x466u] = new("You must purchase Asheron's Call: Dark Majesty to interact with that portal.", RetailLogTextType.Magic),
[0x469u] = new("You have used all the hooks you are allowed to use for this house.", RetailLogTextType.Default),
[0x46Au] = new("%s doesn't know what to do with that.", RetailLogTextType.Default),
[0x474u] = new("You must complete a quest to interact with that portal.", RetailLogTextType.Magic),
@ -225,6 +295,8 @@ public static class WeenieErrorMessages
[0x482u] = new("Your monarch has closed the mansion to the Allegiance.", RetailLogTextType.ClientLocal),
[0x488u] = new("You must be above level %s to purchase this dwelling.", RetailLogTextType.Default),
[0x489u] = new("You must be at or below level %s to purchase this dwelling.", RetailLogTextType.Default),
// 0x48A added — BLOCKER2: else-if dispatch (arg2 == 0x48a).
[0x48Au] = new("You must be a monarch to purchase this dwelling.", RetailLogTextType.Default),
[0x48Bu] = new("You must be above allegiance rank %s to purchase this dwelling.", RetailLogTextType.Default),
[0x48Cu] = new("You must be at or below allegiance rank %s to purchase this dwelling.", RetailLogTextType.Default),
[0x48Eu] = new("Your offer of Allegiance has been ignored.", RetailLogTextType.ClientLocal),
@ -248,7 +320,9 @@ public static class WeenieErrorMessages
[0x4A0u] = new("You fail to link with the portal!", RetailLogTextType.Magic),
[0x4A1u] = new("You successfully link with the portal!", RetailLogTextType.Magic),
[0x4A2u] = new("You fail to recall to the portal!", RetailLogTextType.Magic),
[0x4A3u] = new("You must have linked with a portal in order to summon it!", RetailLogTextType.Magic),
// 0x4A3 corrected — BLOCKER2: retail's real text is about RECALL,
// not summon (0x4A5 below is the genuine "summon it" sibling).
[0x4A3u] = new("You must have linked with a portal in order to recall to it!", RetailLogTextType.Magic),
[0x4A4u] = new("You fail to summon the portal!", RetailLogTextType.Magic),
[0x4A5u] = new("You must have linked with a portal in order to summon it!", RetailLogTextType.Magic),
[0x4A6u] = new("You fail to teleport!", RetailLogTextType.Magic),
@ -265,7 +339,9 @@ public static class WeenieErrorMessages
[0x4B2u] = new("The key doesn't fit this lock.", RetailLogTextType.Default),
[0x4B3u] = new("The lock has been used too recently.", RetailLogTextType.ClientLocal),
[0x4B4u] = new("You aren't trained in lockpicking!", RetailLogTextType.ClientLocal),
[0x4B5u] = new("You must specify a character to boot.", RetailLogTextType.ClientLocal),
// 0x4B5 corrected — BLOCKER2: distinct from 0x491's genuine "boot"
// wording (0x4B5 is the allegiance-query variant).
[0x4B5u] = new("You must specify a character to query.", RetailLogTextType.ClientLocal),
[0x4B6u] = new("Please use the allegiance panel to view your own information.", RetailLogTextType.ClientLocal),
[0x4B7u] = new("You have used that command too recently.", RetailLogTextType.ClientLocal),
[0x4B8u] = new("You do not own that salvage tool!", RetailLogTextType.Default),
@ -303,7 +379,12 @@ public static class WeenieErrorMessages
[0x4DDu] = new("You have failed to alter your attributes.", RetailLogTextType.Default),
[0x4DEu] = new("%s", RetailLogTextType.Default),
[0x4DFu] = new("%s", RetailLogTextType.Default),
[0x4E0u] = new("You are currently wielding items which require a certain level of %s. Your %s skill cannot be lowered while you are wielding these items. Please remove these items and try again.", RetailLogTextType.Default),
// 0x4E0 corrected — BLOCKER2: the prior pass copied 0x4D5's
// "skill cannot be lowered" template; retail's genuine 0x4E0 text is
// about ATTRIBUTES not transferring, a distinct sibling to 0x4DD
// ("failed to alter your attributes") and 0x4E1 ("succeeded in
// transferring your attributes!").
[0x4E0u] = new("You are currently wielding items which require a certain level of skill. Your attributes cannot be transferred while you are wielding these items. Please remove these items and try again.", RetailLogTextType.Default),
[0x4E1u] = new("You have succeeded in transferring your attributes!", RetailLogTextType.Default),
[0x4E2u] = new("This hook is a duplicated housing object. You may not add items to a duplicated housing object. Please empty the hook and allow it to reset.", RetailLogTextType.Default),
[0x4E3u] = new("That item is of the wrong type to be placed on this hook.", RetailLogTextType.Default),
@ -311,7 +392,15 @@ public static class WeenieErrorMessages
[0x4E5u] = new("This hook was a duplicated housing object. Since it is now empty, it will be deleted momentarily. Once it is gone, it is safe to use the other, non-duplicated hook that is here.", RetailLogTextType.Default),
[0x4E6u] = new("This chest was a duplicated housing object. Since it is now empty, it will be deleted momentarily. Once it is gone, it is safe to use the other, non-duplicated chest that is here.", RetailLogTextType.Default),
[0x4E7u] = new("You cannot swear allegiance to anyone because you own a monarch-only house. Please abandon your house and try again.", RetailLogTextType.Default),
[0x4E9u] = new("The %s cannot be used while on a hook and only the owner may open the hook.", RetailLogTextType.Default),
// 0x4E8 added — BLOCKER2: else-if dispatch (arg2 == 0x4e8), anchored
// on that branch's OWN instruction address (not proximity to a
// neighboring case label — see the class doc comment's 0x4E9 note).
[0x4E8u] = new("The %s cannot be used while on a hook and only the owner may open the hook.", RetailLogTextType.Default),
// 0x4E9 corrected — BLOCKER2: the prior pass gave this row 0x4E8's
// text (the two are easy to conflate — near-duplicate wording for
// adjacent ids). Confirmed against ACE's ItemUnusableOnHook_CanOpen
// (0x04E9) doc comment.
[0x4E9u] = new("The %s cannot be used while on a hook, use the '@house hooks on' command to make the hook openable.", RetailLogTextType.Default),
[0x4EAu] = new("The %s can only be used while on a hook.", RetailLogTextType.Default),
[0x4EBu] = new("You can't do that while in the air!", RetailLogTextType.ClientLocal),
[0x4ECu] = new("You cannot modify your player killer status while you are recovering from a PK death.", RetailLogTextType.Default),
@ -325,8 +414,17 @@ public static class WeenieErrorMessages
[0x4F4u] = new("%s fails to affect you because $s cannot affect anyone!", RetailLogTextType.Magic),
[0x4F5u] = new("%s fails to affect you because you cannot be harmed!", RetailLogTextType.Magic),
[0x4F6u] = new("%s fails to affect you because %s is not a player killer!", RetailLogTextType.Magic),
[0x4F7u] = new("%s fails to affect you because you are not the same sort of player killer as", RetailLogTextType.Magic),
// 0x4F8 deliberately excluded — see the class doc comment.
// 0x4F7 corrected — BLOCKER2: this is a COMPLETE, ordinary
// concatenation, not the dangling literal the prior pass's class
// doc misattributed to it (that "..as " dangle belongs to 0x4F8,
// its first operand — see the class doc comment).
[0x4F7u] = new("%s fails to affect you because you are not a player killer!", RetailLogTextType.Magic),
// 0x4F8 added — BLOCKER2: previously deliberately excluded pending
// a confident trace of its 3-operator+ concatenation chain; the
// binary sweep's direct dereference of both literal data pointers
// (data_7d2ee8 + data_7d2f80) resolves it. Both %s placeholders
// substitute the SAME parameter (retail only has one arg3).
[0x4F8u] = new("%s fails to affect you because you are not the same sort of player killer as %s!", RetailLogTextType.Magic),
[0x4F9u] = new("%s fails to affect you across a house boundary!", RetailLogTextType.Magic),
[0x4FAu] = new("%s is an invalid target.", RetailLogTextType.Magic),
[0x4FBu] = new("You are an invalid target for the spell of %s.", RetailLogTextType.Magic),
@ -357,7 +455,14 @@ public static class WeenieErrorMessages
[0x515u] = new("You no longer have the maximum number of %s hooked. You may hook additional %s.", RetailLogTextType.Default),
[0x516u] = new("You are not permitted to use that hook.", RetailLogTextType.Default),
[0x517u] = new("%s is not close enough to your level.", RetailLogTextType.Default),
[0x518u] = new("%s cannot be recruited into the fellowship.", RetailLogTextType.Default),
// 0x518 corrected — BLOCKER2: not in the review's flagged list;
// surfaced from an automated diff between the swept binary
// literals and the landed table. Retail's real text is a 3-part
// concatenation ("This fellowship is locked; " + arg3 + " cannot be
// recruited into the fellowship."), not the arg3-only fragment
// previously landed. Confirmed against ACE's
// LockedFellowshipCannotRecruit_ (0x0518) doc comment.
[0x518u] = new("This fellowship is locked; %s cannot be recruited into the fellowship.", RetailLogTextType.Default),
[0x519u] = new("The fellowship is locked, you were not added to the fellowship.", RetailLogTextType.Default),
[0x51Au] = new("Only the original owner may use that item's magic.", RetailLogTextType.ClientLocal),
[0x51Bu] = new("You have entered the %s channel.", RetailLogTextType.Default),
@ -398,7 +503,10 @@ public static class WeenieErrorMessages
[0x541u] = new("%s is now an allegiance officer.", RetailLogTextType.Default),
[0x542u] = new("An unspecified error occurred while attempting to set %s as an allegiance officer.", RetailLogTextType.Default),
[0x543u] = new("%s is no longer an allegiance officer.", RetailLogTextType.Default),
[0x544u] = new("An unspecified error occurred while attempting to set %s as an allegiance officer.", RetailLogTextType.Default),
// 0x544 corrected — BLOCKER2: retail's genuine text says REMOVE, not
// SET (0x542 above is the genuine "set" sibling); the prior pass
// duplicated 0x542's template here.
[0x544u] = new("An unspecified error occurred while attempting to remove %s as an allegiance officer.", RetailLogTextType.Default),
[0x545u] = new("You already have the maximum number of allegiance officers. You must remove some before you add any more.", RetailLogTextType.Default),
[0x546u] = new("Your allegiance officers have been cleared.", RetailLogTextType.Default),
[0x547u] = new("You must wait %s before communicating again!", RetailLogTextType.Default),
@ -408,14 +516,24 @@ public static class WeenieErrorMessages
[0x54Bu] = new("%s is already an allegiance officer of that level.", RetailLogTextType.Default),
[0x54Cu] = new("Your allegiance does not have a hometown.", RetailLogTextType.Default),
[0x54Du] = new("The %s is currently in use.", RetailLogTextType.ClientLocal),
[0x54Eu] = new("The hook does not contain a usable item. Use the '@house hooks on'command to make the hook openable.", RetailLogTextType.Default),
// 0x54E corrected — BLOCKER2: retail's genuine 0x54E text is the
// "you do not own the house" variant, distinct from 0x54F's
// "@house hooks on" variant the prior pass duplicated onto both ids.
[0x54Eu] = new("The hook does not contain a usable item. You cannot open the hook because you do not own the house to which it belongs.", RetailLogTextType.Default),
[0x54Fu] = new("The hook does not contain a usable item. Use the '@house hooks on'command to make the hook openable.", RetailLogTextType.Default),
[0x550u] = new("Out of Range!", RetailLogTextType.ClientLocal),
[0x551u] = new("You are not listening to the %s channel!", RetailLogTextType.Default),
[0x552u] = new("You must purchase Asheron's Call -- Dark Majesty to use this function.", RetailLogTextType.ClientLocal),
[0x553u] = new("You must purchase Asheron's Call -- Dark Majesty to use this function.", RetailLogTextType.ClientLocal),
[0x554u] = new("You must purchase Asheron's Call -- Dark Majesty to use this function.", RetailLogTextType.ClientLocal),
[0x555u] = new("You must purchase Asheron's Call -- Dark Majesty to use this function.", RetailLogTextType.ClientLocal),
// 0x552-0x555 corrected — BLOCKER2: the prior pass copied 0x49A's
// "Dark Majesty...to use this function." template across all four
// ids. Retail's genuine family is the "--"-separated Throne of
// Destiny expansion, each with its OWN distinct ending
// (function/item/portal/quest) — not four identical strings.
// Confirmed against ACE's MustPurchaseThroneOfDestinyToUseFunction/
// ToUseItem/ToUsePortal/ToAccessQuest (0x0552-0x0555) doc comments.
[0x552u] = new("You must purchase Asheron's Call -- Throne of Destiny to use this function.", RetailLogTextType.ClientLocal),
[0x553u] = new("You must purchase Asheron's Call -- Throne of Destiny to use this item.", RetailLogTextType.ClientLocal),
[0x554u] = new("You must purchase Asheron's Call -- Throne of Destiny to use this portal.", RetailLogTextType.ClientLocal),
[0x555u] = new("You must purchase Asheron's Call -- Throne of Destiny to access this quest.", RetailLogTextType.ClientLocal),
[0x556u] = new("You have failed to complete the augmentation.", RetailLogTextType.Default),
[0x557u] = new("You have used this augmentation too many times already.", RetailLogTextType.Default),
[0x558u] = new("You have used augmentations of this type too many times already.", RetailLogTextType.Default),
@ -457,10 +575,16 @@ public static class WeenieErrorMessages
[0x57Cu] = new("You have cleared the pre-approved vassal for your allegiance.", RetailLogTextType.Default),
[0x57Du] = new("That character is already gagged!", RetailLogTextType.Default),
[0x57Eu] = new("That character is not currently gagged!", RetailLogTextType.Default),
[0x57Fu] = new("Your allegiance chat privileges have been restored.", RetailLogTextType.Default),
// 0x57F corrected — BLOCKER2: 0x581's "restored" text was
// incorrectly duplicated here; 0x57F is the "removed" notice, the
// sibling that fires when privileges are taken away, not restored.
[0x57Fu] = new("Your allegiance chat privileges have been temporarily removed by %s. Until they are restored, you may not view or speak in the allegiance chat channel.", RetailLogTextType.Default),
[0x580u] = new("%s is now temporarily unable to view or speak in allegiance chat. The gag will run out in 5 minutes, or %s may be explicitly ungagged before then.", RetailLogTextType.Default),
[0x581u] = new("Your allegiance chat privileges have been restored.", RetailLogTextType.Default),
[0x582u] = new("Your allegiance chat privileges have been restored.", RetailLogTextType.Default),
// 0x582 corrected — BLOCKER2: 0x581's unparameterized text was
// incorrectly duplicated here; 0x582 is the %s-parameterized
// sibling ("...restored BY %s.").
[0x582u] = new("Your allegiance chat privileges have been restored by %s.", RetailLogTextType.Default),
[0x583u] = new("You have restored allegiance chat privileges to %s.", RetailLogTextType.Default),
[0x584u] = new("You cannot pick up more of that item!", RetailLogTextType.ClientLocal),
[0x585u] = new("You are restricted to clothes and armor created for your race.", RetailLogTextType.ClientLocal),

View file

@ -227,9 +227,17 @@ internal sealed class HeadlessGameplayOperations
// Opus review of 172c6f9a). Same ClientCommandController-output
// category as ChatVM.ShowSystemMessage; retail types the great
// majority of that output green, reserving 0x1A (bright red) for
// genuine refusals. The refusal-vs-informational split lands with
// CH2's producer rewiring (SpewBox routing) — see
// docs/research/2026-08-09-chat-retail-interface-text.md §7.2.
// genuine refusals.
//
// Comment corrected 2026-08-09, CH2 REJECT-review rework (NIT 2,
// docs/research/2026-08-09-ch2-review-findings.md): CH2's SpewBox
// routing covers WeenieError/WeenieErrorWithString ids, which carry
// their own resolved RetailLogTextType — it did NOT reach this sink,
// which takes plain pre-formatted text with no error code attached.
// Per-call-site refusal-vs-informational classification of this
// sink's callers, plus retail's windowId dual-destination echo
// (register row AP-180), remain unstarted — CH4/CH5 scope at the
// earliest, not CH2.
public void DisplayMessage(string message) =>
RequireRuntime().CommunicationOwner.Chat.OnSystemMessage(
message,

View file

@ -158,20 +158,31 @@ public sealed class RuntimeCommunicationState : IDisposable
/// with <paramref name="type"/> exactly as before.</item>
/// </list>
/// <paramref name="windowId"/> is accepted for future parity with
/// retail's per-window echo (a non-zero window ID lands in both the
/// SpewBox AND that specific chat window — research doc §2.3) but is
/// not yet consumed; every current production caller passes the
/// default <c>0</c>.
/// retail's per-window echo (a non-zero window ID lands in BOTH the
/// SpewBox AND that specific chat window, ~40 slash-command-output
/// sites — research doc §2.3) but is not yet consumed; every current
/// production caller passes the default <c>0</c>. This dual-destination
/// gap is filed as register row AP-180 — implementing it is CH4/CH5
/// scope at the earliest.
/// </remarks>
public void AddText(string text, RetailLogTextType type, uint windowId = 0)
{
ArgumentNullException.ThrowIfNull(text);
// Retail's own first step (0x00563C50): trim trailing whitespace
// before anything else, regardless of destination.
text = text.TrimEnd();
if (text.Length == 0)
return;
// CH2 REJECT-review rework (SHOULD-FIX 2,
// docs/research/2026-08-09-ch2-review-findings.md): retail's own
// first step (ClientSystem::AddTextToScroll @0x00563C50) is
// trim(&str, 1, 1, ws) — BOTH ends, not trailing-only (the
// trailing-only trim in research doc §3.1 belongs to
// gmSpewBoxUI::Update, a SEPARATE later call on the SpewBox's own
// display path, not this chokepoint). Retail also has no empty-
// string guard here — AddTextToScroll broadcasts empty strings
// deliberately (the type-7/Magic s_NullBuffer sites reuse a shared
// buffer that can legitimately be empty between calls); inventing
// an early-return for empty text was an unregistered acdream-only
// divergence, now retired rather than kept as a guessed
// approximation.
text = text.Trim();
if (type == RetailLogTextType.ClientLocal)
{

View file

@ -315,7 +315,24 @@ public sealed class RuntimeGenerationReset
state.Stage = RuntimeGenerationResetStage.ChatIdentity;
break;
case RuntimeGenerationResetStage.ChatIdentity:
Advance(state, _communication.ResetChatIdentity);
// CH2 REJECT-review rework (SHOULD-FIX 1,
// docs/research/2026-08-09-ch2-review-findings.md):
// RuntimeCommunicationState.ResetSpewBox was dead code —
// no caller reset the transient SpewBox queue at
// generation boundaries even though ResetChatIdentity
// (the chat transcript's identity/dedup reset) already
// ran here every generation. They share this stage
// because they're the same lifetime boundary — a fresh
// generation must not resurrect a stale refusal line —
// even though they differ in WHAT they reset:
// ResetChatIdentity preserves the visible transcript,
// ResetSpewBox clears it (see RuntimeCommunicationState's
// own doc comments on each).
Advance(state, () =>
{
_communication.ResetChatIdentity();
_communication.ResetSpewBox();
});
break;
case RuntimeGenerationResetStage.PlayerSnapshots:
Advance(state, _inventory.ResetPlayerSnapshots);

View file

@ -118,9 +118,24 @@ public sealed class ChatVM : IDisposable
/// general-purpose output — @version, /loc, friends list, usage lines —
/// and retail types the great majority of that informational command
/// output <c>0x00</c>, reserving <c>0x1A</c> (bright red) for genuine
/// refusals/errors. The refusal-vs-informational split lands with CH2's
/// producer rewiring (SpewBox routing) — see
/// <c>docs/research/2026-08-09-chat-retail-interface-text.md</c> §7.2.
/// refusals/errors.
/// </remarks>
/// <remarks>
/// <b>Comment corrected 2026-08-09, CH2 REJECT-review rework (NIT 2,
/// docs/research/2026-08-09-ch2-review-findings.md):</b> the earlier
/// wording claimed the refusal-vs-informational split "lands with CH2's
/// producer rewiring" — it did not. CH2's SpewBox routing covers
/// <c>WeenieError</c>/<c>WeenieErrorWithString</c> ids, which carry their
/// own resolved <c>RetailLogTextType</c>; this sink takes plain
/// pre-formatted TEXT with no error code attached, so
/// <c>WeenieErrorMessages</c> has nothing to classify here. Per-call-site
/// classification of THIS sink's callers (which specific
/// <c>ClientCommandController</c> lines are genuine refusals retail
/// would type <c>0x1A</c>) remains unstarted, and even a classified
/// caller would still need retail's <c>windowId</c> dual-destination
/// echo (see register row AP-180) to land in both the SpewBox and the
/// command's originating chat window — out of scope for CH4/CH5, not
/// CH2.
/// </remarks>
public void ShowSystemMessage(string text) => _log.OnSystemMessage(text, chatType: 0x00u);