Changeset 283 for trunk/src/game/Unit.cpp
- Timestamp:
- 11/22/08 01:55:16 (17 years ago)
- Files:
-
- 1 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Unit.cpp
r279 r283 47 47 #include "CellImpl.h" 48 48 #include "Path.h" 49 #include "TemporarySummon.h"50 49 51 50 #include <math.h> … … 831 830 832 831 // battleground things (do this at the end, so the death state flag will be properly set to handle in the bg->handlekill) 833 if(pVictim->GetTypeId() == TYPEID_PLAYER && (((Player*)pVictim)->InBattleGround())) 834 { 835 Player *killed = ((Player*)pVictim); 836 Player *killer = NULL; 837 if(GetTypeId() == TYPEID_PLAYER) 838 killer = ((Player*)this); 839 else if(GetTypeId() == TYPEID_UNIT && ((Creature*)this)->isPet()) 840 { 841 Unit *owner = GetOwner(); 842 if(owner && owner->GetTypeId() == TYPEID_PLAYER) 843 killer = ((Player*)owner); 844 } 845 846 if(killer) 847 if(BattleGround *bg = killed->GetBattleGround()) 848 bg->HandleKillPlayer(killed, killer); // drop flags and etc 832 if(player && player->InBattleGround()) 833 { 834 if(BattleGround *bg = player->GetBattleGround()) 835 { 836 if(pVictim->GetTypeId() == TYPEID_PLAYER) 837 bg->HandleKillPlayer((Player*)pVictim, player); 838 else 839 bg->HandleKillUnit((Creature*)pVictim, player); 840 } 849 841 } 850 842 } … … 3420 3412 if (m_currentSpells[CURRENT_CHANNELED_SPELL] && (!spell_id || m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo->Id==spell_id)) 3421 3413 { 3422 // Unsummon any summoned as possessed creatures on channel interrupt3423 SpellEntry const *spellInfo = m_currentSpells[CURRENT_CHANNELED_SPELL]->m_spellInfo;3424 for (int i = 0; i < 3; i++)3425 {3426 if (spellInfo->Effect[i] == SPELL_EFFECT_SUMMON &&3427 (spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED ||3428 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED2 ||3429 spellInfo->EffectMiscValueB[i] == SUMMON_TYPE_POSESSED3))3430 {3431 // Possession is removed in the UnSummon function3432 if (GetCharm())3433 ((TemporarySummon*)GetCharm())->UnSummon();3434 }3435 }3436 3437 3414 if (m_currentSpells[CURRENT_CHANNELED_SPELL]->getState() != SPELL_STATE_FINISHED) 3438 3415 m_currentSpells[CURRENT_CHANNELED_SPELL]->cancel(); … … 9814 9791 9815 9792 CharmInfo::CharmInfo(Unit* unit) 9816 : m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0) , m_barInit(false)9793 : m_unit(unit), m_CommandState(COMMAND_FOLLOW), m_reactState(REACT_PASSIVE), m_petnumber(0) 9817 9794 { 9818 9795 for(int i =0; i<4; ++i) … … 9825 9802 void CharmInfo::InitPetActionBar() 9826 9803 { 9827 if (m_barInit)9828 return;9829 9830 9804 // the first 3 SpellOrActions are attack, follow and stay 9831 9805 for(uint32 i = 0; i < 3; i++) … … 9842 9816 PetActionBar[i + 3].SpellOrAction = 0; 9843 9817 } 9844 m_barInit = true; 9845 } 9846 9847 void CharmInfo::InitEmptyActionBar(bool withAttack) 9848 { 9849 if (m_barInit) 9850 return; 9851 9852 for(uint32 x = 0; x < 10; ++x) 9818 } 9819 9820 void CharmInfo::InitEmptyActionBar() 9821 { 9822 for(uint32 x = 1; x < 10; ++x) 9853 9823 { 9854 9824 PetActionBar[x].Type = ACT_CAST; 9855 9825 PetActionBar[x].SpellOrAction = 0; 9856 9826 } 9857 if (withAttack) 9858 { 9859 PetActionBar[0].Type = ACT_COMMAND; 9860 PetActionBar[0].SpellOrAction = COMMAND_ATTACK; 9861 } 9862 m_barInit = true; 9827 PetActionBar[0].Type = ACT_COMMAND; 9828 PetActionBar[0].SpellOrAction = COMMAND_ATTACK; 9863 9829 } 9864 9830