Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class DS1Hook : PHook
- {
- private PHPointer CharData2;
- private PHPointer InventoryData;
- public DS1Hook() : base(p => p.MainWindowTitle == "DARK SOULS", 5000)
- {
- CharData2 = RegisterPointer((IntPtr)0x1378700, 0, 8);
- InventoryData = RegisterPointer(CharData2, 0x2DC);
- }
- public InventoryItem[] GetInventoryItems()
- {
- var result = new InventoryItem[2048];
- byte[] bytes = InventoryData.ReadBytes(0, 2048 * 0x1C);
- for (int i = 0; i < 2048; i++)
- {
- result[i] = new InventoryItem(bytes, i * 0x1C);
- }
- return result;
- }
- }
- public struct InventoryItem
- {
- public int Category { get; }
- public int ID { get; }
- public int Quantity { get; }
- public int Unk0C { get; }
- public int Unk10 { get; }
- public int Durability { get; }
- public int Unk18 { get; }
- public InventoryItem(byte[] bytes, int index)
- {
- Category = BitConverter.ToInt32(bytes, index + 0x00) >> 28;
- ID = BitConverter.ToInt32(bytes, index + 0x04);
- Quantity = BitConverter.ToInt32(bytes, index + 0x08);
- Unk0C = BitConverter.ToInt32(bytes, index + 0x0C);
- Unk10 = BitConverter.ToInt32(bytes, index + 0x10);
- Durability = BitConverter.ToInt32(bytes, index + 0x14);
- Unk18 = BitConverter.ToInt32(bytes, index + 0x18);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement