Class AbstractMouseDestination<T>
- java.lang.Object
-
- org.dreambot.api.input.mouse.destination.AbstractMouseDestination<T>
-
- Type Parameters:
T
- the type parameter
- Direct Known Subclasses:
EntityDestination
,MiniMapTileDestination
,PointDestination
,ShapeDestination
,TileDestination
public abstract class AbstractMouseDestination<T> extends java.lang.Object
Created with IntelliJ IDEA.- Since:
- : 2/9/2015 Time : 5:42 PM
-
-
Field Summary
Fields Modifier and Type Field Description static int
AREA_DESTINATION
static int
ENTITY_DESTINATION
static int
MINIMAP_DESTINATION
static int
NULL
static int
POINT_DESTINATION
static int
POLYGON_DESTINATION
static int
RECTANGLE_DESTINATION
static int
SHAPE_DESTINATION
static int
TILE_DESTINATION
-
Constructor Summary
Constructors Constructor Description AbstractMouseDestination(T destination)
Creates a new Abstract Mouse Destination from a generic type.
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description boolean
canInteract()
Evaluates whether an interaction for this mouse destination is allowed to be performed.boolean
canInteract(java.lang.String action)
boolean
contains(java.awt.Point point)
Determines if point is contained inside of destination shape.boolean
contains(AbstractMouseDestination destination)
Determines if point is contained inside of destination shape.boolean
containsMouse()
Determines if the destination shape contains the mouse.java.awt.geom.Area
getArea()
Gets the area of the abstract destination shape.java.awt.Rectangle
getBoundingBox()
Gets the bounding box of the abstract destination shape.java.awt.Point
getCenterPoint()
Gets the center point within the bounding box of this mouse destination.java.awt.Rectangle
getContainmentBounds()
Gets the rectangle to contain the mouse inside.abstract java.awt.Shape
getDestinationShape()
Gets the abstract destination shape.Condition
getInterrupt()
java.awt.Point
getSuitablePoint()
Gets a gaussian distributed offset point within the bounding box of this mouse destination.T
getTarget()
Gets destination target.boolean
handleCamera()
Handles camera portion of event interaction.boolean
handleCamera(boolean withZoom, Condition interrupt)
Handles camera portion of event interaction.boolean
handleWalk()
Handles walking portion of event interactions.abstract boolean
isVisible()
Determines whether this destination is visible.void
setContainmentBounds(java.awt.Rectangle containmentBounds)
Sets containment bounds rectangle.void
setInterrupt(Condition interrupt)
java.lang.String
toString()
int
type()
Mouse destination type id.boolean
valid()
Determines if the current destination is valid and visible.boolean
verifyPostInteract()
Verification/callback after your interaction has been completedEntityDestination
would implement this to check for crosshair color, for example.
-
-
-
Field Detail
-
NULL
public static final int NULL
- See Also:
- Constant Field Values
-
POINT_DESTINATION
public static final int POINT_DESTINATION
- See Also:
- Constant Field Values
-
ENTITY_DESTINATION
public static final int ENTITY_DESTINATION
- See Also:
- Constant Field Values
-
AREA_DESTINATION
public static final int AREA_DESTINATION
- See Also:
- Constant Field Values
-
SHAPE_DESTINATION
public static final int SHAPE_DESTINATION
- See Also:
- Constant Field Values
-
RECTANGLE_DESTINATION
public static final int RECTANGLE_DESTINATION
- See Also:
- Constant Field Values
-
POLYGON_DESTINATION
public static final int POLYGON_DESTINATION
- See Also:
- Constant Field Values
-
MINIMAP_DESTINATION
public static final int MINIMAP_DESTINATION
- See Also:
- Constant Field Values
-
TILE_DESTINATION
public static final int TILE_DESTINATION
- See Also:
- Constant Field Values
-
-
Constructor Detail
-
AbstractMouseDestination
public AbstractMouseDestination(T destination)
Creates a new Abstract Mouse Destination from a generic type.- Parameters:
destination
- Your destination, generic
-
-
Method Detail
-
getTarget
public T getTarget()
Gets destination target.- Returns:
- the destination target.
-
getDestinationShape
public abstract java.awt.Shape getDestinationShape()
Gets the abstract destination shape.- Returns:
- The destination shape.
-
getBoundingBox
public java.awt.Rectangle getBoundingBox()
Gets the bounding box of the abstract destination shape.- Returns:
- The
Rectangle
bounding box of the abstract destination shape.
-
handleCamera
public boolean handleCamera()
Handles camera portion of event interaction. This is used internally by interact().- Returns:
- True if the event succeeded.
-
handleCamera
public boolean handleCamera(boolean withZoom, Condition interrupt)
Handles camera portion of event interaction. This is used internally by interact().- Returns:
- True if the event succeeded.
-
handleWalk
public boolean handleWalk()
Handles walking portion of event interactions. This is used internally by interact() Default implementation is to just return true, required to override this in any implementations.- Returns:
- True if the event succeeded or is not needed in the destination implementation.
-
getArea
public java.awt.geom.Area getArea()
Gets the area of the abstract destination shape.- Returns:
- The
Area
generated from the abstract destination shape.
-
getContainmentBounds
public java.awt.Rectangle getContainmentBounds()
Gets the rectangle to contain the mouse inside. Useful for menus.- Returns:
- The containment bounds rectangle.
-
setContainmentBounds
public void setContainmentBounds(java.awt.Rectangle containmentBounds)
Sets containment bounds rectangle.- Parameters:
containmentBounds
- the containmentBounds to set, if null will create a default rectangle.
-
isVisible
public abstract boolean isVisible()
Determines whether this destination is visible.- Returns:
- Whether this destination is visible.
-
valid
public boolean valid()
Determines if the current destination is valid and visible.- Returns:
- true if destination is valid and visible.
-
type
public int type()
Mouse destination type id.- Returns:
- the mouse destination type id.
-
getCenterPoint
public java.awt.Point getCenterPoint()
Gets the center point within the bounding box of this mouse destination.- Returns:
- center point of the bounding box of this mouse destination
-
containsMouse
public boolean containsMouse()
Determines if the destination shape contains the mouse.- Returns:
- true if destination shape contains mouse, otherwise false.
-
contains
public boolean contains(java.awt.Point point)
Determines if point is contained inside of destination shape.- Parameters:
point
- the point which to check.- Returns:
- true if point is contained inside of shape, otherwise false.
-
contains
public boolean contains(AbstractMouseDestination destination)
Determines if point is contained inside of destination shape.- Parameters:
destination
- the destination which to check.- Returns:
- true if point is contained inside of shape, otherwise false.
-
getSuitablePoint
public java.awt.Point getSuitablePoint()
Gets a gaussian distributed offset point within the bounding box of this mouse destination.- Returns:
- point within the bounding box of this mouse destination .
-
canInteract
public boolean canInteract()
Evaluates whether an interaction for this mouse destination is allowed to be performed.- Returns:
- True if an interaction is allowed to be performed.
-
canInteract
public boolean canInteract(java.lang.String action)
-
verifyPostInteract
public boolean verifyPostInteract()
Verification/callback after your interaction has been completedEntityDestination
would implement this to check for crosshair color, for example.- Returns:
- default of True if not implemented, else return of implementation
-
toString
public java.lang.String toString()
- Overrides:
toString
in classjava.lang.Object
-
getInterrupt
public Condition getInterrupt()
-
setInterrupt
public void setInterrupt(Condition interrupt)
-
-