Grand Fantasia Bot source
A script which allows us to wander arround, selecting NPCs, doing Rep Quests, Buying Pots, ... whatever you like
HotKeySet("{F6}", "_createWPfile") create a new Waypointfile.
HotKeySet("{F7}", "_setWP") add your current Coords to the created file. Do a Circle ! The Last Waypoint hast to be near the first or else the wanderer gets probably stuck. No Antistuck available
HotKeySet("{F8}", "_setNPC") select the NPC and move your player as near as you can to the NPC. Then press F8 to addthis NPC to the list.
HotKeySet("{F9}", "_wander") starts the whole process (wandering, mousclicking, NPC moving, ...)
HotKeySet("{F10}", "_MouseClickLeft") move your mouse to the position and press F10
HotKeySet("{F11}", "_MouseClickright") move your mouse to the position and press F11
HotKeySet("{ESC}", "_exit") press ESC to exit the bot..
$playerbase=0x009A6FF0 has to be changed to your pointer. This pointer is for the german version ... Search in CE. Must be somewhere near 040D2XXX...
->added EN Pointer
Value = float
Value between. Search your x Coordinate... First "Value between" Value hast to be set to Xcoord MINUS 3 and second has to be set Xcoord +3. The Displayed Value is NOT the real value. So the Pointervalue might differ a bit from the displayed one.
functions.au3
Code:#include <_XMLDomWrapper.au3>
#include <NomadMemory.au3>
#include <Array.au3>
#Include <String.au3>
#include <math.au3>
AutoItSetOption ( "SendKeyDownDelay", 100)
Local $name="none", $MID, $PROCESSNAME, $PID, $PlayerX, $PlayerY, $node, $rotate[2], $koords, $cnt_koord = 1
const $pPI = 3.14159265358979
$playerbase=0x009A6FF0
$mobbase=0x00454568
$moboffx = dec("FFFFFFFC")
$moboffy = 0
$moboffz = dec("4")
$playoffx = dec("14")
$playoffy = dec("18")
$playoffz = dec("1C")
$viewAc = dec("2C")
$viewBc = dec("30")
HotKeySet("{F6}", "_createWPfile")
HotKeySet("{F7}", "_setWP")
HotKeySet("{F8}", "_wander")
Func _init($processname)
$PROCESSNAME = $processname
WinWait($PROCESSNAME)
$PID = WinGetProcess($PROCESSNAME)
WinActivate($PROCESSNAME)
SendKeepActive($PROCESSNAME)
$MID = _MEMORYOPEN($PID)
EndFunc
Func _createWPfile()
;-----------------------------------------------------------------------
;Creates XML File with Name = $name
;-----------------------------------------------------------------------
Global $name = InputBox("Name of Waypointfile", "Please enter a name for the new waypointfile") &".xml"
_XMLCreateFile(@scriptdir&"waypoints"&$name,"Koordinaten",True)
EndFunc
Func _setWP()
;-----------------------------------------------------------------------
;Opens XML File with Name = $name
;-----------------------------------------------------------------------
_XMLFileOpen(@scriptdir&"waypoints"&$name)
;-----------------------------------------------------------------------
;Reads Player Values
;-----------------------------------------------------------------------
$PlayerX = _MEMORYREAD("0x" & Hex(_MEMORYREAD($playerbase, $MID) + $playoffx), $MID, "float")
$PlayerY = _MEMORYREAD("0x" & Hex(_MEMORYREAD($playerbase, $MID) + $playoffy), $MID, "float")
;-----------------------------------------------------------------------
;Writing XML File
;-----------------------------------------------------------------------
_XMLCreateRootChild ( 'WP', 'x="'&Ceiling($PlayerX)&'" y="'&Ceiling($PlayerY)&'"', "" )
EndFunc
Func _parseWP()
;-----------------------------------------------------------------------
;Parsing XML File. Array $koords contains all values
;-----------------------------------------------------------------------
$node = _XMLGetValue( "./*")
Global $koords[$node[0]+1][2]
For $i = 1 to $node[0]
$search1 = _StringBetween($node[$i], 'x="', '"')
$search2 = _StringBetween($node[$i], 'y="', '"')
$koords[$i][0] = $search1[0]
$koords[$i][1] = $search2[0]
Next
EndFunc
Func _wander()
while True
If $name = "none" then
Global $name = InputBox("Name of Waypointfile", "Please enter the name for the waypointfile") &".xml"
_XMLFileOpen(@scriptdir&"waypoints"&$name)
EndIf
_parseWP()
$PlayerX = _MEMORYREAD("0x" & Hex(_MEMORYREAD($playerbase, $MID) + $playoffx), $MID, "float")
$PlayerY = _MEMORYREAD("0x" & Hex(_MEMORYREAD($playerbase, $MID) + $playoffy), $MID, "float")
$winkel = _ATAN2($koords[$cnt_koord][1]-$PlayerY, $koords[$cnt_koord][0]-$PlayerX)
$rotate[0] = Sin($winkel+1.5*$pPI)
$rotate[1] = -Cos($winkel+1.5*$pPI)
ConsoleWrite($winkel&" Koords: "&$koords[$cnt_koord][0]&"|"&$koords[$cnt_koord][1]&@CRLF&"@"&$rotate[0]&" - "&$rotate[1]&@CRLF&@CRLF)
_MEMORYWRITE("0x" & Hex(_MEMORYREAD($playerbase, $MID) + $viewAc), $MID, $rotate[0] , "float")
_MEMORYWRITE("0x" & Hex(_MEMORYREAD($playerbase, $MID) + $viewBc), $MID, $rotate[1] , "float")
sleep(50)
Send("{NUMLOCK toggle}")
$distance_old = _getDistance(_MEMORYREAD("0x" & Hex(_MEMORYREAD($playerbase, $MID) + $playoffx), $MID, "float"),_MEMORYREAD("0x" & Hex(_MEMORYREAD($playerbase, $MID) + $playoffy), $MID, "float"),$koords[$cnt_koord][0], $koords[$cnt_koord][1] )
Do
;insert AtkBot here ...
sleep(500)
If _getDistance(_MEMORYREAD("0x" & Hex(_MEMORYREAD($playerbase, $MID) + $playoffx), $MID, "float"),_MEMORYREAD("0x" & Hex(_MEMORYREAD($playerbase, $MID) + $playoffy), $MID, "float"),$koords[$cnt_koord][0], $koords[$cnt_koord][1] ) = $distance_old Then
sleep(50)
Send("{NUMLOCK toggle}")
EndIf
until _getDistance(_MEMORYREAD("0x" & Hex(_MEMORYREAD($playerbase, $MID) + $playoffx), $MID, "float"),_MEMORYREAD("0x" & Hex(_MEMORYREAD($playerbase, $MID) + $playoffy), $MID, "float"),$koords[$cnt_koord][0], $koords[$cnt_koord][1] ) < 3
Send("{NUMLOCK toggle}")
If $cnt_koord = ubound($koords)-1 Then
$cnt_koord=1
Else
$cnt_koord+=1
EndIf
Wend
EndFunc
Func _getDistance($px, $py, $mx, $my )
return Sqrt((Abs($mx-$px))^2 + (Abs($my-$py))^2)
EndFunc
_init("Grand Fantasia")
while True
WEnd[/autoit]
added new func to nomadmemory.au3...
[autoit] ;=============================================================================== ?==================
; Function: _MemoryPointerRead ($iv_Address, $ah_Handle, $av_Offset(, $sv_Type))
; Description: Reads a chain of pointers and returns an array containing the destination
; address and the data at the address.
; Parameter(s): $iv_Address - The static memory address you want to start at. It must be in
; hex format (0x00000000).
; $ah_Handle - An array containing the Dll handle and the handle of the open
; process as returned by _MemoryOpen().
; $av_Offset - An array of offsets for the pointers. Each pointer must have an
; offset. If there is no offset for a pointer, enter 0 for that
; array dimension. (Offsets must be in decimal format, NOT hex!)
; $sv_Type - (optional) The "Type" of data you intend to read at the destination
; address. This is set to 'dword'(32bit(4byte) signed integer) by
; default. See the help file for DllStructCreate for all types.
; Requirement(s): The $ah_Handle returned from _MemoryOpen.
; Return Value(s): On Success - Returns an array containing the destination address and the value
; located at the address.
; On Failure - Returns 0
; @Error - 0 = No error.
; 1 = $av_Offset is not an array.
; 2 = Invalid $ah_Handle.
; 3 = $sv_Type is not a string.
; 4 = $sv_Type is an unknown data type.
; 5 = Failed to allocate the memory needed for the DllStructure.
; 6 = Error allocating memory for $sv_Type.
; 7 = Failed to read from the specified process.
; Author(s): Nomad
; Note(s): Values returned are in Decimal format, unless a 'char' type is selected.
; Set $av_Offset like this:
; $av_Offset[0] = NULL (not used)
; $av_Offset[1] = Offset for pointer 1 (all offsets must be in Decimal)
; $av_Offset[2] = Offset for pointer 2
; etc...
; (The number of array dimensions determines the number of pointers)
;=============================================================================== ?==================
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
”Example XML file - talks to NPCs, calls postbox, buys some items”
<?xml version="1.0"?>
<Koordinaten>
<NPC>x="244.923553466797" y="422.993408203125" name="Benjamin"</NPC>
<MouseClick>xm="397" ym="345" type="right"</MouseClick>
<MouseClick>xm="492" ym="480" type="left"</MouseClick>
<NPC>x="245.996353149414" y="422.763519287109" name="Peggy"</NPC>
<MouseClick>xm="397" ym="338" type="right"</MouseClick>
<MouseClick>xm="498" ym="482" type="left"</MouseClick>
<NPC>x="246.005966186523" y="423.847351074219" name="Ludaumann"</NPC>
<MouseClick>xm="392" ym="310" type="right"</MouseClick>
<MouseClick>xm="380" ym="348" type="left"</MouseClick>
<MouseClick>xm="490" ym="482" type="left"</MouseClick>
<MouseClick>xm="490" ym="482" type="left"</MouseClick>
<WP>x="248.048156738281" y="408.347290039063"</WP>
<WP>x="242.535598754883" y="409.919647216797"</WP>
<MouseClick>xm="384" ym="277" type="right"</MouseClick>
<MouseClick>xm="502" ym="478" type="left"</MouseClick>
<WP>x="246.440567016602" y="409.496124267578"</WP>
<WP>x="259.605590820313" y="414.211883544922"</WP>
<MouseClick>xm="399" ym="195" type="right"</MouseClick>
<MouseClick>xm="583" ym="503" type="left"</MouseClick>
<WP>x="258.856964111328" y="408.979187011719"</WP>
<NPC>x="270.831298828125" y="410.110076904297" name="Caroline"</NPC>
<MouseClick>xm="398" ym="314" type="right"</MouseClick>
<MouseClick>xm="392" ym="346" type="left"</MouseClick>
<WP>x="272.171813964844" y="403.863433837891"</WP>
</Koordinaten>
Author: oOldsqL