Very nice I am impressed. This is almost exactly the same as our gathering function's other then separating Herb/Resource's so that you can choose which you would like to hunt. I really think you will like the source of Unleashed when its released. You will most likely code allot differently after youQuote:
Here is the autoit code for hunting and gathering resources, as well as the interaction function in AutoIt form. Please note that the code is referencing variables and functions defined in Prophet Bot Recoded, but should be easily changed to suit your environment.
Global $aMATERIALS[1][6]
Func InteractWith($objectId, $interactionType)
ADDHISTORY("Interacting with " & $objectId)
Local $ACTIONSTRUCT = memread($CHAR_DATA_BASE + 0xFF4)
Local $ACTIONLIST = memread($ACTIONSTRUCT + 0x30)
Local $WALKTOACTION = memread($ACTIONLIST + 0x8)
; Action finished = 0
MemWrite($WALKTOACTION + 0x8, $PROCESS_INFORMATION, 0)
; Action start = 1
MemWrite($WALKTOACTION + 0x14, $PROCESS_INFORMATION, 1)
; Action Not Start = 0
MemWrite($WALKTOACTION + 0x24, $PROCESS_INFORMATION, 0)
; objectId
MemWrite($WALKTOACTION + 0x20, $PROCESS_INFORMATION, $objectId)
; interactionType 0 = regAtk, 1 = pick item, 2 = talk to NPC,3 = useSkill, 4 = gatherResources
MemWrite($WALKTOACTION + 0x38, $PROCESS_INFORMATION, $interactionType)
; Set error = 0
MemWrite($WALKTOACTION + 0x34, $PROCESS_INFORMATION, 0)
; Set skill pointer
MemWrite($WALKTOACTION + 0x50, $PROCESS_INFORMATION, 0)
; Set new actionType
MemWrite($ACTIONSTRUCT + 0xC, $PROCESS_INFORMATION, $WALKTOACTION)
; Set next action position to 1
MemWrite($ACTIONSTRUCT + 0x18, $PROCESS_INFORMATION, 1)
; Set new actionType
MemWrite($ACTIONSTRUCT + 0x14, $PROCESS_INFORMATION, $WALKTOACTION)
Do
Sleep(500)
Until $ACTIVE = 0
EndFunc
Func FindHerbs()
; Bug: Does not forget the locations of herbs
Local $i = 0
Local $hBase = 0x00A5B90C
Local $pointer,$counter
$pointer = memread(memread(memread(memread(memread($hBase) + 0x1C) + 0x8) + 0x28) + 0x18)
Global $aMATERIALS[1][6]
ADDHISTORY("Looking for resources " & $pointer)
for $i=0 to 768
Local $item_base = memread(memread($pointer + $i*4) + 0x4)
Local $ITEM_NAME = memread(memread($item_base + 0x164), 'wchar[30]') ;Item-Name
If (_ArraySearch($HERBS,$ITEM_NAME) <> -1 OR _ArraySearch($RESOURCES,$ITEM_NAME) <> -1) Then
Local $ITEM_SN = memread($item_base + 0x110) ;Item-SN
;$array[$counter][0] = memread($item_base + 0x110) ;Item-SN;
Local $ITEM_ID = memread($item_base + 0x10C) ;Item-ID
Local $ITEM_X = (memread($item_base + 0x3C, 'float')+4000)/10 ;Item x-position
Local $ITEM_Y = (memread($item_base + 0x44, 'float')+5500)/10 ;Item y-position
Local $ITEM_Z = memread($item_base + 0x40, 'float')/10 ;Item z-position
Local $ITEM_DISTANCE = Round(10*Sqrt(($HOME_X-$ITEM_X)^2+($HOME_Y-$ITEM_Y)^2+($HOME_Z-$ITEM_Z)^2),1)
;Local $ITEM_DISTANCE = ($DELTA_X + $DELTA_Y + $DELTA_Z)/3
If $ITEM_NAME <> "" Then
Redim $aMATERIALS[$counter+1][6]
$aMATERIALS[$counter][0] = $ITEM_DISTANCE
$aMATERIALS[$counter][1] = $ITEM_NAME
$aMATERIALS[$counter][2] = $ITEM_X
$aMATERIALS[$counter][3] = $ITEM_Y
$aMATERIALS[$counter][4] = $ITEM_Z
$aMATERIALS[$counter][5] = $ITEM_ID
$counter += 1
EndIf
;Else
;MsgBox(0,"RESERROR","Sorry, " & $ITEM_NAME & " is not a resource.")
Endif
Next
; Sort by distance
_ArraySort($aMATERIALS,0,0)
;_ArrayDisplay($aMATERIALS)
If $aMATERIALS[0][1] <> "" Then
ADDHISTORY("Closest gatherable is " & $aMATERIALS[0][1] & ', ' & $aMATERIALS[0][0] & ' away')
Endif
EndFunc
Func GatherHerbs()
FindHerbs()
For $x = 0 to Ubound($aMATERIALS) -1
If $aMATERIALS[$x][1] <> "" Then
;For $x = 0 to 0
If $aMATERIALS[$x][0] < 85 Then
ADDHISTORY("Moving to item " & $aMATERIALS[$x][1] & " distance " & $aMATERIALS[$x][0])
MoveToXYZ($aMATERIALS[$x][2]*10-4000,$aMATERIALS[$x][3]*10-5500,$aMATERIALS[$x][4]*10)
Do
Sleep(500)
Until $ACTIVE = 0
Sleep(1000)
;; Gather the resource
InteractWith($aMATERIALS[$x][5],4)
ADDHISTORY("Now at item " & $aMATERIALS[$x][1])
Do
Sleep(500)
Until $ACTIVE = 0
;FindHerbs()
;Sleep( 10000 )
_ArraySort($aMATERIALS,0,0)
EndIf
ADDHISTORY("Done Gathering.")
Endif
Next
EndFunc
Func ShowResources()
_ArrayDisplay($aMATERIALS)
EndFunc
Have you seen my cheat engine tutorials? They can be found [Only registered and activated users can see links. Click Here To Register...].Quote:
Check this post and search for Actionstruct: [Only registered and activated users can see links. Click Here To Register...]
There shouldn't be a big difference between Perfect World and Jade Dynasty
Quote:
Here is the autoit code for hunting and gathering resources, as well as the interaction function in AutoIt form. Please note that the code is referencing variables and functions defined in Prophet Bot Recoded, but should be easily changed to suit your environment.
Global $aMATERIALS[1][6]
Func InteractWith($objectId, $interactionType)
ADDHISTORY("Interacting with " & $objectId)
Local $ACTIONSTRUCT = memread($CHAR_DATA_BASE + 0xFF4)
Local $ACTIONLIST = memread($ACTIONSTRUCT + 0x30)
Local $WALKTOACTION = memread($ACTIONLIST + 0x8)
; Action finished = 0
MemWrite($WALKTOACTION + 0x8, $PROCESS_INFORMATION, 0)
; Action start = 1
MemWrite($WALKTOACTION + 0x14, $PROCESS_INFORMATION, 1)
; Action Not Start = 0
MemWrite($WALKTOACTION + 0x24, $PROCESS_INFORMATION, 0)
; objectId
MemWrite($WALKTOACTION + 0x20, $PROCESS_INFORMATION, $objectId)
; interactionType 0 = regAtk, 1 = pick item, 2 = talk to NPC,3 = useSkill, 4 = gatherResources
MemWrite($WALKTOACTION + 0x38, $PROCESS_INFORMATION, $interactionType)
; Set error = 0
MemWrite($WALKTOACTION + 0x34, $PROCESS_INFORMATION, 0)
; Set skill pointer
MemWrite($WALKTOACTION + 0x50, $PROCESS_INFORMATION, 0)
; Set new actionType
MemWrite($ACTIONSTRUCT + 0xC, $PROCESS_INFORMATION, $WALKTOACTION)
; Set next action position to 1
MemWrite($ACTIONSTRUCT + 0x18, $PROCESS_INFORMATION, 1)
; Set new actionType
MemWrite($ACTIONSTRUCT + 0x14, $PROCESS_INFORMATION, $WALKTOACTION)
Do
Sleep(500)
Until $ACTIVE = 0
EndFunc
Func FindHerbs()
; Bug: Does not forget the locations of herbs
Local $i = 0
Local $hBase = 0x00A5B90C
Local $pointer,$counter
$pointer = memread(memread(memread(memread(memread($hBase) + 0x1C) + 0x8) + 0x28) + 0x18)
Global $aMATERIALS[1][6]
ADDHISTORY("Looking for resources " & $pointer)
for $i=0 to 768
Local $item_base = memread(memread($pointer + $i*4) + 0x4)
Local $ITEM_NAME = memread(memread($item_base + 0x164), 'wchar[30]') ;Item-Name
If (_ArraySearch($HERBS,$ITEM_NAME) <> -1 OR _ArraySearch($RESOURCES,$ITEM_NAME) <> -1) Then
Local $ITEM_SN = memread($item_base + 0x110) ;Item-SN
;$array[$counter][0] = memread($item_base + 0x110) ;Item-SN;
Local $ITEM_ID = memread($item_base + 0x10C) ;Item-ID
Local $ITEM_X = (memread($item_base + 0x3C, 'float')+4000)/10 ;Item x-position
Local $ITEM_Y = (memread($item_base + 0x44, 'float')+5500)/10 ;Item y-position
Local $ITEM_Z = memread($item_base + 0x40, 'float')/10 ;Item z-position
Local $ITEM_DISTANCE = Round(10*Sqrt(($HOME_X-$ITEM_X)^2+($HOME_Y-$ITEM_Y)^2+($HOME_Z-$ITEM_Z)^2),1)
;Local $ITEM_DISTANCE = ($DELTA_X + $DELTA_Y + $DELTA_Z)/3
If $ITEM_NAME <> "" Then
Redim $aMATERIALS[$counter+1][6]
$aMATERIALS[$counter][0] = $ITEM_DISTANCE
$aMATERIALS[$counter][1] = $ITEM_NAME
$aMATERIALS[$counter][2] = $ITEM_X
$aMATERIALS[$counter][3] = $ITEM_Y
$aMATERIALS[$counter][4] = $ITEM_Z
$aMATERIALS[$counter][5] = $ITEM_ID
$counter += 1
EndIf
;Else
;MsgBox(0,"RESERROR","Sorry, " & $ITEM_NAME & " is not a resource.")
Endif
Next
; Sort by distance
_ArraySort($aMATERIALS,0,0)
;_ArrayDisplay($aMATERIALS)
If $aMATERIALS[0][1] <> "" Then
ADDHISTORY("Closest gatherable is " & $aMATERIALS[0][1] & ', ' & $aMATERIALS[0][0] & ' away')
Endif
EndFunc
Func GatherHerbs()
FindHerbs()
For $x = 0 to Ubound($aMATERIALS) -1
If $aMATERIALS[$x][1] <> "" Then
;For $x = 0 to 0
If $aMATERIALS[$x][0] < 85 Then
ADDHISTORY("Moving to item " & $aMATERIALS[$x][1] & " distance " & $aMATERIALS[$x][0])
MoveToXYZ($aMATERIALS[$x][2]*10-4000,$aMATERIALS[$x][3]*10-5500,$aMATERIALS[$x][4]*10)
Do
Sleep(500)
Until $ACTIVE = 0
Sleep(1000)
;; Gather the resource
InteractWith($aMATERIALS[$x][5],4)
ADDHISTORY("Now at item " & $aMATERIALS[$x][1])
Do
Sleep(500)
Until $ACTIVE = 0
;FindHerbs()
;Sleep( 10000 )
_ArraySort($aMATERIALS,0,0)
EndIf
ADDHISTORY("Done Gathering.")
Endif
Next
EndFunc
Func ShowResources()
_ArrayDisplay($aMATERIALS)
EndFunc
how to use this code ?
Oh, yeah, I do have them for PWI somewhere, I'll dig em up later. About 1% of the time a chat sentence seems to be blank in memory instead of what it should be though, but I have the same problem with players around me not turning up in the list I use, so maybe it's just me doing something wrong :DQuote:
lol I was asking about resources for ingame chat system like its pointers/offsets/structures not material resources, but thanks anyway.
guess he's busy or not monitoring this thread anymore.
Interest07 can you teach me how you can get function flow/work besides sendPacket, memopen, memclose, and _hex?Quote:
The packets are encrypted before sent to the server as far as I know, so WPE pro won't help. I view the packets by settings a breakpoint at the sendPacket function (so before encryption) using MHS and displaying whats in the stack. YOu can automatically edit the packets here if you wish, but the above methods shouldn't be possible though, as you send a packet to the server saying "Please refine this n that item" instead of "I refined this item, update it please"