コード例 #1
0
        void ReadFile(BinaryReader reader)
        {
            // Read class resist, etc. flags
            DFCareer.CFGData cfg = new DFCareer.CFGData();
            cfg.ResistanceFlags = reader.ReadByte();
            cfg.ImmunityFlags = reader.ReadByte();
            cfg.LowToleranceFlags = reader.ReadByte();
            cfg.CriticalWeaknessFlags = reader.ReadByte();

            // Read class special ability and spell point bitfield
            cfg.AbilityFlagsAndSpellPointsBitfield = reader.ReadUInt16();

            // Read rapid healing flags
            cfg.RapidHealing = reader.ReadByte();

            // Read regeneration flags
            cfg.Regeneration = reader.ReadByte();

            // Unknown value
            cfg.Unknown1 = reader.ReadByte();

            // Spell absorption flags
            cfg.SpellAbsorptionFlags = reader.ReadByte();

            // Attack modifier against major enemy groups
            cfg.AttackModifierFlags = reader.ReadByte();

            // Read forbidden material flags
            cfg.ForbiddenMaterialsFlags = reader.ReadUInt16();

            // Read weapon, armor, shields bitfield
            Byte a = reader.ReadByte();
            Byte b = reader.ReadByte();
            Byte c = reader.ReadByte();
            cfg.WeaponArmorShieldsBitfield = (UInt32)((a << 16) | (c << 8) | b);

            // Read primary skills
            cfg.PrimarySkill1 = reader.ReadByte();
            cfg.PrimarySkill2 = reader.ReadByte();
            cfg.PrimarySkill3 = reader.ReadByte();

            // Read major skills
            cfg.MajorSkill1 = reader.ReadByte();
            cfg.MajorSkill2 = reader.ReadByte();
            cfg.MajorSkill3 = reader.ReadByte();

            // Read minor skills
            cfg.MinorSkill1 = reader.ReadByte();
            cfg.MinorSkill2 = reader.ReadByte();
            cfg.MinorSkill3 = reader.ReadByte();
            cfg.MinorSkill4 = reader.ReadByte();
            cfg.MinorSkill5 = reader.ReadByte();
            cfg.MinorSkill6 = reader.ReadByte();

            // Read class name
            cfg.Name = file.ReadCStringSkip(reader, 0, 16);

            // Read 8 unknown bytes
            cfg.Unknown2 = reader.ReadBytes(8);

            // Hit points per level
            cfg.HitPointsPerLevelOrMonsterLevel = reader.ReadUInt16();

            // Read advancement multiplier
            cfg.AdvancementMultiplier = reader.ReadUInt32();

            // Read attributes
            cfg.Attributes = new UInt16[8];
            for (int i = 0; i < 8; i++)
            {
                cfg.Attributes[i] = reader.ReadUInt16();
            }

            // Structure data
            career = new DFCareer(cfg);
        }