File tree 1 file changed +24
-0
lines changed
1 file changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -470,6 +470,30 @@ void WorldSession::HandleSetSelectionOpcode(WorldPacket& recvData)
470
470
recvData >> guid;
471
471
472
472
_player->SetSelection (guid);
473
+
474
+ // Update target of current autoshoot spell
475
+ if (!guid.IsEmpty ())
476
+ {
477
+ if (Spell* autoReapeatSpell = _player->GetCurrentSpell (CURRENT_AUTOREPEAT_SPELL))
478
+ {
479
+ if (!autoReapeatSpell->GetSpellInfo ()->HasAttribute (SPELL_ATTR4_UNK24) // client automatically handles spells with SPELL_ATTR4_AUTO_RANGED_COMBAT
480
+ && autoReapeatSpell->m_targets .GetUnitTargetGUID () != guid)
481
+ {
482
+ Unit* unitTarget = [&]() -> Unit*
483
+ {
484
+ Unit* unit = ObjectAccessor::GetUnit (*_player, guid);
485
+ if (unit && _player->IsValidAttackTarget (unit, autoReapeatSpell->GetSpellInfo ()))
486
+ return unit;
487
+ return nullptr ;
488
+ }();
489
+
490
+ if (unitTarget)
491
+ autoReapeatSpell->m_targets .SetUnitTarget (unitTarget);
492
+ else
493
+ autoReapeatSpell->m_targets .RemoveObjectTarget ();
494
+ }
495
+ }
496
+ }
473
497
}
474
498
475
499
void WorldSession::HandleStandStateChangeOpcode (WorldPacket& recvData)
You can’t perform that action at this time.
0 commit comments