Changeset 277
- Timestamp:
- 11/22/08 00:35:58 (17 years ago)
- Location:
- trunk/src/game
- Files:
-
- 4 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/PetHandler.cpp
r211 r277 98 98 case COMMAND_ATTACK: //spellid=1792 //ATTACK 99 99 { 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 } 100 107 // only place where pet can be player 101 108 pet->clearUnitState(UNIT_STAT_FOLLOW); -
trunk/src/game/PossessedAI.cpp
r200 r277 25 25 void PossessedAI::AttackStart(Unit *u) 26 26 { 27 if( !u )27 if( !u || i_pet.GetCharmer()->HasAuraType(SPELL_AURA_MOD_PACIFY)) 28 28 return; 29 29 … … 96 96 return; 97 97 } 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)) 99 99 { 100 100 i_pet.AttackerStateUpdate(i_pet.getVictim()); -
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 -
trunk/src/game/Unit.h
r272 r277 641 641 typedef std::list<Player*> SharedVisionList; 642 642 643 struct CharmInfo643 struct TRINITY_DLL_SPEC CharmInfo 644 644 { 645 645 public: … … 658 658 void InitCharmCreateSpells(); 659 659 void InitPetActionBar(); 660 void InitEmptyActionBar( );660 void InitEmptyActionBar(bool withAttack = true); 661 661 //return true if successful 662 662 bool AddSpellToAB(uint32 oldid, uint32 newid, ActiveStates newstate = ACT_DECIDE); … … 672 672 ReactStates m_reactState; 673 673 uint32 m_petnumber; 674 bool m_barInit; 674 675 }; 675 676