[Spells] Fix for AA recast timers not resetting properly (#1989)

* revert completed

Too many issues popping up that are difficult to track down. This was probably not best way to solve the problem.

* fixed for real

* Update aa.cpp

* Update aa.cpp

* Update aa.cpp

* should work

* remove spaces

* [Spells] Fix for AA recast timers not resetting properly
This commit is contained in:
KayenEQ
2022-02-11 16:25:59 -05:00
committed by GitHub
parent e2484997dd
commit 99793cab8b
3 changed files with 30 additions and 22 deletions
+22 -11
View File
@@ -2221,7 +2221,7 @@ bool Mob::DetermineSpellTargets(uint16 spell_id, Mob *&spell_target, Mob *&ae_ce
// if you need to abort the casting, return false
bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, uint16 mana_used,
uint32 inventory_slot, int16 resist_adjust, bool isproc, int level_override,
uint32 timer, uint32 timer_duration, bool from_casted_spell)
uint32 timer, uint32 timer_duration, bool from_casted_spell, uint32 aa_id)
{
Mob *ae_center = nullptr;
@@ -2600,22 +2600,33 @@ bool Mob::SpellFinished(uint16 spell_id, Mob *spell_target, CastingSlot slot, ui
*/
if(IsClient() && !isproc)
{
//Support for bards to get disc recast timers while singing
if (slot == CastingSlot::AltAbility) {
if (!aa_id) {
aa_id = casting_spell_aa_id;
}
if (aa_id) {
AA::Rank *rank = zone->GetAlternateAdvancementRank(aa_id);
//handle expendable AA's
if (rank && rank->base_ability) {
ExpendAlternateAdvancementCharge(rank->base_ability->id);
}
//set AA recast timer
CastToClient()->SendAlternateAdvancementTimer(rank->spell_type, 0, 0);
}
}
//handle bard AA and Discipline recast timers when singing
if (GetClass() == BARD && spell_id != casting_spell_id && timer != 0xFFFFFFFF) {
CastToClient()->GetPTimers().Start(timer, timer_duration);
LogSpells("Spell [{}]: Setting bard disciple reuse timer from spell finished [{}] to [{}]", spell_id, timer, timer_duration);
LogSpells("Spell [{}]: Setting BARD custom reuse timer [{}] to [{}]", spell_id, casting_spell_timer, casting_spell_timer_duration);
}
if(casting_spell_aa_id) {
AA::Rank *rank = zone->GetAlternateAdvancementRank(casting_spell_aa_id);
if(rank && rank->base_ability) {
ExpendAlternateAdvancementCharge(rank->base_ability->id);
}
//handles AA and Discipline recast timers
else if (spell_id == casting_spell_id && casting_spell_timer != 0xFFFFFFFF)
{
CastToClient()->GetPTimers().Start(casting_spell_timer, casting_spell_timer_duration);
LogSpells("Spell [{}]: Setting custom reuse timer [{}] to [{}]", spell_id, casting_spell_timer, casting_spell_timer_duration);
}
else if(spell_id == casting_spell_id && casting_spell_timer != 0xFFFFFFFF)
{
//aa new todo: aa expendable charges here
CastToClient()->GetPTimers().Start(casting_spell_timer, casting_spell_timer_duration);
LogSpells("Spell [{}]: Setting custom reuse timer [{}] to [{}]", spell_id, casting_spell_timer, casting_spell_timer_duration);
}