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
This commit is contained in:
ariel-
2018-03-14 11:57:51 -03:00
parent 8cf7eda8c1
commit 9cc109fe3e

View File

@@ -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);