Code:
import time
import pymem
import pymem.process
import win32api
import win32gui
import win32con
# Game process name
PROCESS_NAME = "PathOfExileSteam.exe"
# Offsets (Verify with Cheat Engine!)
OFFSETS = {
"CurMP": [0x38, 0x0, 0x80, 0x2B0, 0x230],
"MaxMP": [0x38, 0x0, 0x80, 0x2B0, 0x22C],
"CurHP": [0x70, 0x0, 0x80, 0x2B0, 0x1E0],
"MaxHP": [0x38, 0x0, 0x80, 0x2B0, 0x1DC]
}
# HP & MP usage thresholds
HEAL_HP = 70 # Use health flask when HP drops below 70%
HEAL_MP = 40 # Use mana flask when MP drops below 40%
# Connect to memory
try:
pm = pymem.Pymem(PROCESS_NAME)
module = pymem.process.module_from_name(pm.process_handle, PROCESS_NAME)
base_address = module.lpBaseOfDll + 0x03B9AD28 # New base address
print(f"âś… Connected to: {PROCESS_NAME}")
print(f"âś… Dynamic Base Address: {hex(base_address)}")
except Exception as e:
print(f"❌ Error: {e}")
exit()
# Find game window
def find_poe_window():
hwnd_list = []
def win_enum_handler(hwnd, ctx):
if win32gui.IsWindowVisible(hwnd):
title = win32gui.GetWindowText(hwnd)
if "path of exile" in title.lower():
ctx.append(hwnd)
win32gui.EnumWindows(win_enum_handler, hwnd_list)
return hwnd_list[0] if hwnd_list else None
game_window = find_poe_window()
if not game_window:
print("❌ Game window not found.")
exit()
else:
print(f"âś… Game window found! HWND: {game_window}")
# Pointer calculation function
def get_pointer_address(base, offsets):
try:
address = pm.read_longlong(base)
for offset in offsets[:-1]:
address = pm.read_longlong(address + offset)
if not address:
return None
return address + offsets[-1]
except pymem.exception.MemoryReadError as e:
print(f"❌ Memory read error: {e}")
return None
# Main loop
while True:
try:
max_hp_addr = get_pointer_address(base_address, OFFSETS["MaxHP"])
cur_hp_addr = get_pointer_address(base_address, OFFSETS["CurHP"])
max_mp_addr = get_pointer_address(base_address, OFFSETS["MaxMP"])
cur_mp_addr = get_pointer_address(base_address, OFFSETS["CurMP"])
if None in [max_hp_addr, cur_hp_addr, max_mp_addr, cur_mp_addr]:
print("❌ Invalid memory address. Retrying...")
time.sleep(1)
continue
current_hp = pm.read_int(cur_hp_addr)
max_hp = pm.read_int(max_hp_addr)
current_mp = pm.read_int(cur_mp_addr)
max_mp = pm.read_int(max_mp_addr)
hp_percent = (current_hp / max_hp) * 100 if max_hp != 0 else 0
mp_percent = (current_mp / max_mp) * 100 if max_mp != 0 else 0
print(f"❤️ HP: {current_hp}/{max_hp} ({hp_percent:.2f}%) | 💧 MP: {current_mp}/{max_mp} ({mp_percent:.2f}%)")
if hp_percent <= HEAL_HP:
time.sleep(0.2)
win32api.PostMessage(game_window, win32con.WM_KEYDOWN, ord('1'), 0)
win32api.PostMessage(game_window, win32con.WM_KEYUP, ord('1'), 0)
if mp_percent <= HEAL_MP:
time.sleep(0.2)
win32api.PostMessage(game_window, win32con.WM_KEYDOWN, ord('2'), 0)
win32api.PostMessage(game_window, win32con.WM_KEYUP, ord('2'), 0)
except Exception as e:
print(f"❌ General error: {e}")
time.sleep(0.5)[/I][/I]
edit: there we go lol