Browse Source

Restored spell queueing support

Fix #316
Image 3 years ago
parent
commit
6a95d4657f
2 changed files with 13 additions and 6 deletions
  1. 12 5
      EQ2/source/WorldServer/SpellProcess.cpp
  2. 1 1
      EQ2/source/WorldServer/SpellProcess.h

+ 12 - 5
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;
 		}
 

+ 1 - 1
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>