Example #1
0
        protected override int ComputeRawId(IntPtr address)
        {
            // Data is stored in the bottomless box a little differently than the main inventory. In the main
            // inventory, raw ID is stored as an integer (four bytes), with category as a single byte at a different
            // address. In contrast, the bottomless box stores both raw ID and category in a single integer, with three
            // bytes devoted to the ID and the fourth representing category.
            byte[] bytes = MemoryTools.ReadBytes(Handle, address, 4);

            return(TrimLastByte(bytes));
        }
Example #2
0
        protected override ItemId ComputeItemId(IntPtr address)
        {
            // Data is stored in the bottomless box a little differently than the main inventory. In the main
            // inventory, raw ID is stored as an integer (four bytes), with category as a single byte at a different
            // address. In contrast, the bottomless box stores both raw ID and category in a single integer, with three
            // bytes devoted to the ID and the fourth representing category.
            byte[] bytes = MemoryTools.ReadBytes(Handle, address, 4);

            int category = bytes[3];

            // This means that the slot is empty.
            if (category == byte.MaxValue)
            {
                return(null);
            }

            int rawId = TrimLastByte(bytes);

            return(ComputeItemId(rawId, Utilities.ToHex(category)));
        }