aboutsummaryrefslogtreecommitdiff
path: root/src/server/game/Handlers/ItemHandler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/server/game/Handlers/ItemHandler.cpp')
-rw-r--r--src/server/game/Handlers/ItemHandler.cpp21
1 files changed, 15 insertions, 6 deletions
diff --git a/src/server/game/Handlers/ItemHandler.cpp b/src/server/game/Handlers/ItemHandler.cpp
index 26f88bc6528..303e6158a16 100644
--- a/src/server/game/Handlers/ItemHandler.cpp
+++ b/src/server/game/Handlers/ItemHandler.cpp
@@ -1046,9 +1046,9 @@ void WorldSession::HandleSocketGems(WorldPackets::Item::SocketGems& socketGems)
//if a meta gem is being equipped, all information has to be written to the item before testing if the conditions for the gem are met
- //remove ALL enchants
- for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT + MAX_GEM_SOCKETS; ++enchant_slot)
- _player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), false);
+ //remove ALL mods - gem can change item level
+ if (itemTarget->IsEquipped())
+ _player->_ApplyItemMods(itemTarget, itemTarget->GetSlot(), false);
for (uint16 i = 0; i < MAX_GEM_SOCKETS; ++i)
{
@@ -1057,15 +1057,24 @@ void WorldSession::HandleSocketGems(WorldPackets::Item::SocketGems& socketGems)
itemTarget->SetGem(i, &gemData[i]);
if (gemProperties[i] && gemProperties[i]->EnchantID)
- itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT+i), gemProperties[i]->EnchantID, 0, 0, _player->GetGUID());
+ itemTarget->SetEnchantment(EnchantmentSlot(SOCK_ENCHANTMENT_SLOT + i), gemProperties[i]->EnchantID, 0, 0, _player->GetGUID());
uint32 gemCount = 1;
_player->DestroyItemCount(gems[i], gemCount, true);
}
}
- for (uint32 enchant_slot = SOCK_ENCHANTMENT_SLOT; enchant_slot < SOCK_ENCHANTMENT_SLOT+MAX_GEM_SOCKETS; ++enchant_slot)
- _player->ApplyEnchantment(itemTarget, EnchantmentSlot(enchant_slot), true);
+ if (itemTarget->IsEquipped())
+ _player->_ApplyItemMods(itemTarget, itemTarget->GetSlot(), true);
+
+ if (Item* childItem = _player->GetChildItemByGuid(itemTarget->GetChildItem()))
+ {
+ if (childItem->IsEquipped())
+ _player->_ApplyItemMods(childItem, childItem->GetSlot(), false);
+ childItem->CopyArtifactDataFromParent(itemTarget);
+ if (childItem->IsEquipped())
+ _player->_ApplyItemMods(childItem, childItem->GetSlot(), true);
+ }
bool SocketBonusToBeActivated = itemTarget->GemsFitSockets();//current socketbonus state
if (SocketBonusActivated ^ SocketBonusToBeActivated) //if there was a change...