Skip to content

Commit aefe68f

Browse files
committed
fix: restores proper prompt for item drag-and-drop
- Ensures all item drops go through TryDropItem, restoring the safety prompt that asks which item and how many to drop. - Fixes a bug introduced with DragAndDrop_HandleDrop returning an incorrect boolean when bypassing the drop prompt, which caused undroppable items to have their icons hidden.
1 parent b6cb66c commit aefe68f

3 files changed

Lines changed: 8 additions & 14 deletions

File tree

Intersect.Client.Core/Entities/Player.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -415,7 +415,7 @@ public void TryDropItem(int inventorySlotIndex)
415415
}
416416

417417
var quantity = inventorySlot.Quantity;
418-
var canDropMultiple = quantity > 1;
418+
var canDropMultiple = GetQuantityOfItemInInventory(itemDescriptor.Id) > 1;
419419
var inputType = canDropMultiple ? InputType.NumericSliderInput : InputType.YesNo;
420420
var prompt = canDropMultiple ? Strings.Inventory.DropItemPrompt : Strings.Inventory.DropPrompt;
421421
_ = new InputBox(

Intersect.Client.Core/Interface/Game/Draggable.cs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,7 @@ public override void DragAndDrop_StartDragging(Package package, int x, int y)
3939

4040
public override void DragAndDrop_EndDragging(bool success, int x, int y)
4141
{
42-
if (!success)
43-
{
44-
IsVisibleInParent = true;
45-
}
42+
IsVisibleInParent = !success;
4643
}
4744

4845
public override bool DragAndDrop_HandleDrop(Package package, int x, int y)

Intersect.Client.Core/Interface/Game/Inventory/InventoryItem.cs

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -403,12 +403,6 @@ public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
403403
return false;
404404
}
405405

406-
if (!Interface.DoesMouseHitInterface() && !player.IsBusy)
407-
{
408-
PacketSender.SendDropItem(SlotIndex, inventorySlot.Quantity);
409-
return true;
410-
}
411-
412406
var targetNode = Interface.FindComponentUnderCursor();
413407

414408
// Find the first parent acceptable in that tree that can accept the package
@@ -430,13 +424,12 @@ public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
430424
return true;
431425

432426
case BankItem bankItem:
433-
player.TryStoreItemInBank(
427+
return player.TryStoreItemInBank(
434428
SlotIndex,
435429
bankSlotIndex: bankItem.SlotIndex,
436430
quantityHint: inventorySlot.Quantity,
437431
skipPrompt: true
438432
);
439-
return true;
440433

441434
case HotbarItem hotbarItem:
442435
player.AddToHotbar(hotbarItem.SlotIndex, 0, SlotIndex);
@@ -452,7 +445,11 @@ public override bool DragAndDrop_HandleDrop(Package package, int x, int y)
452445
}
453446
}
454447

455-
// If we've reached the top of the tree, we can't drop here, so cancel drop
448+
if (!Interface.DoesMouseHitInterface() && !player.IsBusy)
449+
{
450+
player.TryDropItem(SlotIndex);
451+
}
452+
456453
return false;
457454
}
458455

0 commit comments

Comments
 (0)