That's what I'm banging my head with currently! It looks like they're stored in a circular list... I'm trying to find an offset that I can reference, but right now I'm manually doing it by searching for a mob ID in cheatengine that is 0xF8 bytes and then repeats, then the next field after that is the pointer to the next item in the list. I've written a quick-and-dirty program to loop through the list in an effort to help me figure out where to go from here.
This is in VB.Net and assumes you've already connected to the EXE and have the DLLs linked. It then dumps all of the mobs it can find into a csv file with the x, y, z coords. You need to prime intCurrLink as mentioned earlier:
Code:
Sub FollowChain()
Dim intCurrLink As Integer = &HCAFE4AF8
Dim intRead As Integer = 1
Dim intNextStep As Integer = -1
Dim intPrevStep As Integer
Dim intLinkHighID As Integer
Dim intLinkLowID As Integer
Dim outTraverseLinks As New System.IO.StreamWriter("c:\moblocations.csv", True)
Dim sngX As Single = 0
Dim sngY As Single = 0
Dim sngZ As Single = 0
Dim intInitLink As Integer = intCurrLink
Do While intRead = 1 Or intInitLink <> intCurrLink
ReadProcessMemory(readHandle, intCurrLink - 8, intLinkHighID, 4, Nothing)
ReadProcessMemory(readHandle, intCurrLink - 4, intLinkLowID, 4, Nothing)
ReadProcessMemory(readHandle, intCurrLink, intNextStep, 4, Nothing)
ReadProcessMemory(readHandle, intCurrLink + 4, intPrevStep, 4, Nothing)
ReadProcessMemoryFloat(readHandle, intCurrLink + &H24, sngX, 4, Nothing)
ReadProcessMemoryFloat(readHandle, intCurrLink + &H24, sngY, 4, Nothing)
ReadProcessMemoryFloat(readHandle, intCurrLink + &H24, sngZ, 4, Nothing)
Dim strOutLog As String = intRead & "," & intCurrLink.ToString("X") & "," & intLinkHighID.ToString("X") & "," & intLinkLowID.ToString("X") & "," & intPrevStep.ToString("X") & "," & intNextStep.ToString("X") & "," & sngX & "," & sngY & "," & sngZ
Debug.WriteLine(strOutLog)
outTraverseLinks.WriteLine(strOutLog)
intCurrLink = intNextStep
intRead += 1
Loop
outTraverseLinks.Close()
End Sub
After I get this figured out my next challenge will be linking it to the health, which seems to be in a completely different structure without the mob's ID.
---------- Post added at 02:57 AM ---------- Previous post was at 01:16 AM ----------
The pointer to the mob loop with locations is at [swtor.exe + 0107C8BC] + 40.
So my sub now (with some bug fixes) assuming you've already attached to the EXE and gotten the base address of SWTOR looks like:
Code:
Sub FollowChain()
Dim datRunTime As String = Now.ToString
Dim intCurrLink As Integer
Dim intAddress As Integer
ReadProcessMemory(readHandle, intMemBaseSWTOR + &H107C8BC, intAddress, 4, Nothing)
intCurrLink = intAddress + &H40
Debug.WriteLine("Priming loop with " & intCurrLink.ToString("X"))
Dim intRead As Integer = 1
Dim intNextStep As Integer = -1
Dim intPrevStep As Integer
Dim intLinkHighID As Integer
Dim intLinkLowID As Integer
Dim outTraverseLinks As New System.IO.StreamWriter("c:\moblocations.csv", True)
outTraverseLinks.WriteLine("RunTime,#,Address,HighMobID,LowMobID,PrevAddress,NextAddress,MobX,MobY,MobZ")
Dim sngX As Single = 0
Dim sngY As Single = 0
Dim sngZ As Single = 0
Dim intInitLink As Integer = intCurrLink
Do While intRead = 1 Or intInitLink <> intCurrLink
ReadProcessMemory(readHandle, intCurrLink - 8, intLinkHighID, 4, Nothing)
ReadProcessMemory(readHandle, intCurrLink - 4, intLinkLowID, 4, Nothing)
ReadProcessMemory(readHandle, intCurrLink, intNextStep, 4, Nothing)
ReadProcessMemory(readHandle, intCurrLink + 4, intPrevStep, 4, Nothing)
ReadProcessMemoryFloat(readHandle, intCurrLink + &H14, sngX, 4, Nothing)
ReadProcessMemoryFloat(readHandle, intCurrLink + &H18, sngY, 4, Nothing)
ReadProcessMemoryFloat(readHandle, intCurrLink + &H1C, sngZ, 4, Nothing)
Dim strOutLog As String = datRunTime & "," & intRead & "," & intCurrLink.ToString("X") & "," & intLinkHighID.ToString("X") & "," & intLinkLowID.ToString("X") & "," & intPrevStep.ToString("X") & "," & intNextStep.ToString("X") & "," & sngX & "," & sngY & "," & sngZ
Debug.WriteLine(strOutLog)
outTraverseLinks.WriteLine(strOutLog)
intCurrLink = intNextStep
intRead += 1
Loop
outTraverseLinks.Close()
End Sub
Next is figuring out how to retrieve the mobs' names and health. Let me know if you have any ideas!