Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ;===========================================================================================================
- ; Function: _Self_Slot ($sv_SlotNr)
- ;
- ; Description: Read memory for slot id and quantity.
- ;
- ; Parameter(s): $sv_SlotNr - Integer [0-9].
- ; [0] - Head [1] - Necklace
- ; [2] - Backpack [3] - Armor
- ; [4] - RightHand [5] - LeftHand
- ; [6] - Legs [7] - Feet
- ; [8] - Ring [9] - Ammo
- ;
- ; Return Value(s): On Success - Returns Array cointaining:
- ; [0] - Slot id.
- ; [1] - Slot quantity.
- ; On Failure - Returns Array cointaining:
- ; [0] - 0.
- ; [1] - 0.
- ;
- ; Author(s): Ascer
- ;===========================================================================================================
- Func _Self_Slot ($sv_SlotNr)
- Local $Array[2] = [0, 0]
- Local $v_SlotTable[10][2] = [[0, $offsetHead], [1, $offsetNecklace], [2, $offsetBackpack], [3, $offsetArmor], [4, $offsetRightHand], [5, $offsetLeftHand], [6, $offsetLegs], [7, $offsetFeet], [8, $offsetRing], [9, $offsetAmmo]]
- For $i = 0 To UBound($v_SlotTable) - 1
- If $sv_SlotNr = $v_SlotTable[$i][0] Then
- Local $iv_Offset = [$v_SlotTable[$i][1]]
- Local $iv_SlotPointer = _MemoryPointerRead($BASE_ADDRESS + $addrSelfStart, $ah_Handle, $iv_Offset)[1]
- If $iv_SlotPointer = 0 Then
- Return $Array
- EndIf
- Local $iv_SlotID = '0x' & StringRight(Hex($iv_SlotPointer + 0x1A), 8)
- Local $iv_SlotQuantity = '0x' & StringRight(Hex($iv_SlotPointer + 0x1E), 8)
- Local $Array[2]
- $Array[0] = _MemoryRead($iv_SlotID, $ah_Handle, 'short')
- $Array[1] = _MemoryRead($iv_SlotQuantity, $ah_Handle, 'byte')
- Return $Array
- EndIf
- Next
- Return $Array
- EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement