Core/Items: Implemented artifacts

This commit is contained in:
Shauren
2016-08-15 00:03:38 +02:00
parent f8c5a2c723
commit fea0cb16f2
40 changed files with 1744 additions and 65 deletions

View File

@@ -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...