Compare commits
No commits in common. "a3bfd72cd0ad7e4bf4a660029423224561ba8388" and "f0fd48094eaf78645352b614dcf63000a3d8d577" have entirely different histories.
a3bfd72cd0
...
f0fd48094e
@ -2,7 +2,6 @@ import java.awt.Point
|
|||||||
|
|
||||||
fun main() {
|
fun main() {
|
||||||
// Routines.fullRunIncense(0, 0, 0, 257)
|
// Routines.fullRunIncense(0, 0, 0, 257)
|
||||||
// Routines.processInventoryAtFurnace(3566)
|
Routines.processInventoryAtFurnace(3566)
|
||||||
println(HelperFunctions.prettyTimeString(72134))
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -5,17 +5,6 @@ object HelperFunctions {
|
|||||||
/**
|
/**
|
||||||
* Computes the total number of steps needed to process the given total volume.
|
* Computes the total number of steps needed to process the given total volume.
|
||||||
*
|
*
|
||||||
* This takes the total volume that needs to be processed and th
|
|
||||||
* and calculates the total steps required.
|
|
||||||
* Usage examples:
|
|
||||||
* ```
|
|
||||||
* val total = 550
|
|
||||||
* val perStep = 200
|
|
||||||
* val steps = calculateTotalSteps(total, perStep) // 3 steps
|
|
||||||
*
|
|
||||||
* val steps = calculateTotalSteps(1000, 100) // 10 steps
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param totalVolume the total amount that needs to be processed
|
* @param totalVolume the total amount that needs to be processed
|
||||||
* @param volumePerStep the amount to process per step
|
* @param volumePerStep the amount to process per step
|
||||||
* @return the number of steps required to process the total volume
|
* @return the number of steps required to process the total volume
|
||||||
@ -31,21 +20,6 @@ object HelperFunctions {
|
|||||||
/**
|
/**
|
||||||
* Prints a progress report to console showing current step, total steps, elapsed time, and estimated remaining time.
|
* Prints a progress report to console showing current step, total steps, elapsed time, and estimated remaining time.
|
||||||
*
|
*
|
||||||
* This takes the current step number, total steps, and elapsed duration and prints a progress report.
|
|
||||||
* Typical usage is to call this within a loop, passing the loop index for current step and total loop count.
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* Usage example:
|
|
||||||
* ```
|
|
||||||
* val totalSteps = 100
|
|
||||||
* val start = System.currentTimeMillis()
|
|
||||||
* for (i in 1..totalSteps) {
|
|
||||||
* // Do work
|
|
||||||
*
|
|
||||||
* report(i, totalSteps, System.currentTimeMillis() - start)
|
|
||||||
* }
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param step The current step number
|
* @param step The current step number
|
||||||
* @param of The total number of steps
|
* @param of The total number of steps
|
||||||
* @param dur The elapsed duration so far in milliseconds
|
* @param dur The elapsed duration so far in milliseconds
|
||||||
@ -58,16 +32,6 @@ object HelperFunctions {
|
|||||||
/**
|
/**
|
||||||
* Converts a duration in milliseconds to a human-readable string.
|
* Converts a duration in milliseconds to a human-readable string.
|
||||||
*
|
*
|
||||||
* This takes a duration in ms and converts it to a formatted string like "2h13m4s".
|
|
||||||
*
|
|
||||||
* Usage example:
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* val duration = 72134 // ms
|
|
||||||
* val timeStr = prettyTimeString(duration)
|
|
||||||
* // "1m12s"
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param durationMillis The duration to convert, in milliseconds
|
* @param durationMillis The duration to convert, in milliseconds
|
||||||
* @return A string representation of the duration, in the format XhYmZs
|
* @return A string representation of the duration, in the format XhYmZs
|
||||||
*/
|
*/
|
||||||
@ -97,10 +61,9 @@ object HelperFunctions {
|
|||||||
* It then formats this location into a string declaring a val with the provided
|
* It then formats this location into a string declaring a val with the provided
|
||||||
* variable name, like:
|
* variable name, like:
|
||||||
*
|
*
|
||||||
* ```
|
* ```
|
||||||
* val location = getPointerLocationAsValDeclarationString("clickPoint")
|
* val myPoint = Point(123, 456)
|
||||||
* // val clickPoint = Point(123, 456)
|
* ```
|
||||||
* ```
|
|
||||||
*
|
*
|
||||||
* The delay before getting the pointer location helps ensure the mouse has
|
* The delay before getting the pointer location helps ensure the mouse has
|
||||||
* settled after any prior movements.
|
* settled after any prior movements.
|
||||||
|
|||||||
@ -9,13 +9,6 @@ import java.awt.event.KeyEvent
|
|||||||
*
|
*
|
||||||
* Implementations will contain the game-specific logic to interact with the
|
* Implementations will contain the game-specific logic to interact with the
|
||||||
* RuneScape client and APIs to carry out the actions.
|
* RuneScape client and APIs to carry out the actions.
|
||||||
*
|
|
||||||
* Usage example:
|
|
||||||
* ```
|
|
||||||
* val orch = RSOrchestrator.getInstance()
|
|
||||||
* val params = StandingTaskParams(...)
|
|
||||||
* orch.doStandingTask(orch, params)
|
|
||||||
* ```
|
|
||||||
*/
|
*/
|
||||||
interface RSOrchestrator : Orchestrator {
|
interface RSOrchestrator : Orchestrator {
|
||||||
companion object {
|
companion object {
|
||||||
@ -28,13 +21,6 @@ interface RSOrchestrator : Orchestrator {
|
|||||||
* It withdraws items from the bank, crafts a batch of items, deposits crafted items,
|
* It withdraws items from the bank, crafts a batch of items, deposits crafted items,
|
||||||
* and repeats.
|
* and repeats.
|
||||||
*
|
*
|
||||||
* Usage example:
|
|
||||||
* ```
|
|
||||||
* val orch = RSOrchestrator.getInstance()
|
|
||||||
* val params = StandingTaskParams(...)
|
|
||||||
* orch.doStandingTask(orch, params)
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param orchestrator The [RSOrchestrator] that will execute the actions.
|
* @param orchestrator The [RSOrchestrator] that will execute the actions.
|
||||||
* @param params The [StandingTaskParams] configuring the task details.
|
* @param params The [StandingTaskParams] configuring the task details.
|
||||||
* @return Unit.
|
* @return Unit.
|
||||||
@ -56,14 +42,6 @@ interface RSOrchestrator : Orchestrator {
|
|||||||
*
|
*
|
||||||
* It will repeat this loop for the specified total volume of items to craft, doing the given volume per loop iteration.
|
* It will repeat this loop for the specified total volume of items to craft, doing the given volume per loop iteration.
|
||||||
*
|
*
|
||||||
* Usage example:
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* val orch = RSOrchestrator.getInstance()
|
|
||||||
* val params = TravelTaskParams(...)
|
|
||||||
* orch.doTravelTask(orch, params)
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param orchestrator The [RSOrchestrator] instance that will execute the actual actions.
|
* @param orchestrator The [RSOrchestrator] instance that will execute the actual actions.
|
||||||
* @param params The [TravelTaskParams] configuring the crafting loop details.
|
* @param params The [TravelTaskParams] configuring the crafting loop details.
|
||||||
* @return Unit.
|
* @return Unit.
|
||||||
@ -99,12 +77,6 @@ interface RSOrchestrator : Orchestrator {
|
|||||||
* - Clicks the default "Make" hotkey to start crafting.
|
* - Clicks the default "Make" hotkey to start crafting.
|
||||||
* - Waits for the specified crafting duration plus random variance.
|
* - Waits for the specified crafting duration plus random variance.
|
||||||
*
|
*
|
||||||
* Usage example:
|
|
||||||
* ```
|
|
||||||
* val params = StandingTaskParams(...)
|
|
||||||
* orchestrator.processAtBank(params)
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param taskParams The StandingTaskParams configuring the task details like bank location, hotkeys, durations etc.
|
* @param taskParams The StandingTaskParams configuring the task details like bank location, hotkeys, durations etc.
|
||||||
*/
|
*/
|
||||||
fun processAtBank(
|
fun processAtBank(
|
||||||
@ -129,18 +101,6 @@ interface RSOrchestrator : Orchestrator {
|
|||||||
* - Clicks the "Make" button using the hotkey to craft items.
|
* - Clicks the "Make" button using the hotkey to craft items.
|
||||||
* - Waits for the randomized crafting duration.
|
* - Waits for the randomized crafting duration.
|
||||||
*
|
*
|
||||||
* Usage example:
|
|
||||||
* ```
|
|
||||||
* val params = TravelTaskParams(
|
|
||||||
* bankLocation = Point(100, 200),
|
|
||||||
* stationLocation = Point(300, 400),
|
|
||||||
* withdrawHotkey = KeyEvent.VK_F1,
|
|
||||||
* craftHotkey = KeyEvent.VK_2,
|
|
||||||
* // ...other params
|
|
||||||
* )
|
|
||||||
* orchestrator.processAtStationNearBank(params)
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param taskParams The TravelTaskParams configuring the task details like locations, durations, hotkeys etc.
|
* @param taskParams The TravelTaskParams configuring the task details like locations, durations, hotkeys etc.
|
||||||
*/
|
*/
|
||||||
fun processAtStationNearBank(
|
fun processAtStationNearBank(
|
||||||
@ -148,23 +108,9 @@ interface RSOrchestrator : Orchestrator {
|
|||||||
)
|
)
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Gets the screen point location of the bank.
|
* Gets the bank location point.
|
||||||
*
|
*
|
||||||
* This returns the x,y screen coordinates where the bank is located, which can be used to interact with the bank.
|
* @return The [Point] representing the x,y screen coordinates of the bank location.
|
||||||
*
|
|
||||||
* Usage:
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* val bankPoint = orchestrator.getBankLocation()
|
|
||||||
*
|
|
||||||
* // Left click the bank location to open the interface
|
|
||||||
* orchestrator.moveMouseLeftClickAndSleep(bankPoint, 100)
|
|
||||||
*
|
|
||||||
* // Withdraw preset inventory at bank
|
|
||||||
* orchestrator.keyPress(KeyEvent.VK_F1)
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @return The Point representing the x,y screen coordinates of the bank location.
|
|
||||||
*/
|
*/
|
||||||
fun getBankPoint(): Point
|
fun getBankPoint(): Point
|
||||||
}
|
}
|
||||||
@ -175,20 +121,6 @@ interface RSOrchestrator : Orchestrator {
|
|||||||
* This class handles executing RuneScape automation tasks by controlling
|
* This class handles executing RuneScape automation tasks by controlling
|
||||||
* the game client via image recognition and input emulation.
|
* the game client via image recognition and input emulation.
|
||||||
*
|
*
|
||||||
* Usage examples:
|
|
||||||
* Travel between bank and crafting station:
|
|
||||||
* ```
|
|
||||||
* val agent = RSAgent.getInstance()
|
|
||||||
* val travelParams = TravelTaskParams(...)
|
|
||||||
* agent.doTravelTask(agent, travelParams)
|
|
||||||
* ```
|
|
||||||
* Craft while standing at bank:
|
|
||||||
* ```
|
|
||||||
* val standingParams = StandingTaskParams(...)
|
|
||||||
* agent.doStandingTask(agent, standingParams)
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
*
|
|
||||||
* @param automaton The [Automaton] instance used to control the game. Defaults to [RobotController].
|
* @param automaton The [Automaton] instance used to control the game. Defaults to [RobotController].
|
||||||
*/
|
*/
|
||||||
private class RSAgent(override val automaton: Automaton = RobotController()) : RSOrchestrator {
|
private class RSAgent(override val automaton: Automaton = RobotController()) : RSOrchestrator {
|
||||||
@ -234,13 +166,6 @@ private class RSAgent(override val automaton: Automaton = RobotController()) : R
|
|||||||
* - Clicks the default "Accept" hotkey to start crafting.
|
* - Clicks the default "Accept" hotkey to start crafting.
|
||||||
* - Waits for the specified crafting duration plus random variance.
|
* - Waits for the specified crafting duration plus random variance.
|
||||||
*
|
*
|
||||||
* Usage example:
|
|
||||||
*
|
|
||||||
* ```
|
|
||||||
* val params = StandingTaskParams(...)
|
|
||||||
* orchestrator.processAtBank(params)
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param taskParams The [StandingTaskParams] configuring the task details like bank location, hotkeys, and durations.
|
* @param taskParams The [StandingTaskParams] configuring the task details like bank location, hotkeys, and durations.
|
||||||
*/
|
*/
|
||||||
override fun processAtBank(
|
override fun processAtBank(
|
||||||
@ -279,12 +204,6 @@ private class RSAgent(override val automaton: Automaton = RobotController()) : R
|
|||||||
*
|
*
|
||||||
* - Waits for the randomized crafting duration.
|
* - Waits for the randomized crafting duration.
|
||||||
*
|
*
|
||||||
* Usage example:
|
|
||||||
* ```
|
|
||||||
* val params = TravelTaskParams(...)
|
|
||||||
* orchestrator.processAtStationNearBank(params)
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param taskParams The [TravelTaskParams] configuring the task details.
|
* @param taskParams The [TravelTaskParams] configuring the task details.
|
||||||
*/
|
*/
|
||||||
override fun processAtStationNearBank(
|
override fun processAtStationNearBank(
|
||||||
@ -327,15 +246,6 @@ private class RSAgent(override val automaton: Automaton = RobotController()) : R
|
|||||||
*
|
*
|
||||||
* The delay allows the mouse to settle before sampling its position.
|
* The delay allows the mouse to settle before sampling its position.
|
||||||
*
|
*
|
||||||
* Usage example:
|
|
||||||
* ```
|
|
||||||
* // Get bank location from user mouse position
|
|
||||||
* val bankPoint = orchestrator.getBankPoint()
|
|
||||||
* // Left click the bank to open the interface
|
|
||||||
* orchestrator.automaton.mouseMove(bankPoint)
|
|
||||||
* orchestrator.automaton.mouseClick(InputEvent.BUTTON1_DOWN_MASK)
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @return The Point position of the mouse after user positions it.
|
* @return The Point position of the mouse after user positions it.
|
||||||
*/
|
*/
|
||||||
override fun getBankPoint(): Point {
|
override fun getBankPoint(): Point {
|
||||||
@ -351,12 +261,6 @@ private class RSAgent(override val automaton: Automaton = RobotController()) : R
|
|||||||
*
|
*
|
||||||
* A random variance is also added to the sleep duration to add some less-robotic behavior.
|
* A random variance is also added to the sleep duration to add some less-robotic behavior.
|
||||||
*
|
*
|
||||||
* Usage example:
|
|
||||||
* ```
|
|
||||||
* val ticks = 10 // Sleep for 10 game ticks
|
|
||||||
* orchestrator.sleepTicks(ticks)
|
|
||||||
* ```
|
|
||||||
*
|
|
||||||
* @param n The number of game ticks to sleep for.
|
* @param n The number of game ticks to sleep for.
|
||||||
*/
|
*/
|
||||||
fun sleepForNTicks(n: Long) {
|
fun sleepForNTicks(n: Long) {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user