diff --git a/src/main/kotlin/controllers/DesktopController.kt b/src/main/kotlin/controllers/DesktopController.kt index 758d96c..0f87ab3 100644 --- a/src/main/kotlin/controllers/DesktopController.kt +++ b/src/main/kotlin/controllers/DesktopController.kt @@ -1,6 +1,6 @@ package controllers -import params.WiggleParams +import params.MouseWiggleParams import java.awt.MouseInfo import java.awt.Point import kotlin.random.Random @@ -39,7 +39,7 @@ interface DesktopController { * Gets a point near the given [point], with some random wiggle. * * This generates a new point that is randomly offset from the given [point] - * by an amount controlled by the given [WiggleParams]. + * by an amount controlled by the given [MouseWiggleParams]. * * Usage example: * @@ -63,7 +63,7 @@ interface DesktopController { * @param params The wiggle parameters that control the random offset amount * @return A new [Point] near the given point with some random wiggle applied */ - fun getAlmostPoint(point: Point, params: WiggleParams = WiggleParams()): Point { + fun getAlmostPoint(point: Point, params: MouseWiggleParams = MouseWiggleParams()): Point { val xDel = Random.nextInt(0, params.xWiggle) val yDel = Random.nextInt(0, params.yWiggle) val xDir = if (Random.nextDouble() > 0.5) { diff --git a/src/main/kotlin/game_logic/runescape/RSAgent.kt b/src/main/kotlin/game_logic/runescape/RSAgent.kt index 765f6bf..5ae4eea 100644 --- a/src/main/kotlin/game_logic/runescape/RSAgent.kt +++ b/src/main/kotlin/game_logic/runescape/RSAgent.kt @@ -2,7 +2,7 @@ package game_logic.runescape import controllers.Automaton import controllers.RobotAutomaton -import params.WiggleParams +import params.MouseWiggleParams import params.StandingTaskParams import params.TravelTaskParams import java.awt.Point @@ -86,7 +86,7 @@ class RSAgent(override val automaton: Automaton = RobotAutomaton()) : RSOrchestr taskParams: StandingTaskParams ) { //open the bank located by the chest parameter - moveMouseLeftClickAndSleep(automaton.getAlmostPoint(taskParams.bankPoint, WiggleParams(10, 10)), 900, 400) + moveMouseLeftClickAndSleep(automaton.getAlmostPoint(taskParams.bankPoint, MouseWiggleParams(10, 10)), 900, 400) //withdraw the desired inventory preset automaton.keyPress(taskParams.bankPresetHotkey) //sleep for a server tick @@ -131,7 +131,7 @@ class RSAgent(override val automaton: Automaton = RobotAutomaton()) : RSOrchestr ) { //move to the bank and open the interface moveMouseLeftClickAndSleep( - automaton.getAlmostPoint(taskParams.bankPoint, WiggleParams(10, 10)), + automaton.getAlmostPoint(taskParams.bankPoint, MouseWiggleParams(10, 10)), taskParams.travelDurationMillis, taskParams.travelDurationVarianceMillis ) diff --git a/src/main/kotlin/params/WiggleParams.kt b/src/main/kotlin/params/MouseWiggleParams.kt similarity index 96% rename from src/main/kotlin/params/WiggleParams.kt rename to src/main/kotlin/params/MouseWiggleParams.kt index 87c2dda..9cb5dfd 100644 --- a/src/main/kotlin/params/WiggleParams.kt +++ b/src/main/kotlin/params/MouseWiggleParams.kt @@ -24,7 +24,7 @@ package params * @param xWiggle The max amount of variance in x direction. Default 25. * @param yWiggle The max amount of variance in y direction. Default 25. */ -data class WiggleParams( +data class MouseWiggleParams( val xWiggle: Int = 25, val yWiggle: Int = 25 ) diff --git a/src/test/kotlin/controllers/DesktopControllerTest.kt b/src/test/kotlin/controllers/DesktopControllerTest.kt index 0e7c750..11e2b84 100644 --- a/src/test/kotlin/controllers/DesktopControllerTest.kt +++ b/src/test/kotlin/controllers/DesktopControllerTest.kt @@ -1,6 +1,6 @@ package controllers -import params.WiggleParams +import params.MouseWiggleParams import kotlin.test.* import org.mockito.Mockito.* import java.awt.Point @@ -47,7 +47,7 @@ class DesktopControllerTest { @Test fun `getAlmostPoint returns wiggly point`() { val controller = mock(DesktopController::class.java) - val params = WiggleParams(xWiggle = 10, yWiggle = 10) + val params = MouseWiggleParams(xWiggle = 10, yWiggle = 10) // Mock random wiggle `when`(controller.getAlmostPoint(Point(100, 200), params))