Code:
#SingleInstance force
#Persistent
#IfWinActive, Trove
SetBatchLines -1
SplashTextOn, 500,25, mpFollowingBots, Initializing and updating pointers, please wait...
SetWorkingDir %A_ScriptDir%
global Ver:=1.1
global _Version:=0
global _Pointer:="0x0"
global _xOffset:="0x0"
global _yOffset:="0x0"
global _zOffset:="0x0"
global iniFile := A_ScriptDir . "/config.ini"
global fight := False
global KB := true
global sHKMain := "Numpad0"
global sHKFight := "Numpad1"
global sHKCollect := "Numpad2"
global sTR := 1
global sFR := 5
global sUPDRate := 199
If (FileExist(iniFile)){
IniRead, _Version, %iniFile%, Global, _Version
IniRead, _Pointer, %iniFile%, Global, _Pointer
IniRead, _xOffset, %iniFile%, Global, _xOffset
IniRead, _yOffset, %iniFile%, Global, _yOffset
IniRead, _zOffset, %iniFile%, Global, _zOffset
IniRead, _zOffset, %iniFile%, Global, _zOffset
IniRead, sHKMain, %iniFile%, Hotkeys, sHKMain, %A_Space%
IniRead, sHKFight, %iniFile%, Hotkeys, sHKFight, %A_Space%
IniRead, sHKCollect, %iniFile%, Hotkeys, sHKCollect, %A_Space%
IniRead, KB, %iniFile%, Global, QWERTY
IniRead, sTR, %iniFile%, Global, sTR
IniRead, sFR, %iniFile%, Global, sFR
IniRead, sUPDRate, %iniFile%, Global, sUPDRate
}ELSE{
IniWrite, %sHKMain%, %iniFile%, Hotkeys, sHKMain
IniWrite, %sHKFight%, %iniFile%, Hotkeys, sHKFight
IniWrite, %sHKCollect%, %iniFile%, Hotkeys, sHKCollect
IniWrite, %KB%, %iniFile%, Global, QWERTY
IniWrite, %sTR%, %iniFile%, Global, sTR
IniWrite, %sFR%, %iniFile%, Global, sFR
IniWrite, %sUPDRate%, %iniFile%, Global, sUPDRate
}
url := "https://dl.dropb" + "oxuserconten*****m/u/52517919/MpFollowingBotsPointer.txt"
WebRequest := ComObjCreate("WinHttp.WinHttpRequest.5.1")
WebRequest.Open("GET", url)
WebRequest.Send()
Contents := StrSplit(WebRequest.ResponseText, "$")
if (Contents[1] > _Version){
global _Version:=Contents[1]
global _Pointer:=Contents[2]
global _xOffset:=Contents[3]
global _yOffset:=Contents[4]
global _zOffset:=Contents[5]
IniWrite, %_Version%, %iniFile%, Global, _Version
IniWrite, %_Pointer%, %iniFile%, Global, _Pointer
IniWrite, %_xOffset%, %iniFile%, Global, _xOffset
IniWrite, %_yOffset%, %iniFile%, Global, _yOffset
IniWrite, %_zOffset%, %iniFile%, Global, _zOffset
TrayTip ,mpFollowingBots, % "Values updated to :`nPointer : " _Pointer "`nX offset : " _xOffset "`nY offset : "_yOffset "`nZ offset : " _zOffset
}
global X := 0
global Y := 0
global Z := 0
global Mp := -1
Gui 1:-Resize -MinimizeBox
Gui, 1:Add, ListView, xm ym Checked grid -ReadOnly -LV0x10 w700, Window pid|Handle|Base Address|X Adress|X Value|Y Adress|Y Value|Z Adress|Z Value|Message
Gui, 1:Add, Button, w700 gConfig , &Config
Gui 2:-Resize -MinimizeBox
Gui, 2:Add, Text, xm, Hotkeys :
Gui, 2:Add, Text, xm, Main hotkey :
Gui, 2:Add, Text, xm, Fight hotkey :
Gui, 2:Add, Text, xm, Auto collect hotkey :
Gui, 2:Add, Hotkey, ym x+5 gAssignCollect vHKCollect, %sHKCollect%
Gui, 2:Add, Hotkey, gAssignFight vHKFight, %sHKFight%
Gui, 2:Add, Hotkey, gAssignMain vHKMain, %sHKMain%
Gui, 2:Add, Text, xm, Others :
Gui, 2:Add, Checkbox, xm Checked%KB% vKeyboard, Checked : QWERTY/ Unchecked : AZERTY
Gui, 2:Add, Text, xm, Travelling range : 0
Gui, 2:Add, Slider, Range0-10 ToolTip x+5 vTR gTraRange, %sTR%
Gui, 2:Add, Text, x+5,10
Gui, 2:Add, Text, xm, Fighting range : 0
Gui, 2:Add, Slider, Range0-10 ToolTip x+5 vFR gFigRange, %sFR%
Gui, 2:Add, Text, x+5,10
Gui, 2:Add, Text, xm, Update rate (ms) :
Gui, 2:Add, Edit, x+5 vUPDRate gUPDRateAssign, %sUPDRate%
Gui, 2:Add, Button, xm gDebug , &Copy Debug Data
Hotkey, %sHKMain%, Main, On
Hotkey, %sHKFight%, Fight, On
Hotkey, %sHKCollect%, Collect, On
SplashTextOff
if (Contents[6] > Ver){
num := Contents[7]
url = https://www.mpgh.net/forum/showthread.php?t=%num%
MsgBox, 4,, New version available, go to MPGH topic ? (press Yes or No)
IfMsgBox Yes
Run %url%
}
Gui, 1:Show,,mpFollowingBots
SetTimer, UpdateGui, 999
TrayTip ,mpFollowingBots, Bot started !`nPress numPad0 to select your main account !`nEnsure others are facing SOUTH !
return
Main:
WinGet, p, pid, A
WinGet, process, ProcessName, ahk_pid %p%
IF (process = "Trove.exe"){
IF (Mp <> p){
Mp := p
TrayTip ,mpFollowingBots, % "New main account set : " Mp
SetTimer, Move, %sUPDRate%
}ELSE{
Mp := -1
TrayTip ,mpFollowingBots, Bot Paused
SetTimer, Move, Off
SetTimer, Collecting, Off
SetTimer, Fighting, Off
Sleep, 999
WinGet, l, list, ahk_exe Trove.exe
Loop %l%
ControlSend, , {w up}{a up}{z up}{q up}{s up}{d up}, % "ahk_id " l%a_index%
}
}
return
Fight:
fight := !fight
IF (fight){
SetTimer, Fighting, 999
TrayTip ,mpFollowingBots, Fighting Mode
}
ELSE{
SetTimer, Fighting, Off
TrayTip ,mpFollowingBots, Travelling Mode
Sleep, 1000
WinGet, l, list, ahk_exe Trove.exe
Loop %l%{
WinGet, p, pid,% "ahk_id " l%a_index%
IF (p != Mp)
IF (KB)
ControlSend, , z, ahk_pid %p%
ELSE
ControlSend, , w, ahk_pid %p%
}
}
return
Collect:
collect := !collect
IF (collect){
SetTimer, Collecting, 999
TrayTip ,mpFollowingBots, Collect On
}
ELSE{
SetTimer, Collecting, Off
TrayTip ,mpFollowingBots, Collect Off
WinGet, l, list, ahk_exe Trove.exe
Loop %l%{
WinGet, p, pid,% "ahk_id " l%a_index%
IF (p != Mp)
ControlSend, , {e up}, ahk_pid %p%
}
}
return
Move:
WinGet, l, list, ahk_exe Trove.exe
Loop %l%{
WinGet, p, pid,% "ahk_id " l%a_index%
BaseAddress := getProcessBaseAddress(l%a_index%)
xAddress := GetAddress(p, BaseAddress, _Pointer, _xOffset)
yAddress := GetAddress(p, BaseAddress, _Pointer, _yOffset)
zAddress := GetAddress(p, BaseAddress, _Pointer, _zOffset)
xValue := ReadMemory(xAddress, p)
yValue := ReadMemory(yAddress, p)
zValue := ReadMemory(zAddress, p)
IF (4294967295 - xValue < xValue)
xValue := xValue - 4294967295
IF (4294967295 - yValue < yValue)
yValue := yValue - 4294967295
IF (4294967295 - zValue < zValue)
zValue := zValue - 4294967295
IF (p == Mp){
X := xValue
Y := yValue
Z := zValue
}ELSE{
dX := X - xValue
dY := Y - yValue
dZ := Z - zValue
IF ((dX > sTR && !fight) || (dX > sFR && fight))
IF (KB)
ControlSend, , {d up}{a down}, ahk_pid %p%
ELSE
ControlSend, , {d up}{q down}, ahk_pid %p%
ELSE IF ((dX < -sTR && !fight) || (dX < -sFR && fight))
IF (KB)
ControlSend, , {a up}{d down}, ahk_pid %p%
ELSE
ControlSend, , {q up}{d down}, ahk_pid %p%
ELSE
ControlSend, , {q up}{d up}{a up}, ahk_pid %p%
IF ((dZ > sTR && !fight) || (dZ > sFR && fight))
IF (KB)
ControlSend, , {s up}{w down}, ahk_pid %p%
ELSE
ControlSend, , {s up}{z down}, ahk_pid %p%
ELSE IF ((dZ < -sTR && !fight) || (dZ < -sFR && fight))
IF (KB)
ControlSend, , {w up}{s down}, ahk_pid %p%
ELSE
ControlSend, , {z up}{s down}, ahk_pid %p%
ELSE
ControlSend, , {w up}{s up}{z up}, ahk_pid %p%
IF (dY > 1)
ControlSend, , {Space}, ahk_pid %p%
IF ((dX > sTR && !fight) || (dX > sFR && fight) || (dX < -sTR && !fight) || (dX < -sFR && fight) || (dZ < -sTR && !fight) || (dZ < -sFR && fight) || (dZ > sTR && !fight) || (dZ > sFR && fight)){
Random,r ,1,10
IF (r = 5)
ControlSend, , {w up}{a up}{z up}{q up}{s up}{d up}{Space}, ahk_pid %p%
}
}
}
return
Collecting:
WinGet, l, list, ahk_exe Trove.exe
Loop %l%
{
WinGet, p, pid,% "ahk_id " l%a_index%
IF (p != Mp){
ControlSend, , {e down}, ahk_pid %p%
Random, r, 999, 1999
Sleep, %r%
ControlSend, , {e up},ahk_pid %p%
}
}
return
Fighting:
WinGet, l, list, ahk_exe Trove.exe
Loop %l%{
WinGet, p, pid,% "ahk_id " l%a_index%
IF (p != Mp)
ControlSend, , {vk31}{vk32}, ahk_pid %p%
}
return
UpdateGui:
Gui, 1:Default
LV_DELETE()
WinGet, l, list, ahk_exe Trove.exe
Loop %l%{
WinGet, p, pid,% "ahk_id " l%a_index%
BaseAddress := getProcessBaseAddress(l%a_index%)
xAddress := GetAddress(p, BaseAddress, _Pointer, _xOffset)
yAddress := GetAddress(p, BaseAddress, _Pointer, _yOffset)
zAddress := GetAddress(p, BaseAddress, _Pointer, _zOffset)
xValue := ReadMemory(xAddress, p)
yValue := ReadMemory(yAddress, p)
zValue := ReadMemory(zAddress, p)
IF (4294967295 - xValue < xValue)
xValue := xValue - 4294967295
IF (4294967295 - yValue < yValue)
yValue := yValue - 4294967295
IF (4294967295 - zValue < zValue)
zValue := zValue - 4294967295
IF (Mp != -1 && (dX+dY+dZ)>30){
Message := "I'm lost"
TrayTip, %p% is lost !
}ELSE IF(fight)
Message := "Fight mode"
ELSE
Message := "Travelling mode"
IF (p = Mp)
LV_Add("Check", l%a_index%, p, BaseAddress, xAddress, xValue, yAddress, yValue, zAddress, zValue, "Main Account")
ELSE
LV_Add("", l%a_index%, p, BaseAddress, xAddress, xValue, yAddress, yValue, zAddress, zValue, Message)
}
GuiControlGet, KB,, Keyboard
LV_ModifyCol()
return
Debug:
message := "[SP" . "OILER=Debug][CO" . "DE]Version = " . Ver . "`nPointer = " . _Pointer . "`nX Offsets = " . _xOffset . "`nY Offsets = " . _yOffset . "`nZ Offsets = " . _zOffset
WinGet, l, list, ahk_exe Trove.exe
Loop %l%
{
Handle := l%a_index%
WinGet, pid, PID, ahk_id %Handle%
Base := getProcessBaseAddress(Handle)
xAddress := GetAddress(p, BaseAddress, _Pointer, _xOffset)
yAddress := GetAddress(p, BaseAddress, _Pointer, _yOffset)
zAddress := GetAddress(p, BaseAddress, _Pointer, _zOffset)
message := message . "`nClient" . i . ":`nPID = " . pid . "`nHandle = " . Handle . "`nBase = " . Base . "`nX Address = " . xAddress . "`nY Address = " . yAddress . "`nZ Address = " . zAddress
}
message := message . "[/CO" . "DE][/SPO" . "ILER]"
clipboard = %message%
MsgBox, Debug data copied to clipboard
return
TraRange:
sTR := TR
return
FigRange:
sFR := FR
return
AssignMain:
Hotkey, %sHKMain%, Main, Off
Hotkey, %HKMain%, Main, On
sHKMain := HKMain
MsgBox, Main hotkey set to %sHKMain%
return
AssignFight:
Hotkey, %sHKFight%, Fight, Off
Hotkey, %HKFight%, Fight, On
sHKFight := HKFight
MsgBox, Fight hotkey set to %sHKFight%
return
AssignCollect:
Hotkey, %sHKCollect%, Collect, Off
Hotkey, %HKCollect%, Collect, On
sHKCollect := HKCollect
MsgBox, Collect hotkey set to %sHKCollect%
return
UPDRateAssign:
sUPDRate := UPDRate
IF (Mp != -1)
SetTimer, Move, %sUPDRate%
return
Config:
Gui, 2:Show,,Config
return
GuiClose:
ExitApp
2GuiClose:
IniWrite, %sHKMain%, %iniFile%, Hotkeys, sHKMain
IniWrite, %sHKFight%, %iniFile%, Hotkeys, sHKFight
IniWrite, %sHKCollect%, %iniFile%, Hotkeys, sHKCollect
IniWrite, %KB%, %iniFile%, Global, QWERTY
IniWrite, %sTR%, %iniFile%, Global, sTR
IniWrite, %sFR%, %iniFile%, Global, sFR
IniWrite, %sUPDRate%, %iniFile%, Global, sUPDRate
Gui, 2:Hide
return
getProcessBaseAddress(Handle){
Return DllCall( A_PtrSize = 4 ? "GetWindowLong": "GetWindowLongPtr", "Ptr", Handle, "Int", -6, "Int64")
}
GetAddress(PID, Base, Address, Offset){
p := ReadMemory(base + Address,PID)
OffsetSplit := StrSplit(Offset, "+")
OffsetCount := OffsetSplit.MaxIndex()
Loop, %OffsetCount%{
IF (a_index = OffsetCount)
p := p + OffsetSplit[a_index]
ELSE
p := ReadMemory(p + OffsetSplit[a_index],PID)
}
Return p
}
ReadMemory(MADDRESS, pid){
VarSetCapacity(MVALUE,4,0)
ProcessHandle := DllCall("OpenProcess", "Int", 24, "Char", 0, "UInt", pid, "UInt")
DllCall("ReadProcessMemory", "UInt", ProcessHandle, "Ptr", MADDRESS, "Ptr", &MVALUE, "Uint",4)
Loop 4
result += *(&MVALUE + A_Index-1) << 8*(A_Index-1)
Return result
}