aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorn0n4m3 <none@none>2009-12-17 11:31:44 +0100
committern0n4m3 <none@none>2009-12-17 11:31:44 +0100
commit5953596cee670517df4cf35fb1d428f9862a01b2 (patch)
tree8cf36792e370187c2175b8a24947b08668fafd5f /src
parent9f45beb67e2e8bcc54b18bea9b1eb022f166e7b5 (diff)
Update Movement code for 322a
--HG-- branch : trunk
Diffstat (limited to 'src')
-rw-r--r--src/game/MotionMaster.cpp1
-rw-r--r--src/game/MovementHandler.cpp91
2 files changed, 66 insertions, 26 deletions
diff --git a/src/game/MotionMaster.cpp b/src/game/MotionMaster.cpp
index 705cb20053a..c49765ded54 100644
--- a/src/game/MotionMaster.cpp
+++ b/src/game/MotionMaster.cpp
@@ -589,4 +589,3 @@ bool MotionMaster::GetDestination(float &x, float &y, float &z)
return top()->GetDestination(x,y,z);
}
-
diff --git a/src/game/MovementHandler.cpp b/src/game/MovementHandler.cpp
index a718d1601a2..7968fe06fb7 100644
--- a/src/game/MovementHandler.cpp
+++ b/src/game/MovementHandler.cpp
@@ -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);
- GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), GetPlayer()->GetDifficulty(), timeleft);
+ Difficulty diff = GetPlayer()->GetDifficulty(mEntry->IsRaid());
+ if (uint32 timeReset = sInstanceSaveManager.GetResetTimeFor(GetPlayer()->GetMapId(),diff))
+ {
+ uint32 timeleft = timeReset - time(NULL);
+ GetPlayer()->SendInstanceResetWarning(GetPlayer()->GetMapId(), diff, timeleft);
+ }
}
// mount allow check
@@ -179,9 +183,11 @@ void WorldSession::HandleMoveTeleportAck(WorldPacket& recv_data)
{
sLog.outDebug("MSG_MOVE_TELEPORT_ACK");
uint64 guid;
- uint32 flags, time;
- recv_data >> guid;
+ if(!recv_data.readPackGUID(guid))
+ return;
+
+ uint32 flags, time;
recv_data >> flags >> time;
DEBUG_LOG("Guid " UI64FMTD, guid);
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();
//sLog.outDebug("WORLD: Recvd %s (%u, 0x%X) opcode", LookupOpcodeName(opcode), opcode, opcode);
+ recv_data.hexlike();
Unit *mover = _player->m_mover;
@@ -241,17 +248,23 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
}
/* extract packet */
+ uint64 guid;
+
+ if(!recv_data.readPackGUID(guid))
+ return;
+
MovementInfo movementInfo;
+ movementInfo.guid = guid;
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());
- KickPlayer();
+ KickPlayer();*/
recv_data.rpos(recv_data.wpos()); // prevent warnings spam
- return;
- }
+ /* return;
+ }*/
if (!Trinity::IsValidMapCoord(movementInfo.x, movementInfo.y, movementInfo.z, movementInfo.o))
{
@@ -320,10 +333,10 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
/*----------------------*/
/* process position-change */
- recv_data.put<uint32>(6, getMSTime()); // fix time, offset flags(4) + unk(2)
- WorldPacket data(recv_data.GetOpcode(), (mover->GetPackGUID().size()+recv_data.size()));
- data.append(mover->GetPackGUID()); // use mover guid
- data.append(recv_data.contents(), recv_data.size());
+ WorldPacket data(opcode, recv_data.size());
+ movementInfo.time = getMSTime();
+ movementInfo.guid = mover->GetGUID();
+ WriteMovementInfo(&data, &movementInfo);
GetPlayer()->SendMessageToSet(&data, false);
mover->m_movementInfo = movementInfo;
@@ -338,7 +351,7 @@ void WorldSession::HandleMovementOpcodes( WorldPacket & recv_data )
if (plMover) // nothing is charmed, or player charmed
{
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)
{
@@ -389,14 +402,16 @@ void WorldSession::HandleMovementOpcodes( 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 */
uint64 guid;
uint32 unk1;
float newspeed;
- recv_data >> guid;
+ if(!recv_data.readPackGUID(guid))
+ return;
// now can skip not our packet
if(_player->GetGUID() != guid)
@@ -410,6 +425,7 @@ void WorldSession::HandleForceSpeedChangeAck(WorldPacket &recv_data)
recv_data >> unk1; // counter or moveEvent
MovementInfo movementInfo;
+ movementInfo.guid = guid;
ReadMovementInfo(recv_data, &movementInfo);
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" };
- uint16 opcode = recv_data.GetOpcode();
switch(opcode)
{
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");
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)
{
@@ -507,7 +523,12 @@ void WorldSession::HandleMoveNotActiveMover(WorldPacket &recv_data)
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)
@@ -523,7 +544,19 @@ void WorldSession::HandleDismissControlledVehicle(WorldPacket &recv_data)
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();
}
@@ -584,7 +617,10 @@ void WorldSession::HandleMoveKnockBackAck( WorldPacket & recv_data )
{
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
MovementInfo movementInfo;
@@ -595,7 +631,10 @@ void WorldSession::HandleMoveHoverAck( WorldPacket& recv_data )
{
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
MovementInfo movementInfo;
@@ -608,7 +647,10 @@ void WorldSession::HandleMoveWaterWalkAck(WorldPacket& recv_data)
{
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
MovementInfo movementInfo;
@@ -629,4 +671,3 @@ void WorldSession::HandleSummonResponseOpcode(WorldPacket& recv_data)
_player->SummonIfPossible(agree);
}
-