Changeset 277 for trunk/src/game/Unit.cpp
- Timestamp:
- 11/22/08 00:35:58 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Unit.cpp
r276 r277 3422 3422 if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id)) 3423 3423 { 3424 // Unsummon any summoned as possessed creatures on channel interrupt 3425 SpellEntry const *spellInfo = m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo; 3426 for (int i = 0; i < 3; i++) 3427 { 3428 if (spellInfo->Effect[i] == SPELL_EFFECT_SUMMON && 3429 (spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED || 3430 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2 || 3431 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED3)) 3432 { 3433 // Possession is removed in the UnSummon function 3434 if (GetCharm()) 3435 ((TemporarySummon*)GetCharm())->UnSummon(); 3436 } 3437 } 3438 3424 3439 if (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED) 3425 3440 m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel(); 3426 3441 m_currentSpells[CURRENT_CHANNELED_SPELL]->SetReferencedFromCurrent(false); 3427 3442 m_currentSpells[CURRENT_CHANNELED_SPELL] = NULL; 3428 3429 // Unsummon any summoned as possessed creatures on channel interrupt3430 SpellEntry const *spellInfo = sSpellStore.LookupEntry(spell_id);3431 if (!spellInfo || !interrupted)3432 return;3433 for (int i = 0; i < 3; i++)3434 {3435 if (spellInfo->Effect[i] == SPELL_EFFECT_SUMMON &&3436 (spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED ||3437 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2 ||3438 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED3))3439 {3440 // Possession is removed in the UnSummon function3441 if (GetCharm())3442 ((TemporarySummon*)GetCharm())->UnSummon();3443 }3444 }3445 3443 } 3446 3444 } … … 9821 9819 9822 9820 CharmInfo::CharmInfo(Unit* unit) 9823 : m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0) 9821 : m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0), m_barInit(false) 9824 9822 { 9825 9823 for(int i =0; i<4; ++i) … … 9832 9830 void CharmInfo::InitPetActionBar() 9833 9831 { 9832 if (m_barInit) 9833 return; 9834 9834 9835 // the first 3 SpellOrActions are attack, follow and stay 9835 9836 for(uint32 i = 0; i < 3; i++) … … 9846 9847 PetActionBar[i + 3].SpellOrAction = 0; 9847 9848 } 9848 } 9849 9850 void CharmInfo::InitEmptyActionBar() 9851 { 9852 for(uint32 x = 1; x < 10; ++x) 9849 m_barInit = true; 9850 } 9851 9852 void CharmInfo::InitEmptyActionBar(bool withAttack) 9853 { 9854 if (m_barInit) 9855 return; 9856 9857 for(uint32 x = 0; x < 10; ++x) 9853 9858 { 9854 9859 PetActionBar[x].Type = ACT_CAST; 9855 9860 PetActionBar[x].SpellOrAction = 0; 9856 9861 } 9857 PetActionBar[0].Type = ACT_COMMAND; 9858 PetActionBar[0].SpellOrAction = COMMAND_ATTACK; 9862 if (withAttack) 9863 { 9864 PetActionBar[0].Type = ACT_COMMAND; 9865 PetActionBar[0].SpellOrAction = COMMAND_ATTACK; 9866 } 9867 m_barInit = true; 9859 9868 } 9860 9869