acdream/src/AcDream.App/UI/RetailPanelCatalog.cs
Erik 6b0fa4ff0d feat(ui): Map/House panel — slices 2+3, panel shell + Map tab
Mounts host 0x2100006E slot 0x1000018C (RetailPanelCatalog.MapHouse = 16)
as a two-tab UiTabPanel (Map default, House second) through the OP3/FA3
recipe (LayoutImporter.Build -> Bind -> ActivateTabBehavior). Toolbar
button 0x1000019A un-ghosts (added to both RetailPanelCatalog.Mounted and
.Toolbar). Combined into one commit because MapHousePanelController.Bind
depends on both MapPageController and HousePageController existing —
splitting them would mean landing dead code first.

Map tab (gmMapUI, MapPageController):
- Calendar formatter matching gmMapUI::Update's "Date: %s\nTime: %s"
  shape, reusing WorldTimeService.CurrentCalendar (new
  Func<DerethDateTime.Calendar> dependency threaded through
  InteractionRetainedUiDependencies/GameWindow — a stable long-lived
  service, not routed through the deferred-binding machinery Radar's
  per-session state needs). MonthName enum values already match retail
  display text; HourName's "AndHalf" suffix is rewritten to "-and-Half".
- Coordinate math + marker placement reuse RadarCoordinates/
  LandDefs.GidToLcoord verbatim (both already byte-exact ports of
  CPlayerSystem::InqPlayerCoords/LandDefs::gid_to_lcoord) — no re-port.
  PlaceMarkerOnMap's centering math (m_x0 + x - w/2) ported from
  gmMapUI::PlaceMarkerOnMap @0x004a18b0. Indoor gating clears the
  coordinate text and hides the player marker, matching
  gmMapUI::Update's else branch.
- 53-town s_rgLocations table ported verbatim into MapLocations.cs.
  Markers built once at bind time via the panel's own RowTemplateResolver
  against m_pMap's authored hotspot-template attrs (0x47/0x48), with
  literal-string tooltips through AuthoredTooltipText/Enabled
  (RetailTooltipPresenter) — closes divergence-register row TS-85's last
  item, gmMapUI::AddMapNote @0x004A1C51.
- Structural finding: m_pMap (0x100001EC) is itself authored as a Type-1
  BUTTON (the GM click-to-teleport hook at
  gmMapUI::ListenToElementMessage), and the player/house icons
  (0x100001ED/EE) are its own NESTED children, not siblings —
  UiButton.ConsumesDatChildren swallows them from the normally-built
  tree. Both are re-resolved standalone through the same template
  resolver the town hotspots use and reattached under m_pMap.

House tab (gmHouseUI, HousePageController): mounts the ListBox
(0x100001E6) with its authored row template, wired to an empty Lines()
source by default — genuinely empty until Slice 4's wire lands, matching
retail's own PostInit (no Update call, no static content).

