Fix blocked items
This commit is contained in:
@@ -179,6 +179,7 @@ public unsafe class AddonInventoryWindow : InventoryAddonBase
|
|||||||
|
|
||||||
protected override void OnFinalize(AtkUnitBase* addon)
|
protected override void OnFinalize(AtkUnitBase* addon)
|
||||||
{
|
{
|
||||||
|
IsSetupComplete = false;
|
||||||
_lootedCategoryNode?.Dispose();
|
_lootedCategoryNode?.Dispose();
|
||||||
|
|
||||||
System.LootedItemsTracker.OnLootedItemsChanged -= OnLootedItemsChanged;
|
System.LootedItemsTracker.OnLootedItemsChanged -= OnLootedItemsChanged;
|
||||||
|
|||||||
@@ -120,15 +120,32 @@ public static unsafe class InventoryContextState
|
|||||||
var inventoryManager = InventoryManager.Instance();
|
var inventoryManager = InventoryManager.Instance();
|
||||||
if (inventoryManager == null) return;
|
if (inventoryManager == null) return;
|
||||||
|
|
||||||
var blockedContainer = inventoryManager->GetInventoryContainer(InventoryType.BlockedItems);
|
ScanBlockedContainer(inventoryManager, InventoryType.BlockedItems);
|
||||||
if (blockedContainer == null) return;
|
ScanBlockedContainer(inventoryManager, InventoryType.MailEdit);
|
||||||
|
}
|
||||||
|
|
||||||
for (int i = 0; i < blockedContainer->Size; i++)
|
private static void ScanBlockedContainer(InventoryManager* inventoryManager, InventoryType type)
|
||||||
|
{
|
||||||
|
try
|
||||||
{
|
{
|
||||||
ref var item = ref blockedContainer->Items[i];
|
var container = inventoryManager->GetInventoryContainer(type);
|
||||||
if (item.ItemId == 0) continue;
|
if (container == null) return;
|
||||||
|
if (container->GetSize() == 0) return;
|
||||||
|
if (!container->IsLoaded) return;
|
||||||
|
if (container->Items == null) return;
|
||||||
|
|
||||||
BlockedSlots.Add((item.Container, item.Slot));
|
for (int i = 0; i < container->GetSize(); i++)
|
||||||
|
{
|
||||||
|
var slot = container->GetInventorySlot(i);
|
||||||
|
if (slot == null) continue;
|
||||||
|
if (slot->GetItemId() == 0) continue;
|
||||||
|
|
||||||
|
BlockedSlots.Add((slot->Container, slot->Slot));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch
|
||||||
|
{
|
||||||
|
// Container became invalid during teardown
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user