Revert "Improves inventory window management."

This reverts commit 58df621611.
Reverted because this hard crashes if you close Doman Donation box after closing inventory
This commit is contained in:
Zeffuro
2026-02-20 23:53:47 +01:00
parent 17fe54dfea
commit a9af3e77da
+9 -14
View File
@@ -28,6 +28,7 @@ public static unsafe class DragDropState
public class InventoryMonitor : IDisposable
{
public InventoryMonitor()
{
var bags = new[] { "Inventory", "InventoryLarge", "InventoryExpansion" };
@@ -41,8 +42,6 @@ public class InventoryMonitor : IDisposable
Services.AddonLifecycle.RegisterListener(AddonEvent.PreFinalize, retainer, OnPreFinalize);
Services.AddonLifecycle.RegisterListener(AddonEvent.PreFinalize, bags, OnInventoryPreFinalize);
Services.AddonLifecycle.RegisterListener(AddonEvent.PreHide, bags, OnInventoryPreHide);
// PreRefresh Handlers
Services.AddonLifecycle.RegisterListener(AddonEvent.PreRefresh, bags, InventoryPreRefreshHandler);
@@ -72,14 +71,6 @@ public class InventoryMonitor : IDisposable
System.AddonInventoryWindow.Close();
}
private void OnInventoryPreHide(AddonEvent type, AddonArgs args)
{
if (System.Config.General.OpenWithGameInventory)
{
System.AddonInventoryWindow.Close();
}
}
private unsafe void OpenInventories(string name)
{
GeneralSettings config = System.Config.General;
@@ -201,10 +192,14 @@ public class InventoryMonitor : IDisposable
if (config.OpenWithGameInventory)
{
var addon = RaptureAtkUnitManager.Instance()->GetAddonByName(args.AddonName);
bool isCurrentlyVisible = addon != null && addon->IsVisible;
AtkValue* value1 = (AtkValue*)atkValues[1].Address;
int openTitleId = value1->Int;
if (!isCurrentlyVisible)
if (openTitleId == 0)
{
System.AddonInventoryWindow.Toggle();
}
else
{
System.AddonInventoryWindow.Open();
}
@@ -250,6 +245,6 @@ public class InventoryMonitor : IDisposable
public void Dispose()
{
Services.GameInventory.InventoryChangedRaw -= OnInventoryChangedRaw;
Services.AddonLifecycle.UnregisterListener(OnPostSetup, OnPreFinalize, OnInventoryUpdate, OnSaddleBagUpdate, OnRetainerInventoryUpdate, OnInventoryPreFinalize, OnInventoryPreHide, InventoryPreRefreshHandler);
Services.AddonLifecycle.UnregisterListener(OnPostSetup, OnPreFinalize, OnInventoryUpdate, OnSaddleBagUpdate, OnRetainerInventoryUpdate, OnInventoryPreFinalize, InventoryPreRefreshHandler);
}
}