diff --git a/.idea/misc.xml b/.idea/misc.xml
index 7c9ac40..24a2080 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,7 +4,7 @@
-
+
\ No newline at end of file
diff --git a/build.gradle.kts b/build.gradle.kts
index ed21d98..fe997ea 100644
--- a/build.gradle.kts
+++ b/build.gradle.kts
@@ -13,6 +13,8 @@ repositories {
dependencies {
testImplementation(kotlin("test"))
testImplementation("org.mockito.kotlin:mockito-kotlin:5.0.0")
+
+ implementation("net.java.dev.jna:jna:latest.release")
}
tasks.test {
diff --git a/src/main/kotlin/Entry.kt b/src/main/kotlin/Entry.kt
index 4d477b7..c0965a0 100644
--- a/src/main/kotlin/Entry.kt
+++ b/src/main/kotlin/Entry.kt
@@ -1,6 +1,7 @@
import game_logic.runescape.RunescapeRoutines
fun main() {
- RunescapeRoutines.fullRunIncense(0, 500, 500, 500)
+// RunescapeRoutines.fullRunIncense(0, 4514, 4870, 308)
+ RunescapeRoutines.processInventoryAtFurnace(6888)
}
diff --git a/src/main/kotlin/controllers/DesktopController.kt b/src/main/kotlin/controllers/DesktopController.kt
index 0f87ab3..74c9ba6 100644
--- a/src/main/kotlin/controllers/DesktopController.kt
+++ b/src/main/kotlin/controllers/DesktopController.kt
@@ -1,10 +1,14 @@
package controllers
+import com.sun.jna.Native
+import com.sun.jna.Pointer
+import com.sun.jna.win32.StdCallLibrary
import params.MouseWiggleParams
import java.awt.MouseInfo
import java.awt.Point
import kotlin.random.Random
+
/**
* Interface for controllers that interact with the desktop.
*
@@ -78,4 +82,34 @@ interface DesktopController {
}
return Point(point.x + (xDel * xDir), point.y + (yDel * yDir))
}
+}
+
+class WindowsDesktopController : DesktopController {
+
+ internal interface User32 : StdCallLibrary {
+ interface WNDENUMPROC : StdCallLibrary.StdCallCallback {
+ fun callback(hWnd: Pointer?, arg: Pointer?): Boolean
+ }
+
+ fun EnumWindows(lpEnumFunc: WNDENUMPROC?, userData: Pointer?): Boolean
+ fun GetWindowTextA(hWnd: Pointer?, lpString: ByteArray?, nMaxCount: Int): Int
+
+ fun GetForegroundWindow(): Pointer?
+
+ companion object {
+ val INSTANCE = Native.load("user32", User32::class.java) as User32
+ }
+
+
+ }
+
+ fun getCurrentlyActiveWindowName(): String {
+ val user32 = User32.INSTANCE
+
+ val windowText = ByteArray(512)
+ val hWnd = user32.GetForegroundWindow()
+ user32.GetWindowTextA(hWnd, windowText, 512)
+ val wText = Native.toString(windowText).trim { it <= ' ' } //i have no idea what this does
+ return wText
+ }
}
\ No newline at end of file
diff --git a/src/main/kotlin/game_logic/runescape/RunescapeRoutines.kt b/src/main/kotlin/game_logic/runescape/RunescapeRoutines.kt
index 3f26757..3c0bf49 100644
--- a/src/main/kotlin/game_logic/runescape/RunescapeRoutines.kt
+++ b/src/main/kotlin/game_logic/runescape/RunescapeRoutines.kt
@@ -81,30 +81,38 @@ object RunescapeRoutines {
// Loop to clean grimy herbs:
// Withdraw herb preset, clean without dialog at bank
if (volHerbs > 0) {
+ println("\rCleaning herbs")
cleanHerbs(volHerbs, agent, bankPoint)
+ println("\rHerbs cleaned")
}
- println("\rHerbs cleaned")
+
// Loop to cut magic logs into sticks:
// Withdraw log preset, cut logs using hotkey at bank
if (volLogs > 0) {
+ println("\rCutting logs into sticks")
cutIncenseSticks(volLogs, agent, bankPoint)
+ println("\rLogs cut into sticks")
}
- println("\rLogs cut into sticks")
+
// Loop to coat sticks in ashes:
// Withdraw ash preset, coat sticks using hotkey at bank
if (volAshes > 0) {
+ println("\rCoating sticks in ashes")
coatIncenseSticks(volAshes, agent, bankPoint)
+ println("\rSticks coated in ashes")
}
- println("\rSticks coated in ashes")
+
// Loop to infuse clean herbs into sticks:
// Withdraw herb preset, infuse sticks using hotkey at bank
if (volCleanHerbs > 0) {
+ println()
+ println("\rInfusing sticks with clean herbs")
infuseIncenseSticks(volCleanHerbs, agent, bankPoint)
+ println("\rClean herbs infused")
}
- println("\rClean herbs infused")
val finish = System.currentTimeMillis()
agent.drawStar()
diff --git a/src/test/kotlin/controllers/DesktopControllerTest.kt b/src/test/kotlin/controllers/DesktopControllerTest.kt
index 11e2b84..a1df84a 100644
--- a/src/test/kotlin/controllers/DesktopControllerTest.kt
+++ b/src/test/kotlin/controllers/DesktopControllerTest.kt
@@ -60,4 +60,10 @@ class DesktopControllerTest {
assertNotEquals(100, wiggly.x)
assertNotEquals(200, wiggly.y)
}
+
+ @Test
+ fun devTest(){
+ val c = WindowsDesktopController()
+ println("TEXT: ${ c.getCurrentlyActiveWindowName()}")
+ }
}
\ No newline at end of file