Esempio n. 1
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}");
        }
Esempio n. 2
0
        internal void Read(GDFileReader reader)
        {
            var baseName = reader.ReadString();

            Console.WriteLine($"Item base name: {baseName}");
            var prefixName    = reader.ReadString();
            var suffixName    = reader.ReadString();
            var modifierName  = reader.ReadString();
            var transmuteName = reader.ReadString();
            var seed          = reader.ReadInt();
            var relicName     = reader.ReadString();
            var relicBonus    = reader.ReadString();
            var relicSeed     = reader.ReadInt();
            var augmentName   = reader.ReadString();

            reader.ReadInt();
            var augmentSeed = reader.ReadInt();

            reader.ReadInt();
            var stackCount = reader.ReadInt();
        }
Esempio n. 3
0
        private Character ReadFile(string path, StreamWriter _logger)
        {
            var reader   = new GDFileReader();
            var theTaken = new Character();

            using (reader.ByteReader = new BinaryReader(new FileStream(path, FileMode.Open, FileAccess.Read)))
            {
                reader.ReadKey();

                if (reader.ReadInt() != 0x58434447)
                {
                    throw new IOException();
                }
                var temp = reader.ReadInt();
                if (temp != 1 && temp != 2)
                {
                    throw new IOException();
                }

                //header
                theTaken.Name = reader.ReadWideString();
                _logger.WriteLine($"Name: {theTaken.Name}");
                theTaken.isMale = reader.ReadByte() == 1;
                _logger.WriteLine($"Sex: {(theTaken.isMale ? "Male" : "Female")}");
                var tag = reader.ReadString();
                _logger.WriteLine($"Tag: {tag}");
                theTaken.Level = (int)reader.ReadInt();
                _logger.WriteLine($"Level: {theTaken.Level}");
                var hardcore = reader.ReadByte();
                _logger.WriteLine($"Hardcore: {hardcore}");

                //We're off by 1 byte somehow
                reader.ReadByte();

                _logger.WriteLine($"{reader.NextInt()}");
                _logger.WriteLine($"Header version?: {reader.ReadInt()}"); //version?

                //Read ID
                byte[] id = new byte[16];
                for (int i = 0; i < 16; i++)
                {
                    id[i] = reader.ReadByte();
                }

                //Read character info
                ReadCharacterInfo(ref theTaken, ref reader);

                //Read bio
                ReadCharacterBio(ref theTaken, ref reader);

                //Read inventory
                ReadInventory(ref theTaken, ref reader);

                //Read stash


                //Read respawns


                //Read teleports


                //Read markers


                //Read shrines


                //Read skills


                return(theTaken);
            }
        }