From df72b75c150c47008100d40bc394d6b586313ad4 Mon Sep 17 00:00:00 2001 From: Kloster Date: Tue, 9 Apr 2024 21:24:58 +0800 Subject: [PATCH] to fix Enchant stacking #52 Engineering enchantments and regular enchantments should coexist From search engines --- src/server/game/Spells/SpellEffects.cpp | 27 ++++++++++++++----------- 1 file changed, 15 insertions(+), 12 deletions(-) diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index de0e6afd..19b11b91 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -3138,19 +3138,22 @@ void Spell::EffectEnchantItemPerm(SpellEffIndex effIndex) item_owner->GetName().c_str(), item_owner->GetSession()->GetAccountId()); } - EnchantmentSlot slot = PERM_ENCHANTMENT_SLOT; - - if (enchant->RequiredSkill == SKILL_ENGINEERING && enchant->Type[0] == ITEM_ENCHANTMENT_TYPE_USE_SPELL) - slot = ENGINEERING_ENCHANTMENT_SLOT; - + // 工程附魔和普通附魔应该可以共存才对 // remove old enchanting before applying new if equipped - item_owner->ApplyEnchantment(itemTarget, slot, false); - - itemTarget->SetEnchantment(PERM_ENCHANTMENT_SLOT, enchant_id, 0, enchant->Charges, m_caster->GetGUID()); - - // add new enchanting if equipped - item_owner->ApplyEnchantment(itemTarget, slot, true); - + if (IsPartOfSkillLine(SKILL_ENGINEERING, m_spellInfo->Id)) + { + item_owner->ApplyEnchantment(itemTarget, ENGINEERING_ENCHANTMENT_SLOT, false); + itemTarget->SetEnchantment(ENGINEERING_ENCHANTMENT_SLOT, enchant_id, 0, 0, m_caster->GetGUID()); + // add new enchanting if equipped + item_owner->ApplyEnchantment(itemTarget, ENGINEERING_ENCHANTMENT_SLOT, true); + } + else + { + item_owner->ApplyEnchantment(itemTarget, PERM_ENCHANTMENT_SLOT, false); + itemTarget->SetEnchantment(PERM_ENCHANTMENT_SLOT, enchant_id, 0, 0, m_caster->GetGUID()); + // add new enchanting if equipped + item_owner->ApplyEnchantment(itemTarget, PERM_ENCHANTMENT_SLOT, true); + } itemTarget->ClearSoulboundTradeable(item_owner); } }