diff options
author | ariel- <ariel-@users.noreply.github.com> | 2018-03-14 11:57:51 -0300 |
---|---|---|
committer | ariel- <ariel-@users.noreply.github.com> | 2018-03-14 11:57:51 -0300 |
commit | 9cc109fe3ebc87a7d12edfe99df121ade4f29fc7 (patch) | |
tree | dc2ec6425c5d0c44532aea377730010f4c36377c /src | |
parent | 8cf7eda8c12f8fd5c64245cb24c102c62967a030 (diff) |
Core/Player: properly clear m_items array when unequipping items from the bag
- Also cleanup weapon damage ap mult when direct destroying a equipped weapon
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Entities/Player/Player.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index b8cf9aa206d..ea4881957b5 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -12246,6 +12246,8 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update) } } } + else + m_items[slot] = nullptr; SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid::Empty); @@ -12352,11 +12354,13 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) // equipment and equipped bags can have applied bonuses if (slot < INVENTORY_SLOT_BAG_END) { - // item set bonuses applied only at equip and removed at unequip, and still active for broken items if (pProto->ItemSet) RemoveItemsSetItem(this, pProto); + // clear m_items so weapons for example can be registered as unequipped + m_items[slot] = nullptr; + _ApplyItemMods(pItem, slot, false); } @@ -12382,7 +12386,9 @@ void Player::DestroyItem(uint8 bag, uint8 slot, bool update) SetVisibleItemSlot(slot, nullptr); } - m_items[slot] = nullptr; + // clear for rest of items (ie nonequippable) + if (slot >= INVENTORY_SLOT_BAG_END) + m_items[slot] = nullptr; } else if (Bag* pBag = GetBagByPos(bag)) pBag->RemoveItem(slot, update); |