Compare commits

..

No commits in common. "8414358708009bbb12e25b85897a1db954be4424" and "a3bfd72cd0ad7e4bf4a660029423224561ba8388" have entirely different histories.

2 changed files with 28 additions and 116 deletions

View File

@ -14,7 +14,7 @@ import java.awt.event.KeyEvent
* ``` * ```
* val orch = RSOrchestrator.getInstance() * val orch = RSOrchestrator.getInstance()
* val params = StandingTaskParams(...) * val params = StandingTaskParams(...)
* RSOrchestrator.doStandingTask(orch, params) * orch.doStandingTask(orch, params)
* ``` * ```
*/ */
interface RSOrchestrator : Orchestrator { interface RSOrchestrator : Orchestrator {
@ -32,7 +32,7 @@ interface RSOrchestrator : Orchestrator {
* ``` * ```
* val orch = RSOrchestrator.getInstance() * val orch = RSOrchestrator.getInstance()
* val params = StandingTaskParams(...) * val params = StandingTaskParams(...)
* RSOrchestrator.doStandingTask(orch, params) * orch.doStandingTask(orch, params)
* ``` * ```
* *
* @param orchestrator The [RSOrchestrator] that will execute the actions. * @param orchestrator The [RSOrchestrator] that will execute the actions.
@ -61,7 +61,7 @@ interface RSOrchestrator : Orchestrator {
* ``` * ```
* val orch = RSOrchestrator.getInstance() * val orch = RSOrchestrator.getInstance()
* val params = TravelTaskParams(...) * val params = TravelTaskParams(...)
* RSOrchestrator.doTravelTask(orch, params) * 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.
@ -107,7 +107,9 @@ interface RSOrchestrator : Orchestrator {
* *
* @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(taskParams: StandingTaskParams) fun processAtBank(
taskParams: StandingTaskParams
)
/** /**
* Handles the crafting workflow when at a station near the bank. * Handles the crafting workflow when at a station near the bank.
@ -129,13 +131,21 @@ interface RSOrchestrator : Orchestrator {
* *
* Usage example: * Usage example:
* ``` * ```
* val params = TravelTaskParams(...) * val params = TravelTaskParams(
* bankLocation = Point(100, 200),
* stationLocation = Point(300, 400),
* withdrawHotkey = KeyEvent.VK_F1,
* craftHotkey = KeyEvent.VK_2,
* // ...other params
* )
* orchestrator.processAtStationNearBank(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(taskParams: TravelTaskParams) fun processAtStationNearBank(
taskParams: TravelTaskParams
)
/** /**
* Gets the screen point location of the bank. * Gets the screen point location of the bank.
@ -151,7 +161,7 @@ interface RSOrchestrator : Orchestrator {
* orchestrator.moveMouseLeftClickAndSleep(bankPoint, 100) * orchestrator.moveMouseLeftClickAndSleep(bankPoint, 100)
* *
* // Withdraw preset inventory at bank * // Withdraw preset inventory at bank
* orchestrator.automaton.keyPress(KeyEvent.VK_F1) * orchestrator.keyPress(KeyEvent.VK_F1)
* ``` * ```
* *
* @return The Point representing the x,y screen coordinates of the bank location. * @return The Point representing the x,y screen coordinates of the bank location.
@ -175,7 +185,7 @@ interface RSOrchestrator : Orchestrator {
* Craft while standing at bank: * Craft while standing at bank:
* ``` * ```
* val standingParams = StandingTaskParams(...) * val standingParams = StandingTaskParams(...)
* orchestrator.doStandingTask(agent, standingParams) * agent.doStandingTask(agent, standingParams)
* ``` * ```
* *
* *

View File

@ -2,29 +2,17 @@ import java.awt.Point
import java.awt.event.KeyEvent import java.awt.event.KeyEvent
/** /**
* Routines object containing reusable workflows for common scripts. * Routines contains utility functions to perform common bot tasks and workflows.
* *
* This object encapsulates reusable routines for common botting workflows. * This includes functions like:
* It provides an easy way to invoke these flows without having to reimplement * - fullRunIncense: Handles the full incense stick crafting workflow.
* the lower-level actions each time. * - processInventoryAtFurnace: Processes a total volume of inventory at a furnace near the bank.
* - processRefinedPlanksIntoFrames:Processes refined planks into frames at a sawmill near the bank.
* *
* The routines are structured as standalone methods that accept the necessary * The routines use an Agent instance to perform actions like banking,
* parameters. This allows them to be called independently and composed in * depositing items, withdrawing presets, etc.
* different combinations.
* *
* For example, the fullRunIncense routine orchestrates the entire incense * The routines are encapsulated for pure convenience
* stick crafting workflow by invoking the individual steps:
*
* - cleanHerbs
* - cutIncenseSticks
* - coatIncenseSticks
* - infuseIncenseSticks
*
* The individual steps can also be called independently as needed.
*
* This structure makes the routines reusable, customizable, and composable.
* Scripts can invoke the routines directly rather than reimplementing the
* underlying actions. Parameters allow customizing volumes, locations etc.
*/ */
object Routines { object Routines {
/** /**
@ -52,18 +40,7 @@ object Routines {
* - Infusing clean herbs into sticks * - Infusing clean herbs into sticks
* *
* It loops through each step based on the provided volumes, performing the * It loops through each step based on the provided volumes, performing the
* actions at the bank. * actions at the bank. The bank location is prompted from the user.
*
* Usage example:
*
* ```
* val herbs = 1000
* val logs = 2000
* val ashes = 1500
* val cleanHerbs = herbs + 150
*
* Routines.fullRunIncense(herbs, logs, ashes, cleanHerbs)
* ```
* *
* Progress is printed after each step. Total elapsed time is printed at the end. * Progress is printed after each step. Total elapsed time is printed at the end.
*/ */
@ -120,18 +97,6 @@ object Routines {
* - Depositing clean herbs * - Depositing clean herbs
* *
* It performs the actions at the bank location using the provided agent. * It performs the actions at the bank location using the provided agent.
*
* Usage examples:
* ```
* val volume = 1000
* val bankPoint = Point(100, 200)
* val agent = RSAgent.getInstance()
* Routines.cleanHerbs(volume, agent, bankPoint)
* ```
* Can also omit agent and bankPoint to use defaults:
* ```
* Routines.cleanHerbs(1000)
* ```
*/ */
fun cleanHerbs(volume: Int, agent: RSOrchestrator = RSOrchestrator.getInstance(), bankPoint: Point = agent.getBankPoint()) { fun cleanHerbs(volume: Int, agent: RSOrchestrator = RSOrchestrator.getInstance(), bankPoint: Point = agent.getBankPoint()) {
val params = StandingTaskParams( val params = StandingTaskParams(
@ -158,19 +123,6 @@ object Routines {
* - Withdrawing magic log preset * - Withdrawing magic log preset
* - Cutting magic logs into incense sticks without dialog * - Cutting magic logs into incense sticks without dialog
* - Depositing incense sticks * - Depositing incense sticks
*
* Usage examples:
* ```
* val logs = 1000
* val bankPoint = Point(100, 200)
* val agent = RSAgent.getInstance()
*
* Routines.cutIncenseSticks(logs, agent, bankPoint)
* ```
* Can also omit agent and bankPoint to use defaults:
* ```
* Routines.cutIncenseSticks(1000)
* ```
*/ */
fun cutIncenseSticks(volume: Int, agent: RSOrchestrator = RSOrchestrator.getInstance(), bankPoint: Point = agent.getBankPoint()) { fun cutIncenseSticks(volume: Int, agent: RSOrchestrator = RSOrchestrator.getInstance(), bankPoint: Point = agent.getBankPoint()) {
val params = StandingTaskParams( val params = StandingTaskParams(
@ -197,20 +149,6 @@ object Routines {
* - Withdrawing incense stick preset * - Withdrawing incense stick preset
* - Coating incense sticks with ashes using hotkey * - Coating incense sticks with ashes using hotkey
* - Depositing coated sticks * - Depositing coated sticks
*
* Usage examples:
* ```
* val sticks = 1000
* val bankPoint = Point(100, 200)
* val agent = RSAgent.getInstance()
*
* Routines.coatIncenseSticks(sticks, agent, bankPoint)
* ```
* Can also omit agent and bankPoint to use defaults:
*
* ```
* Routines.coatIncenseSticks(1000)
* ```
*/ */
fun coatIncenseSticks(volume: Int, agent: RSOrchestrator = RSOrchestrator.getInstance(), bankPoint: Point = agent.getBankPoint()) { fun coatIncenseSticks(volume: Int, agent: RSOrchestrator = RSOrchestrator.getInstance(), bankPoint: Point = agent.getBankPoint()) {
val params = StandingTaskParams( val params = StandingTaskParams(
@ -236,19 +174,6 @@ object Routines {
* - Withdrawing incense stick preset * - Withdrawing incense stick preset
* - Infusing incense sticks with herbs using hotkey * - Infusing incense sticks with herbs using hotkey
* - Depositing infused incense sticks * - Depositing infused incense sticks
*
* Usage examples:
* ```
* val sticks = 1000
* val bankPoint = Point(100, 200)
* val agent = RSAgent.getInstance()
*
* Routines.infuseIncenseSticks(sticks, agent, bankPoint)
* ```
* Can also omit agent and bankPoint to use defaults:
* ```
* Routines.infuseIncenseSticks(1000)
* ```
*/ */
fun infuseIncenseSticks(volume: Int, agent: RSOrchestrator = RSOrchestrator.getInstance(), bankPoint: Point = agent.getBankPoint()) { fun infuseIncenseSticks(volume: Int, agent: RSOrchestrator = RSOrchestrator.getInstance(), bankPoint: Point = agent.getBankPoint()) {
val params = StandingTaskParams( val params = StandingTaskParams(
@ -276,14 +201,6 @@ object Routines {
* - The volume, volume per trip, bank point, crafting hotkey, and other details * - The volume, volume per trip, bank point, crafting hotkey, and other details
* - It calls the orchestrator's doStandingTask() method to execute the task. * - It calls the orchestrator's doStandingTask() method to execute the task.
* *
* Usage example:
* ```
* val volume = 1000
* val bankPoint = Point(100, 200)
* val agent = RSAgent.getInstance()
* Routines.craftPotionsAtBank(volume, agent, bankPoint)
* ```
*
* Progress is automatically printed during execution. * Progress is automatically printed during execution.
* *
* @deprecated This method needs validation before use in production. * @deprecated This method needs validation before use in production.
@ -319,15 +236,6 @@ object Routines {
* *
* It calls the orchestrator's doTravelTask() method to execute the grinding task. * It calls the orchestrator's doTravelTask() method to execute the grinding task.
* *
* Usage example:
* ```
* val volume = 1000
* val travelDuration = 5000 // 5 seconds
* val bankPoint = Point(100, 200)
* val wellPoint = Point(300, 400) // Prompted from user
* Routines.potionGrindWithWell(volume, travelDuration, bankPoint, wellPoint)
* ```
*
* Progress is automatically printed during execution. * Progress is automatically printed during execution.
* *
* @deprecated This method needs validation before use in production. * @deprecated This method needs validation before use in production.
@ -374,12 +282,6 @@ object Routines {
* The furnace and bank locations are passed in as specific Point locations. * The furnace and bank locations are passed in as specific Point locations.
* The agent handles the navigation and banking actions. * The agent handles the navigation and banking actions.
* *
* Usage example:
*
* ```
* Routines.processAtFurnaceNearBank(1500)
* ```
*
* Before processing, the camera is reset to align points. * Before processing, the camera is reset to align points.
*/ */
fun processInventoryAtFurnace(volume: Int) { fun processInventoryAtFurnace(volume: Int) {