Class DefaultOvershootManager
- java.lang.Object
-
- net.eternalclient.api.internal.mouse.naturalmouse.support.DefaultOvershootManager
-
- All Implemented Interfaces:
OvershootManager
public class DefaultOvershootManager extends java.lang.Object implements OvershootManager
-
-
Field Summary
Fields Modifier and Type Field Description static intDEFAULT_OVERSHOOT_AMOUNTstatic intMIN_DISTANCE_FOR_OVERSHOOTSstatic intMIN_OVERSHOOT_MOVEMENT_MSstatic intOVERSHOOT_RANDOM_MODIFIER_DIVIDERstatic doubleOVERSHOOT_SPEEDUP_DIVIDER
-
Constructor Summary
Constructors Constructor Description DefaultOvershootManager(java.util.Random random)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description longderiveNextMouseMovementTimeMs(long mouseMovementMs, int overshootsRemaining)Once the mouse reaches the overshoot target, new trajectory with new speed is calculated for next target (can be real or overshoot target, if the next target is real target, the overshootsRemaining value is 0)longgetMinDistanceForOvershoots()longgetMinOvershootMovementMs()java.awt.PointgetOvershootAmount(double distanceToRealTargetX, double distanceToRealTargetY, long mouseMovementMs, int overshootsRemaining)Returns the overshoot amount which will be added to real target, thus getting the overshoot target.doublegetOvershootRandomModifierDivider()intgetOvershoots()intgetOvershoots(Flow flow, long mouseMovementMs, double distance)Get the maximum amount of overshoots the cursor does before reaching its final destination.doublegetOvershootSpeedupDivider()voidsetMinDistanceForOvershoots(long minDistanceForOvershoots)voidsetMinOvershootMovementMs(long minOvershootMovementMs)voidsetOvershootRandomModifierDivider(double overshootRandomModifierDivider)voidsetOvershoots(int overshoots)voidsetOvershootSpeedupDivider(double overshootSpeedupDivider)
-
-
-
Field Detail
-
OVERSHOOT_SPEEDUP_DIVIDER
public static final double OVERSHOOT_SPEEDUP_DIVIDER
- See Also:
- Constant Field Values
-
MIN_OVERSHOOT_MOVEMENT_MS
public static final int MIN_OVERSHOOT_MOVEMENT_MS
- See Also:
- Constant Field Values
-
OVERSHOOT_RANDOM_MODIFIER_DIVIDER
public static final int OVERSHOOT_RANDOM_MODIFIER_DIVIDER
- See Also:
- Constant Field Values
-
MIN_DISTANCE_FOR_OVERSHOOTS
public static final int MIN_DISTANCE_FOR_OVERSHOOTS
- See Also:
- Constant Field Values
-
DEFAULT_OVERSHOOT_AMOUNT
public static final int DEFAULT_OVERSHOOT_AMOUNT
- See Also:
- Constant Field Values
-
-
Method Detail
-
getOvershoots
public int getOvershoots(Flow flow, long mouseMovementMs, double distance)
Description copied from interface:OvershootManagerGet the maximum amount of overshoots the cursor does before reaching its final destination.- Specified by:
getOvershootsin interfaceOvershootManager- Parameters:
flow- the flow which is planned to be used to reach the target. (If returned overshoots > 0, then a new flow will be calculated for each overshoot.). This flow could be analyzed if overshooting is suitable. It is not available as a parameter in overshootAmount calculation, because flow itself is calculated from the movement distance, which is dependent on the overshoot amount.mouseMovementMs- the planned time for reaching the real targetdistance- the distance between mouse position and real target- Returns:
- the number of maximum overshoots used or 0 if no overshoots
-
getOvershootAmount
public java.awt.Point getOvershootAmount(double distanceToRealTargetX, double distanceToRealTargetY, long mouseMovementMs, int overshootsRemaining)Description copied from interface:OvershootManagerReturns the overshoot amount which will be added to real target, thus getting the overshoot target.- Specified by:
getOvershootAmountin interfaceOvershootManager- Parameters:
distanceToRealTargetX- distance to real target X-coordinatedistanceToRealTargetY- distance to real target Y-coordinatemouseMovementMs- the time planned for reaching the real targetovershootsRemaining- the amount of overshoots remaining, current included. Values from (n to 1), where n >= 1- Returns:
- the amount which will be added to real target, thus getting the overshoot target.
-
deriveNextMouseMovementTimeMs
public long deriveNextMouseMovementTimeMs(long mouseMovementMs, int overshootsRemaining)Description copied from interface:OvershootManagerOnce the mouse reaches the overshoot target, new trajectory with new speed is calculated for next target (can be real or overshoot target, if the next target is real target, the overshootsRemaining value is 0)- Specified by:
deriveNextMouseMovementTimeMsin interfaceOvershootManager- Parameters:
mouseMovementMs- the last mouse movement in msovershootsRemaining- the amount of overshoots remaining, including this. Values from (n to 0), where n >= 0- Returns:
- the next mouse movement time in ms
-
getMinOvershootMovementMs
public long getMinOvershootMovementMs()
-
setMinOvershootMovementMs
public void setMinOvershootMovementMs(long minOvershootMovementMs)
-
getOvershootRandomModifierDivider
public double getOvershootRandomModifierDivider()
-
setOvershootRandomModifierDivider
public void setOvershootRandomModifierDivider(double overshootRandomModifierDivider)
-
getOvershootSpeedupDivider
public double getOvershootSpeedupDivider()
-
setOvershootSpeedupDivider
public void setOvershootSpeedupDivider(double overshootSpeedupDivider)
-
getOvershoots
public int getOvershoots()
-
setOvershoots
public void setOvershoots(int overshoots)
-
getMinDistanceForOvershoots
public long getMinDistanceForOvershoots()
-
setMinDistanceForOvershoots
public void setMinDistanceForOvershoots(long minDistanceForOvershoots)
-
-