示例#1
0
        internal static void ReadInventory(Item[] inv, BinaryReader reader, bool readStack = false, bool readFavorite = false)
        {
            int count = reader.ReadUInt16();

            for (int k = 0; k < count; k++)
            {
                ItemIO.ReadItem(inv[reader.ReadUInt16()], reader, readStack, readFavorite);
            }
        }
示例#2
0
 internal static void ReadContainers(BinaryReader reader)
 {
     byte[] flags = new byte[1];
     reader.Read(flags, 0, reader.ReadByte());
     if ((flags[0] & 1) == 1)
     {
         ContainerTables tables = ContainerTables.Create();
         int             count  = reader.ReadUInt16();
         for (int k = 0; k < count; k++)
         {
             int    slot    = reader.ReadUInt16();
             string modName = reader.ReadString();
             string name    = reader.ReadString();
             Mod    mod     = ModLoader.GetMod(modName);
             tables.headSlots[slot] = mod == null ? 0 : mod.GetItem(name).item.headSlot;
         }
         count = reader.ReadUInt16();
         for (int k = 0; k < count; k++)
         {
             int    slot    = reader.ReadUInt16();
             string modName = reader.ReadString();
             string name    = reader.ReadString();
             Mod    mod     = ModLoader.GetMod(modName);
             tables.bodySlots[slot] = mod == null ? 0 : mod.GetItem(name).item.bodySlot;
         }
         count = reader.ReadUInt16();
         for (int k = 0; k < count; k++)
         {
             int    slot    = reader.ReadUInt16();
             string modName = reader.ReadString();
             string name    = reader.ReadString();
             Mod    mod     = ModLoader.GetMod(modName);
             tables.legSlots[slot] = mod == null ? 0 : mod.GetItem(name).item.legSlot;
         }
         ReadContainerData(reader, tables);
     }
     if ((flags[0] & 2) == 2)
     {
         int count = reader.ReadInt32();
         for (int k = 0; k < count; k++)
         {
             int         id        = reader.ReadInt32();
             TEItemFrame itemFrame = TileEntity.ByID[id] as TEItemFrame;
             ItemIO.ReadItem(itemFrame.item, reader, true);
         }
     }
 }