From 3d6c47336c1e41a2409ed0a4119ab80082247beb Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sat, 28 Apr 2018 11:48:44 -0400 Subject: [PATCH] Core/Items: HasItemCount and DestroyItemCount now count bank bags --- Source/Game/Entities/Player/Player.Items.cs | 33 ++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index 0f262b2a5..38e26e86b 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -3017,7 +3017,7 @@ namespace Game.Entities if (inBankAlso) { - for (byte i = InventorySlots.BankItemStart; i < InventorySlots.BankItemEnd; i++) + for (byte i = InventorySlots.BankItemStart; i < InventorySlots.BankBagEnd; i++) { Item pItem = GetItemByPos(InventorySlots.Bag0, i); if (pItem != null && pItem.GetEntry() == item && !pItem.IsInTrade()) @@ -5895,6 +5895,37 @@ namespace Game.Entities } } + // in bank bag list + for (byte i = InventorySlots.BankBagStart; i < InventorySlots.BankBagEnd; i++) + { + Item item = GetItemByPos(InventorySlots.Bag0, i); + if (item) + { + if (item.GetEntry() == itemEntry && !item.IsInTrade()) + { + if (item.GetCount() + remcount <= count) + { + if (!unequip_check || CanUnequipItem((ushort)(InventorySlots.Bag0 << 8 | i), false) == InventoryResult.Ok) + { + remcount += item.GetCount(); + DestroyItem(InventorySlots.Bag0, i, update); + if (remcount >= count) + return; + } + } + else + { + ItemRemovedQuestCheck(item.GetEntry(), count - remcount); + item.SetCount(item.GetCount() - count + remcount); + if (IsInWorld && update) + item.SendUpdateToPlayer(this); + item.SetState(ItemUpdateState.Changed, this); + return; + } + } + } + } + for (byte i = InventorySlots.ReagentStart; i < InventorySlots.ReagentEnd; ++i) { Item item = GetItemByPos(InventorySlots.Bag0, i);