mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-30 17:13:47 +00:00
fix(Core/Items): toggle temporary items enchantments during items swap. (#8067)
- Closes #7957
This commit is contained in:
@@ -3719,6 +3719,14 @@ void Player::SwapItem(uint16 src, uint16 dst)
|
||||
}
|
||||
}
|
||||
|
||||
// Remove item enchantments for now and restore it later
|
||||
// Needed for swap sanity checks
|
||||
ApplyEnchantment(pSrcItem, false);
|
||||
if (pDstItem)
|
||||
{
|
||||
ApplyEnchantment(pDstItem, false);
|
||||
}
|
||||
|
||||
// impossible merge/fill, do real swap
|
||||
InventoryResult msg = EQUIP_ERR_OK;
|
||||
|
||||
@@ -3738,6 +3746,13 @@ void Player::SwapItem(uint16 src, uint16 dst)
|
||||
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
// Restore enchantments
|
||||
ApplyEnchantment(pSrcItem, true);
|
||||
if (pDstItem)
|
||||
{
|
||||
ApplyEnchantment(pDstItem, true);
|
||||
}
|
||||
|
||||
SendEquipError(msg, pSrcItem, pDstItem);
|
||||
return;
|
||||
}
|
||||
@@ -3758,10 +3773,24 @@ void Player::SwapItem(uint16 src, uint16 dst)
|
||||
|
||||
if (msg != EQUIP_ERR_OK)
|
||||
{
|
||||
// Restore enchantments
|
||||
ApplyEnchantment(pSrcItem, true);
|
||||
if (pDstItem)
|
||||
{
|
||||
ApplyEnchantment(pDstItem, true);
|
||||
}
|
||||
|
||||
SendEquipError(msg, pDstItem, pSrcItem);
|
||||
return;
|
||||
}
|
||||
|
||||
// Restore enchantments
|
||||
ApplyEnchantment(pSrcItem, true);
|
||||
if (pDstItem)
|
||||
{
|
||||
ApplyEnchantment(pDstItem, true);
|
||||
}
|
||||
|
||||
// Check bag swap with item exchange (one from empty in not bag possition (equipped (not possible in fact) or store)
|
||||
if (Bag* srcBag = pSrcItem->ToBag())
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user