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)
This commit is contained in:
hondacrx
2021-06-23 23:15:10 -04:00
parent 237b583e64
commit fdd904225c
+11 -6
View File
@@ -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)
{