* Fix some freezes.
* Fix freeze in HandleModMechanicImmunity- thanks for megamage for pointing this. --HG-- branch : trunk
This commit is contained in:
+1
-2
@@ -7448,8 +7448,7 @@ bool ChatHandler::HandleUnFreezeCommand(const char *args)
|
|||||||
player->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
player->RemoveFlag (UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
|
||||||
|
|
||||||
//allow movement and spells
|
//allow movement and spells
|
||||||
uint32 spellID = 9454;
|
player->RemoveAurasDueToSpell(9454);
|
||||||
player->RemoveAurasDueToSpell(spellID);
|
|
||||||
|
|
||||||
//save player
|
//save player
|
||||||
player->SaveToDB();
|
player->SaveToDB();
|
||||||
|
|||||||
@@ -4063,7 +4063,7 @@ void AuraEffect::HandleModMechanicImmunity(bool apply, bool Real)
|
|||||||
if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
|
if(apply && GetSpellProto()->AttributesEx & SPELL_ATTR_EX_DISPEL_AURAS_ON_IMMUNITY)
|
||||||
{
|
{
|
||||||
Unit::AuraMap& Auras = m_target->GetAuras();
|
Unit::AuraMap& Auras = m_target->GetAuras();
|
||||||
for(Unit::AuraMap::iterator iter = Auras.begin(), next; iter != Auras.end();)
|
for(Unit::AuraMap::iterator iter = Auras.begin(); iter != Auras.end();)
|
||||||
{
|
{
|
||||||
SpellEntry const *spell = iter->second->GetSpellProto();
|
SpellEntry const *spell = iter->second->GetSpellProto();
|
||||||
if (!( spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) && // spells unaffected by invulnerability
|
if (!( spell->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY) && // spells unaffected by invulnerability
|
||||||
@@ -4077,6 +4077,7 @@ void AuraEffect::HandleModMechanicImmunity(bool apply, bool Real)
|
|||||||
else
|
else
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
++iter;
|
++iter;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ class TRINITY_DLL_SPEC Aura
|
|||||||
void SetNegative() { m_positive = false; }
|
void SetNegative() { m_positive = false; }
|
||||||
void SetPositive() { m_positive = true; }
|
void SetPositive() { m_positive = true; }
|
||||||
bool IsPermanent() const { return m_permanent; }
|
bool IsPermanent() const { return m_permanent; }
|
||||||
void RemoveAura() { m_permanent = false; m_duration=0; m_removeMode = AURA_REMOVE_BY_DEFAULT; }
|
void RemoveAura(AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT) { m_permanent = false; m_duration=0; m_removeMode = mode; }
|
||||||
|
|
||||||
bool IsPassive() const { return m_isPassive; }
|
bool IsPassive() const { return m_isPassive; }
|
||||||
bool IsDeathPersistent() const { return m_isDeathPersist; }
|
bool IsDeathPersistent() const { return m_isDeathPersist; }
|
||||||
|
|||||||
@@ -2059,8 +2059,7 @@ void Spell::EffectTriggerSpell(uint32 i)
|
|||||||
// ignore positive and passive auras
|
// ignore positive and passive auras
|
||||||
&& !iter->second->IsPositive() && !iter->second->IsPassive())
|
&& !iter->second->IsPositive() && !iter->second->IsPassive())
|
||||||
{
|
{
|
||||||
m_caster->RemoveAurasDueToSpell(spell->Id);
|
m_caster->RemoveAura(iter->second);
|
||||||
iter = Auras.begin();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
@@ -4533,23 +4532,21 @@ void Spell::EffectScriptEffect(uint32 effIndex)
|
|||||||
// Removes snares and roots.
|
// Removes snares and roots.
|
||||||
uint32 mechanic_mask = (1<<MECHANIC_ROOT) | (1<<MECHANIC_SNARE);
|
uint32 mechanic_mask = (1<<MECHANIC_ROOT) | (1<<MECHANIC_SNARE);
|
||||||
Unit::AuraMap& Auras = unitTarget->GetAuras();
|
Unit::AuraMap& Auras = unitTarget->GetAuras();
|
||||||
for(Unit::AuraMap::iterator iter = Auras.begin(), next; iter != Auras.end(); iter = next)
|
for(Unit::AuraMap::iterator iter = Auras.begin(), next; iter != Auras.end();)
|
||||||
{
|
{
|
||||||
next = iter;
|
|
||||||
++next;
|
|
||||||
Aura *aur = iter->second;
|
Aura *aur = iter->second;
|
||||||
if (!aur->IsPositive()) //only remove negative spells
|
if (!aur->IsPositive()) //only remove negative spells
|
||||||
{
|
{
|
||||||
// check for mechanic mask
|
// check for mechanic mask
|
||||||
if(GetAllSpellMechanicMask(aur->GetSpellProto()) & mechanic_mask)
|
if(GetAllSpellMechanicMask(aur->GetSpellProto()) & mechanic_mask)
|
||||||
{
|
{
|
||||||
unitTarget->RemoveAurasDueToSpell(aur->GetId());
|
unitTarget->RemoveAura(iter);
|
||||||
if(Auras.empty())
|
}
|
||||||
break;
|
|
||||||
else
|
else
|
||||||
next = Auras.begin();
|
iter++;
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
iter++;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|||||||
+49
-40
@@ -466,25 +466,13 @@ void Unit::RemoveAurasWithInterruptFlags(uint32 flag, uint32 except)
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// interrupt auras
|
// interrupt auras
|
||||||
AuraList::iterator iter, next;
|
for (AuraList::iterator iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end();)
|
||||||
for (iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end(); iter = next)
|
|
||||||
{
|
{
|
||||||
next = iter;
|
Aura * aur = *iter;
|
||||||
++next;
|
++iter;
|
||||||
|
if ((aur->GetSpellProto()->AuraInterruptFlags & flag) && (!except || aur->GetId() != except))
|
||||||
//sLog.outDetail("auraflag:%u flag:%u = %u",(*iter)->GetSpellProto()->AuraInterruptFlags,flag,(*iter)->GetSpellProto()->AuraInterruptFlags & flag);
|
|
||||||
if(*iter && ((*iter)->GetSpellProto()->AuraInterruptFlags & flag))
|
|
||||||
{
|
{
|
||||||
if((*iter)->IsInUse())
|
RemoveAura(aur);
|
||||||
sLog.outError("Aura %u is trying to remove itself! Flag %u. May cause crash!", (*iter)->GetId(), flag);
|
|
||||||
else if(!except || (*iter)->GetId() != except)
|
|
||||||
{
|
|
||||||
RemoveAurasDueToSpell((*iter)->GetId(), NULL, AURA_REMOVE_BY_CANCEL);
|
|
||||||
if (!m_interruptableAuras.empty())
|
|
||||||
next = m_interruptableAuras.begin();
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -518,19 +506,14 @@ void Unit::RemoveSpellbyDamageTaken(uint32 damage, uint32 spell)
|
|||||||
uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50;
|
uint32 max_dmg = getLevel() > 8 ? 25 * getLevel() - 150 : 50;
|
||||||
float chance = float(damage) / max_dmg * 100.0f;
|
float chance = float(damage) / max_dmg * 100.0f;
|
||||||
|
|
||||||
AuraList::iterator i, next;
|
// interrupt auras
|
||||||
for(i = m_ccAuras.begin(); i != m_ccAuras.end(); i = next)
|
for (AuraList::iterator iter = m_ccAuras.begin(); iter != m_ccAuras.end();)
|
||||||
{
|
{
|
||||||
next = i;
|
Aura * aur = *iter;
|
||||||
++next;
|
++iter;
|
||||||
|
if ((!spell || aur->GetId() != spell) && roll_chance_f(chance))
|
||||||
if(*i && (!spell || (*i)->GetId() != spell) && roll_chance_f(chance))
|
|
||||||
{
|
{
|
||||||
RemoveAurasDueToSpell((*i)->GetId());
|
RemoveAura(aur);
|
||||||
if (!m_ccAuras.empty())
|
|
||||||
next = m_ccAuras.begin();
|
|
||||||
else
|
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2095,13 +2078,13 @@ void Unit::CalcAbsorbResist(Unit *pVictim,SpellSchoolMask schoolMask, DamageEffe
|
|||||||
{
|
{
|
||||||
for(AuraEffectList::const_iterator i = vSchoolAbsorb.begin(); i != vSchoolAbsorb.end();)
|
for(AuraEffectList::const_iterator i = vSchoolAbsorb.begin(); i != vSchoolAbsorb.end();)
|
||||||
{
|
{
|
||||||
if ((*i)->GetAmount()<=0)
|
Aura *aura=(*i)->GetParentAura();
|
||||||
{
|
AuraEffect *auraeff =(*i);
|
||||||
pVictim->RemoveAurasDueToSpell((*i)->GetId(), (*i)->GetCasterGUID(), AURA_REMOVE_BY_ENEMY_SPELL);
|
|
||||||
i = vSchoolAbsorb.begin();
|
|
||||||
}
|
|
||||||
else
|
|
||||||
++i;
|
++i;
|
||||||
|
if (auraeff->GetAmount()<=0)
|
||||||
|
{
|
||||||
|
pVictim->RemoveAura(aura);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Cast back reflect damage spell
|
// Cast back reflect damage spell
|
||||||
@@ -3889,6 +3872,26 @@ void Unit::RemoveAura(uint32 spellId, uint64 caster ,AuraRemoveMode removeMode)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Unit::RemoveAura(Aura * aur ,AuraRemoveMode mode)
|
||||||
|
{
|
||||||
|
if (aur->IsInUse())
|
||||||
|
{
|
||||||
|
if (!aur->GetRemoveMode())
|
||||||
|
aur->RemoveAura(mode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(AuraMap::iterator iter = m_Auras.lower_bound(aur->GetId()); iter != m_Auras.upper_bound(aur->GetId());)
|
||||||
|
{
|
||||||
|
if (aur == iter->second)
|
||||||
|
{
|
||||||
|
RemoveAura(iter, mode);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
++iter;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 caster ,AuraRemoveMode removeMode)
|
void Unit::RemoveAurasDueToSpell(uint32 spellId, uint64 caster ,AuraRemoveMode removeMode)
|
||||||
{
|
{
|
||||||
for(AuraMap::iterator iter = m_Auras.lower_bound(spellId); iter != m_Auras.upper_bound(spellId);)
|
for(AuraMap::iterator iter = m_Auras.lower_bound(spellId); iter != m_Auras.upper_bound(spellId);)
|
||||||
@@ -4002,11 +4005,11 @@ void Unit::RemoveAurasByType(AuraType auraType, uint64 casterGUID, Aura * except
|
|||||||
if (auraType >= TOTAL_AURAS) return;
|
if (auraType >= TOTAL_AURAS) return;
|
||||||
for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
|
for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
|
||||||
{
|
{
|
||||||
Aura const * aur = (*iter)->GetParentAura();
|
Aura * aur = (*iter)->GetParentAura();
|
||||||
++iter;
|
++iter;
|
||||||
if (aur != except && (!casterGUID || aur->GetCasterGUID()==casterGUID))
|
if (aur != except && (!casterGUID || aur->GetCasterGUID()==casterGUID))
|
||||||
{
|
{
|
||||||
RemoveAura(aur->GetId(), aur->GetCasterGUID(), AURA_REMOVE_BY_ENEMY_SPELL);
|
RemoveAura(aur);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4016,11 +4019,11 @@ void Unit::RemoveAurasByTypeWithDispel(AuraType auraType, Spell * spell)
|
|||||||
if (auraType >= TOTAL_AURAS) return;
|
if (auraType >= TOTAL_AURAS) return;
|
||||||
for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
|
for (AuraEffectList::iterator iter = m_modAuras[auraType].begin(); iter != m_modAuras[auraType].end();)
|
||||||
{
|
{
|
||||||
Aura const* aur = (*iter)->GetParentAura();
|
Aura * aur = (*iter)->GetParentAura();
|
||||||
++iter;
|
++iter;
|
||||||
if (GetDispelChance(spell, aur->GetCaster(), aur->GetId()))
|
if (GetDispelChance(spell, aur->GetCaster(), aur->GetId()))
|
||||||
{
|
{
|
||||||
RemoveAura(aur->GetId(), aur->GetCasterGUID(), AURA_REMOVE_BY_ENEMY_SPELL);
|
RemoveAura(aur, AURA_REMOVE_BY_ENEMY_SPELL);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4057,7 +4060,8 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
|||||||
//aura can be during update when removing, set it to remove at next update
|
//aura can be during update when removing, set it to remove at next update
|
||||||
if (Aur->IsInUse())
|
if (Aur->IsInUse())
|
||||||
{
|
{
|
||||||
Aur->RemoveAura();
|
if (!Aur->GetRemoveMode())
|
||||||
|
Aur->RemoveAura(mode);
|
||||||
i++;
|
i++;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -4111,7 +4115,6 @@ void Unit::RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode)
|
|||||||
{
|
{
|
||||||
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
|
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
|
||||||
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]=NULL;
|
caster->m_currentSpells[CURRENT_CHANNELED_SPELL]=NULL;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -11621,6 +11624,11 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
|
|||||||
}
|
}
|
||||||
if (!inuse)
|
if (!inuse)
|
||||||
parentAura->SetInUse(false);
|
parentAura->SetInUse(false);
|
||||||
|
|
||||||
|
if ( !parentAura->GetAuraDuration() && !(parentAura->IsPermanent() || (parentAura->IsPassive())) )
|
||||||
|
RemoveAura(parentAura);
|
||||||
|
else
|
||||||
|
{
|
||||||
// Remove charge (aura can be removed by triggers)
|
// Remove charge (aura can be removed by triggers)
|
||||||
if(useCharges && takeCharges)
|
if(useCharges && takeCharges)
|
||||||
{
|
{
|
||||||
@@ -11629,6 +11637,7 @@ void Unit::ProcDamageAndSpellFor( bool isVictim, Unit * pTarget, uint32 procFlag
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
SpellSchoolMask Unit::GetMeleeDamageSchoolMask() const
|
SpellSchoolMask Unit::GetMeleeDamageSchoolMask() const
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1234,6 +1234,7 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
|||||||
|
|
||||||
void RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
|
void RemoveAura(AuraMap::iterator &i, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
|
||||||
void RemoveAura(uint32 spellId, uint64 caster = 0 ,AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
void RemoveAura(uint32 spellId, uint64 caster = 0 ,AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||||
|
void RemoveAura(Aura * aur, AuraRemoveMode mode = AURA_REMOVE_BY_DEFAULT);
|
||||||
void RemoveAurasDueToSpell(uint32 spellId, uint64 caster = NULL ,AuraRemoveMode removeMode= AURA_REMOVE_BY_DEFAULT);
|
void RemoveAurasDueToSpell(uint32 spellId, uint64 caster = NULL ,AuraRemoveMode removeMode= AURA_REMOVE_BY_DEFAULT);
|
||||||
void RemoveAuraFromStack(uint32 spellId, uint64 caster = NULL ,AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
void RemoveAuraFromStack(uint32 spellId, uint64 caster = NULL ,AuraRemoveMode removeMode = AURA_REMOVE_BY_DEFAULT);
|
||||||
inline void RemoveAuraFromStack(AuraMap::iterator &iter,AuraRemoveMode removeMode);
|
inline void RemoveAuraFromStack(AuraMap::iterator &iter,AuraRemoveMode removeMode);
|
||||||
|
|||||||
Reference in New Issue
Block a user