Quote:
Originally Posted by Interest07
This isn't quite AutoIt code, but it should be clear how it works. actionStruct is [CHARACTER_DATABASE + 0xFF4] in PWI. This function is for starting conversation with NPC, performing regular attack on a mob, using skill on a mob or yourself, mining resources, or picking up an item from floor, depending on the interactionType you pass along.
Code:
InteractWith(objectId, interactionType, client, actionStruct, skillPointer=0)
{
actionList := ReadMemory(actionStruct+0x30,client)
WalkToAction := ReadMemory(actionList+0x8,client)
writeMemory(0, WalkToAction+0x8, client) ;Action finished = 0
writeMemory(1, WalkToAction+0x14, client) ;Action Start = 1
writeMemory(0, WalkToAction+0x24, client) ;Action Not Start = 0
writeMemory(objectId, WalkToAction+0x20, client) ;Set objectId to interact with
writeMemory(interactionType, WalkToAction+0x38, client) ;Set type of action to perform (0 = regAtk, 1 = pick item, 2 = talk to NPC,3 = useSkill, 4 = gatherResources)
writeMemory(0, WalkToAction+0x34, client) ;Set error = 0
writeMemory(skillPointer, WalkToAction+0x50, client)
writeMemory(WalkToAction, actionstruct+0xC, client) ;Set new action type WalkTo in action struct position action1
writeMemory(1, actionstruct+0x18, client) ;Set next action position to 1
writeMemory(WalkToAction, actionstruct+0x14, client) ;Set new action type WalkTo in action struct as next action
}
|
thanks, I'll make a resource filter first and figuring out how to pick it up later with this.
in what language is the function above ? can that function be used for attacking mob using memory write ?
I just searched and got a function already in autoit posted by lolkop and able to pickup items dropped by mobs but it can't be used for picking ground mats, I dunno what to change whatever interactionType is used in the function, could you please check this function and see what should be modified in this so it can be used for picking ground mats ? it also does not automatically approach drops though, but can pick up objects after I move my char close to the drops, so I have to add move2xyz before using it later.
anyway, here is lolkop's pickup function, or if lolkop himself is around, please advice on how to use it to pickup ground mats.
Code:
Func PickItem($sn, $id)
Local $pRemoteThread, $vBuffer, $loop, $result, $OPcode
; --- save the position of the allocated memory ---
$pRemoteMem = DllCall($kernel32, 'int', 'VirtualAllocEx', 'int', $mid, 'ptr', 0, 'int', 0x46, 'int', 0x1000, 'int', 0x40)
; --- build up the asm code ---
;~ 004707F8 |. 8B15 6C3E9F00 MOV EDX,DWORD PTR DS:[9F3E6C] ; edx <- [base]
;~ 004707FE |. 50 PUSH EAX ; /Item-SN
;~ 004707FF |. 51 PUSH ECX ; |Item- ID
;~ 00470800 |. 8B4A 20 MOV ECX,DWORD PTR DS:[EDX+20] ; |
;~ 00470803 |. 81C1 EC000000 ADD ECX,0EC ; |
;~ 00470809 |. E8 42941700 CALL elementc.005E9C50 ; \elementc.005E9C50
$OPcode &= '60' ; pushad
$OPcode &= '8B15'&_hex($base) ; mov edx, [base]
$OPcode &= '68'&_hex($sn) ; push item-sn
$OPcode &= '68'&_hex($id) ; push item-id
$OPcode &= '8B4A20' ; mov ecx, [edx+0x20]
$OPcode &= '81C1'&_hex(0xEC) ; add ecx, 0xEC
$OPcode &= 'E8'&_hex($pick_call-$pRemoteMem[0]-5-StringLen($OPcode)/2) ; call pick_call
$OPcode &= '61' ; popad
$OPcode &= 'C3' ; retn
; --- enter the asm code to to a dllstruct, which can be used with WriteProcessMemory ---
$vBuffer = DllStructCreate('byte[' & StringLen($OPcode) / 2 & ']')
For $loop = 1 To DllStructGetSize($vBuffer)
DllStructSetData($vBuffer, 1, Dec(StringMid($OPcode, ($loop - 1) * 2 + 1, 2)), $loop)
Next
; --- now letz write the code from our dllstruct ---
DllCall($kernel32, 'int', 'WriteProcessMemory', 'int', $mid, 'int', $pRemoteMem[0], 'int', DllStructGetPtr($vBuffer), 'int', DllStructGetSize($vBuffer), 'int', 0)
; --- now we run the asm code we've just written ---
$hRemoteThread = DllCall($kernel32, 'int', 'CreateRemoteThread', 'int', $mid, 'int', 0, 'int', 0, 'int', $pRemoteMem[0], 'ptr', 0, 'int', 0, 'int', 0)
; --- wait till the thread did his job ---
Do
$result = DllCall('kernel32.dll', 'int', 'WaitForSingleObject', 'int', $hRemoteThread[0], 'int', 50)
Until $result[0] <> 258
; --- close everything we've opened ---
DllCall($kernel32, 'int', 'CloseHandle', 'int', $hRemoteThread[0])
DllCall($kernel32, 'ptr', 'VirtualFreeEx', 'hwnd', $mid, 'int', $pRemoteMem[0], 'int', 0, 'int', 0x8000)
Return True
EndFunc