EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   AA reset timer on failed casts. (https://www.eqemulator.org/forums/showthread.php?t=35715)

demonstar55 08-29-2012 06:20 PM

COMMITTED: AA reset timer on failed casts.
 
For some reason shorter reuse timer AAs (Divine Arbiration, Wrath of the Wild) were not being reset on failed casts (interrupts)

Code:

Index: AA.cpp
===================================================================
--- AA.cpp      (revision 2196)
+++ AA.cpp      (working copy)
@@ -288,7 +288,11 @@
                        }

                        if(!CastSpell(caa->spell_id, target_id, 10, -1, -1, 0, -1, AATimerID + pTimerAAStart, timer_base, 1))
-                                      return;
+                      {
+                              // Reset the timer on an AA if it failed to cast for some reason (interrupt)
+                              p_timers.Clear(&database, AATimerID + pTimerAAStart);
+                              return;
+                      }
                }
                else
                {


cavedude 09-02-2012 01:45 PM

I'm going to be taking a look at your submissions and testing them on TGC. If all goes well, they'll be committed. Start to look for them live on the server tomorrow.

demonstar55 09-05-2012 07:15 PM

Hmm, there appears to miss a case.. Will have to do some investigation (my guess is when the target moves out of range, but that's just intuition right now, haven't payed enough attention to when it happens :/ )

demonstar55 09-08-2012 06:41 PM

Okay, I found the case where it was still not resetting the timer, and my inclination was right, it was when the target moved out of range. You can ignore the previous diff and apply this one (I originally didn't want to touch the Cast functions because of a rather ominous warning, but I have to now!)

Code:

Index: AA.cpp
===================================================================
--- AA.cpp      (revision 2207)
+++ AA.cpp      (working copy)
@@ -241,6 +241,7 @@
                case aaTargetCurrentGroup:
                        if(GetTarget() == NULL) {
                                Message_StringID(MT_DefaultText, AA_NO_TARGET); //You must first select a target for this ability!
+                              p_timers.Clear(&database, AATimerID + pTimerAAStart);
                                return;
                        }
                        target_id = GetTarget()->GetID();
@@ -501,6 +502,7 @@
                case aaTargetCurrentGroup:
                        if(GetTarget() == NULL) {
                                Message_StringID(MT_DefaultText, AA_NO_TARGET); //You must first select a target for this ability!
+                              p_timers.Clear(&database, timer_id + pTimerAAEffectStart);
                                return;
                        }
                        target_id = GetTarget()->GetID();
Index: spells.cpp
===================================================================
--- spells.cpp  (revision 2207)
+++ spells.cpp  (working copy)
@@ -711,6 +711,9 @@
                CastToNPC()->AI_Event_SpellCastFinished(false, casting_spell_slot);
        }

+      if(casting_spell_type == 1 && IsClient()) //Rest AA Timer on failed cast
+              CastToClient()->GetPTimers().Clear(&database, casting_spell_timer);
+
        ZeroCastingVars();      // resets all the state keeping stuff

        mlog(SPELLS__CASTING, "Spell %d has been interrupted.", spellid);


cavedude 09-10-2012 12:29 PM

Look for the updated code on PEQ tomorrow.


All times are GMT -4. The time now is 07:37 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.