This repository has been archived by the owner on Dec 21, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 56
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0e608df
commit 402f856
Showing
3 changed files
with
33 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,33 @@ | ||
|
||
|
||
ReadParty(ByRef d2rprocess, ByRef partyList) { | ||
ReadParty(ByRef d2rprocess, ByRef partyList, ByRef playerUnitId) { | ||
partyList := [] | ||
SetFormat Integer, D | ||
rosterOffset := offsets["rosterOffset"] | ||
, baseAddress := d2rprocess.BaseAddress + rosterOffset | ||
, playerUnit := d2rprocess.read(baseAddress, "Int64") | ||
while (playerUnit > 0) { ; keep following the next pointer | ||
name := d2rprocess.readString(playerUnit, length := 16) | ||
, unitId := d2rprocess.read(playerUnit + 0x48, "UInt") | ||
, area := d2rprocess.read(playerUnit + 0x5C, "UInt") | ||
, plevel := d2rprocess.read(playerUnit + 0x58, "UShort") | ||
, partyId := d2rprocess.read(playerUnit + 0x5A, "UShort") | ||
, xPos := d2rprocess.read(playerUnit + 0x60, "UInt") | ||
, yPos := d2rprocess.read(playerUnit + 0x64, "UInt") | ||
player := { "name": name, "unitId": unitId, "area": area, "partyId": partyId, "plevel": plevel, "xPos": xPos, "yPos": yPos } | ||
, partyStruct := d2rprocess.read(baseAddress, "Int64") | ||
while (partyStruct > 0) { ; keep following the next pointer | ||
name := d2rprocess.readString(partyStruct, length := 16) | ||
, unitId := d2rprocess.read(partyStruct + 0x48, "UInt") | ||
, area := d2rprocess.read(partyStruct + 0x5C, "UInt") | ||
, plevel := d2rprocess.read(partyStruct + 0x58, "UShort") | ||
, partyId := d2rprocess.read(partyStruct + 0x5A, "UShort") | ||
, xPos := d2rprocess.read(partyStruct + 0x60, "UInt") | ||
, yPos := d2rprocess.read(partyStruct + 0x64, "UInt") | ||
, hostilePtr := d2rprocess.read(partyStruct + 0x70, "Int64") | ||
, isHostileToPlayer := false | ||
while (hostilePtr) { | ||
hostileUnitId := d2rprocess.read(hostilePtr, "UInt") | ||
hostileFlag := d2rprocess.read(hostilePtr + 0x04, "UInt") | ||
hostilePtr := d2rprocess.read(hostilePtr + 0x08, "Int64") | ||
if (playerUnitId == hostileUnitId) { | ||
if (hostileFlag > 0) { | ||
isHostileToPlayer := true | ||
} | ||
} | ||
} | ||
player := { "name": name, "unitId": unitId, "area": area, "partyId": partyId, "plevel": plevel, "xPos": xPos, "yPos": yPos, "isHostileToPlayer": isHostileToPlayer } | ||
partyList.push(player) | ||
playerUnit := d2rprocess.read(playerUnit + 0x148, "Int64") ; get next player | ||
partyStruct := d2rprocess.read(partyStruct + 0x148, "Int64") ; get next player | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters