All pastes #985867 Raw Edit

Nevan

public diff v1 · immutable
·published 2008-04-15 11:19 UTC
rendered paste body
Index: SpellAuras.cpp===================================================================--- SpellAuras.cpp	(revision 5633)+++ SpellAuras.cpp	(working copy)@@ -3101,6 +3101,13 @@     {         if(IsPositiveSpell(GetId()))                        //Only positive immunity removes auras         {+			if(m_target->GetTypeId()==TYPEID_PLAYER && ((Player*)m_target)->InBattleGround() && IsImmuneToAllSpell(GetId()))+			{+				if(BattleGround *bg = ((Player*)m_target)->GetBattleGround()) +					bg->HandleDropFlag((Player*)m_target);++            }+             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)Index: SpellHandler.cpp===================================================================--- SpellHandler.cpp	(revision 5633)+++ SpellHandler.cpp	(working copy)@@ -509,6 +509,7 @@                     switch(info->id)                     {                         case 179830:+						{                             // check if it's correct bg                             if(bg->GetTypeID() != BATTLEGROUND_WS)                                 return;@@ -521,9 +522,15 @@                             // check player team                             if(_player->GetTeam() == ALLIANCE)                                 return;+							// immune to all+							if (_player->IsImmunedToAllDamage())+								return;+                             spellId = 23335;                // Silverwing Flag                             break;+						}                         case 179831:+						{                             // check if it's correct bg                             if(bg->GetTypeID() != BATTLEGROUND_WS)                                 return;@@ -536,14 +543,21 @@                             // check player team                             if(_player->GetTeam() == HORDE)                                 return;+							// immune to all+							if (_player->IsImmunedToAllDamage())+								return;+                             spellId = 23333;                // Warsong Flag                             break;+						}                         case 184141:+						{                             // check if it's correct bg                             if(bg->GetTypeID() != BATTLEGROUND_EY)                                 return;                             spellId = 34976;                // Netherstorm Flag                             break;+						}                     }                 }             }@@ -576,15 +590,20 @@                             // check if flag dropped                             if(((BattleGroundWS*)bg)->GetFlagState(ALLIANCE) != BG_WS_FLAG_STATE_ON_GROUND)                                 return;-                            obj->Delete();                             if(_player->GetTeam() == ALLIANCE)                             {                                 ((BattleGroundWS*)bg)->EventPlayerReturnedFlag(_player);+								obj->Delete();                                 return;                             }                             else                             {+								// immune to all+								if (_player->IsImmunedToAllDamage())+									return;+                                 _player->CastSpell(_player, 23335, true);+								obj->Delete();                                 return;                             }                             break;@@ -595,15 +614,20 @@                             // check if flag dropped                             if(((BattleGroundWS*)bg)->GetFlagState(HORDE) != BG_WS_FLAG_STATE_ON_GROUND)                                 return;-                            obj->Delete();                             if(_player->GetTeam() == HORDE)                             {                                 ((BattleGroundWS*)bg)->EventPlayerReturnedFlag(_player);+								obj->Delete();                                 return;                             }                             else                             {+								// immune to all+								if (_player->IsImmunedToAllDamage())+									return;+                                 _player->CastSpell(_player, 23333, true);+								obj->Delete();                                 return;                             }                             break;Index: SpellMgr.cpp===================================================================--- SpellMgr.cpp	(revision 5633)+++ SpellMgr.cpp	(working copy)@@ -464,6 +464,36 @@     return true; } +bool IsImmuneToAllSpell(uint32 spellId)+{+    SpellEntry const *spellproto = sSpellStore.LookupEntry(spellId);+    if (!spellproto) return false;++	bool immune_physical = false, immune_magic = false;+    for (int i = 0; i < 3; i++)+	{+		if (spellproto->Effect[i] == SPELL_EFFECT_APPLY_AURA && spellproto->EffectApplyAuraName[i] == SPELL_AURA_SCHOOL_IMMUNITY)+		{+			if (spellproto->EffectMiscValue[i] == IMMUNE_SCHOOL_PHYSICAL)+				immune_physical = true;++			if (spellproto->EffectMiscValue[i] == IMMUNE_SCHOOL_MAGIC)+				immune_magic = true;++			if (spellproto->EffectMiscValue[i] == (IMMUNE_SCHOOL_PHYSICAL + IMMUNE_SCHOOL_MAGIC))+			{+				immune_physical = true;+				immune_magic = true;+			}+		}+	}++	if (immune_physical && immune_magic)+		return true;+	else+		return false;+}+ bool IsSingleTargetSpell(SpellEntry const *spellInfo) {     // cheap shot is an exceptionIndex: SpellMgr.h===================================================================--- SpellMgr.h	(revision 5633)+++ SpellMgr.h	(working copy)@@ -281,6 +281,7 @@ bool IsNonCombatSpell(uint32 spellId);  bool IsPositiveSpell(uint32 spellId);+bool IsImmuneToAllSpell(uint32 spellId); bool IsPositiveEffect(uint32 spellId, uint32 effIndex); bool IsPositiveTarget(uint32 targetA, uint32 targetB); Index: Unit.cpp===================================================================--- Unit.cpp	(revision 5633)+++ Unit.cpp	(working copy)@@ -7467,6 +7467,17 @@     return AdvertisedBenefit; } +bool Unit::IsImmunedToAllDamage() const+{+    // check for immune spells+	Unit::AuraList const& targetTriggers = this->GetAurasByType(SPELL_AURA_SCHOOL_IMMUNITY);+	for(Unit::AuraList::const_iterator i = targetTriggers.begin(); i != targetTriggers.end(); ++i)+		if (IsPositiveSpell((*i)->GetSpellProto()->Id) && IsImmuneToAllSpell((*i)->GetSpellProto()->Id))+			return true;++    return false;+}+ bool Unit::IsImmunedToPhysicalDamage() const {     //If m_immuneToDamage type contain magic, IMMUNE damage.Index: Unit.h===================================================================--- Unit.h	(revision 5633)+++ Unit.h	(working copy)@@ -1033,7 +1033,8 @@         void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply);         virtual bool IsImmunedToSpell(SpellEntry const* spellInfo, bool useCharges = false);                                                             // redefined in Creature-        bool IsImmunedToPhysicalDamage() const;+        bool IsImmunedToAllDamage() const;+		bool IsImmunedToPhysicalDamage() const;         bool IsImmunedToSpellDamage(SpellEntry const* spellInfo, bool useCharges = false);         virtual bool IsImmunedToSpellEffect(uint32 effect, uint32 mechanic) const;                                                             // redefined in Creature