Results 1 to 9 of 9
  1. #1
    Dwar
    Dwar is offline
    Veteran Dwar's Avatar
    Join Date
    2010 Mar
    Posts
    2,222
    Thanks Thanks Given 
    211
    Thanks Thanks Received 
    2,230
    Thanked in
    292 Posts
    Rep Power
    10

    [AutoIt] Grand Fantasia Bot source

    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”


    Author: oOldsqL

    Please register or login to download attachments.

    Please, post your questions on forum, not by PM or mail

    I spend my time, so please pay a little bit of your time to keep world in equilibrium

  2. The Following User Says Thank You to Dwar For This Useful Post:


  3. #2
    ozwinkren
    ozwinkren is offline
    New member
    Join Date
    2011 Feb
    Posts
    7
    Thanks Thanks Given 
    1
    Thanks Thanks Received 
    1
    Thanked in
    1 Post
    Rep Power
    0
    Mr Dwar can u make a sprite trainer with this source ??

  4. #3
    Bloodyfang
    Bloodyfang is offline
    Guest
    Join Date
    2011 May
    Posts
    2
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Rep Power
    0
    and where is the bot program ? u only attach the source , please attach the bot program please

  5. #4
    StormShad
    StormShad is offline
    New member
    Join Date
    2010 Nov
    Location
    Port Elizabeth, South Africa
    Posts
    30
    Thanks Thanks Given 
    4
    Thanks Thanks Received 
    11
    Thanked in
    8 Posts
    Rep Power
    0
    @Bloodyfang did you check this thread I haven't tested the download links in a while but last I saw all were working

  6. The Following User Says Thank You to StormShad For This Useful Post:


  7. #5
    lithios
    lithios is offline
    Guest
    Join Date
    2012 Jul
    Posts
    1
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Rep Power
    0

    doubt

    although I could not download it yet, I wonder if this bot is used for any version of the grand fantasy or only for U.S.version?

  8. #6
    onioncyber
    onioncyber is offline
    Guest
    Join Date
    2012 Jun
    Posts
    2
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    1
    Thanked in
    1 Post
    Rep Power
    0
    how build it to bot ???


  9. #7
    Dwar
    Dwar is offline
    Veteran Dwar's Avatar
    Join Date
    2010 Mar
    Posts
    2,222
    Thanks Thanks Given 
    211
    Thanks Thanks Received 
    2,230
    Thanked in
    292 Posts
    Rep Power
    10
    Quote Originally Posted by onioncyber View Post
    how build it to bot ???
    Get needed libraries, like NomadMemory.au3, Array.au3 etc, and try to compile it with latest AutoIt
    Please, post your questions on forum, not by PM or mail

    I spend my time, so please pay a little bit of your time to keep world in equilibrium

  10. #8
    noookiever
    noookiever is offline
    New member
    Join Date
    2012 May
    Posts
    7
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Rep Power
    0
    Could you explain a little more detailed I am somewhat new to this but would do everything to make or change something in the game ... certainly would like to know how stats change attacks.

  11. #9
    SessionZ
    SessionZ is offline
    Inactive
    Join Date
    2021 Oct
    Posts
    1
    Thanks Thanks Given 
    0
    Thanks Thanks Received 
    0
    Thanked in
    0 Posts
    Rep Power
    0
    hey, i wanted to ask you how to find / create a PointerFile with CE, are there any tutorials on how to do it? (want to do it for grand fantasia)

    LG,
    SessionZ

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •