Core/Spells: implement SpellInfo helper to filter for relevant mechanic immunities in spell_start packet (#26183)

* Core/Spells: implement SpellInfo helper to filter for relevant mechanic immunities when sending SMSG_SPELL_START packets.

According to sniff analysis Blizzard does not send all mechanic immunities of creatures but instead only the ones that are responsible for actual interrupts which are MECHANIC_INTERRUPT  and MECHANIC_SILENCE. Additionally we no longer send immunities for instant cast spells as sniffs confirm that they are not sent for spells without a cast time.
This commit is contained in:
Ovah
2021-04-11 12:51:58 +02:00
committed by GitHub
parent 43dd1b37d6
commit 6215cb4e00
3 changed files with 22 additions and 2 deletions

View File

@@ -4176,8 +4176,8 @@ void Spell::SendSpellStart()
uint32 mechanicImmunityMask = 0;
if (Unit* unitCaster = m_caster->ToUnit())
{
schoolImmunityMask = unitCaster->GetSchoolImmunityMask();
mechanicImmunityMask = unitCaster->GetMechanicImmunityMask();
schoolImmunityMask = m_timer!= 0 ? unitCaster->GetSchoolImmunityMask() : 0;
mechanicImmunityMask = m_timer != 0 ? m_spellInfo->GetMechanicImmunityMask(unitCaster) : 0;
}
if (schoolImmunityMask || mechanicImmunityMask)

View File

@@ -3038,6 +3038,24 @@ uint32 SpellInfo::GetAllowedMechanicMask() const
return _allowedMechanicMask;
}
uint32 SpellInfo::GetMechanicImmunityMask(Unit* caster) const
{
uint32 casterMechanicImmunityMask = caster->GetMechanicImmunityMask();
uint32 mechanicImmunityMask = 0;
// @todo: research other interrupt flags
if (InterruptFlags & SPELL_INTERRUPT_FLAG_INTERRUPT)
{
if (casterMechanicImmunityMask & (1 << MECHANIC_SILENCE))
mechanicImmunityMask |= (1 << MECHANIC_SILENCE);
if (casterMechanicImmunityMask & (1 << MECHANIC_INTERRUPT))
mechanicImmunityMask |= (1 << MECHANIC_INTERRUPT);
}
return mechanicImmunityMask;
}
float SpellInfo::GetMinRange(bool positive /*= false*/) const
{
if (!RangeEntry)

View File

@@ -533,6 +533,8 @@ class TC_GAME_API SpellInfo
uint32 GetAllowedMechanicMask() const;
uint32 GetMechanicImmunityMask(Unit* caster) const;
private:
// loading helpers
void _InitializeExplicitTargetMask();