From 1174b43184cc0cb77ea593fc29a259751b216509 Mon Sep 17 00:00:00 2001 From: lineagedr Date: Fri, 20 Aug 2021 21:17:01 +0300 Subject: [PATCH] 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 --- src/server/game/Entities/Player/Player.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index 52935fd27..c6eaff907 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -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 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; }