aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/game/PetHandler.cpp4
-rw-r--r--src/game/Player.cpp8
-rw-r--r--src/game/PossessedAI.cpp5
-rw-r--r--src/game/SpellHandler.cpp8
4 files changed, 21 insertions, 4 deletions
diff --git a/src/game/PetHandler.cpp b/src/game/PetHandler.cpp
index ac198c0be67..e308908dd50 100644
--- a/src/game/PetHandler.cpp
+++ b/src/game/PetHandler.cpp
@@ -78,6 +78,10 @@ void WorldSession::HandlePetAction( WorldPacket & recv_data )
switch(flag)
{
case ACT_COMMAND: //0x0700
+ // Possessed pets are only able to attack
+ if (pet->isPossessed() && spellid != COMMAND_ATTACK)
+ return;
+
switch(spellid)
{
case COMMAND_STAY: //flat=1792 //STAY
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 4b4f444471c..b00dadc98dd 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -18764,8 +18764,16 @@ void Player::RemovePossess(bool attack)
else
{
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
+ // Reinitialize the pet bar and make the pet come back to the owner
if(((Creature*)target)->isPet())
+ {
PetSpellInitialize();
+ if (!target->getVictim())
+ {
+ target->GetMotionMaster()->MoveFollow(this, PET_FOLLOW_DIST, PET_FOLLOW_ANGLE);
+ target->GetCharmInfo()->SetCommandState(COMMAND_FOLLOW);
+ }
+ }
else if (target->isAlive())
{
// If we're still hostile to our target, continue attacking otherwise reset threat and go home
diff --git a/src/game/PossessedAI.cpp b/src/game/PossessedAI.cpp
index b66a648294f..6b803303185 100644
--- a/src/game/PossessedAI.cpp
+++ b/src/game/PossessedAI.cpp
@@ -24,9 +24,12 @@
void PossessedAI::AttackStart(Unit *u)
{
- if( i_pet.getVictim() || !u )
+ if( !u )
return;
+ if (i_pet.getVictim() && u != i_pet.getVictim())
+ i_pet.AttackStop();
+
if(i_pet.Attack(u, true))
i_victimGuid = u->GetGUID();
diff --git a/src/game/SpellHandler.cpp b/src/game/SpellHandler.cpp
index 051e1adbc30..190134c7b02 100644
--- a/src/game/SpellHandler.cpp
+++ b/src/game/SpellHandler.cpp
@@ -352,13 +352,15 @@ void WorldSession::HandleCancelAuraOpcode( WorldPacket& recvPacket)
if (!spellInfo)
return;
- // Remove possess aura from the possessed as well
- if(_player->isPossessing())
+ // Remove possess/charm aura from the possessed/charmed as well
+ // TODO: Remove this once the ability to cancel aura sets at once is implemented
+ if(_player->GetCharm())
{
for (int i = 0; i < 3; ++i)
{
if (spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_POSSESS ||
- spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_POSSESS_PET)
+ spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_POSSESS_PET ||
+ spellInfo->EffectApplyAuraName[i] == SPELL_AURA_MOD_CHARM)
{
_player->RemoveAurasDueToSpellByCancel(spellId);
_player->GetCharm()->RemoveAurasDueToSpellByCancel(spellId);