Beispiel #1
0
            public static partial void CustomBinaryEndExport(MutagenWriter writer, IWorldspaceGetter obj)
            {
                try
                {
                    var topCell  = obj.TopCell;
                    var subCells = obj.SubCells;
                    if (subCells?.Count == 0 &&
                        topCell == null)
                    {
                        return;
                    }
                    using (HeaderExport.Header(writer, RecordTypes.GRUP, ObjectType.Group))
                    {
                        FormKeyBinaryTranslation.Instance.Write(
                            writer,
                            obj.FormKey);
                        writer.Write((int)GroupTypeEnum.WorldChildren);
                        writer.Write(obj.SubCellsTimestamp);
                        writer.Write(obj.SubCellsUnknown);

                        topCell?.WriteToBinary(writer);
                        ListBinaryTranslation <IWorldspaceBlockGetter> .Instance.Write(
                            writer : writer,
                            items : subCells,
                            transl : (MutagenWriter subWriter, IWorldspaceBlockGetter subItem) =>
                        {
                            subItem.WriteToBinary(subWriter);
                        });
                    }
                }
                catch (Exception ex)
                {
                    throw RecordException.Enrich(ex, obj);
                }
            }
Beispiel #2
0
 public virtual void Write(
     MutagenWriter writer,
     IGlobalGetter item,
     TypedWriteParams?translationParams = null)
 {
     using (HeaderExport.Record(
                writer: writer,
                record: translationParams.ConvertToCustom(RecordTypes.GLOB)))
     {
         try
         {
             OblivionMajorRecordBinaryWriteTranslation.WriteEmbedded(
                 item: item,
                 writer: writer);
             writer.MetaData.FormVersion = item.FormVersion;
             WriteRecordTypes(
                 item: item,
                 writer: writer,
                 translationParams: translationParams);
             writer.MetaData.FormVersion = null;
         }
         catch (Exception ex)
         {
             throw RecordException.Enrich(ex, item);
         }
     }
 }
Beispiel #3
0
 public void Write(
     MutagenWriter writer,
     IActorValueInformationGetter item,
     TypedWriteParams?translationParams = null)
 {
     using (HeaderExport.Record(
                writer: writer,
                record: translationParams.ConvertToCustom(RecordTypes.AVIF)))
     {
         try
         {
             Fallout4MajorRecordBinaryWriteTranslation.WriteEmbedded(
                 item: item,
                 writer: writer);
             MajorRecordBinaryWriteTranslation.WriteRecordTypes(
                 item: item,
                 writer: writer,
                 translationParams: translationParams);
         }
         catch (Exception ex)
         {
             throw RecordException.Enrich(ex, item);
         }
     }
 }
 public void Write(
     MutagenWriter writer,
     IActorValueInformationGetter item,
     RecordTypeConverter?recordTypeConverter = null)
 {
     using (HeaderExport.Header(
                writer: writer,
                record: recordTypeConverter.ConvertToCustom(RecordTypes.AVIF),
                type: Mutagen.Bethesda.Binary.ObjectType.Record))
     {
         try
         {
             Fallout4MajorRecordBinaryWriteTranslation.WriteEmbedded(
                 item: item,
                 writer: writer);
             MajorRecordBinaryWriteTranslation.WriteRecordTypes(
                 item: item,
                 writer: writer,
                 recordTypeConverter: recordTypeConverter);
         }
         catch (Exception ex)
         {
             throw RecordException.Enrich(ex, item);
         }
     }
 }
 public virtual void Write(
     MutagenWriter writer,
     IGameSettingGetter item,
     RecordTypeConverter?recordTypeConverter = null)
 {
     using (HeaderExport.Header(
                writer: writer,
                record: recordTypeConverter.ConvertToCustom(RecordTypes.GMST),
                type: ObjectType.Record))
     {
         try
         {
             SkyrimMajorRecordBinaryWriteTranslation.WriteEmbedded(
                 item: item,
                 writer: writer);
             MajorRecordBinaryWriteTranslation.WriteRecordTypes(
                 item: item,
                 writer: writer,
                 recordTypeConverter: recordTypeConverter);
         }
         catch (Exception ex)
         {
             throw RecordException.Enrich(ex, item);
         }
     }
 }
Beispiel #6
0
        public void EnrichWithUmbrellaInterface()
        {
            var ex  = new Exception();
            var rec = RecordException.Enrich <IItem>(ex, FormKey.Null, "SomeEdid");

            rec.RecordType.Should().Be(typeof(IItem));
        }
