From 3a95f81196935016741c56412ccb24224d88766f Mon Sep 17 00:00:00 2001 From: Michael Cook Date: Wed, 9 Oct 2013 02:00:49 -0400 Subject: [PATCH] Fixed more instances of AA timers being eaten Every time I touch zone/AA.cpp to fix timers it gets uglier. This should fix the bug reported here: http://www.peqtgc.com/phpBB3/viewtopic.php?f=17&t=14125 It should also fix AAs not being reset when it when you have no buff slots free (confirmed on live) --- changelog.txt | 3 +++ zone/AA.cpp | 14 +++++++++----- zone/spells.cpp | 7 +++++-- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/changelog.txt b/changelog.txt index 5cd454b9f..67ecfe9a8 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,8 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 10/09/2013 == +demonstar55: Fixed some more instances of the AA timer being eaten + == 10/08/2013 == demonstar55: Added IsBuffSpell(spell_id) that will return true if the spell has a duration, so would end up in effects/song/discs etc windows on the client demonstar55: Replaced instances of using CalcBuffDuration to determine if a spell was a buff with IsBuffSpell diff --git a/zone/AA.cpp b/zone/AA.cpp index 24c17b939..71af74de0 100644 --- a/zone/AA.cpp +++ b/zone/AA.cpp @@ -262,7 +262,6 @@ void Client::ActivateAA(aaID activate){ } SetMana(GetMana() - caa->mana_cost); } - HandleAAAction(aaid); if(caa->reuse_time > 0) { uint32 timer_base = CalcAAReuseTimer(caa); @@ -273,6 +272,7 @@ void Client::ActivateAA(aaID activate){ p_timers.Start(AATimerID + pTimerAAStart, timer_base); SendAATimer(AATimerID, 0, 0); } + HandleAAAction(aaid); } //cast the spell, if we have one @@ -531,10 +531,14 @@ void Client::HandleAAAction(aaID activate) { } //cast the spell, if we have one - if(spell_id > 0 && spell_id < SPDAT_RECORDS) { - //I dont know when we need to mem and when we do not, if ever... - //MemorizeSpell(8, spell_id, 3); - CastSpell(spell_id, target_id); + if(IsValidSpell(spell_id)) { + int aatid = GetAATimerID(activate); + if(!CastSpell(spell_id, target_id , 10, -1, -1, 0, -1, pTimerAAStart + aatid , CalcAAReuseTimer(caa), 1)) { + SendAATimer(aatid, 0, 0xFFFFFF); + Message_StringID(15,ABILITY_FAILED); + p_timers.Clear(&database, pTimerAAStart + aatid); + return; + } } //handle the duration timer if we have one. diff --git a/zone/spells.cpp b/zone/spells.cpp index 5be8a19f0..02ae8db0d 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -1818,7 +1818,9 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, uint16 slot, uint16 if (isproc) { SpellOnTarget(spell_id, spell_target, false, true, resist_adjust, true); } else { - SpellOnTarget(spell_id, spell_target, false, true, resist_adjust, false); + if(!SpellOnTarget(spell_id, spell_target, false, true, resist_adjust, false)) + if(casting_spell_type == 1) // AA failed to cast, InterruptSpell to reset timer + InterruptSpell(); } if(IsPlayerIllusionSpell(spell_id) && IsClient() @@ -3478,7 +3480,8 @@ bool Mob::SpellOnTarget(uint16 spell_id, Mob* spelltar, bool reflect, bool use_r // if SpellEffect returned false there's a problem applying the // spell. It's most likely a buff that can't stack. mlog(SPELLS__CASTING_ERR, "Spell %d could not apply its effects %s -> %s\n", spell_id, GetName(), spelltar->GetName()); - Message_StringID(MT_Shout, SPELL_NO_HOLD); + if(casting_spell_type != 1) // AA is handled differently + Message_StringID(MT_Shout, SPELL_NO_HOLD); safe_delete(action_packet); return false; }