I am not hooking packet function here.
I am terrible noob at C++.. but how would function look like in c++ ?
just looking for function that would input d2 handle and return true if hostiled
edit: Shaggi said me to convert this to autoit
for(RosterUnit * unit = *D2CLIENT_PlayerUnitList; unit; unit = unit->pNext)
if(unit->dwPartyFlags & PLAYER_HOSTILE) {
// do stuff like chicken
}
so I am on my way to it.
$playerunitlist = _ReadD2Memory($Diablo_MemHandle, $d2client + 0x11BC14, "int")
gut I am not sure what
RosterUnit * unit = *D2CLIENT_PlayerUnitList means. could anyone explain that? Partt of code I cant understand is
* unit = * Does it mean I have to multiply something?
Or is it something like this?
while $unit
$playerunitlist = _ReadD2Memory($Diablo_MemHandle, $d2client + 0x11BC14, "int")
$RoosterUnit = $playerunitlist
$unit = _ReadD2Memory($Diablo_MemHandle, $d2client + 0x11BC14, "int")
wend
Could anyone explain me that C++ loop in plain english please? and what does unit->pNext mean?
Edit2: Shaggi suggested me this loop instead
Func IsHostiled()
$unit = _ReadD2Memory($Diablo_MemHandle, $D2CLIENT_OFFSET + 0x11BC14)
ConsoleWrite("unit "&$unit&@CRLF)
While $unit
$unit = _readd2memory($Diablo_MemHandle, $unit + 0x30)
ConsoleWrite("unit "&$unit&@CRLF)
If $unit = 8 Then MsgBox(0, 0, "Hostiled")
WEnd
EndFunc ;==>IsHostiled
but it outputs me
Quote:
unit 90767616
unit 1
unit 0
which means that there has to be logic problem in that loop because it ends with 0
also in C++ source there is if(unit->dwPartyFlags & PLAYER_HOSTILE) { which I am not sure what it does. I think it means
if BitAnd( readd2memory($Diablo_MemHandle) + $dwPartyFlags
, $PLAYER_HOSTILE
)Correct me if I am wrong about that if
Edit3:
Here's latest code I could come up with but it's still buggy
Func IsHostiled()
$dwPartyFlags = 0x30
$PLAYER_HOSTILED = 0x08
$unit = _ReadD2Memory($Diablo_MemHandle, $D2CLIENT_OFFSET + 0x11BC14)
ConsoleWrite("unit "&$unit&@CRLF)
While $unit
$unit = _readd2memory($Diablo_MemHandle, $unit + 0x30)
ConsoleWrite("unit "&$unit&@CRLF)
If BitAND(_readd2memory($Diablo_MemHandle,$unit + $dwPartyflags),$PLAYER_HOSTILED) Then MsgBox(0, 0, "Hostiled")
WEnd
EndFunc ;==>IsHostiled
for those who arent friendly to Autoit ReadD2Memory returns value of address.
There must be some logic problem or something.