mirror of
https://github.com/mangosfour/server.git
synced 2025-12-21 19:37:02 +00:00
Merge branch 'master' into 310
Conflicts: src/game/Player.cpp src/game/Player.h src/game/Unit.cpp
This commit is contained in:
commit
963aed5e0b
49 changed files with 1124 additions and 986 deletions
|
|
@ -2051,8 +2051,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
|
|||
m_target->CastSpell(m_target, 51581, true, NULL, this);
|
||||
return;
|
||||
case 43873: // Headless Horseman Laugh
|
||||
if(caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)caster)->PlaySound(11965, false);
|
||||
m_target->PlayDistanceSound(11965);
|
||||
return;
|
||||
case 46354: // Blood Elf Illusion
|
||||
if(caster)
|
||||
|
|
@ -2923,20 +2922,8 @@ void Aura::HandleForceReaction(bool apply, bool Real)
|
|||
uint32 faction_id = m_modifier.m_miscvalue;
|
||||
uint32 faction_rank = m_modifier.m_amount;
|
||||
|
||||
if(apply)
|
||||
player->m_forcedReactions[faction_id] = ReputationRank(faction_rank);
|
||||
else
|
||||
player->m_forcedReactions.erase(faction_id);
|
||||
|
||||
WorldPacket data;
|
||||
data.Initialize(SMSG_SET_FORCED_REACTIONS, 4+player->m_forcedReactions.size()*(4+4));
|
||||
data << uint32(player->m_forcedReactions.size());
|
||||
for(ForcedReactions::const_iterator itr = player->m_forcedReactions.begin(); itr != player->m_forcedReactions.end(); ++itr)
|
||||
{
|
||||
data << uint32(itr->first); // faction_id (Faction.dbc)
|
||||
data << uint32(itr->second); // reputation rank
|
||||
}
|
||||
player->SendDirectMessage(&data);
|
||||
player->GetReputationMgr().ApplyForceReaction(faction_id,ReputationRank(faction_rank),apply);
|
||||
player->GetReputationMgr().SendForceReactions();
|
||||
}
|
||||
|
||||
void Aura::HandleAuraModSkill(bool apply, bool Real)
|
||||
|
|
@ -3066,8 +3053,15 @@ void Aura::HandleModPossess(bool apply, bool Real)
|
|||
{
|
||||
m_target->SetCharmerGUID(GetCasterGUID());
|
||||
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,caster->getFaction());
|
||||
|
||||
caster->SetCharm(m_target);
|
||||
|
||||
if(caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
((Player*)caster)->SetFarSightGUID(m_target->GetGUID());
|
||||
((Player*)caster)->SetClientControl(m_target, 1);
|
||||
}
|
||||
|
||||
m_target->CombatStop();
|
||||
m_target->DeleteThreatList();
|
||||
if(m_target->GetTypeId() == TYPEID_UNIT)
|
||||
|
|
@ -3096,15 +3090,19 @@ void Aura::HandleModPossess(bool apply, bool Real)
|
|||
m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,cinfo->faction_A);
|
||||
}
|
||||
|
||||
caster->SetCharm(0);
|
||||
caster->SetCharm(NULL);
|
||||
|
||||
if(caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
((Player*)caster)->SetFarSightGUID(0);
|
||||
((Player*)caster)->SetClientControl(m_target,0);
|
||||
|
||||
WorldPacket data(SMSG_PET_SPELLS, 8+4);
|
||||
data << uint64(0);
|
||||
data << uint32(0);
|
||||
((Player*)caster)->GetSession()->SendPacket(&data);
|
||||
}
|
||||
|
||||
if(m_target->GetTypeId() == TYPEID_UNIT)
|
||||
{
|
||||
((Creature*)m_target)->AIM_Initialize();
|
||||
|
|
@ -3113,8 +3111,6 @@ void Aura::HandleModPossess(bool apply, bool Real)
|
|||
((Creature*)m_target)->AI()->AttackStart(caster);
|
||||
}
|
||||
}
|
||||
if(caster->GetTypeId() == TYPEID_PLAYER)
|
||||
((Player*)caster)->SetFarSightGUID(apply ? m_target->GetGUID() : 0);
|
||||
}
|
||||
|
||||
void Aura::HandleModPossessPet(bool apply, bool Real)
|
||||
|
|
@ -3252,7 +3248,7 @@ void Aura::HandleModCharm(bool apply, bool Real)
|
|||
}
|
||||
}
|
||||
|
||||
caster->SetCharm(0);
|
||||
caster->SetCharm(NULL);
|
||||
|
||||
if(caster->GetTypeId() == TYPEID_PLAYER)
|
||||
{
|
||||
|
|
@ -3312,6 +3308,7 @@ void Aura::HandleFeignDeath(bool apply, bool Real)
|
|||
|
||||
m_target->addUnitState(UNIT_STAT_DIED);
|
||||
m_target->CombatStop();
|
||||
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
||||
|
||||
// prevent interrupt message
|
||||
if(m_caster_guid==m_target->GetGUID() && m_target->m_currentSpells[CURRENT_GENERIC_SPELL])
|
||||
|
|
@ -3494,9 +3491,7 @@ void Aura::HandleModStealth(bool apply, bool Real)
|
|||
if(apply)
|
||||
{
|
||||
// drop flag at stealth in bg
|
||||
if(Real && m_target->GetTypeId()==TYPEID_PLAYER && ((Player*)m_target)->InBattleGround())
|
||||
if(BattleGround *bg = ((Player*)m_target)->GetBattleGround())
|
||||
bg->EventPlayerDroppedFlag((Player*)m_target);
|
||||
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
||||
|
||||
// only at real aura add
|
||||
if(Real)
|
||||
|
|
@ -3561,15 +3556,13 @@ void Aura::HandleInvisibility(bool apply, bool Real)
|
|||
{
|
||||
m_target->m_invisibilityMask |= (1 << m_modifier.m_miscvalue);
|
||||
|
||||
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
||||
|
||||
if(Real && m_target->GetTypeId()==TYPEID_PLAYER)
|
||||
{
|
||||
// apply glow vision
|
||||
m_target->SetFlag(PLAYER_FIELD_BYTES2,PLAYER_FIELD_BYTE2_INVISIBILITY_GLOW);
|
||||
|
||||
// drop flag at invisible in bg
|
||||
if(((Player*)m_target)->InBattleGround())
|
||||
if(BattleGround *bg = ((Player*)m_target)->GetBattleGround())
|
||||
bg->EventPlayerDroppedFlag((Player*)m_target);
|
||||
}
|
||||
|
||||
// apply only if not in GM invisibility and not stealth
|
||||
|
|
@ -4016,44 +4009,15 @@ void Aura::HandleModMechanicImmunity(bool apply, bool Real)
|
|||
}
|
||||
}
|
||||
|
||||
//this method is called whenever we add / remove aura which gives m_target some imunity to some spell effect
|
||||
void Aura::HandleAuraModEffectImmunity(bool apply, bool Real)
|
||||
{
|
||||
if(!apply)
|
||||
// when removing flag aura, handle flag drop
|
||||
if( !apply && m_target->GetTypeId() == TYPEID_PLAYER
|
||||
&& (GetSpellProto()->AuraInterruptFlags & AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION) )
|
||||
{
|
||||
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:
|
||||
{
|
||||
// Warsong Flag, horde // Silverwing Flag, alliance
|
||||
if(GetId() == 23333 || GetId() == 23335)
|
||||
bg->EventPlayerDroppedFlag(((Player*)m_target));
|
||||
break;
|
||||
}
|
||||
case BATTLEGROUND_AB:
|
||||
{
|
||||
break;
|
||||
}
|
||||
case BATTLEGROUND_EY:
|
||||
{
|
||||
if(GetId() == 34976)
|
||||
bg->EventPlayerDroppedFlag(((Player*)m_target));
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if( BattleGround *bg = ((Player*)m_target)->GetBattleGround() )
|
||||
bg->EventPlayerDroppedFlag(((Player*)m_target));
|
||||
}
|
||||
|
||||
m_target->ApplySpellImmune(GetId(),IMMUNITY_EFFECT,m_modifier.m_miscvalue,apply);
|
||||
|
|
@ -4083,28 +4047,33 @@ void Aura::HandleAuraModSchoolImmunity(bool apply, bool Real)
|
|||
{
|
||||
m_target->ApplySpellImmune(GetId(),IMMUNITY_SCHOOL,m_modifier.m_miscvalue,apply);
|
||||
|
||||
if(Real && apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
|
||||
// remove all flag auras (they are positive, but they must be removed when you are immune)
|
||||
if( this->GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
|
||||
&& this->GetSpellProto()->AttributesEx2 & SPELL_ATTR_EX2_DAMAGE_REDUCED_SHIELD )
|
||||
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
||||
|
||||
// TODO: optimalize this cycle - use RemoveAurasWithInterruptFlags call or something else
|
||||
if( Real && apply
|
||||
&& GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY
|
||||
&& IsPositiveSpell(GetId()) ) //Only positive immunity removes auras
|
||||
{
|
||||
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)
|
||||
{
|
||||
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((GetSpellSchoolMask(spell) & school_mask)//Check for school mask
|
||||
&& !( spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) //Spells unaffected by invulnerability
|
||||
&& !iter->second->IsPositive() //Don't remove positive spells
|
||||
&& spell->Id != GetId() ) //Don't remove self
|
||||
{
|
||||
next = iter;
|
||||
++next;
|
||||
SpellEntry const *spell = iter->second->GetSpellProto();
|
||||
if((GetSpellSchoolMask(spell) & school_mask)//Check for school mask
|
||||
&& !( spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) //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();
|
||||
}
|
||||
m_target->RemoveAurasDueToSpell(spell->Id);
|
||||
if(Auras.empty())
|
||||
break;
|
||||
else
|
||||
next = Auras.begin();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -5565,8 +5534,10 @@ void Aura::HandleAuraRetainComboPoints(bool apply, bool Real)
|
|||
void Aura::HandleModUnattackable( bool Apply, bool Real )
|
||||
{
|
||||
if(Real && Apply)
|
||||
{
|
||||
m_target->CombatStop();
|
||||
|
||||
m_target->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_IMMUNE_OR_LOST_SELECTION);
|
||||
}
|
||||
m_target->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE,Apply);
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue