void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real) { m_target->ApplySpellImmune(GetId(),IMMUNITY_SCHOOL,m_modifier.m_miscvalue,apply); if(Real && apply) { if(IsPositiveSpell(GetId())) //Only positive immunity removes auras { uint32 school_mask = m_modifier.m_miscvalue; Unit::AuraMap& Auras = m_target->GetAuras(); for(Unit::AuraMap::iterator iter = Auras.begin(), next; iter != Auras.end(); iter = next) { next = iter; ++next; SpellEntry const *spell = iter->second->GetSpellProto(); if( ( (1 << spell->School) & school_mask) //Check for school mask && !( spell->Attributes & 0x20000000) //Spells unaffected by invulnerability && !iter->second->IsPositive() //Don't remove positive spells && spell->Id != GetId()) //Don't remove self { m_target->RemoveAurasDueToSpell(spell->Id); if(Auras.empty()) break; else next = Auras.begin(); } } } if(m_target->GetTypeId() == TYPEID_PLAYER) { if(((Player*)m_target)->InBattleGround()) { BattleGround *bg = ((Player*)m_target)->GetBattleGround(); if(bg) { switch(bg->GetTypeID()) { case BATTLEGROUND_AV: { break; } case BATTLEGROUND_WS: { if(((BattleGroundWS*)bg)->IsHordeFlagPickedup()) // Warsong Flag, horde if(GetSpellProto()->Id == 23333) // Horde Flag Drop ((BattleGroundWS*)bg)->EventPlayerDroppedFlag(((Player*)m_target)); if(((BattleGroundWS*)bg)->IsAllianceFlagPickedup()) // Silverwing Flag, alliance if(GetSpellProto()->Id == 23335) // Alliance Flag Drop ((BattleGroundWS*)bg)->EventPlayerDroppedFlag(((Player*)m_target)); break; } case BATTLEGROUND_AB: { break; } case BATTLEGROUND_EY: { break; } } } } } } }