Ejemplo n.º 1
0
 public void getPouch(ref byte[] Data)
 {
     InventoryItem[] items = new InventoryItem[PouchDataSize];
     for (int i = 0; i < items.Length; i++)
     {
         items[i] = new InventoryItem
         {
             Index = BitConverter.ToUInt16(Data, Offset + i*4),
             Count = BitConverter.ToUInt16(Data, Offset + i*4 + 2) ^ (ushort)SecurityKey
         };
     }
     Items = items;
 }
Ejemplo n.º 2
0
 public void getPouch7(ref byte[] Data)
 {
     InventoryItem[] items = new InventoryItem[PouchDataSize];
     for (int i = 0; i < items.Length; i++)
     {
         // 10bit itemID
         // 10bit count
         // 12bit flags/reserved
         uint val = BitConverter.ToUInt32(Data, Offset + i*4);
         items[i] = new InventoryItem
         {
             Index = (int)(val & 0x3FF),
             Count = (int)(val >> 10 & 0x3FF),
             New = (val & 0x40000000) == 1, // 30th bit is "NEW"
         };
     }
     Items = items;
     OriginalItems = Items.Select(i => i.Clone()).ToArray();
 }
Ejemplo n.º 3
0
        public void getPouchG1(ref byte[] Data)
        {
            InventoryItem[] items = new InventoryItem[PouchDataSize];
            if (Type == InventoryType.TMHMs)
            {
                int slot = 0;
                for (int i = 0; i < items.Length; i++)
                {
                    if (Data[Offset + i] != 0)
                    {
                        items[slot++] = new InventoryItem
                        {
                            Index = LegalItems[i],
                            Count = Data[Offset + i]
                        }
                    }
                    ;
                }
                while (slot < items.Length)
                {
                    items[slot++] = new InventoryItem
                    {
                        Index = 0,
                        Count = 0
                    }
                }
                ;
            }
            else
            {
                int numStored = Data[Offset];
                for (int i = 0; i < numStored; i++)
                {
                    switch (Type)
                    {
                    case InventoryType.KeyItems:
                        items[i] = new InventoryItem
                        {
                            Index = Data[Offset + i + 1],
                            Count = 1
                        };
                        break;

                    default:
                        items[i] = new InventoryItem
                        {
                            Index = Data[Offset + i * 2 + 1],
                            Count = Data[Offset + i * 2 + 2]
                        };
                        break;
                    }
                }
                for (int i = numStored; i < items.Length; i++)
                {
                    items[i] = new InventoryItem
                    {
                        Index = 0,
                        Count = 0
                    };
                }
            }
            Items = items;
        }
Ejemplo n.º 4
0
 public void getPouchG1(ref byte[] Data)
 {
     InventoryItem[] items = new InventoryItem[PouchDataSize];
     if (Type == InventoryType.TMHMs)
     {
         int slot = 0;
         for (int i = 0; i < items.Length; i++)
         {
             if (Data[Offset + i] != 0)
                 items[slot++] = new InventoryItem
                 {
                     Index = LegalItems[i],
                     Count = Data[Offset+i]
                 };
         }
         while (slot < items.Length)
             items[slot++] = new InventoryItem
             {
                 Index = 0,
                 Count = 0
             };
     }
     else
     {
         int numStored = Data[Offset];
         for (int i = 0; i < numStored; i++)
         {
             switch (Type)
             {
                 case InventoryType.KeyItems:
                     items[i] = new InventoryItem
                     {
                         Index = Data[Offset + i + 1],
                         Count = 1
                     };
                     break;
                 default:
                     items[i] = new InventoryItem
                     {
                         Index = Data[Offset + i * 2 + 1],
                         Count = Data[Offset + i * 2 + 2]
                     };
                     break;
             }
         }
         for (int i = numStored; i < items.Length; i++)
         {
             items[i] = new InventoryItem
             {
                 Index = 0,
                 Count = 0
             };
         }
     }
     Items = items;
 }