aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-12-15 07:55:08 -0300
committerDoctorKraft <DoctorKraft@users.noreply.github.com>2018-03-12 16:39:42 +0100
commitc29e25edfaa8ab02a5396ce047f75141d572f5f2 (patch)
tree0db7a670cbf5f73a9419af7eb1984c0867aee868 /src
parent6d060bbea82fcbafd319ee137cdc2bdd906ff078 (diff)
Core/Player: prevent early aura removal when swapping weapons
Closes #18428 (cherry picked from commit 7e83d7e22a82104e53f872758fc7fe835472782c)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp13
-rw-r--r--src/server/game/Entities/Player/Player.h2
2 files changed, 11 insertions, 4 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index e16acf6dd1d..e8b285d628a 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -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);
diff --git a/src/server/game/Entities/Player/Player.h b/src/server/game/Entities/Player/Player.h
index fb79716bed8..9b60c05df1e 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -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);