Skip to content

Commit

Permalink
Fix anticheat false positive on spline done.
Browse files Browse the repository at this point in the history
Closes #2700
  • Loading branch information
ratkosrb committed Sep 19, 2024
1 parent 91ecfc7 commit 59e1c61
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 13 deletions.
32 changes: 21 additions & 11 deletions src/game/Anticheat/MovementAnticheat/MovementAnticheat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -812,19 +812,29 @@ uint32 MovementAnticheat::HandleFlagTests(Player* pPlayer, MovementInfo& movemen
}
#undef APPEND_CHEAT

AddCheats(cheatFlags);

if (ShouldRejectMovement(cheatFlags) &&
me->movespline->Finalized() &&
!me->IsBeingTeleported())
if (cheatFlags)
{
me->RemoveUnitMovementFlag(removeMoveFlags);
me->ResolvePendingMovementChanges(true, true);
me->SendHeartBeat(true);
return WorldTimer::getMSTime() + 100 + std::min(1000u, sWorld.GetCurrentDiff() + m_session->GetLatency());
// Since we dont require client confirmation for flag changes
// during move splines, it's possible for client to not have
// yet processed the changes when the move spline expires.
// So just ignore this packet and dont send forced update.
if (opcode == CMSG_MOVE_SPLINE_DONE)
return 1;

AddCheats(cheatFlags);

if (ShouldRejectMovement(cheatFlags) &&
me->movespline->Finalized() &&
!me->IsBeingTeleported())
{
me->RemoveUnitMovementFlag(removeMoveFlags);
me->ResolvePendingMovementChanges(true, true);
me->SendHeartBeat(true);
return WorldTimer::getMSTime() + 100 + std::min(1000u, sWorld.GetCurrentDiff() + m_session->GetLatency());
}
else if (removeMoveFlags)
movementInfo.RemoveMovementFlag(removeMoveFlags);
}
else if (removeMoveFlags)
movementInfo.RemoveMovementFlag(removeMoveFlags);

return 0;
}
Expand Down
2 changes: 0 additions & 2 deletions src/game/Handlers/MovementHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,9 +865,7 @@ void WorldSession::HandleMoveSplineDoneOpcode(WorldPacket& recvData)
return;

if (m_moveRejectTime = _player->GetCheatData()->HandleFlagTests(pPlayerMover, movementInfo, CMSG_MOVE_SPLINE_DONE))
{
return;
}
}

HandleMoverRelocation(pMover, movementInfo);
Expand Down

0 comments on commit 59e1c61

Please sign in to comment.