aboutsummaryrefslogtreecommitdiff
path: root/src/server
diff options
context:
space:
mode:
authorariel- <ariel-@users.noreply.github.com>2016-12-15 07:55:08 -0300
committerariel- <ariel-@users.noreply.github.com>2016-12-15 07:55:08 -0300
commit7e83d7e22a82104e53f872758fc7fe835472782c (patch)
treea78cc041c83267af625acdcaaec2ee43424b27ab /src/server
parenteb376f4b7eb3b2f1050a5cdb7b2086ab4b190de4 (diff)
Core/Player: prevent early aura removal when swapping weapons
Closes #18428
Diffstat (limited to 'src/server')
-rw-r--r--src/server/game/Entities/Player/Player.cpp14
-rw-r--r--src/server/game/Entities/Player/Player.h2
2 files changed, 12 insertions, 4 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index c7dc3043ca3..299ce2f99aa 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -7373,7 +7373,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;
@@ -7398,7 +7398,9 @@ void Player::_ApplyItemMods(Item* item, uint8 slot, bool apply)
_ApplyAmmoBonuses();
ApplyItemEquipSpell(item, apply);
- ApplyItemDependentAuras(item, apply);
+ if (updateItemAuras)
+ ApplyItemDependentAuras(item, apply);
+
ApplyEnchantment(item, apply);
TC_LOG_DEBUG("entities.player.items", "Player::_ApplyItemMods: completed");
@@ -12158,7 +12160,7 @@ void Player::RemoveItem(uint8 bag, uint8 slot, bool update)
if (pProto && pProto->ItemSet)
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)
@@ -13061,6 +13063,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);
@@ -13069,6 +13074,9 @@ void Player::SwapItem(uint16 src, uint16 dst)
else if (IsEquipmentPos(dst))
EquipItem(eDest, pSrcItem, true);
+ 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 5b3d01f3dda..dcaa2199496 100644
--- a/src/server/game/Entities/Player/Player.h
+++ b/src/server/game/Entities/Player/Player.h
@@ -1960,7 +1960,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);