*Save aurastates for all auras from spell, not only for first one.

*Bring back old code for frozen aura state(by megamage).
*Remove visible aura slot on aura destruction instead on sending aura update.

--HG--
branch : trunk
This commit is contained in:
QAston
2009-02-23 16:36:11 +01:00
parent 255736028f
commit f963629e55
2 changed files with 81 additions and 48 deletions
+50 -16
View File
@@ -464,6 +464,18 @@ Aura::~Aura()
{ {
AuraSlotEntry * entry = m_target->GetVisibleAura(GetAuraSlot()); AuraSlotEntry * entry = m_target->GetVisibleAura(GetAuraSlot());
entry->m_slotAuras[GetEffIndex()]=NULL; entry->m_slotAuras[GetEffIndex()]=NULL;
//Check if there any aura in slot still exists
bool remove=true;
for (uint8 i=0 ; i<3; i++)
{
if (entry->m_slotAuras[i])
{
remove=false;
break;
}
}
if (remove)
m_target->RemoveVisibleAura(GetAuraSlot());
} }
} }
@@ -783,8 +795,6 @@ void Aura::ApplyModifier(bool apply, bool Real)
m_in_use = false; m_in_use = false;
} }
static AuraType const frozenAuraTypes[] = { SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_NONE };
void Aura::_AddAura() void Aura::_AddAura()
{ {
if (!GetId()) if (!GetId())
@@ -867,9 +877,10 @@ void Aura::_AddAura()
m_target->UpdateAuraForGroup(slot); m_target->UpdateAuraForGroup(slot);
//***************************************************** //*****************************************************
// Update target aura state flag (at 1 aura apply) // Update target aura state flag
// TODO: Make it easer // TODO: Make it easer
//***************************************************** //*****************************************************
if (!secondaura) if (!secondaura)
{ {
// Sitdown on apply aura req seated // Sitdown on apply aura req seated
@@ -879,6 +890,7 @@ void Aura::_AddAura()
// register aura diminishing on apply // register aura diminishing on apply
if (getDiminishGroup() != DIMINISHING_NONE ) if (getDiminishGroup() != DIMINISHING_NONE )
m_target->ApplyDiminishingAura(getDiminishGroup(),true); m_target->ApplyDiminishingAura(getDiminishGroup(),true);
}
// Update Seals information // Update Seals information
if (IsSealSpell(m_spellProto)) if (IsSealSpell(m_spellProto))
@@ -908,21 +920,8 @@ void Aura::_AddAura()
if(m_spellProto->Dispel == DISPEL_ENRAGE) if(m_spellProto->Dispel == DISPEL_ENRAGE)
SetAuraState(AURA_STATE_ENRAGE); SetAuraState(AURA_STATE_ENRAGE);
if(GetSpellSchoolMask(m_spellProto) & SPELL_SCHOOL_MASK_FROST)
{
for(AuraType const* itr = &frozenAuraTypes[0]; *itr != SPELL_AURA_NONE; ++itr)
{
if(m_spellProto->EffectApplyAuraName[GetEffIndex()]== *itr)
{
SetAuraState(AURA_STATE_FROZEN);
break;
}
}
}
m_target->ApplyModFlag(UNIT_FIELD_AURASTATE, GetAuraStateMask(), true); m_target->ApplyModFlag(UNIT_FIELD_AURASTATE, GetAuraStateMask(), true);
} }
}
void Aura::_RemoveAura() void Aura::_RemoveAura()
{ {
@@ -6417,6 +6416,8 @@ void Aura::HandleAuraModStun(bool apply, bool Real)
return; return;
m_target->SetControlled(apply, UNIT_STAT_STUNNED); m_target->SetControlled(apply, UNIT_STAT_STUNNED);
if(GetSpellSchoolMask(m_spellProto) & SPELL_SCHOOL_MASK_FROST)
HandleAuraStateFrozen(apply);
} }
void Aura::HandleAuraModRoot(bool apply, bool Real) void Aura::HandleAuraModRoot(bool apply, bool Real)
@@ -6425,6 +6426,39 @@ void Aura::HandleAuraModRoot(bool apply, bool Real)
return; return;
m_target->SetControlled(apply, UNIT_STAT_ROOT); m_target->SetControlled(apply, UNIT_STAT_ROOT);
if(GetSpellSchoolMask(m_spellProto) & SPELL_SCHOOL_MASK_FROST)
HandleAuraStateFrozen(apply);
}
static AuraType const frozenAuraTypes[] = { SPELL_AURA_MOD_ROOT, SPELL_AURA_MOD_STUN, SPELL_AURA_NONE };
void Aura::HandleAuraStateFrozen(bool apply)
{
if(apply)
{
m_target->ModifyAuraState(AURA_STATE_FROZEN, true);
}
else
{
bool found_another = false;
for(AuraType const* itr = &frozenAuraTypes[0]; *itr != SPELL_AURA_NONE; itr)
{
Unit::AuraList const& auras = m_target->GetAurasByType(*itr);
for(Unit::AuraList::const_iterator i = auras.begin(); i != auras.end(); i)
{
if( GetSpellSchoolMask((*i)->GetSpellProto()) & SPELL_SCHOOL_MASK_FROST)
{
found_another = true;
break;
}
}
if(found_another)
break;
}
if(!found_another)
m_target->ModifyAuraState(AURA_STATE_FROZEN, false);
}
} }
// Charm Auras // Charm Auras
+2 -3
View File
@@ -7688,13 +7688,13 @@ Unit* Unit::GetNextRandomRaidMemberOrPet(float radius)
Player* Target = itr->getSource(); Player* Target = itr->getSource();
// IsHostileTo check duel and controlled by enemy // IsHostileTo check duel and controlled by enemy
if( Target && Target !=this && IsWithinDistInMap(Target, radius) && if( Target && Target !=this && Target->isAlive() && IsWithinDistInMap(Target, radius) &&
!IsHostileTo(Target) ) !IsHostileTo(Target) )
nearMembers.push_back(Target); nearMembers.push_back(Target);
// Push player's pet to vector // Push player's pet to vector
Unit * pet = Target->GetPet(); Unit * pet = Target->GetPet();
if (pet && pet !=this && IsWithinDistInMap(pet, radius) && if (pet && pet !=this && pet->isAlive() && IsWithinDistInMap(pet, radius) &&
!IsHostileTo(pet) ) !IsHostileTo(pet) )
nearMembers.push_back(pet); nearMembers.push_back(pet);
} }
@@ -12808,7 +12808,6 @@ void Unit::SendAuraUpdate(uint8 slot)
if(!ptr) if(!ptr)
{ {
RemoveVisibleAura(slot);
SendMessageToSet(&data, true); SendMessageToSet(&data, true);
return; return;
} }