Beispiel #7
0
 public void Write(
     MutagenWriter writer,
     ISpellLeveledGetter item,
     RecordTypeConverter?recordTypeConverter = null)
 {
     using (HeaderExport.Header(
                writer: writer,
                record: recordTypeConverter.ConvertToCustom(RecordTypes.LVSP),
                type: ObjectType.Record))
     {
         try
         {
             OblivionMajorRecordBinaryWriteTranslation.WriteEmbedded(
                 item: item,
                 writer: writer);
             SpellBinaryWriteTranslation.WriteRecordTypes(
                 item: item,
                 writer: writer,
                 recordTypeConverter: recordTypeConverter);
         }
         catch (Exception ex)
         {
             throw RecordException.Enrich(ex, item);
         }
     }
 }
Beispiel #8
0
 public virtual void Write(
     MutagenWriter writer,
     IGlobalGetter item,
     RecordTypeConverter?recordTypeConverter = null)
 {
     using (HeaderExport.Header(
                writer: writer,
                record: recordTypeConverter.ConvertToCustom(RecordTypes.GLOB),
                type: ObjectType.Record))
     {
         try
         {
             OblivionMajorRecordBinaryWriteTranslation.WriteEmbedded(
                 item: item,
                 writer: writer);
             writer.MetaData.FormVersion = item.FormVersion;
             WriteRecordTypes(
                 item: item,
                 writer: writer,
                 recordTypeConverter: recordTypeConverter);
             writer.MetaData.FormVersion = null;
         }
         catch (Exception ex)
         {
             throw RecordException.Enrich(ex, item);
         }
     }
 }
Beispiel #9
0
 public static partial void CustomBinaryEndExport(MutagenWriter writer, IDialogTopicGetter obj)
 {
     try
     {
         if (!obj.Items.TryGet(out var items) ||
             items.Count == 0)
         {
             return;
         }
         using (HeaderExport.Header(writer, RecordTypes.GRUP, ObjectType.Group))
         {
             FormKeyBinaryTranslation.Instance.Write(
                 writer,
                 obj.FormKey);
             writer.Write((int)GroupTypeEnum.TopicChildren);
             writer.Write(obj.Timestamp);
             ListBinaryTranslation <IDialogItemGetter> .Instance.Write(
                 writer : writer,
                 items : items,
                 transl : (MutagenWriter subWriter, IDialogItemGetter subItem) =>
             {
                 subItem.WriteToBinary(subWriter);
             });
         }
     }
     catch (Exception ex)
     {
         throw RecordException.Enrich(ex, obj);
     }
 }
 public void Write(
     MutagenWriter writer,
     IMaterialSwapGetter item,
     RecordTypeConverter?recordTypeConverter = null)
 {
     using (HeaderExport.Header(
                writer: writer,
                record: recordTypeConverter.ConvertToCustom(RecordTypes.MSWP),
                type: ObjectType.Record))
     {
         try
         {
             Fallout4MajorRecordBinaryWriteTranslation.WriteEmbedded(
                 item: item,
                 writer: writer);
             MajorRecordBinaryWriteTranslation.WriteRecordTypes(
                 item: item,
                 writer: writer,
                 recordTypeConverter: recordTypeConverter);
         }
         catch (Exception ex)
         {
             throw RecordException.Enrich(ex, item);
         }
     }
 }
Beispiel #11
0
 public void Write(
     MutagenWriter writer,
     ILensFlareGetter item,
     TypedWriteParams?translationParams = null)
 {
     using (HeaderExport.Record(
                writer: writer,
                record: translationParams.ConvertToCustom(RecordTypes.LENS)))
     {
         try
         {
             SkyrimMajorRecordBinaryWriteTranslation.WriteEmbedded(
                 item: item,
                 writer: writer);
             MajorRecordBinaryWriteTranslation.WriteRecordTypes(
                 item: item,
                 writer: writer,
                 translationParams: translationParams);
         }
         catch (Exception ex)
         {
             throw RecordException.Enrich(ex, item);
         }
     }
 }
