mirror of
https://github.com/mangosfour/server.git
synced 2025-12-12 10:37:03 +00:00
[11645] Fixed work EffectSummonChangeItem, for example, for item. 17223
Also * Move item comvert code from spell effect to new function. * Some code style cleanups.
This commit is contained in:
parent
92e0b5941f
commit
a97370a7f0
6 changed files with 113 additions and 108 deletions
|
|
@ -3695,42 +3695,42 @@ bool Unit::IsNonMeleeSpellCasted(bool withDelayed, bool skipChanneled, bool skip
|
|||
// Maybe later some special spells will be excluded too.
|
||||
|
||||
// generic spells are casted when they are not finished and not delayed
|
||||
if ( m_currentSpells[CURRENT_GENERIC_SPELL] &&
|
||||
if (m_currentSpells[CURRENT_GENERIC_SPELL] &&
|
||||
(m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_FINISHED) &&
|
||||
(withDelayed || m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_DELAYED) )
|
||||
return(true);
|
||||
(withDelayed || m_currentSpells[CURRENT_GENERIC_SPELL]->getState() != SPELL_STATE_DELAYED))
|
||||
return true;
|
||||
|
||||
// channeled spells may be delayed, but they are still considered casted
|
||||
else if ( !skipChanneled && m_currentSpells[CURRENT_CHANNELED_SPELL] &&
|
||||
(m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED) )
|
||||
return(true);
|
||||
else if (!skipChanneled && m_currentSpells[CURRENT_CHANNELED_SPELL] &&
|
||||
(m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED))
|
||||
return true;
|
||||
|
||||
// autorepeat spells may be finished or delayed, but they are still considered casted
|
||||
else if ( !skipAutorepeat && m_currentSpells[CURRENT_AUTOREPEAT_SPELL] )
|
||||
return(true);
|
||||
else if (!skipAutorepeat && m_currentSpells[CURRENT_AUTOREPEAT_SPELL])
|
||||
return true;
|
||||
|
||||
return(false);
|
||||
return false;
|
||||
}
|
||||
|
||||
void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id)
|
||||
{
|
||||
// generic spells are interrupted if they are not finished or delayed
|
||||
if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id==spell_id))
|
||||
if (m_currentSpells[CURRENT_GENERIC_SPELL] && (!spell_id || m_currentSpells[CURRENT_GENERIC_SPELL]->m_spellInfo->Id == spell_id))
|
||||
InterruptSpell(CURRENT_GENERIC_SPELL,withDelayed);
|
||||
|
||||
// autorepeat spells are interrupted if they are not finished or delayed
|
||||
if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id==spell_id))
|
||||
if (m_currentSpells[CURRENT_AUTOREPEAT_SPELL] && (!spell_id || m_currentSpells[CURRENT_AUTOREPEAT_SPELL]->m_spellInfo->Id == spell_id))
|
||||
InterruptSpell(CURRENT_AUTOREPEAT_SPELL,withDelayed);
|
||||
|
||||
// channeled spells are interrupted if they are not finished, even if they are delayed
|
||||
if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id))
|
||||
if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id == spell_id))
|
||||
InterruptSpell(CURRENT_CHANNELED_SPELL,true);
|
||||
}
|
||||
|
||||
Spell* Unit::FindCurrentSpellBySpellId(uint32 spell_id) const
|
||||
{
|
||||
for (uint32 i = 0; i < CURRENT_MAX_SPELL; ++i)
|
||||
if(m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id==spell_id)
|
||||
if (m_currentSpells[i] && m_currentSpells[i]->m_spellInfo->Id == spell_id)
|
||||
return m_currentSpells[i];
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue