Code:
;get window handle
WinGet, win_ids, ID, Trove
;TO-DO : edit for multi account
Handle := win_ids
;To avoid some bugs
SetKeyDelay, 40
Loop {
Sleep 200
ControlSend,,{w},ahk_id %Handle%
Sleep 100
ControlSend,,{z down},ahk_id %Handle%
ControlSend,,{d down},ahk_id %Handle%
Sleep 100
ControlSend,,{Space},ahk_id %Handle%
Sleep 200
ControlSend,,{Space},ahk_id %Handle%
Sleep 200
ControlSend,,{Space},ahk_id %Handle%
Sleep 200
ControlSend,,{Space},ahk_id %Handle%
Sleep 200
ControlSend,,{Space},ahk_id %Handle%
Sleep 200
ControlSend,,{Space down},ahk_id %Handle%
Sleep 600
ControlSend,,{z up},ahk_id %Handle%
ControlSend,,{d up},ahk_id %Handle%
ControlSend,,{Space up},ahk_id %Handle%
Sleep 200
;respawn to the rally blade and use it
ControlSend,,{Enter}{Shift down}/{Shift up}respawn{Enter},ahk_id %Handle%
Sleep 1000
ControlSend,,e,ahk_id %Handle%
;Send {e}
Sleep 2000
ControlSend,,w,ahk_id %Handle%
ControlSend,,{z down},ahk_id %Handle%
ControlSend,,{d down},ahk_id %Handle%
Sleep 200
ControlSend,,{z up},ahk_id %Handle%
Sleep 150
ControlSend,,{d up},ahk_id %Handle%
Sleep 1000
ControlSend,,e,ahk_id %Handle%
Sleep 3000
TimeOut = 0
LastTime = 0
Loop {
;detect a dungeon
Dungeon1 := DwmGetPixel(1563, 120, ahk_id %Handle%)
Dungeon2 := DwmGetPixel(1563, 193,ahk_id %Handle%)
Dungeon3 := DwmGetPixel(1563, 266,ahk_id %Handle%)
if (Dungeon1 = "0xe9fa"||Dungeon2 = "0x4ff1fb"||Dungeon3 = "0x9af7fe")
{
LastTime = 1
if (TimeOut = 18)
{
;break after 5000ms*18=90s in uncleared dungeon
break
}
TimeOut++
;fake human moves in 5000ms loop
Sleep 500
ControlSend,,&,ahk_id %Handle%
Sleep 4500
}
else
{
if (LastTime = 1)
{
;time to loot !
ControlSend,,{e down},ahk_id %Handle%
;wait for the chest to be destroyed
Sleep 6000
ControlSend,,{e up},ahk_id %Handle%
}
break
}
}
}
Numpad0::ExitApp
Numpad1::Pause,,1
DwmGetPixel(x, y, hwnd)
{
hDC := DllCall("user32.dll\GetDCEx", "UInt", hwnd, "UInt", 0, "UInt", 1|2)
pix := DllCall("gdi32.dll\GetPixel", "UInt", hDC, "Int", x, "Int", y, "UInt")
DllCall("user32.dll\ReleaseDC", "UInt", hwnd, "UInt", hDC)
pix := DecToHex(pix)
return pix
}
DecToHex(dec)
{
oldfrmt := A_FormatInteger
hex := dec
SetFormat, IntegerFast, hex
hex += 0
hex .= ""
SetFormat, IntegerFast, %oldfrmt%
return hex
}