From 3104c84d2049812718d5111bd82ac667ff8556a2 Mon Sep 17 00:00:00 2001 From: Zeffuro Date: Mon, 29 Dec 2025 21:56:33 +0100 Subject: [PATCH 1/2] Safely unblock addon if blocked from opening discard dialogue --- AetherBags/Addons/AddonInventoryWindow.cs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/AetherBags/Addons/AddonInventoryWindow.cs b/AetherBags/Addons/AddonInventoryWindow.cs index 565a744..faf0d95 100644 --- a/AetherBags/Addons/AddonInventoryWindow.cs +++ b/AetherBags/Addons/AddonInventoryWindow.cs @@ -8,6 +8,8 @@ using AetherBags.Nodes.Inventory; using AetherBags.Nodes.Layout; using Dalamud.Game.Addon.Lifecycle; using Dalamud.Game.Addon.Lifecycle.AddonArgTypes; +using FFXIVClientStructs.FFXIV.Client.UI; +using FFXIVClientStructs.FFXIV.Client.UI.Agent; using FFXIVClientStructs.FFXIV.Component.GUI; using KamiToolKit; using KamiToolKit.Nodes; @@ -325,6 +327,12 @@ public class AddonInventoryWindow : NativeAddon protected override unsafe void OnFinalize(AtkUnitBase* addon) { + ref var blockingAddonId = ref AgentInventoryContext.Instance()->BlockingAddonId; + if (blockingAddonId != 0) + { + RaptureAtkModule.Instance()->CloseAddon(blockingAddonId); + } + Services.AddonLifecycle.UnregisterListener(OnInventoryUpdate); addon->UnsubscribeAtkArrayData(1, (int)NumberArrayType.Inventory); From cc042f034958c68e916f5bb2958e861eaf97ae6c Mon Sep 17 00:00:00 2001 From: Zeffuro Date: Mon, 29 Dec 2025 22:54:03 +0100 Subject: [PATCH 2/2] Fix dragging slots over each other --- AetherBags/Inventory/InventoryLocation.cs | 8 ++++++-- .../Nodes/Inventory/InventoryCategoryNode.cs | 20 ++++++++++++++++--- 2 files changed, 23 insertions(+), 5 deletions(-) diff --git a/AetherBags/Inventory/InventoryLocation.cs b/AetherBags/Inventory/InventoryLocation.cs index 35ab722..640eec8 100644 --- a/AetherBags/Inventory/InventoryLocation.cs +++ b/AetherBags/Inventory/InventoryLocation.cs @@ -4,9 +4,13 @@ namespace AetherBags.Inventory; public readonly record struct InventoryLocation(InventoryType Container, ushort Slot) { - public static readonly InventoryLocation Invalid = new(0, 0); + public static readonly InventoryLocation Invalid = new((InventoryType)uint.MaxValue, ushort.MaxValue); - public bool IsValid => Container != 0; + public bool IsValid => Container.IsMainInventory || + Container.IsSaddleBag || + Container.IsArmory || + Container.IsRetainer || + Container == InventoryType.EquippedItems; public override string ToString() => $"{Container}@{Slot}"; } diff --git a/AetherBags/Nodes/Inventory/InventoryCategoryNode.cs b/AetherBags/Nodes/Inventory/InventoryCategoryNode.cs index c2b3292..0d4c8d7 100644 --- a/AetherBags/Nodes/Inventory/InventoryCategoryNode.cs +++ b/AetherBags/Nodes/Inventory/InventoryCategoryNode.cs @@ -260,10 +260,14 @@ public class InventoryCategoryNode : SimpleComponentNode AgentInventoryContext.Instance()->DiscardItem(item.Item.GetLinkedItem(), item.Item.Container, item.Item.Slot, addonId); } - private void OnPayloadAccepted(DragDropNode _, DragDropPayload payload, ItemInfo targetItemInfo) + private void OnPayloadAccepted(DragDropNode node, DragDropPayload payload, ItemInfo targetItemInfo) { + InventoryItem item = targetItemInfo.Item; if (!payload.IsValidInventoryPayload) + { + Services.Logger.Warning($"[OnPayload] Invalid payload type: {payload.Type}"); return; + } InventoryLocation sourceLocation = payload.InventoryLocation; @@ -274,15 +278,25 @@ public class InventoryCategoryNode : SimpleComponentNode } InventoryLocation targetLocation = new InventoryLocation( - targetItemInfo.Item.Container, - (ushort)targetItemInfo.Item.Slot + item.Container, + (ushort)item.Slot ); + if (sourceLocation.Container.IsSameContainerGroup(targetLocation.Container)) + { + Services.Logger.Debug($"[OnPayload] Source and target are in the same container group; no move performed"); + node.Payload = payload; + node.IconId = item.IconId; + System.AddonInventoryWindow.ManualInventoryRefresh(); + return; + }; + Services.Logger.Debug($"[OnPayload] Moving {sourceLocation} -> {targetLocation}"); InventoryMoveHelper.MoveItem( sourceLocation.Container, sourceLocation.Slot, targetLocation.Container, targetLocation.Slot ); + System.AddonInventoryWindow.ManualInventoryRefresh(); } } \ No newline at end of file