cleaned up some call sites

This commit is contained in:
dtookey 2023-08-06 20:40:44 -04:00
parent 339b565211
commit 430c9a34ac

View File

@ -27,13 +27,7 @@ interface RSOrchestrator : Orchestrator{
*/ */
fun doStandingTask(orchestrator: RSOrchestrator, params: StandingTaskParams) { fun doStandingTask(orchestrator: RSOrchestrator, params: StandingTaskParams) {
orchestrator.doLoop(params.totalVolume, params.volumePerStep) { orchestrator.doLoop(params.totalVolume, params.volumePerStep) {
orchestrator.processAtBank( orchestrator.processAtBank(params)
params.bankPoint,
params.bankPresetHotkey,
params.craftingDialogHotkey,
params.craftingWaitDurationMillis,
params.craftingWaitDurationVarianceMillis
)
} }
} }
@ -54,15 +48,7 @@ interface RSOrchestrator : Orchestrator{
*/ */
fun doTravelTask(orchestrator: RSOrchestrator, params: TravelTaskParams) { fun doTravelTask(orchestrator: RSOrchestrator, params: TravelTaskParams) {
orchestrator.doLoop(params.totalVolume, params.volumePerStep) { orchestrator.doLoop(params.totalVolume, params.volumePerStep) {
orchestrator.processAtStationNearBank( orchestrator.processAtStationNearBank(params)
params.bankPoint,
params.travelPoint,
params.bankPresetHotkey,
params.travelDurationMillis,
params.travelDurationVarianceMillis,
params.craftingWaitDurationMillis,
params.craftingWaitDurationVarianceMillis
)
} }
} }
@ -95,11 +81,7 @@ interface RSOrchestrator : Orchestrator{
* @param waitDurationVarianceMillis Random variance in milliseconds to add to the wait duration. * @param waitDurationVarianceMillis Random variance in milliseconds to add to the wait duration.
*/ */
fun processAtBank( fun processAtBank(
bankPoint: Point, taskParams: StandingTaskParams
bankPresetHotkey: Int,
craftingDialogueHotkey: Int,
waitDurationMillis: Long,
waitDurationVariance: Long
) )
/** /**
@ -119,13 +101,7 @@ interface RSOrchestrator : Orchestrator{
* @param waitDurationVarianceMillis Random variance to add to the wait duration. * @param waitDurationVarianceMillis Random variance to add to the wait duration.
*/ */
fun processAtStationNearBank( fun processAtStationNearBank(
bankPoint: Point, taskParams: TravelTaskParams
craftingStationPoint: Point,
bankPresetHotkey: Int,
travelDurationMillis: Long,
travelDurationVarianceMillis: Long,
waitDurationMillis: Long,
waitDurationVarianceMillis: Long
) )
/** /**
@ -200,26 +176,22 @@ private class RSAgent(override val automaton: Automaton = RobotController()) : R
* @param waitDurationVariance Allowed variance in the wait duration. * @param waitDurationVariance Allowed variance in the wait duration.
*/ */
override fun processAtBank( override fun processAtBank(
bankPoint: Point, taskParams: StandingTaskParams
bankPresetHotkey: Int,
craftingDialogueHotkey: Int,
waitDurationMillis: Long,
waitDurationVariance: Long
) { ) {
//open the bank located by the chest parameter //open the bank located by the chest parameter
moveMouseLeftClickAndSleep(automaton.getAlmostPoint(bankPoint, WiggleParams()), 900, 400) moveMouseLeftClickAndSleep(automaton.getAlmostPoint(taskParams.bankPoint, WiggleParams()), 900, 400)
//withdraw the desired inventory preset //withdraw the desired inventory preset
automaton.keyPress(bankPresetHotkey) automaton.keyPress(taskParams.bankPresetHotkey)
//sleep for a server tick //sleep for a server tick
sleepForNTicks(1) sleepForNTicks(1)
//open the crafting dialog with the correct hotkey //open the crafting dialog with the correct hotkey
automaton.keyPress(craftingDialogueHotkey) automaton.keyPress(taskParams.craftingDialogHotkey)
//sleep for a server tick //sleep for a server tick
sleepForNTicks(1) sleepForNTicks(1)
//press the "accept" default hotkey //press the "accept" default hotkey
automaton.keyPress(KeyEvent.VK_SPACE) automaton.keyPress(KeyEvent.VK_SPACE)
//wait for the desired time to finish //wait for the desired time to finish
automaton.sleepWithVariance(waitDurationMillis, waitDurationVariance) automaton.sleepWithVariance(taskParams.craftingWaitDurationMillis, taskParams.craftingWaitDurationVarianceMillis)
} }
/** /**
@ -252,33 +224,27 @@ private class RSAgent(override val automaton: Automaton = RobotController()) : R
* @param waitDurationVarianceMillis The allowed variance in crafting duration * @param waitDurationVarianceMillis The allowed variance in crafting duration
*/ */
override fun processAtStationNearBank( override fun processAtStationNearBank(
bankPoint: Point, taskParams: TravelTaskParams
craftingStationPoint: Point,
bankPresetHotkey: Int,
travelDurationMillis: Long,
travelDurationVarianceMillis: Long,
waitDurationMillis: Long,
waitDurationVarianceMillis: Long
) { ) {
//move to the bank and open the interface //move to the bank and open the interface
moveMouseLeftClickAndSleep( moveMouseLeftClickAndSleep(
automaton.getAlmostPoint(bankPoint, WiggleParams()), automaton.getAlmostPoint(taskParams.bankPoint, WiggleParams()),
travelDurationMillis, taskParams.travelDurationMillis,
travelDurationVarianceMillis taskParams.travelDurationVarianceMillis
) )
//withdraw desired loadout //withdraw desired loadout
automaton.keyPress(bankPresetHotkey) automaton.keyPress(taskParams.bankPresetHotkey)
sleepForNTicks(1) sleepForNTicks(1)
//move to station and open the crafting dialog //move to station and open the crafting dialog
moveMouseLeftClickAndSleep(craftingStationPoint, travelDurationMillis, travelDurationVarianceMillis) moveMouseLeftClickAndSleep(taskParams.travelPoint, taskParams.travelDurationMillis, taskParams.travelDurationVarianceMillis)
//start the crafting task //start the crafting task
automaton.keyPress(KeyEvent.VK_SPACE) automaton.keyPress(KeyEvent.VK_SPACE)
//wait for it to complete //wait for it to complete
automaton.sleepWithVariance(waitDurationMillis, waitDurationVarianceMillis) automaton.sleepWithVariance(taskParams.craftingWaitDurationMillis, taskParams.craftingWaitDurationVarianceMillis)
} }