Code:
$lista = IterateBackpack()
_ArrayDisplay( $lista, "IterateBackpack" )
Func IterateBackpack()
$mpqinfo = IndexSNO( 0x1548FB8 )
$armorOffs = 0
$weaponOffs = 0
$otherOffs = 0
for $j = 0 TO UBound($mpqinfo) - 1
If($mpqinfo[$j][1] = 19750) Then $armorOffs = $mpqinfo[$j][0]
If($mpqinfo[$j][1] = 19754) Then $weaponOffs = $mpqinfo[$j][0]
If($mpqinfo[$j][1] = 19753) Then $otherOffs = $mpqinfo[$j][0]
Next
Local $armorItems = GetLevels($armorOffs)
Local $weaponItems = GetLevels($weaponOffs)
Local $otherItems = GetLevels($otherOffs)
__ArrayConcatenate( $armorItems, $weaponItems )
__ArrayConcatenate( $armorItems, $otherItems )
$_Count = _MemoryRead($_LocalActor_Count, $d3, 'int')
$CurrentOffset = $_LocalActor_3
Local $bagitems[$_Count + 1][13]
$total = 0
For $i = 0 To $_Count
$itemLoc = _MemoryRead($CurrentOffset + 0x114, $d3, 'int')
If $itemLoc <> 0 Then
$CurrentOffset = $CurrentOffset + $ofs_LocalActor_StrucSize
ContinueLoop
EndIf
$bagitems[$total][0] = _MemoryRead($CurrentOffset, $d3, 'ptr') ;Id ACD
$bagitems[$total][1] = $CurrentOffset ;Offset
$bagitems[$total][2] = _MemoryRead($CurrentOffset + 0x4, $d3, 'char[64]') ;Name
$bagitems[$total][3] = $itemLoc ;Item Location
$bagitems[$total][4] = StashPosX( _MemoryRead($CurrentOffset + 0x118, $d3, 'int') ) ;Bagpack X
$bagitems[$total][5] = StashPosY( _MemoryRead($CurrentOffset + 0x11C, $d3, 'int') ) ;Bagpack Y
$bagitems[$total][6] = _MemoryRead($CurrentOffset + 0xB4, $d3, 'ptr') ;Id GameBalance
$bagitems[$total][7] = _MemoryRead($CurrentOffset + 0x120, $d3, 'ptr') ;Id Attrib
$bagitems[$total][8] = 0 ;Ilvl
$bagitems[$total][9] = IterateActorAtribs($bagitems[$total][0], $Atrib_Item_Quality_Level) ;QualityLevel
$bagitems[$total][10] = Round( IterateActorAtribs($bagitems[$total][0], $Atrib_Magic_Find) * 100 ) ;MagicFind
$bagitems[$total][11] = _MemoryRead($CurrentOffset + 0x164, $d3, 'int' ) > 0 ;Identified
$bagitems[$total][12] = Round( IterateActorAtribs($bagitems[$total][0], $Atrib_Gold_Find) * 100 ) ;GoldFind
For $j = 0 To UBound($armorItems) - 1
If $armorItems[$j][0] = $bagitems[$total][6] Then
$bagitems[$total][8] = $armorItems[$j][1]
ExitLoop
EndIf
Next
$total += 1
$CurrentOffset = $CurrentOffset + $ofs_LocalActor_StrucSize
Next
If $total = 0 Then Return False
ReDim $bagitems[$total][13]
Return $bagitems
EndFunc
func IndexSNO($_offset,$_displayInfo = 0)
local $CurrentSnoOffset = 0x0
$_MainOffset = _MemoryRead($_offset, $d3, 'ptr')
$_Pointer = _MemoryRead($_MainOffset + 0x3c, $d3, 'ptr')
$_SnoCount = _MemoryRead($_Pointer + 0x10C, $d3, 'ptr')
if $_SnoCount >= 256 Then
$ignoreSNOcount = 1
$_SnoCount = 4056
Else
$ignoreSNOcount = 0
EndIf
$_SnoIndex = _MemoryRead($_Pointer + 0x148, $d3, 'ptr')
$_SNOName = _MemoryRead($_Pointer, $d3, 'char[64]')
$TempWindex = $_SnoIndex +0xC
if $_displayInfo = 1 then ConsoleWrite("-----* Indexing "&$_SNOName& " *-----"&@crlf)
dim $_OutPut[$_SnoCount+1][2]
for $i = 1 to $_SnoCount step + 1
$_CurSnoOffset = _MemoryRead($TempWindex, $d3, 'ptr')
$_CurSnoID = _MemoryRead($_CurSnoOffset, $d3, 'ptr')
if $ignoreSNOcount = 1 and $_CurSnoOffset = 0x00000000 and $_CurSnoID = 0x00000000 then ExitLoop
if $ignoreSNOcount = 1 then $CurIndex = $i
$_OutPut[$i][0] = $_CurSnoOffset
$_OutPut[$i][1] = $_CurSnoID
if $_displayInfo = 1 then ConsoleWrite($i & " Offset: " & $_CurSnoOffset & " SNOid: " & $_CurSnoID &@crlf)
$TempWindex = $TempWindex + 0x10
Next
if $ignoreSNOcount = 1 then redim $_OutPut[$CurIndex][2]
return $_OutPut
EndFunc
Func GetLevels($offset)
if $offset <> 0 Then
$ofs = $offset + 0x218;
$read = _MemoryRead($ofs, $d3, 'int')
while $read = 0
$ofs += 0x4
$read = _MemoryRead($ofs, $d3, 'int')
WEnd
$size = _MemoryRead($ofs+0x4, $d3, 'int')
$size -= 0x5F0
$ofs = $offset + _MemoryRead($ofs, $d3, 'int')
$nr = $size/0x5F0
Local $snoItems[$nr+1][10]
$j = 0
for $i = 0 To $size Step 0x5F0
$ofs_address = $ofs+$i
$snoItems[$j][0] = _MemoryRead($ofs_address, $d3, 'ptr')
$snoItems[$j][1] = _MemoryRead($ofs_address+0x114, $d3, 'int') ;ilvl
$j += 1
Next
EndIf
return $snoItems
EndFunc
Func __ArrayConcatenate(ByRef $avArrayTarget, Const ByRef $avArraySource)
If Not IsArray($avArrayTarget) Then Return SetError(1, 1, -1); $avArrayTarget is not an array
If Not IsArray($avArraySource) Then Return SetError(1, 2, -1); $avArraySource is not an array
Local $iUBoundTarget0 = UBound($avArrayTarget, 0), $iUBoundSource0 = UBound($avArraySource, 0)
If $iUBoundTarget0 <> $iUBoundSource0 Then Return SetError(1, 3, -1); 1D/2D dimensionality did not match
If $iUBoundTarget0 > 2 Then Return SetError(1, 4, -1); At least one array was 3D or more
Local $iUBoundTarget1 = UBound($avArrayTarget, 1), $iUBoundSource1 = UBound($avArraySource, 1)
Local $iNewSize = $iUBoundTarget1 + $iUBoundSource1
If $iUBoundTarget0 = 1 Then
; 1D arrays
ReDim $avArrayTarget[$iNewSize]
For $i = 0 To $iUBoundSource1 - 1
$avArrayTarget[$iUBoundTarget1 + $i] = $avArraySource[$i]
Next
Else
; 2D arrays
Local $iUBoundTarget2 = UBound($avArrayTarget, 2), $iUBoundSource2 = UBound($avArraySource, 2)
If $iUBoundSource2 > $iUBoundTarget2 Then Return SetError(1, 5, -1); 2D boundry of source too large for target
ReDim $avArrayTarget[$iNewSize][$iUBoundTarget2]
For $r = 0 To $iUBoundSource1 - 1
For $c = 0 To $iUBoundSource2 - 1
$avArrayTarget[$iUBoundTarget1 + $r][$c] = $avArraySource[$r][$c]
Next
Next
EndIf
Return $iNewSize - 1
EndFunc
Func StashPosX( $_x )
If $resolutionX = 1920 Then Return 1434 + ( $_X * 48 )
Return 0
EndFunc
Func StashPosY( $_y )
If $resolutionY = 1080 Then Return 609 + ( $_y * 48 )
Return 0
EndFunc