Autopot by YoungFlyme | Updated Pointer and Offset's
Original Thread https://www.mpgh.net/forum/showthread.php?t=1153911
But i got the source on https://www.mpgh.net/forum/showthread.php?t=1431927
Working: April 29, 2019
But i got the source on https://www.mpgh.net/forum/showthread.php?t=1431927
Working: April 29, 2019
Code:
#NoEnv
#SingleInstance, Force
#WinActivateForce
SendMode Input
SetWorkingDir %A_ScriptDir%
global Pointer:="0x00FFAF90"
global MaxOffset:="0x1C+0x30+0xC4+0x6C+0x388"
global RealOffset:="0x1C+0x30+0xC4+0x6C+0x384"
global iniFile := A_ScriptDir . "/hppot_ptr.ini"
FirstRun := 1
if (FileExist(iniFile)){
IniRead, Pointer, %iniFile%, Global, Pointer
IniRead, MaxOffset, %iniFile%, Global, MaxOffset
IniRead, RealOffset, %iniFile%, Global, RealOffset
}
else{
IniWrite, %Pointer%, %iniFile%, Global, Pointer
IniWrite, %MaxOffset%, %iniFile%, Global, MaxOffset
IniWrite, %RealOffset%, %iniFile%, Global, RealOffset
}
if FirstRun = 1
{
Gui, font, s10, Verdana
Gui, Add, GroupBox, x10 y15 w165 h100, AutoPot Settings
Gui, font
Gui, Add, text, x20 y35, Heal on
Gui, Add, Edit, x60 y32 w27 Number Limit2 vHeal, 50
Gui, Add, text, x90 y35, percent
Gui, Add, Checkbox, x20 y65 vNotifications, Windows notifications?
Gui, Add, Button, x25 y90 w140 h22 default gSaveSettings, Start
Gui, Show, x386 y200 h120 w185, AutoPot
}
return
SaveSettings:
Gui, Submit
FirstRun = 0
AutoHeal = off
Gui, Destroy
AutoHeal = on
SetTimer, AutoHeal, 100
SoundPlay, %A_WinDir%\Media\Windows Ding.wav
If (Notifications)= 1{
TrayTip ,AutoPot, Bot started! Press "Num 7" again to stop the bot!
}
return
NumPad7::
If AutoHeal = off
{
AutoHeal = on
SetTimer, AutoHeal, 100
SoundPlay, %A_WinDir%\Media\Windows Ding.wav
If (Notifications)= 1{
TrayTip ,AutoPot, Bot started! Press "Num 7" again to stop the bot!
}
return
} else If AutoHeal = on
{
AutoHeal = off
SetTimer, AutoHeal, Off
SoundPlay, %A_WinDir%\Media\Windows Ding.wav
sleep 80
SoundPlay, %A_WinDir%\Media\Windows Ding.wav
If (Notifications) = 1{
TrayTip ,AutoPot, Bot stopped! Press "Num 7" again to start the bot!
}
}
return
AutoHeal:
WinGet, l, list, Trove
Loop %l%
{
d := l%a_index%
WinGet, pid, PID, ahk_id %d%
WinGet, Handle, ID, ahk_pid %pid%
Base := getProcessBaseAddress(Handle)
MaxAddress := GetAddress(pid, Base, Pointer, MaxOffset)
RealAddress := GetAddress(pid, Base, Pointer, RealOffset)
MaxValue := ReadMemory(MaxAddress, pid)
RealValue := ReadMemory(RealAddress, pid)
if (RealValue < MaxValue/100*Heal){
ControlSend, , {q down}, ahk_pid %pid%
Sleep, 90
ControlSend, , {q up}, ahk_pid %pid%
heal += 1
Sleep, 1000
}
}
return
getProcessBaseAddress(Handle){
Return DllCall( A_PtrSize = 4
? "GetWindowLong"
: "GetWindowLongPtr"
, "Ptr", Handle
, "Int", -6
, "Int64")
}
GetAddress(PID, Base, Address, Offset){
PointerBase := base + Address
y := ReadMemory(PointerBase,PID)
OffsetSplit := StrSplit(Offset, "+")
OffsetCount := OffsetSplit.MaxIndex()
Loop, %OffsetCount%{
if (a_index = OffsetCount) {
Address := (y + OffsetSplit[a_index])
}Else
if(a_index = 1) {
y := ReadMemory(y + OffsetSplit[a_index],PID)
}Else{
y := ReadMemory(y + OffsetSplit[a_index],PID)
}
}
Return Address
}
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
}
ToolTipDisplay(Message) {
ToolTip, %Message%
SetTimer, RemoveToolTip, 5000
return
}
RemoveToolTip:
SetTimer, RemoveToolTip, Off
ToolTip
return

