diff options
author | Roc13x <roc13x@gmail.com> | 2018-04-28 14:36:42 +0100 |
---|---|---|
committer | Shauren <shauren.trinity@gmail.com> | 2018-04-28 16:36:42 +0300 |
commit | 2d666810d2ce42dde819f3d027a8583fb94dacd2 (patch) | |
tree | 1ff13f6efbd9d5d5007f976302d2c512b4fb75b8 | |
parent | 37f57ce6b9c548798e2c12e6d0514150ab3ad9da (diff) |
Core/Items: HasItemCount and DestroyItemCount now count bank bags (#21648)
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 34 |
1 files changed, 32 insertions, 2 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index ff792ac82e1..832fe63e578 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -10004,7 +10004,7 @@ bool Player::HasItemCount(uint32 item, uint32 count, bool inBankAlso) const if (inBankAlso) { - for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_ITEM_END; i++) + for (uint8 i = BANK_SLOT_ITEM_START; i < BANK_SLOT_BAG_END; i++) { Item* pItem = GetItemByPos(INVENTORY_SLOT_BAG_0, i); if (pItem && pItem->GetEntry() == item && !pItem->IsInTrade()) @@ -12525,7 +12525,7 @@ void Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, bool { if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) { - if (item && item->GetEntry() == itemEntry && !item->IsInTrade()) + if (item->GetEntry() == itemEntry && !item->IsInTrade()) { if (item->GetCount() + remcount <= count) { @@ -12613,6 +12613,36 @@ void Player::DestroyItemCount(uint32 itemEntry, uint32 count, bool update, bool } } + // in bank bag list + for (uint8 i = BANK_SLOT_BAG_START; i < BANK_SLOT_BAG_END; i++) + { + if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) + { + if (item->GetEntry() == itemEntry && !item->IsInTrade()) + { + if (item->GetCount() + remcount <= count) + { + if (!unequip_check || CanUnequipItem(INVENTORY_SLOT_BAG_0 << 8 | i, false) == EQUIP_ERR_OK) + { + remcount += item->GetCount(); + DestroyItem(INVENTORY_SLOT_BAG_0, 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(ITEM_CHANGED, this); + return; + } + } + } + } + for (uint8 i = REAGENT_SLOT_START; i < REAGENT_SLOT_END; ++i) { if (Item* item = GetItemByPos(INVENTORY_SLOT_BAG_0, i)) |