feat(chat): Campaign CH slice CH2 — retail SpewBox interface text
Retail routes on-screen refusals ("You can't jump while in the air",
"You are too encumbered to carry that!") through a SEPARATE transient
screen surface (gmSpewBoxUI, ClientSystem::AddTextToScroll @0x00563C50)
that never touches the chat scroll — type 0x1A is exactly the bit every
ChatInterface window's default filter excludes
(ChatInterface::ChatInterface @0x004F4550). acdream had no such split:
every WeenieError rendered in chat at a single stand-in LogTextType
0x00 (CH1-era approximation, register AP-176), and locally-detected
jump refusals were silently discarded.
This slice ports the full mechanism per
docs/research/2026-08-09-chat-retail-interface-text.md:
CORE (AcDream.Core/Chat):
- WeenieErrorMessages.Resolve now returns (text, RetailLogTextType) from
a 338-row transcription of ClientCommunicationSystem::HandleFailureEvent
@0x00571990 (Appendix A's 339 cases minus one, 0x4F8, deliberately
excluded — its case body is a tangled decompiler artifact, not
resolvable with confidence). Spot-checked ~20 rows directly against
the raw decomp (case 0x2b/0x36/0x3a/0x4e/0x4ec/0x4f3/0x4f4 and the
jump family), beyond the ~10 the brief asked for, because the first
pass surfaced two transcription classes the research doc's markdown
silently ate: (1) 7 ids marked "shared string global" resolved by
reading the case bodies directly (0x24/0x48/0x49 reuse the jump-
refusal globals; 0x4DE/0x4DF/0x55A/0x55E are pure param passthrough);
(2) 19 "arg3 + literal" CONCATENATION ids whose leading space (and
therefore their %s marker) the markdown table's cell-trimming ate —
fixed by re-reading each case body, several requiring a SECOND
non-truncated data_XXXXXXXX dump elsewhere in the same oracle file to
recover text the ~33-char inline preview cut off. One retail typo is
preserved verbatim: 0x4F4's second placeholder is literal "$s", not
"%s" — only the first substitutes.
- ClientTextRefusals: the 11 process-lifetime string globals, all
byte-recovered from the PDB-paired C:\Users\erikn\Downloads\acclient.exe
(MATCH verified via check_exe_pdb.py) via raw UTF-16LE prefix search —
5 were truncated in the research doc's own transcription and all 5
turned out to end "...combat mode"/"...this position", not the
shorter "...combat" a truncated read would suggest.
- SpewBoxState: the gmSpewBoxUI pending/visible queue port (insert-at-0,
dedupe-against-index-0-only, MaxConcurrentItems overflow, per-entry
expiry, one-frame enqueue/drain decoupling). Placed in Core (not
Runtime as the brief's default) because AcDream.UI.Abstractions
references Core but not Runtime, and SpewBoxVM needs to wrap it
directly — the same constraint ChatVM already satisfies against
ChatLog.
- Folded the 4-entry WeenieErrorText.cs into the full table; deleted it.
RUNTIME (AcDream.Runtime):
- RuntimeCommunicationState.AddText(text, type, windowId): the
AddTextToScroll chokepoint. type == ClientLocal -> SpewBox only, never
chat; everything else -> the existing transcript, tagged with type.
- GameEventWiring gains an `onInterfaceText` delegate hole (Core.Net
cannot reference Runtime, so this follows the file's own established
pattern for every other Runtime-owned sink). Rewires 0x028A/0x028B/
UseDone through the full table + router; fixes 0x02EB
CommunicationTransientString's routing type from a CH1-era 0x00
guess to retail's hardcoded ClientLocal (Handle_Communication__
TransientString @0x0057D460).
- LiveSessionEventRouter's 0xF7E0 ServerMessage handler now routes
through AddText with the wire chatType verbatim instead of always
writing ChatLog directly.
- PlayerMovementController gains OnInterfaceText, applied by
RuntimeLocalPlayerMovementState to every controller it installs.
Reports ChargeJump/jump refusals exactly as ClientCombatSystem::
CommenceJump @0x0056AF90 / DoJump @0x0056B110 do — confirmed via
their compiled dispatch that ONLY 0x24/0x48/0x49 produce text;
0x47 (GeneralMovementFailure, fully-constrained/no-stamina) and any
other code are retail-SILENT (DoJump's jump table has exactly 4 real
targets), which contradicts this task's brief ("0x47 -> the
constrained/stamina row per §4.2") — the brief's reading of §4.2
described what jump_is_allowed COMPUTES, not what CommenceJump/DoJump
DISPLAY for it. Implemented the decomp-verified silent behavior.
APP (AcDream.App / AcDream.UI.Abstractions):
- The 5 composition sites that already used RetailLogTextType.ClientLocal
now call Communication.AddText instead of Chat.OnSystemMessage
directly, so they reach the SpewBox instead of the transcript.
- SpewBoxVM (UI.Abstractions) + SpewBoxController (App), modeled
directly on PortalWaitNoticeController. Position/font/colour/
MaxConcurrentItems are placeholders: SpewBoxLayoutDumpDiagnostic
exhaustively swept the installed client_portal.dat's entire LayoutDesc
id range (0x21000000-0x21000075, 101/118 ids populated, sanity-checked
against 3 known ids) and found ZERO elements of class 0x10000016 —
gmSpewBoxUI is mounted from C++ code, not any authored LayoutDesc, so
the dump cannot recover these values.
REGISTER: AP-176 retired (its WeenieError half is now the full table
port); its OnCombatLine half was never in this slice's scope and is
split out to AP-179 so that divergence keeps a row. AP-177 (invented
line lifetime) and AP-178 (invented position/font/colour/max-items)
filed for the presentation placeholders above. AP-175 (PopUpString ->
chat instead of modal) is untouched, not duplicated.
Suite: 11,890 passed / 4 skipped / 0 failed (was 11,835/4/0; +55 net
new tests, 0 regressions).
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
parent
0fa4554759
commit
77c8296e3f
28 changed files with 2144 additions and 224 deletions
File diff suppressed because one or more lines are too long
|
|
@ -345,7 +345,7 @@ internal sealed class RetailInteractionRetainedUiCompositionFactory
|
|||
d.Actions.Selection.SelectedObjectId ?? 0u,
|
||||
stackSplitQuantity: d.StackSplitQuantity,
|
||||
systemMessage:
|
||||
text => d.Communication.Chat.OnSystemMessage(text, (uint)RetailLogTextType.ClientLocal),
|
||||
text => d.Communication.AddText(text, RetailLogTextType.ClientLocal),
|
||||
sendPutItemInContainer: (item, container, placement) =>
|
||||
session.CurrentSession?.SendPutItemInContainer(
|
||||
item,
|
||||
|
|
@ -415,7 +415,7 @@ internal sealed class RetailInteractionRetainedUiCompositionFactory
|
|||
target,
|
||||
spellId),
|
||||
displayMessage:
|
||||
text => d.Communication.Chat.OnSystemMessage(text, (uint)RetailLogTextType.ClientLocal),
|
||||
text => d.Communication.AddText(text, RetailLogTextType.ClientLocal),
|
||||
incrementBusy: itemInteraction.IncrementBusyCount,
|
||||
canSend: () => late.Session.IsInWorld);
|
||||
|
||||
|
|
@ -753,7 +753,7 @@ internal sealed class RetailInteractionRetainedUiCompositionFactory
|
|||
iconComposer.GetIcon,
|
||||
itemInteraction,
|
||||
d.Actions.Selection,
|
||||
text => d.Communication.Chat.OnSystemMessage(text, (uint)RetailLogTextType.ClientLocal)),
|
||||
text => d.Communication.AddText(text, RetailLogTextType.ClientLocal)),
|
||||
Cursor: new RetailUiCursorBindings(cursorFeedback, cursorManager),
|
||||
Confirmations: new ConfirmationRuntimeBindings(
|
||||
(type, context, accepted) =>
|
||||
|
|
@ -768,7 +768,7 @@ internal sealed class RetailInteractionRetainedUiCompositionFactory
|
|||
item,
|
||||
inscription),
|
||||
text =>
|
||||
d.Communication.Chat.OnSystemMessage(text, (uint)RetailLogTextType.ClientLocal)),
|
||||
d.Communication.AddText(text, RetailLogTextType.ClientLocal)),
|
||||
StackSplitQuantity: d.StackSplitQuantity,
|
||||
Plugins: d.UiRegistry,
|
||||
Persistence: persistence,
|
||||
|
|
|
|||
|
|
@ -28,6 +28,7 @@ using AcDream.Core.World;
|
|||
using AcDream.Runtime;
|
||||
using AcDream.Runtime.Entities;
|
||||
using AcDream.Runtime.World;
|
||||
using AcDream.UI.Abstractions.Panels.SpewBox;
|
||||
using DatReaderWriter;
|
||||
using DatReaderWriter.DBObjs;
|
||||
using Silk.NET.Windowing;
|
||||
|
|
@ -1074,6 +1075,19 @@ internal sealed class LivePresentationCompositionPhase
|
|||
portalWaitNoticeLease is { } waitNoticeLease
|
||||
? waitNoticeLease.Resource.Set
|
||||
: null;
|
||||
// Campaign CH slice CH2: the SpewBox is retail's OTHER on-screen
|
||||
// interface-text surface (research doc §1.1/§7.3/§7.4) — modeled
|
||||
// directly on the PortalWaitNoticeController lease immediately
|
||||
// above, wired into the same retained-UI host.
|
||||
if (interaction.RetainedUi is { } spewBoxRetainedUi)
|
||||
{
|
||||
scope.Acquire(
|
||||
"spew box",
|
||||
() => new SpewBoxController(
|
||||
spewBoxRetainedUi.Host.Root,
|
||||
new SpewBoxVM(d.Runtime.CommunicationOwner.SpewBox)),
|
||||
static value => value.Dispose());
|
||||
}
|
||||
CompositionAcquisitionScope.CompositionAcquisitionLease<
|
||||
PortalTunnelPresentation>? portalTunnelLease = null;
|
||||
// Campaign V slice V6m: portal space opens a backbuffer pass of its
|
||||
|
|
|
|||
|
|
@ -1125,7 +1125,7 @@ internal sealed class SessionPlayerCompositionPhase
|
|||
d.Actions.CombatMode,
|
||||
d.Log,
|
||||
debugToast,
|
||||
text => d.Communication.Chat.OnSystemMessage(text, (uint)RetailLogTextType.ClientLocal));
|
||||
text => d.Communication.AddText(text, RetailLogTextType.ClientLocal));
|
||||
bindings.Adopt(
|
||||
"live combat-mode commands",
|
||||
d.CombatModeCommands.BindOwned(combatCommand));
|
||||
|
|
|
|||
|
|
@ -257,7 +257,8 @@ internal sealed class LiveSessionRuntimeFactory
|
|||
_domain.Communication.Chat,
|
||||
_domain.Communication.TurbineChat,
|
||||
_domain.Communication.Friends,
|
||||
_domain.Communication.Squelch));
|
||||
_domain.Communication.Squelch,
|
||||
(text, type) => _domain.Communication.AddText(text, type)));
|
||||
return new GraphicalSessionEventRoute(
|
||||
route,
|
||||
_domain.Runtime,
|
||||
|
|
|
|||
112
src/AcDream.App/UI/SpewBoxController.cs
Normal file
112
src/AcDream.App/UI/SpewBoxController.cs
Normal file
|
|
@ -0,0 +1,112 @@
|
|||
using System.Numerics;
|
||||
using AcDream.UI.Abstractions.Panels.SpewBox;
|
||||
|
||||
namespace AcDream.App.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Retained presentation of retail's <c>gmSpewBoxUI</c> (research doc
|
||||
/// §1.1/§7.3/§7.4) — the transient top-of-viewport interface-text queue.
|
||||
/// Modeled directly on <see cref="PortalWaitNoticeController"/>: a single
|
||||
/// <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.
|
||||
/// </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.
|
||||
/// </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.
|
||||
/// </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
|
||||
/// <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
|
||||
/// user's own recollection of the retail SpewBox's colour (unconfirmed
|
||||
/// by any decompiled or DAT-authored source) rather than an arbitrary
|
||||
/// choice.
|
||||
/// </summary>
|
||||
private static readonly Vector4 SpewBoxColor = new(1f, 1f, 0.4f, 1f);
|
||||
|
||||
private readonly UiRoot _root;
|
||||
private readonly UiText _text;
|
||||
private readonly SpewBoxVM _vm;
|
||||
private bool _disposed;
|
||||
|
||||
public SpewBoxController(UiRoot root, SpewBoxVM vm)
|
||||
{
|
||||
_root = root ?? throw new ArgumentNullException(nameof(root));
|
||||
_vm = vm ?? throw new ArgumentNullException(nameof(vm));
|
||||
_text = new UiText
|
||||
{
|
||||
Name = "SpewBox",
|
||||
Left = 0f,
|
||||
Top = TopOffset,
|
||||
Width = root.Width,
|
||||
Height = BoxHeight,
|
||||
Anchors = AnchorEdges.Left | AnchorEdges.Top | AnchorEdges.Right,
|
||||
Centered = true,
|
||||
OneLine = true,
|
||||
ClickThrough = true,
|
||||
ZOrder = int.MaxValue,
|
||||
DefaultColor = SpewBoxColor,
|
||||
Visible = false,
|
||||
};
|
||||
_text.LinesProvider = ComputeLines;
|
||||
_root.AddChild(_text);
|
||||
}
|
||||
|
||||
/// <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.
|
||||
/// </summary>
|
||||
private IReadOnlyList<UiText.Line> ComputeLines()
|
||||
{
|
||||
double nowSeconds = Environment.TickCount64 / 1000.0;
|
||||
IReadOnlyList<SpewBoxLine> lines = _vm.Lines(nowSeconds);
|
||||
_text.Visible = lines.Count > 0;
|
||||
if (lines.Count == 0)
|
||||
return Array.Empty<UiText.Line>();
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed)
|
||||
return;
|
||||
|
||||
_root.RemoveChild(_text);
|
||||
_disposed = true;
|
||||
}
|
||||
}
|
||||
|
|
@ -87,6 +87,15 @@ public static class GameEventWiring
|
|||
// itemMana/friends/squelch/externalContainers pattern — optional so
|
||||
// every existing caller compiles unchanged.
|
||||
VendorState? vendor = null,
|
||||
// Campaign CH slice CH2: the retail-faithful text/type router
|
||||
// (RuntimeCommunicationState.AddText — Core.Net cannot reference
|
||||
// AcDream.Runtime directly, so this is a delegate hole exactly like
|
||||
// every other Runtime-owned sink above). When null, WeenieError/
|
||||
// WeenieErrorWithString/CommunicationTransientString/UseDone fall
|
||||
// back to their pre-CH2 behavior (still text-correct via the full
|
||||
// WeenieErrorMessages table, just without the SpewBox split) so
|
||||
// every existing caller compiles and behaves unchanged.
|
||||
Action<string, RetailLogTextType>? onInterfaceText = null,
|
||||
Func<bool>? accepting = null)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(dispatcher);
|
||||
|
|
@ -117,15 +126,22 @@ public static class GameEventWiring
|
|||
});
|
||||
registrar.Register(GameEventType.CommunicationTransientString, e =>
|
||||
{
|
||||
// 0x02EB carries no chat type on the wire (see ParseTransient).
|
||||
// 0 is ACE's ChatMessageType.Broadcast, which its own
|
||||
// LogTextTypeEnumMapper comment names "Default" — the right
|
||||
// stand-in for a message the server sends untyped. Left at 0x00
|
||||
// by Campaign CH slice CH1 (retail color table): this is
|
||||
// server-driven text, not client-local, so it keeps the
|
||||
// Default/green color rather than moving to 0x1A.
|
||||
// 0x02EB carries no chat type on the wire (see ParseTransient) —
|
||||
// retail doesn't need one, because
|
||||
// Handle_Communication__TransientString @0x0057D460
|
||||
// HARDCODES the destination:
|
||||
// AddTextToScroll(text, 0x1A, 1, 0). Every 0x02EB message is
|
||||
// SpewBox, unconditionally, regardless of who's the recipient
|
||||
// (research doc §1.3/§2.4) — this corrects Campaign CH slice
|
||||
// CH1's routing note, which assumed "server-driven" implied
|
||||
// "not client-local" (it doesn't; retail's routing key is the
|
||||
// TYPE ARGUMENT the handler passes, not who initiated the text).
|
||||
var s = GameEvents.ParseTransient(e.Payload.Span);
|
||||
if (s is not null) chat.OnSystemMessage(s, chatType: 0u);
|
||||
if (s is null) return;
|
||||
if (onInterfaceText is not null)
|
||||
onInterfaceText(s, RetailLogTextType.ClientLocal);
|
||||
else
|
||||
chat.OnSystemMessage(s, chatType: (uint)RetailLogTextType.ClientLocal);
|
||||
});
|
||||
registrar.Register(GameEventType.PopupString, e =>
|
||||
{
|
||||
|
|
@ -227,16 +243,44 @@ public static class GameEventWiring
|
|||
// Phase I.5: WeenieError + WeenieErrorWithString parsers existed
|
||||
// (GameEvents.ParseWeenieError(WithString)) but were never registered.
|
||||
// The server fires these for game-logic failures: "not enough mana",
|
||||
// "can't pick that up", "your spell fizzled". Routed to chat.
|
||||
// "can't pick that up", "your spell fizzled".
|
||||
//
|
||||
// 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
|
||||
// (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.
|
||||
registrar.Register(GameEventType.WeenieError, e =>
|
||||
{
|
||||
var code = GameEvents.ParseWeenieError(e.Payload.Span);
|
||||
if (code is not null) chat.OnWeenieError(code.Value, param: null);
|
||||
if (code is null) 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);
|
||||
}
|
||||
});
|
||||
registrar.Register(GameEventType.WeenieErrorWithString, e =>
|
||||
{
|
||||
var p = GameEvents.ParseWeenieErrorWithString(e.Payload.Span);
|
||||
if (p is not null) chat.OnWeenieError(p.Value.ErrorCode, p.Value.Interpolation);
|
||||
if (p is null) 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);
|
||||
}
|
||||
});
|
||||
|
||||
// ── Combat ────────────────────────────────────────────────
|
||||
|
|
@ -527,10 +571,15 @@ public static class GameEventWiring
|
|||
});
|
||||
|
||||
// UseDone (0x01C7) — the Use/UseWithTarget completion signal. A non-zero
|
||||
// code is a WeenieError refusal ("You are not trained in healing!" etc.);
|
||||
// retail surfaces the string-table text as a chat line. Interim text map:
|
||||
// WeenieErrorText (#202 / register AP-74). Without this line a refused
|
||||
// kit-heal looks like "nothing happened" — the 2026-07-03 session bug.
|
||||
// code is a WeenieError refusal ("You are not trained in healing!" etc.).
|
||||
//
|
||||
// Campaign CH slice CH2: folds the former 4-entry
|
||||
// WeenieErrorText.cs (#202 / register AP-74) into the full
|
||||
// WeenieErrorMessages table, which resolves both the text AND the
|
||||
// real per-code retail destination type (most UseDone refusal codes
|
||||
// — 0x1D/0x4EB/0x4FC/0x4FE among them — route to the SpewBox, not
|
||||
// chat, per HandleFailureEvent) instead of the previous hardcoded
|
||||
// chatType 0.
|
||||
registrar.Register(GameEventType.UseDone, e =>
|
||||
{
|
||||
uint? err = GameEvents.ParseUseDone(e.Payload.Span);
|
||||
|
|
@ -543,12 +592,13 @@ public static class GameEventWiring
|
|||
if (err is null) return;
|
||||
Console.WriteLine($"[use-done] err=0x{err.Value:X4}");
|
||||
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)
|
||||
chat.OnSystemMessage(WeenieErrorText.For(err.Value), chatType: 0);
|
||||
if (err.Value == 0) return;
|
||||
|
||||
var (text, type) = WeenieErrorMessages.Resolve(err.Value, null);
|
||||
if (onInterfaceText is not null)
|
||||
onInterfaceText(text, type);
|
||||
else
|
||||
chat.OnSystemMessage(text, chatType: (uint)type);
|
||||
});
|
||||
|
||||
// CloseGroundContainer (0x0052): clear ClientUISystem::groundObject and
|
||||
|
|
|
|||
|
|
@ -1,23 +0,0 @@
|
|||
namespace AcDream.Core.Net.Messages;
|
||||
|
||||
/// <summary>
|
||||
/// Interim WeenieError → display text. Retail resolves error codes through
|
||||
/// the portal String tables into lines like "You are not trained in
|
||||
/// healing!"; porting that lookup is #202 — until then this map (codes from
|
||||
/// ACE's <c>WeenieError</c> enum, texts phrased after the retail messages the
|
||||
/// enum names encode) covers the errors our current use/heal flows can
|
||||
/// produce. Register row AP-74. Unknown codes fall back to a generic line
|
||||
/// carrying the code so nothing is ever silently dropped again (the
|
||||
/// 2026-07-03 "kit did nothing" session was an unsurfaced 0x04FC).
|
||||
/// </summary>
|
||||
public static class WeenieErrorText
|
||||
{
|
||||
public static string For(uint error) => error switch
|
||||
{
|
||||
0x001Du => "You're too busy!", // YoureTooBusy
|
||||
0x04EBu => "You can't do that while in the air!", // YouCantDoThatWhileInTheAir
|
||||
0x04FCu => "You are not trained in healing!", // YouArentTrainedInHealing
|
||||
0x04FEu => "You can't heal that!", // YouCantHealThat
|
||||
_ => $"You can't do that. (error 0x{error:X4})",
|
||||
};
|
||||
}
|
||||
109
src/AcDream.Core/Chat/ClientTextRefusals.cs
Normal file
109
src/AcDream.Core/Chat/ClientTextRefusals.cs
Normal file
|
|
@ -0,0 +1,109 @@
|
|||
namespace AcDream.Core.Chat;
|
||||
|
||||
/// <summary>
|
||||
/// The 11 process-lifetime string globals retail's
|
||||
/// <c>ClientCommunicationSystem</c> static ctors initialize at
|
||||
/// <c>0x00708F00</c>-<c>0x00709180</c> (Sept 2013 EoR build) and reuses for
|
||||
/// BOTH locally-detected refusals (jump/posture/emote gates evaluated on the
|
||||
/// client, no server round-trip — research doc
|
||||
/// <c>docs/research/2026-08-09-chat-retail-interface-text.md</c> §4) AND the
|
||||
/// matching server-sent <c>WeenieError</c> ids inside
|
||||
/// <c>HandleFailureEvent @0x00571990</c> (<see cref="WeenieErrorMessages"/>'
|
||||
/// <c>0x024</c>/<c>0x048</c>/<c>0x049</c> rows point straight back to these
|
||||
/// same constants — retail shares ONE string table for both paths).
|
||||
///
|
||||
/// <para>
|
||||
/// Every value here was read byte-for-byte off the PDB-paired binary
|
||||
/// <c>C:\Users\erikn\Downloads\acclient.exe</c> (v11.4186, CodeView GUID
|
||||
/// <c>9e847e2f-777c-4bd9-886c-22256bb87f32</c> — verified MATCH via
|
||||
/// <c>tools/pdb-extract/check_exe_pdb.py</c>) via a raw UTF-16LE prefix
|
||||
/// search + null-terminator read, per
|
||||
/// <c>claude-memory/reference_pe_byte_decode.md</c>. This was necessary
|
||||
/// because the decompiled pseudo-C at
|
||||
/// <c>docs/research/named-retail/acclient_2013_pseudo_c.txt</c> truncates
|
||||
/// every one of these literals at ~33 characters — including 6 the research
|
||||
/// doc's §4.1 table had already resolved correctly by inference (the
|
||||
/// natural completion happened to be unambiguous) and 5 it explicitly
|
||||
/// flagged as needing this exact re-read
|
||||
/// (<c>cant_sit_combat</c>, <c>cant_lie_down_combat</c>,
|
||||
/// <c>cant_crouch_combat</c>, <c>cant_emote_combat</c>,
|
||||
/// <c>cant_emote_position</c> — all 5 turned out to end in
|
||||
/// "... combat mode" / "... this position", NOT the shorter
|
||||
/// "... combat" the truncated preview alone would suggest).
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public static class ClientTextRefusals
|
||||
{
|
||||
/// <summary>
|
||||
/// <c>WeenieError.CantJumpFromThisPosition (0x0048)</c> — jump BLOCKED
|
||||
/// by the current motion or position (a blocklist check, not an
|
||||
/// airborne check).
|
||||
/// </summary>
|
||||
public const string CantJumpPosition = "You can't jump from this position";
|
||||
|
||||
/// <summary>
|
||||
/// <c>WeenieError.NotGrounded / YouCantJumpWhileInTheAir (0x0024)</c> —
|
||||
/// not grounded / no contact.
|
||||
/// </summary>
|
||||
public const string CantJumpInAir = "You can't jump while in the air";
|
||||
|
||||
/// <summary>
|
||||
/// <c>WeenieError.CantJumpLoadedDown (0x0049)</c> — the weenie's
|
||||
/// <c>CanJump(jump_extent)</c> virtual refused (stamina/burden gate).
|
||||
/// </summary>
|
||||
public const string CantJumpLoad = "You're too loaded down to jump";
|
||||
|
||||
/// <summary>
|
||||
/// Dead in the Sept 2013 EoR build per the research doc (no call site
|
||||
/// found) — kept for parity with retail's own string table.
|
||||
/// </summary>
|
||||
public const string CantJumpStamina = "You're too tired to jump!";
|
||||
|
||||
/// <summary>
|
||||
/// Dead in the Sept 2013 EoR build per the research doc (no call site
|
||||
/// found) — kept for parity with retail's own string table.
|
||||
/// </summary>
|
||||
public const string CantJumpRecent = "You've jumped too recently!";
|
||||
|
||||
/// <summary>
|
||||
/// <c>WeenieError.YouAreTooTiredToDoThat (0x003E)</c> —
|
||||
/// <c>CommandInterpreter::MovePlayer</c>'s stamina-exhausted refusal
|
||||
/// (code 0x3E in the movement/posture/emote family).
|
||||
/// </summary>
|
||||
public const string TooTired = "You are too tired to move!";
|
||||
|
||||
/// <summary>
|
||||
/// <c>WeenieError.SitInCombatStance / CantSitInCombat (0x0040)</c>.
|
||||
/// Byte-recovered — the pseudo-C truncated this to
|
||||
/// "You can't sit down while in comb…".
|
||||
/// </summary>
|
||||
public const string CantSitCombat = "You can't sit down while in combat mode";
|
||||
|
||||
/// <summary>
|
||||
/// <c>WeenieError.SleepInCombatStance / CantLieDownInCombat (0x0041)</c>.
|
||||
/// Byte-recovered — the pseudo-C truncated this to
|
||||
/// "You can't lie down while in comb…".
|
||||
/// </summary>
|
||||
public const string CantLieDownCombat = "You can't lie down while in combat mode";
|
||||
|
||||
/// <summary>
|
||||
/// <c>WeenieError.CrouchInCombatStance / CantCrouchInCombat (0x003F)</c>.
|
||||
/// Byte-recovered — the pseudo-C truncated this to
|
||||
/// "You can't crouch while in combat…".
|
||||
/// </summary>
|
||||
public const string CantCrouchCombat = "You can't crouch while in combat mode";
|
||||
|
||||
/// <summary>
|
||||
/// <c>WeenieError.ChatEmoteOutsideNonCombat / CantChatEmoteInCombat
|
||||
/// (0x0042)</c>. Byte-recovered — the pseudo-C truncated this to
|
||||
/// "You can't use chat emotes in com…".
|
||||
/// </summary>
|
||||
public const string CantEmoteCombat = "You can't use chat emotes in combat mode";
|
||||
|
||||
/// <summary>
|
||||
/// <c>WeenieError.CantChatEmoteNotStanding (0x0044)</c>. Byte-recovered
|
||||
/// — the pseudo-C truncated this to
|
||||
/// "You can't use chat emotes from t…".
|
||||
/// </summary>
|
||||
public const string CantEmotePosition = "You can't use chat emotes from this position";
|
||||
}
|
||||
150
src/AcDream.Core/Chat/SpewBoxState.cs
Normal file
150
src/AcDream.Core/Chat/SpewBoxState.cs
Normal file
|
|
@ -0,0 +1,150 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace AcDream.Core.Chat;
|
||||
|
||||
/// <summary>
|
||||
/// One visible SpewBox line: display text plus the caller-clock timestamp
|
||||
/// (seconds) at which it should be pruned.
|
||||
/// </summary>
|
||||
public readonly record struct SpewBoxEntry(string Text, double ExpiresAtSeconds);
|
||||
|
||||
/// <summary>
|
||||
/// Retail's transient on-screen "interface text" — a direct port of
|
||||
/// <c>gmSpewBoxUI</c>'s pending/visible split
|
||||
/// (<c>docs/research/2026-08-09-chat-retail-interface-text.md</c> §1.1/§3.1).
|
||||
/// Pure state, no presentation.
|
||||
///
|
||||
/// <para>
|
||||
/// <b>Placement note (deviation from the CH2 brief):</b> the brief names
|
||||
/// <c>AcDream.Runtime</c> as this type's home. It lives in
|
||||
/// <c>AcDream.Core.Chat</c> instead, directly beside <see cref="ChatLog"/>,
|
||||
/// because <c>AcDream.UI.Abstractions</c> (Code Structure Rule 3 — panels/
|
||||
/// ViewModels target UI.Abstractions only) references <c>AcDream.Core</c>
|
||||
/// but NOT <c>AcDream.Runtime</c>, and the UI.Abstractions
|
||||
/// <c>SpewBoxVM</c> needs to wrap this type directly — exactly the same
|
||||
/// constraint <see cref="ChatVM"/> already satisfies by wrapping
|
||||
/// <see cref="ChatLog"/> (also Core, not Runtime). <c>RuntimeCommunicationState</c>
|
||||
/// still owns the canonical instance and is still the sole writer via its
|
||||
/// <c>AddText</c> router, matching every other J4-era Runtime-owns/App-or-
|
||||
/// UI.Abstractions-borrows pattern in this codebase.
|
||||
/// </para>
|
||||
///
|
||||
/// <para>
|
||||
/// 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.
|
||||
/// </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.
|
||||
/// </summary>
|
||||
public const int MaxConcurrentItems = 1;
|
||||
|
||||
/// <summary>
|
||||
/// Retail's own client never raises the expiry element message
|
||||
/// (<c>0x10000003</c>) anywhere in the Sept 2013 EoR build — the real
|
||||
/// per-line timeout is owned by keystone.dll's authored behaviour for
|
||||
/// layout <c>0x10000012</c> element <c>0x1000004A</c> and was not
|
||||
/// measured in this slice (§3.2.1 of the research doc). This is an
|
||||
/// INVENTED placeholder, not a retail-measured value — see the
|
||||
/// divergence register.
|
||||
/// </summary>
|
||||
public static readonly TimeSpan DefaultLifetime = TimeSpan.FromSeconds(5);
|
||||
|
||||
private readonly object _gate = new();
|
||||
private readonly Queue<string> _pending = new();
|
||||
private readonly List<SpewBoxEntry> _visible = new();
|
||||
private long _revision;
|
||||
|
||||
/// <summary>Monotonic content revision — advances on any Tick that changes the visible set, and on Reset.</summary>
|
||||
public long Revision => Interlocked.Read(ref _revision);
|
||||
|
||||
/// <summary>Number of currently visible lines (0..<see cref="MaxConcurrentItems"/>).</summary>
|
||||
public int Count
|
||||
{
|
||||
get { lock (_gate) return _visible.Count; }
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Enqueue text for display — retail's
|
||||
/// <c>RecvNotice_DisplayFinalStringInfo</c> type-<c>0x1A</c> branch.
|
||||
/// Does not itself become visible until the next <see cref="Tick"/>.
|
||||
/// </summary>
|
||||
public void Enqueue(string text)
|
||||
{
|
||||
lock (_gate)
|
||||
_pending.Enqueue(text);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Drain any pending text into the visible list and prune expired
|
||||
/// entries. Call once per UI frame/tick (retail's global message
|
||||
/// <c>3</c>, <c>gmSpewBoxUI::Update</c>).
|
||||
/// </summary>
|
||||
/// <param name="nowSeconds">
|
||||
/// Caller's own monotonic clock, in seconds. Only used to stamp new
|
||||
/// entries' expiry and to prune old ones — never compared across
|
||||
/// different clock sources.
|
||||
/// </param>
|
||||
public void Tick(double nowSeconds)
|
||||
{
|
||||
bool changed;
|
||||
lock (_gate)
|
||||
{
|
||||
changed = _pending.Count > 0;
|
||||
while (_pending.Count > 0)
|
||||
{
|
||||
string text = _pending.Dequeue();
|
||||
|
||||
// Dedupe against index 0 ONLY (retail: 0x004D5EF6-0x004D5F91)
|
||||
// — an identical repeat refreshes the newest line in place
|
||||
// instead of stacking a duplicate.
|
||||
if (_visible.Count > 0 && _visible[0].Text == text)
|
||||
_visible.RemoveAt(0);
|
||||
|
||||
// Newest at the top — retail's InsertItem(item, 0).
|
||||
_visible.Insert(0, new SpewBoxEntry(text, nowSeconds + DefaultLifetime.TotalSeconds));
|
||||
|
||||
// Overflow drops the OLDEST (highest index) entry — retail's
|
||||
// DeleteItem(count - 1) when count > m_maxConcurrentItems.
|
||||
while (_visible.Count > MaxConcurrentItems)
|
||||
_visible.RemoveAt(_visible.Count - 1);
|
||||
}
|
||||
|
||||
int removed = _visible.RemoveAll(e => e.ExpiresAtSeconds <= nowSeconds);
|
||||
changed |= removed > 0;
|
||||
}
|
||||
|
||||
if (changed)
|
||||
Interlocked.Increment(ref _revision);
|
||||
}
|
||||
|
||||
/// <summary>Snapshot of currently visible lines, newest first.</summary>
|
||||
public SpewBoxEntry[] Snapshot()
|
||||
{
|
||||
lock (_gate)
|
||||
return _visible.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>Clear all pending and visible state — session/generation reset.</summary>
|
||||
public void Reset()
|
||||
{
|
||||
lock (_gate)
|
||||
{
|
||||
_pending.Clear();
|
||||
_visible.Clear();
|
||||
}
|
||||
Interlocked.Increment(ref _revision);
|
||||
}
|
||||
}
|
||||
|
|
@ -4,30 +4,73 @@ namespace AcDream.Core.Chat;
|
|||
|
||||
/// <summary>
|
||||
/// Translates ACE <c>WeenieError</c> + <c>WeenieErrorWithString</c> codes
|
||||
/// into the human-readable templates the retail client showed. The
|
||||
/// retail client baked these strings into <c>string_table.bin</c>; for
|
||||
/// our purposes we mirror ACE's enum-doc comments
|
||||
/// (<c>references/ACE/Source/ACE.Entity/Enum/WeenieError.cs</c> +
|
||||
/// <c>WeenieErrorWithString.cs</c>) since they preserve the original
|
||||
/// templates verbatim, including the literal <c>_</c> placeholder where
|
||||
/// the parameter goes.
|
||||
/// into the human-readable templates retail actually showed, AND the retail
|
||||
/// destination (<see cref="RetailLogTextType"/>) each one routed to.
|
||||
///
|
||||
/// <para>
|
||||
/// <b>Why we need this:</b> Many of the codes ACE sends — especially
|
||||
/// the high-frequency ones the user actually sees in normal play —
|
||||
/// are <i>informational</i>, not error-level (e.g. <c>0x051B</c> =
|
||||
/// "You have entered the X channel.", <c>0x051D</c> = "Turbine Chat
|
||||
/// is enabled."). Displaying them as <c>WeenieError 0xNNNN</c> is
|
||||
/// noisy and misleading. With the proper template they read as the
|
||||
/// retail player would have seen them.
|
||||
/// <b>Campaign CH slice CH2 (2026-08-09):</b> this is a full port of
|
||||
/// <c>ClientCommunicationSystem::HandleFailureEvent @0x00571990</c>
|
||||
/// (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
|
||||
/// <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:
|
||||
/// </para>
|
||||
///
|
||||
/// <list type="bullet">
|
||||
/// <item>7 ids the appendix 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
|
||||
/// 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>
|
||||
/// </list>
|
||||
///
|
||||
/// <para>
|
||||
/// We don't translate every code — only the ~30 most likely to appear
|
||||
/// in a normal session. Unknown codes fall back to the
|
||||
/// <c>WeenieError 0xNNNN[: param]</c> form so nothing is silently
|
||||
/// lost. New codes can be added in 30 seconds when the user reports
|
||||
/// one.
|
||||
/// This retires register row AP-176 (the CH1-era approximation that fixed
|
||||
/// every WeenieError display at <c>LogTextType.Default</c> pending this
|
||||
/// full port).
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public static class WeenieErrorMessages
|
||||
|
|
@ -46,159 +89,394 @@ public static class WeenieErrorMessages
|
|||
public static bool IsSilentClientControlStatus(uint errorCode) =>
|
||||
errorCode is 0x003Bu or 0x003Cu;
|
||||
|
||||
/// <summary>
|
||||
/// One retail routing-table row: the display template (retail's own
|
||||
/// <c>%s</c> placeholder, substituted verbatim — never retail's literal
|
||||
/// <c>$s</c>, see <c>0x4F4</c> above) plus the exact
|
||||
/// <see cref="RetailLogTextType"/> <c>HandleFailureEvent</c> passed to
|
||||
/// <c>AddTextToScroll</c> for this id.
|
||||
/// </summary>
|
||||
public readonly record struct Entry(string Template, RetailLogTextType Type);
|
||||
|
||||
/// <summary>
|
||||
/// Format a WeenieError / WeenieErrorWithString into a human-readable
|
||||
/// system-message string.
|
||||
/// system-message string. Back-compat wrapper over <see cref="Resolve"/>
|
||||
/// for callers that only need text, not the routing type.
|
||||
/// </summary>
|
||||
/// <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)
|
||||
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.
|
||||
/// </summary>
|
||||
public static (string Text, RetailLogTextType Type) Resolve(uint errorCode, string? param)
|
||||
{
|
||||
// WeenieErrorWithString templates use the literal underscore
|
||||
// character `_` as the placeholder for the param. We
|
||||
// substitute it for `param` if present, otherwise drop it.
|
||||
if (param is not null && WithStringTemplates.TryGetValue(errorCode, out var withTemplate))
|
||||
if (Table.TryGetValue(errorCode, out Entry entry))
|
||||
{
|
||||
return withTemplate.Replace("_", param);
|
||||
string text = param is not null && entry.Template.Contains("%s")
|
||||
? entry.Template.Replace("%s", param)
|
||||
: entry.Template;
|
||||
return (text, entry.Type);
|
||||
}
|
||||
|
||||
if (NoParamTemplates.TryGetValue(errorCode, out var template))
|
||||
{
|
||||
// Some "no-param" codes do still arrive with a meaningless
|
||||
// param string; ignore it.
|
||||
return template;
|
||||
}
|
||||
|
||||
// Unknown code — fall back to the raw form.
|
||||
return string.IsNullOrEmpty(param)
|
||||
string fallback = string.IsNullOrEmpty(param)
|
||||
? $"WeenieError 0x{errorCode:X4}"
|
||||
: $"WeenieError 0x{errorCode:X4}: {param}";
|
||||
return (fallback, RetailLogTextType.Default);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Codes from <c>WeenieError</c> (no param). Templates copied
|
||||
/// verbatim from ACE enum-doc comments.
|
||||
/// 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).
|
||||
/// </summary>
|
||||
private static readonly Dictionary<uint, string> NoParamTemplates = new()
|
||||
private static readonly Dictionary<uint, Entry> Table = new()
|
||||
{
|
||||
// Command parser
|
||||
[0x0026] = "That is not a valid command.", // ThatIsNotAValidCommand
|
||||
[0x055F] = "Only Player Killer characters may use this command!",
|
||||
[0x0560] = "Only Player Killer Lite characters may use this command!",
|
||||
|
||||
// Tell-related
|
||||
[0x052B] = "That person is not available now.", // CharacterNotAvailable
|
||||
|
||||
// Chat-channel related
|
||||
[0x051D] = "Turbine Chat is enabled.", // TurbineChatIsEnabled
|
||||
|
||||
// Trade
|
||||
[0x0529] = "Trade Complete!", // TradeComplete
|
||||
|
||||
// Allegiance / Fellowship membership errors (high-frequency
|
||||
// when player isn't in either group and tries the channel)
|
||||
[0x0414] = "You are not in an allegiance!", // YouAreNotInAllegiance
|
||||
[0x050F] = "You do not belong to a Fellowship.", // YouDoNotBelongToAFellowship
|
||||
|
||||
// Allegiance
|
||||
[0x0496] = "Your Allegiance has been dissolved!", // YourAllegianceHasBeenDissolved
|
||||
[0x0497] = "Your patron's Allegiance to you has been broken!",
|
||||
// YourPatronsAllegianceHasBeenBroken
|
||||
[0x0535] = "You do not have the authority within your allegiance to do that.",
|
||||
|
||||
// Movement / teleport / housing
|
||||
[0x0036] = "Action cancelled!", // ActionCancelled
|
||||
[0x003D] = "You charged too far!", // YouChargedTooFar
|
||||
[0x004A] = "Ack! You killed yourself!", // YouKilledYourself
|
||||
[0x0498] = "You have moved too far!", // YouHaveMovedTooFar
|
||||
[0x0499] = "That is not a valid destination!", // TeleToInvalidPosition
|
||||
[0x0532] = "You must wait 30 days after purchasing a house before you may purchase another with any character on the same account.",
|
||||
[0x0550] = "Out of Range!", // MissileOutOfRange
|
||||
|
||||
// Fellowship
|
||||
[0x0528] = "The fellowship is locked; you cannot open locked fellowships.",
|
||||
|
||||
// Player flavour
|
||||
[0x0526] = "You chicken out.", // YouChickenOut
|
||||
|
||||
// PK status (retail: ClientCommunicationSystem::HandleFailureEvent
|
||||
// @0x00571990, decompiled at
|
||||
// docs/research/named-retail/acclient_2013_pseudo_c.txt:382900+.
|
||||
// Strings recovered from the PDB-paired
|
||||
// C:\Users\erikn\Downloads\acclient.exe (imagebase 0x400000) via
|
||||
// VA -> RVA -> file-offset mapping per
|
||||
// claude-memory/reference_pe_byte_decode.md, because the pseudo-C
|
||||
// dump for data_7d32c0 truncates at its declared array bound
|
||||
// (0x5f wchar16) mid-sentence. Retail's literal ends with a
|
||||
// trailing "\n" that we drop here — acdream's ChatEntry already
|
||||
// renders one line per system message, unlike retail's single
|
||||
// scrolling text buffer.
|
||||
[0x0504] = "You are enveloped in a feeling of warmth as you are brought back into the protection of the Light. You are once again a Non-Player Killer.",
|
||||
// YouAreNonPKAgain, case 0x504 @0x005745cd, data_7d32c0
|
||||
[0x0505] = "You're too close to your sanctuary!", // YoureTooCloseToYourSanctuary, case 0x505 @0x00574c65, data_7d2640
|
||||
[0x04EC] = "You cannot modify your player killer status while you are recovering from a PK death.",
|
||||
// CannotChangePKStatusWhileRecovering, case 0x4ec @0x0057446f, data_7d3820
|
||||
[0x04ED] = "Advocates may not change their player killer status!",
|
||||
// AdvocatesCannotChangePKStatus, case 0x4ed @0x005744a1, data_7d37b0
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Codes from <c>WeenieErrorWithString</c>. Templates copied
|
||||
/// verbatim from ACE enum-doc comments. The <c>_</c> placeholder
|
||||
/// is substituted with the param at format time.
|
||||
/// </summary>
|
||||
private static readonly Dictionary<uint, string> WithStringTemplates = new()
|
||||
{
|
||||
// Channel join / leave (high frequency at login)
|
||||
[0x051B] = "You have entered the _ channel.", // YouHaveEnteredThe_Channel
|
||||
[0x051C] = "You have left the _ channel.", // YouHaveLeftThe_Channel
|
||||
|
||||
// Chat-server failures
|
||||
[0x051E] = "_ will not receive your message, please use urgent assistance to speak with an in-game representative.",
|
||||
[0x051F] = "Message Blocked: _", // MessageBlocked_
|
||||
|
||||
// Hear / loud-list
|
||||
[0x0521] = "_ has been added to the list of people you can hear.",
|
||||
[0x0522] = "_ has been removed from the list of people you can hear.",
|
||||
[0x0525] = "You fail to remove _ from your loud list.",
|
||||
|
||||
// Snooping (admin)
|
||||
[0x052C] = "You are now snooping on _.",
|
||||
[0x052D] = "You are no longer snooping on _.",
|
||||
[0x052E] = "You fail to snoop on _.",
|
||||
[0x052F] = "_ attempted to snoop on you.",
|
||||
[0x0551] = "You are not listening to the _ channel.",
|
||||
|
||||
// Allegiance
|
||||
[0x046A] = "_ doesn't know what to do with that.",
|
||||
[0x0413] = "_ is already one of your followers.",
|
||||
[0x0416] = "_ cannot have any more Vassals.",
|
||||
[0x03EF] = "_ is not accepting gifts right now.",
|
||||
|
||||
// Combat / spell failures
|
||||
[0x004E] = "You fail to affect _ because you cannot affect anyone!",
|
||||
[0x004F] = "You fail to affect _ because they cannot be harmed!",
|
||||
[0x0050] = "You fail to affect _ because beneficial spells do not affect them!",
|
||||
[0x0051] = "You fail to affect _ because you are not a player killer!",
|
||||
[0x0052] = "You fail to affect _ because they are not a player killer!",
|
||||
[0x0053] = "You fail to affect _ because you are not the same sort of player killer as them!",
|
||||
[0x0054] = "You fail to affect _ because you are acting across a house boundary!",
|
||||
|
||||
// Healing
|
||||
[0x04FF] = "_ is already at full health!", // _IsAtFullHealth
|
||||
|
||||
// Inventory / etiquette
|
||||
[0x001E] = "_ is too busy to accept gifts right now.",
|
||||
[0x002B] = "_ cannot carry anymore.",
|
||||
|
||||
// Fellowship
|
||||
[0x0517] = "_ is not close enough to your level.",
|
||||
[0x0518] = "This fellowship is locked; _ cannot be recruited into the fellowship.",
|
||||
|
||||
// Hooks
|
||||
[0x0510] = "Maximum number of _ hooked.",
|
||||
[0x0514] = "Maximum number of _ hooked until one is removed.",
|
||||
[0x0515] = "You no longer have the maximum number of _ hooked. You may hook additional.",
|
||||
[0x017u] = new("You failed to go to non-combat mode.", RetailLogTextType.ClientLocal),
|
||||
[0x01Du] = new("You're too busy!", RetailLogTextType.ClientLocal),
|
||||
[0x01Eu] = new("You must control both objects!", RetailLogTextType.ClientLocal),
|
||||
[0x020u] = new("You must control both objects!", RetailLogTextType.ClientLocal),
|
||||
[0x023u] = new("Unable to move to object!", RetailLogTextType.ClientLocal),
|
||||
[0x024u] = new(ClientTextRefusals.CantJumpInAir, RetailLogTextType.ClientLocal),
|
||||
[0x026u] = new("That is not a valid command.", RetailLogTextType.ClientLocal),
|
||||
[0x028u] = new("The item is under someone else's control!", RetailLogTextType.ClientLocal),
|
||||
[0x029u] = new("You cannot pick that up!", RetailLogTextType.ClientLocal),
|
||||
[0x02Au] = new("You are too encumbered to carry that!", RetailLogTextType.ClientLocal),
|
||||
[0x02Bu] = new("%s cannot carry anymore.", RetailLogTextType.Default),
|
||||
[0x036u] = new("Action cancelled!", RetailLogTextType.ClientLocal),
|
||||
[0x037u] = new("Unable to move to object!", RetailLogTextType.ClientLocal),
|
||||
[0x038u] = new("Unable to move to object!", RetailLogTextType.ClientLocal),
|
||||
[0x039u] = new("Unable to move to object!", RetailLogTextType.ClientLocal),
|
||||
[0x03Au] = new("You can't do that... you're dead!", RetailLogTextType.ClientLocal),
|
||||
[0x03Du] = new("You charged too far!", RetailLogTextType.ClientLocal),
|
||||
[0x03Eu] = new("You are too tired to do that!", RetailLogTextType.ClientLocal),
|
||||
[0x048u] = new(ClientTextRefusals.CantJumpPosition, RetailLogTextType.ClientLocal),
|
||||
[0x049u] = new(ClientTextRefusals.CantJumpLoad, RetailLogTextType.ClientLocal),
|
||||
[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),
|
||||
[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),
|
||||
[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),
|
||||
[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),
|
||||
[0x3F8u] = new("You are out of ammunition!", RetailLogTextType.ClientLocal),
|
||||
[0x3F9u] = new("Your missile attack misfired!", RetailLogTextType.ClientLocal),
|
||||
[0x3FAu] = new("You've attempted an impossible spell path!", RetailLogTextType.ClientLocal),
|
||||
[0x3FEu] = new("You don't know that spell!", RetailLogTextType.ClientLocal),
|
||||
[0x3FFu] = new("Incorrect target type", RetailLogTextType.ClientLocal),
|
||||
[0x400u] = new("You don't have all the components for this spell.", RetailLogTextType.ClientLocal),
|
||||
[0x401u] = new("You don't have enough Mana to cast this spell.", RetailLogTextType.ClientLocal),
|
||||
[0x402u] = new("Your spell fizzled.", RetailLogTextType.Magic),
|
||||
[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),
|
||||
[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),
|
||||
[0x413u] = new("%s is already one of your followers", RetailLogTextType.ClientLocal),
|
||||
[0x414u] = new("You are not in an allegiance!", RetailLogTextType.ClientLocal),
|
||||
[0x416u] = new("%s cannot have any more Vassals", RetailLogTextType.ClientLocal),
|
||||
[0x41Du] = new("You must be the leader of a Fellowship", RetailLogTextType.ClientLocal),
|
||||
[0x41Eu] = new("Your Fellowship is full", RetailLogTextType.ClientLocal),
|
||||
[0x41Fu] = new("That Fellowship name is not permitted", RetailLogTextType.ClientLocal),
|
||||
[0x422u] = new("That channel doesn't exist.", RetailLogTextType.ClientLocal),
|
||||
[0x423u] = new("You can't use that channel.", RetailLogTextType.ClientLocal),
|
||||
[0x424u] = new("You're already on that channel.", RetailLogTextType.ClientLocal),
|
||||
[0x425u] = new("You're not currently on that channel.", RetailLogTextType.ClientLocal),
|
||||
[0x427u] = new("You cannot merge different stacks!", RetailLogTextType.ClientLocal),
|
||||
[0x428u] = new("You cannot merge enchanted items!", RetailLogTextType.ClientLocal),
|
||||
[0x429u] = new("You must control at least one stack!", RetailLogTextType.ClientLocal),
|
||||
[0x432u] = new("Your craft attempt fails.", RetailLogTextType.ClientLocal),
|
||||
[0x433u] = new("Your craft attempt fails.", RetailLogTextType.ClientLocal),
|
||||
[0x434u] = new("Given that number of items, you cannot craft anything.", RetailLogTextType.ClientLocal),
|
||||
[0x435u] = new("Your craft attempt fails.", RetailLogTextType.ClientLocal),
|
||||
[0x437u] = new("Either you or one of the items involved does not pass the requirements for this craft interaction.", RetailLogTextType.ClientLocal),
|
||||
[0x438u] = new("You do not have all the neccessary items.", RetailLogTextType.ClientLocal),
|
||||
[0x439u] = new("Not all the items are avaliable.", RetailLogTextType.ClientLocal),
|
||||
[0x43Au] = new("You must be at rest in peace mode to do trade skills.", RetailLogTextType.ClientLocal),
|
||||
[0x43Bu] = new("You are not trained in that trade skill.", RetailLogTextType.ClientLocal),
|
||||
[0x43Cu] = new("Your hands must be free.", RetailLogTextType.ClientLocal),
|
||||
[0x43Du] = new("You cannot link to that portal!", RetailLogTextType.Magic),
|
||||
[0x43Eu] = new("You have solved this quest too recently!", RetailLogTextType.Default),
|
||||
[0x43Fu] = new("You have solved this quest too many times!", RetailLogTextType.Default),
|
||||
[0x445u] = new("This item requires you to complete a specific quest before you can pick it up!", RetailLogTextType.Default),
|
||||
[0x45Cu] = new("Player killers may not interact with that portal!", RetailLogTextType.Magic),
|
||||
[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),
|
||||
[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),
|
||||
[0x47Fu] = new("You must own a house to use this command.", RetailLogTextType.ClientLocal),
|
||||
[0x480u] = new("Your monarch does not own a mansion or a villa!", RetailLogTextType.ClientLocal),
|
||||
[0x481u] = new("Your monarch does not own a mansion or a villa!", RetailLogTextType.ClientLocal),
|
||||
[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),
|
||||
[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),
|
||||
[0x48Fu] = new("You are already involved in something!", RetailLogTextType.ClientLocal),
|
||||
[0x490u] = new("You must be a monarch to use this command.", RetailLogTextType.ClientLocal),
|
||||
[0x491u] = new("You must specify a character to boot.", RetailLogTextType.ClientLocal),
|
||||
[0x492u] = new("You can't boot yourself!", RetailLogTextType.ClientLocal),
|
||||
[0x493u] = new("That character does not exist.", RetailLogTextType.ClientLocal),
|
||||
[0x494u] = new("That person is not a member of your Allegiance!", RetailLogTextType.ClientLocal),
|
||||
[0x495u] = new("No patron from which to break!", RetailLogTextType.ClientLocal),
|
||||
[0x496u] = new("Your Allegiance has been dissolved!", RetailLogTextType.Default),
|
||||
[0x497u] = new("Your patron's Allegiance to you has been broken!", RetailLogTextType.Default),
|
||||
[0x498u] = new("You have moved too far!", RetailLogTextType.ClientLocal),
|
||||
[0x499u] = new("That is not a valid destination!", RetailLogTextType.ClientLocal),
|
||||
[0x49Au] = new("You must purchase Asheron's Call -- Dark Majesty to use this function.", RetailLogTextType.ClientLocal),
|
||||
[0x49Bu] = new("You fail to link with the lifestone!", RetailLogTextType.Magic),
|
||||
[0x49Cu] = new("You wandered too far to link with the lifestone!", RetailLogTextType.Magic),
|
||||
[0x49Du] = new("You successfully link with the lifestone!", RetailLogTextType.Magic),
|
||||
[0x49Eu] = new("You must have linked with a lifestone in order to recall to it!", RetailLogTextType.Magic),
|
||||
[0x49Fu] = new("You fail to recall to the lifestone!", RetailLogTextType.Magic),
|
||||
[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),
|
||||
[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),
|
||||
[0x4A7u] = new("You have been teleported too recently!", RetailLogTextType.Magic),
|
||||
[0x4A8u] = new("You must be an Advocate to interact with that portal.", RetailLogTextType.Magic),
|
||||
[0x4AAu] = new("Players may not interact with that portal.", RetailLogTextType.Magic),
|
||||
[0x4ABu] = new("You are not powerful enough to interact with that portal!", RetailLogTextType.Magic),
|
||||
[0x4ACu] = new("You are too powerful to interact with that portal!", RetailLogTextType.Magic),
|
||||
[0x4ADu] = new("You cannot recall to that portal!", RetailLogTextType.Magic),
|
||||
[0x4AEu] = new("You cannot summon that portal!", RetailLogTextType.Magic),
|
||||
[0x4AFu] = new("The lock is already unlocked.", RetailLogTextType.ClientLocal),
|
||||
[0x4B0u] = new("You can't lock or unlock that!", RetailLogTextType.ClientLocal),
|
||||
[0x4B1u] = new("You can't lock or unlock what is open!", RetailLogTextType.ClientLocal),
|
||||
[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),
|
||||
[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),
|
||||
[0x4B9u] = new("You do not own that salvage tool!", RetailLogTextType.Default),
|
||||
[0x4BAu] = new("You do not own that salvage tool!", RetailLogTextType.Default),
|
||||
[0x4BDu] = new("You do not own that salvage tool!", RetailLogTextType.Default),
|
||||
[0x4BEu] = new("You do not own that item!", RetailLogTextType.Default),
|
||||
[0x4BFu] = new("The %s was not suitable for salvaging.", RetailLogTextType.ClientLocal),
|
||||
[0x4C0u] = new("The %s contains the wrong material.", RetailLogTextType.ClientLocal),
|
||||
[0x4C1u] = new("The material cannot be created.", RetailLogTextType.Default),
|
||||
[0x4C2u] = new("The list of items you are attempting to salvage is invalid.", RetailLogTextType.Default),
|
||||
[0x4C3u] = new("You cannot salvage items that you are trading!", RetailLogTextType.Default),
|
||||
[0x4C4u] = new("You must be a guest in this house to interact with that portal.", RetailLogTextType.Magic),
|
||||
[0x4C5u] = new("Your Allegiance Rank is too low to use that item's magic.", RetailLogTextType.ClientLocal),
|
||||
[0x4C6u] = new("You must be %s to use that item's magic.", RetailLogTextType.ClientLocal),
|
||||
[0x4C7u] = new("Your Arcane Lore skill is too low to use that item's magic.", RetailLogTextType.ClientLocal),
|
||||
[0x4C8u] = new("That item doesn't have enough Mana.", RetailLogTextType.ClientLocal),
|
||||
[0x4C9u] = new("Your %s is too low to use that item's magic.", RetailLogTextType.ClientLocal),
|
||||
[0x4CAu] = new("Only %s may use that item's magic.", RetailLogTextType.ClientLocal),
|
||||
[0x4CBu] = new("You must have %s specialized to use that item's magic.", RetailLogTextType.ClientLocal),
|
||||
[0x4CCu] = new("You have been involved in a player killer battle too recently to do that!", RetailLogTextType.Magic),
|
||||
[0x4CEu] = new("%s is too busy to accept gifts right now.", RetailLogTextType.Default),
|
||||
[0x4CFu] = new("%s cannot accept stacked objects. Try giving one at a time.", RetailLogTextType.Default),
|
||||
[0x4D0u] = new("You have failed to alter your skill.", RetailLogTextType.Default),
|
||||
[0x4D1u] = new("Your %s skill must be trained, not untrained or specialized, in order to be altered in this way!", RetailLogTextType.Default),
|
||||
[0x4D2u] = new("You do not have enough skill credits to specialize your %s skill.", RetailLogTextType.Default),
|
||||
[0x4D3u] = new("You have too many available experience points to be able to absorb the experience points from your %s skill. Please spend some of your experience points and try again.", RetailLogTextType.Default),
|
||||
[0x4D4u] = new("Your %s skill is already untrained!", RetailLogTextType.Default),
|
||||
[0x4D5u] = 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),
|
||||
[0x4D6u] = new("You have succeeded in specializing your %s skill!", RetailLogTextType.Default),
|
||||
[0x4D7u] = new("You have succeeded in lowering your %s skill from specialized to trained!", RetailLogTextType.Default),
|
||||
[0x4D8u] = new("You have succeeded in untraining your %s skill!", RetailLogTextType.Default),
|
||||
[0x4D9u] = new("Although you cannot untrain your %s skill, you have succeeded in recovering all the experience you had invested in it.", RetailLogTextType.Default),
|
||||
[0x4DAu] = new("You have too many credits invested in specialized skills already! Before you can specialize your %s skill, you will need to unspecialize some other skill.", RetailLogTextType.Default),
|
||||
[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),
|
||||
[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),
|
||||
[0x4E4u] = new("This chest is a duplicated housing object. You may not add items to a duplicated housing object. Please empty everything -- including backpacks -- out of the chest and allow the chest to reset.", RetailLogTextType.Default),
|
||||
[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),
|
||||
[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),
|
||||
[0x4EDu] = new("Advocates may not change their player killer status!", RetailLogTextType.Default),
|
||||
[0x4EEu] = new("Your level is too low to change your player killer status with this object.", RetailLogTextType.Default),
|
||||
[0x4EFu] = new("Your level is too high to change your player killer status with this object.", RetailLogTextType.Default),
|
||||
[0x4F0u] = new("You feel a harsh dissonance, and you sense that an act of killing you have committed recently is interfering with the conversion.", RetailLogTextType.Default),
|
||||
[0x4F1u] = new("Bael'Zharon's power flows through you again. You are once more a player killer.", RetailLogTextType.Default),
|
||||
[0x4F2u] = new("Bael'Zharon has granted you respite after your moment of weakness. You are temporarily no longer a player killer.", RetailLogTextType.Default),
|
||||
[0x4F3u] = new("Lite Player Killers may not interact with that portal!", RetailLogTextType.Magic),
|
||||
[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.
|
||||
[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),
|
||||
[0x4FCu] = new("You aren't trained in healing!", RetailLogTextType.ClientLocal),
|
||||
[0x4FDu] = new("You don't own that healing kit!", RetailLogTextType.ClientLocal),
|
||||
[0x4FEu] = new("You can't heal that!", RetailLogTextType.ClientLocal),
|
||||
[0x4FFu] = new("%s is already at full health!", RetailLogTextType.ClientLocal),
|
||||
[0x500u] = new("You aren't ready to heal!", RetailLogTextType.ClientLocal),
|
||||
[0x501u] = new("You can only use Healing Kits on player characters.", RetailLogTextType.ClientLocal),
|
||||
[0x502u] = new("The Lifestone's magic protects you from the attack!", RetailLogTextType.Magic),
|
||||
[0x503u] = new("The portal's residual energy protects you from the attack!", RetailLogTextType.Magic),
|
||||
[0x504u] = new("You are enveloped in a feeling of warmth as you are brought back into the protection of the Light. You are once again a Non-Player Killer.", RetailLogTextType.Default),
|
||||
[0x505u] = new("You're too close to your sanctuary!", RetailLogTextType.ClientLocal),
|
||||
[0x506u] = new("You can't do that -- you're trading!", RetailLogTextType.ClientLocal),
|
||||
[0x507u] = new("Only Non-Player Killers may enter PK Lite. Please see @help pklite for more details about this command.", RetailLogTextType.Default),
|
||||
[0x508u] = new("A cold wind touches your heart. You are now a Player Killer Lite.", RetailLogTextType.Default),
|
||||
[0x509u] = new("%s has no appropriate targets equipped for this spell.", RetailLogTextType.Magic),
|
||||
[0x50Au] = new("You have no appropriate targets equipped for %s's spell.", RetailLogTextType.Magic),
|
||||
[0x50Bu] = new("%s is now an open fellowship; anyone may recruit new members.", RetailLogTextType.Default),
|
||||
[0x50Cu] = new("%s is now a closed fellowship.", RetailLogTextType.Default),
|
||||
[0x50Du] = new("%s is now the leader of this fellowship.", RetailLogTextType.Default),
|
||||
[0x50Eu] = new("You have passed leadership of the fellowship to %s", RetailLogTextType.Default),
|
||||
[0x50Fu] = new("You do not belong to a Fellowship.", RetailLogTextType.ClientLocal),
|
||||
[0x510u] = new("You may not hook any more %s on your house. You already have the maximum number of %s hooked or you are not permitted to hook any on your type of house.", RetailLogTextType.Default),
|
||||
[0x512u] = new("You are now using the maximum number of hooks. You cannot use another hook until you take an item off one of your hooks.", RetailLogTextType.Default),
|
||||
[0x513u] = new("You are no longer using the maximum number of hooks. You may again add items to your hooks.", RetailLogTextType.Default),
|
||||
[0x514u] = new("You now have the maximum number of %s hooked. You cannot hook any additional %s until you remove one or more from your house.", RetailLogTextType.Default),
|
||||
[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),
|
||||
[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),
|
||||
[0x51Cu] = new("You have left the %s channel.", RetailLogTextType.Default),
|
||||
[0x51Eu] = new("%s will not receive your message, please use urgent assistance to speak with an in-game representative", RetailLogTextType.Default),
|
||||
[0x51Fu] = new("Message Blocked: %s", RetailLogTextType.ClientLocal),
|
||||
[0x520u] = new("You cannot add anymore people to the list of players that you can hear.", RetailLogTextType.Default),
|
||||
[0x521u] = new("%s has been added to the list of people you can hear.", RetailLogTextType.Default),
|
||||
[0x522u] = new("%s has been removed from the list of people you can hear.", RetailLogTextType.Default),
|
||||
[0x523u] = new("You are now deaf to player's screams.", RetailLogTextType.Default),
|
||||
[0x524u] = new("You can hear all players once again.", RetailLogTextType.Default),
|
||||
[0x525u] = new("You fail to remove %s from your loud list.", RetailLogTextType.Default),
|
||||
[0x526u] = new("You chicken out.", RetailLogTextType.ClientLocal),
|
||||
[0x527u] = new("You cannot posssibly succeed.", RetailLogTextType.ClientLocal),
|
||||
[0x528u] = new("The fellowship is locked; you cannot open locked fellowships.", RetailLogTextType.Default),
|
||||
[0x529u] = new("Trade Complete!", RetailLogTextType.ClientLocal),
|
||||
[0x52Au] = new("That is not a salvaging tool.", RetailLogTextType.ClientLocal),
|
||||
[0x52Bu] = new("That person is not available now.", RetailLogTextType.ClientLocal),
|
||||
[0x52Cu] = new("You are now snooping on %s.", RetailLogTextType.Default),
|
||||
[0x52Du] = new("You are no longer snooping on %s.", RetailLogTextType.Default),
|
||||
[0x52Eu] = new("You fail to snoop on %s.", RetailLogTextType.Default),
|
||||
[0x52Fu] = new("%s attempted to snoop on you.", RetailLogTextType.Default),
|
||||
[0x530u] = new("%s is already being snooped on, only one person may snoop on another at a time.", RetailLogTextType.Default),
|
||||
[0x531u] = new("%s is in limbo and cannot receive your message.", RetailLogTextType.Default),
|
||||
[0x532u] = new("You must wait 30 days after purchasing a house before you may purchase another with any character on the same account. This applies to all housing except apartments.", RetailLogTextType.Default),
|
||||
[0x533u] = new("You have been booted from your allegiance chat room. Use \"@allegiance chat on\" to rejoin. (%s).", RetailLogTextType.Default),
|
||||
[0x534u] = new("%s has been booted from the allegiance chat room.", RetailLogTextType.Default),
|
||||
[0x535u] = new("You do not have the authority within your allegiance to do that.", RetailLogTextType.Default),
|
||||
[0x536u] = new("The account of %s is already banned from the allegiance.", RetailLogTextType.Default),
|
||||
[0x537u] = new("The account of %s is not banned from the allegiance.", RetailLogTextType.Default),
|
||||
[0x538u] = new("The account of %s was not unbanned from the allegiance.", RetailLogTextType.Default),
|
||||
[0x539u] = new("The account of %s has been banned from the allegiance.", RetailLogTextType.Default),
|
||||
[0x53Au] = new("The account of %s is no longer banned from the allegiance.", RetailLogTextType.Default),
|
||||
[0x53Bu] = new("Banned Characters:", RetailLogTextType.Default),
|
||||
[0x53Eu] = new("%s is banned from the allegiance!", RetailLogTextType.Default),
|
||||
[0x53Fu] = new("You are banned from %s's allegiance!", RetailLogTextType.Default),
|
||||
[0x540u] = new("You have the maximum number of accounts banned.!", RetailLogTextType.Default),
|
||||
[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),
|
||||
[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),
|
||||
[0x548u] = new("You cannot join any chat channels while gagged.", RetailLogTextType.Default),
|
||||
[0x549u] = new("Your allegiance officer status has been modified. You now hold the position of: %s.", RetailLogTextType.Default),
|
||||
[0x54Au] = new("You are no longer an allegiance officer.", RetailLogTextType.Default),
|
||||
[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),
|
||||
[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),
|
||||
[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),
|
||||
[0x559u] = new("You do not have enough unspent experience available to purchase this augmentation.", RetailLogTextType.Default),
|
||||
[0x55Au] = new("%s", RetailLogTextType.Default),
|
||||
[0x55Bu] = new("Congratulations! You have succeeded in acquiring the %s augmentation.", RetailLogTextType.Default),
|
||||
[0x55Cu] = new("Although your augmentation will not allow you to untrain your %s skill, you have succeeded in recovering all the experience you had invested in it.", RetailLogTextType.Default),
|
||||
[0x55Du] = new("You must exit the Training Academy before that command will be available to you.", RetailLogTextType.Default),
|
||||
[0x55Eu] = new("%s", RetailLogTextType.Default),
|
||||
[0x55Fu] = new("Only Player Killer characters may use this command!", RetailLogTextType.Default),
|
||||
[0x560u] = new("Only Player Killer Lite characters may use this command!", RetailLogTextType.Default),
|
||||
[0x561u] = new("You may only have a maximum of 50 friends at once. If you wish to add more friends, you must first remove some.", RetailLogTextType.ClientLocal),
|
||||
[0x562u] = new("%s is already on your friends list!", RetailLogTextType.Default),
|
||||
[0x563u] = new("That character is not on your friends list!", RetailLogTextType.Default),
|
||||
[0x564u] = new("Only the character who owns the house may use this command.", RetailLogTextType.Default),
|
||||
[0x565u] = new("That allegiance name is invalid because it is empty. Please use the @allegiance name clear command to clear your allegiance name.", RetailLogTextType.Default),
|
||||
[0x566u] = new("That allegiance name is too long. Please choose another name.", RetailLogTextType.Default),
|
||||
[0x567u] = new("That allegiance name contains illegal characters. Please choose another name using only letters, spaces, - and '.", RetailLogTextType.Default),
|
||||
[0x568u] = new("That allegiance name is not appropriate. Please choose another name.", RetailLogTextType.Default),
|
||||
[0x569u] = new("That allegiance name is already in use. Please choose another name.", RetailLogTextType.Default),
|
||||
[0x56Au] = new("You may only change your allegiance name once every 24 hours. You may change your allegiance name again in %s.", RetailLogTextType.Default),
|
||||
[0x56Bu] = new("Your allegiance name has been cleared.", RetailLogTextType.Default),
|
||||
[0x56Cu] = new("That is already the name of your allegiance!", RetailLogTextType.Default),
|
||||
[0x56Du] = new("%s is the monarch and cannot be promoted or demoted.", RetailLogTextType.Default),
|
||||
[0x56Eu] = new("That level of allegiance officer is now known as: %s.", RetailLogTextType.Default),
|
||||
[0x56Fu] = new("That is an invalid officer level.", RetailLogTextType.Default),
|
||||
[0x570u] = new("That allegiance officer title is not appropriate.", RetailLogTextType.Default),
|
||||
[0x571u] = new("That allegiance name is too long. Please choose another name.", RetailLogTextType.Default),
|
||||
[0x572u] = new("All of your allegiance officer titles have been cleared.", RetailLogTextType.Default),
|
||||
[0x573u] = new("That allegiance title contains illegal characters. Please choose another name using only letters, spaces, - and '.", RetailLogTextType.Default),
|
||||
[0x574u] = new("Your allegiance is currently: %s.", RetailLogTextType.Default),
|
||||
[0x575u] = new("Your allegiance is now: %s.", RetailLogTextType.Default),
|
||||
[0x576u] = new("You may not accept the offer of allegiance from %s because your allegiance is locked.", RetailLogTextType.Default),
|
||||
[0x577u] = new("You may not swear allegiance at this time because the allegiance of %s is locked.", RetailLogTextType.Default),
|
||||
[0x578u] = new("You have pre-approved %s to join your allegiance.", RetailLogTextType.Default),
|
||||
[0x579u] = new("You have not pre-approved any vassals to join your allegiance.", RetailLogTextType.Default),
|
||||
[0x57Au] = new("%s is already a member of your allegiance!", RetailLogTextType.Default),
|
||||
[0x57Bu] = new("%s has been pre-approved to join your allegiance.", RetailLogTextType.Default),
|
||||
[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),
|
||||
[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),
|
||||
[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),
|
||||
[0x586u] = new("That item was specifically created for another race.", RetailLogTextType.ClientLocal),
|
||||
[0x587u] = new("Olthoi cannot interact with that!", RetailLogTextType.Magic),
|
||||
[0x588u] = new("Olthoi cannot use regular lifestones! Asheron would not allow it!", RetailLogTextType.Magic),
|
||||
[0x589u] = new("The vendor looks at you in horror!", RetailLogTextType.Magic),
|
||||
[0x58Au] = new("%s cowers from you!", RetailLogTextType.Default),
|
||||
[0x58Bu] = new("As a mindless engine of destruction an Olthoi cannot join a fellowship!", RetailLogTextType.Magic),
|
||||
[0x58Cu] = new("The Olthoi only have an allegiance to the Olthoi Queen!", RetailLogTextType.Magic),
|
||||
[0x58Du] = new("You cannot use that item!", RetailLogTextType.Magic),
|
||||
[0x58Eu] = new("This person will not interact with you!", RetailLogTextType.Magic),
|
||||
[0x58Fu] = new("Only Olthoi may pass through this portal!", RetailLogTextType.Magic),
|
||||
[0x590u] = new("Olthoi may not pass through this portal!", RetailLogTextType.Magic),
|
||||
[0x591u] = new("You may not pass through this portal while Vitae weakens you!", RetailLogTextType.Magic),
|
||||
[0x592u] = new("This character must be two weeks old or have been created on an account at least two weeks old to use this portal!", RetailLogTextType.Magic),
|
||||
[0x593u] = new("Olthoi characters can only use Lifestone and PK Arena recalls!", RetailLogTextType.Magic),
|
||||
};
|
||||
}
|
||||
|
|
|
|||
|
|
@ -732,7 +732,8 @@ internal sealed class HeadlessSessionHost : IDisposable
|
|||
Runtime.CommunicationOwner.Chat,
|
||||
Runtime.CommunicationOwner.TurbineChat,
|
||||
Runtime.CommunicationOwner.Friends,
|
||||
Runtime.CommunicationOwner.Squelch));
|
||||
Runtime.CommunicationOwner.Squelch,
|
||||
(text, type) => Runtime.CommunicationOwner.AddText(text, type)));
|
||||
var eventRoute = new HeadlessSessionEventRoute(
|
||||
route,
|
||||
Runtime,
|
||||
|
|
|
|||
|
|
@ -212,6 +212,14 @@ public sealed class GameRuntime
|
|||
faultInjection);
|
||||
|
||||
context.Movement = new RuntimeLocalPlayerMovementState();
|
||||
// Campaign CH slice CH2: local jump refusals (CommenceJump/
|
||||
// DoJump's WeenieError family — research doc §4.2/§6.4) reach
|
||||
// the SpewBox through the SAME AddText router server-sent
|
||||
// WeenieErrors use. Wired here, at construction, because
|
||||
// Communication (built just above) always exists before any
|
||||
// PlayerMovementController is installed.
|
||||
context.Movement.OnInterfaceText =
|
||||
(text, type) => context.Communication.AddText(text, type);
|
||||
construction.Own(context.Movement);
|
||||
Fault(
|
||||
GameRuntimeConstructionPoint.MovementCreated,
|
||||
|
|
|
|||
|
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Numerics;
|
||||
using AcDream.Core.Chat;
|
||||
using AcDream.Core.Physics;
|
||||
|
||||
namespace AcDream.Runtime.Gameplay;
|
||||
|
|
@ -166,6 +167,18 @@ public sealed class PlayerMovementController
|
|||
private uint _localEntityId;
|
||||
private AcDream.Core.Physics.Motion.PositionManager? _positionManager;
|
||||
|
||||
/// <summary>
|
||||
/// Campaign CH slice CH2: reports a client-locally-detected jump refusal
|
||||
/// (retail's <c>CommenceJump @0x0056AF90</c> / <c>DoJump @0x0056B110</c>
|
||||
/// WeenieError family — research doc §4.2/§6.4) to the SpewBox router.
|
||||
/// Wired by <c>RuntimeLocalPlayerMovementState</c>, whose
|
||||
/// <c>OnInterfaceText</c> setter applies to every controller it installs
|
||||
/// (including this one, at commit time). Never invoked directly for the
|
||||
/// jump physics/charge behaviour itself — this is a REPORT of an
|
||||
/// already-decided refusal, not a gate.
|
||||
/// </summary>
|
||||
public Action<string, RetailLogTextType>? OnInterfaceText { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum Z increase per movement step before the move is rejected.
|
||||
///
|
||||
|
|
@ -926,6 +939,41 @@ public sealed class PlayerMovementController
|
|||
"A sealed, retired, or discarded Runtime movement controller cannot be mutated.");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Campaign CH slice CH2: retail-exact <c>CommenceJump</c>/<c>DoJump</c>
|
||||
/// refusal-text dispatch (research doc §4.2, verified directly against
|
||||
/// the decomp — NOT the <c>HandleFailureEvent</c>/<c>WeenieErrorMessages</c>
|
||||
/// table, which is a DIFFERENT switch that happens to share three of
|
||||
/// these same string globals).
|
||||
/// <c>ClientCombatSystem::CommenceJump @0x0056AF90</c> and
|
||||
/// <c>ClientCombatSystem::DoJump @0x0056B110</c> each explicitly handle
|
||||
/// only <c>0x24</c>/<c>0x48</c>/<c>0x49</c>; every other code —
|
||||
/// including <c>0x47 GeneralMovementFailure</c> (fully constrained or
|
||||
/// can't afford the jump's stamina cost, <see cref="MotionInterpreter.jump_is_allowed"/>)
|
||||
/// and <c>0x08 NoPhysicsObject</c> — falls through their dispatch with
|
||||
/// NO <c>AddTextToScroll</c> call at all. Confirmed via <c>DoJump</c>'s
|
||||
/// compiled <c>switch(eax_7)</c> (raw 376288-376312): exactly 4 real
|
||||
/// case targets (<c>0</c>, <c>0x24</c>, <c>0x48</c>, <c>0x49</c>), every
|
||||
/// other index routed to the function's silent fall-through end. A
|
||||
/// fully-constrained or out-of-stamina jump refusal is therefore
|
||||
/// SILENT in retail — no on-screen text, the player just doesn't jump.
|
||||
/// </summary>
|
||||
private void ReportJumpRefusal(WeenieError result)
|
||||
{
|
||||
if (OnInterfaceText is null)
|
||||
return;
|
||||
|
||||
string? text = result switch
|
||||
{
|
||||
WeenieError.NotGrounded => ClientTextRefusals.CantJumpInAir, // 0x24
|
||||
WeenieError.YouCantJumpFromThisPosition => ClientTextRefusals.CantJumpPosition, // 0x48
|
||||
WeenieError.CantJumpLoadedDown => ClientTextRefusals.CantJumpLoad, // 0x49
|
||||
_ => null,
|
||||
};
|
||||
if (text is not null)
|
||||
OnInterfaceText(text, RetailLogTextType.ClientLocal);
|
||||
}
|
||||
|
||||
private void EnsurePublishedForRuntimeOperation()
|
||||
{
|
||||
if (_publicationLifecycle
|
||||
|
|
@ -2470,7 +2518,13 @@ public sealed class PlayerMovementController
|
|||
// place StandingLongJump arms (grounded + Ready + no
|
||||
// sidestep/turn). Never called by production code before
|
||||
// this line despite the W3 port.
|
||||
_motion.ChargeJump();
|
||||
//
|
||||
// Campaign CH slice CH2: the return value used to be
|
||||
// discarded — a refused charge (CantJumpLoadedDown /
|
||||
// YouCantJumpFromThisPosition) silently drained the power
|
||||
// bar with no explanation. Report it exactly as
|
||||
// ClientCombatSystem::CommenceJump @0x0056AF90 does.
|
||||
ReportJumpRefusal(_motion.ChargeJump());
|
||||
}
|
||||
float chargeRate = _motion.InterpretedState.CurrentStyle
|
||||
== AcDream.Core.Combat.CombatInputPlanner.DualWieldCombatStyle
|
||||
|
|
@ -2509,6 +2563,14 @@ public sealed class PlayerMovementController
|
|||
// sent in JumpAction — local + remote stay in sync.
|
||||
_body.set_local_velocity(outJumpVelocity.Value, autonomous: true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// Campaign CH slice CH2: a refused fire used to reset the
|
||||
// charge state and return silently — the power bar drained
|
||||
// and nothing happened, with no explanation. Report it
|
||||
// exactly as ClientCombatSystem::DoJump @0x0056B110 does.
|
||||
ReportJumpRefusal(jumpResult);
|
||||
}
|
||||
_jumpCharging = false;
|
||||
_jumpExtent = 0f;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -60,6 +60,7 @@ public sealed class RuntimeCommunicationState : IDisposable
|
|||
public RuntimeCommunicationState(int maximumChatEntries = 500)
|
||||
{
|
||||
Chat = new ChatLog(maximumChatEntries);
|
||||
SpewBox = new SpewBoxState();
|
||||
CommandTargets = new ChatCommandTargetState(Chat);
|
||||
_events = new RuntimeCommunicationEventStream(Chat);
|
||||
TurbineChat = new TurbineChatState();
|
||||
|
|
@ -73,6 +74,17 @@ public sealed class RuntimeCommunicationState : IDisposable
|
|||
}
|
||||
|
||||
public ChatLog Chat { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Campaign CH slice CH2: retail's transient on-screen "interface text"
|
||||
/// queue (<c>gmSpewBoxUI</c>) — the SECOND sink <see cref="AddText"/>
|
||||
/// can route to. Never written to directly by producers; always through
|
||||
/// <see cref="AddText"/> so the <c>type == ClientLocal</c> routing rule
|
||||
/// stays centralized at one chokepoint, matching retail's
|
||||
/// <c>ClientSystem::AddTextToScroll</c>.
|
||||
/// </summary>
|
||||
public SpewBoxState SpewBox { get; }
|
||||
|
||||
public ChatCommandTargetState CommandTargets { get; }
|
||||
public TurbineChatState TurbineChat { get; }
|
||||
public FriendsState Friends { get; }
|
||||
|
|
@ -114,6 +126,62 @@ public sealed class RuntimeCommunicationState : IDisposable
|
|||
public void ResetFriends() => Friends.Clear();
|
||||
public void ResetSquelch() => Squelch.Clear();
|
||||
|
||||
/// <summary>
|
||||
/// Campaign CH slice CH2: SpewBox lines are purely transient screen
|
||||
/// flash — unlike the chat transcript (which survives a reconnect via
|
||||
/// <see cref="ResetChatIdentity"/>'s preserve-content reset), a fresh
|
||||
/// generation must not resurrect a stale refusal line.
|
||||
/// </summary>
|
||||
public void ResetSpewBox() => SpewBox.Reset();
|
||||
|
||||
/// <summary>
|
||||
/// The single chokepoint every producer of player-visible interface
|
||||
/// text must go through — the direct analogue of retail's
|
||||
/// <c>ClientSystem::AddTextToScroll(text, type, allowPluginFilter,
|
||||
/// windowId) @0x00563C50</c>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Retail's routing rule (research doc §2.1) is a receiver-side type
|
||||
/// filter, not a sender-side destination switch:
|
||||
/// <list type="bullet">
|
||||
/// <item><c>type == RetailLogTextType.ClientLocal (0x1A)</c> → the
|
||||
/// SpewBox ONLY. Every <c>ChatInterface</c> window is born with that
|
||||
/// exact bit cleared from its type filter
|
||||
/// (<c>ChatInterface::ChatInterface @0x004F4550</c>,
|
||||
/// <c>m_llTextTypeFilter &= 0xFBFFFFFF</c>) — <c>0x1A</c> is
|
||||
/// precisely what every chat window refuses. Retail also skips the
|
||||
/// timestamp prefix and the chat-log-file write for this type
|
||||
/// (§2.1 step 4); since this branch never touches
|
||||
/// <see cref="Chat"/> at all, that behaviour falls out for free.
|
||||
/// </item>
|
||||
/// <item>Every other type → the existing chat transcript, tagged
|
||||
/// 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>.
|
||||
/// </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;
|
||||
|
||||
if (type == RetailLogTextType.ClientLocal)
|
||||
{
|
||||
SpewBox.Enqueue(text);
|
||||
return;
|
||||
}
|
||||
|
||||
Chat.OnSystemMessage(text, (uint)type);
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
if (_disposed)
|
||||
|
|
@ -126,6 +194,7 @@ public sealed class RuntimeCommunicationState : IDisposable
|
|||
Friends.Clear();
|
||||
Squelch.Clear();
|
||||
Chat.ResetSessionIdentity();
|
||||
SpewBox.Reset();
|
||||
}
|
||||
|
||||
private sealed class CommunicationView(ChatLog chat) : IRuntimeChatView
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using System.Diagnostics;
|
||||
using AcDream.Core.Chat;
|
||||
using AcDream.Core.Combat;
|
||||
using AcDream.Core.Physics;
|
||||
|
||||
|
|
@ -97,6 +98,26 @@ public sealed class RuntimeLocalPlayerMovementState
|
|||
private MovementInput _commandInput;
|
||||
private bool _disposed;
|
||||
private long _revision;
|
||||
private Action<string, RetailLogTextType>? _onInterfaceText;
|
||||
|
||||
/// <summary>
|
||||
/// Campaign CH slice CH2: the retail-faithful text/type router
|
||||
/// (<c>RuntimeCommunicationState.AddText</c>) — applied to every
|
||||
/// controller this owner installs, past and future, so a client-local
|
||||
/// jump refusal (<c>PlayerMovementController</c>'s local
|
||||
/// <c>ChargeJump</c>/<c>jump</c> calls, research doc §4.2/§6.4) reaches
|
||||
/// the SpewBox through the same chokepoint server-sent WeenieErrors use.
|
||||
/// </summary>
|
||||
public Action<string, RetailLogTextType>? OnInterfaceText
|
||||
{
|
||||
get => _onInterfaceText;
|
||||
set
|
||||
{
|
||||
_onInterfaceText = value;
|
||||
if (_controller is not null)
|
||||
_controller.OnInterfaceText = value;
|
||||
}
|
||||
}
|
||||
|
||||
public PlayerMovementController? Controller
|
||||
{
|
||||
|
|
@ -114,6 +135,8 @@ public sealed class RuntimeLocalPlayerMovementState
|
|||
return;
|
||||
_controller?.RetireRuntimePublication();
|
||||
_controller = value;
|
||||
if (_controller is not null)
|
||||
_controller.OnInterfaceText = _onInterfaceText;
|
||||
ControllerOwnershipEpoch++;
|
||||
Interlocked.Increment(ref _revision);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -63,7 +63,13 @@ public sealed record LiveSocialSessionBindings(
|
|||
ChatLog Chat,
|
||||
TurbineChatState TurbineChat,
|
||||
FriendsState? Friends,
|
||||
SquelchState? Squelch);
|
||||
SquelchState? Squelch,
|
||||
// Campaign CH slice CH2: the retail-faithful text/type router
|
||||
// (RuntimeCommunicationState.AddText). Optional/nullable so every
|
||||
// existing caller (including tests that build a bare ChatLog with no
|
||||
// owning RuntimeCommunicationState) compiles unchanged; GameEventWiring
|
||||
// falls back to its pre-CH2 chat-only behavior when this is null.
|
||||
Action<string, RetailLogTextType>? AddText = null);
|
||||
|
||||
/// <summary>
|
||||
/// Owns every inbound subscription for one exact live session. Domain state
|
||||
|
|
@ -195,6 +201,7 @@ public sealed class LiveSessionEventRouter : ILiveSessionEventRouting
|
|||
clientTime: character.ClientTime,
|
||||
externalContainers: inventory.ExternalContainers,
|
||||
vendor: inventory.Vendor,
|
||||
onInterfaceText: social.AddText,
|
||||
accepting: IsAccepting));
|
||||
ConstructionCheckpoint();
|
||||
|
||||
|
|
@ -267,10 +274,21 @@ public sealed class LiveSessionEventRouter : ILiveSessionEventRouting
|
|||
// raw wire word straight into AddTextToScroll with zero
|
||||
// remapping (research doc §3.3 / HearSpeech.cs doc).
|
||||
speech.ChatType));
|
||||
// 0xF7E0 ServerMessage — Campaign CH slice CH2: routed through
|
||||
// AddText with the wire chatType verbatim, matching retail's
|
||||
// Handle_Communication__TextboxString @0x0057D3A0
|
||||
// (AddTextToScroll(text, wireChatType, 1, 0) — the wire type
|
||||
// decides chat vs SpewBox, exactly like every other producer).
|
||||
Subscribe<ServerMessage.Parsed>(
|
||||
h => session.ServerMessageReceived += h,
|
||||
h => session.ServerMessageReceived -= h,
|
||||
message => social.Chat.OnSystemMessage(message.Message, message.ChatType));
|
||||
message =>
|
||||
{
|
||||
if (social.AddText is { } addText)
|
||||
addText(message.Message, (RetailLogTextType)message.ChatType);
|
||||
else
|
||||
social.Chat.OnSystemMessage(message.Message, message.ChatType);
|
||||
});
|
||||
Subscribe<EmoteText.Parsed>(h => session.EmoteHeard += h, h => session.EmoteHeard -= h, emote =>
|
||||
social.Chat.OnEmote(emote.SenderName, emote.Text, emote.SenderGuid));
|
||||
Subscribe<SoulEmote.Parsed>(h => session.SoulEmoteHeard += h, h => session.SoulEmoteHeard -= h, emote =>
|
||||
|
|
|
|||
59
src/AcDream.UI.Abstractions/Panels/SpewBox/SpewBoxVM.cs
Normal file
59
src/AcDream.UI.Abstractions/Panels/SpewBox/SpewBoxVM.cs
Normal file
|
|
@ -0,0 +1,59 @@
|
|||
using AcDream.Core.Chat;
|
||||
|
||||
namespace AcDream.UI.Abstractions.Panels.SpewBox;
|
||||
|
||||
/// <summary>
|
||||
/// One SpewBox display line plus its remaining lifetime at the moment
|
||||
/// <see cref="SpewBoxVM.Lines"/> was called.
|
||||
/// </summary>
|
||||
public readonly record struct SpewBoxLine(string Text, double RemainingLifetimeSeconds);
|
||||
|
||||
/// <summary>
|
||||
/// ViewModel for the SpewBox panel. Reads <see cref="SpewBoxState"/> and
|
||||
/// projects its visible entries into ordered display lines, mirroring
|
||||
/// <c>ChatVM</c>'s wrap of <see cref="ChatLog"/> (both are Core-layer state
|
||||
/// so this stays inside Code Structure Rule 3 — panels/ViewModels target
|
||||
/// <c>AcDream.UI.Abstractions</c>, which references <c>AcDream.Core</c> but
|
||||
/// not <c>AcDream.Runtime</c>).
|
||||
/// </summary>
|
||||
public sealed class SpewBoxVM
|
||||
{
|
||||
private readonly SpewBoxState _state;
|
||||
|
||||
public SpewBoxVM(SpewBoxState state)
|
||||
{
|
||||
_state = state ?? throw new ArgumentNullException(nameof(state));
|
||||
}
|
||||
|
||||
/// <summary>Monotonic revision of the underlying visible-line set.</summary>
|
||||
public long Revision => _state.Revision;
|
||||
|
||||
/// <summary>True while at least one line is currently visible.</summary>
|
||||
public bool HasVisibleLines => _state.Count > 0;
|
||||
|
||||
/// <summary>
|
||||
/// Ordered visible lines (newest first, matching retail's
|
||||
/// <c>InsertItem(item, 0)</c>) with each entry's remaining lifetime at
|
||||
/// <paramref name="nowSeconds"/>.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Drains the pending queue and prunes expired entries as a side
|
||||
/// effect — this call IS <c>gmSpewBoxUI::Update</c>'s once-per-tick
|
||||
/// drain; callers should invoke it once per presentation frame.
|
||||
/// </remarks>
|
||||
public IReadOnlyList<SpewBoxLine> Lines(double nowSeconds)
|
||||
{
|
||||
_state.Tick(nowSeconds);
|
||||
SpewBoxEntry[] snapshot = _state.Snapshot();
|
||||
if (snapshot.Length == 0)
|
||||
return Array.Empty<SpewBoxLine>();
|
||||
|
||||
var lines = new SpewBoxLine[snapshot.Length];
|
||||
for (int i = 0; i < snapshot.Length; i++)
|
||||
{
|
||||
double remaining = Math.Max(0d, snapshot[i].ExpiresAtSeconds - nowSeconds);
|
||||
lines[i] = new SpewBoxLine(snapshot[i].Text, remaining);
|
||||
}
|
||||
return lines;
|
||||
}
|
||||
}
|
||||
46
tests/AcDream.App.Tests/UI/SpewBoxControllerTests.cs
Normal file
46
tests/AcDream.App.Tests/UI/SpewBoxControllerTests.cs
Normal file
|
|
@ -0,0 +1,46 @@
|
|||
using AcDream.App.UI;
|
||||
using AcDream.Core.Chat;
|
||||
using AcDream.UI.Abstractions.Panels.SpewBox;
|
||||
|
||||
namespace AcDream.App.Tests.UI;
|
||||
|
||||
public sealed class SpewBoxControllerTests
|
||||
{
|
||||
[Fact]
|
||||
public void Controller_IsClickThroughOverlayAndDisposesFromRetainedRoot()
|
||||
{
|
||||
var root = new UiRoot
|
||||
{
|
||||
Width = 1280f,
|
||||
Height = 720f,
|
||||
};
|
||||
var state = new SpewBoxState();
|
||||
|
||||
using (var controller = new SpewBoxController(root, new SpewBoxVM(state)))
|
||||
{
|
||||
UiText text = Assert.IsType<UiText>(Assert.Single(root.Children));
|
||||
Assert.False(text.Visible);
|
||||
Assert.True(text.ClickThrough);
|
||||
Assert.Equal(int.MaxValue, text.ZOrder);
|
||||
|
||||
state.Enqueue("You can't jump while in the air");
|
||||
|
||||
UiText.Line line = Assert.Single(text.LinesProvider!());
|
||||
Assert.Equal("You can't jump while in the air", line.Text);
|
||||
Assert.True(text.Visible);
|
||||
}
|
||||
|
||||
Assert.Empty(root.Children);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Controller_NoContent_LeavesTextHiddenWithEmptyLines()
|
||||
{
|
||||
var root = new UiRoot { Width = 1280f, Height = 720f };
|
||||
using var controller = new SpewBoxController(root, new SpewBoxVM(new SpewBoxState()));
|
||||
|
||||
UiText text = Assert.IsType<UiText>(Assert.Single(root.Children));
|
||||
Assert.Empty(text.LinesProvider!());
|
||||
Assert.False(text.Visible);
|
||||
}
|
||||
}
|
||||
195
tests/AcDream.App.Tests/UI/SpewBoxLayoutDumpDiagnostic.cs
Normal file
195
tests/AcDream.App.Tests/UI/SpewBoxLayoutDumpDiagnostic.cs
Normal file
|
|
@ -0,0 +1,195 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using DatReaderWriter;
|
||||
using DatReaderWriter.DBObjs;
|
||||
using DatReaderWriter.Options;
|
||||
using DatReaderWriter.Types;
|
||||
using Xunit;
|
||||
using Xunit.Abstractions;
|
||||
|
||||
namespace AcDream.App.Tests.UI;
|
||||
|
||||
/// <summary>
|
||||
/// Campaign CH slice CH2, task C.7: a one-shot diagnostic sweep of every
|
||||
/// installed <see cref="LayoutDesc"/> for an element of retail's SpewBox
|
||||
/// class (<c>0x10000016</c> — <c>gmSpewBoxUI::GetUIElementType @0x004D5AA0</c>).
|
||||
/// Not a gate/conformance test — just a discovery tool, per the research
|
||||
/// doc's §8.1/§8.2 open question. Skips (does not fail) when the installed
|
||||
/// DAT directory is unavailable, matching every other
|
||||
/// <c>ContentConformanceDats.ResolveDatDir()</c>-gated diagnostic in this
|
||||
/// tree.
|
||||
///
|
||||
/// <para>
|
||||
/// <b>RESULT (2026-08-09, run against the installed <c>client_portal.dat</c>):</b>
|
||||
/// the installed DAT's entire LayoutDesc id space is the CLOSED range
|
||||
/// <c>0x21000000</c>-<c>0x21000075</c> (118 possible ids, 101 populated —
|
||||
/// sanity-checked by confirming 3 independently-known ids, 0x2100002E
|
||||
/// character window / 0x21000023 inventory / 0x21000016 toolbar prototype,
|
||||
/// are all present). The sweep is therefore EXHAUSTIVE, and it finds
|
||||
/// <b>ZERO</b> elements of class <c>0x10000016</c> anywhere in any of the
|
||||
/// 101 layouts, and LayoutDesc <c>0x10000012</c> — the id the decompiled
|
||||
/// <c>CreateChildElementByEnum(null, 0x10000012, 0x1000004A)</c> call
|
||||
/// appears to reference — exists but has zero top-level elements (it is
|
||||
/// not the per-line template catalog; that id must resolve through a
|
||||
/// different mechanism than a direct <c>dats.Get<LayoutDesc></c> hit,
|
||||
/// which this slice did not crack). Conclusion: <c>gmSpewBoxUI</c> is
|
||||
/// mounted directly from C++ code in <c>gmClient</c>'s HUD registration
|
||||
/// block (research doc §1.1) rather than resolved from any authored
|
||||
/// LayoutDesc tree — its position/extent/font/color/max-items are NOT
|
||||
/// recoverable via this dump technique. Every value the SpewBox
|
||||
/// presentation uses below is therefore an invented placeholder with its
|
||||
/// own divergence-register row, exactly as the research doc's §3.2
|
||||
/// PRESENTATION-UNKNOWN section predicted.
|
||||
/// </para>
|
||||
/// </summary>
|
||||
public sealed class SpewBoxLayoutDumpDiagnostic
|
||||
{
|
||||
private readonly ITestOutputHelper _out;
|
||||
public SpewBoxLayoutDumpDiagnostic(ITestOutputHelper output) => _out = output;
|
||||
|
||||
private const uint SpewBoxElementClass = 0x10000016u;
|
||||
private const uint ListBoxElementClass = 0x10000049u;
|
||||
private const uint LineTemplateLayoutEnum = 0x10000012u;
|
||||
private const uint LineTemplateElementId = 0x1000004Au;
|
||||
private const uint ListBoxMaxItemsProperty = 0x10000028u;
|
||||
|
||||
private static string? ResolveDatDir()
|
||||
{
|
||||
var fromEnv = System.Environment.GetEnvironmentVariable("ACDREAM_DAT_DIR");
|
||||
if (!string.IsNullOrWhiteSpace(fromEnv) && System.IO.Directory.Exists(fromEnv))
|
||||
return fromEnv;
|
||||
var def = System.IO.Path.Combine(
|
||||
System.Environment.GetFolderPath(System.Environment.SpecialFolder.UserProfile),
|
||||
"Documents", "Asheron's Call");
|
||||
return System.IO.Directory.Exists(def) ? def : null;
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void SweepInstalledLayoutDescs_ForSpewBoxElementClass()
|
||||
{
|
||||
string? datDir = ResolveDatDir();
|
||||
if (datDir is null)
|
||||
{
|
||||
_out.WriteLine("SKIP: installed retail DAT directory is unavailable.");
|
||||
return;
|
||||
}
|
||||
|
||||
using var dats = new DatCollection(datDir, DatAccessType.Read);
|
||||
|
||||
int scanned = 0;
|
||||
var hits = new List<(uint LayoutId, ElementDesc Element)>();
|
||||
var allIds = dats.GetAllIdsOfType<LayoutDesc>().ToList();
|
||||
_out.WriteLine($"Portal.GetAllIdsOfType<LayoutDesc> count: {dats.Portal.GetAllIdsOfType<LayoutDesc>().Count()}");
|
||||
_out.WriteLine($"HighRes.GetAllIdsOfType<LayoutDesc> count: {dats.HighRes.GetAllIdsOfType<LayoutDesc>().Count()}");
|
||||
_out.WriteLine($"Contains known char-window 0x2100002E: {allIds.Contains(0x2100002Eu)}");
|
||||
_out.WriteLine($"Contains known inventory 0x21000023: {allIds.Contains(0x21000023u)}");
|
||||
_out.WriteLine($"Contains known toolbar 0x21000016: {allIds.Contains(0x21000016u)}");
|
||||
_out.WriteLine($"Min id: 0x{allIds.Min():X8} Max id: 0x{allIds.Max():X8}");
|
||||
|
||||
foreach (uint layoutId in allIds)
|
||||
{
|
||||
scanned++;
|
||||
if (!dats.Portal.TryGet<LayoutDesc>(layoutId, out LayoutDesc? ld) || ld is null)
|
||||
continue;
|
||||
|
||||
foreach (var kv in ld.Elements)
|
||||
{
|
||||
var found = FindByType(kv.Value, SpewBoxElementClass);
|
||||
if (found is not null)
|
||||
hits.Add((layoutId, found));
|
||||
}
|
||||
}
|
||||
|
||||
_out.WriteLine($"Scanned {scanned} installed LayoutDescs.");
|
||||
_out.WriteLine($"Elements of class 0x{SpewBoxElementClass:X8} (gmSpewBoxUI): {hits.Count}");
|
||||
|
||||
foreach (var (layoutId, element) in hits)
|
||||
{
|
||||
_out.WriteLine(
|
||||
$" LayoutDesc 0x{layoutId:X8} -> element 0x{element.ElementId:X8} "
|
||||
+ $"pos=({element.X},{element.Y}) size=({element.Width}x{element.Height}) "
|
||||
+ $"zLevel={element.ZLevel} readOrder={element.ReadOrder} "
|
||||
+ $"children={element.Children.Count}");
|
||||
|
||||
var listBox = FindByType(element, ListBoxElementClass);
|
||||
if (listBox is not null)
|
||||
{
|
||||
_out.WriteLine(
|
||||
$" ListBox child 0x{listBox.ElementId:X8} "
|
||||
+ $"pos=({listBox.X},{listBox.Y}) size=({listBox.Width}x{listBox.Height})");
|
||||
DumpProperties(listBox, " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
_out.WriteLine(" (no ListBox child of class 0x10000049 found)");
|
||||
}
|
||||
}
|
||||
|
||||
// Also probe the presumed shared line-template catalog directly —
|
||||
// gmSpewBoxUI::Update's CreateChildElementByEnum(null, 0x10000012,
|
||||
// 0x1000004A) call implies LayoutDesc 0x10000012 hosts a template
|
||||
// catalog with a top-level entry 0x1000004A.
|
||||
if (dats.Portal.TryGet<LayoutDesc>(LineTemplateLayoutEnum, out LayoutDesc? templateLd)
|
||||
&& templateLd is not null)
|
||||
{
|
||||
_out.WriteLine($"LayoutDesc 0x{LineTemplateLayoutEnum:X8} exists ({templateLd.Elements.Count} top-level elements).");
|
||||
if (templateLd.Elements.TryGetValue(LineTemplateElementId, out ElementDesc? lineTemplate))
|
||||
{
|
||||
_out.WriteLine(
|
||||
$" Line template 0x{LineTemplateElementId:X8}: type=0x{lineTemplate.Type:X8} "
|
||||
+ $"pos=({lineTemplate.X},{lineTemplate.Y}) size=({lineTemplate.Width}x{lineTemplate.Height})");
|
||||
DumpProperties(lineTemplate, " ");
|
||||
}
|
||||
else
|
||||
{
|
||||
_out.WriteLine($" No top-level element 0x{LineTemplateElementId:X8} in that LayoutDesc.");
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
_out.WriteLine($"LayoutDesc 0x{LineTemplateLayoutEnum:X8} does not exist in the installed DAT.");
|
||||
}
|
||||
|
||||
// Informational only — this is a discovery sweep, not a pass/fail gate.
|
||||
// The findings are transcribed into WeenieErrorMessages/SpewBoxController
|
||||
// doc comments and the divergence register by hand after reading this
|
||||
// output; there is nothing here worth asserting on.
|
||||
}
|
||||
|
||||
private static ElementDesc? FindByType(ElementDesc d, uint type)
|
||||
{
|
||||
if (d.Type == type)
|
||||
return d;
|
||||
foreach (var kv in d.Children)
|
||||
{
|
||||
var found = FindByType(kv.Value, type);
|
||||
if (found is not null)
|
||||
return found;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private static void DumpProperties(ElementDesc d, string indent)
|
||||
{
|
||||
if (d.StateDesc?.Properties is null)
|
||||
{
|
||||
System.Console.WriteLine($"{indent}(no direct-state properties)");
|
||||
return;
|
||||
}
|
||||
|
||||
foreach (var (propertyId, property) in d.StateDesc.Properties)
|
||||
{
|
||||
System.Console.WriteLine($"{indent}property 0x{propertyId:X8} = {Describe(property)}"
|
||||
+ (propertyId == ListBoxMaxItemsProperty ? " <-- MaxConcurrentItems" : ""));
|
||||
}
|
||||
}
|
||||
|
||||
private static string Describe(object property) => property switch
|
||||
{
|
||||
DatReaderWriter.Types.EnumBaseProperty e => $"Enum({e.Value})",
|
||||
DatReaderWriter.Types.DataIdBaseProperty did => $"DataId(0x{did.Value:X8})",
|
||||
DatReaderWriter.Types.ArrayBaseProperty arr => $"Array[{arr.Value.Count}]({string.Join(", ", arr.Value.Select(Describe))})",
|
||||
_ => property.ToString() ?? "?",
|
||||
};
|
||||
}
|
||||
|
|
@ -758,6 +758,162 @@ public sealed class GameEventWiringTests
|
|||
Assert.Contains("Mana Stone", e.Text);
|
||||
}
|
||||
|
||||
// ── Campaign CH slice CH2: onInterfaceText routing ───────────────────
|
||||
|
||||
private static (GameEventDispatcher Dispatcher, ChatLog Chat, List<(string Text, RetailLogTextType Type)> Reported)
|
||||
MakeAllWithInterfaceTextRouter()
|
||||
{
|
||||
var dispatcher = new GameEventDispatcher();
|
||||
var chat = new ChatLog();
|
||||
var reported = new List<(string, RetailLogTextType)>();
|
||||
GameEventWiring.WireAll(
|
||||
dispatcher,
|
||||
new ClientObjectTable(),
|
||||
new CombatState(),
|
||||
new Spellbook(),
|
||||
chat,
|
||||
onInterfaceText: (text, type) => reported.Add((text, type)));
|
||||
return (dispatcher, chat, reported);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_WithRouter_WeenieError_ClientLocalCode_RoutesThroughRouter_NotChat()
|
||||
{
|
||||
// 0x024 = NotGrounded / YouCantJumpWhileInTheAir -> ClientLocal per
|
||||
// the full HandleFailureEvent table. With a router wired, this must
|
||||
// reach the router (and therefore, in production, the SpewBox) and
|
||||
// NEVER the chat transcript — the exact CH1-era behavior this test
|
||||
// replaces (chat.OnWeenieError used to type every code 0x00).
|
||||
var (d, chat, reported) = MakeAllWithInterfaceTextRouter();
|
||||
|
||||
byte[] payload = new byte[4];
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload, 0x024u);
|
||||
var env = GameEventEnvelope.TryParse(WrapEnvelope(GameEventType.WeenieError, payload));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
Assert.Equal(0, chat.Count);
|
||||
var (text, type) = Assert.Single(reported);
|
||||
Assert.Equal(ClientTextRefusals.CantJumpInAir, text);
|
||||
Assert.Equal(RetailLogTextType.ClientLocal, type);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_WithRouter_WeenieError_ChatTypeCode_RoutesThroughRouter_AsChatType()
|
||||
{
|
||||
// 0x402 = Your spell fizzled -> Magic (0x07) per the table. Routed
|
||||
// text still goes through the SAME router (production forwards
|
||||
// non-ClientLocal types to the chat transcript via AddText).
|
||||
var (d, _, reported) = MakeAllWithInterfaceTextRouter();
|
||||
|
||||
byte[] payload = new byte[4];
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload, 0x402u);
|
||||
var env = GameEventEnvelope.TryParse(WrapEnvelope(GameEventType.WeenieError, payload));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
var (text, type) = Assert.Single(reported);
|
||||
Assert.Equal("Your spell fizzled.", text);
|
||||
Assert.Equal(RetailLogTextType.Magic, type);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_WithRouter_WeenieErrorWithString_SubstitutesParam_AndRoutesByType()
|
||||
{
|
||||
var (d, chat, reported) = MakeAllWithInterfaceTextRouter();
|
||||
|
||||
// 0x521 = "%s has been added to the list of people you can hear." -> Default (0x00).
|
||||
byte[] interpBytes = MakeString16L("Caith");
|
||||
byte[] payload = new byte[4 + interpBytes.Length];
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload, 0x521u);
|
||||
Array.Copy(interpBytes, 0, payload, 4, interpBytes.Length);
|
||||
var env = GameEventEnvelope.TryParse(WrapEnvelope(GameEventType.WeenieErrorWithString, payload));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
var (text, type) = Assert.Single(reported);
|
||||
Assert.Equal("Caith has been added to the list of people you can hear.", text);
|
||||
Assert.Equal(RetailLogTextType.Default, type);
|
||||
Assert.Equal(0, chat.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_WithRouter_SilentClientControlStatus_StillDropped()
|
||||
{
|
||||
var (d, chat, reported) = MakeAllWithInterfaceTextRouter();
|
||||
byte[] payload = new byte[4];
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload, 0x003Bu); // ILeftTheWorld
|
||||
var env = GameEventEnvelope.TryParse(WrapEnvelope(GameEventType.WeenieError, payload));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
Assert.Empty(reported);
|
||||
Assert.Equal(0, chat.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_WithRouter_CommunicationTransientString_AlwaysClientLocal()
|
||||
{
|
||||
// Retail hardcodes AddTextToScroll(text, 0x1A, 1, 0) for 0x02EB —
|
||||
// corrects the CH1-era 0x00 routing note in GameEventWiring.cs.
|
||||
var (d, chat, reported) = MakeAllWithInterfaceTextRouter();
|
||||
|
||||
byte[] payload = MakeString16L("You are too encumbered to carry that!");
|
||||
var env = GameEventEnvelope.TryParse(
|
||||
WrapEnvelope(GameEventType.CommunicationTransientString, payload));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
var (text, type) = Assert.Single(reported);
|
||||
Assert.Equal("You are too encumbered to carry that!", text);
|
||||
Assert.Equal(RetailLogTextType.ClientLocal, type);
|
||||
Assert.Equal(0, chat.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_NoRouter_CommunicationTransientString_FallsBackToChatWithClientLocalType()
|
||||
{
|
||||
// No router wired (older/test caller shape) — the fallback still
|
||||
// tags the entry with the retail-correct type even though it can't
|
||||
// perform the SpewBox split.
|
||||
var (d, _, _, _, chat) = MakeAll();
|
||||
|
||||
byte[] payload = MakeString16L("fallback text");
|
||||
var env = GameEventEnvelope.TryParse(
|
||||
WrapEnvelope(GameEventType.CommunicationTransientString, payload));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
Assert.Equal(1, chat.Count);
|
||||
var e = chat.Snapshot()[0];
|
||||
Assert.Equal("fallback text", e.Text);
|
||||
Assert.Equal((uint)RetailLogTextType.ClientLocal, e.LogTextType);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_WithRouter_UseDone_NonZeroError_RoutesResolvedTextAndType()
|
||||
{
|
||||
// 0x1D = YoureTooBusy -> ClientLocal per the table. Folds the former
|
||||
// WeenieErrorText.cs 4-entry map into the full table (register AP-74).
|
||||
var (d, chat, reported) = MakeAllWithInterfaceTextRouter();
|
||||
|
||||
byte[] payload = new byte[4];
|
||||
BinaryPrimitives.WriteUInt32LittleEndian(payload, 0x001Du);
|
||||
var env = GameEventEnvelope.TryParse(WrapEnvelope(GameEventType.UseDone, payload));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
var (text, type) = Assert.Single(reported);
|
||||
Assert.Equal("You're too busy!", text);
|
||||
Assert.Equal(RetailLogTextType.ClientLocal, type);
|
||||
Assert.Equal(0, chat.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void WireAll_WithRouter_UseDone_ZeroError_ReportsNothing()
|
||||
{
|
||||
var (d, _, reported) = MakeAllWithInterfaceTextRouter();
|
||||
|
||||
byte[] payload = new byte[4]; // err == 0
|
||||
var env = GameEventEnvelope.TryParse(WrapEnvelope(GameEventType.UseDone, payload));
|
||||
d.Dispatch(env!.Value);
|
||||
|
||||
Assert.Empty(reported);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void PlayerDescription_RegistersInventoryEntries_InClientObjectTable()
|
||||
{
|
||||
|
|
|
|||
171
tests/AcDream.Core.Tests/Chat/SpewBoxStateTests.cs
Normal file
171
tests/AcDream.Core.Tests/Chat/SpewBoxStateTests.cs
Normal file
|
|
@ -0,0 +1,171 @@
|
|||
using AcDream.Core.Chat;
|
||||
|
||||
namespace AcDream.Core.Tests.Chat;
|
||||
|
||||
/// <summary>
|
||||
/// Campaign CH slice CH2: unit tests for <see cref="SpewBoxState"/>, the
|
||||
/// pure-state port of retail's <c>gmSpewBoxUI</c> pending/visible queue
|
||||
/// split (research doc §3.1/§7.2).
|
||||
/// </summary>
|
||||
public sealed class SpewBoxStateTests
|
||||
{
|
||||
[Fact]
|
||||
public void Enqueue_DoesNotBecomeVisibleUntilTick()
|
||||
{
|
||||
// Retail decouples enqueue (RecvNotice_DisplayFinalStringInfo) from
|
||||
// display (Update, driven by UI tick global message 3) by one frame.
|
||||
var state = new SpewBoxState();
|
||||
state.Enqueue("You can't jump while in the air");
|
||||
|
||||
Assert.Equal(0, state.Count);
|
||||
Assert.Empty(state.Snapshot());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Tick_DrainsPendingIntoVisible()
|
||||
{
|
||||
var state = new SpewBoxState();
|
||||
state.Enqueue("You can't jump while in the air");
|
||||
|
||||
state.Tick(nowSeconds: 0d);
|
||||
|
||||
Assert.Equal(1, state.Count);
|
||||
SpewBoxEntry entry = Assert.Single(state.Snapshot());
|
||||
Assert.Equal("You can't jump while in the air", entry.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Tick_InsertsNewestAtIndexZero()
|
||||
{
|
||||
// Retail: InsertItem(item, 0) — with MaxConcurrentItems raised past
|
||||
// the code default of 1, newer entries must lead the visible list.
|
||||
var state = new SpewBoxState();
|
||||
state.Enqueue("first");
|
||||
state.Tick(0d);
|
||||
state.Enqueue("second");
|
||||
state.Tick(0d);
|
||||
|
||||
// MaxConcurrentItems == 1 (retail code default) means "first" was
|
||||
// already evicted by the overflow rule — assert directly on the
|
||||
// ordering guarantee instead by forcing a raised cap via reflection
|
||||
// is out of scope; the dedupe/overflow tests below cover that
|
||||
// interaction precisely. Here we only need the single surviving
|
||||
// entry to be "second" (the newest), proving insert-at-front beat
|
||||
// whatever eviction order a stack (insert-at-back) would produce.
|
||||
SpewBoxEntry entry = Assert.Single(state.Snapshot());
|
||||
Assert.Equal("second", entry.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Tick_IdenticalRepeat_RefreshesInPlace_DoesNotStack()
|
||||
{
|
||||
// Retail (0x004D5EF6-0x004D5F91): if the current item 0 has
|
||||
// byte-identical text, that older item is deleted first — a
|
||||
// repeated message refreshes instead of stacking a duplicate.
|
||||
var state = new SpewBoxState();
|
||||
state.Enqueue("You are too encumbered to carry that!");
|
||||
state.Tick(0d);
|
||||
state.Enqueue("You are too encumbered to carry that!");
|
||||
state.Tick(1d);
|
||||
|
||||
Assert.Equal(1, state.Count);
|
||||
SpewBoxEntry entry = Assert.Single(state.Snapshot());
|
||||
Assert.Equal("You are too encumbered to carry that!", entry.Text);
|
||||
// The refreshed entry carries the LATER expiry (re-inserted at t=1).
|
||||
Assert.Equal(1d + SpewBoxState.DefaultLifetime.TotalSeconds, entry.ExpiresAtSeconds);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Tick_DifferentText_DoesNotDedupe()
|
||||
{
|
||||
var state = new SpewBoxState();
|
||||
state.Enqueue("first message");
|
||||
state.Tick(0d);
|
||||
state.Enqueue("second message");
|
||||
state.Tick(0d);
|
||||
|
||||
// With MaxConcurrentItems == 1, "second message" evicts "first
|
||||
// message" via overflow, not dedupe — either way only one survives,
|
||||
// and it must be the newest.
|
||||
SpewBoxEntry entry = Assert.Single(state.Snapshot());
|
||||
Assert.Equal("second message", entry.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Tick_Overflow_DropsOldest_RespectingMaxConcurrentItems()
|
||||
{
|
||||
var state = new SpewBoxState();
|
||||
Assert.Equal(1, SpewBoxState.MaxConcurrentItems);
|
||||
|
||||
state.Enqueue("oldest");
|
||||
state.Tick(0d);
|
||||
state.Enqueue("newer");
|
||||
state.Tick(0d);
|
||||
|
||||
Assert.Equal(SpewBoxState.MaxConcurrentItems, state.Count);
|
||||
SpewBoxEntry entry = Assert.Single(state.Snapshot());
|
||||
Assert.Equal("newer", entry.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Tick_PrunesExpiredEntries()
|
||||
{
|
||||
var state = new SpewBoxState();
|
||||
state.Enqueue("fading message");
|
||||
state.Tick(nowSeconds: 0d);
|
||||
Assert.Equal(1, state.Count);
|
||||
|
||||
double justPastExpiry = SpewBoxState.DefaultLifetime.TotalSeconds + 0.001;
|
||||
state.Tick(justPastExpiry);
|
||||
|
||||
Assert.Equal(0, state.Count);
|
||||
Assert.Empty(state.Snapshot());
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Tick_NoPendingNoExpired_RevisionUnchanged()
|
||||
{
|
||||
var state = new SpewBoxState();
|
||||
state.Enqueue("stays visible a while");
|
||||
state.Tick(0d);
|
||||
long revisionAfterFirstTick = state.Revision;
|
||||
|
||||
// Well within the lifetime window, nothing pending — a second Tick
|
||||
// should be a pure no-op.
|
||||
state.Tick(0.5d);
|
||||
|
||||
Assert.Equal(revisionAfterFirstTick, state.Revision);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Reset_ClearsPendingAndVisible()
|
||||
{
|
||||
var state = new SpewBoxState();
|
||||
state.Enqueue("pending, never ticked");
|
||||
state.Enqueue("about to be visible");
|
||||
state.Tick(0d);
|
||||
Assert.True(state.Count > 0);
|
||||
|
||||
state.Reset();
|
||||
|
||||
Assert.Equal(0, state.Count);
|
||||
Assert.Empty(state.Snapshot());
|
||||
|
||||
// A Reset while text was still pending (never ticked) must also
|
||||
// discard the pending queue — ticking afterward shows nothing.
|
||||
state.Tick(1d);
|
||||
Assert.Equal(0, state.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Revision_AdvancesOnTickThatChangesVisibleSet()
|
||||
{
|
||||
var state = new SpewBoxState();
|
||||
long initial = state.Revision;
|
||||
|
||||
state.Enqueue("a line");
|
||||
state.Tick(0d);
|
||||
|
||||
Assert.True(state.Revision > initial);
|
||||
}
|
||||
}
|
||||
|
|
@ -42,11 +42,17 @@ public sealed class WeenieErrorMessagesTests
|
|||
// ── known codes — informational, no parameter ────────────────────
|
||||
|
||||
[Fact]
|
||||
public void Format_TurbineChatIsEnabled_NoParamForm()
|
||||
public void Format_0x051D_FallsBackToHex_NoRetailCaseExists()
|
||||
{
|
||||
// 0x051D came in WeenieError (no param) form at login.
|
||||
// Campaign CH slice CH2: the pre-CH2 "Turbine Chat is enabled."
|
||||
// text for 0x051D was an ACE-derived guess, never decomp-confirmed.
|
||||
// The full HandleFailureEvent port found NO case for 0x51D anywhere
|
||||
// in the switch (only 0x51C has one — case 0x51c: at raw line
|
||||
// 383115-383118 of acclient_2013_pseudo_c.txt) — retail's own
|
||||
// client simply has no display text for this id. Falling back to
|
||||
// the generic form is now the retail-faithful answer, not a gap.
|
||||
Assert.Equal(
|
||||
"Turbine Chat is enabled.",
|
||||
"WeenieError 0x051D",
|
||||
WeenieErrorMessages.Format(0x051D, param: null));
|
||||
}
|
||||
|
||||
|
|
@ -149,14 +155,16 @@ public sealed class WeenieErrorMessagesTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Format_AdjacentUnmappedPKCode_StillFallsBackToHex()
|
||||
public void Format_LevelTooLowToChangePKStatus_NowResolvedByCH2()
|
||||
{
|
||||
// 0x04EE (LevelTooLowToChangePKStatusWithObject) sits right next
|
||||
// to the codes above but its retail literal
|
||||
// ("Your level is too low to change…") was NOT independently
|
||||
// byte-recovered in this pass — confirms the fallback still
|
||||
// covers the untouched neighbours rather than silently guessing.
|
||||
Assert.Equal("WeenieError 0x04EE", WeenieErrorMessages.Format(0x04EE, null));
|
||||
// 0x04EE (LevelTooLowToChangePKStatusWithObject) sits right next to
|
||||
// the PK-status codes above; the pre-CH2 test asserted the
|
||||
// fallback because only a curated ~60-entry subset was ported then.
|
||||
// Campaign CH slice CH2's full 338-row HandleFailureEvent port
|
||||
// (Appendix A row 0x4EE, Type 0x00) resolves it for real.
|
||||
Assert.Equal(
|
||||
"Your level is too low to change your player killer status with this object.",
|
||||
WeenieErrorMessages.Format(0x04EE, null));
|
||||
}
|
||||
|
||||
// ── unknown codes — graceful fallback preserves debug info ───────
|
||||
|
|
@ -193,10 +201,17 @@ public sealed class WeenieErrorMessagesTests
|
|||
}
|
||||
|
||||
[Fact]
|
||||
public void Format_FailToAffectCannotBeHarmed_SubstitutesParam()
|
||||
public void Format_0x004F_FallsBackToHex_NoRetailCaseExists()
|
||||
{
|
||||
// Campaign CH slice CH2: the pre-CH2 "You fail to affect _ because
|
||||
// they cannot be harmed!" text for 0x004F was an ACE-derived guess.
|
||||
// Direct decomp verification (grepping every "case 0x4f:" in
|
||||
// ClientCommunicationSystem::HandleFailureEvent's whole body) found
|
||||
// NONE — only 0x4E, 0x50, 0x51, 0x52, 0x53, 0x54 have cases; 0x4F is
|
||||
// skipped entirely, same as the many other gaps in that switch's
|
||||
// sparse jump table. Retail has no display text for this id.
|
||||
Assert.Equal(
|
||||
"You fail to affect Drudge because they cannot be harmed!",
|
||||
"WeenieError 0x004F: Drudge",
|
||||
WeenieErrorMessages.Format(0x004F, "Drudge"));
|
||||
}
|
||||
|
||||
|
|
@ -207,4 +222,85 @@ public sealed class WeenieErrorMessagesTests
|
|||
"+Acdream is already at full health!",
|
||||
WeenieErrorMessages.Format(0x04FF, "+Acdream"));
|
||||
}
|
||||
|
||||
// ── Campaign CH slice CH2: the full HandleFailureEvent table port ────
|
||||
|
||||
/// <summary>
|
||||
/// Pins the table's size: 338 rows (Appendix A's 339 minus the one
|
||||
/// deliberately-excluded 0x4F8, see the class doc comment on
|
||||
/// <see cref="WeenieErrorMessages"/>). A change to this number without
|
||||
/// a matching research/commit citation is a red flag, not a routine
|
||||
/// edit.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void Resolve_FullTable_HasExactly338Rows()
|
||||
{
|
||||
int count = 0;
|
||||
for (uint id = 0; id <= 0x600u; id++)
|
||||
{
|
||||
var (text, _) = WeenieErrorMessages.Resolve(id, null);
|
||||
if (!text.StartsWith("WeenieError 0x", StringComparison.Ordinal))
|
||||
count++;
|
||||
}
|
||||
Assert.Equal(338, count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Resolve_0x4F8_IsDeliberatelyExcluded_FallsBackToHex()
|
||||
{
|
||||
// See the class doc comment: 0x4F8's case body is a tangled
|
||||
// multi-operator+ decompiler artifact that could not be resolved
|
||||
// with confidence — excluded rather than guessed.
|
||||
var (text, type) = WeenieErrorMessages.Resolve(0x4F8, "Someone");
|
||||
Assert.Equal("WeenieError 0x04F8: Someone", text);
|
||||
Assert.Equal(RetailLogTextType.Default, type);
|
||||
}
|
||||
|
||||
// ── spot pins across all three retail routing destinations ──────────
|
||||
|
||||
[Theory]
|
||||
// ClientLocal (0x1A) — the SpewBox destination.
|
||||
[InlineData(0x017u, "You failed to go to non-combat mode.", RetailLogTextType.ClientLocal)]
|
||||
[InlineData(0x02Au, "You are too encumbered to carry that!", RetailLogTextType.ClientLocal)]
|
||||
[InlineData(0x04EBu, "You can't do that while in the air!", RetailLogTextType.ClientLocal)]
|
||||
[InlineData(0x550u, "Out of Range!", RetailLogTextType.ClientLocal)]
|
||||
// Magic (0x07) — the light-blue spell/portal-failure channel.
|
||||
[InlineData(0x402u, "Your spell fizzled.", RetailLogTextType.Magic)]
|
||||
[InlineData(0x49Bu, "You fail to link with the lifestone!", RetailLogTextType.Magic)]
|
||||
[InlineData(0x593u, "Olthoi characters can only use Lifestone and PK Arena recalls!", RetailLogTextType.Magic)]
|
||||
// Default (0x00) — the ordinary broadcast/green channel.
|
||||
[InlineData(0x4A, "Ack! You killed yourself!", RetailLogTextType.Default)]
|
||||
[InlineData(0x50Cu, "%s is now a closed fellowship.", RetailLogTextType.Default)]
|
||||
[InlineData(0x55Fu, "Only Player Killer characters may use this command!", RetailLogTextType.Default)]
|
||||
public void Resolve_SpotPins_TextAndTypeMatchAppendixA(uint id, string expectedTemplate, RetailLogTextType expectedType)
|
||||
{
|
||||
var (text, type) = WeenieErrorMessages.Resolve(id, param: null);
|
||||
Assert.Equal(expectedTemplate, text);
|
||||
Assert.Equal(expectedType, type);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Resolve_JumpFamily_SharesClientTextRefusalsConstantsVerbatim()
|
||||
{
|
||||
// HandleFailureEvent's 0x24/0x48/0x49 cases reuse the SAME string
|
||||
// globals as the local jump-refusal sites — assert byte-identity,
|
||||
// not just similar wording.
|
||||
Assert.Equal(ClientTextRefusals.CantJumpInAir, WeenieErrorMessages.Resolve(0x024u, null).Text);
|
||||
Assert.Equal(ClientTextRefusals.CantJumpPosition, WeenieErrorMessages.Resolve(0x048u, null).Text);
|
||||
Assert.Equal(ClientTextRefusals.CantJumpLoad, WeenieErrorMessages.Resolve(0x049u, null).Text);
|
||||
Assert.Equal(RetailLogTextType.ClientLocal, WeenieErrorMessages.Resolve(0x024u, null).Type);
|
||||
Assert.Equal(RetailLogTextType.ClientLocal, WeenieErrorMessages.Resolve(0x048u, null).Type);
|
||||
Assert.Equal(RetailLogTextType.ClientLocal, WeenieErrorMessages.Resolve(0x049u, null).Type);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Resolve_0x4F4_PreservesRetailDollarSTypo()
|
||||
{
|
||||
// Retail's own literal is "...because $s cannot affect anyone!" —
|
||||
// a genuine retail typo (should have been %s). Only the FIRST %s
|
||||
// substitutes; the literal "$s" must NOT be replaced.
|
||||
var (text, type) = WeenieErrorMessages.Resolve(0x4F4u, "A drudge");
|
||||
Assert.Equal("A drudge fails to affect you because $s cannot affect anyone!", text);
|
||||
Assert.Equal(RetailLogTextType.Magic, type);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Numerics;
|
||||
using AcDream.Core.Chat;
|
||||
using AcDream.Core.Physics;
|
||||
using AcDream.Core.Physics.Motion;
|
||||
using AcDream.Runtime.Gameplay;
|
||||
|
|
@ -880,6 +881,65 @@ public class PlayerMovementControllerTests
|
|||
Assert.Equal(baseline, restored, precision: 4);
|
||||
}
|
||||
|
||||
// ── Campaign CH slice CH2: local jump refusals reach the SpewBox ───────
|
||||
|
||||
[Fact]
|
||||
public void ChargeJump_RefusedByOverBurden_ReportsCantJumpLoadedDown()
|
||||
{
|
||||
// CACQualities::CanJump refuses past 200% load (PlayerWeenie.CanJump,
|
||||
// CanJumpLoadThreshold = 2.0f) — a real, production-reachable refusal,
|
||||
// not a fake. Retail: ClientCombatSystem::CommenceJump @0x0056AF90's
|
||||
// eax_3 == 0x49 branch -> cant_jump_load.
|
||||
var engine = MakeFlatEngine();
|
||||
var controller = new PlayerMovementController(engine);
|
||||
controller.SeedPlacementForTest(new Vector3(96f, 96f, 50f), 0x0001, new Vector3(96f, 96f, 50f));
|
||||
controller.SetCharacterBurden(2.5f);
|
||||
|
||||
var reported = new List<(string Text, AcDream.Core.Chat.RetailLogTextType Type)>();
|
||||
controller.OnInterfaceText = (text, type) => reported.Add((text, type));
|
||||
|
||||
controller.Update(0.016f, new MovementInput(Jump: true));
|
||||
|
||||
var report = Assert.Single(reported);
|
||||
Assert.Equal(ClientTextRefusals.CantJumpLoad, report.Text);
|
||||
Assert.Equal(AcDream.Core.Chat.RetailLogTextType.ClientLocal, report.Type);
|
||||
Assert.False(controller.IsAirborne, "a refused charge must not launch the player");
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ChargeJump_Succeeds_ReportsNothing()
|
||||
{
|
||||
var engine = MakeFlatEngine();
|
||||
var controller = new PlayerMovementController(engine);
|
||||
controller.SeedPlacementForTest(new Vector3(96f, 96f, 50f), 0x0001, new Vector3(96f, 96f, 50f));
|
||||
|
||||
var reported = new List<string>();
|
||||
controller.OnInterfaceText = (text, _) => reported.Add(text);
|
||||
|
||||
controller.Update(1.0f, new MovementInput(Jump: true)); // full charge
|
||||
controller.Update(0.016f, new MovementInput(Jump: false)); // release -> jump fires
|
||||
|
||||
Assert.Empty(reported);
|
||||
Assert.True(controller.IsAirborne);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ChargeJump_RefusalWithNoObserverWired_DoesNotThrow()
|
||||
{
|
||||
// OnInterfaceText defaults to null (no production wiring in a bare
|
||||
// test controller) — the refusal path must be a safe no-op, not a
|
||||
// NullReferenceException.
|
||||
var engine = MakeFlatEngine();
|
||||
var controller = new PlayerMovementController(engine);
|
||||
controller.SeedPlacementForTest(new Vector3(96f, 96f, 50f), 0x0001, new Vector3(96f, 96f, 50f));
|
||||
controller.SetCharacterBurden(2.5f);
|
||||
|
||||
var exception = Record.Exception(() =>
|
||||
controller.Update(0.016f, new MovementInput(Jump: true)));
|
||||
|
||||
Assert.Null(exception);
|
||||
}
|
||||
|
||||
// ── Campaign P Slice P5 (2026-07-30): ConstraintManager leash arming (#167) ──
|
||||
//
|
||||
// docs/research/2026-07-30-constraint-leash-constants.md. The player's
|
||||
|
|
|
|||
|
|
@ -167,6 +167,82 @@ public sealed class RuntimeCommunicationStateTests
|
|||
Assert.Null(second.CommandTargets.LastIncomingTellSender);
|
||||
}
|
||||
|
||||
// ── Campaign CH slice CH2: AddText routing chokepoint ────────────────
|
||||
|
||||
[Fact]
|
||||
public void AddText_ClientLocal_RoutesToSpewBoxOnly_NeverChatTranscript()
|
||||
{
|
||||
// Retail: type == 0x1A (ClientLocal) is exactly the bit every
|
||||
// ChatInterface window's default filter excludes
|
||||
// (ChatInterface::ChatInterface @0x004F4550,
|
||||
// m_llTextTypeFilter &= 0xFBFFFFFF). The CH1-era ChatLog.OnWeenieError
|
||||
// path put EVERY WeenieError line in chat, including 0x1A ones —
|
||||
// this is the fix: a ClientLocal line must reach SpewBox and never
|
||||
// touch the chat transcript at all.
|
||||
using var state = new RuntimeCommunicationState();
|
||||
|
||||
state.AddText("You can't jump while in the air", RetailLogTextType.ClientLocal);
|
||||
|
||||
Assert.Equal(0, state.Chat.Count);
|
||||
state.SpewBox.Tick(0d);
|
||||
Assert.Equal(1, state.SpewBox.Count);
|
||||
Assert.Equal("You can't jump while in the air", state.SpewBox.Snapshot()[0].Text);
|
||||
}
|
||||
|
||||
[Theory]
|
||||
[InlineData(RetailLogTextType.Default)]
|
||||
[InlineData(RetailLogTextType.Magic)]
|
||||
[InlineData(RetailLogTextType.System)]
|
||||
public void AddText_NonClientLocalTypes_RouteToChatOnly_NeverSpewBox(RetailLogTextType type)
|
||||
{
|
||||
using var state = new RuntimeCommunicationState();
|
||||
|
||||
state.AddText("Your spell fizzled.", type);
|
||||
|
||||
Assert.Equal(1, state.Chat.Count);
|
||||
Assert.Equal("Your spell fizzled.", state.Chat.Snapshot()[0].Text);
|
||||
Assert.Equal((uint)type, state.Chat.Snapshot()[0].LogTextType);
|
||||
state.SpewBox.Tick(0d);
|
||||
Assert.Equal(0, state.SpewBox.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddText_TrimsTrailingWhitespace_LikeRetailAddTextToScroll()
|
||||
{
|
||||
using var state = new RuntimeCommunicationState();
|
||||
|
||||
state.AddText("Out of Range! ", RetailLogTextType.ClientLocal);
|
||||
|
||||
state.SpewBox.Tick(0d);
|
||||
Assert.Equal("Out of Range!", state.SpewBox.Snapshot()[0].Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void AddText_EmptyAfterTrim_IsDropped()
|
||||
{
|
||||
using var state = new RuntimeCommunicationState();
|
||||
|
||||
state.AddText(" ", RetailLogTextType.ClientLocal);
|
||||
state.AddText(" ", RetailLogTextType.Default);
|
||||
|
||||
state.SpewBox.Tick(0d);
|
||||
Assert.Equal(0, state.SpewBox.Count);
|
||||
Assert.Equal(0, state.Chat.Count);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Dispose_ResetsSpewBox()
|
||||
{
|
||||
var state = new RuntimeCommunicationState();
|
||||
state.AddText("about to be torn down", RetailLogTextType.ClientLocal);
|
||||
state.SpewBox.Tick(0d);
|
||||
Assert.Equal(1, state.SpewBox.Count);
|
||||
|
||||
state.Dispose();
|
||||
|
||||
Assert.Equal(0, state.SpewBox.Count);
|
||||
}
|
||||
|
||||
private sealed class RecordingObserver : IRuntimeCommunicationObserver
|
||||
{
|
||||
public List<RuntimeCommunicationEvent> Events { get; } = [];
|
||||
|
|
|
|||
|
|
@ -153,6 +153,57 @@ public sealed class RuntimeLocalPlayerMovementStateTests
|
|||
Assert.NotEqual(first.Snapshot.Position, second.Snapshot.Position);
|
||||
}
|
||||
|
||||
// ── Campaign CH slice CH2: OnInterfaceText propagation ──────────────
|
||||
|
||||
[Fact]
|
||||
public void OnInterfaceText_SetBeforeControllerInstall_AppliesToTheInstalledController()
|
||||
{
|
||||
using var movement = new RuntimeLocalPlayerMovementState();
|
||||
var received = new List<(string Text, AcDream.Core.Chat.RetailLogTextType Type)>();
|
||||
movement.OnInterfaceText = (text, type) => received.Add((text, type));
|
||||
|
||||
var controller = new PlayerMovementController(new PhysicsEngine());
|
||||
movement.Controller = controller;
|
||||
|
||||
controller.OnInterfaceText!("test line", AcDream.Core.Chat.RetailLogTextType.ClientLocal);
|
||||
|
||||
Assert.Single(received);
|
||||
Assert.Equal("test line", received[0].Text);
|
||||
Assert.Equal(AcDream.Core.Chat.RetailLogTextType.ClientLocal, received[0].Type);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OnInterfaceText_SetAfterControllerInstall_StillAppliesToTheCurrentController()
|
||||
{
|
||||
using var movement = new RuntimeLocalPlayerMovementState();
|
||||
var controller = new PlayerMovementController(new PhysicsEngine());
|
||||
movement.Controller = controller;
|
||||
|
||||
var received = new List<string>();
|
||||
movement.OnInterfaceText = (text, _) => received.Add(text);
|
||||
|
||||
controller.OnInterfaceText!("late-bound line", AcDream.Core.Chat.RetailLogTextType.ClientLocal);
|
||||
|
||||
Assert.Equal(["late-bound line"], received);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void OnInterfaceText_SwappingController_AppliesToTheReplacement()
|
||||
{
|
||||
using var movement = new RuntimeLocalPlayerMovementState();
|
||||
var received = new List<string>();
|
||||
movement.OnInterfaceText = (text, _) => received.Add(text);
|
||||
|
||||
var first = new PlayerMovementController(new PhysicsEngine());
|
||||
movement.Controller = first;
|
||||
var second = new PlayerMovementController(new PhysicsEngine());
|
||||
movement.Controller = second;
|
||||
|
||||
second.OnInterfaceText!("from replacement", AcDream.Core.Chat.RetailLogTextType.ClientLocal);
|
||||
|
||||
Assert.Equal(["from replacement"], received);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void MotionPreparationPublishesOnlyTheConstructionSeam()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -97,6 +97,63 @@ public sealed class LiveSessionEventRouterTests
|
|||
Assert.Equal(1, chat.Count);
|
||||
}
|
||||
|
||||
// ── Campaign CH slice CH2: 0xF7E0 ServerMessage routes through AddText ──
|
||||
|
||||
[Fact]
|
||||
public void ServerMessage_RoutesThroughAddText_WithWireChatTypeVerbatim_WhenWired()
|
||||
{
|
||||
using var session = NewSession();
|
||||
var chat = new ChatLog();
|
||||
var reported = new List<(string Text, RetailLogTextType Type)>();
|
||||
var social = new LiveSocialSessionBindings(
|
||||
chat,
|
||||
new TurbineChatState(),
|
||||
new FriendsState(),
|
||||
new SquelchState(),
|
||||
(text, type) => reported.Add((text, type)));
|
||||
var router = new LiveSessionEventRouter(
|
||||
session,
|
||||
new LiveEntitySessionSink(
|
||||
_ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => { },
|
||||
_ => { }, _ => { }, _ => { }, _ => { }, _ => { }, _ => { },
|
||||
_ => { }),
|
||||
new LiveEnvironmentSessionSink(_ => { }, _ => { }),
|
||||
NewInventoryBindings(),
|
||||
NewCharacterBindings(),
|
||||
social);
|
||||
router.Attach();
|
||||
|
||||
// 0x1A carried verbatim -- retail's Handle_Communication__TextboxString
|
||||
// @0x0057D3A0 feeds the RAW wire chatType into AddTextToScroll.
|
||||
EventDelegate<Action<AcDream.Core.Net.Messages.ServerMessage.Parsed>>(
|
||||
session, nameof(session.ServerMessageReceived))(
|
||||
new AcDream.Core.Net.Messages.ServerMessage.Parsed("You are too encumbered to carry that!", 0x1Au));
|
||||
|
||||
var (text, type) = Assert.Single(reported);
|
||||
Assert.Equal("You are too encumbered to carry that!", text);
|
||||
Assert.Equal(RetailLogTextType.ClientLocal, type);
|
||||
Assert.Equal(0, chat.Count);
|
||||
|
||||
router.Dispose();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void ServerMessage_FallsBackToChatDirectly_WhenNoRouterWired()
|
||||
{
|
||||
using var session = NewSession();
|
||||
var chat = new ChatLog();
|
||||
var router = NewRouter(session, new Counters(), chat: chat);
|
||||
|
||||
EventDelegate<Action<AcDream.Core.Net.Messages.ServerMessage.Parsed>>(
|
||||
session, nameof(session.ServerMessageReceived))(
|
||||
new AcDream.Core.Net.Messages.ServerMessage.Parsed("fallback path", 0x00u));
|
||||
|
||||
Assert.Equal(1, chat.Count);
|
||||
Assert.Equal("fallback path", chat.Snapshot()[0].Text);
|
||||
|
||||
router.Dispose();
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void NestedRouters_DisposeOlderFirstLeavesOnlyNewerRouter()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -0,0 +1,79 @@
|
|||
using AcDream.Core.Chat;
|
||||
using AcDream.UI.Abstractions.Panels.SpewBox;
|
||||
|
||||
namespace AcDream.UI.Abstractions.Tests.Panels.SpewBox;
|
||||
|
||||
public sealed class SpewBoxVMTests
|
||||
{
|
||||
[Fact]
|
||||
public void Lines_NoContent_ReturnsEmpty()
|
||||
{
|
||||
var vm = new SpewBoxVM(new SpewBoxState());
|
||||
|
||||
Assert.Empty(vm.Lines(0d));
|
||||
Assert.False(vm.HasVisibleLines);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Lines_DrainsPendingAndReturnsRemainingLifetime()
|
||||
{
|
||||
var state = new SpewBoxState();
|
||||
var vm = new SpewBoxVM(state);
|
||||
state.Enqueue("You can't jump while in the air");
|
||||
|
||||
IReadOnlyList<SpewBoxLine> lines = vm.Lines(nowSeconds: 10d);
|
||||
|
||||
SpewBoxLine line = Assert.Single(lines);
|
||||
Assert.Equal("You can't jump while in the air", line.Text);
|
||||
Assert.Equal(SpewBoxState.DefaultLifetime.TotalSeconds, line.RemainingLifetimeSeconds, precision: 3);
|
||||
Assert.True(vm.HasVisibleLines);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Lines_RemainingLifetime_CountsDownAndFloorsAtZero()
|
||||
{
|
||||
var state = new SpewBoxState();
|
||||
var vm = new SpewBoxVM(state);
|
||||
state.Enqueue("fading");
|
||||
|
||||
vm.Lines(nowSeconds: 0d);
|
||||
double halfway = SpewBoxState.DefaultLifetime.TotalSeconds / 2;
|
||||
SpewBoxLine midLine = Assert.Single(vm.Lines(nowSeconds: halfway));
|
||||
Assert.Equal(halfway, midLine.RemainingLifetimeSeconds, precision: 3);
|
||||
|
||||
// Past expiry: the line is pruned by the same Lines() call that ticks it.
|
||||
Assert.Empty(vm.Lines(nowSeconds: SpewBoxState.DefaultLifetime.TotalSeconds + 1d));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Lines_NewestFirst_MatchesRetailInsertAtZero()
|
||||
{
|
||||
var state = new SpewBoxState();
|
||||
var vm = new SpewBoxVM(state);
|
||||
state.Enqueue("older");
|
||||
vm.Lines(0d);
|
||||
state.Enqueue("newer");
|
||||
|
||||
IReadOnlyList<SpewBoxLine> lines = vm.Lines(0d);
|
||||
|
||||
// MaxConcurrentItems == 1 means only the newest survives, which is
|
||||
// itself proof insertion happens at the front (retail's overflow
|
||||
// rule drops the OLDEST / highest index, not the newest).
|
||||
SpewBoxLine line = Assert.Single(lines);
|
||||
Assert.Equal("newer", line.Text);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void Revision_TracksUnderlyingState()
|
||||
{
|
||||
var state = new SpewBoxState();
|
||||
var vm = new SpewBoxVM(state);
|
||||
long initial = vm.Revision;
|
||||
|
||||
state.Enqueue("a line");
|
||||
vm.Lines(0d);
|
||||
|
||||
Assert.True(vm.Revision > initial);
|
||||
Assert.Equal(state.Revision, vm.Revision);
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue