Skip to content

Commit e6e7a46

Browse files
authored
fix: unequip equipment when depositing into the bank (#2157)
1 parent e917f8e commit e6e7a46

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

Intersect.Server.Core/Entities/BankInterface.cs

+7-8
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,13 @@ out var slotIndicesToRemoveFrom
236236
Debug.Assert(slotToRemoveFrom != default);
237237
var quantityToRemoveFromSlot = Math.Min(remainingQuantityToRemove, slotToRemoveFrom.Quantity);
238238
slotToRemoveFrom.Quantity -= quantityToRemoveFromSlot;
239+
240+
// If the item is equipped equipment, we need to unequip it before taking it out of the inventory.
241+
if (itemDescriptor.ItemType == ItemType.Equipment && slotIndexToRemoveFrom > -1)
242+
{
243+
mPlayer.EquipmentProcessItemLoss(slotIndexToRemoveFrom);
244+
}
245+
239246
if (slotToRemoveFrom.Quantity < 1)
240247
{
241248
slotToRemoveFrom.Set(Item.None);
@@ -264,14 +271,6 @@ out var slotIndicesToRemoveFrom
264271
Log.Error($"{mPlayer.Id} did not have {remainingQuantity}x {itemDescriptor.Id} taken");
265272
}
266273

267-
if (itemDescriptor.ItemType == ItemType.Equipment)
268-
{
269-
if (inventorySlotIndex > -1)
270-
{
271-
mPlayer.EquipmentProcessItemLoss(inventorySlotIndex);
272-
}
273-
}
274-
275274
if (sendUpdate)
276275
{
277276
foreach (var slotIndexToUpdate in slotIndicesToRemoveFrom)

0 commit comments

Comments
 (0)