Show
Ignore:
Timestamp:
11/22/08 00:35:58 (17 years ago)
Author:
yumileroy
Message:

* Don't allow pets to attack in melee if owner is pacified. This applies for possessed "pets" as well.
* Use proper spell ID in unsummoning possessed units on channeling interrupt.
* Allow only once to init pet bar for CharmInfo?
* Export CharmInfo? to be available to scripts
* Allow to disable the melee attack command when initializing the pet action bar

Original author: gvcoman
Date: 2008-11-20 20:27:04-05:00

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/game/Unit.cpp

    r276 r277  
    34223422    if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id)) 
    34233423    { 
     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 
    34243439        if (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED) 
    34253440            m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel(); 
    34263441        m_currentSpells[CURRENT_CHANNELED_SPELL]->SetReferencedFromCurrent(false); 
    34273442        m_currentSpells[CURRENT_CHANNELED_SPELL] = NULL; 
    3428  
    3429         // Unsummon any summoned as possessed creatures on channel interrupt 
    3430         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 function 
    3441                 if (GetCharm()) 
    3442                     ((TemporarySummon*)GetCharm())->UnSummon();  
    3443             } 
    3444         } 
    34453443    } 
    34463444} 
     
    98219819 
    98229820CharmInfo::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) 
    98249822{ 
    98259823    for(int i =0; i<4; ++i) 
     
    98329830void CharmInfo::InitPetActionBar() 
    98339831{ 
     9832    if (m_barInit) 
     9833        return; 
     9834 
    98349835    // the first 3 SpellOrActions are attack, follow and stay 
    98359836    for(uint32 i = 0; i < 3; i++) 
     
    98469847        PetActionBar[i + 3].SpellOrAction = 0; 
    98479848    } 
    9848 } 
    9849  
    9850 void CharmInfo::InitEmptyActionBar() 
    9851 { 
    9852     for(uint32 x = 1; x < 10; ++x) 
     9849    m_barInit = true; 
     9850} 
     9851 
     9852void CharmInfo::InitEmptyActionBar(bool withAttack) 
     9853{ 
     9854    if (m_barInit) 
     9855        return; 
     9856 
     9857    for(uint32 x = 0; x < 10; ++x) 
    98539858    { 
    98549859        PetActionBar[x].Type = ACT_CAST; 
    98559860        PetActionBar[x].SpellOrAction = 0; 
    98569861    } 
    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; 
    98599868} 
    98609869