First off, awesome community... but deep stuff for a real newbie like me. Credits go out to members of this forum. I've copy and pasted so much from here trying to learn that I don't remember who did what, but none of it is mine! And yeah, AutoIT isn't really programming, but it's something I am familiar with so I wanted to try and get the concepts of this stuff down first.
This is a little script that I think should work, and not sure if I just have offsets wrong or not. All it does is dump the fishing bobber objects to my console. That works. But I want to find which bobber is MINE! So I know that is where my problem is.
Code:
#include "BMmemory.au3"
_BMInitialize()
Const $ObjectTypeOffset = 0x14
Const $ObjectGUIDOffset = 0x30
Const $ObjectNextOffset = 0x3C
Dim $hWOW = WinGetHandle("World of Warcraft")
Global $WoWProcess = _BMOpenProcess($hWOW, False)
Global $ObjDescriptorOffset = 0x8
Global $OBJECT_FIELD_CREATED_BY = 0x6
Global $aPlayerGUID = 0x011110E0
Global $PlayerGUID = WoWGetLocalGUID($WoWProcess)
; Starting here!
ConsoleWrite("Starting Dump...." & @CR)
Sleep(2000)
ConsoleWrite("Player: " & _BMReadASCIIString($WoWProcess, 0x01139FB8, 12) & @CR)
ConsoleWrite("dumping now..." & @CR)
ConsoleWrite("---------------------------" & @CR)
ConsoleWrite("---------------------------" & @CR)
FindObjects()
_BMCloseHandle($WoWProcess)
_BMDispose()
ConsoleWrite("Done" & @CR & @CR)
; The End!
; Iterate through objects
Func FindObjects()
Local $curobj, $nextobj
; Get current object [[[0x01139F80] + 0x2C34] + 0xAC]
$curobj = _BMReadUint($WoWProcess, _BMReadUint($WoWProcess, _BMReadUint($WoWProcess, 0x01139F80) + 0x2C34) + 0xAC)
While ($curobj <> 0 And BitAND($curobj, 1) = 0)
; output to console
PrintInfo($curobj)
; Get next object [curobj + 0x3C]
$nextobj = _BMReadUint($WoWProcess, $curobj + $ObjectNextOffset)
If $nextobj = 0 AND $nextobj = $curobj Then ExitLoop
$curobj = $nextobj
WEnd
EndFunc
; Print Object info to console bsed on object type
Func PrintInfo($uBASE)
Local $uTYPE = _BMReadUint($WoWProcess, $uBASE + $ObjectTypeOffset)
Select
#cs
Case $uTYPE = 3
;;
Case $uTYPE = 4
;;
Case $uTYPE = 5 ; bobber is of this type
; I just want to look at bobbers!
If GetGameObjectName($uBASE) = "Fishing Bobber" Then
ConsoleWrite("Current object: " & $uBASE & @CR)
ConsoleWrite("Type: Game Object"& @CR)
ConsoleWrite("Name: " & GetGameObjectName($uBASE) & @CR)
$CreatedBy = WoWGetKnownField($WoWProcess, $uBASE, $OBJECT_FIELD_CREATED_BY)
If $CreatedBy <> 0 Then
If $CreatedBy = $playerGUID Then
ConsoleWrite("YOU created this bobber!"& @CR)
EndIf
EndIf
ConsoleWrite("---------------------------" & @CR)
EndIf
EndSelect
EndFunc
; excerpt from WOWfuncs.au3
Func WoWGetLocalGUID($Handle)
Return _BMReadInt($Handle, $aPlayerGUID)
EndFunc
Func WoWGetKnownField($Handle, $ObjectBase, $FieldIndex, $Type = "dword")
Return _BMReadMemory($Handle, (_BMReadUint($Handle, ($ObjectBase + $ObjDescriptorOffset)) + ($FieldIndex * 4)), $Type)
EndFunc
Func GetObjectGUID($Handle, $ObjectBase)
Return _BMReadUInt($Handle, ($ObjectBase + $ObjectGUIDOffset))
EndFunc
; returns name of object
Func GetGameObjectName($uBASE)
Return _BMReadASCIIString($WoWProcess, _BMReadUint($WoWProcess, _BMReadUint($WoWProcess, $uBASE + 0x1A4) + 0x88), 256)
EndFunc
; returns name of unit
Func GetUnitName($uBASE)
Return _BMReadASCIIString($WoWProcess, _BMReadUint($WoWProcess, _BMReadUint($WoWProcess, $uBASE + 0x968) + 0x54), 256)
EndFunc