aboutsummaryrefslogtreecommitdiff
path: root/src/game/SpellAuras.cpp
diff options
context:
space:
mode:
authorgvcoman <none@none>2008-11-05 20:51:05 -0600
committergvcoman <none@none>2008-11-05 20:51:05 -0600
commit44bdb135f4ed5bb834795cfb928ccbb0504cf834 (patch)
tree7995df4957fb2e0e6cde895fbe3e85b7efde5fa7 /src/game/SpellAuras.cpp
parent8d331f2b10cff29ee0571f7056ad353df6a3eabd (diff)
[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 --HG-- branch : trunk
Diffstat (limited to 'src/game/SpellAuras.cpp')
-rw-r--r--src/game/SpellAuras.cpp70
1 files changed, 16 insertions, 54 deletions
diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp
index 0f20a414c8a..d0a70858b71 100644
--- a/src/game/SpellAuras.cpp
+++ b/src/game/SpellAuras.cpp
@@ -49,6 +49,7 @@
#include "GridNotifiers.h"
#include "GridNotifiersImpl.h"
#include "CellImpl.h"
+#include "TemporarySummon.h"
#define NULL_AURA_SLOT 0xFF
@@ -527,8 +528,8 @@ void Aura::Update(uint32 diff)
}
}
- // Channeled aura required check distance from caster
- if(IsChanneledSpell(m_spellProto) && m_caster_guid != m_target->GetGUID())
+ // Channeled aura required check distance from caster except in possessed cases
+ if(IsChanneledSpell(m_spellProto) && m_caster_guid != m_target->GetGUID() && !m_target->isPossessed())
{
Unit* caster = GetCaster();
if(!caster)
@@ -2003,6 +2004,7 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
caster->CastSpell(m_target,finalSpelId,true,NULL,this);
return;
}
+
// Dark Fiend
if(GetId()==45934)
{
@@ -2018,6 +2020,13 @@ void Aura::HandleAuraDummy(bool apply, bool Real)
m_target->CastSpell(m_target,47287,true,NULL,this);
return;
}
+
+ // Eye of Kilrogg, unsummon eye when aura is gone
+ if(GetId() == 126 && caster->GetTypeId() == TYPEID_PLAYER && caster->GetCharm())
+ {
+ ((TemporarySummon*)caster->GetCharm())->UnSummon();
+ return;
+ }
}
// AT APPLY & REMOVE
@@ -2886,56 +2895,11 @@ void Aura::HandleModPossess(bool apply, bool Real)
if( apply )
{
- m_target->SetCharmerGUID(GetCasterGUID());
- m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,caster->getFaction());
- caster->SetCharm(m_target);
-
- m_target->CombatStop();
- m_target->DeleteThreatList();
- if(m_target->GetTypeId() == TYPEID_UNIT)
- {
- m_target->StopMoving();
- m_target->GetMotionMaster()->Clear();
- m_target->GetMotionMaster()->MoveIdle();
- CharmInfo *charmInfo = ((Creature*)m_target)->InitCharmInfo(m_target);
- charmInfo->InitPossessCreateSpells();
- }
-
- if(caster->GetTypeId() == TYPEID_PLAYER)
- {
- ((Player*)caster)->PossessSpellInitialize();
- }
+ if (caster->GetTypeId() == TYPEID_PLAYER)
+ ((Player*)caster)->Possess(m_target);
}
else
- {
- m_target->SetCharmerGUID(0);
-
- if(m_target->GetTypeId() == TYPEID_PLAYER)
- ((Player*)m_target)->setFactionForRace(m_target->getRace());
- else if(m_target->GetTypeId() == TYPEID_UNIT)
- {
- CreatureInfo const *cinfo = ((Creature*)m_target)->GetCreatureInfo();
- m_target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE,cinfo->faction_A);
- }
-
- caster->SetCharm(0);
-
- if(caster->GetTypeId() == TYPEID_PLAYER)
- {
- WorldPacket data(SMSG_PET_SPELLS, 8);
- data << uint64(0);
- ((Player*)caster)->GetSession()->SendPacket(&data);
- }
- if(m_target->GetTypeId() == TYPEID_UNIT)
- {
- ((Creature*)m_target)->AIM_Initialize();
-
- if (((Creature*)m_target)->AI())
- ((Creature*)m_target)->AI()->AttackStart(caster);
- }
- }
- if(caster->GetTypeId() == TYPEID_PLAYER)
- caster->SetUInt64Value(PLAYER_FARSIGHT,apply ? m_target->GetGUID() : 0);
+ m_target->UnpossessSelf(true);
}
void Aura::HandleModPossessPet(bool apply, bool Real)
@@ -2951,13 +2915,11 @@ void Aura::HandleModPossessPet(bool apply, bool Real)
if(apply)
{
- caster->SetUInt64Value(PLAYER_FARSIGHT, m_target->GetGUID());
- m_target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN5);
+ ((Player*)caster)->Possess(m_target);
}
else
{
- caster->SetUInt64Value(PLAYER_FARSIGHT, 0);
- m_target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN5);
+ ((Player*)caster)->RemovePossess(false);
}
}