*always remove old aura instead of recalculating new one in same id stack case-this prevents some problem with spelleffects execution problems

--HG--
branch : trunk
This commit is contained in:
QAston
2009-05-23 10:57:05 +02:00
parent 028ed64e10
commit 9af492483e
3 changed files with 16 additions and 19 deletions
+3 -3
View File
@@ -1145,7 +1145,7 @@ void Aura::_RemoveAura()
} }
uint32 id = GetId(); uint32 id = GetId();
// Remove Linked Auras // Remove Linked Auras
if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_REMOVE) if(m_removeMode!=AURA_REMOVE_BY_STACK && m_removeMode!=AURA_REMOVE_BY_DEATH && spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_REMOVE)
{ {
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)id)) if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(-(int32)id))
for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
@@ -1153,11 +1153,11 @@ void Aura::_RemoveAura()
if(*itr < 0) if(*itr < 0)
m_target->RemoveAurasDueToSpell(-(*itr)); m_target->RemoveAurasDueToSpell(-(*itr));
else if(Unit* caster = GetCaster()) else if(Unit* caster = GetCaster())
if (m_removeMode!=AURA_REMOVE_BY_DEFAULT && m_removeMode!=AURA_REMOVE_BY_DEATH) if (m_removeMode!=AURA_REMOVE_BY_DEFAULT)
m_target->CastSpell(m_target, *itr, true, 0, 0, caster->GetGUID()); m_target->CastSpell(m_target, *itr, true, 0, 0, caster->GetGUID());
} }
} }
if(spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_AURA) if(m_removeMode!=AURA_REMOVE_BY_STACK && m_removeMode!=AURA_REMOVE_BY_DEATH && spellmgr.GetSpellCustomAttr(id) & SPELL_ATTR_CU_LINK_AURA)
{ {
if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(id + SPELL_LINK_AURA)) if(const std::vector<int32> *spell_triggered = spellmgr.GetSpellLinked(id + SPELL_LINK_AURA))
for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr) for(std::vector<int32>::const_iterator itr = spell_triggered->begin(); itr != spell_triggered->end(); ++itr)
+5
View File
@@ -2641,6 +2641,11 @@ bool SpellMgr::IsNoStackSpellDueToSpell(uint32 spellId_1, uint32 spellId_2, bool
spellId_2 = GetLastSpellInChain(spellId_2); spellId_2 = GetLastSpellInChain(spellId_2);
spellId_1 = GetLastSpellInChain(spellId_1); spellId_1 = GetLastSpellInChain(spellId_1);
// Hack for Incanter's Absorption
if (spellId_1 == spellId_2 && spellId_1 == 44413)
return false;
if (spellId_1 == spellId_2) if (spellId_1 == spellId_2)
return true; return true;
+8 -16
View File
@@ -3809,22 +3809,18 @@ bool Unit::AddAura(Aura *Aur, bool handleEffects)
SpellEntry const* aurSpellInfo = Aur->GetSpellProto(); SpellEntry const* aurSpellInfo = Aur->GetSpellProto();
// passive and persistent auras can stack with themselves any number of times // passive and persistent and Incanter's Absorption auras can stack with themselves any number of times
if (!Aur->IsPassive() && !Aur->IsPersistent()) if (!Aur->IsPassive() && !Aur->IsPersistent() && aurSpellInfo->Id != 44413)
{ {
// find current aura from spell and change it's stackamount // find current aura from spell and change it's stackamount
if (Aura * foundAura = GetAura(aurSpellInfo->Id, Aur->GetCasterGUID())) if (Aura * foundAura = GetAura(aurSpellInfo->Id, Aur->GetCasterGUID()))
{ {
// hack for Incanter's Absorption uint8 stackAmount = foundAura->GetStackAmount() + 1;
if (aurSpellInfo->Id != 44413) if (stackAmount > aurSpellInfo->StackAmount)
{ stackAmount = aurSpellInfo->StackAmount;
if(aurSpellInfo->StackAmount && foundAura->GetStackAmount() < aurSpellInfo->StackAmount) Aur->SetStackAmount(stackAmount);
foundAura->SetStackAmount(foundAura->GetStackAmount()+1); RemoveAura(foundAura, AURA_REMOVE_BY_STACK);
else return true;
foundAura->RefreshAura();
delete Aur;
return false;
}
} }
} }
@@ -3915,10 +3911,6 @@ bool Unit::RemoveNoStackAurasDueToAura(Aura *Aur)
uint32 i_spellId = i_spellProto->Id; uint32 i_spellId = i_spellProto->Id;
bool sameCaster = Aur->GetCasterGUID() == (*i).second->GetCasterGUID(); bool sameCaster = Aur->GetCasterGUID() == (*i).second->GetCasterGUID();
// Incanter's Absorption, has been checked in refresh part
if(i_spellId == spellId && sameCaster)
continue;
if(IsPassiveSpell(i_spellId)) if(IsPassiveSpell(i_spellId))
{ {
// passive non-stackable spells not stackable only for same caster // passive non-stackable spells not stackable only for same caster