Merge commit 'origin/master' into 310

Conflicts:
	src/game/Player.cpp
This commit is contained in:
tomrus88 2009-05-06 09:40:35 +04:00
commit 6821c24268
27 changed files with 414 additions and 105 deletions

View file

@ -43,6 +43,7 @@
#include "Util.h"
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "Vehicle.h"
#include "CellImpl.h"
#define NULL_AURA_SLOT 0xFF
@ -3532,6 +3533,7 @@ void Aura::HandleAuraModStun(bool apply, bool Real)
void Aura::HandleModStealth(bool apply, bool Real)
{
Unit* pTarget = m_target;
SpellEntry const* pSpellInfo = GetSpellProto();
if (apply)
{
@ -3567,7 +3569,7 @@ void Aura::HandleModStealth(bool apply, bool Real)
pTarget->CastCustomSpell(pTarget,31665,&bp,NULL,NULL,true);
}
// Overkill
else if ((*i)->GetId() == 58426 && GetSpellProto()->SpellFamilyFlags & 0x0000000000400000LL)
else if ((*i)->GetId() == 58426 && pSpellInfo->SpellFamilyFlags & 0x0000000000400000LL)
{
pTarget->RemoveAurasDueToSpell(58428);
pTarget->CastSpell(pTarget, 58427, true);
@ -3607,7 +3609,7 @@ void Aura::HandleModStealth(bool apply, bool Real)
if ((*i)->GetSpellProto()->SpellIconID == 2114)
pTarget->CastSpell(pTarget,31666,true);
// Overkill
else if ((*i)->GetId() == 58426 && GetSpellProto()->SpellFamilyFlags & 0x0000000000400000LL)
else if ((*i)->GetId() == 58426 && pSpellInfo->SpellFamilyFlags & 0x0000000000400000LL)
pTarget->CastSpell(pTarget, 58428, true);
}
}
@ -3992,21 +3994,26 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/)
if(GetId()==42292 || GetId()==59752)
mechanic=IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
// cache values in local vars for prevent access to possible deleted aura data
SpellEntry const* spellInfo = GetSpellProto();
uint32 misc = m_modifier.m_miscvalue;
Unit* target = m_target;
if(apply && spellInfo->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
{
Unit::AuraMap& Auras = m_target->GetAuras();
Unit::AuraMap& Auras = 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 (!( spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) && // spells unaffected by invulnerability
spell->Id != GetId())
spell->Id != spellInfo->Id)
{
//check for mechanic mask
if(GetSpellMechanicMask(spell, iter->second->GetEffIndex()) & mechanic)
{
m_target->RemoveAurasDueToSpell(spell->Id);
target->RemoveAurasDueToSpell(spell->Id);
if(Auras.empty())
break;
else
@ -4016,19 +4023,19 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/)
}
}
m_target->ApplySpellImmune(GetId(),IMMUNITY_MECHANIC,m_modifier.m_miscvalue,apply);
target->ApplySpellImmune(spellInfo->Id,IMMUNITY_MECHANIC,misc,apply);
// Bestial Wrath
if ( GetSpellProto()->SpellFamilyName == SPELLFAMILY_HUNTER && GetSpellProto()->SpellIconID == 1680)
if (spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && spellInfo->SpellIconID == 1680)
{
// The Beast Within cast on owner if talent present
if ( Unit* owner = m_target->GetOwner() )
if (Unit* owner = target->GetOwner())
{
// Search talent
Unit::AuraList const& m_dummyAuras = owner->GetAurasByType(SPELL_AURA_DUMMY);
for(Unit::AuraList::const_iterator i = m_dummyAuras.begin(); i != m_dummyAuras.end(); ++i)
Unit::AuraList const& dummyAuras = owner->GetAurasByType(SPELL_AURA_DUMMY);
for(Unit::AuraList::const_iterator i = dummyAuras.begin(); i != dummyAuras.end(); ++i)
{
if ( (*i)->GetSpellProto()->SpellIconID == 2229 )
if ((*i)->GetSpellProto()->SpellIconID == 2229)
{
if (apply)
owner->CastSpell(owner, 34471, true, 0, this);
@ -4041,21 +4048,21 @@ void Aura::HandleModMechanicImmunity(bool apply, bool /*Real*/)
}
// The Beast Within and Bestial Wrath - immunity
if(GetId() == 19574 || GetId() == 34471)
if (spellInfo->Id == 19574 || spellInfo->Id == 34471)
{
if(apply)
if (apply)
{
m_target->CastSpell(m_target,24395,true);
m_target->CastSpell(m_target,24396,true);
m_target->CastSpell(m_target,24397,true);
m_target->CastSpell(m_target,26592,true);
target->CastSpell(target,24395,true);
target->CastSpell(target,24396,true);
target->CastSpell(target,24397,true);
target->CastSpell(target,26592,true);
}
else
{
m_target->RemoveAurasDueToSpell(24395);
m_target->RemoveAurasDueToSpell(24396);
m_target->RemoveAurasDueToSpell(24397);
m_target->RemoveAurasDueToSpell(26592);
target->RemoveAurasDueToSpell(24395);
target->RemoveAurasDueToSpell(24396);
target->RemoveAurasDueToSpell(24397);
target->RemoveAurasDueToSpell(26592);
}
}
}
@ -6684,19 +6691,35 @@ void Aura::HandleArenaPreparation(bool apply, bool Real)
m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PREPARATION);
}
void Aura::HandleAuraControlVehicle(bool /*apply*/, bool Real)
/**
* Such auras are applied from a caster(=player) to a vehicle.
* This has been verified using spell #49256
*/
void Aura::HandleAuraControlVehicle(bool apply, bool Real)
{
if(!Real)
return;
if(m_target->GetTypeId() != TYPEID_PLAYER)
Unit *player = GetCaster();
Vehicle *vehicle = dynamic_cast<Vehicle*>(m_target);
if(!player || player->GetTypeId()!=TYPEID_PLAYER || !vehicle)
return;
if(Pet *pet = m_target->GetPet())
pet->Remove(PET_SAVE_AS_CURRENT);
if (apply)
{
if(Pet *pet = player->GetPet())
pet->Remove(PET_SAVE_AS_CURRENT);
((Player*)player)->EnterVehicle(vehicle);
}
else
{
SpellEntry const *spell = GetSpellProto();
WorldPacket data(SMSG_ON_CANCEL_EXPECTED_RIDE_VEHICLE_AURA, 0);
((Player*)m_target)->GetSession()->SendPacket(&data);
// some SPELL_AURA_CONTROL_VEHICLE auras have a dummy effect on the player - remove them
player->RemoveAurasDueToSpell(spell->Id);
((Player*)player)->ExitVehicle(vehicle);
}
}
void Aura::HandleAuraConvertRune(bool apply, bool Real)