mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
[8381] Some refactoring work in Unit::m_currentSpells code. Author: VladimirMangos
* Restrict access, use enum args, move some repeated code parts to function.
* Make m_selfContainer set only part of Unit::SetCurrentCastedSpell
--HG--
branch : trunk
This commit is contained in:
@@ -17775,13 +17775,15 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, Creature* npc
|
||||
if( m_ShapeShiftFormSpellId && m_form != FORM_BATTLESTANCE && m_form != FORM_BERSERKERSTANCE && m_form != FORM_DEFENSIVESTANCE && m_form != FORM_SHADOW )
|
||||
RemoveAurasDueToSpell(m_ShapeShiftFormSpellId);
|
||||
|
||||
if(m_currentSpells[CURRENT_GENERIC_SPELL] && m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id != spellid)
|
||||
InterruptSpell(CURRENT_GENERIC_SPELL,false);
|
||||
if (Spell* spell = GetCurrentSpell(CURRENT_GENERIC_SPELL))
|
||||
if (spell->m_spellInfo->Id != spellid)
|
||||
InterruptSpell(CURRENT_GENERIC_SPELL,false);
|
||||
|
||||
InterruptSpell(CURRENT_AUTOREPEAT_SPELL,false);
|
||||
|
||||
if(m_currentSpells[CURRENT_CHANNELED_SPELL] && m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id != spellid)
|
||||
InterruptSpell(CURRENT_CHANNELED_SPELL,true);
|
||||
if (Spell* spell = GetCurrentSpell(CURRENT_CHANNELED_SPELL))
|
||||
if (spell->m_spellInfo->Id != spellid)
|
||||
InterruptSpell(CURRENT_CHANNELED_SPELL,true);
|
||||
}
|
||||
|
||||
uint32 sourcenode = nodes[0];
|
||||
@@ -19924,12 +19926,10 @@ void Player::RemoveItemDependentAurasAndCasts( Item * pItem )
|
||||
}
|
||||
|
||||
// currently casted spells can be dependent from item
|
||||
for (uint32 i = 0; i < CURRENT_MAX_SPELL; i++)
|
||||
{
|
||||
if( m_currentSpells[i] && m_currentSpells[i]->getState()!=SPELL_STATE_DELAYED &&
|
||||
!HasItemFitToSpellReqirements(m_currentSpells[i]->m_spellInfo,pItem) )
|
||||
InterruptSpell(i);
|
||||
}
|
||||
for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
|
||||
if (Spell* spell = GetCurrentSpell(CurrentSpellTypes(i)))
|
||||
if (spell->getState()!=SPELL_STATE_DELAYED && !HasItemFitToSpellReqirements(spell->m_spellInfo,pItem) )
|
||||
InterruptSpell(CurrentSpellTypes(i));
|
||||
}
|
||||
|
||||
uint32 Player::GetResurrectionSpellId()
|
||||
|
||||
Reference in New Issue
Block a user