223 lines
7.7 KiB
Kotlin
223 lines
7.7 KiB
Kotlin
import java.awt.Point
|
|
import java.awt.event.KeyEvent
|
|
|
|
/**
|
|
* Routines contains utility functions to perform common bot tasks and workflows.
|
|
*
|
|
* 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 use an Agent instance to perform actions like banking,
|
|
* depositing items, withdrawing presets, etc.
|
|
*
|
|
* The routines are encapsulated for pure convenience
|
|
*/
|
|
object Routines {
|
|
|
|
/**
|
|
* Performs the full incense stick crafting process from start to finish.
|
|
*
|
|
* @param volHerbs The number of grimy herbs to clean.
|
|
* @param volLogs The number of magic logs to cut into sticks.
|
|
* @param volAshes The number of sticks to coat in ashes.
|
|
* @param volCleanHerbs The number of clean herbs to infuse into sticks.
|
|
*
|
|
* This handles the entire incense stick crafting process:
|
|
* - Cleaning grimy herbs
|
|
* - Cutting magic logs into sticks
|
|
* - Coating sticks in ashes
|
|
* - Infusing clean herbs into sticks
|
|
*
|
|
* It loops through each step based on the provided volumes, performing the
|
|
* 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()
|
|
|
|
// Loop to clean grimy herbs:
|
|
// Withdraw herb preset, clean without dialog at bank
|
|
if (volHerbs > 0) {
|
|
val params = RoutineParams(volHerbs, CommonVolumesPerStep.FullInventory, agent, chest)
|
|
cleanHerbs(params)
|
|
}
|
|
println("\rHerbs cleaned")
|
|
|
|
// Loop to cut magic logs into sticks:
|
|
// Withdraw log preset, cut logs using hotkey at bank
|
|
if (volLogs > 0) {
|
|
val params = RoutineParams(volLogs, CommonVolumesPerStep.FullInventory, agent, chest)
|
|
cutIncenseSticks(params)
|
|
}
|
|
println("\rLogs cut into sticks")
|
|
|
|
// Loop to coat sticks in ashes:
|
|
// Withdraw ash preset, coat sticks using hotkey at bank
|
|
if (volAshes > 0) {
|
|
val params = RoutineParams(volAshes, CommonVolumesPerStep.CoatingIncenseWithAsh, agent, chest)
|
|
coatIncenseSticks(params)
|
|
}
|
|
println("\rSticks coated in ashes")
|
|
|
|
// Loop to infuse clean herbs into sticks:
|
|
// Withdraw herb preset, infuse sticks using hotkey at bank
|
|
if (volCleanHerbs > 0) {
|
|
val params = RoutineParams(volCleanHerbs, CommonVolumesPerStep.InfusingIncenseWithHerb, agent, chest)
|
|
infuseIncenseSticks(params)
|
|
}
|
|
println("\rClean herbs infused")
|
|
|
|
val finish = System.currentTimeMillis()
|
|
|
|
println("Entire chain finished in ${agent.prettyTimeString(finish - start)}")
|
|
}
|
|
|
|
@Deprecated("Needs validation before you use it for realsies")
|
|
fun cleanHerbs(
|
|
params: RoutineParams
|
|
) {
|
|
params.agent.doLoop(params.totalVolume, params.volumePerStep) {
|
|
params.agent.bankStandWithoutDialog(params.chest, KeyEvent.VK_F1, KeyEvent.VK_1)
|
|
}
|
|
}
|
|
|
|
@Deprecated("Needs validation before you use it for realsies")
|
|
fun cutIncenseSticks(
|
|
params: RoutineParams
|
|
) {
|
|
params.agent.doLoop(params.totalVolume, params.volumePerStep) {
|
|
params.agent.bankStandForLoop(params.chest, KeyEvent.VK_F2, KeyEvent.VK_2, 26000, 1200)
|
|
}
|
|
}
|
|
|
|
|
|
@Deprecated("Needs validation before you use it for realsies")
|
|
fun coatIncenseSticks(
|
|
params: RoutineParams
|
|
) {
|
|
params.agent.doLoop(params.totalVolume, params.volumePerStep) {
|
|
params.agent.bankStandForLoop(params.chest, KeyEvent.VK_F3, KeyEvent.VK_3, 21000, 600)
|
|
}
|
|
}
|
|
|
|
@Deprecated("Needs validation before you use it for realsies")
|
|
fun infuseIncenseSticks(
|
|
params: RoutineParams
|
|
) {
|
|
params.agent.doLoop(params.totalVolume, params.volumePerStep) {
|
|
params.agent.bankStandForLoop(params.chest, KeyEvent.VK_F4, KeyEvent.VK_4, 48600, 600)
|
|
}
|
|
}
|
|
|
|
@Deprecated("Needs validation before you use it for realsies")
|
|
fun craftPotionAtBank(
|
|
params: RoutineParams
|
|
) {
|
|
params.agent.doLoop(params.totalVolume, params.volumePerStep) {
|
|
params.agent.bankStandForLoop(params.chest, Agent.F6, Agent.Minus, 19200, 600)
|
|
}
|
|
}
|
|
|
|
@Deprecated("Needs validation before you use it for realsies")
|
|
fun potionGrindWithWell(
|
|
params: RoutineParams,
|
|
travelDurationInMillis: Long
|
|
) {
|
|
val agent = Agent()
|
|
|
|
val chest = agent.getBankPoint()
|
|
|
|
val well = agent.promptUserForPoint("Put your mouse over the well...")
|
|
|
|
agent.doLoop(params.totalVolume, params.volumePerStep) {
|
|
agent.processAtStationNearBank(chest, well, Agent.F6, travelDurationInMillis, 0, 18600, 600)
|
|
}
|
|
}
|
|
|
|
|
|
@Deprecated("Needs validation before you use it for realsies")
|
|
fun supremeOverloadGrind(
|
|
params: RoutineParams
|
|
) {
|
|
val agent = Agent()
|
|
val chest = agent.getBankPoint()
|
|
val well = agent.promptUserForPoint("Put your mouse over the well...")
|
|
|
|
agent.doLoop(params.totalVolume, params.volumePerStep) {
|
|
agent.processAtStationNearBank(chest, well, Agent.F6, 0, 0, 6500, 1000)
|
|
}
|
|
|
|
}
|
|
|
|
fun processInventoryAtFurnace(
|
|
params: RoutineParams
|
|
) {
|
|
val agent = Agent()
|
|
println("Reset the camera")
|
|
agent.scrollOutToHeight(8)
|
|
|
|
val furnaceFromChest = Point(776, 321)
|
|
val chestFromFurance = Point(1713, 843)
|
|
|
|
agent.doLoop(params.totalVolume, params.volumePerStep) {
|
|
agent.processAtStationNearBank(chestFromFurance, furnaceFromChest, Agent.F6, 2000, 600, 51000, 600)
|
|
}
|
|
}
|
|
|
|
|
|
@Deprecated("Needs validation before you use it for realsies")
|
|
fun processRefinedPlanksIntoFrames(
|
|
params: RoutineParams
|
|
) {
|
|
println("You must zoom in all the way and have the compass pointing straight N with a completely top-down view\n you must also be standing at the touch point on the saw")
|
|
val agent = Agent()
|
|
agent.scrollOutToHeight(8)
|
|
|
|
val sawFromChest = Point(1079, 907)
|
|
val chestFromSaw = Point(1226, 180)
|
|
agent.doLoop(params.totalVolume, params.volumePerStep) {
|
|
// //standing at bank with full inv
|
|
// d.mouseMove(sawFromChest)
|
|
// d.sleep(100, 50)
|
|
// //run to saw
|
|
// d.click(LeftClick)
|
|
// d.sleep(2700, 500)
|
|
// //start cutting frames
|
|
// d.keypress(Space)
|
|
// //waiting
|
|
// d.sleep(64000, 1000)
|
|
// d.mouseMove(chestFromSaw)
|
|
// d.sleep(100, 50)
|
|
// //running to bank
|
|
// d.click(LeftClick)
|
|
// d.sleep(2700, 500)
|
|
// d.keypress(F6)
|
|
// d.sleep(1200, 500)
|
|
// //full inv
|
|
|
|
agent.processAtStationNearBank(chestFromSaw, sawFromChest, Agent.F6, 2700, 500, 64000, 1000)
|
|
}
|
|
}
|
|
}
|
|
|
|
data class RoutineParams(
|
|
val totalVolume: Int,
|
|
val volumePerStep: Int,
|
|
val agent: Agent = Agent(),
|
|
val chest: Point = agent.getBankPoint()
|
|
)
|
|
|
|
object CommonVolumesPerStep {
|
|
const val FullInventory = 28
|
|
const val TwoReagentFullInventory = 14
|
|
const val CoatingIncenseWithAsh = 26
|
|
const val InfusingIncenseWithHerb = 27
|
|
} |