Advertisement
Guest User

Untitled

a guest
Mar 29th, 2017
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.74 KB | None | 0 0
  1. ;===========================================================================================================
  2. ; Function: _Self_Slot ($sv_SlotNr)
  3. ;
  4. ; Description: Read memory for slot id and quantity.
  5. ;
  6. ; Parameter(s): $sv_SlotNr - Integer [0-9].
  7. ; [0] - Head [1] - Necklace
  8. ; [2] - Backpack [3] - Armor
  9. ; [4] - RightHand [5] - LeftHand
  10. ; [6] - Legs [7] - Feet
  11. ; [8] - Ring [9] - Ammo
  12. ;
  13. ; Return Value(s): On Success - Returns Array cointaining:
  14. ; [0] - Slot id.
  15. ; [1] - Slot quantity.
  16. ; On Failure - Returns Array cointaining:
  17. ; [0] - 0.
  18. ; [1] - 0.
  19. ;
  20. ; Author(s): Ascer
  21. ;===========================================================================================================
  22. Func _Self_Slot ($sv_SlotNr)
  23.  
  24. Local $Array[2] = [0, 0]
  25. 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]]
  26.  
  27. For $i = 0 To UBound($v_SlotTable) - 1
  28. If $sv_SlotNr = $v_SlotTable[$i][0] Then
  29.  
  30. Local $iv_Offset = [$v_SlotTable[$i][1]]
  31. Local $iv_SlotPointer = _MemoryPointerRead($BASE_ADDRESS + $addrSelfStart, $ah_Handle, $iv_Offset)[1]
  32.  
  33. If $iv_SlotPointer = 0 Then
  34. Return $Array
  35. EndIf
  36.  
  37. Local $iv_SlotID = '0x' & StringRight(Hex($iv_SlotPointer + 0x1A), 8)
  38. Local $iv_SlotQuantity = '0x' & StringRight(Hex($iv_SlotPointer + 0x1E), 8)
  39.  
  40. Local $Array[2]
  41. $Array[0] = _MemoryRead($iv_SlotID, $ah_Handle, 'short')
  42. $Array[1] = _MemoryRead($iv_SlotQuantity, $ah_Handle, 'byte')
  43.  
  44. Return $Array
  45.  
  46. EndIf
  47.  
  48. Next
  49.  
  50. Return $Array
  51.  
  52. EndFunc
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement