示例#1
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var weight = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var value  = BitConverter.ToInt32(context.buf, pos); pos += 4;


            var effectIds = new int[4];

            for (var i = 0; i < Constants.INGR_EFFECTS_LENGTH; ++i)
            {
                effectIds[i] = BitConverter.ToInt32(context.buf, pos); pos += 4;
            }

            var skillIds = new int[4];

            for (var i = 0; i < Constants.INGR_EFFECTS_LENGTH; ++i)
            {
                skillIds[i] = BitConverter.ToInt32(context.buf, pos); pos += 4;
            }

            var attributeIds = new int[4];

            for (var i = 0; i < Constants.INGR_EFFECTS_LENGTH; ++i)
            {
                attributeIds[i] = BitConverter.ToInt32(context.buf, pos); pos += 4;
            }

            return(new IngredientData(context.SubRecordName, weight, value, effectIds, skillIds, attributeIds));
        }
示例#2
0
        internal static object Read(SubRecordReadContext context)
        {
            var data = new byte[context.header.Size];

            Array.Copy(context.buf, data, context.header.Size);
            return(new GenericSubRecord(context.SubRecordName, data, true));
        }
示例#3
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var attributeID1 = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var attributeID2 = BitConverter.ToInt32(context.buf, pos); pos += 4;

            var rankData = new RankData[Constants.FACT_MAX_RANKS];

            for (var i = 0; i < Constants.FACT_MAX_RANKS; ++i)
            {
                var attribute1  = BitConverter.ToInt32(context.buf, pos); pos += 4;
                var attribute2  = BitConverter.ToInt32(context.buf, pos); pos += 4;
                var firstSkill  = BitConverter.ToInt32(context.buf, pos); pos += 4;
                var secondSkill = BitConverter.ToInt32(context.buf, pos); pos += 4;
                var faction     = BitConverter.ToInt32(context.buf, pos); pos += 4;

                rankData[i] = new RankData(attribute1, attribute2, firstSkill, secondSkill, faction);
            }

            var skillIds = new int[Constants.FACT_MAX_SKILL_IDS];

            for (int i = 0; i < Constants.FACT_MAX_SKILL_IDS; ++i)
            {
                skillIds[i] = BitConverter.ToInt32(context.buf, pos); pos += 4;
            }

            var flags = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new FactionData(context.SubRecordName, attributeID1, attributeID2, rankData, skillIds, flags));
        }
示例#4
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var type         = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var level        = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var strength     = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var intelligence = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var willpower    = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var agility      = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var speed        = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var endurance    = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var personality  = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var luck         = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var health       = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var spellPoints  = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var fatigue      = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var soul         = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var combat       = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var magic        = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var stealth      = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var attackMin1   = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var attackMax1   = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var attackMin2   = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var attackMax2   = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var attackMin3   = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var attackMax3   = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var gold         = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new CreatureData(context.SubRecordName, type, level, strength, intelligence, willpower, agility,
                                    speed, endurance, personality, luck, health, spellPoints, fatigue, soul, combat,
                                    magic, stealth, attackMin1, attackMax1, attackMin2, attackMax2, attackMin3,
                                    attackMax3, gold));
        }
示例#5
0
        internal static object Read(SubRecordReadContext context)
        {
            var volume   = context.buf[0];
            var minRange = context.buf[1];
            var maxRange = context.buf[2];

            return(new SoundData(context.SubRecordName, volume, minRange, maxRange));
        }
示例#6
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var gridX = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var gridY = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new GridSubRecord(context.SubRecordName, gridX, gridY));
        }
示例#7
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var name    = GetString(context.buf, pos, 32); pos += 32;
            var unknown = context.buf[pos++];

            return(new AIActivateData(context.SubRecordName, name, unknown));
        }
示例#8
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var count = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var name  = GetString(context.buf, pos, 32); pos += 32;

            return(new InventoryItemSubRecord(context.SubRecordName, count, name));
        }
示例#9
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var count = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var name  = GetString(context.buf, pos, Constants.NPCO_ITEM_NAME_LENGTH);

            return(new InventoryItemSubRecord(context.SubRecordName, count, name));
        }
示例#10
0
        internal static object Read(SubRecordReadContext context)
        {
            var part     = context.buf[0];
            var vampire  = context.buf[1];
            var flags    = context.buf[2];
            var partType = context.buf[3];

            return(new BodyPartData(context.SubRecordName, part, vampire, flags, partType));
        }
示例#11
0
        internal static object Read(SubRecordReadContext context)
        {
            switch (context.header.Size)
            {
            case 52:
            {
                var pos = 0;

                var level        = BitConverter.ToInt16(context.buf, pos); pos += 2;
                var strength     = context.buf[pos++];
                var intelligence = context.buf[pos++];
                var willpower    = context.buf[pos++];
                var agility      = context.buf[pos++];
                var speed        = context.buf[pos++];
                var endurance    = context.buf[pos++];
                var personality  = context.buf[pos++];
                var luck         = context.buf[pos++];

                var skills = new byte[27];
                Array.Copy(context.buf, pos, skills, 0, 27); pos += 27;

                var reputation  = context.buf[pos++];
                var health      = BitConverter.ToInt16(context.buf, pos); pos += 2;
                var spellPoints = BitConverter.ToInt16(context.buf, pos); pos += 2;
                var fatigue     = BitConverter.ToInt16(context.buf, pos); pos += 2;
                var disposition = context.buf[pos++];
                var factionID   = context.buf[pos++];
                var rank        = context.buf[pos++];
                var unknown     = context.buf[pos++];
                var gold        = BitConverter.ToInt32(context.buf, pos); pos += 4;

                return(new NPCData52(context.SubRecordName, level, strength, intelligence, willpower, agility, speed,
                                     endurance, personality, luck, skills, reputation, health, spellPoints, fatigue,
                                     disposition, factionID, rank, unknown, gold));
            }

            case 12:
            {
                var pos = 0;

                var level       = BitConverter.ToInt16(context.buf, pos); pos += 2;
                var disposition = context.buf[pos++];
                var factionID   = context.buf[pos++];
                var rank        = context.buf[pos++];
                var unknown     = context.buf[pos++];
                var unknown1    = context.buf[pos++];
                var unknown2    = context.buf[pos++];
                var gold        = BitConverter.ToInt32(context.buf, pos); pos += 4;

                return(new NPCData12(context.SubRecordName, level, disposition, factionID, rank, unknown, unknown1, unknown2, gold));
            }

            default:
                throw new InvalidOperationException($"Unexpected size for NPDT: {context.header.Size}");
            }
        }
示例#12
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var weight  = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var value   = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var unknown = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new MiscItemData(context.SubRecordName, weight, value, unknown));
        }
示例#13
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var type      = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var spellCost = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var flags     = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new SpellData(context.SubRecordName, type, spellCost, flags));
        }
示例#14
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var weight   = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var value    = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var autoCalc = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new PotionData(context.SubRecordName, weight, value, autoCalc));
        }
示例#15
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var type    = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var quality = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var weight  = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var value   = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new AlchemyApparatusData(context.SubRecordName, type, quality, weight, value));
        }
示例#16
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var x       = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var y       = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var z       = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var unknown = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new AITravelData(context.SubRecordName, x, y, z, unknown));
        }
示例#17
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var type          = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var weight        = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var value         = BitConverter.ToInt16(context.buf, pos); pos += 2;
            var enchantPoints = BitConverter.ToInt16(context.buf, pos); pos += 2;

            return(new ClothingData(context.SubRecordName, type, weight, value, enchantPoints));
        }
示例#18
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var weight  = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var value   = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var quality = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var uses    = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new LockpickData(context.SubRecordName, weight, value, quality, uses));
        }
示例#19
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var ambientColor  = ReadColorRef(context.buf, ref pos);
            var sunlightColor = ReadColorRef(context.buf, ref pos);
            var fogColor      = ReadColorRef(context.buf, ref pos);
            var fogDensity    = BitConverter.ToSingle(context.buf, pos); pos += 4;

            return(new InteriorLightSubRecord(context.SubRecordName, ambientColor, sunlightColor, fogColor, fogDensity));
        }
