From fdd904225cf266078185634e278c0eb86a57d0ab Mon Sep 17 00:00:00 2001 From: hondacrx Date: Wed, 23 Jun 2021 23:15:10 -0400 Subject: [PATCH] Core/Handlers: fix bogus check that skipped CMSG_CAST_SPELL packet under certain conditions, missing a target change Port From (https://github.com/TrinityCore/TrinityCore/commit/16b1f5c7f6324dcd5ac5803cae343359c5ba8611) --- Source/Game/Handlers/SpellHandler.cs | 17 +++++++++++------ 1 file changed, 11 insertions(+), 6 deletions(-) diff --git a/Source/Game/Handlers/SpellHandler.cs b/Source/Game/Handlers/SpellHandler.cs index d42d8b9ee..24c3df411 100644 --- a/Source/Game/Handlers/SpellHandler.cs +++ b/Source/Game/Handlers/SpellHandler.cs @@ -304,12 +304,6 @@ namespace Game // Check possible spell cast overrides spellInfo = caster.GetCastSpellInfo(spellInfo); - // Client is resending autoshot cast opcode when other spell is casted during shoot rotation - // Skip it to prevent "interrupt" message - if (spellInfo.IsAutoRepeatRangedSpell() && GetPlayer().GetCurrentSpell(CurrentSpellTypes.AutoRepeat) != null - && GetPlayer().GetCurrentSpell(CurrentSpellTypes.AutoRepeat).m_spellInfo == spellInfo) - return; - // can't use our own spells when we're in possession of another unit, if (GetPlayer().IsPossessing()) return; @@ -317,6 +311,17 @@ namespace Game // client provided targets SpellCastTargets targets = new(caster, cast.Cast); + // Client is resending autoshot cast opcode when other spell is cast during shoot rotation + // Skip it to prevent "interrupt" message + // Also check targets! target may have changed and we need to interrupt current spell + if (spellInfo.IsAutoRepeatRangedSpell()) + { + Spell autoRepeatSpell = caster.GetCurrentSpell(CurrentSpellTypes.AutoRepeat); + if (autoRepeatSpell != null) + if (autoRepeatSpell.m_spellInfo == spellInfo && autoRepeatSpell.m_targets.GetUnitTargetGUID() == targets.GetUnitTargetGUID()) + return; + } + // auto-selection buff level base at target level (in spellInfo) if (targets.GetUnitTarget() != null) {