Beispiel #12
0
 public void Write(
     MutagenWriter writer,
     ILensFlareGetter item,
     RecordTypeConverter?recordTypeConverter = null)
 {
     using (HeaderExport.Header(
                writer: writer,
                record: recordTypeConverter.ConvertToCustom(RecordTypes.LENS),
                type: Mutagen.Bethesda.Binary.ObjectType.Record))
     {
         try
         {
             SkyrimMajorRecordBinaryWriteTranslation.WriteEmbedded(
                 item: item,
                 writer: writer);
             MajorRecordBinaryWriteTranslation.WriteRecordTypes(
                 item: item,
                 writer: writer,
                 recordTypeConverter: recordTypeConverter);
         }
         catch (Exception ex)
         {
             throw RecordException.Enrich(ex, item);
         }
     }
 }
 public void Write(
     MutagenWriter writer,
     ISpellLeveledGetter item,
     TypedWriteParams?translationParams = null)
 {
     using (HeaderExport.Record(
                writer: writer,
                record: translationParams.ConvertToCustom(RecordTypes.LVSP)))
     {
         try
         {
             OblivionMajorRecordBinaryWriteTranslation.WriteEmbedded(
                 item: item,
                 writer: writer);
             SpellBinaryWriteTranslation.WriteRecordTypes(
                 item: item,
                 writer: writer,
                 translationParams: translationParams);
         }
         catch (Exception ex)
         {
             throw RecordException.Enrich(ex, item);
         }
     }
 }
