diff --git a/src/main/kotlin/Routines.kt b/src/main/kotlin/Routines.kt index 5436e98..8f7da62 100644 --- a/src/main/kotlin/Routines.kt +++ b/src/main/kotlin/Routines.kt @@ -1,6 +1,19 @@ 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 { /** @@ -21,7 +34,9 @@ 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 */ + @Deprecated("Needs validation before you use it for realsies") fun fullRunIncense(volHerbs: Int, volLogs: Int, volAshes: Int, volCleanHerbs: Int) { val agent = Agent() val start = System.currentTimeMillis() @@ -30,36 +45,28 @@ object Routines { // Loop to clean grimy herbs: // Withdraw herb preset, clean without dialog at bank if (volHerbs > 0) { - agent.doLoop(volHerbs, 28) { - agent.bankStandWithoutDialog(chest, KeyEvent.VK_F1, KeyEvent.VK_1) - } + cleanHerbs(volHerbs, agent = agent, chest = chest) } println("\rHerbs cleaned") // Loop to cut magic logs into sticks: // Withdraw log preset, cut logs using hotkey at bank if (volLogs > 0) { - agent.doLoop(volLogs, 26) { - agent.bankStandForLoop(chest, KeyEvent.VK_F2, KeyEvent.VK_2, 26000, 1200) - } + cutIncenseSticks(volLogs, agent = agent, chest = chest) } println("\rLogs cut into sticks") // Loop to coat sticks in ashes: // Withdraw ash preset, coat sticks using hotkey at bank if (volAshes > 0) { - agent.doLoop(volAshes, 26) { - agent.bankStandForLoop(chest, KeyEvent.VK_F3, KeyEvent.VK_3, 21000, 600) - } + coatIncenseSticks(volAshes, agent = agent, chest = chest) } println("\rSticks coated in ashes") // Loop to infuse clean herbs into sticks: -// Withdraw herb preset, infuse sticks using hotkey at bank + // Withdraw herb preset, infuse sticks using hotkey at bank if (volCleanHerbs > 0) { - agent.doLoop(volCleanHerbs, 27) { - agent.bankStandForLoop(chest, KeyEvent.VK_F4, KeyEvent.VK_4, 48600, 600) - } + infuseIncenseSticks(volCleanHerbs, agent = agent, chest = chest) } println("\rClean herbs infused") @@ -81,10 +88,10 @@ object Routines { * * Inside the loop, it withdraws the herb cleaning preset and activates * the cleaning without additional dialog boxes. + * @deprecated Needs validation before using for real, as sawmill points are hardcoded */ - fun cleanHerbs(totalVolume: Int, volumePerStep: Int = 14) { - val agent = Agent() - val chest = agent.getBankPoint() + @Deprecated("Needs validation before you use it for realsies") + fun cleanHerbs(totalVolume: Int, volumePerStep: Int = 14, agent: Agent = Agent(), chest: Point = agent.getBankPoint()) { agent.doLoop(totalVolume, volumePerStep) { agent.bankStandWithoutDialog(chest, KeyEvent.VK_F1, KeyEvent.VK_1) } @@ -104,8 +111,10 @@ object Routines { * * Inside the loop, it withdraws the log cutting preset and cuts the logs into * sticks using the specified hotkeys. + * @deprecated Needs validation before using for real, as sawmill points are hardcoded */ - fun cutIncenseSticks(totalVolume: Int, volumePerStep: Int = 28) { + @Deprecated("Needs validation before you use it for realsies") + fun cutIncenseSticks(totalVolume: Int, volumePerStep: Int = 28, agent: Agent = Agent(), chest: Point = agent.getBankPoint()) { val agent = Agent() val chest = agent.getBankPoint() @@ -129,8 +138,10 @@ object Routines { * * Inside the loop, it withdraws the ash coating preset and coats the sticks * using the specified hotkeys. + * @deprecated Needs validation before using for real, as sawmill points are hardcoded */ - fun coatIncenseSticks(totalVolume: Int, volumePerStep: Int = 26) { + @Deprecated("Needs validation before you use it for realsies") + fun coatIncenseSticks(totalVolume: Int, volumePerStep: Int = 26, agent: Agent = Agent(), chest: Point = agent.getBankPoint()) { val agent = Agent() val chest = agent.getBankPoint() @@ -154,8 +165,10 @@ object Routines { * * Inside the loop, it withdraws the herb infusing preset and infuses the sticks * using the specified hotkeys. + * @deprecated Needs validation before using for real, as sawmill points are hardcoded */ - fun infuseIncenseSticks(totalVolume: Int, volumePerStep: Int = 27) { + @Deprecated("Needs validation before you use it for realsies") + fun infuseIncenseSticks(totalVolume: Int, volumePerStep: Int = 27, agent: Agent = Agent(), chest: Point = agent.getBankPoint()) { val agent = Agent() @@ -178,8 +191,10 @@ object Routines { * * Inside the loop, it withdraws the potion crafting preset and crafts * using the crafting hotkey which doesn't produce a dialogue box. + * @deprecated Needs validation before using for real, as sawmill points are hardcoded */ - fun craftPotionAtBank(totalVolume: Int, volumePerStep: Int = 14) { + @Deprecated("Needs validation before you use it for realsies") + fun craftPotionAtBank(totalVolume: Int, volumePerStep: Int = 14, agent: Agent = Agent(), chest: Point = agent.getBankPoint()) { val agent = Agent() val chest = agent.getBankPoint() @@ -207,8 +222,10 @@ object Routines { * After creating the potions, it banks again before the next iteration. * * The travelDurationInMillis parameter allows configuring the travel time between the bank and the well. + * @deprecated Needs validation before using for real, as sawmill points are hardcoded */ - fun potionGrindWithWell(totalVolume: Int, volumePerStep: Int = 14, travelDurationInMillis: Long = 0) { + @Deprecated("Needs validation before you use it for realsies") + fun potionGrindWithWell(totalVolume: Int, volumePerStep: Int = 14, travelDurationInMillis: Long = 0, agent: Agent = Agent(), chest: Point = agent.getBankPoint()) { val agent = Agent() val chest = agent.getBankPoint() @@ -236,8 +253,10 @@ object Routines { * using the well. * * After crafting finishes, it banks again before the next iteration. + * @deprecated Needs validation before using for real, as sawmill points are hardcoded */ - fun supremeOverloadGrind(totalVolume: Int, volumePerStep: Int = 4) { + @Deprecated("Needs validation before you use it for realsies") + fun supremeOverloadGrind(totalVolume: Int, volumePerStep: Int = 4, agent: Agent = Agent(), chest: Point = agent.getBankPoint()) { val agent = Agent() val chest = agent.getBankPoint() val well = agent.promptUserForPoint("Put your mouse over the well...") @@ -263,8 +282,10 @@ object Routines { * process hotkey, and travels back to the bank before the next iteration. * * The camera is reset before starting. + * @deprecated Needs validation before using for real, as sawmill points are hardcoded */ - fun processInventoryAtFurnace(totalVolume: Int, volumePerStep: Int = 28) { + @Deprecated("Needs validation before you use it for realsies") + fun processInventoryAtFurnace(totalVolume: Int, volumePerStep: Int = 28, agent: Agent = Agent(), chest: Point = agent.getBankPoint()) { val agent = Agent() println("Reset the camera") agent.scrollOutToHeight(8) @@ -294,7 +315,7 @@ object Routines { * @deprecated Needs validation before using for real, as sawmill points are hardcoded */ @Deprecated("Needs validation before you use it for realsies") - fun processRefinedPlanksIntoFrames(totalVolume: Int, volumePerStep: Int) { + fun processRefinedPlanksIntoFrames(totalVolume: Int, volumePerStep: Int, agent: Agent = Agent(), chest: Point = agent.getBankPoint()) { 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)