Update Movement code for 322a
--HG-- branch : trunk
This commit is contained in:
@@ -589,4 +589,3 @@ bool MotionMaster::GetDestination(float &x, float &y, float &z)
|
|||||||
|
|
||||||
return top()->GetDestination(x,y,z);
|
return top()->GetDestination(x,y,z);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -149,10 +149,14 @@ void WorldSession::HandleMoveWorldportAckOpcode()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if((mEntry->IsRaid() || (mEntry->IsNonRaidDungeon() && mEntry->SupportsHeroicMode() && GetPlayer()->IsHeroic())) && mInstance)
|
if (mInstance && mEntry->IsDungeon())
|
||||||
{
|
{
|
||||||
uint32 timeleft = sInstanceSaveManager.GetResetTimeFor(GetPlayer()->GetMapId()) - time(NULL);
|
Difficulty diff = GetPlayer()->GetDifficulty(mEntry->IsRaid());
|
||||||
GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), GetPlayer()->GetDifficulty(), timeleft);
|
if (uint32 timeReset = sInstanceSaveManager.GetResetTimeFor(GetPlayer()->GetMapId(),diff))
|
||||||
|
{
|
||||||
|
uint32 timeleft = timeReset - time(NULL);
|
||||||
|
GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), diff, timeleft);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// mount allow check
|
// mount allow check
|
||||||
@@ -179,9 +183,11 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
|
|||||||
{
|
{
|
||||||
sLog.outDebug("MSG_MOVE_TELEPORT_ACK");
|
sLog.outDebug("MSG_MOVE_TELEPORT_ACK");
|
||||||
uint64 guid;
|
uint64 guid;
|
||||||
uint32 flags, time;
|
|
||||||
|
|
||||||
recv_data >> guid;
|
if(!recv_data.readPackGUID(guid))
|
||||||
|
return;
|
||||||
|
|
||||||
|
uint32 flags, time;
|
||||||
recv_data >> flags >> time;
|
recv_data >> flags >> time;
|
||||||
DEBUG_LOG("Guid " UI64FMTD, guid);
|
DEBUG_LOG("Guid " UI64FMTD, guid);
|
||||||
DEBUG_LOG("Flags %u, time %u", flags, time/IN_MILISECONDS);
|
DEBUG_LOG("Flags %u, time %u", flags, time/IN_MILISECONDS);
|
||||||
@@ -226,6 +232,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
|||||||
{
|
{
|
||||||
uint16 opcode = recv_data.GetOpcode();
|
uint16 opcode = recv_data.GetOpcode();
|
||||||
//sLog.outDebug("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
|
//sLog.outDebug("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
|
||||||
|
recv_data.hexlike();
|
||||||
|
|
||||||
Unit *mover = _player->m_mover;
|
Unit *mover = _player->m_mover;
|
||||||
|
|
||||||
@@ -241,17 +248,23 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* extract packet */
|
/* extract packet */
|
||||||
|
uint64 guid;
|
||||||
|
|
||||||
|
if(!recv_data.readPackGUID(guid))
|
||||||
|
return;
|
||||||
|
|
||||||
MovementInfo movementInfo;
|
MovementInfo movementInfo;
|
||||||
|
movementInfo.guid = guid;
|
||||||
ReadMovementInfo(recv_data, &movementInfo);
|
ReadMovementInfo(recv_data, &movementInfo);
|
||||||
/*----------------*/
|
/*----------------*/
|
||||||
|
|
||||||
if (recv_data.size() != recv_data.rpos())
|
/* if(recv_data.size() != recv_data.rpos())
|
||||||
{
|
{
|
||||||
sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), recv_data.GetOpcode(), recv_data.size() - recv_data.rpos());
|
sLog.outError("MovementHandler: player %s (guid %d, account %u) sent a packet (opcode %u) that is " SIZEFMTD " bytes larger than it should be. Kicked as cheater.", _player->GetName(), _player->GetGUIDLow(), _player->GetSession()->GetAccountId(), recv_data.GetOpcode(), recv_data.size() - recv_data.rpos());
|
||||||
KickPlayer();
|
KickPlayer();*/
|
||||||
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
|
||||||
return;
|
/* return;
|
||||||
}
|
}*/
|
||||||
|
|
||||||
if (!Trinity::IsValidMapCoord(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o))
|
if (!Trinity::IsValidMapCoord(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o))
|
||||||
{
|
{
|
||||||
@@ -320,10 +333,10 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
|||||||
/*----------------------*/
|
/*----------------------*/
|
||||||
|
|
||||||
/* process position-change */
|
/* process position-change */
|
||||||
recv_data.put<uint32>(6, getMSTime()); // fix time, offset flags(4) + unk(2)
|
WorldPacket data(opcode, recv_data.size());
|
||||||
WorldPacket data(recv_data.GetOpcode(), (mover->GetPackGUID().size()+recv_data.size()));
|
movementInfo.time = getMSTime();
|
||||||
data.append(mover->GetPackGUID()); // use mover guid
|
movementInfo.guid = mover->GetGUID();
|
||||||
data.append(recv_data.contents(), recv_data.size());
|
WriteMovementInfo(&data, &movementInfo);
|
||||||
GetPlayer()->SendMessageToSet(&data, false);
|
GetPlayer()->SendMessageToSet(&data, false);
|
||||||
|
|
||||||
mover->m_movementInfo = movementInfo;
|
mover->m_movementInfo = movementInfo;
|
||||||
@@ -338,7 +351,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
|||||||
if (plMover) // nothing is charmed, or player charmed
|
if (plMover) // nothing is charmed, or player charmed
|
||||||
{
|
{
|
||||||
plMover->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
|
plMover->SetPosition(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o);
|
||||||
plMover->UpdateFallInformationIfNeed(movementInfo, recv_data.GetOpcode());
|
plMover->UpdateFallInformationIfNeed(movementInfo, opcode);
|
||||||
|
|
||||||
if (movementInfo.z < -500.0f)
|
if (movementInfo.z < -500.0f)
|
||||||
{
|
{
|
||||||
@@ -389,14 +402,16 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
|
|||||||
|
|
||||||
void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
|
void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
|
||||||
{
|
{
|
||||||
//sLog.outDebug("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(recv_data.GetOpcode()), recv_data.GetOpcode(), recv_data.GetOpcode());
|
uint32 opcode = recv_data.GetOpcode();
|
||||||
|
sLog.outDebug("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
|
||||||
|
|
||||||
/* extract packet */
|
/* extract packet */
|
||||||
uint64 guid;
|
uint64 guid;
|
||||||
uint32 unk1;
|
uint32 unk1;
|
||||||
float newspeed;
|
float newspeed;
|
||||||
|
|
||||||
recv_data >> guid;
|
if(!recv_data.readPackGUID(guid))
|
||||||
|
return;
|
||||||
|
|
||||||
// now can skip not our packet
|
// now can skip not our packet
|
||||||
if(_player->GetGUID() != guid)
|
if(_player->GetGUID() != guid)
|
||||||
@@ -410,6 +425,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
|
|||||||
recv_data >> unk1; // counter or moveEvent
|
recv_data >> unk1; // counter or moveEvent
|
||||||
|
|
||||||
MovementInfo movementInfo;
|
MovementInfo movementInfo;
|
||||||
|
movementInfo.guid = guid;
|
||||||
ReadMovementInfo(recv_data, &movementInfo);
|
ReadMovementInfo(recv_data, &movementInfo);
|
||||||
|
|
||||||
recv_data >> newspeed;
|
recv_data >> newspeed;
|
||||||
@@ -422,7 +438,6 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
|
|||||||
|
|
||||||
static char const* move_type_name[MAX_MOVE_TYPE] = { "Walk", "Run", "RunBack", "Swim", "SwimBack", "TurnRate", "Flight", "FlightBack", "PitchRate" };
|
static char const* move_type_name[MAX_MOVE_TYPE] = { "Walk", "Run", "RunBack", "Swim", "SwimBack", "TurnRate", "Flight", "FlightBack", "PitchRate" };
|
||||||
|
|
||||||
uint16 opcode = recv_data.GetOpcode();
|
|
||||||
switch(opcode)
|
switch(opcode)
|
||||||
{
|
{
|
||||||
case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; force_move_type = MOVE_WALK; break;
|
case CMSG_FORCE_WALK_SPEED_CHANGE_ACK: move_type = MOVE_WALK; force_move_type = MOVE_WALK; break;
|
||||||
@@ -498,7 +513,8 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data)
|
|||||||
sLog.outDebug("WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
|
sLog.outDebug("WORLD: Recvd CMSG_MOVE_NOT_ACTIVE_MOVER");
|
||||||
|
|
||||||
uint64 old_mover_guid;
|
uint64 old_mover_guid;
|
||||||
recv_data >> old_mover_guid;
|
if(!recv_data.readPackGUID(old_mover_guid))
|
||||||
|
return;
|
||||||
|
|
||||||
/*if(_player->m_mover->GetGUID() == old_mover_guid)
|
/*if(_player->m_mover->GetGUID() == old_mover_guid)
|
||||||
{
|
{
|
||||||
@@ -507,7 +523,12 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data)
|
|||||||
return;
|
return;
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
ReadMovementInfo(recv_data, &_player->m_mover->m_movementInfo);
|
MovementInfo mi;
|
||||||
|
mi.guid = old_mover_guid;
|
||||||
|
ReadMovementInfo(recv_data, &mi);
|
||||||
|
|
||||||
|
//ReadMovementInfo(recv_data, &_player->m_mover->m_movementInfo);
|
||||||
|
_player->m_movementInfo = mi;
|
||||||
}
|
}
|
||||||
|
|
||||||
void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
|
void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
|
||||||
@@ -523,7 +544,19 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
ReadMovementInfo(recv_data, &_player->m_mover->m_movementInfo);
|
uint64 guid;
|
||||||
|
|
||||||
|
if(!recv_data.readPackGUID(guid))
|
||||||
|
return;
|
||||||
|
|
||||||
|
MovementInfo mi;
|
||||||
|
mi.guid = guid;
|
||||||
|
ReadMovementInfo(recv_data, &mi);
|
||||||
|
|
||||||
|
_player->m_movementInfo = mi;
|
||||||
|
|
||||||
|
/*
|
||||||
|
ReadMovementInfo(recv_data, &_player->m_mover->m_movementInfo);*/
|
||||||
_player->ExitVehicle();
|
_player->ExitVehicle();
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -584,7 +617,10 @@ void WorldSession::HandleMoveKnockBackAck( WorldPacket & recv_data )
|
|||||||
{
|
{
|
||||||
sLog.outDebug("CMSG_MOVE_KNOCK_BACK_ACK");
|
sLog.outDebug("CMSG_MOVE_KNOCK_BACK_ACK");
|
||||||
|
|
||||||
recv_data.read_skip<uint64>(); // guid
|
uint64 guid; // guid - unused
|
||||||
|
if(!recv_data.readPackGUID(guid))
|
||||||
|
return;
|
||||||
|
|
||||||
recv_data.read_skip<uint32>(); // unk
|
recv_data.read_skip<uint32>(); // unk
|
||||||
|
|
||||||
MovementInfo movementInfo;
|
MovementInfo movementInfo;
|
||||||
@@ -595,7 +631,10 @@ void WorldSession::HandleMoveHoverAck( WorldPacket& recv_data )
|
|||||||
{
|
{
|
||||||
sLog.outDebug("CMSG_MOVE_HOVER_ACK");
|
sLog.outDebug("CMSG_MOVE_HOVER_ACK");
|
||||||
|
|
||||||
recv_data.read_skip<uint64>(); // guid
|
uint64 guid; // guid - unused
|
||||||
|
if(!recv_data.readPackGUID(guid))
|
||||||
|
return;
|
||||||
|
|
||||||
recv_data.read_skip<uint32>(); // unk
|
recv_data.read_skip<uint32>(); // unk
|
||||||
|
|
||||||
MovementInfo movementInfo;
|
MovementInfo movementInfo;
|
||||||
@@ -608,7 +647,10 @@ void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recv_data)
|
|||||||
{
|
{
|
||||||
sLog.outDebug("CMSG_MOVE_WATER_WALK_ACK");
|
sLog.outDebug("CMSG_MOVE_WATER_WALK_ACK");
|
||||||
|
|
||||||
recv_data.read_skip<uint64>(); // guid
|
uint64 guid; // guid - unused
|
||||||
|
if(!recv_data.readPackGUID(guid))
|
||||||
|
return;
|
||||||
|
|
||||||
recv_data.read_skip<uint32>(); // unk
|
recv_data.read_skip<uint32>(); // unk
|
||||||
|
|
||||||
MovementInfo movementInfo;
|
MovementInfo movementInfo;
|
||||||
@@ -629,4 +671,3 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recv_data)
|
|||||||
|
|
||||||
_player->SummonIfPossible(agree);
|
_player->SummonIfPossible(agree);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user