mirror of
https://github.com/liyunfan1223/azerothcore-wotlk.git
synced 2026-08-08 07:48:02 +00:00
fix(Core/Spells): Properly remove item dependent passive auras on item unequip (#7944)
This commit is contained in:
@@ -2905,33 +2905,41 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update, bool swap)
|
|||||||
RemoveItemsSetItem(this, pProto);
|
RemoveItemsSetItem(this, pProto);
|
||||||
|
|
||||||
_ApplyItemMods(pItem, slot, false);
|
_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;
|
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);
|
SetGuidValue(PLAYER_FIELD_INV_SLOT_HEAD + (slot * 2), ObjectGuid::Empty);
|
||||||
|
|
||||||
if (slot < EQUIPMENT_SLOT_END)
|
if (slot < EQUIPMENT_SLOT_END)
|
||||||
|
|||||||
Reference in New Issue
Block a user