fix(chat): Campaign CH round 3 — SpewBox flush-top/font, /help exact print sequence
User-gate round 3 findings (a)-(c):
(a) SpewBox: TopOffset moves from the round-1 60px placeholder to 0 (flush
to the viewport top). SpewBoxController never wired DatFont/Font at all
before this round, so it silently rendered through the 15px debug
BitmapFont fallback; it now resolves retail dat Font 0x40000025
(MaxCharHeight=11px) through a new RetailUiRuntime.Assets accessor —
the smallest font id confirmed in use by any currently-imported retail
LayoutDesc fixture, cross-referenced against every
tests/AcDream.App.Tests/UI/Layout/fixtures/*.json dump and confirmed
against the installed DAT via AcDream.Cli dump-font-atlas. It is also the
chat window's own smallest font (the 0x2100006F floating-window 1/2/3/4
indicator badges), so both selection criteria the brief offered agree.
Both remain best-available approximations, not resolved retail values —
register row AP-178 updated accordingly.
(b)/(c) /help and /help death: round 2 extracted the individual retail
strings byte-exact but never traced ClientCommunicationSystem::DoHelp's
complete print sequence. Byte-swept DoHelp's own range plus the five
Summary-branch functions it calls into (HelpEmote/HelpSquelch/
HelpStatusGroup/HelpTextGroup/HelpAllGroup) against the PDB-paired
acclient.exe. Retail's real shape: bare /help prints exactly TWO scroll
entries (HelpPrefixNote, then the 13-item AvailableHelpListing built from
DoHelp's own literals and each group's Summary_HelpType branch, in exact
source order) — not the acdream-invented cheat sheet BuildHelpText()
built before. Any resolved /help <verb> gets the SAME two-entry shape:
HelpPrefixNote, then ForMoreInformationPrefix concatenated directly onto
the verb's own Detail text (retail's own unsubstituted "<command>"
literal, ported verbatim). ChatCommandRouter.EmitVerbHelp applies this
uniformly to every resolved verb, not just death. An unresolved verb now
shows retail's real "Unknown command" fallback text; that fallback types
0x1A (ClientLocal), which retail routes to the SpewBox exclusively — a
gap ChatVM's UI.Abstractions layer can't yet reach, filed as ISSUES #367
/ register AP-186 rather than left silently unregistered.
Jump-in-air (round 2's open item 1) was root-caused and fixed separately
at a5a7eb4f between rounds — recorded in the campaign ledger.
Debug suite (all projects): 12,329 passed / 4 skipped / 1 failed — the
one failure is issue #351, a pre-existing Debug-only streaming flake
confirmed reproducing identically on the pristine pre-round-3 commit via
git stash, not a regression. Release verification covers every project
reachable without rebuilding AcDream.App: a live client process (PID
15064) held its own Release binaries locked for the session and was not
killed per project policy — AcDream.UI.Abstractions.Tests (867/867, the
layer both /help fixes live in) plus every other non-App-dependent
project, all 0 failed. AcDream.App/AcDream.App.Tests/AcDream.Core.Tests
(the SpewBox fix's layer) are green in Debug only this session.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
a5a7eb4fb6
commit
98de4f5ab3
14 changed files with 665 additions and 105 deletions
|
|
@ -1,6 +1,8 @@
|
|||
using System.Collections.Generic;
|
||||
using AcDream.App.UI;
|
||||
using AcDream.Core.Chat;
|
||||
using AcDream.UI.Abstractions.Panels.SpewBox;
|
||||
using DatReaderWriter.Types;
|
||||
|
||||
namespace AcDream.App.Tests.UI;
|
||||
|
||||
|
|
@ -175,4 +177,79 @@ public sealed class SpewBoxControllerTests
|
|||
|
||||
Assert.Empty(root.Children);
|
||||
}
|
||||
|
||||
// ── Campaign CH user-gate round 3 (2026-08-10), finding (a) ─────────
|
||||
|
||||
[Fact]
|
||||
public void Construction_MountsFlushToTheViewportTop()
|
||||
{
|
||||
// The user reported the box "still not aligned all the way to the
|
||||
// top" — TopOffset moved from the round-1 60px placeholder to 0.
|
||||
var root = new UiRoot { Width = 1280f, Height = 720f };
|
||||
using var controller = new SpewBoxController(root, new SpewBoxVM(new SpewBoxState()));
|
||||
|
||||
UiText text = Assert.IsType<UiText>(root.Children.OfType<UiText>().Single());
|
||||
Assert.Equal(0f, text.Top);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Tick_KeepsTopFlushAndRecentersX_AcrossAResize()
|
||||
{
|
||||
var root = new UiRoot { Width = 1280f, Height = 720f };
|
||||
var state = new SpewBoxState();
|
||||
using var controller = new SpewBoxController(root, new SpewBoxVM(state));
|
||||
|
||||
state.Enqueue("resize me");
|
||||
root.Tick(dt: 0d, nowMs: 1000L);
|
||||
|
||||
UiText text = Assert.IsType<UiText>(root.Children.OfType<UiText>().Single());
|
||||
float widthBefore = root.Width;
|
||||
Assert.Equal((widthBefore - 450f) / 2f, text.Left);
|
||||
Assert.Equal(0f, text.Top);
|
||||
|
||||
// Simulate a window resize, then the next per-frame tick.
|
||||
root.Width = 1920f;
|
||||
root.Tick(dt: 0d, nowMs: 1016L);
|
||||
|
||||
Assert.Equal((1920f - 450f) / 2f, text.Left);
|
||||
Assert.Equal(0f, text.Top); // top offset never depends on width
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Construction_WithResolvedRetailFont_WiresDatFontOntoTheText()
|
||||
{
|
||||
// Campaign CH user-gate round 3: the retail dat font (id
|
||||
// SpewBoxController.RetailFontId) is now actually WIRED, where
|
||||
// before the controller never set DatFont/Font at all and silently
|
||||
// fell through to the render context's default debug font.
|
||||
var root = new UiRoot { Width = 1280f, Height = 720f };
|
||||
var font = new UiDatFont(
|
||||
fgTex: 1, fgW: 64, fgH: 64,
|
||||
bgTex: 0, bgW: 0, bgH: 0,
|
||||
lineHeight: 11f, baselineOffset: 9f,
|
||||
glyphs: new Dictionary<char, FontCharDesc>());
|
||||
|
||||
using var controller = new SpewBoxController(
|
||||
root, new SpewBoxVM(new SpewBoxState()), font, debugFont: null);
|
||||
|
||||
UiText text = Assert.IsType<UiText>(root.Children.OfType<UiText>().Single());
|
||||
Assert.Same(font, text.DatFont);
|
||||
Assert.Equal(11f, text.DatFont!.LineHeight);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Construction_WithoutAResolvedFont_FallsBackToTheSuppliedDebugFont()
|
||||
{
|
||||
// No installed-DAT font available (e.g. headless) -- the debug
|
||||
// bitmap font parameter is still wired through, matching every
|
||||
// other retained-UI controller's dat-font/debug-font pattern.
|
||||
var root = new UiRoot { Width = 1280f, Height = 720f };
|
||||
|
||||
using var controller = new SpewBoxController(
|
||||
root, new SpewBoxVM(new SpewBoxState()), font: null, debugFont: null);
|
||||
|
||||
UiText text = Assert.IsType<UiText>(root.Children.OfType<UiText>().Single());
|
||||
Assert.Null(text.DatFont);
|
||||
Assert.Null(text.Font);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -237,6 +237,11 @@ public class ChatCommandRouterTests
|
|||
Assert.Contains(log.Snapshot(), entry => entry.Text.Contains("Returns you to the last lifestone"));
|
||||
}
|
||||
|
||||
// Campaign CH user-gate round 3 (2026-08-10), finding (c): a resolved
|
||||
// verb prints retail's DoHelp SHAPE, not just its content — the SAME
|
||||
// HelpPrefixNote entry every /help path prints, then a SECOND entry
|
||||
// that is ForMoreInformationPrefix concatenated directly onto the
|
||||
// verb's own detail text (no blank line, no separate third entry).
|
||||
[Theory]
|
||||
[InlineData("/help mr", "@mr <text> - Sends the text to the last person who used @m to send you a message. This only works for monarchs.")]
|
||||
[InlineData("/help pr", "@pr <text> - Sends the text to the last vassal who used @p to send you a message.")]
|
||||
|
|
@ -251,18 +256,47 @@ public class ChatCommandRouterTests
|
|||
var outcome = ChatCommandRouter.Submit(input, vm, bus, ChatChannelKind.Say);
|
||||
|
||||
Assert.Equal(SubmitOutcome.ClientHandled, outcome);
|
||||
Assert.Contains(log.Snapshot(), entry => entry.Text == expected);
|
||||
var entries = log.Snapshot();
|
||||
Assert.Equal(2, entries.Length);
|
||||
Assert.Equal(RetailCommandHelpTable.HelpPrefixNote, entries[0].Text);
|
||||
Assert.Equal(RetailCommandHelpTable.ForMoreInformationPrefix + expected, entries[1].Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HelpVerb_UnknownVerb_ShowsFallbackMessage()
|
||||
public void HelpVerb_UnknownVerb_ShowsRetailUnknownCommandText()
|
||||
{
|
||||
// Campaign CH user-gate round 3 (2026-08-10): retail's own DoHelp
|
||||
// fallback text is "Unknown command" (swept verbatim), not an
|
||||
// acdream-invented "No help available" message. Retail types this
|
||||
// 0x1A (ClientLocal / SpewBox-only); ChatVM has no SpewBox routing
|
||||
// capability yet (ISSUES.md #367), so it still lands in the chat
|
||||
// scroll here as ONE entry (no HelpPrefixNote wrapper — DoHelp's
|
||||
// fallback bypasses the two-entry shape entirely).
|
||||
var (vm, log, bus) = Fixture();
|
||||
|
||||
var outcome = ChatCommandRouter.Submit("/help nonsenseverb", vm, bus, ChatChannelKind.Say);
|
||||
|
||||
Assert.Equal(SubmitOutcome.ClientHandled, outcome);
|
||||
Assert.Empty(bus.Published);
|
||||
Assert.Contains(log.Snapshot(), entry => entry.Text.Contains("No help available"));
|
||||
var entry = Assert.Single(log.Snapshot());
|
||||
Assert.Equal(RetailCommandHelpTable.UnknownCommand, entry.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void HelpBare_ShowsRetailTwoEntryShape()
|
||||
{
|
||||
// Campaign CH user-gate round 3 (2026-08-10), finding (b): bare
|
||||
// /help must emit retail's real two-entry sequence (Note, then the
|
||||
// 13-item "Available help:" listing) — not the previous
|
||||
// acdream-invented single-blob cheat sheet.
|
||||
var (vm, log, bus) = Fixture();
|
||||
|
||||
var outcome = ChatCommandRouter.Submit("/help", vm, bus, ChatChannelKind.Say);
|
||||
|
||||
Assert.Equal(SubmitOutcome.ClientHandled, outcome);
|
||||
var entries = log.Snapshot();
|
||||
Assert.Equal(2, entries.Length);
|
||||
Assert.Equal(RetailCommandHelpTable.HelpPrefixNote, entries[0].Text);
|
||||
Assert.Equal(RetailCommandHelpTable.AvailableHelpListing, entries[1].Text);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -22,10 +22,15 @@ public sealed class ChatPanelInputTests
|
|||
public void Submit_HelpCommand_RendersLocalHelpAndDoesNotPublish()
|
||||
{
|
||||
// Phase J follow-up: client-side commands (/help, /?, /h) are
|
||||
// intercepted before the parser. They render a local cheat-sheet
|
||||
// via ChatLog.OnSystemMessage and do NOT round-trip the server
|
||||
// — that's what prevented the "Unknown command: help" duplicate
|
||||
// ACE was firing back.
|
||||
// intercepted before the parser. They render local text via
|
||||
// ChatLog.OnSystemMessage and do NOT round-trip the server — that's
|
||||
// what prevented the "Unknown command: help" duplicate ACE was
|
||||
// firing back.
|
||||
//
|
||||
// Campaign CH user-gate round 3 (2026-08-10): retail's DoHelp
|
||||
// prints via exactly TWO scroll entries (Note, then the 13-item
|
||||
// "Available help:" listing), never one acdream-invented blob — see
|
||||
// RetailCommandHelpTable's class remarks for the full trace.
|
||||
var log = new ChatLog();
|
||||
var vm = new ChatVM(log);
|
||||
var panel = new ChatPanel(vm);
|
||||
|
|
@ -39,12 +44,11 @@ public sealed class ChatPanelInputTests
|
|||
panel.Render(new PanelContext(0.016f, bus), renderer);
|
||||
|
||||
Assert.Empty(bus.Published);
|
||||
var entry = Assert.Single(log.Snapshot());
|
||||
Assert.Equal(ChatKind.System, entry.Kind);
|
||||
// Help text mentions / and @ equivalence and points at @acehelp
|
||||
// for the server's full command list.
|
||||
Assert.Contains("/tell", entry.Text);
|
||||
Assert.Contains("@acehelp", entry.Text);
|
||||
var entries = log.Snapshot();
|
||||
Assert.Equal(2, entries.Length);
|
||||
Assert.All(entries, entry => Assert.Equal(ChatKind.System, entry.Kind));
|
||||
Assert.Equal(AcDream.UI.Abstractions.Panels.Chat.RetailCommandHelpTable.HelpPrefixNote, entries[0].Text);
|
||||
Assert.Equal(AcDream.UI.Abstractions.Panels.Chat.RetailCommandHelpTable.AvailableHelpListing, entries[1].Text);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
|
|
@ -67,7 +71,7 @@ public sealed class ChatPanelInputTests
|
|||
panel.Render(new PanelContext(0.016f, bus), renderer);
|
||||
|
||||
Assert.Empty(bus.Published);
|
||||
Assert.Single(log.Snapshot());
|
||||
Assert.Equal(2, log.Snapshot().Length);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
|
|
|
|||
|
|
@ -165,4 +165,99 @@ public sealed class RetailCommandHelpTableTests
|
|||
Assert.True(RetailCommandHelpTable.TryGetHelpText(verb, out string text));
|
||||
Assert.Equal(expected, text);
|
||||
}
|
||||
|
||||
// ── Campaign CH user-gate round 3 (2026-08-10) ──────────────────────
|
||||
// The round 2 pass extracted the individual STRINGS byte-exact; this
|
||||
// round traces DoHelp's complete PRINT SEQUENCE — see the class
|
||||
// remarks. These pin the newly-swept literals byte-exact against
|
||||
// tools/pdb-extract/sweep_weenie_strings.py's output.
|
||||
|
||||
[Fact]
|
||||
public void HelpPrefixNote_HasRetailsLeadingAndTrailingBlankLines()
|
||||
{
|
||||
// acclient_2013_pseudo_c.txt:394980 (data_0x7e11e0) -- the original
|
||||
// round-2 extraction dropped the leading "\n" and the trailing
|
||||
// "\n\n" that are part of retail's own literal.
|
||||
Assert.Equal(
|
||||
"\nNote: You may substitute a forward slash (/) for the at symbol (@).\n\n",
|
||||
RetailCommandHelpTable.HelpPrefixNote);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ForMoreInformationPrefix_KeepsRetailsUnsubstitutedPlaceholderVerbatim()
|
||||
{
|
||||
// acclient_2013_pseudo_c.txt:395087 (data_0x7e1178) -- "<command>"
|
||||
// is retail's own literal text, not a format placeholder acdream
|
||||
// failed to substitute; the decomp shows no sprintf/substitution
|
||||
// call between this literal and its use.
|
||||
Assert.Equal(
|
||||
"For more information, type @help <command>.\n",
|
||||
RetailCommandHelpTable.ForMoreInformationPrefix);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void UnknownCommand_MatchesRetailsExactFallbackText()
|
||||
{
|
||||
Assert.Equal("Unknown command", RetailCommandHelpTable.UnknownCommand);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AvailableHelpListing_MatchesDoHelpsCompleteThirteenItemSequence()
|
||||
{
|
||||
// acclient_2013_pseudo_c.txt:395091-395249 (DoHelp bare-arg "else"
|
||||
// branch), swept whole via sweep_weenie_strings.py --range
|
||||
// 0x57f9e0 0x57fe7e --ascii-only against the PDB-paired
|
||||
// C:\Users\erikn\Downloads\acclient.exe (verified MATCH). Exact
|
||||
// source order: header, then allegiances/channels/chatting/death/
|
||||
// emote/fillcomps/friends/house/squelch/status/text/commands.
|
||||
Assert.Equal(
|
||||
"Available help:\n"
|
||||
+ "@help allegiances - Commands to help you deal with your Allegiance.\n"
|
||||
+ "@help channels - How to communicate with people in your allegiance or fellowship.\n"
|
||||
+ "@help chatting - How to chat publically and privately.\n"
|
||||
+ "@help death - Commands for making, finding, and looting corpses.\n"
|
||||
+ "@help emote - How to perform text and action emotes.\n"
|
||||
+ "@help fillcomps - A command to help you buy components in bulk.\n"
|
||||
+ "@help friends - Commands to help you manage your friends list.\n"
|
||||
+ "@help house - Commands that help you manage your house, including guest and storage management.\n"
|
||||
+ "@help squelch - Commands that let you block out messages from other players.\n"
|
||||
+ "@help status - Commands that display useful information.\n"
|
||||
+ "@help text - Commands that help you manage your text window.\n"
|
||||
+ "@help commands - Lists all commands.\n",
|
||||
RetailCommandHelpTable.AvailableHelpListing);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DeathGroup_ThroughRouter_PrintsRetailsCompleteTwoEntryShape()
|
||||
{
|
||||
// Campaign CH user-gate round 3, finding (c): "/help death"'s
|
||||
// CONTENT was already byte-exact (round 2); what was still wrong
|
||||
// was the SHAPE. Retail's DoHelp prints two scroll entries for any
|
||||
// resolved verb: HelpPrefixNote, then ForMoreInformationPrefix
|
||||
// concatenated directly onto the verb's own Detail text (no blank
|
||||
// line, no third entry). Exercised at the router level (not just
|
||||
// the table) so this is the actual /help death user experience,
|
||||
// not merely the table's stored string.
|
||||
var log = new AcDream.Core.Chat.ChatLog();
|
||||
var vm = new ChatVM(log, displayLimit: 50);
|
||||
var bus = new RecordingCommandBus();
|
||||
|
||||
var outcome = ChatCommandRouter.Submit(
|
||||
"/help death", vm, bus, ChatChannelKind.Say);
|
||||
|
||||
Assert.Equal(SubmitOutcome.ClientHandled, outcome);
|
||||
var entries = log.Snapshot();
|
||||
Assert.Equal(2, entries.Length);
|
||||
Assert.Equal(RetailCommandHelpTable.HelpPrefixNote, entries[0].Text);
|
||||
Assert.Equal(
|
||||
RetailCommandHelpTable.ForMoreInformationPrefix
|
||||
+ RetailCommandHelpTable.DeathGroupDetail,
|
||||
entries[1].Text);
|
||||
}
|
||||
|
||||
private sealed class RecordingCommandBus : ICommandBus
|
||||
{
|
||||
public List<object> Published { get; } = new();
|
||||
public void Publish<T>(T command) where T : notnull => Published.Add(command);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue