aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorxinef1 <w.szyszko2@gmail.com>2016-12-30 20:38:54 +0100
committerDoctorKraft <DoctorKraft@users.noreply.github.com>2018-03-18 00:19:46 +0100
commit15b22590beb99fd1ac7f06564d5aa37a29ab127c (patch)
tree3a41f38abab2f888f580d1884c21c8d3171bca58 /src
parent9fe172d7d510116892e2ef4cbd6ea4bf88ac4674 (diff)
Core/Items: Fixed problem where item dependent auras are not properly updated (#18592)
- Introduced in 7e83d7e22a82104e53f872758fc7fe835472782c Closes #18506 (cherry picked from commit 90a330c910804f9cb770681ff646a2362c8c0efa)
Diffstat (limited to 'src')
-rw-r--r--src/server/game/Entities/Player/Player.cpp11
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp5
2 files changed, 10 insertions, 6 deletions
diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp
index 1298f5815bc..e964818fe12 100644
--- a/src/server/game/Entities/Player/Player.cpp
+++ b/src/server/game/Entities/Player/Player.cpp
@@ -13201,9 +13201,6 @@ 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);
@@ -13216,9 +13213,6 @@ 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);
@@ -13227,6 +13221,11 @@ void Player::SwapItem(uint16 src, uint16 dst)
else if (IsEquipmentPos(src))
EquipItem(eDest2, pDstItem, true);
+ // if inventory item was moved, check if we can remove dependent auras, because they were not removed in Player::RemoveItem (update was set to false)
+ // do this after swaps are done, we pass nullptr because both weapons could be swapped and none of them should be ignored
+ if ((srcbag == INVENTORY_SLOT_BAG_0 && srcslot < INVENTORY_SLOT_BAG_END) || (dstbag == INVENTORY_SLOT_BAG_0 && dstslot < INVENTORY_SLOT_BAG_END))
+ ApplyItemDependentAuras((Item*)nullptr, false);
+
// if player is moving bags and is looting an item inside this bag
// release the loot
if (!GetLootGUID().IsEmpty())
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 1b1910abdc5..50ff418d108 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -303,6 +303,11 @@ void WorldSession::HandleAutoEquipItemOpcode(WorldPackets::Item::AutoEquipItem&
}
_player->AutoUnequipOffhandIfNeed();
+
+ // if inventory item was moved, check if we can remove dependent auras, because they were not removed in Player::RemoveItem (update was set to false)
+ // do this after swaps are done, we pass nullptr because both weapons could be swapped and none of them should be ignored
+ if ((autoEquipItem.PackSlot == INVENTORY_SLOT_BAG_0 && autoEquipItem.Slot < INVENTORY_SLOT_BAG_END) || (dstbag == INVENTORY_SLOT_BAG_0 && dstslot < INVENTORY_SLOT_BAG_END))
+ _player->ApplyItemDependentAuras((Item*)nullptr, false);
}
}