Beispiel #14
0
            static partial void CustomBinaryEndImport(MutagenFrame frame, IWorldspaceInternal obj)
            {
                try
                {
                    if (!frame.Reader.TryReadGroup(out var groupHeader))
                    {
                        return;
                    }
                    if (groupHeader.GroupType == (int)GroupTypeEnum.WorldChildren)
                    {
                        obj.SubCellsTimestamp = BinaryPrimitives.ReadInt32LittleEndian(groupHeader.LastModifiedData);
                        var formKey = FormKeyBinaryTranslation.Instance.Parse(groupHeader.ContainedRecordTypeData, frame.MetaData.MasterReferences !);
                        if (formKey != obj.FormKey)
                        {
                            throw new ArgumentException("Cell children group did not match the FormID of the parent worldspace.");
                        }
                    }
                    else
                    {
                        frame.Reader.Position -= groupHeader.HeaderLength;
                        return;
                    }
                    var subFrame = MutagenFrame.ByLength(frame.Reader, groupHeader.ContentLength);
                    for (int i = 0; i < 3; i++)
                    {
                        if (subFrame.Complete)
                        {
                            return;
                        }
                        var subType = HeaderTranslation.GetNextSubrecordType(frame.Reader, out var subLen);
                        switch (subType.TypeInt)
                        {
                        case 0x44414F52:     // "ROAD":
                            obj.Road = Road.CreateFromBinary(subFrame);
                            break;

                        case 0x4C4C4543:     // "CELL":
                            obj.TopCell = Cell.CreateFromBinary(subFrame);
                            break;

                        case 0x50555247:     // "GRUP":
                            obj.SubCells.SetTo(
                                Mutagen.Bethesda.Binary.ListBinaryTranslation <WorldspaceBlock> .Instance.Parse(
                                    frame: frame,
                                    triggeringRecord: RecordTypes.GRUP,
                                    transl: LoquiBinaryTranslation <WorldspaceBlock> .Instance.Parse));
                            break;

                        default:
                            return;
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw RecordException.Enrich(ex, obj);
                }
            }
Beispiel #15
0
 public static partial void CustomBinaryEndImport(MutagenFrame frame, ICellInternal obj)
 {
     try
     {
         CustomBinaryEnd(frame, obj);
     }
     catch (Exception ex)
     {
         throw RecordException.Enrich(ex, obj);
     }
 }
Beispiel #16
0
 public T this[FormKey key]
 {
     get
     {
         try
         {
             return(ConstructWrapper(this._locs[key]));
         }
         catch (Exception ex)
         {
             throw RecordException.Enrich <T>(ex, key, edid: null);
         }
     }
 }
Beispiel #17
0
 public static partial void CustomBinaryEndImport(MutagenFrame frame, IDialogTopicInternal obj)
 {
     try
     {
         if (frame.Reader.Complete)
         {
             return;
         }
         if (!frame.TryGetGroup(out var groupMeta))
         {
             return;
         }
         if (groupMeta.GroupType == (int)GroupTypeEnum.TopicChildren)
         {
             obj.Timestamp = BinaryPrimitives.ReadInt32LittleEndian(groupMeta.LastModifiedData);
             obj.Unknown   = frame.GetInt32(offset: 20);
             if (FormKey.Factory(frame.MetaData.MasterReferences !, BinaryPrimitives.ReadUInt32LittleEndian(groupMeta.ContainedRecordTypeData)) != obj.FormKey)
             {
                 throw new ArgumentException("Dialog children group did not match the FormID of the parent.");
             }
         }
         else
         {
             return;
         }
         frame.Reader.Position += groupMeta.HeaderLength;
         obj.Responses.SetTo(ListBinaryTranslation <DialogResponses> .Instance.Parse(
                                 reader: frame.SpawnWithLength(groupMeta.ContentLength),
                                 transl: (MutagenFrame r, RecordType header, out DialogResponses listItem) =>
         {
             return(LoquiBinaryTranslation <DialogResponses> .Instance.Parse(
                        frame: r,
                        item: out listItem));
         }));
     }
     catch (Exception ex)
     {
         throw RecordException.Enrich(ex, obj);
     }
 }
Beispiel #18
0
 partial void CustomEnd(OverlayStream stream, int finalPos, int offset)
 {
     try
     {
         if (stream.Complete)
         {
             return;
         }
         var startPos = stream.Position;
         if (!stream.TryGetGroup(out var groupMeta))
         {
             return;
         }
         if (groupMeta.GroupType != (int)GroupTypeEnum.TopicChildren)
         {
             return;
         }
         this._grupData = stream.ReadMemory(checked ((int)groupMeta.TotalLength));
         var formKey = FormKey.Factory(_package.MetaData.MasterReferences !, BinaryPrimitives.ReadUInt32LittleEndian(groupMeta.ContainedRecordTypeData));
         if (formKey != this.FormKey)
         {
             throw new ArgumentException("Dialog children group did not match the FormID of the parent.");
         }
         var contentSpan = this._grupData.Value.Slice(_package.MetaData.Constants.GroupConstants.HeaderLength);
         this.Items = BinaryOverlayList.FactoryByArray <IDialogItemGetter>(
             contentSpan,
             _package,
             getter: (s, p) => DialogItemBinaryOverlay.DialogItemFactory(new OverlayStream(s, p), p),
             locs: ParseRecordLocations(
                 stream: new OverlayStream(contentSpan, _package),
                 trigger: DialogItem_Registration.TriggeringRecordType,
                 constants: GameConstants.Oblivion.MajorConstants,
                 skipHeader: false));
     }
     catch (Exception ex)
     {
         throw RecordException.Enrich(ex, this);
     }
 }
Beispiel #19
0
        public static void RunPatch(IPatcherState <ISkyrimMod, ISkyrimModGetter> state)
        {
            Console.WriteLine("\n\nInitialization successful, beginning patcher process...\n");

            // initialize the modified record counter, and add Game Setting changes to the patch.
            var count = Settings.GameSettings.AddGameSettingsToPatch(state);

            if (count > 0) // if game settings were successfully added, write to log
            {
                Console.WriteLine($"Modified {count} Game Setting {(count > 1 ? "s" : "")}.");
            }

            // Apply attack angle modifier for all races, if the modifier isn't set to 0
            if (!Settings.AttackStrikeAngleModifier.Equals(0F))
            {
                foreach (IRaceGetter race in state.LoadOrder.PriorityOrder.Race().WinningOverrides())
                {
                    // iterate through all races that have the ActorTypeNPC keyword.
                    try
                    {
                        if (!race.HasKeyword(Skyrim.Keyword.ActorTypeNPC) || race.EditorID == null)
                        {
                            continue; // skip this race if it does not have the ActorTypeNPC keyword
                        }
                        var raceCopy = race.DeepCopy();

                        var subrecordChanges = count;
                        foreach (var attack in raceCopy.Attacks)
                        {
                            if (attack.AttackData == null)
                            {
                                continue;
                            }
                            attack.AttackData.StrikeAngle =
                                Settings.GetModifiedStrikeAngle(attack.AttackData.StrikeAngle);
                            ++count; // iterate counter by one for each modified attack
                        }

                        subrecordChanges = count - subrecordChanges;
                        if (subrecordChanges > 0)
                        {
                            state.PatchMod.Races.Set(raceCopy);
                            Console.WriteLine($"Modified {subrecordChanges} attacks for race: {race.EditorID}");
                        }
                    }
                    catch (Exception ex)
                    {
                        throw RecordException.Enrich(ex, race);
                    }
                }
            }

            // Apply speed and reach fixes to all weapons.
            foreach (var weap in state.LoadOrder.PriorityOrder.WinningOverrides <IWeaponGetter>())
            {
                try
                {
                    if (weap.Data == null || weap.EditorID == null)
                    {
                        continue;
                    }

                    var weapon = weap.DeepCopy(); // copy weap record to temp

                    var(changedReach, changedSpeed) = Settings.ApplyChangesToWeapon(weapon);

                    if (changedReach || changedSpeed)
                    {
                        // if temp record was modified
                        state.PatchMod.Weapons.Set(weapon); // set weap record to temp
                        Console.WriteLine($"Successfully modified weapon: {weap.EditorID}");
                        ++count;
                        if (Settings.PrintWeaponStatsToLog)
                        {
                            Console.Write(
                                $"{(changedReach ? $"\tReach: {weap.Data.Reach}\n" : "")}{(changedSpeed ? $"\tSpeed: {weap.Data.Speed}\n" : "")}");
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw RecordException.Enrich(ex, weap);
                }
            }

            // Log the total number of records modified by the patcher.
            Console.WriteLine($"\nFinished patching {count} records.\n");
        }
Beispiel #20
0
            private static void CustomBinaryEnd(MutagenFrame frame, ICellInternal obj)
            {
                try
                {
                    if (frame.Reader.Complete)
                    {
                        return;
                    }
                    if (!frame.TryGetGroup(out var groupMeta))
                    {
                        return;
                    }
                    var formKey = FormKey.Factory(frame.MetaData.MasterReferences !, BinaryPrimitives.ReadUInt32LittleEndian(groupMeta.ContainedRecordTypeData));
                    if (groupMeta.GroupType == (int)GroupTypeEnum.CellChildren)
                    {
                        obj.Timestamp        = BinaryPrimitives.ReadInt32LittleEndian(groupMeta.LastModifiedData);
                        obj.UnknownGroupData = BinaryPrimitives.ReadInt32LittleEndian(groupMeta.HeaderData.Slice(groupMeta.HeaderData.Length - 4));
                        frame.Position      += groupMeta.HeaderLength;
                        if (formKey != obj.FormKey)
                        {
                            throw new ArgumentException("Cell children group did not match the FormID of the parent cell.");
                        }
                    }
                    else
                    {
                        return;
                    }
                    var subFrame = frame.SpawnWithLength(groupMeta.ContentLength);
                    while (!subFrame.Complete)
                    {
                        var persistGroupMeta = frame.GetGroup();
                        if (!persistGroupMeta.IsGroup)
                        {
                            throw new ArgumentException();
                        }
                        GroupTypeEnum type      = (GroupTypeEnum)persistGroupMeta.GroupType;
                        var           itemFrame = frame.SpawnWithLength(persistGroupMeta.TotalLength);
                        switch (type)
                        {
                        case GroupTypeEnum.CellTemporaryChildren:
                            ParseTemporary(
                                itemFrame,
                                obj);
                            break;

                        case GroupTypeEnum.CellPersistentChildren:
                            ParseTypical(
                                itemFrame,
                                obj);
                            break;

                        default:
                            throw new NotImplementedException();
                        }
                    }
                }
                catch (Exception ex)
                {
                    throw RecordException.Enrich(ex, obj);
                }
            }
Beispiel #21
0
 public static partial void CustomBinaryEndExport(MutagenWriter writer, ICellGetter obj)
 {
     try
     {
         var navMeshes = obj.NavigationMeshes;
         var landscape = obj.Landscape;
         if ((obj.Persistent?.Count ?? 0) == 0 &&
             (obj.Temporary?.Count ?? 0) == 0 &&
             navMeshes.Count == 0 &&
             landscape == null)
         {
             return;
         }
         using (HeaderExport.Header(writer, RecordTypes.GRUP, ObjectType.Group))
         {
             FormKeyBinaryTranslation.Instance.Write(
                 writer,
                 obj.FormKey);
             writer.Write((int)GroupTypeEnum.CellChildren);
             writer.Write(obj.Timestamp);
             writer.Write(obj.UnknownGroupData);
             if (obj.Persistent?.Count > 0)
             {
                 using (HeaderExport.Header(writer, RecordTypes.GRUP, ObjectType.Group))
                 {
                     FormKeyBinaryTranslation.Instance.Write(
                         writer,
                         obj.FormKey);
                     writer.Write((int)GroupTypeEnum.CellPersistentChildren);
                     writer.Write(obj.PersistentTimestamp);
                     writer.Write(obj.PersistentUnknownGroupData);
                     ListBinaryTranslation <IPlacedGetter> .Instance.Write(
                         writer : writer,
                         items : obj.Persistent,
                         transl : WritePlaced);
                 }
             }
             if (obj.Temporary?.Count > 0 ||
                 navMeshes.Count > 0 ||
                 landscape != null)
             {
                 using (HeaderExport.Header(writer, RecordTypes.GRUP, ObjectType.Group))
                 {
                     FormKeyBinaryTranslation.Instance.Write(
                         writer,
                         obj.FormKey);
                     writer.Write((int)GroupTypeEnum.CellTemporaryChildren);
                     writer.Write(obj.TemporaryTimestamp);
                     writer.Write(obj.TemporaryUnknownGroupData);
                     landscape?.WriteToBinary(writer);
                     foreach (var navMesh in navMeshes)
                     {
                         navMesh.WriteToBinary(writer);
                     }
                     if (obj.Temporary != null)
                     {
                         ListBinaryTranslation <IPlacedGetter> .Instance.Write(
                             writer : writer,
                             items : obj.Temporary,
                             transl : WritePlaced);
                     }
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw RecordException.Enrich(ex, obj);
     }
 }
Beispiel #22
0
 public static partial void CustomBinaryEndExport(MutagenWriter writer, ICellGetter obj)
 {
     try
     {
         var pathGrid  = obj.PathGrid;
         var landscape = obj.Landscape;
         if ((obj.Persistent?.Count ?? 0) == 0 &&
             (obj.Temporary?.Count ?? 0) == 0 &&
             (obj.VisibleWhenDistant?.Count ?? 0) == 0 &&
             pathGrid == null &&
             landscape == null)
         {
             return;
         }
         using (HeaderExport.Header(writer, RecordTypes.GRUP, ObjectType.Group))
         {
             FormKeyBinaryTranslation.Instance.Write(
                 writer,
                 obj.FormKey);
             writer.Write((int)GroupTypeEnum.CellChildren);
             writer.Write(obj.Timestamp);
             if (obj.Persistent?.Count > 0)
             {
                 using (HeaderExport.Header(writer, RecordTypes.GRUP, ObjectType.Group))
                 {
                     FormKeyBinaryTranslation.Instance.Write(
                         writer,
                         obj.FormKey);
                     writer.Write((int)GroupTypeEnum.CellPersistentChildren);
                     writer.Write(obj.PersistentTimestamp);
                     ListBinaryTranslation <IPlacedGetter> .Instance.Write(
                         writer : writer,
                         items : obj.Persistent,
                         transl : (r, item) =>
                     {
                         item.WriteToBinary(r);
                     });
                 }
             }
             if (obj.Temporary?.Count > 0 ||
                 pathGrid != null ||
                 landscape != null)
             {
                 using (HeaderExport.Header(writer, RecordTypes.GRUP, ObjectType.Group))
                 {
                     FormKeyBinaryTranslation.Instance.Write(
                         writer,
                         obj.FormKey);
                     writer.Write((int)GroupTypeEnum.CellTemporaryChildren);
                     writer.Write(obj.TemporaryTimestamp);
                     landscape?.WriteToBinary(writer);
                     pathGrid?.WriteToBinary(writer);
                     if (obj.Temporary != null)
                     {
                         ListBinaryTranslation <IPlacedGetter> .Instance.Write(
                             writer : writer,
                             items : obj.Temporary,
                             transl : (r, item) =>
                         {
                             item.WriteToBinary(r);
                         });
                     }
                 }
             }
             if (obj.VisibleWhenDistant?.Count > 0)
             {
                 using (HeaderExport.Header(writer, RecordTypes.GRUP, ObjectType.Group))
                 {
                     FormKeyBinaryTranslation.Instance.Write(
                         writer,
                         obj.FormKey);
                     writer.Write((int)GroupTypeEnum.CellVisibleDistantChildren);
                     writer.Write(obj.VisibleWhenDistantTimestamp);
                     ListBinaryTranslation <IPlacedGetter> .Instance.Write(
                         writer : writer,
                         items : obj.VisibleWhenDistant,
                         transl : (r, item) =>
                     {
                         item.WriteToBinary(r);
                     });
                 }
             }
         }
     }
     catch (Exception ex)
     {
         throw RecordException.Enrich(ex, obj);
     }
 }