Show
Ignore:
Timestamp:
11/19/08 13:43:15 (17 years ago)
Author:
yumileroy
Message:

[svn] Implemented player on player and player on creature possession:
* Implemented packet and vision forwarding through possessed units
* Added new OnPossess? script call alerting scripts on when possession is applied/removed
* Moved fall damage and fall under map calculations into the Player class
* Added new PossessedAI that is applied only while possession on creature is active
* Implemented summon possessed spell effect
* Fixed Eyes of the Beast

Original author: gvcoman
Date: 2008-11-05 20:51:05-06:00

Files:
1 modified

Legend:

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

    r173 r174  
    5050#include "GridNotifiersImpl.h" 
    5151#include "CellImpl.h" 
     52#include "TemporarySummon.h" 
    5253 
    5354#define NULL_AURA_SLOT 0xFF 
     
    528529    } 
    529530 
    530     // Channeled aura required check distance from caster 
    531     if(IsChanneledSpell(m_spellProto) && m_caster_guid != m_target->GetGUID()) 
     531    // Channeled aura required check distance from caster except in possessed cases 
     532    if(IsChanneledSpell(m_spellProto) && m_caster_guid != m_target->GetGUID() && !m_target->isPossessed()) 
    532533    { 
    533534        Unit* caster = GetCaster(); 
     
    20042005            return; 
    20052006        } 
     2007 
    20062008        // Dark Fiend 
    20072009        if(GetId()==45934) 
     
    20172019        { 
    20182020            m_target->CastSpell(m_target,47287,true,NULL,this); 
     2021            return; 
     2022        } 
     2023 
     2024        // Eye of Kilrogg, unsummon eye when aura is gone 
     2025        if(GetId() == 126 && caster->GetTypeId() == TYPEID_PLAYER && caster->GetCharm()) 
     2026        { 
     2027            ((TemporarySummon*)caster->GetCharm())->UnSummon(); 
    20192028            return; 
    20202029        } 
     
    28872896    if( apply ) 
    28882897    { 
    2889         m_target->SetCharmerGUID(GetCasterGUID()); 
    2890         m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,caster->getFaction()); 
    2891         caster->SetCharm(m_target); 
    2892  
    2893         m_target->CombatStop(); 
    2894         m_target->DeleteThreatList(); 
    2895         if(m_target->GetTypeId() == TYPEID_UNIT) 
    2896         { 
    2897             m_target->StopMoving(); 
    2898             m_target->GetMotionMaster()->Clear(); 
    2899             m_target->GetMotionMaster()->MoveIdle(); 
    2900             CharmInfo *charmInfo = ((Creature*)m_target)->InitCharmInfo(m_target); 
    2901             charmInfo->InitPossessCreateSpells(); 
    2902         } 
    2903  
    2904         if(caster->GetTypeId() == TYPEID_PLAYER) 
    2905         { 
    2906             ((Player*)caster)->PossessSpellInitialize(); 
    2907         } 
     2898        if (caster->GetTypeId() == TYPEID_PLAYER) 
     2899            ((Player*)caster)->Possess(m_target); 
    29082900    } 
    29092901    else 
    2910     { 
    2911         m_target->SetCharmerGUID(0); 
    2912  
    2913         if(m_target->GetTypeId() == TYPEID_PLAYER) 
    2914             ((Player*)m_target)->setFactionForRace(m_target->getRace()); 
    2915         else if(m_target->GetTypeId() == TYPEID_UNIT) 
    2916         { 
    2917             CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo(); 
    2918             m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,cinfo->faction_A); 
    2919         } 
    2920  
    2921         caster->SetCharm(0); 
    2922  
    2923         if(caster->GetTypeId() == TYPEID_PLAYER) 
    2924         { 
    2925             WorldPacket data(SMSG_PET_SPELLS, 8); 
    2926             data << uint64(0); 
    2927             ((Player*)caster)->GetSession()->SendPacket(&data); 
    2928         } 
    2929         if(m_target->GetTypeId() == TYPEID_UNIT) 
    2930         { 
    2931             ((Creature*)m_target)->AIM_Initialize(); 
    2932  
    2933             if (((Creature*)m_target)->AI()) 
    2934                 ((Creature*)m_target)->AI()->AttackStart(caster); 
    2935         } 
    2936     } 
    2937     if(caster->GetTypeId() == TYPEID_PLAYER) 
    2938         caster->SetUInt64Value(PLAYER_FARSIGHT,apply ? m_target->GetGUID() : 0); 
     2902        m_target->UnpossessSelf(true); 
    29392903} 
    29402904 
     
    29522916    if(apply) 
    29532917    { 
    2954         caster->SetUInt64Value(PLAYER_FARSIGHT, m_target->GetGUID()); 
    2955         m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN5); 
     2918        ((Player*)caster)->Possess(m_target); 
    29562919    } 
    29572920    else 
    29582921    { 
    2959         caster->SetUInt64Value(PLAYER_FARSIGHT, 0); 
    2960         m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN5); 
     2922        ((Player*)caster)->RemovePossess(false); 
    29612923    } 
    29622924}