Interface MouseManager
-
Method Summary
Modifier and TypeMethodDescriptionvoidclick(int x, int y) Dispatches a mouse press event at the specified canvas coordinates.getClickPoint(AutomatedMenu menu) Gets a random click point for interacting with an automated menu's target.Gets the current mouse movement strategy.voidmove(int x, int y) Dispatches a mouse move event to the specified canvas coordinates.voidmoveAlongPath(List<Point> points) Moves the mouse cursor along a predefined path of points using default parameters.voidmoveAlongPath(List<Point> points, int baseDelay, int delayVariation, boolean easeMovement, double easeStrength, boolean fatigueEnabled, double fatigueMultiplier) Moves the mouse cursor along a predefined path with custom movement parameters.voidMoves the mouse cursor from its current position to the specified target point.voidmoveTo(AutomatedMenu automatedMenu) Moves the mouse cursor to the interaction point of an automated menu.voidrelease()Dispatches a mouse release event.resamplePath(List<Point> points, int targetPointCount) Resamples a path of points to contain a specific number of evenly distributed points.resamplePath(List<Point> points, Point targetPoint) Resamples a path of points based on the distance to a target point.voidsetMouseMovementStrategy(@NotNull MouseMovementStrategy mouseMovementStrategy) Sets the mouse movement strategy for all mouse-based interactions.
-
Method Details
-
setMouseMovementStrategy
Sets the mouse movement strategy for all mouse-based interactions.The strategy determines how the mouse cursor moves from its current position to interaction targets. Available strategies include:
- Bezier curve movement (default, natural-looking)
- Linear movement (direct path)
- Direct/instant movement (teleports cursor)
- Parameters:
mouseMovementStrategy- the mouse movement strategy (must not be null)- See Also:
-
getMouseMovementStrategy
MouseMovementStrategy getMouseMovementStrategy()Gets the current mouse movement strategy.- Returns:
- the current mouse movement strategy
-
move
void move(int x, int y) Dispatches a mouse move event to the specified canvas coordinates.This is a low-level method that directly dispatches a
MOUSE_MOVEDevent to the game canvas. Coordinates are automatically translated if the canvas is in stretched mode. For path-based movement using the configuredMouseMovementStrategy, usemoveTo(Point)instead.- Parameters:
x- the target x-coordinate on the canvasy- the target y-coordinate on the canvas- See Also:
-
click
void click(int x, int y) Dispatches a mouse press event at the specified canvas coordinates.This is a low-level method that directly dispatches a
MOUSE_PRESSEDevent to the game canvas at the given coordinates. Coordinates are automatically translated if the canvas is in stretched mode. This method does not move the cursor before clicking; usemove(int, int)first if movement is needed.- Parameters:
x- the x-coordinate to clicky- the y-coordinate to click- See Also:
-
release
void release()Dispatches a mouse release event.This is a low-level method that dispatches a
MOUSE_RELEASEDevent to the game canvas. Should be called afterclick(int, int)to complete a full click cycle, or to end a drag operation.- See Also:
-
resamplePath
Resamples a path of points based on the distance to a target point.The number of points in the resampled path is calculated based on the distance from the current mouse position to the target point, using the configured path density and minimum path points settings from
StormConfig.- Parameters:
points- the original path of points to resampletargetPoint- the target endpoint used to calculate the resampling density- Returns:
- a new list of points with density based on distance to target
- See Also:
-
resamplePath
Resamples a path of points to contain a specific number of evenly distributed points.Points are redistributed along the path's total length to achieve even spacing. The first and last points of the original path are always preserved. If the original path already has more points than requested, or if the path has fewer than 2 points, the original path is returned unchanged.
- Parameters:
points- the original path of points to resampletargetPointCount- the desired number of points in the resampled path (minimum 2)- Returns:
- a new list of points with even spacing, or the original path if resampling is not needed
-
moveAlongPath
Moves the mouse cursor along a predefined path of points using default parameters.The mouse will follow the specified path sequentially, dispatching move events at each point. Movement timing, easing, and fatigue parameters are taken from
StormConfig.- Parameters:
points- the path of points to follow- See Also:
-
moveAlongPath
void moveAlongPath(List<Point> points, int baseDelay, int delayVariation, boolean easeMovement, double easeStrength, boolean fatigueEnabled, double fatigueMultiplier) Moves the mouse cursor along a predefined path with custom movement parameters.This method provides fine-grained control over the mouse movement behavior including timing, easing, and fatigue simulation for more realistic movements.
Easing: When enabled, movement is slower at the start and end of the path, and faster in the middle, creating a more natural acceleration/deceleration curve.
Fatigue: When enabled, movement gradually slows down based on the total distance traveled, simulating human fatigue over long mouse movements.
- Parameters:
points- the path of points to followbaseDelay- the base delay in milliseconds between point movementsdelayVariation- the maximum random variation (in ms) added to the base delayeaseMovement- whether to apply ease-in-out to the movement (slower at edges, faster in middle)easeStrength- the strength of the easing effect (higher values = more pronounced slowing at edges)fatigueEnabled- whether to simulate fatigue (gradual slowdown based on distance traveled)fatigueMultiplier- the multiplier controlling fatigue intensity (higher = more slowdown over distance)
-
moveTo
Moves the mouse cursor from its current position to the specified target point.This method generates a movement path using the currently configured
MouseMovementStrategy, resamples it for smooth movement based on distance, and then executes the movement using configured timing parameters.- Parameters:
point- the target point to move to- See Also:
-
moveTo
Moves the mouse cursor to the interaction point of an automated menu.The target position is determined by calling
getClickPoint(AutomatedMenu)on the client thread, then the mouse is moved using the currently configuredMouseMovementStrategy. After the movement completes, the menu'smoveMouseflag is set tofalse.- Parameters:
automatedMenu- the automated menu to move to- See Also:
-
getClickPoint
Gets a random click point for interacting with an automated menu's target.The click point is determined using the following priority:
- The menu's explicit click point, if set
- A random point within the target
TileObject's clickbox (for game objects, walls, etc.) - A random point within the target
Actor's convex hull (for NPCs and players) - A random point on the canvas as fallback
- Parameters:
menu- the automated menu to get the click point for- Returns:
- a point suitable for clicking to interact with the menu's target
-