/* extract packet */
MovementInfo movementInfo;
@@ -202,48 +208,81 @@
{
// transports size limited
// (also received at zeppelin leave by some reason with t_* as absolute in continent coordinates, can be safely skipped)
- if( movementInfo.t_x > 50 || movementInfo.t_y > 50 || movementInfo.t_z > 50 )
+ if( movementInfo.t_x > 60 || movementInfo.t_y > 60 || movementInfo.t_x < -60 || movementInfo.t_y < -60 )
return;
if( !MaNGOS::IsValidMapCoord(movementInfo.x+movementInfo.t_x, movementInfo.y+movementInfo.t_y,
movementInfo.z+movementInfo.t_z, movementInfo.o+movementInfo.t_o) )
return;
-
- // if we boarded a transport, add us to it
- if (!GetPlayer()->m_transport)
+ if ((GetPlayer()->m_anti_transportGUID == 0) && (movementInfo.t_guid !=0))
{
- // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just unmount if the guid can be found in the transport list
- for (MapManager::TransportSet::iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter)
+ // if we boarded a transport, add us to it
+ if (!GetPlayer()->m_transport)
{
- if ((*iter)->GetGUID() == movementInfo.t_guid)
+ // elevators also cause the client to send MOVEMENTFLAG_ONTRANSPORT - just unmount if the guid can be found in the transport list
+ for (MapManager::TransportSet::iterator iter = MapManager::Instance().m_Transports.begin(); iter != MapManager::Instance().m_Transports.end(); ++iter)
{
- GetPlayer()->m_transport = (*iter);
- (*iter)->AddPassenger(GetPlayer());
- break;
+ if ((*iter)->GetGUID() == movementInfo.t_guid)
+ {
+ GetPlayer()->m_transport = (*iter);
+ (*iter)->AddPassenger(GetPlayer());
+ break;
+ }
}
}
+ ///GetPlayer()->m_anti_transportGUID = GUID_LOPART(movementInfo.t_guid);
+ //Correct finding GO guid in DB (thanks to GriffonHeart)
+ GameObject *obj = HashMapHolder<GameObject>::Find(movementInfo.t_guid);
+ if(obj)
+ GetPlayer()->m_anti_transportGUID = obj->GetDBTableGUIDLow();
+ else
+ GetPlayer()->m_anti_transportGUID = GUID_LOPART(movementInfo.t_guid);
}
}
- else if (GetPlayer()->m_transport) // if we were on a transport, leave
+ else if (GetPlayer()->m_anti_transportGUID != 0)
{
- GetPlayer()->m_transport->RemovePassenger(GetPlayer());
- GetPlayer()->m_transport = NULL;
+ if (GetPlayer()->m_transport) // if we were on a transport, leave
+ {
+ GetPlayer()->m_transport->RemovePassenger(GetPlayer());
+ GetPlayer()->m_transport = NULL;
+ }
movementInfo.t_x = 0.0f;
movementInfo.t_y = 0.0f;
movementInfo.t_z = 0.0f;
movementInfo.t_o = 0.0f;
movementInfo.t_time = 0;
movementInfo.t_seat = -1;
+ GetPlayer()->m_anti_transportGUID = 0;
}
// fall damage generation (ignore in flight case that can be triggered also at lags in moment teleportation to another map).
if (opcode == MSG_MOVE_FALL_LAND && !GetPlayer()->isInFlight())
{
+ GetPlayer()->m_anti_justjumped = 0;
// calculate total z distance of the fall
float z_diff = GetPlayer()->m_lastFallZ - movementInfo.z;
sLog.outDebug("zDiff = %f", z_diff);
Player *target = GetPlayer();
+ /* //movement anticheat "No Fall Damage"
+ if (target->m_anti_beginfalltime != 0)
+ {
+ #ifdef MOVEMENT_ANTICHEAT_DEBUG
+ sLog.outDebug("Movement anticheat: alternate FallTime %d | client falltime %d | m_anti_justteleported = %d",movementInfo.time - GetPlayer()->m_anti_beginfalltime, movementInfo.fallTime, GetPlayer()->m_anti_justteleported );
+ #endif
+ if (target->m_anti_justteleported != 1){
+ uint32 alt_falltime = movementInfo.time - target->m_anti_beginfalltime;
+ movementInfo.fallTime = (alt_falltime < movementInfo.fallTime) ? movementInfo.fallTime : alt_falltime;
+ } else {
+ target->m_anti_justteleported = 0;
+ }
+ target->m_anti_beginfalltime = 0;
+ }
+ #ifdef MOVEMENT_ANTICHEAT_DEBUG
+ sLog.outError("Movement anticheat: FallTime %d", movementInfo.fallTime);
+ #endif
+ //end movement anticheate */
+
//Players with low fall distance, Feather Fall or physical immunity (charges used) are ignored
// 14.57 can be calculated by resolving damageperc formular below to 0
if (z_diff >= 14.57f && !target->isDead() && !target->isGameMaster() &&
@@ -291,9 +330,244 @@
GetPlayer()->SetInWater( !GetPlayer()->IsInWater() || GetPlayer()->GetBaseMap()->IsUnderWater(movementInfo.x, movementInfo.y, movementInfo.z) );
}
-void WorldSession::HandleMoveKnockBackAck( WorldPacket & /*recv_data*/ )
+void WorldSession::HandleMoveKnockBackAck( WorldPacket & recv_data )
{
// CHECK_PACKET_SIZE(recv_data,?);
sLog.outDebug("CMSG_MOVE_KNOCK_BACK_ACK");
// Currently not used but maybe use later for recheck final player position
// (must be at call same as into "recv_data >> x >> y >> z >> orientation;"
void WorldSession::HandleMoveHoverAck( WorldPacket& /*recv_data*/ )
Index: game/Player.cpp
===================================================================
--- game/Player.cpp (revision 81)
+++ game/Player.cpp (working copy)
@@ -398,7 +398,24 @@
m_rest_bonus=0;
rest_type=REST_TYPE_NO;
////////////////////Rest System/////////////////////
+ //movement anticheat
+ m_anti_lastmovetime = 0; //last movement time
+ m_anti_transportGUID = 0; //current transport GUID
+ m_anti_last_hspeed = 7.0f; //horizontal speed, default RUN speed
+ m_anti_lastspeed_changetime = 0; //last speed change time
+ m_anti_last_vspeed = -2.0f; //vertical speed, default max jump height
+ m_anti_beginfalltime = 0; //alternative falling begin time
+ m_anti_justteleported = 0; //seted when player was teleported
+ m_anti_teletoplane_count = 0;//Teleport To Plane alarm counter
+ m_anti_lastMStime = 0; //last movement server time
+ m_anti_deltamovetime = 0;
+ m_anti_deltaMStime = 0;
+ m_anti_mistiming_count = 0;
+
+ m_anti_justjumped = 0; //jump already began
+ m_anti_alarmcount = 0; //alarm counter
+ /////////////////////////////////
m_mailsLoaded = false;
m_mailsUpdated = false;
unReadMails = 0;
@@ -1493,7 +1510,8 @@
sLog.outError("TeleportTo: invalid map %d or absent instance template.", mapid);
return false;
}
-
+ //reset falltimer at teleport
+ m_anti_justteleported = 1;
// preparing unsummon pet if lost (we must get pet before teleportation or will not find it later)
Pet* pet = GetPet();
Index: game/Player.h
===================================================================
--- game/Player.h (revision 81)
+++ game/Player.h (working copy)
@@ -2348,7 +2348,23 @@
float m_rest_bonus;
RestType rest_type;
////////////////////Rest System/////////////////////
+ //movement anticheat
+ uint32 m_anti_lastmovetime; //last movement time
+ uint64 m_anti_transportGUID; //current transport GUID
+ float m_anti_last_hspeed; //horizontal speed, default RUN speed
+ uint32 m_anti_lastspeed_changetime; //last speed change time
+ float m_anti_last_vspeed; //vertical speed, default max jump height
+ uint32 m_anti_beginfalltime; //alternative falling begin time
+ uint32 m_anti_justteleported; //seted when player was teleported
+ uint32 m_anti_teletoplane_count;//Teleport To Plane alarm counter
+ uint32 m_anti_lastMStime; //last movement server time
+ uint32 m_anti_deltamovetime; //client side session time
+ uint32 m_anti_deltaMStime; //server side session time
+ uint32 m_anti_mistiming_count; //mistiming counts before kick
+
+ uint32 m_anti_justjumped; //Jump already began, anti air jump check
+ uint64 m_anti_alarmcount; //alarm counter
// Transports
Transport * m_transport;