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:
@@ -28,6 +28,7 @@ public static unsafe class DragDropState
|
|||||||
|
|
||||||
public class InventoryMonitor : IDisposable
|
public class InventoryMonitor : IDisposable
|
||||||
{
|
{
|
||||||
|
|
||||||
public InventoryMonitor()
|
public InventoryMonitor()
|
||||||
{
|
{
|
||||||
var bags = new[] { "Inventory", "InventoryLarge", "InventoryExpansion" };
|
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, retainer, OnPreFinalize);
|
||||||
Services.AddonLifecycle.RegisterListener(AddonEvent.PreFinalize, bags, OnInventoryPreFinalize);
|
Services.AddonLifecycle.RegisterListener(AddonEvent.PreFinalize, bags, OnInventoryPreFinalize);
|
||||||
|
|
||||||
Services.AddonLifecycle.RegisterListener(AddonEvent.PreHide, bags, OnInventoryPreHide);
|
|
||||||
|
|
||||||
// PreRefresh Handlers
|
// PreRefresh Handlers
|
||||||
Services.AddonLifecycle.RegisterListener(AddonEvent.PreRefresh, bags, InventoryPreRefreshHandler);
|
Services.AddonLifecycle.RegisterListener(AddonEvent.PreRefresh, bags, InventoryPreRefreshHandler);
|
||||||
|
|
||||||
@@ -72,14 +71,6 @@ public class InventoryMonitor : IDisposable
|
|||||||
System.AddonInventoryWindow.Close();
|
System.AddonInventoryWindow.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnInventoryPreHide(AddonEvent type, AddonArgs args)
|
|
||||||
{
|
|
||||||
if (System.Config.General.OpenWithGameInventory)
|
|
||||||
{
|
|
||||||
System.AddonInventoryWindow.Close();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private unsafe void OpenInventories(string name)
|
private unsafe void OpenInventories(string name)
|
||||||
{
|
{
|
||||||
GeneralSettings config = System.Config.General;
|
GeneralSettings config = System.Config.General;
|
||||||
@@ -201,10 +192,14 @@ public class InventoryMonitor : IDisposable
|
|||||||
|
|
||||||
if (config.OpenWithGameInventory)
|
if (config.OpenWithGameInventory)
|
||||||
{
|
{
|
||||||
var addon = RaptureAtkUnitManager.Instance()->GetAddonByName(args.AddonName);
|
AtkValue* value1 = (AtkValue*)atkValues[1].Address;
|
||||||
bool isCurrentlyVisible = addon != null && addon->IsVisible;
|
int openTitleId = value1->Int;
|
||||||
|
|
||||||
if (!isCurrentlyVisible)
|
if (openTitleId == 0)
|
||||||
|
{
|
||||||
|
System.AddonInventoryWindow.Toggle();
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
System.AddonInventoryWindow.Open();
|
System.AddonInventoryWindow.Open();
|
||||||
}
|
}
|
||||||
@@ -250,6 +245,6 @@ public class InventoryMonitor : IDisposable
|
|||||||
public void Dispose()
|
public void Dispose()
|
||||||
{
|
{
|
||||||
Services.GameInventory.InventoryChangedRaw -= OnInventoryChangedRaw;
|
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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user