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
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
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 you
have studied its code. One thing I can note for Unleashed source is that we have converted all memory functions to use nomadmemory.au3 and allot of arrays. I would advise anyone planning on making use of the unleashed source to practice nomadmemory.au3 functions and building array's.
This will get you ready for the release.
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
hi Interest07, this is totally off topic, but I'll post it here anyway since you're the topic starter at this thread
do you have resources for the chat system ? like for getting the nick of who's whispering, and what the message is. Thought of making an auto buffer priest by whispering something to it. Put the cleric somewhere and I can ask for buff by just whispering the command.
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.
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
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"
Interest07 can you teach me how you can get function flow/work besides sendPacket, memopen, memclose, and _hex?
Help with sending packets in autoit 08/16/2010 - AutoIt - 1 Replies ive been lookin around different sites for ways to send packets to the game server. the only examples i see is to create a server and a client which i dont need, i think. well to the point now, can someone lead me in a direction or tell me how to send packets to a game? also if i send packets then that means i dont need the game to be active, correct? Because in autoit when u use keys u need to have the game active, and control send does not work. ty
Sending Packets !!! 09/07/2008 - Kal Online - 14 Replies now i know how to sniff / analyse packets ... but what then ? :)
how can i send packets ?? to pimp or mix weapon for example
i just need the way to send , and then i can depend on myself :D
Sending Packets (need advice) 03/20/2008 - Conquer Online 2 - 7 Replies OK well im finaly trying to stop leaching off of everybodys work its been great n all download n play :D But im tired of being a begger n the past couple months ive been learning as much as i can about macros memery add blah blah you know ...
After playing around with ce and ahk the past couple months i stumbled across wpe pro, theres not alot of tuturals and its hard to find good help.
Well heres what ive been doing so far, open my CO then i attach it to my sniffer.
I change my...
Scamming by sending packets??? 04/15/2006 - Conquer Online 2 - 1 Replies Well my friend and i came up with the idea to send packets to the server to show a certain item in the trade window. We want to use this as a type of scam. I didnt see this in any other threads and was wondering if anyone knew if this is possible and if they could point use in the right direction. My friend was pretty good with packets in CO 1.0 but we arent really sure to go about doing it. If anyone one could please lend a helping hand?
P.S.- Before I get flamed for this because i know i...
Sending packets 10/12/2005 - Conquer Online 2 - 10 Replies I've a question. Is it possible to send 1 packet multiple times at the exact same time?