Skip to content

Commit

Permalink
to fix Enchant stacking alexkulya#52
Browse files Browse the repository at this point in the history
Engineering enchantments and regular enchantments should coexist

From search engines
  • Loading branch information
ctmwow authored Apr 9, 2024
1 parent 254397a commit df72b75
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions src/server/game/Spells/SpellEffects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down

0 comments on commit df72b75

Please sign in to comment.