Changeset 277 for trunk

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

Location:
trunk/src/game
Files:
4 modified

Legend:

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

    r211 r277  
    9898                case COMMAND_ATTACK:                        //spellid=1792  //ATTACK 
    9999                { 
     100                    // Can't attack if owner is pacified 
     101                    if (_player->HasAuraType(SPELL_AURA_MOD_PACIFY)) 
     102                    { 
     103                        //pet->SendPetCastFail(spellid, SPELL_FAILED_PACIFIED); 
     104                        //TODO: Send proper error message to client 
     105                        return; 
     106                    } 
    100107                    // only place where pet can be player 
    101108                    pet->clearUnitState(UNIT_STAT_FOLLOW); 
  • trunk/src/game/PossessedAI.cpp

    r200 r277  
    2525void PossessedAI::AttackStart(Unit *u) 
    2626{ 
    27     if( !u ) 
     27    if( !u || i_pet.GetCharmer()->HasAuraType(SPELL_AURA_MOD_PACIFY)) 
    2828        return; 
    2929 
     
    9696            return; 
    9797        } 
    98         else if(i_pet.IsWithinCombatDist(i_pet.getVictim(), ATTACK_DISTANCE) && i_pet.isAttackReady()) 
     98        else if(i_pet.IsWithinCombatDist(i_pet.getVictim(), ATTACK_DISTANCE) && i_pet.isAttackReady() && !i_pet.GetCharmer()->HasAuraType(SPELL_AURA_MOD_PACIFY)) 
    9999        { 
    100100            i_pet.AttackerStateUpdate(i_pet.getVictim()); 
  • 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 
  • trunk/src/game/Unit.h

    r272 r277  
    641641typedef std::list<Player*> SharedVisionList; 
    642642 
    643 struct CharmInfo 
     643struct TRINITY_DLL_SPEC CharmInfo 
    644644{ 
    645645    public: 
     
    658658        void InitCharmCreateSpells(); 
    659659        void InitPetActionBar(); 
    660         void InitEmptyActionBar(); 
     660        void InitEmptyActionBar(bool withAttack = true); 
    661661                                                            //return true if successful 
    662662        bool AddSpellToAB(uint32 oldid, uint32 newid, ActiveStates newstate = ACT_DECIDE); 
     
    672672        ReactStates     m_reactState; 
    673673        uint32          m_petnumber; 
     674        bool            m_barInit; 
    674675}; 
    675676