Fix blocked items

This commit is contained in:
Zeffuro
2026-02-20 23:36:37 +01:00
parent 04c8005be1
commit 17fe54dfea
2 changed files with 25 additions and 7 deletions
@@ -179,6 +179,7 @@ public unsafe class AddonInventoryWindow : InventoryAddonBase
protected override void OnFinalize(AtkUnitBase* addon)
{
IsSetupComplete = false;
_lootedCategoryNode?.Dispose();
System.LootedItemsTracker.OnLootedItemsChanged -= OnLootedItemsChanged;
@@ -120,15 +120,32 @@ public static unsafe class InventoryContextState
var inventoryManager = InventoryManager.Instance();
if (inventoryManager == null) return;
var blockedContainer = inventoryManager->GetInventoryContainer(InventoryType.BlockedItems);
if (blockedContainer == null) return;
ScanBlockedContainer(inventoryManager, InventoryType.BlockedItems);
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];
if (item.ItemId == 0) continue;
var container = inventoryManager->GetInventoryContainer(type);
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
}
}