;;Simplest way to make hotkeys can be done other ways, Basically hit the button and it calls the function
;;I think we all know what this is
$PI = 3.14159265358979
;;Name of character logged into the client you wish to attach to
$Character_Name = "Tagy"
;;Value for how much to modify each axis
$Magnitude = 1
;;Offsets for coord pointers
Global $N3_Coord_Offsets[3],
$Client_Handles,
$Z_PTR,
$Y_PTR,
$X_PTR,
$VectorX_PTR ,
$VectorY_PTR $N3_DLL_Base_Offset = 0x63620
$N3_Coord_Offsets[0] = 0x84
$N3_Coord_Offsets[1] = 0x50
$N3_Coord_Offsets[2] = 0x60
;;call load pointers once at the start which will then update every 2 seconds
Load_Pointers()
;;Start a timer till refresh
;;Recalculate offsets every 2 seconds
Load_Pointers()
;;Delay to not waste cpu
;;Calculate my angle from both Vectors
Return Atan2
(_MemoryRead
($VectorY_PTR,
$Client_Handles[0],
"Float"),_MemoryRead
($VectorX_PTR,
$Client_Handles[0],
"Float"))*
180 /
$pi
;;Calculate the Vector for the angle specified
Func Angle_To_Vector
($Angle) $Heading = $Pi * $Angle / 180
$New_Vector[0] =
$Magnitude *
sin($Heading) $New_Vector[1] =
$Magnitude *
cos($Heading)
;;Atan2 a math function required for calcs
;;Load/update pointer data
;;Gets all 3 handles to the client based off of toon name
$Client_Handles = Get_AO_Client($Character_Name)
;;Calls Create_Pointer_Path and returns the Z axis address
$Coord_PTR = Create_Pointer_Path("n3.dll", $N3_DLL_Base_Offset, $N3_Coord_Offsets)
;;Declaring the addresses needed based off the Z axis
$Z_PTR = $Coord_PTR
$Y_PTR = $Coord_PTR + 0x4
$X_PTR = $Coord_PTR - 0x4
$VectorX_PTR = $Coord_PTR + 0x68
$VectorY_PTR = $Coord_PTR + 0x70
;;gets the final address in a pointer from a array of offsets
Func Create_Pointer_Path
($DLL_Name,
$Dll_Offset,
$Offset_Array) ;;Get the base address of n3.dll
$Address = _MemoryModuleGetBaseAddress($Client_Handles[2], $DLL_Name)+$DLL_Offset
;;Levels up the pointer
$Address = _MemoryRead($Address, $Client_Handles[0])+$Offset_Array[$I]
;;Returns the Z axis address
;It's not required to attach to a client by name it's just a function i like basically give it a toon name and it will attach to it
Func Get_AO_Client
($Name) ;;makes an array of all processes named Client.exe
;;makes an array of all Windows named Anarchy Online
;;it's messy looking but in this for loop it matches a bunch of data
For $C =
1 to $LIST[0][0] ;;Opens a temporary memory handle to the client to read it's name
$Temp_Handle = _Memoryopen($LIST[$C][1])
;;Gets the static address of the name
Global $Name_Addr = _MemoryModuleGetBaseAddress
($LIST[$C][1],
"Interfaces.dll")+0x2F844
;;Reads the name
$Name_Check = _MemoryRead($Name_Addr, $Temp_Handle, "Char[14]")
;;Checks the character name of the current client against the one in the parameters
;;Was true so opens the memory handle
$Client_Handles[0] = _Memoryopen($LIST[$C][1])
;;Process Handle
$Client_Handles[2] = $LIST[$C][1]
For $i =
1 To $WList[0][0] ;;Makes a for loop then compares the process handle to the window handle until true
;;Got the correct handle end the loop
$Client_Handles[1] = $WList[$i][1]
;;close the temporary handle
_MemoryClose($Temp_Handle)
;;Returns OpenMemory handle/Window handle/Process handle
;;Calculates the 2 vectors for the direction desired then updates the axis in the memory
$Vector = Angle_To_Vector(Get_Angle())
_MEMORYWRITE($X_PTR, $Client_Handles[0],_MEMORYREAD($X_PTR, $Client_Handles[0], "Float")+$Vector[0], "Float")
_MEMORYWRITE($Y_PTR, $Client_Handles[0],_MEMORYREAD($Y_PTR, $Client_Handles[0], "Float")+$Vector[1], "Float")
;;Calculates the 2 vectors for the direction desired then updates the axis in the memory
$Vector = Angle_To_Vector(Get_Angle()+180)
_MEMORYWRITE($X_PTR, $Client_Handles[0],_MEMORYREAD($X_PTR, $Client_Handles[0], "Float")+$Vector[0], "Float")
_MEMORYWRITE($Y_PTR, $Client_Handles[0],_MEMORYREAD($Y_PTR, $Client_Handles[0], "Float")+$Vector[1], "Float")
;;Calculates the 2 vectors for the direction desired then updates the axis in the memory
$Vector = Angle_To_Vector(Get_Angle()+90)
_MEMORYWRITE($X_PTR, $Client_Handles[0],_MEMORYREAD($X_PTR, $Client_Handles[0], "Float")+$Vector[0], "Float")
_MEMORYWRITE($Y_PTR, $Client_Handles[0],_MEMORYREAD($Y_PTR, $Client_Handles[0], "Float")+$Vector[1], "Float")
;;Calculates the 2 vectors for the direction desired then updates the axis in the memory
$Vector = Angle_To_Vector(Get_Angle()-90)
_MEMORYWRITE($X_PTR, $Client_Handles[0],_MEMORYREAD($X_PTR, $Client_Handles[0], "Float")+$Vector[0], "Float")
_MEMORYWRITE($Y_PTR, $Client_Handles[0],_MEMORYREAD($Y_PTR, $Client_Handles[0], "Float")+$Vector[1], "Float")
;;Reads the Z axis and adds the Magnitude variable onto it then rewrites it
_MEMORYWRITE($Z_PTR, $Client_Handles[0],_MEMORYREAD($Z_PTR, $Client_Handles[0], "Float")+$Magnitude, "Float")
;;Reads the Z axis and subtracts the Magnitude variable onto it then rewrites it
_MEMORYWRITE($Z_PTR, $Client_Handles[0],_MEMORYREAD($Z_PTR, $Client_Handles[0], "Float")-$Magnitude, "Float")
;;Opens the processes memory
Func _MemoryOpen
($iv_Pid,
$iv_DesiredAccess = 0x1F0FFF,
$iv_InheritHandle =
1) Local $av_OpenProcess =
DllCall($ah_Handle[0],
'int',
'OpenProcess',
'int',
$iv_DesiredAccess,
'int',
$iv_InheritHandle,
'int',
$iv_Pid) $ah_Handle[1] = $av_OpenProcess[0]
;;Reads the processes memory.
Func _MemoryRead
($iv_Address,
$ah_Handle,
$sv_Type =
'dword') DllCall($ah_Handle[0],
'int',
'ReadProcessMemory',
'int',
$ah_Handle[1],
'int',
$iv_Address,
'ptr',
DllStructGetPtr($v_Buffer),
'int',
DllStructGetSize($v_Buffer),
'int',
'')
;;Writes to the processes memory
Func _MemoryWrite
($iv_Address,
$ah_Handle,
$v_Data,
$sv_Type =
'dword') DllCall($ah_Handle[0],
'int',
'WriteProcessMemory',
'int',
$ah_Handle[1],
'int',
$iv_Address,
'ptr',
DllStructGetPtr($v_Buffer),
'int',
DllStructGetSize($v_Buffer),
'int',
'')
;;Closes a handle to the memory
Func _MemoryClose
($ah_Handle) DllCall($ah_Handle[0],
'int',
'CloseHandle',
'int',
$ah_Handle[1])
;;I don't know it wasn't made by me
Func SetPrivilege
( $privilege,
$bEnable ) Const $TOKEN_ADJUST_PRIVILEGES = 0x0020
Const $TOKEN_QUERY = 0x0008
Const $SE_PRIVILEGE_ENABLED = 0x0002
Local $hToken,
$SP_auxret,
$SP_ret,
$hCurrProcess,
$nTokens,
$nTokenIndex,
$priv $nTokens = 1
$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_ptr",
0) $hToken = $SP_auxret[3]
$nTokenIndex = 1
While $nTokenIndex <=
$nTokens $priv = $privilege[$nTokenIndex-1]
$priv = $privilege
$ret =
DLLCall("advapi32.dll",
"int",
"LookupPrivilegeValue",
"str",
"",
"str",
$priv, _
$nTokenIndex += 1
$ret =
DLLCall("advapi32.dll",
"int",
"AdjustTokenPrivileges",
"hwnd",
$hToken,
"int",
0, _
$f =
DLLCall("kernel32.dll",
"int",
"GetLastError") $NEWTOKEN_PRIVILEGES=0
$TOKEN_PRIVILEGES=0
$LUID=0
$SP_auxret =
DLLCall("kernel32.dll",
"int",
"CloseHandle",
"hwnd",
$hToken)
;;Calculates the base load address of a dll in a process
Func _MemoryModuleGetBaseAddress
($iPID,
$sModule) Local $PERMISSION =
BitOR(0x0002, 0x0400, 0x0008, 0x0010, 0x0020
) Local $hProcess =
DllCall("kernel32.dll",
"ptr",
"OpenProcess",
"dword",
$PERMISSION,
"int",
0,
"dword",
$iPID) $hProcess = $hProcess[0]
Local $aCall =
DllCall($PSAPI,
"int",
"EnumProcessModules",
"ptr",
$hProcess,
"ptr",
DllStructGetPtr($Modules),
"dword",
DllStructGetSize($Modules),
"dword*",
0) Local $iModnum =
$aCall[4] /
4 $aTemp =
DllCall($PSAPI,
"dword",
"GetModuleBaseNameW",
"ptr",
$hProcess,
"ptr", Ptr
(DllStructGetData($Modules,
1,
$i)),
"wstr",
"",
"dword",
260)