diff --git a/src/server/game/Entities/Player/PlayerStorage.cpp b/src/server/game/Entities/Player/PlayerStorage.cpp index 2948a14e2..d99786d66 100644 --- a/src/server/game/Entities/Player/PlayerStorage.cpp +++ b/src/server/game/Entities/Player/PlayerStorage.cpp @@ -2905,33 +2905,41 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update, bool swap) RemoveItemsSetItem(this, pProto); _ApplyItemMods(pItem, slot, false); - - // remove item dependent auras and casts (only weapon and armor slots) - if (slot < EQUIPMENT_SLOT_END) - { - // Xinef: Ensure that this function is called for places with swap=true - if (!swap) - RemoveItemDependentAurasAndCasts(pItem); - - // remove held enchantments, update expertise - if (slot == EQUIPMENT_SLOT_MAINHAND) - UpdateExpertise(BASE_ATTACK); - else if (slot == EQUIPMENT_SLOT_OFFHAND) - UpdateExpertise(OFF_ATTACK); - // update armor penetration - passive auras may need it - switch (slot) - { - case EQUIPMENT_SLOT_MAINHAND: - case EQUIPMENT_SLOT_OFFHAND: - case EQUIPMENT_SLOT_RANGED: - RecalculateRating(CR_ARMOR_PENETRATION); - default: - break; - } - } } m_items[slot] = nullptr; + + // remove item dependent auras and casts (only weapon and armor slots) + if (slot < INVENTORY_SLOT_BAG_END && slot < EQUIPMENT_SLOT_END) + { + // Xinef: Ensure that this function is called for places with swap=true + if (!swap) + { + RemoveItemDependentAurasAndCasts(pItem); + } + + // remove held enchantments, update expertise + if (slot == EQUIPMENT_SLOT_MAINHAND) + { + UpdateExpertise(BASE_ATTACK); + } + else if (slot == EQUIPMENT_SLOT_OFFHAND) + { + UpdateExpertise(OFF_ATTACK); + } + + // update armor penetration - passive auras may need it + switch (slot) + { + case EQUIPMENT_SLOT_MAINHAND: + case EQUIPMENT_SLOT_OFFHAND: + case EQUIPMENT_SLOT_RANGED: + RecalculateRating(CR_ARMOR_PENETRATION); + default: + break; + } + } + SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid::Empty); if (slot < EQUIPMENT_SLOT_END)