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 params = StandingTaskParams(...)
* RSOrchestrator.doStandingTask(orch, params)
* orch.doStandingTask(orch, params)
* ```
*/
interface RSOrchestrator : Orchestrator {
@ -32,7 +32,7 @@ interface RSOrchestrator : Orchestrator {
* ```
* val orch = RSOrchestrator.getInstance()
* val params = StandingTaskParams(...)
* RSOrchestrator.doStandingTask(orch, params)
* orch.doStandingTask(orch, params)
* ```
*
* @param orchestrator The [RSOrchestrator] that will execute the actions.
@ -61,7 +61,7 @@ interface RSOrchestrator : Orchestrator {
* ```
* val orch = RSOrchestrator.getInstance()
* val params = TravelTaskParams(...)
* RSOrchestrator.doTravelTask(orch, params)
* orch.doTravelTask(orch, params)
* ```
*
* @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.
*/
fun processAtBank(taskParams: StandingTaskParams)
fun processAtBank(
taskParams: StandingTaskParams
)
/**
* Handles the crafting workflow when at a station near the bank.
@ -129,13 +131,21 @@ interface RSOrchestrator : Orchestrator {
*
* 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)
* ```
*
* @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.
@ -151,7 +161,7 @@ interface RSOrchestrator : Orchestrator {
* orchestrator.moveMouseLeftClickAndSleep(bankPoint, 100)
*
* // 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.
@ -175,7 +185,7 @@ interface RSOrchestrator : Orchestrator {
* Craft while standing at bank:
* ```
* 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
/**
* 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.
* It provides an easy way to invoke these flows without having to reimplement
* the lower-level actions each time.
* This includes functions like:
* - fullRunIncense: Handles the full incense stick crafting workflow.
* - 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
* parameters. This allows them to be called independently and composed in
* different combinations.
* The routines use an Agent instance to perform actions like banking,
* depositing items, withdrawing presets, etc.
*
* For example, the fullRunIncense routine orchestrates the entire incense
* 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.
* The routines are encapsulated for pure convenience
*/
object Routines {
/**
@ -52,18 +40,7 @@ object Routines {
* - Infusing clean herbs into sticks
*
* It loops through each step based on the provided volumes, performing the
* actions at the bank.
*
* Usage example:
*
* ```
* val herbs = 1000
* val logs = 2000
* val ashes = 1500
* val cleanHerbs = herbs + 150
*
* Routines.fullRunIncense(herbs, logs, ashes, cleanHerbs)
* ```
* actions at the bank. The bank location is prompted from the user.
*
* Progress is printed after each step. Total elapsed time is printed at the end.
*/
@ -120,18 +97,6 @@ object Routines {
* - Depositing clean herbs
*
* 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()) {
val params = StandingTaskParams(
@ -158,19 +123,6 @@ object Routines {
* - Withdrawing magic log preset
* - Cutting magic logs into incense sticks without dialog
* - 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()) {
val params = StandingTaskParams(
@ -197,20 +149,6 @@ object Routines {
* - Withdrawing incense stick preset
* - Coating incense sticks with ashes using hotkey
* - 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()) {
val params = StandingTaskParams(
@ -236,19 +174,6 @@ object Routines {
* - Withdrawing incense stick preset
* - Infusing incense sticks with herbs using hotkey
* - 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()) {
val params = StandingTaskParams(
@ -273,17 +198,9 @@ object Routines {
* This method handles the workflow of crafting potions using hotkeys while standing at a bank:
*
* - It constructs a StandingTaskParams instance defining:
* - 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.
*
* 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.
*
* @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.
*
* 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.
*
* @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 agent handles the navigation and banking actions.
*
* Usage example:
*
* ```
* Routines.processAtFurnaceNearBank(1500)
* ```
*
* Before processing, the camera is reset to align points.
*/
fun processInventoryAtFurnace(volume: Int) {