21 new tests (7 MapHousePanelControllerTests, 14 MapPageControllerTests):
tab table pairing, close button, town-hotspot count/tooltips, calendar
formatter golden values (Frostfell 27/119 P.Y., every HourName incl.
AndHalf), player/house marker placement and indoor-gating reproduced
against the real fixture via already-tested RadarCoordinates (no
re-derivation). Fixture map_house_2100006E_1000018C.json captured via
the shared RetailLayoutFixtureGenerator (other 34 fixtures deliberately
NOT regenerated — out of scope for this batch, would touch unrelated
panels' schema drift).

Full solution builds clean; App suite 5391/0 failed/71 skipped (non-live;
one earlier flaky streaming failure unrelated to this change, confirmed
pre-existing on the branch before these commits).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-08-17 02:04:19 +02:00

113 lines
4.6 KiB
C#

namespace AcDream.App.UI;
/// <summary>
/// Retail <c>gmPanelUI</c> panel ids carried by DAT property <c>0x10000029</c>.
/// The toolbar exposes only a subset of these ids; Helpful/Harmful effects use
/// the authored <c>gmUIElement_EffectsIndicator</c> buttons instead.
/// </summary>
public static class RetailPanelCatalog
{
public const uint CharacterInformation = 3u;
public const uint PositiveEffects = 4u;
public const uint NegativeEffects = 5u;
public const uint Inventory = 7u;
public const uint LinkStatus = 8u;
public const uint MiniGame = 9u;
public const uint Character = 11u;
public const uint Magic = 13u;
public const uint Vitae = 15u;
/// <summary>
/// The retail Options panel's <c>gmPanelUI</c> slot key — byte-verified
/// from the toolbar options button's OWN authored property
/// <c>0x10000029 = 10</c> (fixture <c>toolbar_21000016.json</c>,
/// element <c>0x1000019B</c>) and independently corroborated by
/// <c>docs/research/2026-08-10-options-panel-structure.md</c> §1.4's
/// decompiled slot-key table (host <c>0x2100006E</c>, slot
/// <c>0x1000018D</c> → key 10). Campaign OP slice OP3.
/// </summary>
public const uint Options = 10u;
/// <summary>
/// Campaign FA slice FA3: the four-tab Friends/Allegiance/Fellowship/
/// Squelch panel's <c>gmPanelUI</c> slot key — byte-verified from the
/// live installed DATs (host <c>0x2100006E</c> slot <c>0x1000018F</c>'s
/// own authored <c>0x10000029 = 12</c>, <c>FaPanelSlotProbeTests</c>).
/// No toolbar button authors this id (lane A §6.1: the open path is
/// keyboard-only, F3/F4) — <see cref="SocialPanel"/> is therefore in
/// <see cref="Mounted"/> only, not <see cref="Toolbar"/>, the same
/// convention <see cref="PositiveEffects"/>/<see cref="NegativeEffects"/>/
/// <see cref="LinkStatus"/>/<see cref="MiniGame"/>/<see cref="Vitae"/>
/// already use for their own non-toolbar open paths.
/// </summary>
public const uint SocialPanel = 12u;
/// <summary>
/// Batch C (overnight hover/UI round, 2026-08-17): the two-tab Map/House
/// panel's <c>gmPanelUI</c> slot key — byte-verified from the live
/// installed DATs (host <c>0x2100006E</c> slot <c>0x1000018C</c>'s own
/// authored <c>0x10000029 = 16</c>, and the toolbar Map/House button
/// <c>0x1000019A</c>'s own authored <c>0x10000029 = 16</c>,
/// <c>MapHousePanelSlotProbeTests</c>). Already independently named by
/// the FA campaign's full 16-slot dump
/// (<c>docs/research/2026-08-11-fa-panel-structure.md:927-933</c>,
/// "gmMapUI+gmHouseUI pages"). Unlike <see cref="SocialPanel"/>, a real
/// toolbar button opens this one — it is in BOTH <see cref="Mounted"/>
/// and <see cref="Toolbar"/>.
/// </summary>
public const uint MapHouse = 16u;
private static readonly (uint PanelId, string WindowName)[] Mounted =
{
(CharacterInformation, WindowNames.CharacterInformation),
(PositiveEffects, WindowNames.PositiveEffects),
(NegativeEffects, WindowNames.NegativeEffects),
(Inventory, WindowNames.Inventory),
(LinkStatus, WindowNames.LinkStatus),
(MiniGame, WindowNames.MiniGame),
(Character, WindowNames.Character),
(Magic, WindowNames.Spellbook),
(Vitae, WindowNames.Vitae),
(Options, WindowNames.Options),
(SocialPanel, WindowNames.SocialPanel),
(MapHouse, WindowNames.MapHouse),
};
private static readonly (uint PanelId, string WindowName)[] Toolbar =
{
(Inventory, WindowNames.Inventory),
(Character, WindowNames.Character),
(Magic, WindowNames.Spellbook),
(Options, WindowNames.Options),
(MapHouse, WindowNames.MapHouse),
};
public static IReadOnlyList<(uint PanelId, string WindowName)> MountedPanels => Mounted;
public static IReadOnlyList<(uint PanelId, string WindowName)> ToolbarPanels => Toolbar;
public static bool TryGetWindowName(uint panelId, out string windowName)
{
foreach (var entry in Mounted)
{
if (entry.PanelId != panelId) continue;
windowName = entry.WindowName;
return true;
}
windowName = string.Empty;
return false;
}
public static bool TryGetPanelId(string windowName, out uint panelId)
{
foreach (var entry in Mounted)
{
if (!string.Equals(entry.WindowName, windowName, StringComparison.Ordinal)) continue;
panelId = entry.PanelId;
return true;
}
panelId = 0;
return false;
}
}