示例#20
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var type        = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var enchantCost = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var charge      = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var autoCalc    = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new EnchantData(context.SubRecordName, type, enchantCost, charge, autoCalc));
        }
示例#21
0
        internal static object Read(SubRecordReadContext context)
        {
            var connections = new List <int>();
            var pos         = 0;

            while (pos < context.header.Size)
            {
                connections.Add(BitConverter.ToInt32(context.buf, pos)); pos += 4;
            }

            return(new PathGridConnectionSubRecord(context.SubRecordName, connections));
        }
示例#22
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var weight        = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var value         = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var scroll        = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var skillID       = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var enchantPoints = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new BookData(context.SubRecordName, weight, value, scroll, skillID, enchantPoints));
        }
示例#23
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var version     = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var fileType    = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var companyName = GetString(context.buf, pos, Constants.TES3_COMPANY_NAME_LENGTH); pos += Constants.TES3_COMPANY_NAME_LENGTH;
            var description = GetString(context.buf, pos, Constants.TES3_DESCRIPTION_LENGTH); pos += Constants.TES3_DESCRIPTION_LENGTH;
            var numRecords  = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new TES3HeaderData(context.SubRecordName, version, fileType, companyName, description, numRecords));
        }
示例#24
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var gridX       = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var gridY       = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var granularity = BitConverter.ToInt16(context.buf, pos); pos += 2;
            var pointCount  = BitConverter.ToInt16(context.buf, pos); pos += 2;


            return(new PathGridDataSubRecord(context.SubRecordName, gridX, gridY, granularity, pointCount));
        }
示例#25
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var type          = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var weight        = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var value         = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var health        = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var enchantPoints = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var armor         = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new ArmorData(context.SubRecordName, type, weight, value, health, enchantPoints, armor));
        }
示例#26
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var weight = BitConverter.ToSingle(context.buf, pos); pos += 4;
            var value  = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var time   = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var radius = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var color  = ReadColorRef(context.buf, ref pos);
            var flags  = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new LightData(context.SubRecordName, weight, value, time, radius, color, flags));
        }
示例#27
0
		internal static object Read(SubRecordReadContext context)
		{
        
            var pos = 0;

            var unknown = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var disposition = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var rank = context.buf[pos++];
            var gender = context.buf[pos++];
            var pcRank = context.buf[pos++];
            var unknown1 = context.buf[pos++];

            return new DialogueInfoData(context.SubRecordName, unknown, disposition, rank, gender, pcRank, unknown1);
		}
示例#28
0
        internal static object Read(SubRecordReadContext context)
        {
            switch (context.header.Size)
            {
            case 1:
                return(new ByteSubRecord(context.SubRecordName, context.buf[0]));

            case 4:
                return(new IntSubRecord(context.SubRecordName, BitConverter.ToInt32(context.buf, 0)));

            default:
                throw new InvalidOperationException($"Unrecognized dialogue DATA size: {context.header.Size}");
            }
        }
示例#29
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos = 0;

            var name = GetString(context.buf, pos, 32); pos += 32;

            var numShorts    = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var numLongs     = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var numFloats    = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var dataSize     = BitConverter.ToInt32(context.buf, pos); pos += 4;
            var localVarSize = BitConverter.ToInt32(context.buf, pos); pos += 4;

            return(new ScriptHeader(context.SubRecordName, name, numShorts, numLongs, numFloats, dataSize, localVarSize));
        }
示例#30
0
        internal static object Read(SubRecordReadContext context)
        {
            var pos     = 0;
            var mapping = new TES3VertexColor[VertexColorSubRecord.COLOR_MAPPING_SIDE_LENGTH, VertexColorSubRecord.COLOR_MAPPING_SIDE_LENGTH];

            for (var i = 0; i < VertexColorSubRecord.COLOR_MAPPING_SIDE_LENGTH; ++i)
            {
                for (var j = 0; j < VertexColorSubRecord.COLOR_MAPPING_SIDE_LENGTH; ++j)
                {
                    mapping[i, j] = new TES3VertexColor(context.buf[pos++], context.buf[pos++], context.buf[pos++]);
                }
            }

            return(new VertexColorSubRecord(context.SubRecordName, mapping));
        }