diff --git a/source/WorldServer/LuaInterface.cpp b/source/WorldServer/LuaInterface.cpp index 70f2758..5d840ce 100644 --- a/source/WorldServer/LuaInterface.cpp +++ b/source/WorldServer/LuaInterface.cpp @@ -1615,7 +1615,7 @@ void LuaInterface::DeletePendingSpells(bool all) { if(!all) { if (spell->caster && spell->caster->GetZone()) { - spell->caster->GetZone()->GetSpellProcess()->DeleteActiveSpell(spell); + spell->caster->GetZone()->GetSpellProcess()->DeleteActiveSpell(spell, true); } else if(spell->targets.size() > 0 && spell->caster && spell->caster->GetZone()) { spell->MSpellTargets.readlock(__FUNCTION__, __LINE__); @@ -1623,7 +1623,7 @@ void LuaInterface::DeletePendingSpells(bool all) { Spawn* target = spell->caster->GetZone()->GetSpawnByID(spell->targets.at(i)); if (!target || !target->IsEntity()) continue; - target->GetZone()->GetSpellProcess()->DeleteActiveSpell(spell); + target->GetZone()->GetSpellProcess()->DeleteActiveSpell(spell, true); } spell->MSpellTargets.releasereadlock(__FUNCTION__, __LINE__); } diff --git a/source/WorldServer/SpellProcess.cpp b/source/WorldServer/SpellProcess.cpp index 87f24ad..c5c89dd 100644 --- a/source/WorldServer/SpellProcess.cpp +++ b/source/WorldServer/SpellProcess.cpp @@ -3026,8 +3026,9 @@ void SpellProcess::AddSelfAndPetToCharTargets(LuaSpell* spell, Spawn* caster, bo spell->char_id_targets.insert(make_pair(charID, 0x00)); } -void SpellProcess::DeleteActiveSpell(LuaSpell* spell) { - lua_interface->RemoveCurrentSpell(spell->state, spell, true); +void SpellProcess::DeleteActiveSpell(LuaSpell* spell, bool skipRemoveCurrent) { + if(!skipRemoveCurrent) + lua_interface->RemoveCurrentSpell(spell->state, spell, true); active_spells.Remove(spell, true, 2000); } diff --git a/source/WorldServer/SpellProcess.h b/source/WorldServer/SpellProcess.h index cb398be..f2f6723 100644 --- a/source/WorldServer/SpellProcess.h +++ b/source/WorldServer/SpellProcess.h @@ -396,7 +396,7 @@ public: void AddActiveSpell(LuaSpell* spell); static void AddSelfAndPet(LuaSpell* spell, Spawn* self, bool onlyPet=false); static void AddSelfAndPetToCharTargets(LuaSpell* spell, Spawn* caster, bool onlyPet=false); - void DeleteActiveSpell(LuaSpell* spell); + void DeleteActiveSpell(LuaSpell* spell, bool skipRemoveCurrent = false); static bool AddLuaSpellTarget(LuaSpell* lua_spell, int32 id, bool lock_spell_targets = true); mutable std::shared_mutex MSpellProcess; private: