예제 #1
0
        private void ReadCharacterBio(ref Character theTaken, ref GDFileReader reader)
        {
            ByteBlock block = new ByteBlock();

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

            if (version < 8)
            {
                throw new Exception();
            }

            theTaken.Level = (int)reader.ReadInt();
            reader.ReadInt();
            Console.WriteLine($"Modifier points: {reader.ReadInt()}");
            theTaken.SkillPoints = (int)reader.ReadInt();
            Console.WriteLine($"Devotion points: {reader.ReadInt()}");
            theTaken.DevotionPoints = (int)reader.ReadInt();
            theTaken.Physique       = (int)reader.ReadFloat();
            theTaken.Cunning        = (int)reader.ReadFloat();
            theTaken.Spirit         = (int)reader.ReadFloat();
            theTaken.Health         = (int)reader.ReadFloat();
            theTaken.Energy         = (int)reader.ReadFloat();
            reader.ReadBlockEnd(ref block);
        }
예제 #2
0
        private void ReadCharacterInfo(ref Character theTaken, ref GDFileReader reader)
        {
            ByteBlock block = new ByteBlock();

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

            if (version < 5)
            {
                throw new Exception();
            }
            reader.ReadByte();
            reader.ReadByte();
            var difficulty         = reader.ReadByte();
            var greatestDifficulty = reader.ReadByte();
            var money = reader.ReadInt();

            if (version > 4)
            {
                reader.ReadByte();
                reader.ReadInt();
            }
            reader.ReadByte();
            reader.ReadInt();
            reader.ReadByte();
            reader.ReadByte();
            reader.ReadByte();
            reader.ReadString();
            reader.ReadBlockEnd(ref block);
            Console.WriteLine($"Position at end of char info: {reader.ByteReader.BaseStream.Position}");
        }
예제 #3
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);
        }
예제 #4
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);
        }