Example #1
0
        public override void GetPouch(ReadOnlySpan <byte> data)
        {
            var items = new InventoryItem8b[LegalItems.Length];

            int ctr = 0;

            foreach (var index in LegalItems)
            {
                var item = GetItem(data, index);
                if (!item.IsValidSaveSortNumberCount)
                {
                    continue;
                }
                items[ctr++] = item;
            }
            while (ctr != LegalItems.Length)
            {
                items[ctr++] = new InventoryItem8b();
            }

            Items = items;
            SortBy <InventoryItem8b, ushort>(z => !z.IsValidSaveSortNumberCount ? (ushort)0xFFFF : z.SortOrder);
        }
Example #2
0
        public InventoryItem8b GetItem(ReadOnlySpan <byte> data, ushort itemID)
        {
            var ofs = GetItemOffset(itemID, Offset);

            return(InventoryItem8b.Read(itemID, data[ofs..]));