better docs regarding the new params and agent changes

This commit is contained in:
dtookey 2023-08-05 08:04:53 -04:00
parent 6e3df53ce1
commit b88c998c0a
2 changed files with 103 additions and 18 deletions

View File

@ -2,14 +2,21 @@ import java.awt.Point
import java.awt.event.KeyEvent import java.awt.event.KeyEvent
/** /**
* Agent represents an autonomous agent that can simulate mouse and keyboard actions. * Agent handles lower level actions like banking, navigation, and timing
* to support automation routines.
* *
* This class provides methods for the agent to perform actions like moving the mouse, * This provides a common set of primitive actions that can be used across
* clicking, pressing keys, prompting the user, and looping through repetitive tasks. * different automation workflows. Routines build on top of these actions.
* *
* The Agent uses a Doer instance internally to execute low-level keyboard and mouse operations. * The agent handles things like:
* - Bank interaction (presets, deposits, withdrawals)
* - Navigation points and travel
* - Timing actions with randomness
* - Progress reporting and logging
* *
* @property doer The Doer used by this Agent for simulating user input. * By encapsulating these common actions, routines can focus on their
* specific workflow logic and leverage the agent for the lower level
* activities needed to craft, cook, etc.
*/ */
class Agent: Doer() { class Agent: Doer() {

View File

@ -1,37 +1,95 @@
import java.awt.Point import java.awt.Point
/** /**
* Configuration parameters for routines. * Interface for common task parameters used across automation routines.
* *
* @param totalVolume The total number of items to process in the routine. * This defines standard fields needed by most routines like total volume,
* @param volumePerStep The volume of items to process per loop iteration. * volume per step, and the Agent instance.
* @param agent The Agent instance to use for actions like banking. *
* @param chest The Point location of the bank chest to use. * By extending this interface, routine parameter classes get these
* common fields for free.
*
* @property totalVolume The total number of items to process in the routine.
* @property volumePerStep The volume of items to process per step.
* @property agent The Agent instance that will run the routine.
*/ */
interface TaskParams { interface TaskParams {
val totalVolume: Int val totalVolume: Int
val volumePerStep: Int val volumePerStep: Int
val agent: Agent val agent: Agent
} }
interface BankParams{ /**
* Interface for bank related parameters used in automation routines.
*
* Routines that involve banking items will need bank specific
* configuration like location and preset hotkeys.
*
* This interface encapsulates those common bank parameters. Classes
* that represent task params should implement this if banking is required.
*
* @property bankPoint The Point location of the bank to use.
* @property bankPresetHotkey The bank preset hotkey to withdraw/deposit items.
*/
interface BankParams {
val bankPoint: Point val bankPoint: Point
val bankPresetHotkey: Int val bankPresetHotkey: Int
} }
interface CraftingParams{ /**
* Interface for crafting related parameters used in automation routines.
*
* Routines that involve a crafting action like fletching, cooking, etc will
* need crafting specific configuration like hotkeys and timing.
*
* This interface encapsulates those common crafting parameters. Classes
* that represent task params should implement this if they involve crafting.
*
* @property craftingDialogHotkey The hotkey used to open the crafting dialog.
* @property craftingWaitDurationMillis Base time in ms to wait after crafting.
* @property craftingWaitDurationVarianceMillis Random variance added to wait.
*/
interface CraftingParams {
val craftingDialogHotkey: Int val craftingDialogHotkey: Int
val craftingWaitDurationMillis: Long val craftingWaitDurationMillis: Long
val craftingWaitDurationVarianceMillis: Long val craftingWaitDurationVarianceMillis: Long
} }
interface TravelParams{ /**
* Interface for travel related parameters used in automation routines.
*
* Routines that involve traveling between a bank and activity area (e.g.
* crafting, cooking) will need travel related configuration.
*
* This interface encapsulates those common travel params. Classes that
* represent travel task params should implement this interface.
*
* @property travelPoint The Point destination to travel to.
* @property travelDurationMillis The expected travel time in milliseconds.
* @property travelDurationVarianceMillis Random variance to apply to the
* travel time. This helps simulate human-like travel.
*/
interface TravelParams {
val travelPoint: Point val travelPoint: Point
val travelDurationMillis: Long val travelDurationMillis: Long
val travelDurationVarianceMillis: Long val travelDurationVarianceMillis: Long
} }
/**
* Task parameters for routines performed while standing in one spot.
*
* This represents routines like fletching, cooking, etc. that are done
* without traveling between a bank and activity area.
*
* @param totalVolume Total number of items to process.
* @param volumePerStep The volume of items to process per iteration.
* @param agent The Agent instance.
* @param bankPoint Location of the bank.
* @param bankPresetHotkey Bank preset hotkey to use.
* @param craftingDialogHotkey Hotkey to open crafting dialog.
* @param craftingWaitDurationMillis Crafting action duration.
* @param craftingWaitDurationVarianceMillis Random variance for duration.
*/
data class StandingTaskParams( data class StandingTaskParams(
override val totalVolume: Int, override val totalVolume: Int,
override val volumePerStep: Int, override val volumePerStep: Int,
@ -41,9 +99,29 @@ data class StandingTaskParams(
override val craftingDialogHotkey: Int, override val craftingDialogHotkey: Int,
override val craftingWaitDurationMillis: Long, override val craftingWaitDurationMillis: Long,
override val craftingWaitDurationVarianceMillis: Long override val craftingWaitDurationVarianceMillis: Long
): TaskParams, BankParams, CraftingParams ) : TaskParams, BankParams, CraftingParams
/**
* Task parameters for routines that involve traveling.
*
* This encapsulates all the configuration needed for routines where the
* player travels between a bank and activity area for crafting, cooking, etc.
*
* It brings together the common [TaskParams], bank [BankParams], crafting
* [CraftingParams], and travel [TravelParams] parameters into one data class.
*
* @param totalVolume Total number of items to process.
* @param volumePerStep The volume of items per crafting iteration.
* @param agent The Agent instance.
* @param bankPoint The bank location.
* @param travelPoint The travel destination.
* @param bankPresetHotkey Hotkey for bank preset.
* @param craftingDialogHotkey Hotkey to open crafting dialog.
* @param craftingWaitDurationMillis Base crafting action time.
* @param craftingWaitDurationVarianceMillis Crafting time variance.
* @param travelDurationMillis Expected travel time.
* @param travelDurationVarianceMillis Travel time variance.
*/
data class TravelTaskParams( data class TravelTaskParams(
override val totalVolume: Int, override val totalVolume: Int,
override val volumePerStep: Int, override val volumePerStep: Int,
@ -51,12 +129,12 @@ data class TravelTaskParams(
override val bankPoint: Point, override val bankPoint: Point,
override val travelPoint: Point, override val travelPoint: Point,
override val bankPresetHotkey: Int, override val bankPresetHotkey: Int,
override val craftingDialogHotkey: Int = -1, override val craftingDialogHotkey: Int = -1, //all current travel tasks click the thing that starts the crafting dialogue
override val craftingWaitDurationMillis: Long, override val craftingWaitDurationMillis: Long,
override val craftingWaitDurationVarianceMillis: Long, override val craftingWaitDurationVarianceMillis: Long,
override val travelDurationMillis: Long, override val travelDurationMillis: Long,
override val travelDurationVarianceMillis: Long override val travelDurationVarianceMillis: Long
): TaskParams, BankParams, CraftingParams, TravelParams ) : TaskParams, BankParams, CraftingParams, TravelParams
/** /**
* CommonVolumesPerStep provides constants for common inventory volumes used during routines. * CommonVolumesPerStep provides constants for common inventory volumes used during routines.