Skip to content

@doskir /ExpCalculator.au3 secret
Last active

Embed URL

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
PoE Exp Calculator from www.toolsofexile.com
;Developed by www.toolsofexile.com
TraySetState(2)
HotKeySet("{F3}", "Reset")
HotKeySet("{F4}", "Close")
#RequireAdmin
If IsAdmin() = 0 Then
MsgBox(0, "", "You are not running as an administrator! Please right-click this program, then click Run As Administrator.")
Exit
EndIf
SETPRIVILEGE("SeDebugPrivilege", 1)
$PID = ProcessExists("Client.exe")
If $PID = 0 Then
MsgBox(0, "", "Please run Path of Exile before starting this program.")
Exit
EndIf
$HANDLE = _MEMORYOPEN($PID)
If $HANDLE = 0 Then
MsgBox(0, "", "Unable to open the Path of Exile process to read memory. Please ensure you do not have any software blocking this program from running properly, such as anti-virus software.")
Exit
EndIf
$BASEADDRESS = GETBASEADDRESS($PID)
$PLAYERBASE = $BASEADDRESS + 7141876
$PLAYERBASE = _MEMORYREAD($PLAYERBASE, $HANDLE, "dword")
Local $EXPMINOFFSETS[8] = [1112, 88, 1924, 776, 508, 124, 124, 824]
Local $EXPMAXOFFSETS[8] = [1112, 88, 1924, 776, 508, 124, 124, 828]
Local $LEVELOFFSETS[8] = [1112, 88, 1924, 776, 508, 124, 124, 832]
$TIME = TimerInit()
$STARTEXP = READPOINTER($PLAYERBASE, $HANDLE, $EXPMINOFFSETS)
$CURLEVEL = READPOINTER($PLAYERBASE, $HANDLE, $LEVELOFFSETS)
While 1
If ProcessExists("Client.exe") = False Then
Exit
EndIf
$EXPMIN = READPOINTER($PLAYERBASE, $HANDLE, $EXPMINOFFSETS)
$EXPMAX = READPOINTER($PLAYERBASE, $HANDLE, $EXPMAXOFFSETS)
$LEVEL = READPOINTER($PLAYERBASE, $HANDLE, $LEVELOFFSETS)
$EXPGAINED = $EXPMIN - $STARTEXP
If $EXPGAINED < 0 Then
$EXPGAINED = 0
EndIf
$EXPREMAINING = $EXPMAX - $EXPMIN
$TTL = 0
$SECONDS = TimerDiff($TIME) / 1000
$MINUTES = Round(Floor(Mod($SECONDS / 60, 60)))
$HOURS = Round(Floor($SECONDS / 3600))
$SECONDS = Round(Mod($SECONDS, 60))
$RUNTIME = $HOURS & ":" & $MINUTES & ":" & $SECONDS
$EXPHOUR = 0
If $EXPGAINED > 0 Then
$RUNNINGHOURS = TimerDiff($TIME) / (1000 * 60 * 60)
$EXPHOUR = Round($EXPGAINED / $RUNNINGHOURS)
$TTLHOURS = $EXPREMAINING / $EXPHOUR
$TTLMINUTES = $TTLHOURS * 60
$TTLSECONDS = $TTLMINUTES * 60
$INIT = $TTLSECONDS
$HRS = Round(Floor($INIT / 3600))
$MINS = Round(Floor(Mod(($INIT / 60), 60)))
$SECS = Round(Mod($INIT, 60))
$TTL = $HRS & ":" & $MINS & ":" & $SECS
If $EXPHOUR > 10000 Then
$EXPHOUR = Round($EXPHOUR / 1000)
$EXPHOUR = ADDCOMMAS($EXPHOUR)
$EXPHOUR = $EXPHOUR & "k"
EndIf
EndIf
If $EXPMIN > 10000 Then
$EXPMIN = Round($EXPMIN / 1000)
$EXPMIN = ADDCOMMAS($EXPMIN)
$EXPMIN = $EXPMIN & "k"
EndIf
If $EXPMAX > 10000 Then
$EXPMAX = Round($EXPMAX / 1000)
$EXPMAX = ADDCOMMAS($EXPMAX)
$EXPMAX = $EXPMAX & "k"
EndIf
ToolTip("Experience: " & $EXPMIN & " / " & $EXPMAX & @CRLF & "Exp/hr: " & $EXPHOUR & @CRLF & "TTL: " & $TTL & @CRLF & "Running Time: " & $RUNTIME, @DesktopWidth / 1.5, 0, "Level: " & $LEVEL)
Sleep(1000)
WEnd
Func CLOSE()
_MEMORYCLOSE($HANDLE)
Exit
EndFunc
Func ADDCOMMAS($STRING)
$T = 0
$FINAL = ""
$VAR = $STRING
$RESULT = StringSplit($VAR, "")
For $X = $RESULT[0] To 1 Step -1
$T = $T + 1
If $T = 4 Then
$FINAL = "," & $FINAL
$T = 1
EndIf
$FINAL = $RESULT[$X] & $FINAL
Next
Return $FINAL
EndFunc
Func READPOINTER($BASE, $HAND, $OFFSETS)
$CURADDRESS = $BASE
For $X = 0 To UBound($OFFSETS) - 1
$CURADDRESS = _MEMORYREAD($CURADDRESS + $OFFSETS[$X], $HAND, "dword")
Next
Return $CURADDRESS
EndFunc
Func RESET()
$TIME = TimerInit()
$STARTEXP = READPOINTER($PLAYERBASE, $HANDLE, $EXPMINOFFSETS)
$CURLEVEL = READPOINTER($PLAYERBASE, $HANDLE, $LEVELOFFSETS)
EndFunc
Func GETBASEADDRESS($PROCESSID)
$HSNAP = DllCall("Kernel32.dll", "HANDLE", "CreateToolhelp32Snapshot", "DWORD", 8, "DWORD", $PROCESSID)
$STMODULE = DllStructCreate("DWORD dwSize;DWORD th32ModuleID;DWORD th32ProcessID;" & "DWORD GlblcntUsage;DWORD ProccntUsage;ptr modBaseAddr;" & "DWORD modBaseSize;HANDLE hModule;WCHAR szModule[256];" & "WCHAR szExePath[260]")
DllStructSetData($STMODULE, "dwSize", DllStructGetSize($STMODULE))
$RET = DllCall("Kernel32.dll", "BOOLEAN", "Module32FirstW", "HANDLE", $HSNAP[0], "ptr", DllStructGetPtr($STMODULE))
If ($RET[0] = False) Then
DllCall("Kernel32.dll", "BOOLEAN", "CloseHandle", "HANDLE", $HSNAP[0])
Return 0
Else
$RET[0] = True
Do
If DllStructGetData($STMODULE, "szModule") = "Client.exe" Then
DllCall("Kernel32.dll", "BOOLEAN", "CloseHandle", "HANDLE", $HSNAP[0])
Return DllStructGetData($STMODULE, "modBaseAddr")
EndIf
$RET = DllCall("Kernel32.dll", "BOOLEAN", "Module32NextW", "HANDLE", $HSNAP[0], "ptr", DllStructGetPtr($STMODULE))
Until $RET[0] = False
EndIf
EndFunc
#region _Memory
Func _MEMORYOPEN($IV_PID, $IV_DESIREDACCESS = 2035711, $IF_INHERITHANDLE = 1)
If Not ProcessExists($IV_PID) Then
SetError(1)
Return 0
EndIf
Local $AH_HANDLE[2] = [DllOpen("kernel32.dll")]
If @error Then
SetError(2)
Return 0
EndIf
Local $AV_OPENPROCESS = DllCall($AH_HANDLE[0], "int", "OpenProcess", "int", $IV_DESIREDACCESS, "int", $IF_INHERITHANDLE, "int", $IV_PID)
If @error Then
DllClose($AH_HANDLE[0])
SetError(3)
Return 0
EndIf
$AH_HANDLE[1] = $AV_OPENPROCESS[0]
Return $AH_HANDLE
EndFunc
Func _MEMORYREAD($IV_ADDRESS, $AH_HANDLE, $SV_TYPE = "dword")
If Not IsArray($AH_HANDLE) Then
SetError(1)
Return 0
EndIf
Local $V_BUFFER = DllStructCreate($SV_TYPE)
If @error Then
SetError(@error + 1)
Return 0
EndIf
DllCall($AH_HANDLE[0], "int", "ReadProcessMemory", "int", $AH_HANDLE[1], "int", $IV_ADDRESS, "ptr", DllStructGetPtr($V_BUFFER), "int", DllStructGetSize($V_BUFFER), "int", "")
If Not @error Then
Local $V_VALUE = DllStructGetData($V_BUFFER, 1)
Return $V_VALUE
Else
SetError(6)
Return 0
EndIf
EndFunc
Func _MEMORYWRITE($IV_ADDRESS, $AH_HANDLE, $V_DATA, $SV_TYPE = "dword")
If Not IsArray($AH_HANDLE) Then
SetError(1)
Return 0
EndIf
Local $V_BUFFER = DllStructCreate($SV_TYPE)
If @error Then
SetError(@error + 1)
Return 0
Else
DllStructSetData($V_BUFFER, 1, $V_DATA)
If @error Then
SetError(6)
Return 0
EndIf
EndIf
DllCall($AH_HANDLE[0], "int", "WriteProcessMemory", "int", $AH_HANDLE[1], "int", $IV_ADDRESS, "ptr", DllStructGetPtr($V_BUFFER), "int", DllStructGetSize($V_BUFFER), "int", "")
If Not @error Then
Return 1
Else
SetError(7)
Return 0
EndIf
EndFunc
Func _MEMORYCLOSE($AH_HANDLE)
If Not IsArray($AH_HANDLE) Then
SetError(1)
Return 0
EndIf
DllCall($AH_HANDLE[0], "int", "CloseHandle", "int", $AH_HANDLE[1])
If Not @error Then
DllClose($AH_HANDLE[0])
Return 1
Else
DllClose($AH_HANDLE[0])
SetError(2)
Return 0
EndIf
EndFunc
Func _MEMORYPOINTERREAD($IV_ADDRESS, $AH_HANDLE, $AV_OFFSET, $SV_TYPE = "dword")
If IsArray($AV_OFFSET) Then
If IsArray($AH_HANDLE) Then
Local $IV_POINTERCOUNT = UBound($AV_OFFSET) - 1
Else
SetError(2)
Return 0
EndIf
Else
SetError(1)
Return 0
EndIf
Local $IV_DATA[2], $I
Local $V_BUFFER = DllStructCreate("dword")
For $I = 0 To $IV_POINTERCOUNT
If $I = $IV_POINTERCOUNT Then
$V_BUFFER = DllStructCreate($SV_TYPE)
If @error Then
SetError(@error + 2)
Return 0
EndIf
$IV_ADDRESS = "0x" & Hex($IV_DATA[1] + $AV_OFFSET[$I])
DllCall($AH_HANDLE[0], "int", "ReadProcessMemory", "int", $AH_HANDLE[1], "int", $IV_ADDRESS, "ptr", DllStructGetPtr($V_BUFFER), "int", DllStructGetSize($V_BUFFER), "int", "")
If @error Then
SetError(7)
Return 0
EndIf
$IV_DATA[1] = DllStructGetData($V_BUFFER, 1)
ElseIf $I = 0 Then
DllCall($AH_HANDLE[0], "int", "ReadProcessMemory", "int", $AH_HANDLE[1], "int", $IV_ADDRESS, "ptr", DllStructGetPtr($V_BUFFER), "int", DllStructGetSize($V_BUFFER), "int", "")
If @error Then
SetError(7)
Return 0
EndIf
$IV_DATA[1] = DllStructGetData($V_BUFFER, 1)
Else
$IV_ADDRESS = "0x" & Hex($IV_DATA[1] + $AV_OFFSET[$I])
DllCall($AH_HANDLE[0], "int", "ReadProcessMemory", "int", $AH_HANDLE[1], "int", $IV_ADDRESS, "ptr", DllStructGetPtr($V_BUFFER), "int", DllStructGetSize($V_BUFFER), "int", "")
If @error Then
SetError(7)
Return 0
EndIf
$IV_DATA[1] = DllStructGetData($V_BUFFER, 1)
EndIf
Next
$IV_DATA[0] = $IV_ADDRESS
Return $IV_DATA
EndFunc
Func _MEMORYPOINTERWRITE($IV_ADDRESS, $AH_HANDLE, $AV_OFFSET, $V_DATA, $SV_TYPE = "dword")
If IsArray($AV_OFFSET) Then
If IsArray($AH_HANDLE) Then
Local $IV_POINTERCOUNT = UBound($AV_OFFSET) - 1
Else
SetError(2)
Return 0
EndIf
Else
SetError(1)
Return 0
EndIf
Local $IV_STRUCTDATA, $I
Local $V_BUFFER = DllStructCreate("dword")
For $I = 0 To $IV_POINTERCOUNT
If $I = $IV_POINTERCOUNT Then
$V_BUFFER = DllStructCreate($SV_TYPE)
If @error Then
SetError(@error + 3)
Return 0
EndIf
DllStructSetData($V_BUFFER, 1, $V_DATA)
If @error Then
SetError(8)
Return 0
EndIf
$IV_ADDRESS = "0x" & Hex($IV_STRUCTDATA + $AV_OFFSET[$I])
DllCall($AH_HANDLE[0], "int", "WriteProcessMemory", "int", $AH_HANDLE[1], "int", $IV_ADDRESS, "ptr", DllStructGetPtr($V_BUFFER), "int", DllStructGetSize($V_BUFFER), "int", "")
If @error Then
SetError(9)
Return 0
Else
Return $IV_ADDRESS
EndIf
ElseIf $I = 0 Then
DllCall($AH_HANDLE[0], "int", "ReadProcessMemory", "int", $AH_HANDLE[1], "int", $IV_ADDRESS, "ptr", DllStructGetPtr($V_BUFFER), "int", DllStructGetSize($V_BUFFER), "int", "")
If @error Then
SetError(3)
Return 0
EndIf
$IV_STRUCTDATA = DllStructGetData($V_BUFFER, 1)
Else
$IV_ADDRESS = "0x" & Hex($IV_STRUCTDATA + $AV_OFFSET[$I])
DllCall($AH_HANDLE[0], "int", "ReadProcessMemory", "int", $AH_HANDLE[1], "int", $IV_ADDRESS, "ptr", DllStructGetPtr($V_BUFFER), "int", DllStructGetSize($V_BUFFER), "int", "")
If @error Then
SetError(3)
Return 0
EndIf
$IV_STRUCTDATA = DllStructGetData($V_BUFFER, 1)
EndIf
Next
EndFunc
Func SETPRIVILEGE($PRIVILEGE, $BENABLE)
Const $TOKEN_ADJUST_PRIVILEGES = 32
Const $TOKEN_QUERY = 8
Const $SE_PRIVILEGE_ENABLED = 2
Local $HTOKEN, $SP_AUXRET, $SP_RET, $HCURRPROCESS, $NTOKENS, $NTOKENINDEX, $PRIV
$NTOKENS = 1
$LUID = DllStructCreate("dword;int")
If IsArray($PRIVILEGE) Then $NTOKENS = UBound($PRIVILEGE)
$TOKEN_PRIVILEGES = DllStructCreate("dword;dword[" & (3 * $NTOKENS) & "]")
$NEWTOKEN_PRIVILEGES = DllStructCreate("dword;dword[" & (3 * $NTOKENS) & "]")
$HCURRPROCESS = DllCall("kernel32.dll", "hwnd", "GetCurrentProcess")
$SP_AUXRET = DllCall("advapi32.dll", "int", "OpenProcessToken", "hwnd", $HCURRPROCESS[0], "int", BitOR($TOKEN_ADJUST_PRIVILEGES, $TOKEN_QUERY), "int*", 0)
If $SP_AUXRET[0] Then
$HTOKEN = $SP_AUXRET[3]
DllStructSetData($TOKEN_PRIVILEGES, 1, 1)
$NTOKENINDEX = 1
While $NTOKENINDEX <= $NTOKENS
If IsArray($PRIVILEGE) Then
$NTOKENVAR = $NTOKENINDEX - 1
$PRIV = $PRIVILEGE[$NTOKENVAR]
Else
$PRIV = $PRIVILEGE
EndIf
$RET = DllCall("advapi32.dll", "int", "LookupPrivilegeValue", "str", "", "str", $PRIV, "ptr", DllStructGetPtr($LUID))
If $RET[0] Then
If $BENABLE Then
DllStructSetData($TOKEN_PRIVILEGES, 2, $SE_PRIVILEGE_ENABLED, (3 * $NTOKENINDEX))
Else
DllStructSetData($TOKEN_PRIVILEGES, 2, 0, (3 * $NTOKENINDEX))
EndIf
DllStructSetData($TOKEN_PRIVILEGES, 2, DllStructGetData($LUID, 1), (3 * ($NTOKENINDEX - 1)) + 1)
DllStructSetData($TOKEN_PRIVILEGES, 2, DllStructGetData($LUID, 2), (3 * ($NTOKENINDEX - 1)) + 2)
DllStructSetData($LUID, 1, 0)
DllStructSetData($LUID, 2, 0)
EndIf
$NTOKENINDEX += 1
WEnd
$RET = DllCall("advapi32.dll", "int", "AdjustTokenPrivileges", "hwnd", $HTOKEN, "int", 0, "ptr", DllStructGetPtr($TOKEN_PRIVILEGES), "int", DllStructGetSize($NEWTOKEN_PRIVILEGES), "ptr", DllStructGetPtr($NEWTOKEN_PRIVILEGES), "int*", 0)
$F = DllCall("kernel32.dll", "int", "GetLastError")
EndIf
$NEWTOKEN_PRIVILEGES = 0
$TOKEN_PRIVILEGES = 0
$LUID = 0
If $SP_AUXRET[0] = 0 Then Return 0
$SP_AUXRET = DllCall("kernel32.dll", "int", "CloseHandle", "hwnd", $HTOKEN)
If Not $RET[0] And Not $SP_AUXRET[0] Then Return 0
Return $RET[0]
EndFunc
Func _MEMORYGETBASEADDRESS($AH_HANDLE, $IHEXDEC = 0)
Local $IV_ADDRESS = 1048576
Local $V_BUFFER = DllStructCreate("dword;dword;dword;dword;dword;dword;dword")
Local $VDATA
Local $VTYPE
If Not IsArray($AH_HANDLE) Then
SetError(1)
Return 0
EndIf
DllCall($AH_HANDLE[0], "int", "VirtualQueryEx", "int", $AH_HANDLE[1], "int", $IV_ADDRESS, "ptr", DllStructGetPtr($V_BUFFER), "int", DllStructGetSize($V_BUFFER))
If Not @error Then
$VDATA = Hex(DllStructGetData($V_BUFFER, 2))
$VTYPE = Hex(DllStructGetData($V_BUFFER, 3))
While $VTYPE <> "00000080"
DllCall($AH_HANDLE[0], "int", "VirtualQueryEx", "int", $AH_HANDLE[1], "int", $IV_ADDRESS, "ptr", DllStructGetPtr($V_BUFFER), "int", DllStructGetSize($V_BUFFER))
$VDATA = Hex(DllStructGetData($V_BUFFER, 2))
$VTYPE = Hex(DllStructGetData($V_BUFFER, 3))
If Hex($IV_ADDRESS) = "01000000" Then ExitLoop
$IV_ADDRESS += 65536
WEnd
If $VTYPE = "00000080" Then
SetError(0)
If $IHEXDEC = 1 Then
Return Dec($VDATA)
Else
Return $VDATA
EndIf
Else
SetError(2)
Return 0
EndIf
Else
SetError(3)
Return 0
EndIf
EndFunc
#endregion _Memory
; DeTokenise by myAut2Exe >The Open Source AutoIT/AutoHotKey script decompiler< 2.12 build(185)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.