aboutsummaryrefslogtreecommitdiff
path: root/src/game/Unit.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/game/Unit.cpp')
-rw-r--r--src/game/Unit.cpp35
1 files changed, 22 insertions, 13 deletions
diff --git a/src/game/Unit.cpp b/src/game/Unit.cpp
index 264b81bd0cd..c54ab4b7f0d 100644
--- a/src/game/Unit.cpp
+++ b/src/game/Unit.cpp
@@ -3421,15 +3421,8 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id)
// 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]->getState() != SPELL_STATE_FINISHED)
- m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
- m_currentSpells[CURRENT_CHANNELED_SPELL]->SetReferencedFromCurrent(false);
- m_currentSpells[CURRENT_CHANNELED_SPELL] = NULL;
-
// Unsummon any summoned as possessed creatures on channel interrupt
- SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);
- if (!spellInfo || !interrupted)
- return;
+ SpellEntry const *spellInfo = m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo;
for (int i = 0; i < 3; i++)
{
if (spellInfo->Effect[i] == SPELL_EFFECT_SUMMON &&
@@ -3442,6 +3435,11 @@ void Unit::InterruptNonMeleeSpells(bool withDelayed, uint32 spell_id)
((TemporarySummon*)GetCharm())->UnSummon();
}
}
+
+ if (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED)
+ m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel();
+ m_currentSpells[CURRENT_CHANNELED_SPELL]->SetReferencedFromCurrent(false);
+ m_currentSpells[CURRENT_CHANNELED_SPELL] = NULL;
}
}
@@ -9820,7 +9818,7 @@ CharmInfo* Unit::InitCharmInfo(Unit *charm)
}
CharmInfo::CharmInfo(Unit* unit)
-: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0)
+: m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0), m_barInit(false)
{
for(int i =0; i<4; ++i)
{
@@ -9831,6 +9829,9 @@ CharmInfo::CharmInfo(Unit* unit)
void CharmInfo::InitPetActionBar()
{
+ if (m_barInit)
+ return;
+
// the first 3 SpellOrActions are attack, follow and stay
for(uint32 i = 0; i < 3; i++)
{
@@ -9845,17 +9846,25 @@ void CharmInfo::InitPetActionBar()
PetActionBar[i + 3].Type = ACT_DISABLED;
PetActionBar[i + 3].SpellOrAction = 0;
}
+ m_barInit = true;
}
-void CharmInfo::InitEmptyActionBar()
+void CharmInfo::InitEmptyActionBar(bool withAttack)
{
- for(uint32 x = 1; x < 10; ++x)
+ if (m_barInit)
+ return;
+
+ for(uint32 x = 0; x < 10; ++x)
{
PetActionBar[x].Type = ACT_CAST;
PetActionBar[x].SpellOrAction = 0;
}
- PetActionBar[0].Type = ACT_COMMAND;
- PetActionBar[0].SpellOrAction = COMMAND_ATTACK;
+ if (withAttack)
+ {
+ PetActionBar[0].Type = ACT_COMMAND;
+ PetActionBar[0].SpellOrAction = COMMAND_ATTACK;
+ }
+ m_barInit = true;
}
void CharmInfo::InitPossessCreateSpells()