Lands the codex-worktree D.2b stream plus the extraction the 2026-07-02 UI architecture review mandated before commit: - ItemInteractionController: single owner of double-click use/equip/ container-open, targeted-use mode (health kits), drag-out drop; toolbar shortcut drags don't drop the real item. ItemEquipRules for multi-slot (coat) coverage via equip masks. - Cursor phase: CursorFeedbackController (semantic priority chain: drag > resize > window-move > target-mode > text) + RetailCursorCatalog (enums 0x27/0x28/0x29, hotspot 14,14; ClientUISystem::UpdateCursorState 0x00564630) resolved through the portal EnumIDMap chain by RetailCursorResolver; RetailCursorManager applies dat cursor art to the OS cursor. Register row AP-72 covers the OS standard-cursor fallback. - Character window goes live: CharacterSheetProvider owns sheet assembly, XP-curve/raise-cost math and the raise flow — extracted out of GameWindow per Code Structure Rule 1 instead of committing the ~430-line feature body there. Optimistic XP/credit debits go through eventful store APIs (new ClientObjectTable.UpdateInt64Property + LocalPlayerState.DebitIntProperty/DebitInt64Property) instead of raw property-dictionary writes; register row AP-73 covers the still-missing raise ledger (#163). - RetailWindowFrame: the shared nine-slice window mount recipe; the character window uses it, remaining windows migrate via #164. - Status-bar buttons toggle inventory/character windows; retail row-major backpack ordering; WorldSession.SendUseWithTarget + raise/train sends. GameWindow shrinks 14,214 -> 13,877 lines despite the new features; the sheet/raise logic is unit-tested in CharacterSheetProviderTests instead of trapped in the god object. Build green; full suite 3,286 tests pass. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
61 lines
2.2 KiB
C#
61 lines
2.2 KiB
C#
using AcDream.App.Rendering;
|
|
using AcDream.App.UI;
|
|
using DatReaderWriter;
|
|
using DatReaderWriter.Options;
|
|
using SysEnv = System.Environment;
|
|
|
|
namespace AcDream.App.Tests.UI;
|
|
|
|
public sealed class RetailCursorCatalogTests
|
|
{
|
|
[Theory]
|
|
[InlineData(CursorFeedbackKind.TargetPending, 0x27u, 14, 14)]
|
|
[InlineData(CursorFeedbackKind.TargetValid, 0x28u, 14, 14)]
|
|
[InlineData(CursorFeedbackKind.TargetInvalid, 0x29u, 14, 14)]
|
|
public void TargetUseCursorSpecs_matchClientUISystemUpdateCursorState(
|
|
CursorFeedbackKind kind,
|
|
uint expectedEnum,
|
|
int expectedHotspotX,
|
|
int expectedHotspotY)
|
|
{
|
|
Assert.Equal(6u, RetailCursorCatalog.CursorEnumTable);
|
|
|
|
Assert.True(RetailCursorCatalog.TryGetGlobalCursor(kind, out var spec));
|
|
|
|
Assert.Equal(expectedEnum, spec.EnumId);
|
|
Assert.Equal(expectedHotspotX, spec.HotspotX);
|
|
Assert.Equal(expectedHotspotY, spec.HotspotY);
|
|
}
|
|
|
|
[Fact]
|
|
public void TargetUseCursorSpecs_resolveGoldenDatSurfaces()
|
|
{
|
|
string? datDir = ResolveDatDir();
|
|
if (datDir is null)
|
|
return;
|
|
|
|
using var dats = new DatCollection(datDir, DatAccessType.Read);
|
|
var resolver = new RetailCursorResolver(dats, new object());
|
|
|
|
Assert.True(resolver.TryResolve(new RetailCursorSpec(0x27u, 14, 14), out var pending));
|
|
Assert.True(resolver.TryResolve(new RetailCursorSpec(0x28u, 14, 14), out var valid));
|
|
Assert.True(resolver.TryResolve(new RetailCursorSpec(0x29u, 14, 14), out var invalid));
|
|
|
|
Assert.Equal(new UiCursorMedia(0x06004D73u, 14, 14), pending);
|
|
Assert.Equal(new UiCursorMedia(0x06005E6Bu, 14, 14), valid);
|
|
Assert.Equal(new UiCursorMedia(0x06005E6Au, 14, 14), invalid);
|
|
}
|
|
|
|
private static string? ResolveDatDir()
|
|
{
|
|
string? fromEnv = SysEnv.GetEnvironmentVariable("ACDREAM_DAT_DIR");
|
|
if (!string.IsNullOrWhiteSpace(fromEnv) && Directory.Exists(fromEnv))
|
|
return fromEnv;
|
|
|
|
string defaultDir = Path.Combine(
|
|
SysEnv.GetFolderPath(SysEnv.SpecialFolder.UserProfile),
|
|
"Documents",
|
|
"Asheron's Call");
|
|
return Directory.Exists(defaultDir) ? defaultDir : null;
|
|
}
|
|
}
|