Core: https://github.com/TrinityCore/TrinityCore/commit/747ea7ca2c2b757dc9c5a672746d801a8365ee98
DB: TDB_full_335.59_2015_07_14 + updates
Bug:
Hunter's auto-shot displays an inappropriate 'interrupted' error in the client for the following reasons:
Details:
I found an old PTR video from 3.0.2 which shows a hunter moving in and out of shooting / melee. Notice there are no "Interrupted" errors displayed on the client.
working on it. ^_^
Maybe it needs a more active use of SPELL_FAILED_DONT_REPORT to drop messaging when target is dead?
Needs further testing, I only briefly tested on a hunter, See Patch:
https://gist.github.com/Langerz82/fab95ee5755067a107a84722ebbb6942
Going to set aside a couple of hours to test it during the weekend.
Looking forward to feedback from other testers & TC members too.
At a glance, you should also handle the other direction: melee to ranged. In the patch you posted, the flag hasSwitchedRangedToMelee never gets reset to FALSE unless the mob is already in melee range.
if (IsWithinMeleeRange(victim) && hasSwitchedRangedToMelee)
{
hasSwitchedRangedToMelee = false;
}
If a mob starts to flee or the player tab-targets another mob, this flag would remain TRUE even though the player would auto-switch from melee to ranged.
Looks good though, you're definitely on the right track here.
I have updated the patch to reflect the other case you mentioned. This is a better, cleaner, solution.
See:
https://gist.github.com/Langerz82/fab95ee5755067a107a84722ebbb6942
Have not tested in game but looks better. Please consider this one coding style change:
Change:
// Prevents Interrupted packet if its an repeated Auto Ranged Spell.
if (m_spellInfo->RangeEntry && m_spellInfo->RangeEntry->type == SPELL_RANGE_RANGED && m_spellInfo->IsAutoRepeatRangedSpell())
{
}
else
{
// Send Interrupted info like normal.
SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED);
}
To
// Prevents Interrupted packet if its a repeated Auto Ranged Spell to avoid "interrupted" message spam in client
if !(m_spellInfo->RangeEntry && m_spellInfo->RangeEntry->type == SPELL_RANGE_RANGED && m_spellInfo->IsAutoRepeatRangedSpell())
{
// Send Interrupted info like normal.
SendInterrupted(0);
SendCastResult(SPELL_FAILED_INTERRUPTED);
}
EDIT:
Oops, I forgot you can reply directly to a gist so I copied this message there...
@MrSmite done, see:
https://gist.github.com/Langerz82/fab95ee5755067a107a84722ebbb6942
Most helpful comment
working on it. ^_^