mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-17 08:00:48 +01:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user