From 2ca6b95029a502705b6e93cc221622130af0f621 Mon Sep 17 00:00:00 2001 From: hondacrx Date: Sun, 18 Mar 2018 12:18:00 -0400 Subject: [PATCH] Core/Items: Fixed problem where item dependent auras are not properly updated --- Source/Game/Entities/Player/Player.Items.cs | 13 ++++++------- Source/Game/Handlers/ItemHandler.cs | 5 +++++ 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/Source/Game/Entities/Player/Player.Items.cs b/Source/Game/Entities/Player/Player.Items.cs index 9bffde923..e04351690 100644 --- a/Source/Game/Entities/Player/Player.Items.cs +++ b/Source/Game/Entities/Player/Player.Items.cs @@ -2434,9 +2434,6 @@ namespace Game.Entities RemoveItem(dstbag, dstslot, false); RemoveItem(srcbag, srcslot, false); - if (srcbag == InventorySlots.Bag0 && srcslot < InventorySlots.BagEnd) - ApplyItemDependentAuras(pSrcItem, false); - // add to dest if (IsInventoryPos(dst)) StoreItem(_sDest, pSrcItem, true); @@ -2449,9 +2446,6 @@ namespace Game.Entities EquipChildItem(srcbag, srcslot, pSrcItem); } - if (dstbag == InventorySlots.Bag0 && dstslot < InventorySlots.BagEnd) - ApplyItemDependentAuras(pDstItem, false); - // add to src if (IsInventoryPos(src)) StoreItem(sDest2, pDstItem, true); @@ -2459,7 +2453,12 @@ namespace Game.Entities BankItem(sDest2, pDstItem, true); 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 == InventorySlots.Bag0 && srcslot < InventorySlots.BagEnd) || (dstbag == InventorySlots.Bag0 && dstslot < InventorySlots.BagEnd)) + ApplyItemDependentAuras(null, false); + // if player is moving bags and is looting an item inside this bag // release the loot if (!GetLootGUID().IsEmpty()) diff --git a/Source/Game/Handlers/ItemHandler.cs b/Source/Game/Handlers/ItemHandler.cs index b629f7dd4..55ba14243 100644 --- a/Source/Game/Handlers/ItemHandler.cs +++ b/Source/Game/Handlers/ItemHandler.cs @@ -298,6 +298,11 @@ namespace Game } pl.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 == InventorySlots.Bag0 && autoEquipItem.Slot < InventorySlots.BagEnd) || (dstbag == InventorySlots.Bag0 && dstslot < InventorySlots.BagEnd)) + pl.ApplyItemDependentAuras(null, false); } }