#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
CoordMode, ToolTip, Screen
SetTitleMatchMode, 3
SetKeyDelay, 0, 2
Numpad9::
FileDelete, %A_ScriptDir%\tmp\break.txt
FileAppend, 0, %A_ScriptDir%\tmp\break.txt
GetWindowsHandle()
return
!Numpad9::
FileDelete, %A_ScriptDir%\tmp\break.txt
FileAppend, 1, %A_ScriptDir%\tmp\break.txt
return
Numpad7::
ExitApp
GetWindowsHandle()
{
Global
AccNum := 0
WinGet, id, list, Trove
Loop, %id%
{
AccNum := AccNum + 1
ids := id%A_Index%
SetWindowHandle(AccNum, ids)
}
}
SetWindowHandle(AccNumF, this_id)
{
Global
If (AccNumF = 1)
{
1Handle = %this_id%
WinGet, pid1, PID, ahk_id %1Handle%
pid1 := pid1
Lure1 := GetLureAmmount(1Handle, pid1)
FileDelete, %A_ScriptDir%\tmp\lure1.txt
FileAppend, %Lure1%, %A_ScriptDir%\tmp\lure1.txt
FileDelete, %A_ScriptDir%\tmp\pid1.txt
FileAppend, %pid1%, %A_ScriptDir%\tmp\pid1.txt
FileDelete, %A_ScriptDir%\tmp\handle1.txt
FileAppend, %1Handle%, %A_ScriptDir%\tmp\handle1.txt
Run, %A_ScriptDir%\Thread1.exe
}
else If (AccNumF = 2)
{
2Handle = %this_id%
WinGet, pid2, PID, ahk_id %2Handle%
pid2 := pid2
Lure2 := GetLureAmmount(2Handle, pid2)
FileDelete, %A_ScriptDir%\tmp\lure2.txt
FileAppend, %Lure2%, %A_ScriptDir%\tmp\lure2.txt
FileDelete, %A_ScriptDir%\tmp\pid2.txt
FileAppend, %pid2%, %A_ScriptDir%\tmp\pid2.txt
FileDelete, %A_ScriptDir%\tmp\handle2.txt
FileAppend, %2Handle%, %A_ScriptDir%\tmp\handle2.txt
Run, %A_ScriptDir%\Thread2.exe
}
else If (AccNumF = 3)
{
3Handle = %this_id%
WinGet, pid3, PID, ahk_id %3Handle%
pid3 := pid3
Lure3 := GetLureAmmount(3Handle, pid3)
FileDelete, %A_ScriptDir%\tmp\lure3.txt
FileAppend, %Lure3%, %A_ScriptDir%\tmp\lure3.txt
FileDelete, %A_ScriptDir%\tmp\pid3.txt
FileAppend, %pid3%, %A_ScriptDir%\tmp\pid3.txt
FileDelete, %A_ScriptDir%\tmp\handle3.txt
FileAppend, %3Handle%, %A_ScriptDir%\tmp\handle3.txt
Run, %A_ScriptDir%\Thread3.exe
}
else If (AccNumF = 4)
{
4Handle = %this_id%
WinGet, pid4, PID, ahk_id %4Handle%
pid4 := pid4
Lure4 := GetLureAmmount(4Handle, pid4)
FileDelete, %A_ScriptDir%\tmp\lure4.txt
FileAppend, %Lure4%, %A_ScriptDir%\tmp\lure4.txt
FileDelete, %A_ScriptDir%\tmp\pid4.txt
FileAppend, %pid4%, %A_ScriptDir%\tmp\pid4.txt
FileDelete, %A_ScriptDir%\tmp\handle4.txt
FileAppend, %4Handle%, %A_ScriptDir%\tmp\handle4.txt
Run, %A_ScriptDir%\Thread4.exe
}
else If (AccNumF = 5)
{
5Handle = %this_id%
WinGet, pid5, PID, ahk_id %5Handle%
pid5 := pid5
Lure5 := GetLureAmmount(5Handle, pid5)
FileDelete, %A_ScriptDir%\tmp\lure5.txt
FileAppend, %Lure5%, %A_ScriptDir%\tmp\lure5.txt
FileDelete, %A_ScriptDir%\tmp\pid5.txt
FileAppend, %pid5%, %A_ScriptDir%\tmp\pid5.txt
FileDelete, %A_ScriptDir%\tmp\handle5.txt
FileAppend, %5Handle%, %A_ScriptDir%\tmp\handle5.txt
Run, %A_ScriptDir%\Thread5.exe
}
else If (AccNumF = 6)
{
6Handle = %this_id%
WinGet, pid6, PID, ahk_id %6Handle%
pid6 := pid6
Lure6 := GetLureAmmount(6Handle, pid6)
FileDelete, %A_ScriptDir%\tmp\lure6.txt
FileAppend, %Lure6%, %A_ScriptDir%\tmp\lure6.txt
FileDelete, %A_ScriptDir%\tmp\pid6.txt
FileAppend, %pid6%, %A_ScriptDir%\tmp\pid6.txt
FileDelete, %A_ScriptDir%\tmp\handle6.txt
FileAppend, %6Handle%, %A_ScriptDir%\tmp\handle6.txt
Run, %A_ScriptDir%\Thread6.exe
}
else If (AccNumF = 7)
{
7Handle = %this_id%
WinGet, pid7, PID, ahk_id %7Handle%
pid7 := pid7
Lure7 := GetLureAmmount(7Handle, pid7)
FileDelete, %A_ScriptDir%\tmp\lure7.txt
FileAppend, %Lure7%, %A_ScriptDir%\tmp\lure7.txt
FileDelete, %A_ScriptDir%\tmp\pid7.txt
FileAppend, %pid7%, %A_ScriptDir%\tmp\pid7.txt
FileDelete, %A_ScriptDir%\tmp\handle7.txt
FileAppend, %7Handle%, %A_ScriptDir%\tmp\handle7.txt
Run, %A_ScriptDir%\Thread7.exe
}
else If (AccNumF = 8)
{
8Handle = %this_id%
WinGet, pid8, PID, ahk_id %8Handle%
pid8 := pid8
Lure8 := GetLureAmmount(8Handle, pid8)
FileDelete, %A_ScriptDir%\tmp\lure8.txt
FileAppend, %Lure8%, %A_ScriptDir%\tmp\lure8.txt
FileDelete, %A_ScriptDir%\tmp\pid8.txt
FileAppend, %pid8%, %A_ScriptDir%\tmp\pid8.txt
FileDelete, %A_ScriptDir%\tmp\handle8.txt
FileAppend, %8Handle%, %A_ScriptDir%\tmp\handle8.txt
Run, %A_ScriptDir%\Thread8.exe
}
}
GetLureAmmount(HandleL, pidL)
{
base := getProcessBaseAddress(HandleL)
pointerBase := base + 0x008E8E18
y1 := ReadMemory(pointerBase, pidL)
y2 := ReadMemory(y1 + 0x9c, pidL)
y3 := ReadMemory(y2 + 0x78, pidL)
y4 := ReadMemory(y3 + 0x0, pidL)
y5 := y4 + 0x58
Return Lure := ReadMemory(y5, pidL)
}
getProcessBaseAddress(HandleUse)
{
return DllCall( A_PtrSize = 4
? "GetWindowLong"
: "GetWindowLongPtr"
, "Ptr", HandleUse
, "Int", -6
, "Int64") ; Use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit
; If DLL call fails, returned value will = 0
}
ReadMemory(MADDRESS, PIDUse)
{
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", PIDUse, "UInt")
;DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
return, result
}
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
CoordMode, ToolTip, Screen
SetTitleMatchMode, 3
SetKeyDelay, 0, 2
FileRead, Lure, %A_ScriptDir%\tmp\lure1.txt
FileRead, pid, %A_ScriptDir%\tmp\pid1.txt
FileRead, Handle, %A_ScriptDir%\tmp\handle1.txt
FileDelete, %A_ScriptDir%\tmp\lure1.txt
FileDelete, %A_ScriptDir%\tmp\handle1.txt
FileDelete, %A_ScriptDir%\tmp\pid1.txt
FileRead, Break, %A_ScriptDir%\tmp\break.txt
LureCount := 0
Loop %Lure%
{
FileRead, Break, %A_ScriptDir%\tmp\break.txt
If (Break = 1)
{
break
}
else
{
}
LureCount := LureCount +1
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Catch := 0
Loop
{
If (Catch = 1)
{
break
}
else
{
Base := getProcessBaseAddress()
CaughtWater := ReadMemory((ReadMemory(base + 0x008E5360) + 0xBD150))
CaughtLava := ReadMemory(((ReadMemory(base + 0x008E5360) + 0xBD150) + 0x4A4))
If (CaughtWater = 1 or CaughtLava = 1)
{
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Random, Wait, 2000, 3500
Sleep, %Wait%
Catch := 1
}
else
{
Sleep, 500
}
}
}
}
ExitApp
getProcessBaseAddress()
{
Global Handle
return DllCall( A_PtrSize = 4
? "GetWindowLong"
: "GetWindowLongPtr"
, "Ptr", Handle
, "Int", -6
, "Int64") ; Use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit
; If DLL call fails, returned value will = 0
}
ReadMemory(MADDRESS)
{
Global pid
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
;DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
return, result
}
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
CoordMode, ToolTip, Screen
SetTitleMatchMode, 3
SetKeyDelay, 0, 2
FileRead, Lure, %A_ScriptDir%\tmp\lure2.txt
FileRead, pid, %A_ScriptDir%\tmp\pid2.txt
FileRead, Handle, %A_ScriptDir%\tmp\handle2.txt
FileDelete, %A_ScriptDir%\tmp\lure2.txt
FileDelete, %A_ScriptDir%\tmp\handle2.txt
FileDelete, %A_ScriptDir%\tmp\pid2.txt
FileRead, Break, %A_ScriptDir%\tmp\break.txt
LureCount := 0
Loop %Lure%
{
FileRead, Break, %A_ScriptDir%\tmp\break.txt
If (Break = 1)
{
break
}
else
{
}
LureCount := LureCount +1
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Catch := 0
Loop
{
If (Catch = 1)
{
break
}
else
{
Base := getProcessBaseAddress()
CaughtWater := ReadMemory((ReadMemory(base + 0x008E5360) + 0xBD150))
CaughtLava := ReadMemory(((ReadMemory(base + 0x008E5360) + 0xBD150) + 0x4A4))
If (CaughtWater = 1 or CaughtLava = 1)
{
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Random, Wait, 2000, 3500
Sleep, %Wait%
Catch := 1
}
else
{
Sleep, 500
}
}
}
}
ExitApp
getProcessBaseAddress()
{
Global Handle
return DllCall( A_PtrSize = 4
? "GetWindowLong"
: "GetWindowLongPtr"
, "Ptr", Handle
, "Int", -6
, "Int64") ; Use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit
; If DLL call fails, returned value will = 0
}
ReadMemory(MADDRESS)
{
Global pid
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
;DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
return, result
}
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
CoordMode, ToolTip, Screen
SetTitleMatchMode, 3
SetKeyDelay, 0, 2
FileRead, Lure, %A_ScriptDir%\tmp\lure3.txt
FileRead, pid, %A_ScriptDir%\tmp\pid3.txt
FileRead, Handle, %A_ScriptDir%\tmp\handle3.txt
FileDelete, %A_ScriptDir%\tmp\lure3.txt
FileDelete, %A_ScriptDir%\tmp\handle3.txt
FileDelete, %A_ScriptDir%\tmp\pid3.txt
FileRead, Break, %A_ScriptDir%\tmp\break.txt
LureCount := 0
Loop %Lure%
{
FileRead, Break, %A_ScriptDir%\tmp\break.txt
If (Break = 1)
{
break
}
else
{
}
LureCount := LureCount +1
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Catch := 0
Loop
{
If (Catch = 1)
{
break
}
else
{
Base := getProcessBaseAddress()
CaughtWater := ReadMemory((ReadMemory(base + 0x008E5360) + 0xBD150))
CaughtLava := ReadMemory(((ReadMemory(base + 0x008E5360) + 0xBD150) + 0x4A4))
If (CaughtWater = 1 or CaughtLava = 1)
{
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Random, Wait, 2000, 3500
Sleep, %Wait%
Catch := 1
}
else
{
Sleep, 500
}
}
}
}
ExitApp
getProcessBaseAddress()
{
Global Handle
return DllCall( A_PtrSize = 4
? "GetWindowLong"
: "GetWindowLongPtr"
, "Ptr", Handle
, "Int", -6
, "Int64") ; Use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit
; If DLL call fails, returned value will = 0
}
ReadMemory(MADDRESS)
{
Global pid
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
;DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
return, result
}
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
CoordMode, ToolTip, Screen
SetTitleMatchMode, 3
SetKeyDelay, 0, 2
FileRead, Lure, %A_ScriptDir%\tmp\lure4.txt
FileRead, pid, %A_ScriptDir%\tmp\pid4.txt
FileRead, Handle, %A_ScriptDir%\tmp\handle4.txt
FileDelete, %A_ScriptDir%\tmp\lure4.txt
FileDelete, %A_ScriptDir%\tmp\handle4.txt
FileDelete, %A_ScriptDir%\tmp\pid4.txt
FileRead, Break, %A_ScriptDir%\tmp\break.txt
LureCount := 0
Loop %Lure%
{
FileRead, Break, %A_ScriptDir%\tmp\break.txt
If (Break = 1)
{
break
}
else
{
}
LureCount := LureCount +1
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Catch := 0
Loop
{
If (Catch = 1)
{
break
}
else
{
Base := getProcessBaseAddress()
CaughtWater := ReadMemory((ReadMemory(base + 0x008E5360) + 0xBD150))
CaughtLava := ReadMemory(((ReadMemory(base + 0x008E5360) + 0xBD150) + 0x4A4))
If (CaughtWater = 1 or CaughtLava = 1)
{
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Random, Wait, 2000, 3500
Sleep, %Wait%
Catch := 1
}
else
{
Sleep, 500
}
}
}
}
ExitApp
getProcessBaseAddress()
{
Global Handle
return DllCall( A_PtrSize = 4
? "GetWindowLong"
: "GetWindowLongPtr"
, "Ptr", Handle
, "Int", -6
, "Int64") ; Use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit
; If DLL call fails, returned value will = 0
}
ReadMemory(MADDRESS)
{
Global pid
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
;DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
return, result
}
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
CoordMode, ToolTip, Screen
SetTitleMatchMode, 3
SetKeyDelay, 0, 2
FileRead, Lure, %A_ScriptDir%\tmp\lure5.txt
FileRead, pid, %A_ScriptDir%\tmp\pid5.txt
FileRead, Handle, %A_ScriptDir%\tmp\handle5.txt
FileDelete, %A_ScriptDir%\tmp\lure5.txt
FileDelete, %A_ScriptDir%\tmp\handle5.txt
FileDelete, %A_ScriptDir%\tmp\pid5.txt
FileRead, Break, %A_ScriptDir%\tmp\break.txt
LureCount := 0
Loop %Lure%
{
FileRead, Break, %A_ScriptDir%\tmp\break.txt
If (Break = 1)
{
break
}
else
{
}
LureCount := LureCount +1
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Catch := 0
Loop
{
If (Catch = 1)
{
break
}
else
{
Base := getProcessBaseAddress()
CaughtWater := ReadMemory((ReadMemory(base + 0x008E5360) + 0xBD150))
CaughtLava := ReadMemory(((ReadMemory(base + 0x008E5360) + 0xBD150) + 0x4A4))
If (CaughtWater = 1 or CaughtLava = 1)
{
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Random, Wait, 2000, 3500
Sleep, %Wait%
Catch := 1
}
else
{
Sleep, 500
}
}
}
}
ExitApp
getProcessBaseAddress()
{
Global Handle
return DllCall( A_PtrSize = 4
? "GetWindowLong"
: "GetWindowLongPtr"
, "Ptr", Handle
, "Int", -6
, "Int64") ; Use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit
; If DLL call fails, returned value will = 0
}
ReadMemory(MADDRESS)
{
Global pid
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
;DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
return, result
}
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
CoordMode, ToolTip, Screen
SetTitleMatchMode, 3
SetKeyDelay, 0, 2
FileRead, Lure, %A_ScriptDir%\tmp\lure6.txt
FileRead, pid, %A_ScriptDir%\tmp\pid6.txt
FileRead, Handle, %A_ScriptDir%\tmp\handle6.txt
FileDelete, %A_ScriptDir%\tmp\lure6.txt
FileDelete, %A_ScriptDir%\tmp\handle6.txt
FileDelete, %A_ScriptDir%\tmp\pid6.txt
FileRead, Break, %A_ScriptDir%\tmp\break.txt
LureCount := 0
Loop %Lure%
{
FileRead, Break, %A_ScriptDir%\tmp\break.txt
If (Break = 1)
{
break
}
else
{
}
LureCount := LureCount +1
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Catch := 0
Loop
{
If (Catch = 1)
{
break
}
else
{
Base := getProcessBaseAddress()
CaughtWater := ReadMemory((ReadMemory(base + 0x008E5360) + 0xBD150))
CaughtLava := ReadMemory(((ReadMemory(base + 0x008E5360) + 0xBD150) + 0x4A4))
If (CaughtWater = 1 or CaughtLava = 1)
{
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Random, Wait, 2000, 3500
Sleep, %Wait%
Catch := 1
}
else
{
Sleep, 500
}
}
}
}
ExitApp
getProcessBaseAddress()
{
Global Handle
return DllCall( A_PtrSize = 4
? "GetWindowLong"
: "GetWindowLongPtr"
, "Ptr", Handle
, "Int", -6
, "Int64") ; Use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit
; If DLL call fails, returned value will = 0
}
ReadMemory(MADDRESS)
{
Global pid
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
;DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
return, result
}
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
CoordMode, ToolTip, Screen
SetTitleMatchMode, 3
SetKeyDelay, 0, 2
FileRead, Lure, %A_ScriptDir%\tmp\lure7.txt
FileRead, pid, %A_ScriptDir%\tmp\pid7.txt
FileRead, Handle, %A_ScriptDir%\tmp\handle7.txt
FileDelete, %A_ScriptDir%\tmp\lure7.txt
FileDelete, %A_ScriptDir%\tmp\handle7.txt
FileDelete, %A_ScriptDir%\tmp\pid7.txt
FileRead, Break, %A_ScriptDir%\tmp\break.txt
LureCount := 0
Loop %Lure%
{
FileRead, Break, %A_ScriptDir%\tmp\break.txt
If (Break = 1)
{
break
}
else
{
}
LureCount := LureCount +1
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Catch := 0
Loop
{
If (Catch = 1)
{
break
}
else
{
Base := getProcessBaseAddress()
CaughtWater := ReadMemory((ReadMemory(base + 0x008E5360) + 0xBD150))
CaughtLava := ReadMemory(((ReadMemory(base + 0x008E5360) + 0xBD150) + 0x4A4))
If (CaughtWater = 1 or CaughtLava = 1)
{
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Random, Wait, 2000, 3500
Sleep, %Wait%
Catch := 1
}
else
{
Sleep, 500
}
}
}
}
ExitApp
getProcessBaseAddress()
{
Global Handle
return DllCall( A_PtrSize = 4
? "GetWindowLong"
: "GetWindowLongPtr"
, "Ptr", Handle
, "Int", -6
, "Int64") ; Use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit
; If DLL call fails, returned value will = 0
}
ReadMemory(MADDRESS)
{
Global pid
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
;DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
return, result
}
#NoEnv
SendMode Input
SetWorkingDir %A_ScriptDir%
CoordMode, ToolTip, Screen
SetTitleMatchMode, 3
SetKeyDelay, 0, 2
FileRead, Lure, %A_ScriptDir%\tmp\lure8.txt
FileRead, pid, %A_ScriptDir%\tmp\pid8.txt
FileRead, Handle, %A_ScriptDir%\tmp\handle8.txt
FileDelete, %A_ScriptDir%\tmp\lure8.txt
FileDelete, %A_ScriptDir%\tmp\handle8.txt
FileDelete, %A_ScriptDir%\tmp\pid8.txt
FileRead, Break, %A_ScriptDir%\tmp\break.txt
LureCount := 0
Loop %Lure%
{
FileRead, Break, %A_ScriptDir%\tmp\break.txt
If (Break = 1)
{
break
}
else
{
}
LureCount := LureCount +1
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Catch := 0
Loop
{
If (Catch = 1)
{
break
}
else
{
Base := getProcessBaseAddress()
CaughtWater := ReadMemory((ReadMemory(base + 0x008E5360) + 0xBD150))
CaughtLava := ReadMemory(((ReadMemory(base + 0x008E5360) + 0xBD150) + 0x4A4))
If (CaughtWater = 1 or CaughtLava = 1)
{
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Random, Wait, 2000, 3500
Sleep, %Wait%
Catch := 1
}
else
{
Sleep, 500
}
}
}
}
ExitApp
getProcessBaseAddress()
{
Global Handle
return DllCall( A_PtrSize = 4
? "GetWindowLong"
: "GetWindowLongPtr"
, "Ptr", Handle
, "Int", -6
, "Int64") ; Use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit
; If DLL call fails, returned value will = 0
}
ReadMemory(MADDRESS)
{
Global pid
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
;DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
return, result
}

