22using Intersect . Client . Framework . File_Management ;
33using Intersect . Client . Framework . Gwen . Control ;
44using Intersect . Client . Framework . Gwen . Control . EventArguments ;
5+ using Intersect . Client . Framework . Gwen . DragDrop ;
56using Intersect . Client . Framework . Gwen . Input ;
67using Intersect . Client . Framework . Input ;
78using Intersect . Client . General ;
89using Intersect . Client . Interface . Game . DescriptionWindows ;
10+ using Intersect . Client . Interface . Game . Inventory ;
911using Intersect . Client . Localization ;
1012using Intersect . Configuration ;
1113using Intersect . Framework . Core . GameObjects . Items ;
@@ -30,7 +32,6 @@ public ShopItem(ShopWindow shopWindow, Base parent, int index, ContextMenu conte
3032 Icon . HoverLeave += Icon_HoverLeave ;
3133 Icon . Clicked += Icon_RightClicked ;
3234 Icon . DoubleClicked += Icon_DoubleClicked ;
33- Icon . DisableDragAndDrop = true ;
3435
3536 LoadJsonUi ( GameContentManager . UI . InGame , Graphics . Renderer . GetResolutionString ( ) ) ;
3637
@@ -161,4 +162,25 @@ public void LoadItem()
161162 Icon . RenderColor = itemDescriptor . Color ;
162163 }
163164 }
165+
166+ public override bool DragAndDrop_HandleDrop ( Package p , int x , int y )
167+ {
168+ var targetNode = Interface . FindComponentUnderCursor ( ) ;
169+
170+ // Find the first parent acceptable in that tree that can accept the package
171+ while ( targetNode != default )
172+ {
173+ if ( targetNode is not InventoryWindow )
174+ {
175+ targetNode = targetNode . Parent ;
176+ continue ;
177+ }
178+
179+ Globals . Me ? . TryBuyItem ( _mySlot ) ;
180+ return true ;
181+ }
182+
183+ // If we've reached the top of the tree, we can't drop here, so cancel drop
184+ return false ;
185+ }
164186}
0 commit comments