Code:
;;--------------------------------------------------------------------------------
;; Getting Backpack Item Info
;;--------------------------------------------------------------------------------
Func IterateBackpack($bag = 0, $rlvl = 0)
;$bag = 0 for backpack and 15 for stash
;$rlvl = 1 for actual level requirement of item and 0 for base required level
$_Count = _MemoryRead($_LocalActor_Count, $d3, 'int')
$CurrentOffset = $_LocalActor_3
Local $__ACDACTOR[$_Count + 1][9]
For $i = 0 To $_Count
$__ACDACTOR[$i][0] = _MemoryRead($CurrentOffset, $d3, 'ptr')
$__ACDACTOR[$i][1] = _MemoryRead($CurrentOffset + 0x4, $d3, 'char[64]')
$__ACDACTOR[$i][2] = _MemoryRead($CurrentOffset + 0x114, $d3, 'int')
$__ACDACTOR[$i][3] = _MemoryRead($CurrentOffset + 0x118, $d3, 'int')
$__ACDACTOR[$i][4] = _MemoryRead($CurrentOffset + 0x11C, $d3, 'int')
$__ACDACTOR[$i][5] = 0
$__ACDACTOR[$i][6] = _MemoryRead($CurrentOffset + $ofs_LocalActor_atribGUID, $d3, 'ptr')
$__ACDACTOR[$i][7] = $CurrentOffset
$__ACDACTOR[$i][8] = _MemoryRead($CurrentOffset + 0xB4, $d3, 'int')
$CurrentOffset = $CurrentOffset + $ofs_LocalActor_StrucSize
Next
For $i = $_Count To 0 Step -1
If $__ACDACTOR[$i][2] <> $bag Then
_ArrayDelete($__ACDACTOR, $i)
Else
$__ACDACTOR[$i][5] = GetPackItemLevel($__ACDACTOR[$i][6], $Atrib_Requirement)
If $rlvl Then
$lvlReduce = GetPackItemLevel($__ACDACTOR[$i][6], $Atrib_Item_Level_Requirement_Reduction)
If $lvlReduce Then $__ACDACTOR[$i][5] = $__ACDACTOR[$i][5] - $lvlReduce
EndIf
EndIf
Next
;print it´
Return $__ACDACTOR
EndFunc ;==>IterateBackpack
;;--------------------------------------------------------------------------------
;; Maps snos containg a lvl to the item with that snoid
;;--------------------------------------------------------------------------------
Func MapItemWithLvl($items, $snowithlvl, $indexForBGID)
Local $newItems = $items
ReDim $newItems[UBound($items, 1)][UBound($items, 2) + UBound($snowithlvl, 2) + 9] ;add size for some new variables
For $i = 0 To UBound($items) - 1 Step 1
For $j = 0 To UBound($snowithlvl) - 1 Step 1
If $snowithlvl[$j][0] = $items[$i][$indexForBGID] Then
$newItems[$i][$indexForBGID + 1] = $snowithlvl[$j][1] ;ilvl
$newItems[$i][$indexForBGID + 2] = $snowithlvl[$j][2] ;min dmg
$newItems[$i][$indexForBGID + 3] = $snowithlvl[$j][3] ;;max dmg
$newItems[$i][$indexForBGID + 4] = $snowithlvl[$j][4] ;;min armor
$newItems[$i][$indexForBGID + 5] = $snowithlvl[$j][5] ;max armor
$newItems[$i][$indexForBGID + 6] = $snowithlvl[$j][6] ;min dmg modifier
$newItems[$i][$indexForBGID + 7] = $snowithlvl[$j][7] ;max dmg modifier
$newItems[$i][$indexForBGID + 8] = $snowithlvl[$j][8] ;gold
$newItems[$i][$indexForBGID + 9] = $snowithlvl[$j][9] ;weapon speed
;;some extra attributes
$newItems[$i][$indexForBGID + 10] = IterateActorAtribs($newItems[$i][0], $Atrib_Item_Quality_Level) ;quality lvl
$newItems[$i][$indexForBGID + 11] = IterateActorAtribs($newItems[$i][0], $Atrib_Strength_Item) ;str
$newItems[$i][$indexForBGID + 12] = IterateActorAtribs($newItems[$i][0], $Atrib_Vitality_Item) ;vit
$newItems[$i][$indexForBGID + 12] = IterateActorAtribs($newItems[$i][0], $Atrib_Intelligence_Item) ;int
$newItems[$i][$indexForBGID + 13] = IterateActorAtribs($newItems[$i][0], $Atrib_Dexterity_Item) ;dex
$newItems[$i][$indexForBGID + 15] = IterateActorAtribs($newItems[$i][0], $Atrib_Resistance_All) ;all res
$newItems[$i][$indexForBGID + 16] = Round(IterateActorAtribs($newItems[$i][0], $Atrib_Gold_Find) * 100) ;gf in %
$newItems[$i][$indexForBGID + 17] = Round(IterateActorAtribs($newItems[$i][0], $Atrib_Magic_Find) * 100) ;mf in %
$newItems[$i][$indexForBGID + 18] = Round(IterateActorAtribs($newItems[$i][0], $Atrib_Hitpoints_Max_Percent_Bonus_Item) * 100) ;life %
$newItems[$i][$indexForBGID + 19] = _MemoryRead($newItems[$i][7]+0x164, $d3, 'int') > 0 ;0ffset + 164 ;true=unid, false=identified
ExitLoop
EndIf
Next
Next
Return $newItems
EndFunc ;==>MapItemWithLvl
;;--------------------------------------------------------------------------------
;; Gets levels from Gamebalance file, returns a list with snoid and lvl
;;--------------------------------------------------------------------------------
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') ;lvl
$snoItems[$j][2] = _MemoryRead($ofs_address + 0x1C8, $d3, 'float') ;min dmg
$snoItems[$j][3] = $snoItems[$j][2] + _MemoryRead($ofs_address + 0x1CC, $d3, 'float') ;max dmg
$snoItems[$j][4] = _MemoryRead($ofs_address + 0x224, $d3, 'float') ;min armor
$snoItems[$j][5] = $snoItems[$j][4] + _MemoryRead($ofs_address + 0x228, $d3, 'float') ;max armor
$snoItems[$j][6] = _MemoryRead($ofs_address + 0x32C, $d3, 'float') ;min dmg modifier
$snoItems[$j][7] = $snoItems[$j][4] + _MemoryRead($ofs_address + 0x330, $d3, 'float') ;max dmg modifier
$snoItems[$j][8] = _MemoryRead($ofs_address + 0x12C, $d3, 'int') ;gold price
$snoItems[$j][9] = _MemoryRead($ofs_address + 0x2D4, $d3, 'float') ;wpn speed
$j += 1
Next
EndIf
Return $snoItems
EndFunc ;==>GetLevels
;;--------------------------------------------------------------------------------
;; Getting Backpack Item Info, extended to show some more info
;; $bag = 0 for backpack and 15 for stash
;;--------------------------------------------------------------------------------
Func IterateBackpackExtendedWithLvl($bag = 0)
$list = IndexSNO($gameBalance)
$armorOffs = 0
$weaponOffs = 0
$otherOffs = 0
For $j = 0 To UBound($list) - 1
;19750 = armor, 19754 = weapon, 1953 = other
If ($list[$j][1] = 19750) Then
$armorOffs = $list[$j][0]
EndIf
If ($list[$j][1] = 19754) Then
$weaponOffs = $list[$j][0]
EndIf
If ($list[$j][1] = 19753) Then
$otherOffs = $list[$j][0]
EndIf
Next
Local $armorItems = GetLevels($armorOffs)
Local $weaponItems = GetLevels($weaponOffs)
Local $otherItems = GetLevels($otherOffs)
Local $data = IterateBackpack($bag)
Local $armorItemsWithLvl = MapItemWithLvl($data, $armorItems, 8)
Local $weaponItemsWithLvl = MapItemWithLvl($data, $weaponItems, 8)
Local $otherItemsWithLvl = MapItemWithLvl($data, $otherItems, 8)
Local $allItems[UBound($armorItemsWithLvl, 1)][UBound($armorItemsWithLvl, 2)]
For $i = 0 To UBound($allItems) - 1 Step 1
If $armorItemsWithLvl[$i][9] <> "" Then
;copy from $armorItemsWithLvl to all items
For $j = 0 To UBound($armorItemsWithLvl, 2) - 1 Step 1
$allItems[$i][$j] = $armorItemsWithLvl[$i][$j]
Next
ElseIf $weaponItemsWithLvl[$i][9] <> "" Then
;copy from $weaponItemsWithLvl to all items
For $j = 0 To UBound($weaponItemsWithLvl, 2) - 1 Step 1
$allItems[$i][$j] = $weaponItemsWithLvl[$i][$j]
Next
ElseIf $otherItemsWithLvl[$i][9] <> "" Then
;copy from $otherItemsWithLvl to all items
For $j = 0 To UBound($otherItemsWithLvl, 2) - 1 Step 1
$allItems[$i][$j] = $otherItemsWithLvl[$i][$j]
Next
EndIf
Next
Return $allItems
EndFunc ;==>IterateBackpackExtendedWithLvl