Tool-Assisted-RS/src/main/kotlin/TaskParams.kt
2023-08-05 08:12:38 -04:00

160 lines
5.8 KiB
Kotlin

import java.awt.Point
/**
* Interface for common task parameters used across automation routines.
*
* This defines standard fields needed by most routines like total volume,
* volume per step, and the Agent instance.
*
* @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 {
val totalVolume: Int
val volumePerStep: Int
val agent: Agent
}
/**
* 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 bankPresetHotkey: Int
}
/**
* 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 craftingWaitDurationMillis: Long
val craftingWaitDurationVarianceMillis: Long
}
/**
* 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 travelDurationMillis: 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(
override val totalVolume: Int,
override val volumePerStep: Int,
override val agent: Agent,
override val bankPoint: Point,
override val bankPresetHotkey: Int,
override val craftingDialogHotkey: Int,
override val craftingWaitDurationMillis: Long,
override val craftingWaitDurationVarianceMillis: Long
) : 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(
override val totalVolume: Int,
override val volumePerStep: Int,
override val agent: Agent,
override val bankPoint: Point,
override val travelPoint: Point,
override val bankPresetHotkey: Int,
override val craftingDialogHotkey: Int = -1, //all current travel tasks click the thing that starts the crafting dialogue
override val craftingWaitDurationMillis: Long,
override val craftingWaitDurationVarianceMillis: Long,
override val travelDurationMillis: Long,
override val travelDurationVarianceMillis: Long
) : TaskParams, BankParams, CraftingParams, TravelParams
/**
* CommonVolumesPerStep provides constants for common inventory volumes used during routines.
*/
object CommonVolumesPerStep {
/**
* Full inventory volume constant.
*/
const val FullInventory = 28
/**
* Two-reagent full inventory volume constant.
* For example, when combining two items that fill the inventory.
*/
const val TwoReagentFullInventory = 14
/**
* Volume for coating incense sticks with ashes.
*/
const val CoatingIncenseWithAsh = 26
/**
* Volume for infusing incense sticks with herbs.
*/
const val InfusingIncenseWithHerb = 27
}