validated the incense stick pipeline after refactor

This commit is contained in:
dtookey 2023-08-05 07:42:31 -04:00
parent a39268a7fc
commit 333872f5bb
3 changed files with 19 additions and 19 deletions

View File

@ -33,7 +33,7 @@ import kotlin.random.Random
* @constructor Creates a Doer instance with a Robot.
*/
open class Doer(private val robot: Robot = Robot()) {
companion object{
companion object {
/**
* The duration in milliseconds of one "tick". The duration of 600ms matches the tick duration of game servers.
*
@ -48,7 +48,6 @@ open class Doer(private val robot: Robot = Robot()) {
}
/**
* Extra padding in milliseconds added before actions to account for latency. 500ms is entirely arbitrary. It is
* simply a value that works well during high-load periods. Better to be conservative than lossy.
@ -283,8 +282,11 @@ open class Doer(private val robot: Robot = Robot()) {
* @param variance The amount of random variance to add in milliseconds.
*/
fun sleep(dur: Long, variance: Long) {
if (dur < 0 || variance <= 1) {
return
}
val dSize = (variance) / 2
val r1 = Random.nextLong(dSize)
val r1 = Random.nextLong(dSize)
val r2 = Random.nextLong(dSize)
sleep(dur + r1 + r2)
}

View File

@ -1,7 +1,7 @@
import java.awt.Point
fun main() {
// Routines.fullRunIncense(0, 8916, 9462, 4808)
Routines.processInventoryAtFurnace(100)
Routines.fullRunIncense(29, 29, 29, 29)
// Routines.processInventoryAtFurnace(100)
}

View File

@ -1,5 +1,4 @@
import java.awt.Point
import java.awt.event.InputEvent
import java.awt.event.KeyEvent
/**
@ -35,40 +34,39 @@ object Routines {
* 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.
* @deprecated Needs validation before using for real, as sawmill points are hardcoded
*/
fun fullRunIncense(volHerbs: Int, volLogs: Int, volAshes: Int, volCleanHerbs: Int) {
val start = System.currentTimeMillis()
//initialize the shared agent and chest point
val agent = Agent()
val chest = agent.getBankPoint()
val bankPoint = agent.getBankPoint()
// Loop to clean grimy herbs:
// Withdraw herb preset, clean without dialog at bank
if (volHerbs > 0) {
cleanHerbs(volHerbs)
cleanHerbs(volHerbs, agent, bankPoint)
}
println("\rHerbs cleaned")
// Loop to cut magic logs into sticks:
// Withdraw log preset, cut logs using hotkey at bank
if (volLogs > 0) {
cutIncenseSticks(volLogs)
cutIncenseSticks(volLogs, agent, bankPoint)
}
println("\rLogs cut into sticks")
// Loop to coat sticks in ashes:
// Withdraw ash preset, coat sticks using hotkey at bank
if (volAshes > 0) {
coatIncenseSticks(volAshes)
coatIncenseSticks(volAshes, agent, bankPoint)
}
println("\rSticks coated in ashes")
// Loop to infuse clean herbs into sticks:
// Withdraw herb preset, infuse sticks using hotkey at bank
if (volCleanHerbs > 0) {
infuseIncenseSticks(volCleanHerbs)
infuseIncenseSticks(volCleanHerbs, agent, bankPoint)
}
println("\rClean herbs infused")
@ -77,11 +75,11 @@ object Routines {
println("Entire chain finished in ${agent.prettyTimeString(finish - start)}")
}
@Deprecated("Needs validation before you use it for realsies")
fun cleanHerbs(volume: Int, agent: Agent = Agent(), bankPoint: Point = agent.getBankPoint()) {
val params = StandingTaskParams(
volume,
28,
CommonVolumesPerStep.FullInventory,
agent,
bankPoint,
KeyEvent.VK_F1,
@ -96,7 +94,7 @@ object Routines {
fun cutIncenseSticks(volume: Int, agent: Agent = Agent(), bankPoint: Point = agent.getBankPoint()) {
val params = StandingTaskParams(
volume,
28,
CommonVolumesPerStep.FullInventory,
agent,
bankPoint,
KeyEvent.VK_F2,
@ -112,7 +110,7 @@ object Routines {
fun coatIncenseSticks(volume: Int, agent: Agent = Agent(), bankPoint: Point = agent.getBankPoint()) {
val params = StandingTaskParams(
volume,
28,
CommonVolumesPerStep.CoatingIncenseWithAsh,
agent,
bankPoint,
KeyEvent.VK_F3,
@ -127,7 +125,7 @@ object Routines {
fun infuseIncenseSticks(volume: Int, agent: Agent = Agent(), bankPoint: Point = agent.getBankPoint()) {
val params = StandingTaskParams(
volume,
28,
CommonVolumesPerStep.InfusingIncenseWithHerb,
agent,
bankPoint,
KeyEvent.VK_F4,
@ -142,7 +140,7 @@ object Routines {
fun craftPotionAtBank(volume: Int, agent: Agent = Agent(), bankPoint: Point = agent.getBankPoint()) {
val params = StandingTaskParams(
volume,
28,
CommonVolumesPerStep.FullInventory,
agent,
bankPoint,
KeyEvent.VK_F6,
@ -163,7 +161,7 @@ object Routines {
val well = agent.promptUserForPoint("Put your mouse over the well...")
val params = TravelTaskParams(
volume,
28,
CommonVolumesPerStep.FullInventory,
agent,
bankPoint,
well,