feat(Core/Item): remove item auras after unequipping an item. (#7398)

* [Core/Item]: Remove item auras after unequipping an item.

* chore(Core/Item): add brackets, improve codestyle

* Update

* update

* Update

* Update

* constexpr

* Update Player.cpp
This commit is contained in:
lineagedr
2021-08-20 21:17:01 +03:00
committed by GitHub
parent 32e149e342
commit 1174b43184

View File

@@ -6907,6 +6907,10 @@ void Player::ApplyItemEquipSpell(Item* item, bool apply, bool form_change)
if (!spellData.SpellId)
continue;
// Spells that should stay on the caster after removing the item.
constexpr std::array<uint32, 1> spellExceptions = { /*Electromagnetic Gigaflux Reactivator*/ 11826 };
const auto found = std::find(std::begin(spellExceptions), std::end(spellExceptions), spellData.SpellId);
// wrong triggering type
if (apply)
{
@@ -6917,8 +6921,8 @@ void Player::ApplyItemEquipSpell(Item* item, bool apply, bool form_change)
}
else
{
// Auras activated by use should not be removed on unequip (with no charges)
if (spellData.SpellTrigger == ITEM_SPELLTRIGGER_ON_USE && spellData.SpellCharges <= 0)
// If the spell is an exception do not remove it.
if (found != std::end(spellExceptions))
{
continue;
}