From 6a95d4657f3930fa19f9683095885945586bde51 Mon Sep 17 00:00:00 2001 From: Image <> Date: Wed, 10 Mar 2021 22:28:39 -0500 Subject: [PATCH] Restored spell queueing support Fix #316 --- EQ2/source/WorldServer/SpellProcess.cpp | 17 ++++++++++++----- EQ2/source/WorldServer/SpellProcess.h | 2 +- 2 files changed, 13 insertions(+), 6 deletions(-) diff --git a/EQ2/source/WorldServer/SpellProcess.cpp b/EQ2/source/WorldServer/SpellProcess.cpp index d41068534..fd54e40be 100644 --- a/EQ2/source/WorldServer/SpellProcess.cpp +++ b/EQ2/source/WorldServer/SpellProcess.cpp @@ -795,7 +795,7 @@ void SpellProcess::CheckSpellQueue(Entity* caster){ } } -void SpellProcess::CheckSpellQueue(Spell* spell, Entity* caster){ +bool SpellProcess::CheckSpellQueue(Spell* spell, Entity* caster){ if(caster->IsPlayer()){ bool add = true; bool remove = false; @@ -807,8 +807,12 @@ void SpellProcess::CheckSpellQueue(Spell* spell, Entity* caster){ if(remove) RemoveSpellFromQueue(spell, caster); if(add) + { AddSpellToQueue(spell, caster); + return true; + } } + return false; } void SpellProcess::SendSpellBookUpdate(Client* client){ @@ -1037,7 +1041,7 @@ void SpellProcess::ProcessSpell(ZoneServer* zone, Spell* spell, Entity* caster, zone->RemoveTargetFromSpell(conflictSpell, tmpTarget); CheckRemoveTargetFromSpell(conflictSpell); ((Entity*)tmpTarget)->RemoveSpellEffect(conflictSpell); - if(client) + if(client && IsReady(conflictSpell->spell, client->GetPlayer())) UnlockSpell(client, conflictSpell->spell); } DeleteSpell(lua_spell); @@ -1089,9 +1093,12 @@ void SpellProcess::ProcessSpell(ZoneServer* zone, Spell* spell, Entity* caster, if(caster->IsPlayer() && !IsReady(spell, caster)) { LogWrite(SPELL__DEBUG, 1, "Spell", "Queuing spell for %s.", caster->GetName()); - CheckSpellQueue(spell, caster); - lua_spell->caster->GetZone()->GetSpellProcess()->RemoveSpellScriptTimerBySpell(lua_spell); - DeleteSpell(lua_spell); + bool queueSpell = CheckSpellQueue(spell, caster); + if(!queueSpell) + { + lua_spell->caster->GetZone()->GetSpellProcess()->RemoveSpellScriptTimerBySpell(lua_spell); + DeleteSpell(lua_spell); + } return; } diff --git a/EQ2/source/WorldServer/SpellProcess.h b/EQ2/source/WorldServer/SpellProcess.h index 8e89649b0..72e87f7f8 100644 --- a/EQ2/source/WorldServer/SpellProcess.h +++ b/EQ2/source/WorldServer/SpellProcess.h @@ -299,7 +299,7 @@ public: /// <summary>Check the given enities queue for the spell, if found remove, if not found add</summary> /// <param name='spell'>Spell to check for</param> /// <param name='caster'>Entity's queue to check, if not player function does nothing</param> - void CheckSpellQueue(Spell* spell, Entity* caster); + bool CheckSpellQueue(Spell* spell, Entity* caster); /// <summary>Checks to see if the entity can cast the spell </summary> /// <param name='spell'>The spell being cast</param>