mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-20 09:17:36 +01:00
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:
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -533,6 +533,8 @@ class TC_GAME_API SpellInfo
|
||||
|
||||
uint32 GetAllowedMechanicMask() const;
|
||||
|
||||
uint32 GetMechanicImmunityMask(Unit* caster) const;
|
||||
|
||||
private:
|
||||
// loading helpers
|
||||
void _InitializeExplicitTargetMask();
|
||||
|
||||
Reference in New Issue
Block a user