LureCount := 0
Loop %Lure%
{
base := getProcessBaseAddress()
pointerBase := base + 0x008E8E18
y1 := ReadMemory(pointerBase)
y2 := ReadMemory(y1 + 0x9c)
y3 := ReadMemory(y2 + 0x78)
y4 := ReadMemory(y3 + 0x0)
y5 := y4 + 0x58
Lure := ReadMemory(y5)
FileRead, Break, %A_ScriptDir%\tmp\break.txt
If (Break = 1)
{
break
}
else
{
}
LureCount := LureCount +1
CaughtWater := ReadMemory((ReadMemory(base + 0x008E5360) + 0xBD150))
CaughtLava := ReadMemory(((ReadMemory(base + 0x008E5360) + 0xBD150) + 0x4A4))
If (CaughtWater = 0 or CaughtLava = 0)
{
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Catch := 0
Loop
{
If (Catch = 1)
{
break
}
else
{
Base := getProcessBaseAddress()
CaughtWater := ReadMemory((ReadMemory(base + 0x008E5360) + 0xBD150))
CaughtLava := ReadMemory(((ReadMemory(base + 0x008E5360) + 0xBD150) + 0x4A4))
If (CaughtWater = 1 or CaughtLava = 1)
{
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Random, Wait, 2000, 3500
Sleep, %Wait%
Catch := 1
}
else
{
Sleep, 500
}
}
}
}
Else
{
Random, Wait, 1000, 2500
Sleep, %Wait%
}
}
ExitApp
#NoEnv
SendMode Input
CoordMode, ToolTip, Screen
SetTitleMatchMode, 3
SetKeyDelay, 0, 2
Numpad9::
WinGet, pidn, PID, A
pid := pidn
WinGet, hwnds, ID, A
Handle := hwnds
Break := 0
InputBox, Lure, Lure's, How many Lure's do you have in inventory?
LureCount := 0
Loop %Lure%
{
LureCount := LureCount +1
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Catch := 0
Loop
{
If (Break = 1 or Catch = 1)
{
break
}
else
{
Base := getProcessBaseAddress()
pointerBase := base + 0x008E5360
y1 := ReadMemory(pointerBase)
y2 := ReadMemory(y1 + 0x20)
y3 := ReadMemory(y2 + 0x4)
y4 := y3 + 0x320
CameraY := ReadMemory(y4)
If (CameraY = 1)
{
ToolTips = 1
SetTimer, ToolTip, 500
ControlSend, , {f down}, ahk_pid %pid%
Sleep, 86
ControlSend, , {f up}, ahk_pid %pid%
Random, Wait, 2000, 3500
Sleep, %Wait%
Catch := 1
}
else
{
ToolTips = 0
SetTimer, ToolTip, 500
Sleep, 500
}
}
}
}
Break := 1
ToolTips = 2
SetTimer, ToolTip, 500
return
!Numpad9::
Break := 1
ToolTip
return
Numpad7::
ExitApp
ToolTip:
If (ToolTips = 0)
ToolTip, Waiting.. %LureCount%/%Lure% Lures used, 0, 0
Else If (ToolTips = 1)
ToolTip, Catching Fish! %LureCount%/%Lure% Lures used, 0, 0
Else If (ToolTips = 2)
ToolTip, !!All Lure's Have Been Used!!, 0, 0
Return
getProcessBaseAddress()
{
Global Handle
return DllCall( A_PtrSize = 4
? "GetWindowLong"
: "GetWindowLongPtr"
, "Ptr", Handle
, "Int", -6
, "Int64") ; Use Int64 to prevent negative overflow when AHK is 32 bit and target process is 64bit
; If DLL call fails, returned value will = 0
}
ReadMemory(MADDRESS)
{
Global pid
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
;DllCall("ReadProcessMemory","UInt",ProcessHandle,"UInt",MADDRESS,"Str",MVALUE,"UInt",4,"UInt *",0)
DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
return, result
}