mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-24 19:06:49 +01:00
Core/Player: prevent early aura removal when swapping weapons
Closes #18428
(cherry picked from commit 7e83d7e22a)
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user