Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 15 additions & 3 deletions Intersect.Client.Core/Interface/Game/Bag/BagItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,30 @@ public BagItem(BagWindow bagWindow, Base parent, int index, ContextMenu contextM

protected override void OnContextMenuOpening(ContextMenu contextMenu)
{
contextMenu.ClearChildren();

if (Globals.BagSlots is not { Length: > 0 } bagSlots)
{
return;
}

if (!ItemDescriptor.TryGet(bagSlots[SlotIndex].ItemId, out var item))
var slotIndex = SlotIndex;

if (slotIndex >= bagSlots.Length)
{
return;
}

if (bagSlots[slotIndex] is not { } bagSlot)
{
return;
}

if (!ItemDescriptor.TryGet(bagSlot.ItemId, out var item))
{
return;
}

// Clear the context menu and add the withdraw item with updated item name
contextMenu.ClearChildren();
_withdrawContextItem.SetText(Strings.BagContextMenu.Withdraw.ToString(item.Name));
contextMenu.AddChild(_withdrawContextItem);
base.OnContextMenuOpening(contextMenu);
Expand Down
22 changes: 17 additions & 5 deletions Intersect.Client.Core/Interface/Game/Bank/BankItem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,21 +59,33 @@ public BankItem(BankWindow bankWindow, Base parent, int index, ContextMenu conte

protected override void OnContextMenuOpening(ContextMenu contextMenu)
{
contextMenu.ClearChildren(); // Clear context menu

if (Globals.BankSlots is not { Length: > 0 } bankSlots)
{
return;
}

if (!ItemDescriptor.TryGet(bankSlots[SlotIndex].ItemId, out var item))
var slotIndex = SlotIndex;

if (slotIndex >= bankSlots.Length)
{
return;
}

// Clear the context menu and add the withdraw item with updated item name
contextMenu.ClearChildren();
contextMenu.AddChild(_withdrawContextItem);
_withdrawContextItem.SetText(Strings.BankContextMenu.Withdraw.ToString(item.Name));
if (bankSlots[slotIndex] is not { } bankSlot)
{
return;
}

if (!ItemDescriptor.TryGet(bankSlot.ItemId, out var item))
{
return;
}

// Update context menu
_withdrawContextItem.SetText(Strings.BankContextMenu.Withdraw.ToString(item.Name));
contextMenu.AddChild(_withdrawContextItem);
base.OnContextMenuOpening(contextMenu);
}

Expand Down
Loading