Core/Player: prevent early aura removal when swapping weapons

Closes #18428
(cherry picked from commit 7e83d7e22a)
This commit is contained in:
ariel-
2016-12-15 07:55:08 -03:00
committed by DoctorKraft
parent 6d060bbea8
commit c29e25edfa
2 changed files with 11 additions and 4 deletions

View File

@@ -7256,7 +7256,7 @@ void Player::DuelComplete(DuelCompleteType type)
//---------------------------------------------------------//
void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply)
void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply, bool updateItemAuras /*= true*/)
{
if (slot >= INVENTORY_SLOT_BAG_END || !item)
return;
@@ -7277,7 +7277,8 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply)
_ApplyItemBonuses(item, slot, apply);
ApplyItemEquipSpell(item, apply);
ApplyItemDependentAuras(item, apply);
if (updateItemAuras)
ApplyItemDependentAuras(item, apply);
ApplyArtifactPowers(item, apply);
ApplyEnchantment(item, apply);
@@ -12195,7 +12196,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
if (pProto && pProto->GetItemSet())
RemoveItemsSetItem(this, pProto);
_ApplyItemMods(pItem, slot, false);
_ApplyItemMods(pItem, slot, false, update);
// remove item dependent auras and casts (only weapon and armor slots)
if (slot < EQUIPMENT_SLOT_END)
@@ -13200,6 +13201,9 @@ void Player::SwapItem(uint16 src, uint16 dst)
RemoveItem(dstbag, dstslot, false);
RemoveItem(srcbag, srcslot, false);
if (srcbag == INVENTORY_SLOT_BAG_0 && srcslot < INVENTORY_SLOT_BAG_END)
ApplyItemDependentAuras(pSrcItem, false);
// add to dest
if (IsInventoryPos(dst))
StoreItem(sDest, pSrcItem, true);
@@ -13212,6 +13216,9 @@ void Player::SwapItem(uint16 src, uint16 dst)
EquipChildItem(srcbag, srcslot, pSrcItem);
}
if (dstbag == INVENTORY_SLOT_BAG_0 && dstslot < INVENTORY_SLOT_BAG_END)
ApplyItemDependentAuras(pDstItem, false);
// add to src
if (IsInventoryPos(src))
StoreItem(sDest2, pDstItem, true);

View File

@@ -2032,7 +2032,7 @@ class TC_GAME_API Player : public Unit, public GridObject<Player>
void ApplyItemDependentAuras(Item* item, bool apply);
void _ApplyItemMods(Item* item, uint8 slot, bool apply);
void _ApplyItemMods(Item* item, uint8 slot, bool apply, bool updateItemAuras = true);
void _RemoveAllItemMods();
void _ApplyAllItemMods();
void _ApplyAllLevelScaleItemMods(bool apply);