fix(D.5.1): toolbar use-item gates on in-world + logs; store controller field (review)

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
Erik 2026-06-16 22:52:28 +02:00
parent 3b6f293dc8
commit b3e5e8b0f7

View file

@ -617,6 +617,8 @@ public sealed class GameWindow : IDisposable
private AcDream.UI.Abstractions.Panels.Vitals.VitalsVM? _vitalsVm;
// Phase D.2b — retail-look UI tree (dormant UiHost wired here). Null unless ACDREAM_RETAIL_UI=1.
private AcDream.App.UI.UiHost? _uiHost;
// Phase D.5.1 — toolbar controller (kept for lifetime clarity; mirrors _chatWindowController pattern).
private AcDream.App.UI.Layout.ToolbarController? _toolbarController;
// Phase D.2b Task 9 — plugin UI registrations buffered before OnLoad; drained in OnLoad.
private readonly AcDream.App.Plugins.BufferedUiRegistry? _uiRegistry;
// Phase I.2: ImGui debug panel ViewModel. Lives for as long as
@ -1915,7 +1917,7 @@ public sealed class GameWindow : IDisposable
_dats!, 0x21000016u, ResolveChrome, vitalsDatFont);
if (toolbarLayout is not null)
{
AcDream.App.UI.Layout.ToolbarController.Bind(
_toolbarController = AcDream.App.UI.Layout.ToolbarController.Bind(
toolbarLayout, Items,
() => Shortcuts,
iconIds: (icon, under, over) => iconComposer.GetIcon(icon, under, over),
@ -11627,10 +11629,13 @@ public sealed class GameWindow : IDisposable
// for items already in the player's inventory.
private void UseItemByGuid(uint guid)
{
if (_liveSession is null) return;
if (_liveSession is null
|| _liveSession.CurrentState != AcDream.Core.Net.WorldSession.State.InWorld)
return;
var seq = _liveSession.NextGameActionSequence();
var body = AcDream.Core.Net.Messages.InteractRequests.BuildUse(seq, guid);
_liveSession.SendGameAction(body);
Console.WriteLine($"[D.5.1] toolbar use-item guid=0x{guid:X8} seq={seq}");
}
private void SendPickUp(uint itemGuid)