aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorgvcoman <none@none>2008-11-07 16:49:42 -0600
committergvcoman <none@none>2008-11-07 16:49:42 -0600
commite18c77155311ff47b2609c37ccf9abda43d6e3a5 (patch)
tree9849bf2e2d595b02356cddf5354b4826342c739e /src
parent46bb829582d9bc5ccb526fc7314dbbea0e615fa1 (diff)
[svn] Possession:
* Fixed player not having PvP flag on remove * Fixed pet resetting its aggro on remove * Fixed pet bar resetting on remove (?) * Added dummy handler for NOT_ACTIVE_MOVER, display message only in debug logging mode --HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/MovementHandler.cpp5
-rw-r--r--src/game/Opcodes.cpp2
-rw-r--r--src/game/Player.cpp23
-rw-r--r--src/game/WorldSession.h1
4 files changed, 20 insertions, 11 deletions
diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
index 792db2e06f4..87d51e5daf6 100644
--- a/src/game/MovementHandler.cpp
+++ b/src/game/MovementHandler.cpp
@@ -538,6 +538,11 @@ void WorldSession::HandleSetActiveMoverOpcode(WorldPacket &recv_data)
SendPacket(&data);
}
+void WorldSession::HandleNotActiveMoverOpcode(WorldPacket& /*recv_data*/)
+{
+ sLog.outDebug("WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
+}
+
void WorldSession::HandleMountSpecialAnimOpcode(WorldPacket& /*recvdata*/)
{
//sLog.outDebug("WORLD: Recvd CMSG_MOUNTSPECIAL_ANIM");
diff --git a/src/game/Opcodes.cpp b/src/game/Opcodes.cpp
index 98ce54ce111..ad68167b746 100644
--- a/src/game/Opcodes.cpp
+++ b/src/game/Opcodes.cpp
@@ -749,7 +749,7 @@ OpcodeHandler opcodeTable[NUM_MSG_TYPES] =
/*0x2CE*/ { "CMSG_MOVE_TIME_SKIPPED", STATUS_LOGGEDIN, &WorldSession::HandleMoveTimeSkippedOpcode },
/*0x2CF*/ { "CMSG_MOVE_FEATHER_FALL_ACK", STATUS_LOGGEDIN, &WorldSession::HandleFeatherFallAck },
/*0x2D0*/ { "CMSG_MOVE_WATER_WALK_ACK", STATUS_LOGGEDIN, &WorldSession::HandleMoveWaterWalkAck },
- /*0x2D1*/ { "CMSG_MOVE_NOT_ACTIVE_MOVER", STATUS_NEVER, &WorldSession::Handle_NULL },
+ /*0x2D1*/ { "CMSG_MOVE_NOT_ACTIVE_MOVER", STATUS_LOGGEDIN, &WorldSession::HandleNotActiveMoverOpcode },
/*0x2D2*/ { "SMSG_PLAY_SOUND", STATUS_NEVER, &WorldSession::Handle_ServerSide },
/*0x2D3*/ { "CMSG_BATTLEFIELD_STATUS", STATUS_LOGGEDIN, &WorldSession::HandleBattlefieldStatusOpcode },
/*0x2D4*/ { "SMSG_BATTLEFIELD_STATUS", STATUS_NEVER, &WorldSession::Handle_ServerSide },
diff --git a/src/game/Player.cpp b/src/game/Player.cpp
index 12d1dd99941..9ef583416c6 100644
--- a/src/game/Player.cpp
+++ b/src/game/Player.cpp
@@ -18660,6 +18660,8 @@ void Player::Possess(Unit *target)
// Update the proper unit fields
SetPossessedTarget(target);
+ uint32 flags1 = target->GetUInt32Value(UNIT_FIELD_FLAGS);
+
target->SetUInt32Value(UNIT_FIELD_FACTIONTEMPLATE, getFaction());
target->RemoveUnitMovementFlag(MOVEMENTFLAG_WALK_MODE);
target->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN5);
@@ -18667,6 +18669,8 @@ void Player::Possess(Unit *target)
SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
SetUInt64Value(PLAYER_FARSIGHT, target->GetGUID());
+ uint32 flags2 = target->GetUInt32Value(UNIT_FIELD_FLAGS);
+
if(target->GetTypeId() == TYPEID_UNIT)
{
// Set target to active in the grid and place it in the world container to be picked up by all regular player cell visits
@@ -18720,6 +18724,10 @@ void Player::RemovePossess(bool attack)
++itr;
}
+ // Interrupt any current casting of the target
+ if(target->IsNonMeleeSpellCasted(true))
+ target->InterruptNonMeleeSpells(true);
+
RemovePossessedTarget();
if(target->GetTypeId() == TYPEID_PLAYER)
@@ -18743,7 +18751,6 @@ void Player::RemovePossess(bool attack)
}
target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_UNKNOWN5);
- target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_DISABLE_MOVE);
SetUInt64Value(PLAYER_FARSIGHT, 0);
@@ -18758,18 +18765,14 @@ void Player::RemovePossess(bool attack)
((Player*)target)->SetViewport(target->GetGUID(), true);
else
{
+ target->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_PVP_ATTACKABLE);
if(((Creature*)target)->isPet())
- {
- ((Pet*)target)->InitPetCreateSpells();
PetSpellInitialize();
- }
-
- if (target->isAlive())
+ else if (target->isAlive())
{
// If we're still hostile to our target, continue attacking otherwise reset threat and go home
- if (target->getVictim())
+ if (Unit* victim = target->getVictim())
{
- Unit* victim = target->getVictim();
FactionTemplateEntry const* t_faction = target->getFactionTemplateEntry();
FactionTemplateEntry const* v_faction = victim->getFactionTemplateEntry();
// Unit::IsHostileTo will always return true since the unit is always hostile to its victim
@@ -18783,14 +18786,14 @@ void Player::RemovePossess(bool attack)
target->GetMotionMaster()->MoveTargetedHome();
}
}
- else if (target->GetTypeId() == TYPEID_UNIT)
+ else
{
target->GetMotionMaster()->Clear();
target->GetMotionMaster()->MoveTargetedHome();
}
// Add high amount of threat on the player
- if(target != GetPet() && attack)
+ if(attack)
target->AddThreat(this, 1000000.0f);
}
// Delete the assigned possessed AI
diff --git a/src/game/WorldSession.h b/src/game/WorldSession.h
index c4ff01884ff..27391ae9618 100644
--- a/src/game/WorldSession.h
+++ b/src/game/WorldSession.h
@@ -320,6 +320,7 @@ class TRINITY_DLL_SPEC WorldSession
void HandleMovementOpcodes(WorldPacket& recvPacket);
void HandlePossessedMovement(WorldPacket& recv_data, MovementInfo& movementInfo, uint32& MovementFlags);
void HandleSetActiveMoverOpcode(WorldPacket &recv_data);
+ void HandleNotActiveMoverOpcode(WorldPacket &recv_data);
void HandleMoveTimeSkippedOpcode(WorldPacket &recv_data);
void HandleRequestRaidInfoOpcode( WorldPacket & recv_data );