Exemple #1
0
        internal void Read(GDFileReader reader, Item[] items)
        {
            ByteBlock block = new ByteBlock();

            reader.ReadBlockStart(ref block);
            var version = reader.ReadInt();

            if (version < 5)
            {
                throw new Exception("Bad Stash version #");
            }

            var width  = reader.ReadInt();
            var height = reader.ReadInt();

            foreach (var item in items)
            {
                item.Read(reader);
            }

            reader.ReadBlockEnd(ref block);
        }
Exemple #2
0
        private void ReadInventory(ref Character theTaken, ref GDFileReader reader)
        {
            Item[]    equipment  = new Item[12]; //Arrays.InitializeWithDefaultInstances<Item>(12);
            Item[]    weaponSet1 = new Item[2];
            Item[]    weaponSet2 = new Item[2];
            ByteBlock block      = new ByteBlock();

            if (reader.ReadBlockStart(ref block) != 3)
            {
                throw new Exception();
            }
            var version = reader.ReadInt();

            if (version < 4)
            {
                throw new IOException("Invalid version");
            }

            byte flag = reader.ReadByte();

            if (flag == 1)
            {
                uint numBags = reader.ReadInt();
                reader.ReadInt(); //Focused
                reader.ReadInt(); //Selected

                List <Bag> bags = new List <Bag>((int)numBags);
                for (int i = 0; i < numBags; i++)
                {
                    Bag bag = new Bag();
                    bag.Read(reader);
                    bag.Index = i;
                    bags.Add(bag);
                }

                var useAlternate = reader.ReadByte();

                for (int x = 0; x < 12; x++)
                {
                    equipment[x].Read(reader);
                    reader.ReadByte();
                }

                var alternate1 = reader.ReadByte();

                for (int y = 0; y < 2; y++)
                {
                    weaponSet1[y].Read(reader);
                    reader.ReadByte();
                }

                var alternate2 = reader.ReadByte();

                for (int z = 0; z < 2; z++)
                {
                    weaponSet2[z].Read(reader);
                    reader.ReadByte();
                }
            }
            reader.ReadBlockEnd(ref block);
        }