diff --git a/Mutagen.Bethesda.Starfield/Documentation/AspectInterfaceDocumentation_Generated.md b/Mutagen.Bethesda.Starfield/Documentation/AspectInterfaceDocumentation_Generated.md index 989936fa65..6cdc5ef5aa 100644 --- a/Mutagen.Bethesda.Starfield/Documentation/AspectInterfaceDocumentation_Generated.md +++ b/Mutagen.Bethesda.Starfield/Documentation/AspectInterfaceDocumentation_Generated.md @@ -7,6 +7,7 @@ Functions can then be written that take in `INamed`, allowing any record that ha - Activator - Armor - Book +- Container - LeveledItem - MagicEffect - MiscItem @@ -20,6 +21,7 @@ Functions can then be written that take in `INamed`, allowing any record that ha - Activator - Armor - Book +- Container - KeywordFormComponent - MagicEffect - MiscItem @@ -37,6 +39,7 @@ Functions can then be written that take in `INamed`, allowing any record that ha - AnimatedObject - BodyData - Book +- Container - DestructionStage - HeadPart - LegendaryItem @@ -55,6 +58,7 @@ Functions can then be written that take in `INamed`, allowing any record that ha - BipedObjectData - Book - Class +- Container - DamageType - FaceMorphPhenotype - FaceMorphPhenotypeItem @@ -103,6 +107,7 @@ Functions can then be written that take in `INamed`, allowing any record that ha - AudioOcclusionPrimitive - BendableSpline - Book +- Container - LegendaryItem - LeveledItem - MiscItem @@ -121,6 +126,7 @@ Functions can then be written that take in `INamed`, allowing any record that ha - Activator - Armor - Book +- Container - LeveledItem - MagicEffect - MiscItem @@ -167,6 +173,13 @@ Functions can then be written that take in `INamed`, allowing any record that ha - IWeightValue ### Class - INamed +### Container +- IHaveVirtualMachineAdapter +- IKeyworded +- IModeled +- INamed +- IObjectBounded +- IScripted ### DamageType - INamed ### DestructionStage diff --git a/Mutagen.Bethesda.Starfield/Interfaces/Aspect/AspectInterfaceMapping_Generated.cs b/Mutagen.Bethesda.Starfield/Interfaces/Aspect/AspectInterfaceMapping_Generated.cs index 069a9826e3..a12bddd85f 100644 --- a/Mutagen.Bethesda.Starfield/Interfaces/Aspect/AspectInterfaceMapping_Generated.cs +++ b/Mutagen.Bethesda.Starfield/Interfaces/Aspect/AspectInterfaceMapping_Generated.cs @@ -25,6 +25,7 @@ public StarfieldAspectInterfaceMapping() Activator_Registration.Instance, Armor_Registration.Instance, Book_Registration.Instance, + Container_Registration.Instance, LeveledItem_Registration.Instance, MagicEffect_Registration.Instance, MiscItem_Registration.Instance, @@ -43,6 +44,7 @@ public StarfieldAspectInterfaceMapping() Activator_Registration.Instance, Armor_Registration.Instance, Book_Registration.Instance, + Container_Registration.Instance, KeywordFormComponent_Registration.Instance, MagicEffect_Registration.Instance, MiscItem_Registration.Instance, @@ -63,6 +65,7 @@ public StarfieldAspectInterfaceMapping() AnimatedObject_Registration.Instance, BodyData_Registration.Instance, Book_Registration.Instance, + Container_Registration.Instance, DestructionStage_Registration.Instance, HeadPart_Registration.Instance, LegendaryItem_Registration.Instance, @@ -82,6 +85,7 @@ public StarfieldAspectInterfaceMapping() Armor_Registration.Instance, Book_Registration.Instance, Class_Registration.Instance, + Container_Registration.Instance, DamageType_Registration.Instance, FaceMorphPhenotype_Registration.Instance, FaceMorphPhenotypeItem_Registration.Instance, @@ -118,6 +122,7 @@ public StarfieldAspectInterfaceMapping() BipedObjectData_Registration.Instance, Book_Registration.Instance, Class_Registration.Instance, + Container_Registration.Instance, DamageType_Registration.Instance, FaceMorphPhenotype_Registration.Instance, FaceMorphPhenotypeItem_Registration.Instance, @@ -168,6 +173,7 @@ public StarfieldAspectInterfaceMapping() Armor_Registration.Instance, Book_Registration.Instance, Class_Registration.Instance, + Container_Registration.Instance, DamageType_Registration.Instance, FaceMorphPhenotype_Registration.Instance, FaceMorphPhenotypeItem_Registration.Instance, @@ -197,6 +203,7 @@ public StarfieldAspectInterfaceMapping() Armor_Registration.Instance, Book_Registration.Instance, Class_Registration.Instance, + Container_Registration.Instance, DamageType_Registration.Instance, FaceMorphPhenotype_Registration.Instance, FaceMorphPhenotypeItem_Registration.Instance, @@ -226,6 +233,7 @@ public StarfieldAspectInterfaceMapping() Armor_Registration.Instance, AudioOcclusionPrimitive_Registration.Instance, Book_Registration.Instance, + Container_Registration.Instance, LeveledItem_Registration.Instance, MiscItem_Registration.Instance, ObjectEffect_Registration.Instance, @@ -255,6 +263,7 @@ public StarfieldAspectInterfaceMapping() Activator_Registration.Instance, Armor_Registration.Instance, Book_Registration.Instance, + Container_Registration.Instance, LeveledItem_Registration.Instance, MagicEffect_Registration.Instance, MiscItem_Registration.Instance, diff --git a/Mutagen.Bethesda.Starfield/Mutagen.Bethesda.Starfield.csproj b/Mutagen.Bethesda.Starfield/Mutagen.Bethesda.Starfield.csproj index 1358652ce0..11d6c390cf 100644 --- a/Mutagen.Bethesda.Starfield/Mutagen.Bethesda.Starfield.csproj +++ b/Mutagen.Bethesda.Starfield/Mutagen.Bethesda.Starfield.csproj @@ -2050,6 +2050,9 @@ ConstructibleObject.xml + + Container.xml + Quest.xml @@ -5349,9 +5352,6 @@ MorphableObject.xml - - Armor.xml - Book.xml @@ -5367,5 +5367,14 @@ Book.xml + + Armor.xml + + + Component.xml + + + Component.xml + \ No newline at end of file diff --git a/Mutagen.Bethesda.Starfield/Records/Common Subrecords/AComponent.cs b/Mutagen.Bethesda.Starfield/Records/Common Subrecords/AComponent.cs index 833b7a5cdf..ab27e87847 100644 --- a/Mutagen.Bethesda.Starfield/Records/Common Subrecords/AComponent.cs +++ b/Mutagen.Bethesda.Starfield/Records/Common Subrecords/AComponent.cs @@ -31,6 +31,7 @@ public enum ComponentType ParticleSystem_Component, BGSLodOwner_Component, BGSSoundTag_Component, + BGSDisplayCase, } public static bool TryCreateFromBinary( @@ -91,6 +92,8 @@ public static AComponent CreateFromBinary( return LodOwnerComponent.CreateFromBinary(frame, translationParams); case ComponentType.BGSSoundTag_Component: return SoundTagComponent.CreateFromBinary(frame, translationParams); + case ComponentType.BGSDisplayCase: + return DisplayCaseComponent.CreateFromBinary(frame, translationParams); default: throw new NotImplementedException(); } @@ -153,6 +156,7 @@ public static partial void WriteBinaryBFCBStringCustom( IParticleSystemComponentGetter _ => AComponent.ComponentType.ParticleSystem_Component, ILodOwnerComponentGetter _ => AComponent.ComponentType.BGSLodOwner_Component, ISoundTagComponentGetter _ => AComponent.ComponentType.BGSSoundTag_Component, + IDisplayCaseComponentGetter _ => AComponent.ComponentType.BGSDisplayCase, _ => throw new NotImplementedException() }; @@ -211,6 +215,8 @@ public static IAComponentGetter AComponentFactory( return LodOwnerComponentBinaryOverlay.LodOwnerComponentFactory(stream, package); case AComponent.ComponentType.BGSSoundTag_Component: return SoundTagComponentBinaryOverlay.SoundTagComponentFactory(stream, package); + case AComponent.ComponentType.BGSDisplayCase: + return DisplayCaseComponentBinaryOverlay.DisplayCaseComponentFactory(stream, package); default: throw new NotImplementedException(); } diff --git a/Mutagen.Bethesda.Starfield/Records/Common Subrecords/AComponent_Generated.cs b/Mutagen.Bethesda.Starfield/Records/Common Subrecords/AComponent_Generated.cs index 371af732e1..e94ac66e94 100644 --- a/Mutagen.Bethesda.Starfield/Records/Common Subrecords/AComponent_Generated.cs +++ b/Mutagen.Bethesda.Starfield/Records/Common Subrecords/AComponent_Generated.cs @@ -41,7 +41,7 @@ namespace Mutagen.Bethesda.Starfield { #region Class /// - /// Implemented by: [AnimationGraphComponent, AttachParentArrayComponent, ActivityTrackerComponent, ScannableComponent, KeywordFormComponent, ObjectWindowFilterComponent, ContactShadowComponent, FullNameComponent, ModelComponent, PlanetModelComponent, HoudiniDataComponent, SkinFormComponent, BodyPartInfoComponent, EffectSequenceComponent, LightAttachmentFormComponent, LightAnimFormComponent, ParticleSystemComponent, LodOwnerComponent, SoundTagComponent] + /// Implemented by: [AnimationGraphComponent, AttachParentArrayComponent, ActivityTrackerComponent, ScannableComponent, KeywordFormComponent, ObjectWindowFilterComponent, ContactShadowComponent, FullNameComponent, ModelComponent, PlanetModelComponent, HoudiniDataComponent, SkinFormComponent, BodyPartInfoComponent, EffectSequenceComponent, LightAttachmentFormComponent, LightAnimFormComponent, ParticleSystemComponent, LodOwnerComponent, SoundTagComponent, DisplayCaseComponent] /// public abstract partial class AComponent : IAComponent, @@ -360,7 +360,7 @@ internal static AComponent GetNew() #region Interface /// - /// Implemented by: [AnimationGraphComponent, AttachParentArrayComponent, ActivityTrackerComponent, ScannableComponent, KeywordFormComponent, ObjectWindowFilterComponent, ContactShadowComponent, FullNameComponent, ModelComponent, PlanetModelComponent, HoudiniDataComponent, SkinFormComponent, BodyPartInfoComponent, EffectSequenceComponent, LightAttachmentFormComponent, LightAnimFormComponent, ParticleSystemComponent, LodOwnerComponent, SoundTagComponent] + /// Implemented by: [AnimationGraphComponent, AttachParentArrayComponent, ActivityTrackerComponent, ScannableComponent, KeywordFormComponent, ObjectWindowFilterComponent, ContactShadowComponent, FullNameComponent, ModelComponent, PlanetModelComponent, HoudiniDataComponent, SkinFormComponent, BodyPartInfoComponent, EffectSequenceComponent, LightAttachmentFormComponent, LightAnimFormComponent, ParticleSystemComponent, LodOwnerComponent, SoundTagComponent, DisplayCaseComponent] /// public partial interface IAComponent : IAComponentGetter, @@ -371,7 +371,7 @@ public partial interface IAComponent : } /// - /// Implemented by: [AnimationGraphComponent, AttachParentArrayComponent, ActivityTrackerComponent, ScannableComponent, KeywordFormComponent, ObjectWindowFilterComponent, ContactShadowComponent, FullNameComponent, ModelComponent, PlanetModelComponent, HoudiniDataComponent, SkinFormComponent, BodyPartInfoComponent, EffectSequenceComponent, LightAttachmentFormComponent, LightAnimFormComponent, ParticleSystemComponent, LodOwnerComponent, SoundTagComponent] + /// Implemented by: [AnimationGraphComponent, AttachParentArrayComponent, ActivityTrackerComponent, ScannableComponent, KeywordFormComponent, ObjectWindowFilterComponent, ContactShadowComponent, FullNameComponent, ModelComponent, PlanetModelComponent, HoudiniDataComponent, SkinFormComponent, BodyPartInfoComponent, EffectSequenceComponent, LightAttachmentFormComponent, LightAnimFormComponent, ParticleSystemComponent, LodOwnerComponent, SoundTagComponent, DisplayCaseComponent] /// public partial interface IAComponentGetter : ILoquiObject, diff --git a/Mutagen.Bethesda.Starfield/Records/Common Subrecords/Component.xml b/Mutagen.Bethesda.Starfield/Records/Common Subrecords/Component.xml index e2776d39e1..c36d126df2 100644 --- a/Mutagen.Bethesda.Starfield/Records/Common Subrecords/Component.xml +++ b/Mutagen.Bethesda.Starfield/Records/Common Subrecords/Component.xml @@ -133,4 +133,20 @@ + + + + + + + + + + + + + + + + diff --git a/Mutagen.Bethesda.Starfield/Records/Common Subrecords/DisplayCaseComponentItem_Generated.cs b/Mutagen.Bethesda.Starfield/Records/Common Subrecords/DisplayCaseComponentItem_Generated.cs new file mode 100644 index 0000000000..c2edfbaad3 --- /dev/null +++ b/Mutagen.Bethesda.Starfield/Records/Common Subrecords/DisplayCaseComponentItem_Generated.cs @@ -0,0 +1,1300 @@ +/* + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Autogenerated by Loqui. Do not manually change. + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +*/ +#region Usings +using Loqui; +using Loqui.Interfaces; +using Loqui.Internal; +using Mutagen.Bethesda.Binary; +using Mutagen.Bethesda.Plugins; +using Mutagen.Bethesda.Plugins.Binary.Headers; +using Mutagen.Bethesda.Plugins.Binary.Overlay; +using Mutagen.Bethesda.Plugins.Binary.Streams; +using Mutagen.Bethesda.Plugins.Binary.Translations; +using Mutagen.Bethesda.Plugins.Cache; +using Mutagen.Bethesda.Plugins.Exceptions; +using Mutagen.Bethesda.Plugins.Internals; +using Mutagen.Bethesda.Plugins.Meta; +using Mutagen.Bethesda.Plugins.Records; +using Mutagen.Bethesda.Plugins.Records.Internals; +using Mutagen.Bethesda.Plugins.Records.Mapping; +using Mutagen.Bethesda.Starfield.Internals; +using Mutagen.Bethesda.Translations.Binary; +using Noggog; +using Noggog.StructuredStrings; +using Noggog.StructuredStrings.CSharp; +using RecordTypeInts = Mutagen.Bethesda.Starfield.Internals.RecordTypeInts; +using RecordTypes = Mutagen.Bethesda.Starfield.Internals.RecordTypes; +using System.Buffers.Binary; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Reactive.Disposables; +using System.Reactive.Linq; +#endregion + +#nullable enable +namespace Mutagen.Bethesda.Starfield +{ + #region Class + public partial class DisplayCaseComponentItem : + IDisplayCaseComponentItem, + IEquatable, + ILoquiObjectSetter + { + #region Ctor + public DisplayCaseComponentItem() + { + CustomCtor(); + } + partial void CustomCtor(); + #endregion + + #region DisplayFilter + private readonly IFormLink _DisplayFilter = new FormLink(); + public IFormLink DisplayFilter + { + get => _DisplayFilter; + set => _DisplayFilter.SetTo(value); + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IFormLinkGetter IDisplayCaseComponentItemGetter.DisplayFilter => this.DisplayFilter; + #endregion + #region Unknown1 + public UInt32 Unknown1 { get; set; } = default; + #endregion + #region Index + public UInt32 Index { get; set; } = default; + #endregion + #region Unknown2 + public UInt32 Unknown2 { get; set; } = default; + #endregion + + #region To String + + public void Print( + StructuredStringBuilder sb, + string? name = null) + { + DisplayCaseComponentItemMixIn.Print( + item: this, + sb: sb, + name: name); + } + + #endregion + + #region Equals and Hash + public override bool Equals(object? obj) + { + if (obj is not IDisplayCaseComponentItemGetter rhs) return false; + return ((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)this).CommonInstance()!).Equals(this, rhs, equalsMask: null); + } + + public bool Equals(IDisplayCaseComponentItemGetter? obj) + { + return ((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)this).CommonInstance()!).Equals(this, obj, equalsMask: null); + } + + public override int GetHashCode() => ((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)this).CommonInstance()!).GetHashCode(this); + + #endregion + + #region Mask + public class Mask : + IEquatable>, + IMask + { + #region Ctors + public Mask(TItem initialValue) + { + this.DisplayFilter = initialValue; + this.Unknown1 = initialValue; + this.Index = initialValue; + this.Unknown2 = initialValue; + } + + public Mask( + TItem DisplayFilter, + TItem Unknown1, + TItem Index, + TItem Unknown2) + { + this.DisplayFilter = DisplayFilter; + this.Unknown1 = Unknown1; + this.Index = Index; + this.Unknown2 = Unknown2; + } + + #pragma warning disable CS8618 + protected Mask() + { + } + #pragma warning restore CS8618 + + #endregion + + #region Members + public TItem DisplayFilter; + public TItem Unknown1; + public TItem Index; + public TItem Unknown2; + #endregion + + #region Equals + public override bool Equals(object? obj) + { + if (!(obj is Mask rhs)) return false; + return Equals(rhs); + } + + public bool Equals(Mask? rhs) + { + if (rhs == null) return false; + if (!object.Equals(this.DisplayFilter, rhs.DisplayFilter)) return false; + if (!object.Equals(this.Unknown1, rhs.Unknown1)) return false; + if (!object.Equals(this.Index, rhs.Index)) return false; + if (!object.Equals(this.Unknown2, rhs.Unknown2)) return false; + return true; + } + public override int GetHashCode() + { + var hash = new HashCode(); + hash.Add(this.DisplayFilter); + hash.Add(this.Unknown1); + hash.Add(this.Index); + hash.Add(this.Unknown2); + return hash.ToHashCode(); + } + + #endregion + + #region All + public bool All(Func eval) + { + if (!eval(this.DisplayFilter)) return false; + if (!eval(this.Unknown1)) return false; + if (!eval(this.Index)) return false; + if (!eval(this.Unknown2)) return false; + return true; + } + #endregion + + #region Any + public bool Any(Func eval) + { + if (eval(this.DisplayFilter)) return true; + if (eval(this.Unknown1)) return true; + if (eval(this.Index)) return true; + if (eval(this.Unknown2)) return true; + return false; + } + #endregion + + #region Translate + public Mask Translate(Func eval) + { + var ret = new DisplayCaseComponentItem.Mask(); + this.Translate_InternalFill(ret, eval); + return ret; + } + + protected void Translate_InternalFill(Mask obj, Func eval) + { + obj.DisplayFilter = eval(this.DisplayFilter); + obj.Unknown1 = eval(this.Unknown1); + obj.Index = eval(this.Index); + obj.Unknown2 = eval(this.Unknown2); + } + #endregion + + #region To String + public override string ToString() => this.Print(); + + public string Print(DisplayCaseComponentItem.Mask? printMask = null) + { + var sb = new StructuredStringBuilder(); + Print(sb, printMask); + return sb.ToString(); + } + + public void Print(StructuredStringBuilder sb, DisplayCaseComponentItem.Mask? printMask = null) + { + sb.AppendLine($"{nameof(DisplayCaseComponentItem.Mask)} =>"); + using (sb.Brace()) + { + if (printMask?.DisplayFilter ?? true) + { + sb.AppendItem(DisplayFilter, "DisplayFilter"); + } + if (printMask?.Unknown1 ?? true) + { + sb.AppendItem(Unknown1, "Unknown1"); + } + if (printMask?.Index ?? true) + { + sb.AppendItem(Index, "Index"); + } + if (printMask?.Unknown2 ?? true) + { + sb.AppendItem(Unknown2, "Unknown2"); + } + } + } + #endregion + + } + + public class ErrorMask : + IErrorMask, + IErrorMask + { + #region Members + public Exception? Overall { get; set; } + private List? _warnings; + public List Warnings + { + get + { + if (_warnings == null) + { + _warnings = new List(); + } + return _warnings; + } + } + public Exception? DisplayFilter; + public Exception? Unknown1; + public Exception? Index; + public Exception? Unknown2; + #endregion + + #region IErrorMask + public object? GetNthMask(int index) + { + DisplayCaseComponentItem_FieldIndex enu = (DisplayCaseComponentItem_FieldIndex)index; + switch (enu) + { + case DisplayCaseComponentItem_FieldIndex.DisplayFilter: + return DisplayFilter; + case DisplayCaseComponentItem_FieldIndex.Unknown1: + return Unknown1; + case DisplayCaseComponentItem_FieldIndex.Index: + return Index; + case DisplayCaseComponentItem_FieldIndex.Unknown2: + return Unknown2; + default: + throw new ArgumentException($"Index is out of range: {index}"); + } + } + + public void SetNthException(int index, Exception ex) + { + DisplayCaseComponentItem_FieldIndex enu = (DisplayCaseComponentItem_FieldIndex)index; + switch (enu) + { + case DisplayCaseComponentItem_FieldIndex.DisplayFilter: + this.DisplayFilter = ex; + break; + case DisplayCaseComponentItem_FieldIndex.Unknown1: + this.Unknown1 = ex; + break; + case DisplayCaseComponentItem_FieldIndex.Index: + this.Index = ex; + break; + case DisplayCaseComponentItem_FieldIndex.Unknown2: + this.Unknown2 = ex; + break; + default: + throw new ArgumentException($"Index is out of range: {index}"); + } + } + + public void SetNthMask(int index, object obj) + { + DisplayCaseComponentItem_FieldIndex enu = (DisplayCaseComponentItem_FieldIndex)index; + switch (enu) + { + case DisplayCaseComponentItem_FieldIndex.DisplayFilter: + this.DisplayFilter = (Exception?)obj; + break; + case DisplayCaseComponentItem_FieldIndex.Unknown1: + this.Unknown1 = (Exception?)obj; + break; + case DisplayCaseComponentItem_FieldIndex.Index: + this.Index = (Exception?)obj; + break; + case DisplayCaseComponentItem_FieldIndex.Unknown2: + this.Unknown2 = (Exception?)obj; + break; + default: + throw new ArgumentException($"Index is out of range: {index}"); + } + } + + public bool IsInError() + { + if (Overall != null) return true; + if (DisplayFilter != null) return true; + if (Unknown1 != null) return true; + if (Index != null) return true; + if (Unknown2 != null) return true; + return false; + } + #endregion + + #region To String + public override string ToString() => this.Print(); + + public void Print(StructuredStringBuilder sb, string? name = null) + { + sb.AppendLine($"{(name ?? "ErrorMask")} =>"); + using (sb.Brace()) + { + if (this.Overall != null) + { + sb.AppendLine("Overall =>"); + using (sb.Brace()) + { + sb.AppendLine($"{this.Overall}"); + } + } + PrintFillInternal(sb); + } + } + protected void PrintFillInternal(StructuredStringBuilder sb) + { + { + sb.AppendItem(DisplayFilter, "DisplayFilter"); + } + { + sb.AppendItem(Unknown1, "Unknown1"); + } + { + sb.AppendItem(Index, "Index"); + } + { + sb.AppendItem(Unknown2, "Unknown2"); + } + } + #endregion + + #region Combine + public ErrorMask Combine(ErrorMask? rhs) + { + if (rhs == null) return this; + var ret = new ErrorMask(); + ret.DisplayFilter = this.DisplayFilter.Combine(rhs.DisplayFilter); + ret.Unknown1 = this.Unknown1.Combine(rhs.Unknown1); + ret.Index = this.Index.Combine(rhs.Index); + ret.Unknown2 = this.Unknown2.Combine(rhs.Unknown2); + return ret; + } + public static ErrorMask? Combine(ErrorMask? lhs, ErrorMask? rhs) + { + if (lhs != null && rhs != null) return lhs.Combine(rhs); + return lhs ?? rhs; + } + #endregion + + #region Factory + public static ErrorMask Factory(ErrorMaskBuilder errorMask) + { + return new ErrorMask(); + } + #endregion + + } + public class TranslationMask : ITranslationMask + { + #region Members + private TranslationCrystal? _crystal; + public readonly bool DefaultOn; + public bool OnOverall; + public bool DisplayFilter; + public bool Unknown1; + public bool Index; + public bool Unknown2; + #endregion + + #region Ctors + public TranslationMask( + bool defaultOn, + bool onOverall = true) + { + this.DefaultOn = defaultOn; + this.OnOverall = onOverall; + this.DisplayFilter = defaultOn; + this.Unknown1 = defaultOn; + this.Index = defaultOn; + this.Unknown2 = defaultOn; + } + + #endregion + + public TranslationCrystal GetCrystal() + { + if (_crystal != null) return _crystal; + var ret = new List<(bool On, TranslationCrystal? SubCrystal)>(); + GetCrystal(ret); + _crystal = new TranslationCrystal(ret.ToArray()); + return _crystal; + } + + protected void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)> ret) + { + ret.Add((DisplayFilter, null)); + ret.Add((Unknown1, null)); + ret.Add((Index, null)); + ret.Add((Unknown2, null)); + } + + public static implicit operator TranslationMask(bool defaultOn) + { + return new TranslationMask(defaultOn: defaultOn, onOverall: defaultOn); + } + + } + #endregion + + #region Mutagen + public IEnumerable EnumerateFormLinks() => DisplayCaseComponentItemCommon.Instance.EnumerateFormLinks(this); + public void RemapLinks(IReadOnlyDictionary mapping) => DisplayCaseComponentItemSetterCommon.Instance.RemapLinks(this, mapping); + #endregion + + #region Binary Translation + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + protected object BinaryWriteTranslator => DisplayCaseComponentItemBinaryWriteTranslation.Instance; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + object IBinaryItem.BinaryWriteTranslator => this.BinaryWriteTranslator; + void IBinaryItem.WriteToBinary( + MutagenWriter writer, + TypedWriteParams translationParams = default) + { + ((DisplayCaseComponentItemBinaryWriteTranslation)this.BinaryWriteTranslator).Write( + item: this, + writer: writer, + translationParams: translationParams); + } + #region Binary Create + public static DisplayCaseComponentItem CreateFromBinary( + MutagenFrame frame, + TypedParseParams translationParams = default) + { + var ret = new DisplayCaseComponentItem(); + ((DisplayCaseComponentItemSetterCommon)((IDisplayCaseComponentItemGetter)ret).CommonSetterInstance()!).CopyInFromBinary( + item: ret, + frame: frame, + translationParams: translationParams); + return ret; + } + + #endregion + + public static bool TryCreateFromBinary( + MutagenFrame frame, + out DisplayCaseComponentItem item, + TypedParseParams translationParams = default) + { + var startPos = frame.Position; + item = CreateFromBinary( + frame: frame, + translationParams: translationParams); + return startPos != frame.Position; + } + #endregion + + void IPrintable.Print(StructuredStringBuilder sb, string? name) => this.Print(sb, name); + + void IClearable.Clear() + { + ((DisplayCaseComponentItemSetterCommon)((IDisplayCaseComponentItemGetter)this).CommonSetterInstance()!).Clear(this); + } + + internal static DisplayCaseComponentItem GetNew() + { + return new DisplayCaseComponentItem(); + } + + } + #endregion + + #region Interface + public partial interface IDisplayCaseComponentItem : + IDisplayCaseComponentItemGetter, + IFormLinkContainer, + ILoquiObjectSetter + { + new IFormLink DisplayFilter { get; set; } + new UInt32 Unknown1 { get; set; } + new UInt32 Index { get; set; } + new UInt32 Unknown2 { get; set; } + } + + public partial interface IDisplayCaseComponentItemGetter : + ILoquiObject, + IBinaryItem, + IFormLinkContainerGetter, + ILoquiObject + { + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + object CommonInstance(); + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + object? CommonSetterInstance(); + [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)] + object CommonSetterTranslationInstance(); + static ILoquiRegistration StaticRegistration => DisplayCaseComponentItem_Registration.Instance; + IFormLinkGetter DisplayFilter { get; } + UInt32 Unknown1 { get; } + UInt32 Index { get; } + UInt32 Unknown2 { get; } + + } + + #endregion + + #region Common MixIn + public static partial class DisplayCaseComponentItemMixIn + { + public static void Clear(this IDisplayCaseComponentItem item) + { + ((DisplayCaseComponentItemSetterCommon)((IDisplayCaseComponentItemGetter)item).CommonSetterInstance()!).Clear(item: item); + } + + public static DisplayCaseComponentItem.Mask GetEqualsMask( + this IDisplayCaseComponentItemGetter item, + IDisplayCaseComponentItemGetter rhs, + EqualsMaskHelper.Include include = EqualsMaskHelper.Include.All) + { + return ((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)item).CommonInstance()!).GetEqualsMask( + item: item, + rhs: rhs, + include: include); + } + + public static string Print( + this IDisplayCaseComponentItemGetter item, + string? name = null, + DisplayCaseComponentItem.Mask? printMask = null) + { + return ((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)item).CommonInstance()!).Print( + item: item, + name: name, + printMask: printMask); + } + + public static void Print( + this IDisplayCaseComponentItemGetter item, + StructuredStringBuilder sb, + string? name = null, + DisplayCaseComponentItem.Mask? printMask = null) + { + ((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)item).CommonInstance()!).Print( + item: item, + sb: sb, + name: name, + printMask: printMask); + } + + public static bool Equals( + this IDisplayCaseComponentItemGetter item, + IDisplayCaseComponentItemGetter rhs, + DisplayCaseComponentItem.TranslationMask? equalsMask = null) + { + return ((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)item).CommonInstance()!).Equals( + lhs: item, + rhs: rhs, + equalsMask: equalsMask?.GetCrystal()); + } + + public static void DeepCopyIn( + this IDisplayCaseComponentItem lhs, + IDisplayCaseComponentItemGetter rhs) + { + ((DisplayCaseComponentItemSetterTranslationCommon)((IDisplayCaseComponentItemGetter)lhs).CommonSetterTranslationInstance()!).DeepCopyIn( + item: lhs, + rhs: rhs, + errorMask: default, + copyMask: default, + deepCopy: false); + } + + public static void DeepCopyIn( + this IDisplayCaseComponentItem lhs, + IDisplayCaseComponentItemGetter rhs, + DisplayCaseComponentItem.TranslationMask? copyMask = null) + { + ((DisplayCaseComponentItemSetterTranslationCommon)((IDisplayCaseComponentItemGetter)lhs).CommonSetterTranslationInstance()!).DeepCopyIn( + item: lhs, + rhs: rhs, + errorMask: default, + copyMask: copyMask?.GetCrystal(), + deepCopy: false); + } + + public static void DeepCopyIn( + this IDisplayCaseComponentItem lhs, + IDisplayCaseComponentItemGetter rhs, + out DisplayCaseComponentItem.ErrorMask errorMask, + DisplayCaseComponentItem.TranslationMask? copyMask = null) + { + var errorMaskBuilder = new ErrorMaskBuilder(); + ((DisplayCaseComponentItemSetterTranslationCommon)((IDisplayCaseComponentItemGetter)lhs).CommonSetterTranslationInstance()!).DeepCopyIn( + item: lhs, + rhs: rhs, + errorMask: errorMaskBuilder, + copyMask: copyMask?.GetCrystal(), + deepCopy: false); + errorMask = DisplayCaseComponentItem.ErrorMask.Factory(errorMaskBuilder); + } + + public static void DeepCopyIn( + this IDisplayCaseComponentItem lhs, + IDisplayCaseComponentItemGetter rhs, + ErrorMaskBuilder? errorMask, + TranslationCrystal? copyMask) + { + ((DisplayCaseComponentItemSetterTranslationCommon)((IDisplayCaseComponentItemGetter)lhs).CommonSetterTranslationInstance()!).DeepCopyIn( + item: lhs, + rhs: rhs, + errorMask: errorMask, + copyMask: copyMask, + deepCopy: false); + } + + public static DisplayCaseComponentItem DeepCopy( + this IDisplayCaseComponentItemGetter item, + DisplayCaseComponentItem.TranslationMask? copyMask = null) + { + return ((DisplayCaseComponentItemSetterTranslationCommon)((IDisplayCaseComponentItemGetter)item).CommonSetterTranslationInstance()!).DeepCopy( + item: item, + copyMask: copyMask); + } + + public static DisplayCaseComponentItem DeepCopy( + this IDisplayCaseComponentItemGetter item, + out DisplayCaseComponentItem.ErrorMask errorMask, + DisplayCaseComponentItem.TranslationMask? copyMask = null) + { + return ((DisplayCaseComponentItemSetterTranslationCommon)((IDisplayCaseComponentItemGetter)item).CommonSetterTranslationInstance()!).DeepCopy( + item: item, + copyMask: copyMask, + errorMask: out errorMask); + } + + public static DisplayCaseComponentItem DeepCopy( + this IDisplayCaseComponentItemGetter item, + ErrorMaskBuilder? errorMask, + TranslationCrystal? copyMask = null) + { + return ((DisplayCaseComponentItemSetterTranslationCommon)((IDisplayCaseComponentItemGetter)item).CommonSetterTranslationInstance()!).DeepCopy( + item: item, + copyMask: copyMask, + errorMask: errorMask); + } + + #region Binary Translation + public static void CopyInFromBinary( + this IDisplayCaseComponentItem item, + MutagenFrame frame, + TypedParseParams translationParams = default) + { + ((DisplayCaseComponentItemSetterCommon)((IDisplayCaseComponentItemGetter)item).CommonSetterInstance()!).CopyInFromBinary( + item: item, + frame: frame, + translationParams: translationParams); + } + + #endregion + + } + #endregion + +} + +namespace Mutagen.Bethesda.Starfield +{ + #region Field Index + internal enum DisplayCaseComponentItem_FieldIndex + { + DisplayFilter = 0, + Unknown1 = 1, + Index = 2, + Unknown2 = 3, + } + #endregion + + #region Registration + internal partial class DisplayCaseComponentItem_Registration : ILoquiRegistration + { + public static readonly DisplayCaseComponentItem_Registration Instance = new DisplayCaseComponentItem_Registration(); + + public static ProtocolKey ProtocolKey => ProtocolDefinition_Starfield.ProtocolKey; + + public const ushort AdditionalFieldCount = 4; + + public const ushort FieldCount = 4; + + public static readonly Type MaskType = typeof(DisplayCaseComponentItem.Mask<>); + + public static readonly Type ErrorMaskType = typeof(DisplayCaseComponentItem.ErrorMask); + + public static readonly Type ClassType = typeof(DisplayCaseComponentItem); + + public static readonly Type GetterType = typeof(IDisplayCaseComponentItemGetter); + + public static readonly Type? InternalGetterType = null; + + public static readonly Type SetterType = typeof(IDisplayCaseComponentItem); + + public static readonly Type? InternalSetterType = null; + + public const string FullName = "Mutagen.Bethesda.Starfield.DisplayCaseComponentItem"; + + public const string Name = "DisplayCaseComponentItem"; + + public const string Namespace = "Mutagen.Bethesda.Starfield"; + + public const byte GenericCount = 0; + + public static readonly Type? GenericRegistrationType = null; + + public static readonly Type BinaryWriteTranslation = typeof(DisplayCaseComponentItemBinaryWriteTranslation); + #region Interface + ProtocolKey ILoquiRegistration.ProtocolKey => ProtocolKey; + ushort ILoquiRegistration.FieldCount => FieldCount; + ushort ILoquiRegistration.AdditionalFieldCount => AdditionalFieldCount; + Type ILoquiRegistration.MaskType => MaskType; + Type ILoquiRegistration.ErrorMaskType => ErrorMaskType; + Type ILoquiRegistration.ClassType => ClassType; + Type ILoquiRegistration.SetterType => SetterType; + Type? ILoquiRegistration.InternalSetterType => InternalSetterType; + Type ILoquiRegistration.GetterType => GetterType; + Type? ILoquiRegistration.InternalGetterType => InternalGetterType; + string ILoquiRegistration.FullName => FullName; + string ILoquiRegistration.Name => Name; + string ILoquiRegistration.Namespace => Namespace; + byte ILoquiRegistration.GenericCount => GenericCount; + Type? ILoquiRegistration.GenericRegistrationType => GenericRegistrationType; + ushort? ILoquiRegistration.GetNameIndex(StringCaseAgnostic name) => throw new NotImplementedException(); + bool ILoquiRegistration.GetNthIsEnumerable(ushort index) => throw new NotImplementedException(); + bool ILoquiRegistration.GetNthIsLoqui(ushort index) => throw new NotImplementedException(); + bool ILoquiRegistration.GetNthIsSingleton(ushort index) => throw new NotImplementedException(); + string ILoquiRegistration.GetNthName(ushort index) => throw new NotImplementedException(); + bool ILoquiRegistration.IsNthDerivative(ushort index) => throw new NotImplementedException(); + bool ILoquiRegistration.IsProtected(ushort index) => throw new NotImplementedException(); + Type ILoquiRegistration.GetNthType(ushort index) => throw new NotImplementedException(); + #endregion + + } + #endregion + + #region Common + internal partial class DisplayCaseComponentItemSetterCommon + { + public static readonly DisplayCaseComponentItemSetterCommon Instance = new DisplayCaseComponentItemSetterCommon(); + + partial void ClearPartial(); + + public void Clear(IDisplayCaseComponentItem item) + { + ClearPartial(); + item.DisplayFilter.Clear(); + item.Unknown1 = default; + item.Index = default; + item.Unknown2 = default; + } + + #region Mutagen + public void RemapLinks(IDisplayCaseComponentItem obj, IReadOnlyDictionary mapping) + { + obj.DisplayFilter.Relink(mapping); + } + + #endregion + + #region Binary Translation + public virtual void CopyInFromBinary( + IDisplayCaseComponentItem item, + MutagenFrame frame, + TypedParseParams translationParams) + { + PluginUtilityTranslation.SubrecordParse( + record: item, + frame: frame, + translationParams: translationParams, + fillStructs: DisplayCaseComponentItemBinaryCreateTranslation.FillBinaryStructs); + } + + #endregion + + } + internal partial class DisplayCaseComponentItemCommon + { + public static readonly DisplayCaseComponentItemCommon Instance = new DisplayCaseComponentItemCommon(); + + public DisplayCaseComponentItem.Mask GetEqualsMask( + IDisplayCaseComponentItemGetter item, + IDisplayCaseComponentItemGetter rhs, + EqualsMaskHelper.Include include = EqualsMaskHelper.Include.All) + { + var ret = new DisplayCaseComponentItem.Mask(false); + ((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)item).CommonInstance()!).FillEqualsMask( + item: item, + rhs: rhs, + ret: ret, + include: include); + return ret; + } + + public void FillEqualsMask( + IDisplayCaseComponentItemGetter item, + IDisplayCaseComponentItemGetter rhs, + DisplayCaseComponentItem.Mask ret, + EqualsMaskHelper.Include include = EqualsMaskHelper.Include.All) + { + ret.DisplayFilter = item.DisplayFilter.Equals(rhs.DisplayFilter); + ret.Unknown1 = item.Unknown1 == rhs.Unknown1; + ret.Index = item.Index == rhs.Index; + ret.Unknown2 = item.Unknown2 == rhs.Unknown2; + } + + public string Print( + IDisplayCaseComponentItemGetter item, + string? name = null, + DisplayCaseComponentItem.Mask? printMask = null) + { + var sb = new StructuredStringBuilder(); + Print( + item: item, + sb: sb, + name: name, + printMask: printMask); + return sb.ToString(); + } + + public void Print( + IDisplayCaseComponentItemGetter item, + StructuredStringBuilder sb, + string? name = null, + DisplayCaseComponentItem.Mask? printMask = null) + { + if (name == null) + { + sb.AppendLine($"DisplayCaseComponentItem =>"); + } + else + { + sb.AppendLine($"{name} (DisplayCaseComponentItem) =>"); + } + using (sb.Brace()) + { + ToStringFields( + item: item, + sb: sb, + printMask: printMask); + } + } + + protected static void ToStringFields( + IDisplayCaseComponentItemGetter item, + StructuredStringBuilder sb, + DisplayCaseComponentItem.Mask? printMask = null) + { + if (printMask?.DisplayFilter ?? true) + { + sb.AppendItem(item.DisplayFilter.FormKey, "DisplayFilter"); + } + if (printMask?.Unknown1 ?? true) + { + sb.AppendItem(item.Unknown1, "Unknown1"); + } + if (printMask?.Index ?? true) + { + sb.AppendItem(item.Index, "Index"); + } + if (printMask?.Unknown2 ?? true) + { + sb.AppendItem(item.Unknown2, "Unknown2"); + } + } + + #region Equals and Hash + public virtual bool Equals( + IDisplayCaseComponentItemGetter? lhs, + IDisplayCaseComponentItemGetter? rhs, + TranslationCrystal? equalsMask) + { + if (!EqualsMaskHelper.RefEquality(lhs, rhs, out var isEqual)) return isEqual; + if ((equalsMask?.GetShouldTranslate((int)DisplayCaseComponentItem_FieldIndex.DisplayFilter) ?? true)) + { + if (!lhs.DisplayFilter.Equals(rhs.DisplayFilter)) return false; + } + if ((equalsMask?.GetShouldTranslate((int)DisplayCaseComponentItem_FieldIndex.Unknown1) ?? true)) + { + if (lhs.Unknown1 != rhs.Unknown1) return false; + } + if ((equalsMask?.GetShouldTranslate((int)DisplayCaseComponentItem_FieldIndex.Index) ?? true)) + { + if (lhs.Index != rhs.Index) return false; + } + if ((equalsMask?.GetShouldTranslate((int)DisplayCaseComponentItem_FieldIndex.Unknown2) ?? true)) + { + if (lhs.Unknown2 != rhs.Unknown2) return false; + } + return true; + } + + public virtual int GetHashCode(IDisplayCaseComponentItemGetter item) + { + var hash = new HashCode(); + hash.Add(item.DisplayFilter); + hash.Add(item.Unknown1); + hash.Add(item.Index); + hash.Add(item.Unknown2); + return hash.ToHashCode(); + } + + #endregion + + + public object GetNew() + { + return DisplayCaseComponentItem.GetNew(); + } + + #region Mutagen + public IEnumerable EnumerateFormLinks(IDisplayCaseComponentItemGetter obj) + { + yield return FormLinkInformation.Factory(obj.DisplayFilter); + yield break; + } + + #endregion + + } + internal partial class DisplayCaseComponentItemSetterTranslationCommon + { + public static readonly DisplayCaseComponentItemSetterTranslationCommon Instance = new DisplayCaseComponentItemSetterTranslationCommon(); + + #region DeepCopyIn + public void DeepCopyIn( + IDisplayCaseComponentItem item, + IDisplayCaseComponentItemGetter rhs, + ErrorMaskBuilder? errorMask, + TranslationCrystal? copyMask, + bool deepCopy) + { + if ((copyMask?.GetShouldTranslate((int)DisplayCaseComponentItem_FieldIndex.DisplayFilter) ?? true)) + { + item.DisplayFilter.SetTo(rhs.DisplayFilter.FormKey); + } + if ((copyMask?.GetShouldTranslate((int)DisplayCaseComponentItem_FieldIndex.Unknown1) ?? true)) + { + item.Unknown1 = rhs.Unknown1; + } + if ((copyMask?.GetShouldTranslate((int)DisplayCaseComponentItem_FieldIndex.Index) ?? true)) + { + item.Index = rhs.Index; + } + if ((copyMask?.GetShouldTranslate((int)DisplayCaseComponentItem_FieldIndex.Unknown2) ?? true)) + { + item.Unknown2 = rhs.Unknown2; + } + } + + #endregion + + public DisplayCaseComponentItem DeepCopy( + IDisplayCaseComponentItemGetter item, + DisplayCaseComponentItem.TranslationMask? copyMask = null) + { + DisplayCaseComponentItem ret = (DisplayCaseComponentItem)((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)item).CommonInstance()!).GetNew(); + ((DisplayCaseComponentItemSetterTranslationCommon)((IDisplayCaseComponentItemGetter)ret).CommonSetterTranslationInstance()!).DeepCopyIn( + item: ret, + rhs: item, + errorMask: null, + copyMask: copyMask?.GetCrystal(), + deepCopy: true); + return ret; + } + + public DisplayCaseComponentItem DeepCopy( + IDisplayCaseComponentItemGetter item, + out DisplayCaseComponentItem.ErrorMask errorMask, + DisplayCaseComponentItem.TranslationMask? copyMask = null) + { + var errorMaskBuilder = new ErrorMaskBuilder(); + DisplayCaseComponentItem ret = (DisplayCaseComponentItem)((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)item).CommonInstance()!).GetNew(); + ((DisplayCaseComponentItemSetterTranslationCommon)((IDisplayCaseComponentItemGetter)ret).CommonSetterTranslationInstance()!).DeepCopyIn( + ret, + item, + errorMask: errorMaskBuilder, + copyMask: copyMask?.GetCrystal(), + deepCopy: true); + errorMask = DisplayCaseComponentItem.ErrorMask.Factory(errorMaskBuilder); + return ret; + } + + public DisplayCaseComponentItem DeepCopy( + IDisplayCaseComponentItemGetter item, + ErrorMaskBuilder? errorMask, + TranslationCrystal? copyMask = null) + { + DisplayCaseComponentItem ret = (DisplayCaseComponentItem)((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)item).CommonInstance()!).GetNew(); + ((DisplayCaseComponentItemSetterTranslationCommon)((IDisplayCaseComponentItemGetter)ret).CommonSetterTranslationInstance()!).DeepCopyIn( + item: ret, + rhs: item, + errorMask: errorMask, + copyMask: copyMask, + deepCopy: true); + return ret; + } + + } + #endregion + +} + +namespace Mutagen.Bethesda.Starfield +{ + public partial class DisplayCaseComponentItem + { + #region Common Routing + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ILoquiRegistration ILoquiObject.Registration => DisplayCaseComponentItem_Registration.Instance; + public static ILoquiRegistration StaticRegistration => DisplayCaseComponentItem_Registration.Instance; + [DebuggerStepThrough] + protected object CommonInstance() => DisplayCaseComponentItemCommon.Instance; + [DebuggerStepThrough] + protected object CommonSetterInstance() + { + return DisplayCaseComponentItemSetterCommon.Instance; + } + [DebuggerStepThrough] + protected object CommonSetterTranslationInstance() => DisplayCaseComponentItemSetterTranslationCommon.Instance; + [DebuggerStepThrough] + object IDisplayCaseComponentItemGetter.CommonInstance() => this.CommonInstance(); + [DebuggerStepThrough] + object IDisplayCaseComponentItemGetter.CommonSetterInstance() => this.CommonSetterInstance(); + [DebuggerStepThrough] + object IDisplayCaseComponentItemGetter.CommonSetterTranslationInstance() => this.CommonSetterTranslationInstance(); + + #endregion + + } +} + +#region Modules +#region Binary Translation +namespace Mutagen.Bethesda.Starfield +{ + public partial class DisplayCaseComponentItemBinaryWriteTranslation : IBinaryWriteTranslator + { + public static readonly DisplayCaseComponentItemBinaryWriteTranslation Instance = new(); + + public static void WriteEmbedded( + IDisplayCaseComponentItemGetter item, + MutagenWriter writer) + { + FormLinkBinaryTranslation.Instance.Write( + writer: writer, + item: item.DisplayFilter); + writer.Write(item.Unknown1); + writer.Write(item.Index); + writer.Write(item.Unknown2); + } + + public void Write( + MutagenWriter writer, + IDisplayCaseComponentItemGetter item, + TypedWriteParams translationParams) + { + WriteEmbedded( + item: item, + writer: writer); + } + + public void Write( + MutagenWriter writer, + object item, + TypedWriteParams translationParams = default) + { + Write( + item: (IDisplayCaseComponentItemGetter)item, + writer: writer, + translationParams: translationParams); + } + + } + + internal partial class DisplayCaseComponentItemBinaryCreateTranslation + { + public static readonly DisplayCaseComponentItemBinaryCreateTranslation Instance = new DisplayCaseComponentItemBinaryCreateTranslation(); + + public static void FillBinaryStructs( + IDisplayCaseComponentItem item, + MutagenFrame frame) + { + item.DisplayFilter.SetTo(FormLinkBinaryTranslation.Instance.Parse(reader: frame)); + item.Unknown1 = frame.ReadUInt32(); + item.Index = frame.ReadUInt32(); + item.Unknown2 = frame.ReadUInt32(); + } + + } + +} +namespace Mutagen.Bethesda.Starfield +{ + #region Binary Write Mixins + public static class DisplayCaseComponentItemBinaryTranslationMixIn + { + public static void WriteToBinary( + this IDisplayCaseComponentItemGetter item, + MutagenWriter writer, + TypedWriteParams translationParams = default) + { + ((DisplayCaseComponentItemBinaryWriteTranslation)item.BinaryWriteTranslator).Write( + item: item, + writer: writer, + translationParams: translationParams); + } + + } + #endregion + + +} +namespace Mutagen.Bethesda.Starfield +{ + internal partial class DisplayCaseComponentItemBinaryOverlay : + PluginBinaryOverlay, + IDisplayCaseComponentItemGetter + { + #region Common Routing + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ILoquiRegistration ILoquiObject.Registration => DisplayCaseComponentItem_Registration.Instance; + public static ILoquiRegistration StaticRegistration => DisplayCaseComponentItem_Registration.Instance; + [DebuggerStepThrough] + protected object CommonInstance() => DisplayCaseComponentItemCommon.Instance; + [DebuggerStepThrough] + protected object CommonSetterTranslationInstance() => DisplayCaseComponentItemSetterTranslationCommon.Instance; + [DebuggerStepThrough] + object IDisplayCaseComponentItemGetter.CommonInstance() => this.CommonInstance(); + [DebuggerStepThrough] + object? IDisplayCaseComponentItemGetter.CommonSetterInstance() => null; + [DebuggerStepThrough] + object IDisplayCaseComponentItemGetter.CommonSetterTranslationInstance() => this.CommonSetterTranslationInstance(); + + #endregion + + void IPrintable.Print(StructuredStringBuilder sb, string? name) => this.Print(sb, name); + + public IEnumerable EnumerateFormLinks() => DisplayCaseComponentItemCommon.Instance.EnumerateFormLinks(this); + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + protected object BinaryWriteTranslator => DisplayCaseComponentItemBinaryWriteTranslation.Instance; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + object IBinaryItem.BinaryWriteTranslator => this.BinaryWriteTranslator; + void IBinaryItem.WriteToBinary( + MutagenWriter writer, + TypedWriteParams translationParams = default) + { + ((DisplayCaseComponentItemBinaryWriteTranslation)this.BinaryWriteTranslator).Write( + item: this, + writer: writer, + translationParams: translationParams); + } + + public IFormLinkGetter DisplayFilter => new FormLink(FormKey.Factory(_package.MetaData.MasterReferences!, BinaryPrimitives.ReadUInt32LittleEndian(_structData.Span.Slice(0x0, 0x4)))); + public UInt32 Unknown1 => BinaryPrimitives.ReadUInt32LittleEndian(_structData.Slice(0x4, 0x4)); + public UInt32 Index => BinaryPrimitives.ReadUInt32LittleEndian(_structData.Slice(0x8, 0x4)); + public UInt32 Unknown2 => BinaryPrimitives.ReadUInt32LittleEndian(_structData.Slice(0xC, 0x4)); + partial void CustomFactoryEnd( + OverlayStream stream, + int finalPos, + int offset); + + partial void CustomCtor(); + protected DisplayCaseComponentItemBinaryOverlay( + MemoryPair memoryPair, + BinaryOverlayFactoryPackage package) + : base( + memoryPair: memoryPair, + package: package) + { + this.CustomCtor(); + } + + public static IDisplayCaseComponentItemGetter DisplayCaseComponentItemFactory( + OverlayStream stream, + BinaryOverlayFactoryPackage package, + TypedParseParams translationParams = default) + { + stream = ExtractTypelessSubrecordStructMemory( + stream: stream, + meta: package.MetaData.Constants, + translationParams: translationParams, + length: 0x10, + memoryPair: out var memoryPair, + offset: out var offset); + var ret = new DisplayCaseComponentItemBinaryOverlay( + memoryPair: memoryPair, + package: package); + stream.Position += 0x10; + ret.CustomFactoryEnd( + stream: stream, + finalPos: stream.Length, + offset: offset); + return ret; + } + + public static IDisplayCaseComponentItemGetter DisplayCaseComponentItemFactory( + ReadOnlyMemorySlice slice, + BinaryOverlayFactoryPackage package, + TypedParseParams translationParams = default) + { + return DisplayCaseComponentItemFactory( + stream: new OverlayStream(slice, package), + package: package, + translationParams: translationParams); + } + + #region To String + + public void Print( + StructuredStringBuilder sb, + string? name = null) + { + DisplayCaseComponentItemMixIn.Print( + item: this, + sb: sb, + name: name); + } + + #endregion + + #region Equals and Hash + public override bool Equals(object? obj) + { + if (obj is not IDisplayCaseComponentItemGetter rhs) return false; + return ((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)this).CommonInstance()!).Equals(this, rhs, equalsMask: null); + } + + public bool Equals(IDisplayCaseComponentItemGetter? obj) + { + return ((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)this).CommonInstance()!).Equals(this, obj, equalsMask: null); + } + + public override int GetHashCode() => ((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)this).CommonInstance()!).GetHashCode(this); + + #endregion + + } + +} +#endregion + +#endregion + diff --git a/Mutagen.Bethesda.Starfield/Records/Common Subrecords/DisplayCaseComponent_Generated.cs b/Mutagen.Bethesda.Starfield/Records/Common Subrecords/DisplayCaseComponent_Generated.cs new file mode 100644 index 0000000000..bea44294bf --- /dev/null +++ b/Mutagen.Bethesda.Starfield/Records/Common Subrecords/DisplayCaseComponent_Generated.cs @@ -0,0 +1,1560 @@ +/* + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * + * Autogenerated by Loqui. Do not manually change. + * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * +*/ +#region Usings +using Loqui; +using Loqui.Interfaces; +using Loqui.Internal; +using Mutagen.Bethesda.Binary; +using Mutagen.Bethesda.Plugins; +using Mutagen.Bethesda.Plugins.Binary.Headers; +using Mutagen.Bethesda.Plugins.Binary.Overlay; +using Mutagen.Bethesda.Plugins.Binary.Streams; +using Mutagen.Bethesda.Plugins.Binary.Translations; +using Mutagen.Bethesda.Plugins.Cache; +using Mutagen.Bethesda.Plugins.Exceptions; +using Mutagen.Bethesda.Plugins.Internals; +using Mutagen.Bethesda.Plugins.Meta; +using Mutagen.Bethesda.Plugins.Records; +using Mutagen.Bethesda.Plugins.Records.Internals; +using Mutagen.Bethesda.Plugins.Records.Mapping; +using Mutagen.Bethesda.Starfield; +using Mutagen.Bethesda.Starfield.Internals; +using Mutagen.Bethesda.Translations.Binary; +using Noggog; +using Noggog.StructuredStrings; +using Noggog.StructuredStrings.CSharp; +using RecordTypeInts = Mutagen.Bethesda.Starfield.Internals.RecordTypeInts; +using RecordTypes = Mutagen.Bethesda.Starfield.Internals.RecordTypes; +using System.Buffers.Binary; +using System.Diagnostics; +using System.Diagnostics.CodeAnalysis; +using System.Reactive.Disposables; +using System.Reactive.Linq; +#endregion + +#nullable enable +namespace Mutagen.Bethesda.Starfield +{ + #region Class + public partial class DisplayCaseComponent : + AComponent, + IDisplayCaseComponent, + IEquatable, + ILoquiObjectSetter + { + #region Ctor + public DisplayCaseComponent() + { + CustomCtor(); + } + partial void CustomCtor(); + #endregion + + #region Items + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private ExtendedList? _Items; + public ExtendedList? Items + { + get => this._Items; + set => this._Items = value; + } + #region Interface Members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IReadOnlyList? IDisplayCaseComponentGetter.Items => _Items; + #endregion + + #endregion + #region DCED + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private ExtendedList? _DCED; + public ExtendedList? DCED + { + get => this._DCED; + set => this._DCED = value; + } + #region Interface Members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IReadOnlyList? IDisplayCaseComponentGetter.DCED => _DCED; + #endregion + + #endregion + + #region To String + + public override void Print( + StructuredStringBuilder sb, + string? name = null) + { + DisplayCaseComponentMixIn.Print( + item: this, + sb: sb, + name: name); + } + + #endregion + + #region Equals and Hash + public override bool Equals(object? obj) + { + if (obj is not IDisplayCaseComponentGetter rhs) return false; + return ((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)this).CommonInstance()!).Equals(this, rhs, equalsMask: null); + } + + public bool Equals(IDisplayCaseComponentGetter? obj) + { + return ((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)this).CommonInstance()!).Equals(this, obj, equalsMask: null); + } + + public override int GetHashCode() => ((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)this).CommonInstance()!).GetHashCode(this); + + #endregion + + #region Mask + public new class Mask : + AComponent.Mask, + IEquatable>, + IMask + { + #region Ctors + public Mask(TItem initialValue) + : base(initialValue) + { + this.Items = new MaskItem?>>?>(initialValue, Enumerable.Empty?>>()); + this.DCED = new MaskItem?>(initialValue, Enumerable.Empty<(int Index, TItem Value)>()); + } + + public Mask( + TItem Items, + TItem DCED) + : base() + { + this.Items = new MaskItem?>>?>(Items, Enumerable.Empty?>>()); + this.DCED = new MaskItem?>(DCED, Enumerable.Empty<(int Index, TItem Value)>()); + } + + #pragma warning disable CS8618 + protected Mask() + { + } + #pragma warning restore CS8618 + + #endregion + + #region Members + public MaskItem?>>?>? Items; + public MaskItem?>? DCED; + #endregion + + #region Equals + public override bool Equals(object? obj) + { + if (!(obj is Mask rhs)) return false; + return Equals(rhs); + } + + public bool Equals(Mask? rhs) + { + if (rhs == null) return false; + if (!base.Equals(rhs)) return false; + if (!object.Equals(this.Items, rhs.Items)) return false; + if (!object.Equals(this.DCED, rhs.DCED)) return false; + return true; + } + public override int GetHashCode() + { + var hash = new HashCode(); + hash.Add(this.Items); + hash.Add(this.DCED); + hash.Add(base.GetHashCode()); + return hash.ToHashCode(); + } + + #endregion + + #region All + public override bool All(Func eval) + { + if (!base.All(eval)) return false; + if (this.Items != null) + { + if (!eval(this.Items.Overall)) return false; + if (this.Items.Specific != null) + { + foreach (var item in this.Items.Specific) + { + if (!eval(item.Overall)) return false; + if (item.Specific != null && !item.Specific.All(eval)) return false; + } + } + } + if (this.DCED != null) + { + if (!eval(this.DCED.Overall)) return false; + if (this.DCED.Specific != null) + { + foreach (var item in this.DCED.Specific) + { + if (!eval(item.Value)) return false; + } + } + } + return true; + } + #endregion + + #region Any + public override bool Any(Func eval) + { + if (base.Any(eval)) return true; + if (this.Items != null) + { + if (eval(this.Items.Overall)) return true; + if (this.Items.Specific != null) + { + foreach (var item in this.Items.Specific) + { + if (!eval(item.Overall)) return false; + if (item.Specific != null && !item.Specific.All(eval)) return false; + } + } + } + if (this.DCED != null) + { + if (eval(this.DCED.Overall)) return true; + if (this.DCED.Specific != null) + { + foreach (var item in this.DCED.Specific) + { + if (!eval(item.Value)) return false; + } + } + } + return false; + } + #endregion + + #region Translate + public new Mask Translate(Func eval) + { + var ret = new DisplayCaseComponent.Mask(); + this.Translate_InternalFill(ret, eval); + return ret; + } + + protected void Translate_InternalFill(Mask obj, Func eval) + { + base.Translate_InternalFill(obj, eval); + if (Items != null) + { + obj.Items = new MaskItem?>>?>(eval(this.Items.Overall), Enumerable.Empty?>>()); + if (Items.Specific != null) + { + var l = new List?>>(); + obj.Items.Specific = l; + foreach (var item in Items.Specific) + { + MaskItemIndexed?>? mask = item == null ? null : new MaskItemIndexed?>(item.Index, eval(item.Overall), item.Specific?.Translate(eval)); + if (mask == null) continue; + l.Add(mask); + } + } + } + if (DCED != null) + { + obj.DCED = new MaskItem?>(eval(this.DCED.Overall), Enumerable.Empty<(int Index, R Value)>()); + if (DCED.Specific != null) + { + var l = new List<(int Index, R Item)>(); + obj.DCED.Specific = l; + foreach (var item in DCED.Specific) + { + R mask = eval(item.Value); + l.Add((item.Index, mask)); + } + } + } + } + #endregion + + #region To String + public override string ToString() => this.Print(); + + public string Print(DisplayCaseComponent.Mask? printMask = null) + { + var sb = new StructuredStringBuilder(); + Print(sb, printMask); + return sb.ToString(); + } + + public void Print(StructuredStringBuilder sb, DisplayCaseComponent.Mask? printMask = null) + { + sb.AppendLine($"{nameof(DisplayCaseComponent.Mask)} =>"); + using (sb.Brace()) + { + if ((printMask?.Items?.Overall ?? true) + && Items is {} ItemsItem) + { + sb.AppendLine("Items =>"); + using (sb.Brace()) + { + sb.AppendItem(ItemsItem.Overall); + if (ItemsItem.Specific != null) + { + foreach (var subItem in ItemsItem.Specific) + { + using (sb.Brace()) + { + subItem?.Print(sb); + } + } + } + } + } + if ((printMask?.DCED?.Overall ?? true) + && DCED is {} DCEDItem) + { + sb.AppendLine("DCED =>"); + using (sb.Brace()) + { + sb.AppendItem(DCEDItem.Overall); + if (DCEDItem.Specific != null) + { + foreach (var subItem in DCEDItem.Specific) + { + using (sb.Brace()) + { + { + sb.AppendItem(subItem); + } + } + } + } + } + } + } + } + #endregion + + } + + public new class ErrorMask : + AComponent.ErrorMask, + IErrorMask + { + #region Members + public MaskItem>?>? Items; + public MaskItem?>? DCED; + #endregion + + #region IErrorMask + public override object? GetNthMask(int index) + { + DisplayCaseComponent_FieldIndex enu = (DisplayCaseComponent_FieldIndex)index; + switch (enu) + { + case DisplayCaseComponent_FieldIndex.Items: + return Items; + case DisplayCaseComponent_FieldIndex.DCED: + return DCED; + default: + return base.GetNthMask(index); + } + } + + public override void SetNthException(int index, Exception ex) + { + DisplayCaseComponent_FieldIndex enu = (DisplayCaseComponent_FieldIndex)index; + switch (enu) + { + case DisplayCaseComponent_FieldIndex.Items: + this.Items = new MaskItem>?>(ex, null); + break; + case DisplayCaseComponent_FieldIndex.DCED: + this.DCED = new MaskItem?>(ex, null); + break; + default: + base.SetNthException(index, ex); + break; + } + } + + public override void SetNthMask(int index, object obj) + { + DisplayCaseComponent_FieldIndex enu = (DisplayCaseComponent_FieldIndex)index; + switch (enu) + { + case DisplayCaseComponent_FieldIndex.Items: + this.Items = (MaskItem>?>)obj; + break; + case DisplayCaseComponent_FieldIndex.DCED: + this.DCED = (MaskItem?>)obj; + break; + default: + base.SetNthMask(index, obj); + break; + } + } + + public override bool IsInError() + { + if (Overall != null) return true; + if (Items != null) return true; + if (DCED != null) return true; + return false; + } + #endregion + + #region To String + public override string ToString() => this.Print(); + + public override void Print(StructuredStringBuilder sb, string? name = null) + { + sb.AppendLine($"{(name ?? "ErrorMask")} =>"); + using (sb.Brace()) + { + if (this.Overall != null) + { + sb.AppendLine("Overall =>"); + using (sb.Brace()) + { + sb.AppendLine($"{this.Overall}"); + } + } + PrintFillInternal(sb); + } + } + protected override void PrintFillInternal(StructuredStringBuilder sb) + { + base.PrintFillInternal(sb); + if (Items is {} ItemsItem) + { + sb.AppendLine("Items =>"); + using (sb.Brace()) + { + sb.AppendItem(ItemsItem.Overall); + if (ItemsItem.Specific != null) + { + foreach (var subItem in ItemsItem.Specific) + { + using (sb.Brace()) + { + subItem?.Print(sb); + } + } + } + } + } + if (DCED is {} DCEDItem) + { + sb.AppendLine("DCED =>"); + using (sb.Brace()) + { + sb.AppendItem(DCEDItem.Overall); + if (DCEDItem.Specific != null) + { + foreach (var subItem in DCEDItem.Specific) + { + using (sb.Brace()) + { + { + sb.AppendItem(subItem); + } + } + } + } + } + } + } + #endregion + + #region Combine + public ErrorMask Combine(ErrorMask? rhs) + { + if (rhs == null) return this; + var ret = new ErrorMask(); + ret.Items = new MaskItem>?>(Noggog.ExceptionExt.Combine(this.Items?.Overall, rhs.Items?.Overall), Noggog.ExceptionExt.Combine(this.Items?.Specific, rhs.Items?.Specific)); + ret.DCED = new MaskItem?>(Noggog.ExceptionExt.Combine(this.DCED?.Overall, rhs.DCED?.Overall), Noggog.ExceptionExt.Combine(this.DCED?.Specific, rhs.DCED?.Specific)); + return ret; + } + public static ErrorMask? Combine(ErrorMask? lhs, ErrorMask? rhs) + { + if (lhs != null && rhs != null) return lhs.Combine(rhs); + return lhs ?? rhs; + } + #endregion + + #region Factory + public static new ErrorMask Factory(ErrorMaskBuilder errorMask) + { + return new ErrorMask(); + } + #endregion + + } + public new class TranslationMask : + AComponent.TranslationMask, + ITranslationMask + { + #region Members + public DisplayCaseComponentItem.TranslationMask? Items; + public bool DCED; + #endregion + + #region Ctors + public TranslationMask( + bool defaultOn, + bool onOverall = true) + : base(defaultOn, onOverall) + { + this.DCED = defaultOn; + } + + #endregion + + protected override void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)> ret) + { + base.GetCrystal(ret); + ret.Add((Items == null ? DefaultOn : !Items.GetCrystal().CopyNothing, Items?.GetCrystal())); + ret.Add((DCED, null)); + } + + public static implicit operator TranslationMask(bool defaultOn) + { + return new TranslationMask(defaultOn: defaultOn, onOverall: defaultOn); + } + + } + #endregion + + #region Mutagen + public override IEnumerable EnumerateFormLinks() => DisplayCaseComponentCommon.Instance.EnumerateFormLinks(this); + public override void RemapLinks(IReadOnlyDictionary mapping) => DisplayCaseComponentSetterCommon.Instance.RemapLinks(this, mapping); + #endregion + + #region Binary Translation + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + protected override object BinaryWriteTranslator => DisplayCaseComponentBinaryWriteTranslation.Instance; + void IBinaryItem.WriteToBinary( + MutagenWriter writer, + TypedWriteParams translationParams = default) + { + ((DisplayCaseComponentBinaryWriteTranslation)this.BinaryWriteTranslator).Write( + item: this, + writer: writer, + translationParams: translationParams); + } + #region Binary Create + public new static DisplayCaseComponent CreateFromBinary( + MutagenFrame frame, + TypedParseParams translationParams = default) + { + var ret = new DisplayCaseComponent(); + ((DisplayCaseComponentSetterCommon)((IDisplayCaseComponentGetter)ret).CommonSetterInstance()!).CopyInFromBinary( + item: ret, + frame: frame, + translationParams: translationParams); + return ret; + } + + #endregion + + public static bool TryCreateFromBinary( + MutagenFrame frame, + out DisplayCaseComponent item, + TypedParseParams translationParams = default) + { + var startPos = frame.Position; + item = CreateFromBinary( + frame: frame, + translationParams: translationParams); + return startPos != frame.Position; + } + #endregion + + void IPrintable.Print(StructuredStringBuilder sb, string? name) => this.Print(sb, name); + + void IClearable.Clear() + { + ((DisplayCaseComponentSetterCommon)((IDisplayCaseComponentGetter)this).CommonSetterInstance()!).Clear(this); + } + + internal static new DisplayCaseComponent GetNew() + { + return new DisplayCaseComponent(); + } + + } + #endregion + + #region Interface + public partial interface IDisplayCaseComponent : + IAComponent, + IDisplayCaseComponentGetter, + IFormLinkContainer, + ILoquiObjectSetter + { + new ExtendedList? Items { get; set; } + new ExtendedList? DCED { get; set; } + } + + public partial interface IDisplayCaseComponentGetter : + IAComponentGetter, + IBinaryItem, + IFormLinkContainerGetter, + ILoquiObject + { + static new ILoquiRegistration StaticRegistration => DisplayCaseComponent_Registration.Instance; + IReadOnlyList? Items { get; } + IReadOnlyList? DCED { get; } + + } + + #endregion + + #region Common MixIn + public static partial class DisplayCaseComponentMixIn + { + public static void Clear(this IDisplayCaseComponent item) + { + ((DisplayCaseComponentSetterCommon)((IDisplayCaseComponentGetter)item).CommonSetterInstance()!).Clear(item: item); + } + + public static DisplayCaseComponent.Mask GetEqualsMask( + this IDisplayCaseComponentGetter item, + IDisplayCaseComponentGetter rhs, + EqualsMaskHelper.Include include = EqualsMaskHelper.Include.All) + { + return ((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)item).CommonInstance()!).GetEqualsMask( + item: item, + rhs: rhs, + include: include); + } + + public static string Print( + this IDisplayCaseComponentGetter item, + string? name = null, + DisplayCaseComponent.Mask? printMask = null) + { + return ((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)item).CommonInstance()!).Print( + item: item, + name: name, + printMask: printMask); + } + + public static void Print( + this IDisplayCaseComponentGetter item, + StructuredStringBuilder sb, + string? name = null, + DisplayCaseComponent.Mask? printMask = null) + { + ((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)item).CommonInstance()!).Print( + item: item, + sb: sb, + name: name, + printMask: printMask); + } + + public static bool Equals( + this IDisplayCaseComponentGetter item, + IDisplayCaseComponentGetter rhs, + DisplayCaseComponent.TranslationMask? equalsMask = null) + { + return ((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)item).CommonInstance()!).Equals( + lhs: item, + rhs: rhs, + equalsMask: equalsMask?.GetCrystal()); + } + + public static void DeepCopyIn( + this IDisplayCaseComponent lhs, + IDisplayCaseComponentGetter rhs, + out DisplayCaseComponent.ErrorMask errorMask, + DisplayCaseComponent.TranslationMask? copyMask = null) + { + var errorMaskBuilder = new ErrorMaskBuilder(); + ((DisplayCaseComponentSetterTranslationCommon)((IDisplayCaseComponentGetter)lhs).CommonSetterTranslationInstance()!).DeepCopyIn( + item: lhs, + rhs: rhs, + errorMask: errorMaskBuilder, + copyMask: copyMask?.GetCrystal(), + deepCopy: false); + errorMask = DisplayCaseComponent.ErrorMask.Factory(errorMaskBuilder); + } + + public static void DeepCopyIn( + this IDisplayCaseComponent lhs, + IDisplayCaseComponentGetter rhs, + ErrorMaskBuilder? errorMask, + TranslationCrystal? copyMask) + { + ((DisplayCaseComponentSetterTranslationCommon)((IDisplayCaseComponentGetter)lhs).CommonSetterTranslationInstance()!).DeepCopyIn( + item: lhs, + rhs: rhs, + errorMask: errorMask, + copyMask: copyMask, + deepCopy: false); + } + + public static DisplayCaseComponent DeepCopy( + this IDisplayCaseComponentGetter item, + DisplayCaseComponent.TranslationMask? copyMask = null) + { + return ((DisplayCaseComponentSetterTranslationCommon)((IDisplayCaseComponentGetter)item).CommonSetterTranslationInstance()!).DeepCopy( + item: item, + copyMask: copyMask); + } + + public static DisplayCaseComponent DeepCopy( + this IDisplayCaseComponentGetter item, + out DisplayCaseComponent.ErrorMask errorMask, + DisplayCaseComponent.TranslationMask? copyMask = null) + { + return ((DisplayCaseComponentSetterTranslationCommon)((IDisplayCaseComponentGetter)item).CommonSetterTranslationInstance()!).DeepCopy( + item: item, + copyMask: copyMask, + errorMask: out errorMask); + } + + public static DisplayCaseComponent DeepCopy( + this IDisplayCaseComponentGetter item, + ErrorMaskBuilder? errorMask, + TranslationCrystal? copyMask = null) + { + return ((DisplayCaseComponentSetterTranslationCommon)((IDisplayCaseComponentGetter)item).CommonSetterTranslationInstance()!).DeepCopy( + item: item, + copyMask: copyMask, + errorMask: errorMask); + } + + #region Binary Translation + public static void CopyInFromBinary( + this IDisplayCaseComponent item, + MutagenFrame frame, + TypedParseParams translationParams = default) + { + ((DisplayCaseComponentSetterCommon)((IDisplayCaseComponentGetter)item).CommonSetterInstance()!).CopyInFromBinary( + item: item, + frame: frame, + translationParams: translationParams); + } + + #endregion + + } + #endregion + +} + +namespace Mutagen.Bethesda.Starfield +{ + #region Field Index + internal enum DisplayCaseComponent_FieldIndex + { + Items = 0, + DCED = 1, + } + #endregion + + #region Registration + internal partial class DisplayCaseComponent_Registration : ILoquiRegistration + { + public static readonly DisplayCaseComponent_Registration Instance = new DisplayCaseComponent_Registration(); + + public static ProtocolKey ProtocolKey => ProtocolDefinition_Starfield.ProtocolKey; + + public const ushort AdditionalFieldCount = 2; + + public const ushort FieldCount = 2; + + public static readonly Type MaskType = typeof(DisplayCaseComponent.Mask<>); + + public static readonly Type ErrorMaskType = typeof(DisplayCaseComponent.ErrorMask); + + public static readonly Type ClassType = typeof(DisplayCaseComponent); + + public static readonly Type GetterType = typeof(IDisplayCaseComponentGetter); + + public static readonly Type? InternalGetterType = null; + + public static readonly Type SetterType = typeof(IDisplayCaseComponent); + + public static readonly Type? InternalSetterType = null; + + public const string FullName = "Mutagen.Bethesda.Starfield.DisplayCaseComponent"; + + public const string Name = "DisplayCaseComponent"; + + public const string Namespace = "Mutagen.Bethesda.Starfield"; + + public const byte GenericCount = 0; + + public static readonly Type? GenericRegistrationType = null; + + public static readonly RecordType TriggeringRecordType = RecordTypes.BFCB; + public static RecordTriggerSpecs TriggerSpecs => _recordSpecs.Value; + private static readonly Lazy _recordSpecs = new Lazy(() => + { + var triggers = RecordCollection.Factory(RecordTypes.BFCB); + var all = RecordCollection.Factory( + RecordTypes.BFCB, + RecordTypes.DCSD, + RecordTypes.DCED); + return new RecordTriggerSpecs(allRecordTypes: all, triggeringRecordTypes: triggers); + }); + public static readonly Type BinaryWriteTranslation = typeof(DisplayCaseComponentBinaryWriteTranslation); + #region Interface + ProtocolKey ILoquiRegistration.ProtocolKey => ProtocolKey; + ushort ILoquiRegistration.FieldCount => FieldCount; + ushort ILoquiRegistration.AdditionalFieldCount => AdditionalFieldCount; + Type ILoquiRegistration.MaskType => MaskType; + Type ILoquiRegistration.ErrorMaskType => ErrorMaskType; + Type ILoquiRegistration.ClassType => ClassType; + Type ILoquiRegistration.SetterType => SetterType; + Type? ILoquiRegistration.InternalSetterType => InternalSetterType; + Type ILoquiRegistration.GetterType => GetterType; + Type? ILoquiRegistration.InternalGetterType => InternalGetterType; + string ILoquiRegistration.FullName => FullName; + string ILoquiRegistration.Name => Name; + string ILoquiRegistration.Namespace => Namespace; + byte ILoquiRegistration.GenericCount => GenericCount; + Type? ILoquiRegistration.GenericRegistrationType => GenericRegistrationType; + ushort? ILoquiRegistration.GetNameIndex(StringCaseAgnostic name) => throw new NotImplementedException(); + bool ILoquiRegistration.GetNthIsEnumerable(ushort index) => throw new NotImplementedException(); + bool ILoquiRegistration.GetNthIsLoqui(ushort index) => throw new NotImplementedException(); + bool ILoquiRegistration.GetNthIsSingleton(ushort index) => throw new NotImplementedException(); + string ILoquiRegistration.GetNthName(ushort index) => throw new NotImplementedException(); + bool ILoquiRegistration.IsNthDerivative(ushort index) => throw new NotImplementedException(); + bool ILoquiRegistration.IsProtected(ushort index) => throw new NotImplementedException(); + Type ILoquiRegistration.GetNthType(ushort index) => throw new NotImplementedException(); + #endregion + + } + #endregion + + #region Common + internal partial class DisplayCaseComponentSetterCommon : AComponentSetterCommon + { + public new static readonly DisplayCaseComponentSetterCommon Instance = new DisplayCaseComponentSetterCommon(); + + partial void ClearPartial(); + + public void Clear(IDisplayCaseComponent item) + { + ClearPartial(); + item.Items = null; + item.DCED = null; + base.Clear(item); + } + + public override void Clear(IAComponent item) + { + Clear(item: (IDisplayCaseComponent)item); + } + + #region Mutagen + public void RemapLinks(IDisplayCaseComponent obj, IReadOnlyDictionary mapping) + { + base.RemapLinks(obj, mapping); + obj.Items?.RemapLinks(mapping); + } + + #endregion + + #region Binary Translation + public virtual void CopyInFromBinary( + IDisplayCaseComponent item, + MutagenFrame frame, + TypedParseParams translationParams) + { + PluginUtilityTranslation.SubrecordParse( + record: item, + frame: frame, + translationParams: translationParams, + fillTyped: DisplayCaseComponentBinaryCreateTranslation.FillBinaryRecordTypes); + } + + public override void CopyInFromBinary( + IAComponent item, + MutagenFrame frame, + TypedParseParams translationParams) + { + CopyInFromBinary( + item: (DisplayCaseComponent)item, + frame: frame, + translationParams: translationParams); + } + + #endregion + + } + internal partial class DisplayCaseComponentCommon : AComponentCommon + { + public new static readonly DisplayCaseComponentCommon Instance = new DisplayCaseComponentCommon(); + + public DisplayCaseComponent.Mask GetEqualsMask( + IDisplayCaseComponentGetter item, + IDisplayCaseComponentGetter rhs, + EqualsMaskHelper.Include include = EqualsMaskHelper.Include.All) + { + var ret = new DisplayCaseComponent.Mask(false); + ((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)item).CommonInstance()!).FillEqualsMask( + item: item, + rhs: rhs, + ret: ret, + include: include); + return ret; + } + + public void FillEqualsMask( + IDisplayCaseComponentGetter item, + IDisplayCaseComponentGetter rhs, + DisplayCaseComponent.Mask ret, + EqualsMaskHelper.Include include = EqualsMaskHelper.Include.All) + { + ret.Items = item.Items.CollectionEqualsHelper( + rhs.Items, + (loqLhs, loqRhs) => loqLhs.GetEqualsMask(loqRhs, include), + include); + ret.DCED = item.DCED.CollectionEqualsHelper( + rhs.DCED, + (l, r) => l == r, + include); + base.FillEqualsMask(item, rhs, ret, include); + } + + public string Print( + IDisplayCaseComponentGetter item, + string? name = null, + DisplayCaseComponent.Mask? printMask = null) + { + var sb = new StructuredStringBuilder(); + Print( + item: item, + sb: sb, + name: name, + printMask: printMask); + return sb.ToString(); + } + + public void Print( + IDisplayCaseComponentGetter item, + StructuredStringBuilder sb, + string? name = null, + DisplayCaseComponent.Mask? printMask = null) + { + if (name == null) + { + sb.AppendLine($"DisplayCaseComponent =>"); + } + else + { + sb.AppendLine($"{name} (DisplayCaseComponent) =>"); + } + using (sb.Brace()) + { + ToStringFields( + item: item, + sb: sb, + printMask: printMask); + } + } + + protected static void ToStringFields( + IDisplayCaseComponentGetter item, + StructuredStringBuilder sb, + DisplayCaseComponent.Mask? printMask = null) + { + AComponentCommon.ToStringFields( + item: item, + sb: sb, + printMask: printMask); + if ((printMask?.Items?.Overall ?? true) + && item.Items is {} ItemsItem) + { + sb.AppendLine("Items =>"); + using (sb.Brace()) + { + foreach (var subItem in ItemsItem) + { + using (sb.Brace()) + { + subItem?.Print(sb, "Item"); + } + } + } + } + if ((printMask?.DCED?.Overall ?? true) + && item.DCED is {} DCEDItem) + { + sb.AppendLine("DCED =>"); + using (sb.Brace()) + { + foreach (var subItem in DCEDItem) + { + using (sb.Brace()) + { + sb.AppendItem(subItem); + } + } + } + } + } + + public static DisplayCaseComponent_FieldIndex ConvertFieldIndex(AComponent_FieldIndex index) + { + switch (index) + { + default: + throw new ArgumentException($"Index is out of range: {index.ToStringFast()}"); + } + } + + #region Equals and Hash + public virtual bool Equals( + IDisplayCaseComponentGetter? lhs, + IDisplayCaseComponentGetter? rhs, + TranslationCrystal? equalsMask) + { + if (!EqualsMaskHelper.RefEquality(lhs, rhs, out var isEqual)) return isEqual; + if (!base.Equals((IAComponentGetter)lhs, (IAComponentGetter)rhs, equalsMask)) return false; + if ((equalsMask?.GetShouldTranslate((int)DisplayCaseComponent_FieldIndex.Items) ?? true)) + { + if (!lhs.Items.SequenceEqualNullable(rhs.Items, (l, r) => ((DisplayCaseComponentItemCommon)((IDisplayCaseComponentItemGetter)l).CommonInstance()!).Equals(l, r, equalsMask?.GetSubCrystal((int)DisplayCaseComponent_FieldIndex.Items)))) return false; + } + if ((equalsMask?.GetShouldTranslate((int)DisplayCaseComponent_FieldIndex.DCED) ?? true)) + { + if (!lhs.DCED.SequenceEqualNullable(rhs.DCED)) return false; + } + return true; + } + + public override bool Equals( + IAComponentGetter? lhs, + IAComponentGetter? rhs, + TranslationCrystal? equalsMask) + { + return Equals( + lhs: (IDisplayCaseComponentGetter?)lhs, + rhs: rhs as IDisplayCaseComponentGetter, + equalsMask: equalsMask); + } + + public virtual int GetHashCode(IDisplayCaseComponentGetter item) + { + var hash = new HashCode(); + hash.Add(item.Items); + hash.Add(item.DCED); + hash.Add(base.GetHashCode()); + return hash.ToHashCode(); + } + + public override int GetHashCode(IAComponentGetter item) + { + return GetHashCode(item: (IDisplayCaseComponentGetter)item); + } + + #endregion + + + public override object GetNew() + { + return DisplayCaseComponent.GetNew(); + } + + #region Mutagen + public IEnumerable EnumerateFormLinks(IDisplayCaseComponentGetter obj) + { + foreach (var item in base.EnumerateFormLinks(obj)) + { + yield return item; + } + if (obj.Items is {} ItemsItem) + { + foreach (var item in ItemsItem.SelectMany(f => f.EnumerateFormLinks())) + { + yield return FormLinkInformation.Factory(item); + } + } + yield break; + } + + #endregion + + } + internal partial class DisplayCaseComponentSetterTranslationCommon : AComponentSetterTranslationCommon + { + public new static readonly DisplayCaseComponentSetterTranslationCommon Instance = new DisplayCaseComponentSetterTranslationCommon(); + + #region DeepCopyIn + public void DeepCopyIn( + IDisplayCaseComponent item, + IDisplayCaseComponentGetter rhs, + ErrorMaskBuilder? errorMask, + TranslationCrystal? copyMask, + bool deepCopy) + { + base.DeepCopyIn( + (IAComponent)item, + (IAComponentGetter)rhs, + errorMask, + copyMask, + deepCopy: deepCopy); + if ((copyMask?.GetShouldTranslate((int)DisplayCaseComponent_FieldIndex.Items) ?? true)) + { + errorMask?.PushIndex((int)DisplayCaseComponent_FieldIndex.Items); + try + { + if ((rhs.Items != null)) + { + item.Items = + rhs.Items + .Select(r => + { + return r.DeepCopy( + errorMask: errorMask, + default(TranslationCrystal)); + }) + .ToExtendedList(); + } + else + { + item.Items = null; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)DisplayCaseComponent_FieldIndex.DCED) ?? true)) + { + errorMask?.PushIndex((int)DisplayCaseComponent_FieldIndex.DCED); + try + { + if ((rhs.DCED != null)) + { + item.DCED = + rhs.DCED + .ToExtendedList(); + } + else + { + item.DCED = null; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + } + + + public override void DeepCopyIn( + IAComponent item, + IAComponentGetter rhs, + ErrorMaskBuilder? errorMask, + TranslationCrystal? copyMask, + bool deepCopy) + { + this.DeepCopyIn( + item: (IDisplayCaseComponent)item, + rhs: (IDisplayCaseComponentGetter)rhs, + errorMask: errorMask, + copyMask: copyMask, + deepCopy: deepCopy); + } + + #endregion + + public DisplayCaseComponent DeepCopy( + IDisplayCaseComponentGetter item, + DisplayCaseComponent.TranslationMask? copyMask = null) + { + DisplayCaseComponent ret = (DisplayCaseComponent)((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)item).CommonInstance()!).GetNew(); + ((DisplayCaseComponentSetterTranslationCommon)((IDisplayCaseComponentGetter)ret).CommonSetterTranslationInstance()!).DeepCopyIn( + item: ret, + rhs: item, + errorMask: null, + copyMask: copyMask?.GetCrystal(), + deepCopy: true); + return ret; + } + + public DisplayCaseComponent DeepCopy( + IDisplayCaseComponentGetter item, + out DisplayCaseComponent.ErrorMask errorMask, + DisplayCaseComponent.TranslationMask? copyMask = null) + { + var errorMaskBuilder = new ErrorMaskBuilder(); + DisplayCaseComponent ret = (DisplayCaseComponent)((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)item).CommonInstance()!).GetNew(); + ((DisplayCaseComponentSetterTranslationCommon)((IDisplayCaseComponentGetter)ret).CommonSetterTranslationInstance()!).DeepCopyIn( + ret, + item, + errorMask: errorMaskBuilder, + copyMask: copyMask?.GetCrystal(), + deepCopy: true); + errorMask = DisplayCaseComponent.ErrorMask.Factory(errorMaskBuilder); + return ret; + } + + public DisplayCaseComponent DeepCopy( + IDisplayCaseComponentGetter item, + ErrorMaskBuilder? errorMask, + TranslationCrystal? copyMask = null) + { + DisplayCaseComponent ret = (DisplayCaseComponent)((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)item).CommonInstance()!).GetNew(); + ((DisplayCaseComponentSetterTranslationCommon)((IDisplayCaseComponentGetter)ret).CommonSetterTranslationInstance()!).DeepCopyIn( + item: ret, + rhs: item, + errorMask: errorMask, + copyMask: copyMask, + deepCopy: true); + return ret; + } + + } + #endregion + +} + +namespace Mutagen.Bethesda.Starfield +{ + public partial class DisplayCaseComponent + { + #region Common Routing + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ILoquiRegistration ILoquiObject.Registration => DisplayCaseComponent_Registration.Instance; + public new static ILoquiRegistration StaticRegistration => DisplayCaseComponent_Registration.Instance; + [DebuggerStepThrough] + protected override object CommonInstance() => DisplayCaseComponentCommon.Instance; + [DebuggerStepThrough] + protected override object CommonSetterInstance() + { + return DisplayCaseComponentSetterCommon.Instance; + } + [DebuggerStepThrough] + protected override object CommonSetterTranslationInstance() => DisplayCaseComponentSetterTranslationCommon.Instance; + + #endregion + + } +} + +#region Modules +#region Binary Translation +namespace Mutagen.Bethesda.Starfield +{ + public partial class DisplayCaseComponentBinaryWriteTranslation : + AComponentBinaryWriteTranslation, + IBinaryWriteTranslator + { + public new static readonly DisplayCaseComponentBinaryWriteTranslation Instance = new(); + + public static void WriteRecordTypes( + IDisplayCaseComponentGetter item, + MutagenWriter writer, + TypedWriteParams translationParams) + { + AComponentBinaryWriteTranslation.WriteRecordTypes( + item: item, + writer: writer, + translationParams: translationParams); + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation.Instance.Write( + writer: writer, + items: item.Items, + recordType: translationParams.ConvertToCustom(RecordTypes.DCSD), + transl: (MutagenWriter subWriter, IDisplayCaseComponentItemGetter subItem, TypedWriteParams conv) => + { + var Item = subItem; + ((DisplayCaseComponentItemBinaryWriteTranslation)((IBinaryItem)Item).BinaryWriteTranslator).Write( + item: Item, + writer: subWriter, + translationParams: conv); + }); + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation.Instance.Write( + writer: writer, + items: item.DCED, + recordType: translationParams.ConvertToCustom(RecordTypes.DCED), + transl: UInt32BinaryTranslation.Instance.Write); + } + + public void Write( + MutagenWriter writer, + IDisplayCaseComponentGetter item, + TypedWriteParams translationParams) + { + WriteRecordTypes( + item: item, + writer: writer, + translationParams: translationParams); + using (HeaderExport.Subrecord(writer, RecordTypes.BFCE)) { } // End Marker + } + + public override void Write( + MutagenWriter writer, + object item, + TypedWriteParams translationParams = default) + { + Write( + item: (IDisplayCaseComponentGetter)item, + writer: writer, + translationParams: translationParams); + } + + public override void Write( + MutagenWriter writer, + IAComponentGetter item, + TypedWriteParams translationParams) + { + Write( + item: (IDisplayCaseComponentGetter)item, + writer: writer, + translationParams: translationParams); + } + + } + + internal partial class DisplayCaseComponentBinaryCreateTranslation : AComponentBinaryCreateTranslation + { + public new static readonly DisplayCaseComponentBinaryCreateTranslation Instance = new DisplayCaseComponentBinaryCreateTranslation(); + + public static ParseResult FillBinaryRecordTypes( + IDisplayCaseComponent item, + MutagenFrame frame, + PreviousParse lastParsed, + Dictionary? recordParseCount, + RecordType nextRecordType, + int contentLength, + TypedParseParams translationParams = default) + { + nextRecordType = translationParams.ConvertToStandard(nextRecordType); + switch (nextRecordType.TypeInt) + { + case RecordTypeInts.DCSD: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + item.Items = + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation.Instance.Parse( + reader: frame.SpawnWithLength(contentLength), + transl: DisplayCaseComponentItem.TryCreateFromBinary) + .CastExtendedList(); + return (int)DisplayCaseComponent_FieldIndex.Items; + } + case RecordTypeInts.DCED: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + item.DCED = + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation.Instance.Parse( + reader: frame.SpawnWithLength(contentLength), + transl: UInt32BinaryTranslation.Instance.Parse) + .CastExtendedList(); + return (int)DisplayCaseComponent_FieldIndex.DCED; + } + default: + return AComponentBinaryCreateTranslation.FillBinaryRecordTypes( + item: item, + frame: frame, + lastParsed: lastParsed, + recordParseCount: recordParseCount, + nextRecordType: nextRecordType, + contentLength: contentLength, + translationParams: translationParams.WithNoConverter()); + } + } + + } + +} +namespace Mutagen.Bethesda.Starfield +{ + #region Binary Write Mixins + public static class DisplayCaseComponentBinaryTranslationMixIn + { + } + #endregion + + +} +namespace Mutagen.Bethesda.Starfield +{ + internal partial class DisplayCaseComponentBinaryOverlay : + AComponentBinaryOverlay, + IDisplayCaseComponentGetter + { + #region Common Routing + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ILoquiRegistration ILoquiObject.Registration => DisplayCaseComponent_Registration.Instance; + public new static ILoquiRegistration StaticRegistration => DisplayCaseComponent_Registration.Instance; + [DebuggerStepThrough] + protected override object CommonInstance() => DisplayCaseComponentCommon.Instance; + [DebuggerStepThrough] + protected override object CommonSetterTranslationInstance() => DisplayCaseComponentSetterTranslationCommon.Instance; + + #endregion + + void IPrintable.Print(StructuredStringBuilder sb, string? name) => this.Print(sb, name); + + public override IEnumerable EnumerateFormLinks() => DisplayCaseComponentCommon.Instance.EnumerateFormLinks(this); + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + protected override object BinaryWriteTranslator => DisplayCaseComponentBinaryWriteTranslation.Instance; + void IBinaryItem.WriteToBinary( + MutagenWriter writer, + TypedWriteParams translationParams = default) + { + ((DisplayCaseComponentBinaryWriteTranslation)this.BinaryWriteTranslator).Write( + item: this, + writer: writer, + translationParams: translationParams); + } + + public IReadOnlyList? Items { get; private set; } + public IReadOnlyList? DCED { get; private set; } + partial void CustomFactoryEnd( + OverlayStream stream, + int finalPos, + int offset); + + partial void CustomCtor(); + protected DisplayCaseComponentBinaryOverlay( + MemoryPair memoryPair, + BinaryOverlayFactoryPackage package) + : base( + memoryPair: memoryPair, + package: package) + { + this.CustomCtor(); + } + + public static IDisplayCaseComponentGetter DisplayCaseComponentFactory( + OverlayStream stream, + BinaryOverlayFactoryPackage package, + TypedParseParams translationParams = default) + { + stream = ExtractTypelessSubrecordRecordMemory( + stream: stream, + meta: package.MetaData.Constants, + translationParams: translationParams, + memoryPair: out var memoryPair, + offset: out var offset, + finalPos: out var finalPos); + var ret = new DisplayCaseComponentBinaryOverlay( + memoryPair: memoryPair, + package: package); + ret.FillTypelessSubrecordTypes( + stream: stream, + finalPos: stream.Length, + offset: offset, + translationParams: translationParams, + fill: ret.FillRecordType); + return ret; + } + + public static IDisplayCaseComponentGetter DisplayCaseComponentFactory( + ReadOnlyMemorySlice slice, + BinaryOverlayFactoryPackage package, + TypedParseParams translationParams = default) + { + return DisplayCaseComponentFactory( + stream: new OverlayStream(slice, package), + package: package, + translationParams: translationParams); + } + + public override ParseResult FillRecordType( + OverlayStream stream, + int finalPos, + int offset, + RecordType type, + PreviousParse lastParsed, + Dictionary? recordParseCount, + TypedParseParams translationParams = default) + { + type = translationParams.ConvertToStandard(type); + switch (type.TypeInt) + { + case RecordTypeInts.DCSD: + { + var subMeta = stream.ReadSubrecordHeader(); + var subLen = finalPos - stream.Position; + this.Items = BinaryOverlayList.FactoryByStartIndex( + mem: stream.RemainingMemory.Slice(0, subLen), + package: _package, + itemLength: 16, + getter: (s, p) => DisplayCaseComponentItemBinaryOverlay.DisplayCaseComponentItemFactory(s, p)); + stream.Position += subLen; + return (int)DisplayCaseComponent_FieldIndex.Items; + } + case RecordTypeInts.DCED: + { + var subMeta = stream.ReadSubrecordHeader(); + var subLen = finalPos - stream.Position; + this.DCED = BinaryOverlayList.FactoryByStartIndex( + mem: stream.RemainingMemory.Slice(0, subLen), + package: _package, + itemLength: 4, + getter: (s, p) => BinaryPrimitives.ReadUInt32LittleEndian(s)); + stream.Position += subLen; + return (int)DisplayCaseComponent_FieldIndex.DCED; + } + default: + return base.FillRecordType( + stream: stream, + finalPos: finalPos, + offset: offset, + type: type, + lastParsed: lastParsed, + recordParseCount: recordParseCount, + translationParams: translationParams.WithNoConverter()); + } + } + #region To String + + public override void Print( + StructuredStringBuilder sb, + string? name = null) + { + DisplayCaseComponentMixIn.Print( + item: this, + sb: sb, + name: name); + } + + #endregion + + #region Equals and Hash + public override bool Equals(object? obj) + { + if (obj is not IDisplayCaseComponentGetter rhs) return false; + return ((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)this).CommonInstance()!).Equals(this, rhs, equalsMask: null); + } + + public bool Equals(IDisplayCaseComponentGetter? obj) + { + return ((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)this).CommonInstance()!).Equals(this, obj, equalsMask: null); + } + + public override int GetHashCode() => ((DisplayCaseComponentCommon)((IDisplayCaseComponentGetter)this).CommonInstance()!).GetHashCode(this); + + #endregion + + } + +} +#endregion + +#endregion + diff --git a/Mutagen.Bethesda.Starfield/Records/Major Records/Container.cs b/Mutagen.Bethesda.Starfield/Records/Major Records/Container.cs new file mode 100644 index 0000000000..d232d5084a --- /dev/null +++ b/Mutagen.Bethesda.Starfield/Records/Major Records/Container.cs @@ -0,0 +1,23 @@ +namespace Mutagen.Bethesda.Starfield; + +public partial class Container +{ + [Flags] + public enum MajorFlag + { + HasDistantLod = 0x0000_8000, + RandomAnimStart = 0x0001_0000, + Obstacle = 0x0200_0000, + NavMeshGenerationFilter = 0x0400_0000, + NavMeshGenerationBoundingBox = 0x0800_0000, + NavMeshGenerationGround = 0x4000_0000 + } + + [Flags] + public enum Flag + { + AllowSoundsWhenAnimation = 0x01, + Respawns = 0x02, + ShowOwner = 0x04 + } +} \ No newline at end of file diff --git a/Mutagen.Bethesda.Starfield/Records/Major Records/Container.xml b/Mutagen.Bethesda.Starfield/Records/Major Records/Container.xml index d6c6f4619f..2ac836e145 100644 --- a/Mutagen.Bethesda.Starfield/Records/Major Records/Container.xml +++ b/Mutagen.Bethesda.Starfield/Records/Major Records/Container.xml @@ -1,7 +1,40 @@ - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + IStaticTarget IItem diff --git a/Mutagen.Bethesda.Starfield/Records/Major Records/Container_Generated.cs b/Mutagen.Bethesda.Starfield/Records/Major Records/Container_Generated.cs index 487cb85282..dc265cc310 100644 --- a/Mutagen.Bethesda.Starfield/Records/Major Records/Container_Generated.cs +++ b/Mutagen.Bethesda.Starfield/Records/Major Records/Container_Generated.cs @@ -7,12 +7,16 @@ using Loqui; using Loqui.Interfaces; using Loqui.Internal; +using Mutagen.Bethesda.Assets; using Mutagen.Bethesda.Binary; using Mutagen.Bethesda.Plugins; +using Mutagen.Bethesda.Plugins.Aspects; +using Mutagen.Bethesda.Plugins.Assets; using Mutagen.Bethesda.Plugins.Binary.Headers; using Mutagen.Bethesda.Plugins.Binary.Overlay; using Mutagen.Bethesda.Plugins.Binary.Streams; using Mutagen.Bethesda.Plugins.Binary.Translations; +using Mutagen.Bethesda.Plugins.Cache; using Mutagen.Bethesda.Plugins.Exceptions; using Mutagen.Bethesda.Plugins.Internals; using Mutagen.Bethesda.Plugins.Meta; @@ -23,6 +27,7 @@ using Mutagen.Bethesda.Plugins.Utility; using Mutagen.Bethesda.Starfield; using Mutagen.Bethesda.Starfield.Internals; +using Mutagen.Bethesda.Strings; using Mutagen.Bethesda.Translations.Binary; using Noggog; using Noggog.StructuredStrings; @@ -54,6 +59,304 @@ protected Container() partial void CustomCtor(); #endregion + #region VirtualMachineAdapter + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private VirtualMachineAdapter? _VirtualMachineAdapter; + /// + /// Aspects: IScripted + /// + public VirtualMachineAdapter? VirtualMachineAdapter + { + get => _VirtualMachineAdapter; + set => _VirtualMachineAdapter = value; + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IVirtualMachineAdapterGetter? IContainerGetter.VirtualMachineAdapter => this.VirtualMachineAdapter; + #region Aspects + IAVirtualMachineAdapterGetter? IHaveVirtualMachineAdapterGetter.VirtualMachineAdapter => this.VirtualMachineAdapter; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IVirtualMachineAdapterGetter? IScriptedGetter.VirtualMachineAdapter => this.VirtualMachineAdapter; + #endregion + #endregion + #region ObjectBounds + /// + /// Aspects: IObjectBounded + /// + public ObjectBounds ObjectBounds { get; set; } = new ObjectBounds(); + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IObjectBoundsGetter IContainerGetter.ObjectBounds => ObjectBounds; + #region Aspects + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ObjectBounds? IObjectBoundedOptional.ObjectBounds + { + get => this.ObjectBounds; + set => this.ObjectBounds = value ?? new ObjectBounds(); + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IObjectBoundsGetter IObjectBoundedGetter.ObjectBounds => this.ObjectBounds; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IObjectBoundsGetter? IObjectBoundedOptionalGetter.ObjectBounds => this.ObjectBounds; + #endregion + #endregion + #region ODTY + public Single? ODTY { get; set; } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + Single? IContainerGetter.ODTY => this.ODTY; + #endregion + #region ObjectPlacementDefaults + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private ObjectPlacementDefaults? _ObjectPlacementDefaults; + public ObjectPlacementDefaults? ObjectPlacementDefaults + { + get => _ObjectPlacementDefaults; + set => _ObjectPlacementDefaults = value; + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IObjectPlacementDefaultsGetter? IContainerGetter.ObjectPlacementDefaults => this.ObjectPlacementDefaults; + #endregion + #region XALG + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + protected MemorySlice? _XALG; + public MemorySlice? XALG + { + get => this._XALG; + set => this._XALG = value; + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ReadOnlyMemorySlice? IContainerGetter.XALG => this.XALG; + #endregion + #region Transforms + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private Transforms? _Transforms; + public Transforms? Transforms + { + get => _Transforms; + set => _Transforms = value; + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ITransformsGetter? IContainerGetter.Transforms => this.Transforms; + #endregion + #region SnapTemplate + private readonly IFormLinkNullable _SnapTemplate = new FormLinkNullable(); + public IFormLinkNullable SnapTemplate + { + get => _SnapTemplate; + set => _SnapTemplate.SetTo(value); + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IFormLinkNullableGetter IContainerGetter.SnapTemplate => this.SnapTemplate; + #endregion + #region SnapBehavior + private readonly IFormLinkNullable _SnapBehavior = new FormLinkNullable(); + public IFormLinkNullable SnapBehavior + { + get => _SnapBehavior; + set => _SnapBehavior.SetTo(value); + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IFormLinkNullableGetter IContainerGetter.SnapBehavior => this.SnapBehavior; + #endregion + #region Components + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private ExtendedList _Components = new ExtendedList(); + public ExtendedList Components + { + get => this._Components; + init => this._Components = value; + } + #region Interface Members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IReadOnlyList IContainerGetter.Components => _Components; + #endregion + + #endregion + #region Name + /// + /// Aspects: INamed, INamedRequired, ITranslatedNamed, ITranslatedNamedRequired + /// + public TranslatedString? Name { get; set; } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ITranslatedStringGetter? IContainerGetter.Name => this.Name; + #region Aspects + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + string INamedRequiredGetter.Name => this.Name?.String ?? string.Empty; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + string? INamedGetter.Name => this.Name?.String; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ITranslatedStringGetter? ITranslatedNamedGetter.Name => this.Name; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ITranslatedStringGetter ITranslatedNamedRequiredGetter.Name => this.Name ?? string.Empty; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + string? INamed.Name + { + get => this.Name?.String; + set => this.Name = value; + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + string INamedRequired.Name + { + get => this.Name?.String ?? string.Empty; + set => this.Name = value; + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + TranslatedString ITranslatedNamedRequired.Name + { + get => this.Name ?? string.Empty; + set => this.Name = value; + } + #endregion + #endregion + #region Model + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private Model? _Model; + /// + /// Aspects: IModeled + /// + public Model? Model + { + get => _Model; + set => _Model = value; + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IModelGetter? IContainerGetter.Model => this.Model; + #region Aspects + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IModelGetter? IModeledGetter.Model => this.Model; + #endregion + #endregion + #region Items + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private ExtendedList? _Items; + public ExtendedList? Items + { + get => this._Items; + set => this._Items = value; + } + #region Interface Members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IReadOnlyList? IContainerGetter.Items => _Items; + #endregion + + #endregion + #region Destructible + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private Destructible? _Destructible; + public Destructible? Destructible + { + get => _Destructible; + set => _Destructible = value; + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IDestructibleGetter? IContainerGetter.Destructible => this.Destructible; + #endregion + #region Flags + public Container.Flag Flags { get; set; } = default; + #endregion + #region Keywords + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private ExtendedList>? _Keywords; + /// + /// Aspects: IKeyworded<IKeywordGetter> + /// + public ExtendedList>? Keywords + { + get => this._Keywords; + set => this._Keywords = value; + } + #region Interface Members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IReadOnlyList>? IContainerGetter.Keywords => _Keywords; + #endregion + + #region Aspects + IReadOnlyList>? IKeywordedGetter.Keywords => this.Keywords; + IReadOnlyList>? IKeywordedGetter.Keywords => this.Keywords; + #endregion + #endregion + #region ForcedLocRefTypes + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private ExtendedList>? _ForcedLocRefTypes; + public ExtendedList>? ForcedLocRefTypes + { + get => this._ForcedLocRefTypes; + set => this._ForcedLocRefTypes = value; + } + #region Interface Members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IReadOnlyList>? IContainerGetter.ForcedLocRefTypes => _ForcedLocRefTypes; + #endregion + + #endregion + #region NativeTerminal + private readonly IFormLinkNullable _NativeTerminal = new FormLinkNullable(); + public IFormLinkNullable NativeTerminal + { + get => _NativeTerminal; + set => _NativeTerminal.SetTo(value); + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IFormLinkNullableGetter IContainerGetter.NativeTerminal => this.NativeTerminal; + #endregion + #region Properties + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private ExtendedList? _Properties; + public ExtendedList? Properties + { + get => this._Properties; + set => this._Properties = value; + } + #region Interface Members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IReadOnlyList? IContainerGetter.Properties => _Properties; + #endregion + + #endregion + #region AttachParentSlots + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private ExtendedList>? _AttachParentSlots; + public ExtendedList>? AttachParentSlots + { + get => this._AttachParentSlots; + set => this._AttachParentSlots = value; + } + #region Interface Members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IReadOnlyList>? IContainerGetter.AttachParentSlots => _AttachParentSlots; + #endregion + + #endregion + #region OpenSound + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private SoundReference? _OpenSound; + public SoundReference? OpenSound + { + get => _OpenSound; + set => _OpenSound = value; + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ISoundReferenceGetter? IContainerGetter.OpenSound => this.OpenSound; + #endregion + #region CloseSound + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private SoundReference? _CloseSound; + public SoundReference? CloseSound + { + get => _CloseSound; + set => _CloseSound = value; + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ISoundReferenceGetter? IContainerGetter.CloseSound => this.CloseSound; + #endregion + #region DisplayFilter + private readonly IFormLinkNullable _DisplayFilter = new FormLinkNullable(); + public IFormLinkNullable DisplayFilter + { + get => _DisplayFilter; + set => _DisplayFilter.SetTo(value); + } + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IFormLinkNullableGetter IContainerGetter.DisplayFilter => this.DisplayFilter; + #endregion #region To String @@ -79,6 +382,28 @@ public override void Print( public Mask(TItem initialValue) : base(initialValue) { + this.VirtualMachineAdapter = new MaskItem?>(initialValue, new VirtualMachineAdapter.Mask(initialValue)); + this.ObjectBounds = new MaskItem?>(initialValue, new ObjectBounds.Mask(initialValue)); + this.ODTY = initialValue; + this.ObjectPlacementDefaults = new MaskItem?>(initialValue, new ObjectPlacementDefaults.Mask(initialValue)); + this.XALG = initialValue; + this.Transforms = new MaskItem?>(initialValue, new Transforms.Mask(initialValue)); + this.SnapTemplate = initialValue; + this.SnapBehavior = initialValue; + this.Components = new MaskItem?>>?>(initialValue, Enumerable.Empty?>>()); + this.Name = initialValue; + this.Model = new MaskItem?>(initialValue, new Model.Mask(initialValue)); + this.Items = new MaskItem?>>?>(initialValue, Enumerable.Empty?>>()); + this.Destructible = new MaskItem?>(initialValue, new Destructible.Mask(initialValue)); + this.Flags = initialValue; + this.Keywords = new MaskItem?>(initialValue, Enumerable.Empty<(int Index, TItem Value)>()); + this.ForcedLocRefTypes = new MaskItem?>(initialValue, Enumerable.Empty<(int Index, TItem Value)>()); + this.NativeTerminal = initialValue; + this.Properties = new MaskItem?>>?>(initialValue, Enumerable.Empty?>>()); + this.AttachParentSlots = new MaskItem?>(initialValue, Enumerable.Empty<(int Index, TItem Value)>()); + this.OpenSound = new MaskItem?>(initialValue, new SoundReference.Mask(initialValue)); + this.CloseSound = new MaskItem?>(initialValue, new SoundReference.Mask(initialValue)); + this.DisplayFilter = initialValue; } public Mask( @@ -88,7 +413,29 @@ public Mask( TItem EditorID, TItem FormVersion, TItem Version2, - TItem StarfieldMajorRecordFlags) + TItem StarfieldMajorRecordFlags, + TItem VirtualMachineAdapter, + TItem ObjectBounds, + TItem ODTY, + TItem ObjectPlacementDefaults, + TItem XALG, + TItem Transforms, + TItem SnapTemplate, + TItem SnapBehavior, + TItem Components, + TItem Name, + TItem Model, + TItem Items, + TItem Destructible, + TItem Flags, + TItem Keywords, + TItem ForcedLocRefTypes, + TItem NativeTerminal, + TItem Properties, + TItem AttachParentSlots, + TItem OpenSound, + TItem CloseSound, + TItem DisplayFilter) : base( MajorRecordFlagsRaw: MajorRecordFlagsRaw, FormKey: FormKey, @@ -98,6 +445,28 @@ public Mask( Version2: Version2, StarfieldMajorRecordFlags: StarfieldMajorRecordFlags) { + this.VirtualMachineAdapter = new MaskItem?>(VirtualMachineAdapter, new VirtualMachineAdapter.Mask(VirtualMachineAdapter)); + this.ObjectBounds = new MaskItem?>(ObjectBounds, new ObjectBounds.Mask(ObjectBounds)); + this.ODTY = ODTY; + this.ObjectPlacementDefaults = new MaskItem?>(ObjectPlacementDefaults, new ObjectPlacementDefaults.Mask(ObjectPlacementDefaults)); + this.XALG = XALG; + this.Transforms = new MaskItem?>(Transforms, new Transforms.Mask(Transforms)); + this.SnapTemplate = SnapTemplate; + this.SnapBehavior = SnapBehavior; + this.Components = new MaskItem?>>?>(Components, Enumerable.Empty?>>()); + this.Name = Name; + this.Model = new MaskItem?>(Model, new Model.Mask(Model)); + this.Items = new MaskItem?>>?>(Items, Enumerable.Empty?>>()); + this.Destructible = new MaskItem?>(Destructible, new Destructible.Mask(Destructible)); + this.Flags = Flags; + this.Keywords = new MaskItem?>(Keywords, Enumerable.Empty<(int Index, TItem Value)>()); + this.ForcedLocRefTypes = new MaskItem?>(ForcedLocRefTypes, Enumerable.Empty<(int Index, TItem Value)>()); + this.NativeTerminal = NativeTerminal; + this.Properties = new MaskItem?>>?>(Properties, Enumerable.Empty?>>()); + this.AttachParentSlots = new MaskItem?>(AttachParentSlots, Enumerable.Empty<(int Index, TItem Value)>()); + this.OpenSound = new MaskItem?>(OpenSound, new SoundReference.Mask(OpenSound)); + this.CloseSound = new MaskItem?>(CloseSound, new SoundReference.Mask(CloseSound)); + this.DisplayFilter = DisplayFilter; } #pragma warning disable CS8618 @@ -108,6 +477,31 @@ protected Mask() #endregion + #region Members + public MaskItem?>? VirtualMachineAdapter { get; set; } + public MaskItem?>? ObjectBounds { get; set; } + public TItem ODTY; + public MaskItem?>? ObjectPlacementDefaults { get; set; } + public TItem XALG; + public MaskItem?>? Transforms { get; set; } + public TItem SnapTemplate; + public TItem SnapBehavior; + public MaskItem?>>?>? Components; + public TItem Name; + public MaskItem?>? Model { get; set; } + public MaskItem?>>?>? Items; + public MaskItem?>? Destructible { get; set; } + public TItem Flags; + public MaskItem?>? Keywords; + public MaskItem?>? ForcedLocRefTypes; + public TItem NativeTerminal; + public MaskItem?>>?>? Properties; + public MaskItem?>? AttachParentSlots; + public MaskItem?>? OpenSound { get; set; } + public MaskItem?>? CloseSound { get; set; } + public TItem DisplayFilter; + #endregion + #region Equals public override bool Equals(object? obj) { @@ -119,11 +513,55 @@ public bool Equals(Mask? rhs) { if (rhs == null) return false; if (!base.Equals(rhs)) return false; + if (!object.Equals(this.VirtualMachineAdapter, rhs.VirtualMachineAdapter)) return false; + if (!object.Equals(this.ObjectBounds, rhs.ObjectBounds)) return false; + if (!object.Equals(this.ODTY, rhs.ODTY)) return false; + if (!object.Equals(this.ObjectPlacementDefaults, rhs.ObjectPlacementDefaults)) return false; + if (!object.Equals(this.XALG, rhs.XALG)) return false; + if (!object.Equals(this.Transforms, rhs.Transforms)) return false; + if (!object.Equals(this.SnapTemplate, rhs.SnapTemplate)) return false; + if (!object.Equals(this.SnapBehavior, rhs.SnapBehavior)) return false; + if (!object.Equals(this.Components, rhs.Components)) return false; + if (!object.Equals(this.Name, rhs.Name)) return false; + if (!object.Equals(this.Model, rhs.Model)) return false; + if (!object.Equals(this.Items, rhs.Items)) return false; + if (!object.Equals(this.Destructible, rhs.Destructible)) return false; + if (!object.Equals(this.Flags, rhs.Flags)) return false; + if (!object.Equals(this.Keywords, rhs.Keywords)) return false; + if (!object.Equals(this.ForcedLocRefTypes, rhs.ForcedLocRefTypes)) return false; + if (!object.Equals(this.NativeTerminal, rhs.NativeTerminal)) return false; + if (!object.Equals(this.Properties, rhs.Properties)) return false; + if (!object.Equals(this.AttachParentSlots, rhs.AttachParentSlots)) return false; + if (!object.Equals(this.OpenSound, rhs.OpenSound)) return false; + if (!object.Equals(this.CloseSound, rhs.CloseSound)) return false; + if (!object.Equals(this.DisplayFilter, rhs.DisplayFilter)) return false; return true; } public override int GetHashCode() { var hash = new HashCode(); + hash.Add(this.VirtualMachineAdapter); + hash.Add(this.ObjectBounds); + hash.Add(this.ODTY); + hash.Add(this.ObjectPlacementDefaults); + hash.Add(this.XALG); + hash.Add(this.Transforms); + hash.Add(this.SnapTemplate); + hash.Add(this.SnapBehavior); + hash.Add(this.Components); + hash.Add(this.Name); + hash.Add(this.Model); + hash.Add(this.Items); + hash.Add(this.Destructible); + hash.Add(this.Flags); + hash.Add(this.Keywords); + hash.Add(this.ForcedLocRefTypes); + hash.Add(this.NativeTerminal); + hash.Add(this.Properties); + hash.Add(this.AttachParentSlots); + hash.Add(this.OpenSound); + hash.Add(this.CloseSound); + hash.Add(this.DisplayFilter); hash.Add(base.GetHashCode()); return hash.ToHashCode(); } @@ -134,6 +572,123 @@ public override int GetHashCode() public override bool All(Func eval) { if (!base.All(eval)) return false; + if (VirtualMachineAdapter != null) + { + if (!eval(this.VirtualMachineAdapter.Overall)) return false; + if (this.VirtualMachineAdapter.Specific != null && !this.VirtualMachineAdapter.Specific.All(eval)) return false; + } + if (ObjectBounds != null) + { + if (!eval(this.ObjectBounds.Overall)) return false; + if (this.ObjectBounds.Specific != null && !this.ObjectBounds.Specific.All(eval)) return false; + } + if (!eval(this.ODTY)) return false; + if (ObjectPlacementDefaults != null) + { + if (!eval(this.ObjectPlacementDefaults.Overall)) return false; + if (this.ObjectPlacementDefaults.Specific != null && !this.ObjectPlacementDefaults.Specific.All(eval)) return false; + } + if (!eval(this.XALG)) return false; + if (Transforms != null) + { + if (!eval(this.Transforms.Overall)) return false; + if (this.Transforms.Specific != null && !this.Transforms.Specific.All(eval)) return false; + } + if (!eval(this.SnapTemplate)) return false; + if (!eval(this.SnapBehavior)) return false; + if (this.Components != null) + { + if (!eval(this.Components.Overall)) return false; + if (this.Components.Specific != null) + { + foreach (var item in this.Components.Specific) + { + if (!eval(item.Overall)) return false; + if (item.Specific != null && !item.Specific.All(eval)) return false; + } + } + } + if (!eval(this.Name)) return false; + if (Model != null) + { + if (!eval(this.Model.Overall)) return false; + if (this.Model.Specific != null && !this.Model.Specific.All(eval)) return false; + } + if (this.Items != null) + { + if (!eval(this.Items.Overall)) return false; + if (this.Items.Specific != null) + { + foreach (var item in this.Items.Specific) + { + if (!eval(item.Overall)) return false; + if (item.Specific != null && !item.Specific.All(eval)) return false; + } + } + } + if (Destructible != null) + { + if (!eval(this.Destructible.Overall)) return false; + if (this.Destructible.Specific != null && !this.Destructible.Specific.All(eval)) return false; + } + if (!eval(this.Flags)) return false; + if (this.Keywords != null) + { + if (!eval(this.Keywords.Overall)) return false; + if (this.Keywords.Specific != null) + { + foreach (var item in this.Keywords.Specific) + { + if (!eval(item.Value)) return false; + } + } + } + if (this.ForcedLocRefTypes != null) + { + if (!eval(this.ForcedLocRefTypes.Overall)) return false; + if (this.ForcedLocRefTypes.Specific != null) + { + foreach (var item in this.ForcedLocRefTypes.Specific) + { + if (!eval(item.Value)) return false; + } + } + } + if (!eval(this.NativeTerminal)) return false; + if (this.Properties != null) + { + if (!eval(this.Properties.Overall)) return false; + if (this.Properties.Specific != null) + { + foreach (var item in this.Properties.Specific) + { + if (!eval(item.Overall)) return false; + if (item.Specific != null && !item.Specific.All(eval)) return false; + } + } + } + if (this.AttachParentSlots != null) + { + if (!eval(this.AttachParentSlots.Overall)) return false; + if (this.AttachParentSlots.Specific != null) + { + foreach (var item in this.AttachParentSlots.Specific) + { + if (!eval(item.Value)) return false; + } + } + } + if (OpenSound != null) + { + if (!eval(this.OpenSound.Overall)) return false; + if (this.OpenSound.Specific != null && !this.OpenSound.Specific.All(eval)) return false; + } + if (CloseSound != null) + { + if (!eval(this.CloseSound.Overall)) return false; + if (this.CloseSound.Specific != null && !this.CloseSound.Specific.All(eval)) return false; + } + if (!eval(this.DisplayFilter)) return false; return true; } #endregion @@ -142,6 +697,123 @@ public override bool All(Func eval) public override bool Any(Func eval) { if (base.Any(eval)) return true; + if (VirtualMachineAdapter != null) + { + if (eval(this.VirtualMachineAdapter.Overall)) return true; + if (this.VirtualMachineAdapter.Specific != null && this.VirtualMachineAdapter.Specific.Any(eval)) return true; + } + if (ObjectBounds != null) + { + if (eval(this.ObjectBounds.Overall)) return true; + if (this.ObjectBounds.Specific != null && this.ObjectBounds.Specific.Any(eval)) return true; + } + if (eval(this.ODTY)) return true; + if (ObjectPlacementDefaults != null) + { + if (eval(this.ObjectPlacementDefaults.Overall)) return true; + if (this.ObjectPlacementDefaults.Specific != null && this.ObjectPlacementDefaults.Specific.Any(eval)) return true; + } + if (eval(this.XALG)) return true; + if (Transforms != null) + { + if (eval(this.Transforms.Overall)) return true; + if (this.Transforms.Specific != null && this.Transforms.Specific.Any(eval)) return true; + } + if (eval(this.SnapTemplate)) return true; + if (eval(this.SnapBehavior)) return true; + if (this.Components != null) + { + if (eval(this.Components.Overall)) return true; + if (this.Components.Specific != null) + { + foreach (var item in this.Components.Specific) + { + if (!eval(item.Overall)) return false; + if (item.Specific != null && !item.Specific.All(eval)) return false; + } + } + } + if (eval(this.Name)) return true; + if (Model != null) + { + if (eval(this.Model.Overall)) return true; + if (this.Model.Specific != null && this.Model.Specific.Any(eval)) return true; + } + if (this.Items != null) + { + if (eval(this.Items.Overall)) return true; + if (this.Items.Specific != null) + { + foreach (var item in this.Items.Specific) + { + if (!eval(item.Overall)) return false; + if (item.Specific != null && !item.Specific.All(eval)) return false; + } + } + } + if (Destructible != null) + { + if (eval(this.Destructible.Overall)) return true; + if (this.Destructible.Specific != null && this.Destructible.Specific.Any(eval)) return true; + } + if (eval(this.Flags)) return true; + if (this.Keywords != null) + { + if (eval(this.Keywords.Overall)) return true; + if (this.Keywords.Specific != null) + { + foreach (var item in this.Keywords.Specific) + { + if (!eval(item.Value)) return false; + } + } + } + if (this.ForcedLocRefTypes != null) + { + if (eval(this.ForcedLocRefTypes.Overall)) return true; + if (this.ForcedLocRefTypes.Specific != null) + { + foreach (var item in this.ForcedLocRefTypes.Specific) + { + if (!eval(item.Value)) return false; + } + } + } + if (eval(this.NativeTerminal)) return true; + if (this.Properties != null) + { + if (eval(this.Properties.Overall)) return true; + if (this.Properties.Specific != null) + { + foreach (var item in this.Properties.Specific) + { + if (!eval(item.Overall)) return false; + if (item.Specific != null && !item.Specific.All(eval)) return false; + } + } + } + if (this.AttachParentSlots != null) + { + if (eval(this.AttachParentSlots.Overall)) return true; + if (this.AttachParentSlots.Specific != null) + { + foreach (var item in this.AttachParentSlots.Specific) + { + if (!eval(item.Value)) return false; + } + } + } + if (OpenSound != null) + { + if (eval(this.OpenSound.Overall)) return true; + if (this.OpenSound.Specific != null && this.OpenSound.Specific.Any(eval)) return true; + } + if (CloseSound != null) + { + if (eval(this.CloseSound.Overall)) return true; + if (this.CloseSound.Specific != null && this.CloseSound.Specific.Any(eval)) return true; + } + if (eval(this.DisplayFilter)) return true; return false; } #endregion @@ -157,6 +829,109 @@ public override bool Any(Func eval) protected void Translate_InternalFill(Mask obj, Func eval) { base.Translate_InternalFill(obj, eval); + obj.VirtualMachineAdapter = this.VirtualMachineAdapter == null ? null : new MaskItem?>(eval(this.VirtualMachineAdapter.Overall), this.VirtualMachineAdapter.Specific?.Translate(eval)); + obj.ObjectBounds = this.ObjectBounds == null ? null : new MaskItem?>(eval(this.ObjectBounds.Overall), this.ObjectBounds.Specific?.Translate(eval)); + obj.ODTY = eval(this.ODTY); + obj.ObjectPlacementDefaults = this.ObjectPlacementDefaults == null ? null : new MaskItem?>(eval(this.ObjectPlacementDefaults.Overall), this.ObjectPlacementDefaults.Specific?.Translate(eval)); + obj.XALG = eval(this.XALG); + obj.Transforms = this.Transforms == null ? null : new MaskItem?>(eval(this.Transforms.Overall), this.Transforms.Specific?.Translate(eval)); + obj.SnapTemplate = eval(this.SnapTemplate); + obj.SnapBehavior = eval(this.SnapBehavior); + if (Components != null) + { + obj.Components = new MaskItem?>>?>(eval(this.Components.Overall), Enumerable.Empty?>>()); + if (Components.Specific != null) + { + var l = new List?>>(); + obj.Components.Specific = l; + foreach (var item in Components.Specific) + { + MaskItemIndexed?>? mask = item == null ? null : new MaskItemIndexed?>(item.Index, eval(item.Overall), item.Specific?.Translate(eval)); + if (mask == null) continue; + l.Add(mask); + } + } + } + obj.Name = eval(this.Name); + obj.Model = this.Model == null ? null : new MaskItem?>(eval(this.Model.Overall), this.Model.Specific?.Translate(eval)); + if (Items != null) + { + obj.Items = new MaskItem?>>?>(eval(this.Items.Overall), Enumerable.Empty?>>()); + if (Items.Specific != null) + { + var l = new List?>>(); + obj.Items.Specific = l; + foreach (var item in Items.Specific) + { + MaskItemIndexed?>? mask = item == null ? null : new MaskItemIndexed?>(item.Index, eval(item.Overall), item.Specific?.Translate(eval)); + if (mask == null) continue; + l.Add(mask); + } + } + } + obj.Destructible = this.Destructible == null ? null : new MaskItem?>(eval(this.Destructible.Overall), this.Destructible.Specific?.Translate(eval)); + obj.Flags = eval(this.Flags); + if (Keywords != null) + { + obj.Keywords = new MaskItem?>(eval(this.Keywords.Overall), Enumerable.Empty<(int Index, R Value)>()); + if (Keywords.Specific != null) + { + var l = new List<(int Index, R Item)>(); + obj.Keywords.Specific = l; + foreach (var item in Keywords.Specific) + { + R mask = eval(item.Value); + l.Add((item.Index, mask)); + } + } + } + if (ForcedLocRefTypes != null) + { + obj.ForcedLocRefTypes = new MaskItem?>(eval(this.ForcedLocRefTypes.Overall), Enumerable.Empty<(int Index, R Value)>()); + if (ForcedLocRefTypes.Specific != null) + { + var l = new List<(int Index, R Item)>(); + obj.ForcedLocRefTypes.Specific = l; + foreach (var item in ForcedLocRefTypes.Specific) + { + R mask = eval(item.Value); + l.Add((item.Index, mask)); + } + } + } + obj.NativeTerminal = eval(this.NativeTerminal); + if (Properties != null) + { + obj.Properties = new MaskItem?>>?>(eval(this.Properties.Overall), Enumerable.Empty?>>()); + if (Properties.Specific != null) + { + var l = new List?>>(); + obj.Properties.Specific = l; + foreach (var item in Properties.Specific) + { + MaskItemIndexed?>? mask = item == null ? null : new MaskItemIndexed?>(item.Index, eval(item.Overall), item.Specific?.Translate(eval)); + if (mask == null) continue; + l.Add(mask); + } + } + } + if (AttachParentSlots != null) + { + obj.AttachParentSlots = new MaskItem?>(eval(this.AttachParentSlots.Overall), Enumerable.Empty<(int Index, R Value)>()); + if (AttachParentSlots.Specific != null) + { + var l = new List<(int Index, R Item)>(); + obj.AttachParentSlots.Specific = l; + foreach (var item in AttachParentSlots.Specific) + { + R mask = eval(item.Value); + l.Add((item.Index, mask)); + } + } + } + obj.OpenSound = this.OpenSound == null ? null : new MaskItem?>(eval(this.OpenSound.Overall), this.OpenSound.Specific?.Translate(eval)); + obj.CloseSound = this.CloseSound == null ? null : new MaskItem?>(eval(this.CloseSound.Overall), this.CloseSound.Specific?.Translate(eval)); + obj.DisplayFilter = eval(this.DisplayFilter); } #endregion @@ -175,6 +950,190 @@ public void Print(StructuredStringBuilder sb, Container.Mask? printMask = sb.AppendLine($"{nameof(Container.Mask)} =>"); using (sb.Brace()) { + if (printMask?.VirtualMachineAdapter?.Overall ?? true) + { + VirtualMachineAdapter?.Print(sb); + } + if (printMask?.ObjectBounds?.Overall ?? true) + { + ObjectBounds?.Print(sb); + } + if (printMask?.ODTY ?? true) + { + sb.AppendItem(ODTY, "ODTY"); + } + if (printMask?.ObjectPlacementDefaults?.Overall ?? true) + { + ObjectPlacementDefaults?.Print(sb); + } + if (printMask?.XALG ?? true) + { + sb.AppendItem(XALG, "XALG"); + } + if (printMask?.Transforms?.Overall ?? true) + { + Transforms?.Print(sb); + } + if (printMask?.SnapTemplate ?? true) + { + sb.AppendItem(SnapTemplate, "SnapTemplate"); + } + if (printMask?.SnapBehavior ?? true) + { + sb.AppendItem(SnapBehavior, "SnapBehavior"); + } + if ((printMask?.Components?.Overall ?? true) + && Components is {} ComponentsItem) + { + sb.AppendLine("Components =>"); + using (sb.Brace()) + { + sb.AppendItem(ComponentsItem.Overall); + if (ComponentsItem.Specific != null) + { + foreach (var subItem in ComponentsItem.Specific) + { + using (sb.Brace()) + { + subItem?.Print(sb); + } + } + } + } + } + if (printMask?.Name ?? true) + { + sb.AppendItem(Name, "Name"); + } + if (printMask?.Model?.Overall ?? true) + { + Model?.Print(sb); + } + if ((printMask?.Items?.Overall ?? true) + && Items is {} ItemsItem) + { + sb.AppendLine("Items =>"); + using (sb.Brace()) + { + sb.AppendItem(ItemsItem.Overall); + if (ItemsItem.Specific != null) + { + foreach (var subItem in ItemsItem.Specific) + { + using (sb.Brace()) + { + subItem?.Print(sb); + } + } + } + } + } + if (printMask?.Destructible?.Overall ?? true) + { + Destructible?.Print(sb); + } + if (printMask?.Flags ?? true) + { + sb.AppendItem(Flags, "Flags"); + } + if ((printMask?.Keywords?.Overall ?? true) + && Keywords is {} KeywordsItem) + { + sb.AppendLine("Keywords =>"); + using (sb.Brace()) + { + sb.AppendItem(KeywordsItem.Overall); + if (KeywordsItem.Specific != null) + { + foreach (var subItem in KeywordsItem.Specific) + { + using (sb.Brace()) + { + { + sb.AppendItem(subItem); + } + } + } + } + } + } + if ((printMask?.ForcedLocRefTypes?.Overall ?? true) + && ForcedLocRefTypes is {} ForcedLocRefTypesItem) + { + sb.AppendLine("ForcedLocRefTypes =>"); + using (sb.Brace()) + { + sb.AppendItem(ForcedLocRefTypesItem.Overall); + if (ForcedLocRefTypesItem.Specific != null) + { + foreach (var subItem in ForcedLocRefTypesItem.Specific) + { + using (sb.Brace()) + { + { + sb.AppendItem(subItem); + } + } + } + } + } + } + if (printMask?.NativeTerminal ?? true) + { + sb.AppendItem(NativeTerminal, "NativeTerminal"); + } + if ((printMask?.Properties?.Overall ?? true) + && Properties is {} PropertiesItem) + { + sb.AppendLine("Properties =>"); + using (sb.Brace()) + { + sb.AppendItem(PropertiesItem.Overall); + if (PropertiesItem.Specific != null) + { + foreach (var subItem in PropertiesItem.Specific) + { + using (sb.Brace()) + { + subItem?.Print(sb); + } + } + } + } + } + if ((printMask?.AttachParentSlots?.Overall ?? true) + && AttachParentSlots is {} AttachParentSlotsItem) + { + sb.AppendLine("AttachParentSlots =>"); + using (sb.Brace()) + { + sb.AppendItem(AttachParentSlotsItem.Overall); + if (AttachParentSlotsItem.Specific != null) + { + foreach (var subItem in AttachParentSlotsItem.Specific) + { + using (sb.Brace()) + { + { + sb.AppendItem(subItem); + } + } + } + } + } + } + if (printMask?.OpenSound?.Overall ?? true) + { + OpenSound?.Print(sb); + } + if (printMask?.CloseSound?.Overall ?? true) + { + CloseSound?.Print(sb); + } + if (printMask?.DisplayFilter ?? true) + { + sb.AppendItem(DisplayFilter, "DisplayFilter"); + } } } #endregion @@ -185,12 +1144,81 @@ public void Print(StructuredStringBuilder sb, Container.Mask? printMask = StarfieldMajorRecord.ErrorMask, IErrorMask { + #region Members + public MaskItem? VirtualMachineAdapter; + public MaskItem? ObjectBounds; + public Exception? ODTY; + public MaskItem? ObjectPlacementDefaults; + public Exception? XALG; + public MaskItem? Transforms; + public Exception? SnapTemplate; + public Exception? SnapBehavior; + public MaskItem>?>? Components; + public Exception? Name; + public MaskItem? Model; + public MaskItem>?>? Items; + public MaskItem? Destructible; + public Exception? Flags; + public MaskItem?>? Keywords; + public MaskItem?>? ForcedLocRefTypes; + public Exception? NativeTerminal; + public MaskItem>?>? Properties; + public MaskItem?>? AttachParentSlots; + public MaskItem? OpenSound; + public MaskItem? CloseSound; + public Exception? DisplayFilter; + #endregion + #region IErrorMask public override object? GetNthMask(int index) { Container_FieldIndex enu = (Container_FieldIndex)index; switch (enu) { + case Container_FieldIndex.VirtualMachineAdapter: + return VirtualMachineAdapter; + case Container_FieldIndex.ObjectBounds: + return ObjectBounds; + case Container_FieldIndex.ODTY: + return ODTY; + case Container_FieldIndex.ObjectPlacementDefaults: + return ObjectPlacementDefaults; + case Container_FieldIndex.XALG: + return XALG; + case Container_FieldIndex.Transforms: + return Transforms; + case Container_FieldIndex.SnapTemplate: + return SnapTemplate; + case Container_FieldIndex.SnapBehavior: + return SnapBehavior; + case Container_FieldIndex.Components: + return Components; + case Container_FieldIndex.Name: + return Name; + case Container_FieldIndex.Model: + return Model; + case Container_FieldIndex.Items: + return Items; + case Container_FieldIndex.Destructible: + return Destructible; + case Container_FieldIndex.Flags: + return Flags; + case Container_FieldIndex.Keywords: + return Keywords; + case Container_FieldIndex.ForcedLocRefTypes: + return ForcedLocRefTypes; + case Container_FieldIndex.NativeTerminal: + return NativeTerminal; + case Container_FieldIndex.Properties: + return Properties; + case Container_FieldIndex.AttachParentSlots: + return AttachParentSlots; + case Container_FieldIndex.OpenSound: + return OpenSound; + case Container_FieldIndex.CloseSound: + return CloseSound; + case Container_FieldIndex.DisplayFilter: + return DisplayFilter; default: return base.GetNthMask(index); } @@ -201,52 +1229,352 @@ public override void SetNthException(int index, Exception ex) Container_FieldIndex enu = (Container_FieldIndex)index; switch (enu) { + case Container_FieldIndex.VirtualMachineAdapter: + this.VirtualMachineAdapter = new MaskItem(ex, null); + break; + case Container_FieldIndex.ObjectBounds: + this.ObjectBounds = new MaskItem(ex, null); + break; + case Container_FieldIndex.ODTY: + this.ODTY = ex; + break; + case Container_FieldIndex.ObjectPlacementDefaults: + this.ObjectPlacementDefaults = new MaskItem(ex, null); + break; + case Container_FieldIndex.XALG: + this.XALG = ex; + break; + case Container_FieldIndex.Transforms: + this.Transforms = new MaskItem(ex, null); + break; + case Container_FieldIndex.SnapTemplate: + this.SnapTemplate = ex; + break; + case Container_FieldIndex.SnapBehavior: + this.SnapBehavior = ex; + break; + case Container_FieldIndex.Components: + this.Components = new MaskItem>?>(ex, null); + break; + case Container_FieldIndex.Name: + this.Name = ex; + break; + case Container_FieldIndex.Model: + this.Model = new MaskItem(ex, null); + break; + case Container_FieldIndex.Items: + this.Items = new MaskItem>?>(ex, null); + break; + case Container_FieldIndex.Destructible: + this.Destructible = new MaskItem(ex, null); + break; + case Container_FieldIndex.Flags: + this.Flags = ex; + break; + case Container_FieldIndex.Keywords: + this.Keywords = new MaskItem?>(ex, null); + break; + case Container_FieldIndex.ForcedLocRefTypes: + this.ForcedLocRefTypes = new MaskItem?>(ex, null); + break; + case Container_FieldIndex.NativeTerminal: + this.NativeTerminal = ex; + break; + case Container_FieldIndex.Properties: + this.Properties = new MaskItem>?>(ex, null); + break; + case Container_FieldIndex.AttachParentSlots: + this.AttachParentSlots = new MaskItem?>(ex, null); + break; + case Container_FieldIndex.OpenSound: + this.OpenSound = new MaskItem(ex, null); + break; + case Container_FieldIndex.CloseSound: + this.CloseSound = new MaskItem(ex, null); + break; + case Container_FieldIndex.DisplayFilter: + this.DisplayFilter = ex; + break; default: base.SetNthException(index, ex); break; } - } - - public override void SetNthMask(int index, object obj) - { - Container_FieldIndex enu = (Container_FieldIndex)index; - switch (enu) + } + + public override void SetNthMask(int index, object obj) + { + Container_FieldIndex enu = (Container_FieldIndex)index; + switch (enu) + { + case Container_FieldIndex.VirtualMachineAdapter: + this.VirtualMachineAdapter = (MaskItem?)obj; + break; + case Container_FieldIndex.ObjectBounds: + this.ObjectBounds = (MaskItem?)obj; + break; + case Container_FieldIndex.ODTY: + this.ODTY = (Exception?)obj; + break; + case Container_FieldIndex.ObjectPlacementDefaults: + this.ObjectPlacementDefaults = (MaskItem?)obj; + break; + case Container_FieldIndex.XALG: + this.XALG = (Exception?)obj; + break; + case Container_FieldIndex.Transforms: + this.Transforms = (MaskItem?)obj; + break; + case Container_FieldIndex.SnapTemplate: + this.SnapTemplate = (Exception?)obj; + break; + case Container_FieldIndex.SnapBehavior: + this.SnapBehavior = (Exception?)obj; + break; + case Container_FieldIndex.Components: + this.Components = (MaskItem>?>)obj; + break; + case Container_FieldIndex.Name: + this.Name = (Exception?)obj; + break; + case Container_FieldIndex.Model: + this.Model = (MaskItem?)obj; + break; + case Container_FieldIndex.Items: + this.Items = (MaskItem>?>)obj; + break; + case Container_FieldIndex.Destructible: + this.Destructible = (MaskItem?)obj; + break; + case Container_FieldIndex.Flags: + this.Flags = (Exception?)obj; + break; + case Container_FieldIndex.Keywords: + this.Keywords = (MaskItem?>)obj; + break; + case Container_FieldIndex.ForcedLocRefTypes: + this.ForcedLocRefTypes = (MaskItem?>)obj; + break; + case Container_FieldIndex.NativeTerminal: + this.NativeTerminal = (Exception?)obj; + break; + case Container_FieldIndex.Properties: + this.Properties = (MaskItem>?>)obj; + break; + case Container_FieldIndex.AttachParentSlots: + this.AttachParentSlots = (MaskItem?>)obj; + break; + case Container_FieldIndex.OpenSound: + this.OpenSound = (MaskItem?)obj; + break; + case Container_FieldIndex.CloseSound: + this.CloseSound = (MaskItem?)obj; + break; + case Container_FieldIndex.DisplayFilter: + this.DisplayFilter = (Exception?)obj; + break; + default: + base.SetNthMask(index, obj); + break; + } + } + + public override bool IsInError() + { + if (Overall != null) return true; + if (VirtualMachineAdapter != null) return true; + if (ObjectBounds != null) return true; + if (ODTY != null) return true; + if (ObjectPlacementDefaults != null) return true; + if (XALG != null) return true; + if (Transforms != null) return true; + if (SnapTemplate != null) return true; + if (SnapBehavior != null) return true; + if (Components != null) return true; + if (Name != null) return true; + if (Model != null) return true; + if (Items != null) return true; + if (Destructible != null) return true; + if (Flags != null) return true; + if (Keywords != null) return true; + if (ForcedLocRefTypes != null) return true; + if (NativeTerminal != null) return true; + if (Properties != null) return true; + if (AttachParentSlots != null) return true; + if (OpenSound != null) return true; + if (CloseSound != null) return true; + if (DisplayFilter != null) return true; + return false; + } + #endregion + + #region To String + public override string ToString() => this.Print(); + + public override void Print(StructuredStringBuilder sb, string? name = null) + { + sb.AppendLine($"{(name ?? "ErrorMask")} =>"); + using (sb.Brace()) + { + if (this.Overall != null) + { + sb.AppendLine("Overall =>"); + using (sb.Brace()) + { + sb.AppendLine($"{this.Overall}"); + } + } + PrintFillInternal(sb); + } + } + protected override void PrintFillInternal(StructuredStringBuilder sb) + { + base.PrintFillInternal(sb); + VirtualMachineAdapter?.Print(sb); + ObjectBounds?.Print(sb); + { + sb.AppendItem(ODTY, "ODTY"); + } + ObjectPlacementDefaults?.Print(sb); + { + sb.AppendItem(XALG, "XALG"); + } + Transforms?.Print(sb); + { + sb.AppendItem(SnapTemplate, "SnapTemplate"); + } + { + sb.AppendItem(SnapBehavior, "SnapBehavior"); + } + if (Components is {} ComponentsItem) + { + sb.AppendLine("Components =>"); + using (sb.Brace()) + { + sb.AppendItem(ComponentsItem.Overall); + if (ComponentsItem.Specific != null) + { + foreach (var subItem in ComponentsItem.Specific) + { + using (sb.Brace()) + { + subItem?.Print(sb); + } + } + } + } + } + { + sb.AppendItem(Name, "Name"); + } + Model?.Print(sb); + if (Items is {} ItemsItem) + { + sb.AppendLine("Items =>"); + using (sb.Brace()) + { + sb.AppendItem(ItemsItem.Overall); + if (ItemsItem.Specific != null) + { + foreach (var subItem in ItemsItem.Specific) + { + using (sb.Brace()) + { + subItem?.Print(sb); + } + } + } + } + } + Destructible?.Print(sb); + { + sb.AppendItem(Flags, "Flags"); + } + if (Keywords is {} KeywordsItem) + { + sb.AppendLine("Keywords =>"); + using (sb.Brace()) + { + sb.AppendItem(KeywordsItem.Overall); + if (KeywordsItem.Specific != null) + { + foreach (var subItem in KeywordsItem.Specific) + { + using (sb.Brace()) + { + { + sb.AppendItem(subItem); + } + } + } + } + } + } + if (ForcedLocRefTypes is {} ForcedLocRefTypesItem) + { + sb.AppendLine("ForcedLocRefTypes =>"); + using (sb.Brace()) + { + sb.AppendItem(ForcedLocRefTypesItem.Overall); + if (ForcedLocRefTypesItem.Specific != null) + { + foreach (var subItem in ForcedLocRefTypesItem.Specific) + { + using (sb.Brace()) + { + { + sb.AppendItem(subItem); + } + } + } + } + } + } + { + sb.AppendItem(NativeTerminal, "NativeTerminal"); + } + if (Properties is {} PropertiesItem) { - default: - base.SetNthMask(index, obj); - break; + sb.AppendLine("Properties =>"); + using (sb.Brace()) + { + sb.AppendItem(PropertiesItem.Overall); + if (PropertiesItem.Specific != null) + { + foreach (var subItem in PropertiesItem.Specific) + { + using (sb.Brace()) + { + subItem?.Print(sb); + } + } + } + } } - } - - public override bool IsInError() - { - if (Overall != null) return true; - return false; - } - #endregion - - #region To String - public override string ToString() => this.Print(); - - public override void Print(StructuredStringBuilder sb, string? name = null) - { - sb.AppendLine($"{(name ?? "ErrorMask")} =>"); - using (sb.Brace()) + if (AttachParentSlots is {} AttachParentSlotsItem) { - if (this.Overall != null) + sb.AppendLine("AttachParentSlots =>"); + using (sb.Brace()) { - sb.AppendLine("Overall =>"); - using (sb.Brace()) + sb.AppendItem(AttachParentSlotsItem.Overall); + if (AttachParentSlotsItem.Specific != null) { - sb.AppendLine($"{this.Overall}"); + foreach (var subItem in AttachParentSlotsItem.Specific) + { + using (sb.Brace()) + { + { + sb.AppendItem(subItem); + } + } + } } } - PrintFillInternal(sb); } - } - protected override void PrintFillInternal(StructuredStringBuilder sb) - { - base.PrintFillInternal(sb); + OpenSound?.Print(sb); + CloseSound?.Print(sb); + { + sb.AppendItem(DisplayFilter, "DisplayFilter"); + } } #endregion @@ -255,6 +1583,28 @@ public ErrorMask Combine(ErrorMask? rhs) { if (rhs == null) return this; var ret = new ErrorMask(); + ret.VirtualMachineAdapter = this.VirtualMachineAdapter.Combine(rhs.VirtualMachineAdapter, (l, r) => l.Combine(r)); + ret.ObjectBounds = this.ObjectBounds.Combine(rhs.ObjectBounds, (l, r) => l.Combine(r)); + ret.ODTY = this.ODTY.Combine(rhs.ODTY); + ret.ObjectPlacementDefaults = this.ObjectPlacementDefaults.Combine(rhs.ObjectPlacementDefaults, (l, r) => l.Combine(r)); + ret.XALG = this.XALG.Combine(rhs.XALG); + ret.Transforms = this.Transforms.Combine(rhs.Transforms, (l, r) => l.Combine(r)); + ret.SnapTemplate = this.SnapTemplate.Combine(rhs.SnapTemplate); + ret.SnapBehavior = this.SnapBehavior.Combine(rhs.SnapBehavior); + ret.Components = new MaskItem>?>(Noggog.ExceptionExt.Combine(this.Components?.Overall, rhs.Components?.Overall), Noggog.ExceptionExt.Combine(this.Components?.Specific, rhs.Components?.Specific)); + ret.Name = this.Name.Combine(rhs.Name); + ret.Model = this.Model.Combine(rhs.Model, (l, r) => l.Combine(r)); + ret.Items = new MaskItem>?>(Noggog.ExceptionExt.Combine(this.Items?.Overall, rhs.Items?.Overall), Noggog.ExceptionExt.Combine(this.Items?.Specific, rhs.Items?.Specific)); + ret.Destructible = this.Destructible.Combine(rhs.Destructible, (l, r) => l.Combine(r)); + ret.Flags = this.Flags.Combine(rhs.Flags); + ret.Keywords = new MaskItem?>(Noggog.ExceptionExt.Combine(this.Keywords?.Overall, rhs.Keywords?.Overall), Noggog.ExceptionExt.Combine(this.Keywords?.Specific, rhs.Keywords?.Specific)); + ret.ForcedLocRefTypes = new MaskItem?>(Noggog.ExceptionExt.Combine(this.ForcedLocRefTypes?.Overall, rhs.ForcedLocRefTypes?.Overall), Noggog.ExceptionExt.Combine(this.ForcedLocRefTypes?.Specific, rhs.ForcedLocRefTypes?.Specific)); + ret.NativeTerminal = this.NativeTerminal.Combine(rhs.NativeTerminal); + ret.Properties = new MaskItem>?>(Noggog.ExceptionExt.Combine(this.Properties?.Overall, rhs.Properties?.Overall), Noggog.ExceptionExt.Combine(this.Properties?.Specific, rhs.Properties?.Specific)); + ret.AttachParentSlots = new MaskItem?>(Noggog.ExceptionExt.Combine(this.AttachParentSlots?.Overall, rhs.AttachParentSlots?.Overall), Noggog.ExceptionExt.Combine(this.AttachParentSlots?.Specific, rhs.AttachParentSlots?.Specific)); + ret.OpenSound = this.OpenSound.Combine(rhs.OpenSound, (l, r) => l.Combine(r)); + ret.CloseSound = this.CloseSound.Combine(rhs.CloseSound, (l, r) => l.Combine(r)); + ret.DisplayFilter = this.DisplayFilter.Combine(rhs.DisplayFilter); return ret; } public static ErrorMask? Combine(ErrorMask? lhs, ErrorMask? rhs) @@ -276,16 +1626,79 @@ public ErrorMask Combine(ErrorMask? rhs) StarfieldMajorRecord.TranslationMask, ITranslationMask { + #region Members + public VirtualMachineAdapter.TranslationMask? VirtualMachineAdapter; + public ObjectBounds.TranslationMask? ObjectBounds; + public bool ODTY; + public ObjectPlacementDefaults.TranslationMask? ObjectPlacementDefaults; + public bool XALG; + public Transforms.TranslationMask? Transforms; + public bool SnapTemplate; + public bool SnapBehavior; + public AComponent.TranslationMask? Components; + public bool Name; + public Model.TranslationMask? Model; + public ContainerEntry.TranslationMask? Items; + public Destructible.TranslationMask? Destructible; + public bool Flags; + public bool Keywords; + public bool ForcedLocRefTypes; + public bool NativeTerminal; + public ObjectProperty.TranslationMask? Properties; + public bool AttachParentSlots; + public SoundReference.TranslationMask? OpenSound; + public SoundReference.TranslationMask? CloseSound; + public bool DisplayFilter; + #endregion + #region Ctors public TranslationMask( bool defaultOn, bool onOverall = true) : base(defaultOn, onOverall) { + this.ODTY = defaultOn; + this.XALG = defaultOn; + this.SnapTemplate = defaultOn; + this.SnapBehavior = defaultOn; + this.Name = defaultOn; + this.Flags = defaultOn; + this.Keywords = defaultOn; + this.ForcedLocRefTypes = defaultOn; + this.NativeTerminal = defaultOn; + this.AttachParentSlots = defaultOn; + this.DisplayFilter = defaultOn; } #endregion + protected override void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)> ret) + { + base.GetCrystal(ret); + ret.Add((VirtualMachineAdapter != null ? VirtualMachineAdapter.OnOverall : DefaultOn, VirtualMachineAdapter?.GetCrystal())); + ret.Add((ObjectBounds != null ? ObjectBounds.OnOverall : DefaultOn, ObjectBounds?.GetCrystal())); + ret.Add((ODTY, null)); + ret.Add((ObjectPlacementDefaults != null ? ObjectPlacementDefaults.OnOverall : DefaultOn, ObjectPlacementDefaults?.GetCrystal())); + ret.Add((XALG, null)); + ret.Add((Transforms != null ? Transforms.OnOverall : DefaultOn, Transforms?.GetCrystal())); + ret.Add((SnapTemplate, null)); + ret.Add((SnapBehavior, null)); + ret.Add((Components == null ? DefaultOn : !Components.GetCrystal().CopyNothing, Components?.GetCrystal())); + ret.Add((Name, null)); + ret.Add((Model != null ? Model.OnOverall : DefaultOn, Model?.GetCrystal())); + ret.Add((Items == null ? DefaultOn : !Items.GetCrystal().CopyNothing, Items?.GetCrystal())); + ret.Add((Destructible != null ? Destructible.OnOverall : DefaultOn, Destructible?.GetCrystal())); + ret.Add((Flags, null)); + ret.Add((Keywords, null)); + ret.Add((ForcedLocRefTypes, null)); + ret.Add((NativeTerminal, null)); + ret.Add((Properties == null ? DefaultOn : !Properties.GetCrystal().CopyNothing, Properties?.GetCrystal())); + ret.Add((AttachParentSlots, null)); + ret.Add((OpenSound != null ? OpenSound.OnOverall : DefaultOn, OpenSound?.GetCrystal())); + ret.Add((CloseSound != null ? CloseSound.OnOverall : DefaultOn, CloseSound?.GetCrystal())); + ret.Add((DisplayFilter, null)); + } + public static implicit operator TranslationMask(bool defaultOn) { return new TranslationMask(defaultOn: defaultOn, onOverall: defaultOn); @@ -296,6 +1709,8 @@ public static implicit operator TranslationMask(bool defaultOn) #region Mutagen public static readonly RecordType GrupRecordType = Container_Registration.TriggeringRecordType; + public override IEnumerable EnumerateFormLinks() => ContainerCommon.Instance.EnumerateFormLinks(this); + public override void RemapLinks(IReadOnlyDictionary mapping) => ContainerSetterCommon.Instance.RemapLinks(this, mapping); public Container( FormKey formKey, StarfieldRelease gameRelease) @@ -345,6 +1760,15 @@ public override string ToString() protected override Type LinkType => typeof(IContainer); + public MajorFlag MajorFlags + { + get => (MajorFlag)this.MajorRecordFlagsRaw; + set => this.MajorRecordFlagsRaw = (int)value; + } + public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ContainerCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); + public override IEnumerable EnumerateListedAssetLinks() => ContainerSetterCommon.Instance.EnumerateListedAssetLinks(this); + public override void RemapAssetLinks(IReadOnlyDictionary mapping, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache) => ContainerSetterCommon.Instance.RemapAssetLinks(this, mapping, linkCache, queryCategories); + public override void RemapListedAssetLinks(IReadOnlyDictionary mapping) => ContainerSetterCommon.Instance.RemapAssetLinks(this, mapping, null, AssetLinkQuery.Listed); #region Equals and Hash public override bool Equals(object? obj) { @@ -424,13 +1848,64 @@ void IClearable.Clear() #region Interface public partial interface IContainer : + IAssetLinkContainer, IConstructible, IContainerGetter, + IFormLinkContainer, IItem, + IKeyworded, ILoquiObjectSetter, + IModeled, + INamed, + INamedRequired, + IObjectBounded, + IScripted, IStarfieldMajorRecordInternal, - IStaticTarget + IStaticTarget, + ITranslatedNamed, + ITranslatedNamedRequired { + /// + /// Aspects: IScripted + /// + new VirtualMachineAdapter? VirtualMachineAdapter { get; set; } + /// + /// Aspects: IObjectBounded + /// + new ObjectBounds ObjectBounds { get; set; } + new Single? ODTY { get; set; } + new ObjectPlacementDefaults? ObjectPlacementDefaults { get; set; } + new MemorySlice? XALG { get; set; } + new Transforms? Transforms { get; set; } + new IFormLinkNullable SnapTemplate { get; set; } + new IFormLinkNullable SnapBehavior { get; set; } + new ExtendedList Components { get; } + /// + /// Aspects: INamed, INamedRequired, ITranslatedNamed, ITranslatedNamedRequired + /// + new TranslatedString? Name { get; set; } + /// + /// Aspects: IModeled + /// + new Model? Model { get; set; } + new ExtendedList? Items { get; set; } + new Destructible? Destructible { get; set; } + new Container.Flag Flags { get; set; } + /// + /// Aspects: IKeyworded<IKeywordGetter> + /// + new ExtendedList>? Keywords { get; set; } + new ExtendedList>? ForcedLocRefTypes { get; set; } + new IFormLinkNullable NativeTerminal { get; set; } + new ExtendedList? Properties { get; set; } + new ExtendedList>? AttachParentSlots { get; set; } + new SoundReference? OpenSound { get; set; } + new SoundReference? CloseSound { get; set; } + new IFormLinkNullable DisplayFilter { get; set; } + #region Mutagen + new Container.MajorFlag MajorFlags { get; set; } + #endregion + } public partial interface IContainerInternal : @@ -443,14 +1918,76 @@ public partial interface IContainerInternal : [AssociatedRecordTypesAttribute(Mutagen.Bethesda.Starfield.Internals.RecordTypeInts.CONT)] public partial interface IContainerGetter : IStarfieldMajorRecordGetter, + IAssetLinkContainerGetter, IBinaryItem, IConstructibleGetter, + IFormLinkContainerGetter, + IHaveVirtualMachineAdapterGetter, IItemGetter, + IKeywordedGetter, ILoquiObject, IMapsToGetter, - IStaticTargetGetter + IModeledGetter, + INamedGetter, + INamedRequiredGetter, + IObjectBoundedGetter, + IScriptedGetter, + IStaticTargetGetter, + ITranslatedNamedGetter, + ITranslatedNamedRequiredGetter { static new ILoquiRegistration StaticRegistration => Container_Registration.Instance; + #region VirtualMachineAdapter + /// + /// Aspects: IHaveVirtualMachineAdapterGetter, IScriptedGetter + /// + IVirtualMachineAdapterGetter? VirtualMachineAdapter { get; } + #endregion + #region ObjectBounds + /// + /// Aspects: IObjectBoundedGetter + /// + IObjectBoundsGetter ObjectBounds { get; } + #endregion + Single? ODTY { get; } + IObjectPlacementDefaultsGetter? ObjectPlacementDefaults { get; } + ReadOnlyMemorySlice? XALG { get; } + ITransformsGetter? Transforms { get; } + IFormLinkNullableGetter SnapTemplate { get; } + IFormLinkNullableGetter SnapBehavior { get; } + IReadOnlyList Components { get; } + #region Name + /// + /// Aspects: INamedGetter, INamedRequiredGetter, ITranslatedNamedGetter, ITranslatedNamedRequiredGetter + /// + ITranslatedStringGetter? Name { get; } + #endregion + #region Model + /// + /// Aspects: IModeledGetter + /// + IModelGetter? Model { get; } + #endregion + IReadOnlyList? Items { get; } + IDestructibleGetter? Destructible { get; } + Container.Flag Flags { get; } + #region Keywords + /// + /// Aspects: IKeywordedGetter<IKeywordGetter> + /// + IReadOnlyList>? Keywords { get; } + #endregion + IReadOnlyList>? ForcedLocRefTypes { get; } + IFormLinkNullableGetter NativeTerminal { get; } + IReadOnlyList? Properties { get; } + IReadOnlyList>? AttachParentSlots { get; } + ISoundReferenceGetter? OpenSound { get; } + ISoundReferenceGetter? CloseSound { get; } + IFormLinkNullableGetter DisplayFilter { get; } + + #region Mutagen + Container.MajorFlag MajorFlags { get; } + #endregion } @@ -627,6 +2164,28 @@ internal enum Container_FieldIndex FormVersion = 4, Version2 = 5, StarfieldMajorRecordFlags = 6, + VirtualMachineAdapter = 7, + ObjectBounds = 8, + ODTY = 9, + ObjectPlacementDefaults = 10, + XALG = 11, + Transforms = 12, + SnapTemplate = 13, + SnapBehavior = 14, + Components = 15, + Name = 16, + Model = 17, + Items = 18, + Destructible = 19, + Flags = 20, + Keywords = 21, + ForcedLocRefTypes = 22, + NativeTerminal = 23, + Properties = 24, + AttachParentSlots = 25, + OpenSound = 26, + CloseSound = 27, + DisplayFilter = 28, } #endregion @@ -637,9 +2196,9 @@ internal partial class Container_Registration : ILoquiRegistration public static ProtocolKey ProtocolKey => ProtocolDefinition_Starfield.ProtocolKey; - public const ushort AdditionalFieldCount = 0; + public const ushort AdditionalFieldCount = 22; - public const ushort FieldCount = 7; + public const ushort FieldCount = 29; public static readonly Type MaskType = typeof(Container.Mask<>); @@ -669,8 +2228,47 @@ internal partial class Container_Registration : ILoquiRegistration public static RecordTriggerSpecs TriggerSpecs => _recordSpecs.Value; private static readonly Lazy _recordSpecs = new Lazy(() => { - var all = RecordCollection.Factory(RecordTypes.CONT); - return new RecordTriggerSpecs(allRecordTypes: all); + var triggers = RecordCollection.Factory(RecordTypes.CONT); + var all = RecordCollection.Factory( + RecordTypes.CONT, + RecordTypes.VMAD, + RecordTypes.XXXX, + RecordTypes.OBND, + RecordTypes.ODTY, + RecordTypes.OPDS, + RecordTypes.XALG, + RecordTypes.PTT2, + RecordTypes.SNTP, + RecordTypes.SNBH, + RecordTypes.BFCB, + RecordTypes.BFCE, + RecordTypes.FULL, + RecordTypes.MODL, + RecordTypes.MODT, + RecordTypes.MOLM, + RecordTypes.FLLD, + RecordTypes.XFLG, + RecordTypes.MODC, + RecordTypes.MODF, + RecordTypes.CNTO, + RecordTypes.COCT, + RecordTypes.COED, + RecordTypes.DEST, + RecordTypes.DAMC, + RecordTypes.DSDL, + RecordTypes.DSTD, + RecordTypes.DATA, + RecordTypes.KWDA, + RecordTypes.KSIZ, + RecordTypes.FTYP, + RecordTypes.NTRM, + RecordTypes.PRPS, + RecordTypes.APPR, + RecordTypes.STOP, + RecordTypes.WED0, + RecordTypes.WED1, + RecordTypes.ONAM); + return new RecordTriggerSpecs(allRecordTypes: all, triggeringRecordTypes: triggers); }); public static readonly Type BinaryWriteTranslation = typeof(ContainerBinaryWriteTranslation); #region Interface @@ -712,6 +2310,28 @@ internal partial class ContainerSetterCommon : StarfieldMajorRecordSetterCommon public void Clear(IContainerInternal item) { ClearPartial(); + item.VirtualMachineAdapter = null; + item.ObjectBounds.Clear(); + item.ODTY = default; + item.ObjectPlacementDefaults = null; + item.XALG = default; + item.Transforms = null; + item.SnapTemplate.Clear(); + item.SnapBehavior.Clear(); + item.Components.Clear(); + item.Name = default; + item.Model = null; + item.Items = null; + item.Destructible = null; + item.Flags = default; + item.Keywords = null; + item.ForcedLocRefTypes = null; + item.NativeTerminal.Clear(); + item.Properties = null; + item.AttachParentSlots = null; + item.OpenSound = null; + item.CloseSound = null; + item.DisplayFilter.Clear(); base.Clear(item); } @@ -729,6 +2349,62 @@ public override void Clear(IMajorRecordInternal item) public void RemapLinks(IContainer obj, IReadOnlyDictionary mapping) { base.RemapLinks(obj, mapping); + obj.VirtualMachineAdapter?.RemapLinks(mapping); + obj.Transforms?.RemapLinks(mapping); + obj.SnapTemplate.Relink(mapping); + obj.SnapBehavior.Relink(mapping); + obj.Components.RemapLinks(mapping); + obj.Model?.RemapLinks(mapping); + obj.Items?.RemapLinks(mapping); + obj.Destructible?.RemapLinks(mapping); + obj.Keywords?.RemapLinks(mapping); + obj.ForcedLocRefTypes?.RemapLinks(mapping); + obj.NativeTerminal.Relink(mapping); + obj.Properties?.RemapLinks(mapping); + obj.AttachParentSlots?.RemapLinks(mapping); + obj.OpenSound?.RemapLinks(mapping); + obj.CloseSound?.RemapLinks(mapping); + obj.DisplayFilter.Relink(mapping); + } + + public IEnumerable EnumerateListedAssetLinks(IContainer obj) + { + foreach (var item in base.EnumerateListedAssetLinks(obj)) + { + yield return item; + } + foreach (var item in obj.Components.WhereCastable() + .SelectMany((f) => f.EnumerateListedAssetLinks())) + { + yield return item; + } + if (obj.Model is {} ModelItems) + { + foreach (var item in ModelItems.EnumerateListedAssetLinks()) + { + yield return item; + } + } + if (obj.Destructible is {} DestructibleItems) + { + foreach (var item in DestructibleItems.EnumerateListedAssetLinks()) + { + yield return item; + } + } + yield break; + } + + public void RemapAssetLinks( + IContainer obj, + IReadOnlyDictionary mapping, + IAssetLinkCache? linkCache, + AssetLinkQuery queryCategories) + { + base.RemapAssetLinks(obj, mapping, linkCache, queryCategories); + obj.Components.ForEach(x => x.RemapAssetLinks(mapping, queryCategories, linkCache)); + obj.Model?.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Destructible?.RemapAssetLinks(mapping, queryCategories, linkCache); } #endregion @@ -796,6 +2472,74 @@ public void FillEqualsMask( Container.Mask ret, EqualsMaskHelper.Include include = EqualsMaskHelper.Include.All) { + ret.VirtualMachineAdapter = EqualsMaskHelper.EqualsHelper( + item.VirtualMachineAdapter, + rhs.VirtualMachineAdapter, + (loqLhs, loqRhs, incl) => loqLhs.GetEqualsMask(loqRhs, incl), + include); + ret.ObjectBounds = MaskItemExt.Factory(item.ObjectBounds.GetEqualsMask(rhs.ObjectBounds, include), include); + ret.ODTY = item.ODTY.EqualsWithin(rhs.ODTY); + ret.ObjectPlacementDefaults = EqualsMaskHelper.EqualsHelper( + item.ObjectPlacementDefaults, + rhs.ObjectPlacementDefaults, + (loqLhs, loqRhs, incl) => loqLhs.GetEqualsMask(loqRhs, incl), + include); + ret.XALG = MemorySliceExt.SequenceEqual(item.XALG, rhs.XALG); + ret.Transforms = EqualsMaskHelper.EqualsHelper( + item.Transforms, + rhs.Transforms, + (loqLhs, loqRhs, incl) => loqLhs.GetEqualsMask(loqRhs, incl), + include); + ret.SnapTemplate = item.SnapTemplate.Equals(rhs.SnapTemplate); + ret.SnapBehavior = item.SnapBehavior.Equals(rhs.SnapBehavior); + ret.Components = item.Components.CollectionEqualsHelper( + rhs.Components, + (loqLhs, loqRhs) => loqLhs.GetEqualsMask(loqRhs, include), + include); + ret.Name = object.Equals(item.Name, rhs.Name); + ret.Model = EqualsMaskHelper.EqualsHelper( + item.Model, + rhs.Model, + (loqLhs, loqRhs, incl) => loqLhs.GetEqualsMask(loqRhs, incl), + include); + ret.Items = item.Items.CollectionEqualsHelper( + rhs.Items, + (loqLhs, loqRhs) => loqLhs.GetEqualsMask(loqRhs, include), + include); + ret.Destructible = EqualsMaskHelper.EqualsHelper( + item.Destructible, + rhs.Destructible, + (loqLhs, loqRhs, incl) => loqLhs.GetEqualsMask(loqRhs, incl), + include); + ret.Flags = item.Flags == rhs.Flags; + ret.Keywords = item.Keywords.CollectionEqualsHelper( + rhs.Keywords, + (l, r) => object.Equals(l, r), + include); + ret.ForcedLocRefTypes = item.ForcedLocRefTypes.CollectionEqualsHelper( + rhs.ForcedLocRefTypes, + (l, r) => object.Equals(l, r), + include); + ret.NativeTerminal = item.NativeTerminal.Equals(rhs.NativeTerminal); + ret.Properties = item.Properties.CollectionEqualsHelper( + rhs.Properties, + (loqLhs, loqRhs) => loqLhs.GetEqualsMask(loqRhs, include), + include); + ret.AttachParentSlots = item.AttachParentSlots.CollectionEqualsHelper( + rhs.AttachParentSlots, + (l, r) => object.Equals(l, r), + include); + ret.OpenSound = EqualsMaskHelper.EqualsHelper( + item.OpenSound, + rhs.OpenSound, + (loqLhs, loqRhs, incl) => loqLhs.GetEqualsMask(loqRhs, incl), + include); + ret.CloseSound = EqualsMaskHelper.EqualsHelper( + item.CloseSound, + rhs.CloseSound, + (loqLhs, loqRhs, incl) => loqLhs.GetEqualsMask(loqRhs, incl), + include); + ret.DisplayFilter = item.DisplayFilter.Equals(rhs.DisplayFilter); base.FillEqualsMask(item, rhs, ret, include); } @@ -845,6 +2589,169 @@ protected static void ToStringFields( item: item, sb: sb, printMask: printMask); + if ((printMask?.VirtualMachineAdapter?.Overall ?? true) + && item.VirtualMachineAdapter is {} VirtualMachineAdapterItem) + { + VirtualMachineAdapterItem?.Print(sb, "VirtualMachineAdapter"); + } + if (printMask?.ObjectBounds?.Overall ?? true) + { + item.ObjectBounds?.Print(sb, "ObjectBounds"); + } + if ((printMask?.ODTY ?? true) + && item.ODTY is {} ODTYItem) + { + sb.AppendItem(ODTYItem, "ODTY"); + } + if ((printMask?.ObjectPlacementDefaults?.Overall ?? true) + && item.ObjectPlacementDefaults is {} ObjectPlacementDefaultsItem) + { + ObjectPlacementDefaultsItem?.Print(sb, "ObjectPlacementDefaults"); + } + if ((printMask?.XALG ?? true) + && item.XALG is {} XALGItem) + { + sb.AppendLine($"XALG => {SpanExt.ToHexString(XALGItem)}"); + } + if ((printMask?.Transforms?.Overall ?? true) + && item.Transforms is {} TransformsItem) + { + TransformsItem?.Print(sb, "Transforms"); + } + if (printMask?.SnapTemplate ?? true) + { + sb.AppendItem(item.SnapTemplate.FormKeyNullable, "SnapTemplate"); + } + if (printMask?.SnapBehavior ?? true) + { + sb.AppendItem(item.SnapBehavior.FormKeyNullable, "SnapBehavior"); + } + if (printMask?.Components?.Overall ?? true) + { + sb.AppendLine("Components =>"); + using (sb.Brace()) + { + foreach (var subItem in item.Components) + { + using (sb.Brace()) + { + subItem?.Print(sb, "Item"); + } + } + } + } + if ((printMask?.Name ?? true) + && item.Name is {} NameItem) + { + sb.AppendItem(NameItem, "Name"); + } + if ((printMask?.Model?.Overall ?? true) + && item.Model is {} ModelItem) + { + ModelItem?.Print(sb, "Model"); + } + if ((printMask?.Items?.Overall ?? true) + && item.Items is {} ItemsItem) + { + sb.AppendLine("Items =>"); + using (sb.Brace()) + { + foreach (var subItem in ItemsItem) + { + using (sb.Brace()) + { + subItem?.Print(sb, "Item"); + } + } + } + } + if ((printMask?.Destructible?.Overall ?? true) + && item.Destructible is {} DestructibleItem) + { + DestructibleItem?.Print(sb, "Destructible"); + } + if (printMask?.Flags ?? true) + { + sb.AppendItem(item.Flags, "Flags"); + } + if ((printMask?.Keywords?.Overall ?? true) + && item.Keywords is {} KeywordsItem) + { + sb.AppendLine("Keywords =>"); + using (sb.Brace()) + { + foreach (var subItem in KeywordsItem) + { + using (sb.Brace()) + { + sb.AppendItem(subItem.FormKey); + } + } + } + } + if ((printMask?.ForcedLocRefTypes?.Overall ?? true) + && item.ForcedLocRefTypes is {} ForcedLocRefTypesItem) + { + sb.AppendLine("ForcedLocRefTypes =>"); + using (sb.Brace()) + { + foreach (var subItem in ForcedLocRefTypesItem) + { + using (sb.Brace()) + { + sb.AppendItem(subItem.FormKey); + } + } + } + } + if (printMask?.NativeTerminal ?? true) + { + sb.AppendItem(item.NativeTerminal.FormKeyNullable, "NativeTerminal"); + } + if ((printMask?.Properties?.Overall ?? true) + && item.Properties is {} PropertiesItem) + { + sb.AppendLine("Properties =>"); + using (sb.Brace()) + { + foreach (var subItem in PropertiesItem) + { + using (sb.Brace()) + { + subItem?.Print(sb, "Item"); + } + } + } + } + if ((printMask?.AttachParentSlots?.Overall ?? true) + && item.AttachParentSlots is {} AttachParentSlotsItem) + { + sb.AppendLine("AttachParentSlots =>"); + using (sb.Brace()) + { + foreach (var subItem in AttachParentSlotsItem) + { + using (sb.Brace()) + { + sb.AppendItem(subItem.FormKey); + } + } + } + } + if ((printMask?.OpenSound?.Overall ?? true) + && item.OpenSound is {} OpenSoundItem) + { + OpenSoundItem?.Print(sb, "OpenSound"); + } + if ((printMask?.CloseSound?.Overall ?? true) + && item.CloseSound is {} CloseSoundItem) + { + CloseSoundItem?.Print(sb, "CloseSound"); + } + if (printMask?.DisplayFilter ?? true) + { + sb.AppendItem(item.DisplayFilter.FormKeyNullable, "DisplayFilter"); + } } public static Container_FieldIndex ConvertFieldIndex(StarfieldMajorRecord_FieldIndex index) @@ -868,33 +2775,153 @@ public static Container_FieldIndex ConvertFieldIndex(StarfieldMajorRecord_FieldI default: throw new ArgumentException($"Index is out of range: {index.ToStringFast()}"); } - } - - public static new Container_FieldIndex ConvertFieldIndex(MajorRecord_FieldIndex index) - { - switch (index) + } + + public static new Container_FieldIndex ConvertFieldIndex(MajorRecord_FieldIndex index) + { + switch (index) + { + case MajorRecord_FieldIndex.MajorRecordFlagsRaw: + return (Container_FieldIndex)((int)index); + case MajorRecord_FieldIndex.FormKey: + return (Container_FieldIndex)((int)index); + case MajorRecord_FieldIndex.VersionControl: + return (Container_FieldIndex)((int)index); + case MajorRecord_FieldIndex.EditorID: + return (Container_FieldIndex)((int)index); + default: + throw new ArgumentException($"Index is out of range: {index.ToStringFast()}"); + } + } + + #region Equals and Hash + public virtual bool Equals( + IContainerGetter? lhs, + IContainerGetter? rhs, + TranslationCrystal? equalsMask) + { + if (!EqualsMaskHelper.RefEquality(lhs, rhs, out var isEqual)) return isEqual; + if (!base.Equals((IStarfieldMajorRecordGetter)lhs, (IStarfieldMajorRecordGetter)rhs, equalsMask)) return false; + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.VirtualMachineAdapter) ?? true)) + { + if (EqualsMaskHelper.RefEquality(lhs.VirtualMachineAdapter, rhs.VirtualMachineAdapter, out var lhsVirtualMachineAdapter, out var rhsVirtualMachineAdapter, out var isVirtualMachineAdapterEqual)) + { + if (!((VirtualMachineAdapterCommon)((IVirtualMachineAdapterGetter)lhsVirtualMachineAdapter).CommonInstance()!).Equals(lhsVirtualMachineAdapter, rhsVirtualMachineAdapter, equalsMask?.GetSubCrystal((int)Container_FieldIndex.VirtualMachineAdapter))) return false; + } + else if (!isVirtualMachineAdapterEqual) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.ObjectBounds) ?? true)) + { + if (EqualsMaskHelper.RefEquality(lhs.ObjectBounds, rhs.ObjectBounds, out var lhsObjectBounds, out var rhsObjectBounds, out var isObjectBoundsEqual)) + { + if (!((ObjectBoundsCommon)((IObjectBoundsGetter)lhsObjectBounds).CommonInstance()!).Equals(lhsObjectBounds, rhsObjectBounds, equalsMask?.GetSubCrystal((int)Container_FieldIndex.ObjectBounds))) return false; + } + else if (!isObjectBoundsEqual) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.ODTY) ?? true)) + { + if (!lhs.ODTY.EqualsWithin(rhs.ODTY)) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.ObjectPlacementDefaults) ?? true)) + { + if (EqualsMaskHelper.RefEquality(lhs.ObjectPlacementDefaults, rhs.ObjectPlacementDefaults, out var lhsObjectPlacementDefaults, out var rhsObjectPlacementDefaults, out var isObjectPlacementDefaultsEqual)) + { + if (!((ObjectPlacementDefaultsCommon)((IObjectPlacementDefaultsGetter)lhsObjectPlacementDefaults).CommonInstance()!).Equals(lhsObjectPlacementDefaults, rhsObjectPlacementDefaults, equalsMask?.GetSubCrystal((int)Container_FieldIndex.ObjectPlacementDefaults))) return false; + } + else if (!isObjectPlacementDefaultsEqual) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.XALG) ?? true)) + { + if (!MemorySliceExt.SequenceEqual(lhs.XALG, rhs.XALG)) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.Transforms) ?? true)) + { + if (EqualsMaskHelper.RefEquality(lhs.Transforms, rhs.Transforms, out var lhsTransforms, out var rhsTransforms, out var isTransformsEqual)) + { + if (!((TransformsCommon)((ITransformsGetter)lhsTransforms).CommonInstance()!).Equals(lhsTransforms, rhsTransforms, equalsMask?.GetSubCrystal((int)Container_FieldIndex.Transforms))) return false; + } + else if (!isTransformsEqual) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.SnapTemplate) ?? true)) + { + if (!lhs.SnapTemplate.Equals(rhs.SnapTemplate)) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.SnapBehavior) ?? true)) + { + if (!lhs.SnapBehavior.Equals(rhs.SnapBehavior)) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.Components) ?? true)) + { + if (!lhs.Components.SequenceEqual(rhs.Components, (l, r) => ((AComponentCommon)((IAComponentGetter)l).CommonInstance()!).Equals(l, r, equalsMask?.GetSubCrystal((int)Container_FieldIndex.Components)))) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.Name) ?? true)) + { + if (!object.Equals(lhs.Name, rhs.Name)) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.Model) ?? true)) + { + if (EqualsMaskHelper.RefEquality(lhs.Model, rhs.Model, out var lhsModel, out var rhsModel, out var isModelEqual)) + { + if (!((ModelCommon)((IModelGetter)lhsModel).CommonInstance()!).Equals(lhsModel, rhsModel, equalsMask?.GetSubCrystal((int)Container_FieldIndex.Model))) return false; + } + else if (!isModelEqual) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.Items) ?? true)) + { + if (!lhs.Items.SequenceEqualNullable(rhs.Items, (l, r) => ((ContainerEntryCommon)((IContainerEntryGetter)l).CommonInstance()!).Equals(l, r, equalsMask?.GetSubCrystal((int)Container_FieldIndex.Items)))) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.Destructible) ?? true)) + { + if (EqualsMaskHelper.RefEquality(lhs.Destructible, rhs.Destructible, out var lhsDestructible, out var rhsDestructible, out var isDestructibleEqual)) + { + if (!((DestructibleCommon)((IDestructibleGetter)lhsDestructible).CommonInstance()!).Equals(lhsDestructible, rhsDestructible, equalsMask?.GetSubCrystal((int)Container_FieldIndex.Destructible))) return false; + } + else if (!isDestructibleEqual) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.Flags) ?? true)) + { + if (lhs.Flags != rhs.Flags) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.Keywords) ?? true)) + { + if (!lhs.Keywords.SequenceEqualNullable(rhs.Keywords)) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.ForcedLocRefTypes) ?? true)) + { + if (!lhs.ForcedLocRefTypes.SequenceEqualNullable(rhs.ForcedLocRefTypes)) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.NativeTerminal) ?? true)) + { + if (!lhs.NativeTerminal.Equals(rhs.NativeTerminal)) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.Properties) ?? true)) + { + if (!lhs.Properties.SequenceEqualNullable(rhs.Properties, (l, r) => ((ObjectPropertyCommon)((IObjectPropertyGetter)l).CommonInstance()!).Equals(l, r, equalsMask?.GetSubCrystal((int)Container_FieldIndex.Properties)))) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.AttachParentSlots) ?? true)) + { + if (!lhs.AttachParentSlots.SequenceEqualNullable(rhs.AttachParentSlots)) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.OpenSound) ?? true)) + { + if (EqualsMaskHelper.RefEquality(lhs.OpenSound, rhs.OpenSound, out var lhsOpenSound, out var rhsOpenSound, out var isOpenSoundEqual)) + { + if (!((SoundReferenceCommon)((ISoundReferenceGetter)lhsOpenSound).CommonInstance()!).Equals(lhsOpenSound, rhsOpenSound, equalsMask?.GetSubCrystal((int)Container_FieldIndex.OpenSound))) return false; + } + else if (!isOpenSoundEqual) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.CloseSound) ?? true)) + { + if (EqualsMaskHelper.RefEquality(lhs.CloseSound, rhs.CloseSound, out var lhsCloseSound, out var rhsCloseSound, out var isCloseSoundEqual)) + { + if (!((SoundReferenceCommon)((ISoundReferenceGetter)lhsCloseSound).CommonInstance()!).Equals(lhsCloseSound, rhsCloseSound, equalsMask?.GetSubCrystal((int)Container_FieldIndex.CloseSound))) return false; + } + else if (!isCloseSoundEqual) return false; + } + if ((equalsMask?.GetShouldTranslate((int)Container_FieldIndex.DisplayFilter) ?? true)) { - case MajorRecord_FieldIndex.MajorRecordFlagsRaw: - return (Container_FieldIndex)((int)index); - case MajorRecord_FieldIndex.FormKey: - return (Container_FieldIndex)((int)index); - case MajorRecord_FieldIndex.VersionControl: - return (Container_FieldIndex)((int)index); - case MajorRecord_FieldIndex.EditorID: - return (Container_FieldIndex)((int)index); - default: - throw new ArgumentException($"Index is out of range: {index.ToStringFast()}"); + if (!lhs.DisplayFilter.Equals(rhs.DisplayFilter)) return false; } - } - - #region Equals and Hash - public virtual bool Equals( - IContainerGetter? lhs, - IContainerGetter? rhs, - TranslationCrystal? equalsMask) - { - if (!EqualsMaskHelper.RefEquality(lhs, rhs, out var isEqual)) return isEqual; - if (!base.Equals((IStarfieldMajorRecordGetter)lhs, (IStarfieldMajorRecordGetter)rhs, equalsMask)) return false; return true; } @@ -923,6 +2950,58 @@ public override bool Equals( public virtual int GetHashCode(IContainerGetter item) { var hash = new HashCode(); + if (item.VirtualMachineAdapter is {} VirtualMachineAdapteritem) + { + hash.Add(VirtualMachineAdapteritem); + } + hash.Add(item.ObjectBounds); + if (item.ODTY is {} ODTYitem) + { + hash.Add(ODTYitem); + } + if (item.ObjectPlacementDefaults is {} ObjectPlacementDefaultsitem) + { + hash.Add(ObjectPlacementDefaultsitem); + } + if (item.XALG is {} XALGItem) + { + hash.Add(XALGItem); + } + if (item.Transforms is {} Transformsitem) + { + hash.Add(Transformsitem); + } + hash.Add(item.SnapTemplate); + hash.Add(item.SnapBehavior); + hash.Add(item.Components); + if (item.Name is {} Nameitem) + { + hash.Add(Nameitem); + } + if (item.Model is {} Modelitem) + { + hash.Add(Modelitem); + } + hash.Add(item.Items); + if (item.Destructible is {} Destructibleitem) + { + hash.Add(Destructibleitem); + } + hash.Add(item.Flags); + hash.Add(item.Keywords); + hash.Add(item.ForcedLocRefTypes); + hash.Add(item.NativeTerminal); + hash.Add(item.Properties); + hash.Add(item.AttachParentSlots); + if (item.OpenSound is {} OpenSounditem) + { + hash.Add(OpenSounditem); + } + if (item.CloseSound is {} CloseSounditem) + { + hash.Add(CloseSounditem); + } + hash.Add(item.DisplayFilter); hash.Add(base.GetHashCode()); return hash.ToHashCode(); } @@ -952,6 +3031,136 @@ public IEnumerable EnumerateFormLinks(IContainerGetter obj) { yield return item; } + if (obj.VirtualMachineAdapter is IFormLinkContainerGetter VirtualMachineAdapterlinkCont) + { + foreach (var item in VirtualMachineAdapterlinkCont.EnumerateFormLinks()) + { + yield return item; + } + } + if (obj.Transforms is {} TransformsItems) + { + foreach (var item in TransformsItems.EnumerateFormLinks()) + { + yield return item; + } + } + if (FormLinkInformation.TryFactory(obj.SnapTemplate, out var SnapTemplateInfo)) + { + yield return SnapTemplateInfo; + } + if (FormLinkInformation.TryFactory(obj.SnapBehavior, out var SnapBehaviorInfo)) + { + yield return SnapBehaviorInfo; + } + foreach (var item in obj.Components.WhereCastable() + .SelectMany((f) => f.EnumerateFormLinks())) + { + yield return FormLinkInformation.Factory(item); + } + if (obj.Model is {} ModelItems) + { + foreach (var item in ModelItems.EnumerateFormLinks()) + { + yield return item; + } + } + if (obj.Items is {} ItemsItem) + { + foreach (var item in ItemsItem.WhereCastable() + .SelectMany((f) => f.EnumerateFormLinks())) + { + yield return FormLinkInformation.Factory(item); + } + } + if (obj.Destructible is {} DestructibleItems) + { + foreach (var item in DestructibleItems.EnumerateFormLinks()) + { + yield return item; + } + } + if (obj.Keywords is {} KeywordsItem) + { + foreach (var item in KeywordsItem) + { + yield return FormLinkInformation.Factory(item); + } + } + if (obj.ForcedLocRefTypes is {} ForcedLocRefTypesItem) + { + foreach (var item in ForcedLocRefTypesItem) + { + yield return FormLinkInformation.Factory(item); + } + } + if (FormLinkInformation.TryFactory(obj.NativeTerminal, out var NativeTerminalInfo)) + { + yield return NativeTerminalInfo; + } + if (obj.Properties is {} PropertiesItem) + { + foreach (var item in PropertiesItem.SelectMany(f => f.EnumerateFormLinks())) + { + yield return FormLinkInformation.Factory(item); + } + } + if (obj.AttachParentSlots is {} AttachParentSlotsItem) + { + foreach (var item in AttachParentSlotsItem) + { + yield return FormLinkInformation.Factory(item); + } + } + if (obj.OpenSound is {} OpenSoundItems) + { + foreach (var item in OpenSoundItems.EnumerateFormLinks()) + { + yield return item; + } + } + if (obj.CloseSound is {} CloseSoundItems) + { + foreach (var item in CloseSoundItems.EnumerateFormLinks()) + { + yield return item; + } + } + if (FormLinkInformation.TryFactory(obj.DisplayFilter, out var DisplayFilterInfo)) + { + yield return DisplayFilterInfo; + } + yield break; + } + + public IEnumerable EnumerateAssetLinks(IContainerGetter obj, AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) + { + foreach (var item in base.EnumerateAssetLinks(obj, queryCategories, linkCache, assetType)) + { + yield return item; + } + if (queryCategories.HasFlag(AssetLinkQuery.Listed)) + { + foreach (var item in obj.Components.WhereCastable() + .SelectMany((f) => f.EnumerateAssetLinks(queryCategories: queryCategories, linkCache: linkCache, assetType: assetType))) + { + yield return item; + } + if (obj.Model is {} ModelItems) + { + foreach (var item in ModelItems.EnumerateAssetLinks(queryCategories: queryCategories, linkCache: linkCache, assetType: assetType)) + { + yield return item; + } + } + if (obj.Destructible is {} DestructibleItems) + { + foreach (var item in DestructibleItems.EnumerateAssetLinks(queryCategories: queryCategories, linkCache: linkCache, assetType: assetType)) + { + yield return item; + } + } + } yield break; } @@ -1026,6 +3235,418 @@ public void DeepCopyIn( errorMask, copyMask, deepCopy: deepCopy); + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.VirtualMachineAdapter) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.VirtualMachineAdapter); + try + { + if(rhs.VirtualMachineAdapter is {} rhsVirtualMachineAdapter) + { + item.VirtualMachineAdapter = rhsVirtualMachineAdapter.DeepCopy( + errorMask: errorMask, + copyMask?.GetSubCrystal((int)Container_FieldIndex.VirtualMachineAdapter)); + } + else + { + item.VirtualMachineAdapter = default; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.ObjectBounds) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.ObjectBounds); + try + { + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.ObjectBounds) ?? true)) + { + item.ObjectBounds = rhs.ObjectBounds.DeepCopy( + copyMask: copyMask?.GetSubCrystal((int)Container_FieldIndex.ObjectBounds), + errorMask: errorMask); + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.ODTY) ?? true)) + { + item.ODTY = rhs.ODTY; + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.ObjectPlacementDefaults) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.ObjectPlacementDefaults); + try + { + if(rhs.ObjectPlacementDefaults is {} rhsObjectPlacementDefaults) + { + item.ObjectPlacementDefaults = rhsObjectPlacementDefaults.DeepCopy( + errorMask: errorMask, + copyMask?.GetSubCrystal((int)Container_FieldIndex.ObjectPlacementDefaults)); + } + else + { + item.ObjectPlacementDefaults = default; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.XALG) ?? true)) + { + if(rhs.XALG is {} XALGrhs) + { + item.XALG = XALGrhs.ToArray(); + } + else + { + item.XALG = default; + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.Transforms) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.Transforms); + try + { + if(rhs.Transforms is {} rhsTransforms) + { + item.Transforms = rhsTransforms.DeepCopy( + errorMask: errorMask, + copyMask?.GetSubCrystal((int)Container_FieldIndex.Transforms)); + } + else + { + item.Transforms = default; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.SnapTemplate) ?? true)) + { + item.SnapTemplate.SetTo(rhs.SnapTemplate.FormKeyNullable); + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.SnapBehavior) ?? true)) + { + item.SnapBehavior.SetTo(rhs.SnapBehavior.FormKeyNullable); + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.Components) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.Components); + try + { + item.Components.SetTo( + rhs.Components + .Select(r => + { + return r.DeepCopy( + errorMask: errorMask, + default(TranslationCrystal)); + })); + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.Name) ?? true)) + { + item.Name = rhs.Name?.DeepCopy(); + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.Model) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.Model); + try + { + if(rhs.Model is {} rhsModel) + { + item.Model = rhsModel.DeepCopy( + errorMask: errorMask, + copyMask?.GetSubCrystal((int)Container_FieldIndex.Model)); + } + else + { + item.Model = default; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.Items) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.Items); + try + { + if ((rhs.Items != null)) + { + item.Items = + rhs.Items + .Select(r => + { + return r.DeepCopy( + errorMask: errorMask, + default(TranslationCrystal)); + }) + .ToExtendedList(); + } + else + { + item.Items = null; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.Destructible) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.Destructible); + try + { + if(rhs.Destructible is {} rhsDestructible) + { + item.Destructible = rhsDestructible.DeepCopy( + errorMask: errorMask, + copyMask?.GetSubCrystal((int)Container_FieldIndex.Destructible)); + } + else + { + item.Destructible = default; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.Flags) ?? true)) + { + item.Flags = rhs.Flags; + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.Keywords) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.Keywords); + try + { + if ((rhs.Keywords != null)) + { + item.Keywords = + rhs.Keywords + .Select(r => (IFormLinkGetter)new FormLink(r.FormKey)) + .ToExtendedList>(); + } + else + { + item.Keywords = null; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.ForcedLocRefTypes) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.ForcedLocRefTypes); + try + { + if ((rhs.ForcedLocRefTypes != null)) + { + item.ForcedLocRefTypes = + rhs.ForcedLocRefTypes + .Select(r => (IFormLinkGetter)new FormLink(r.FormKey)) + .ToExtendedList>(); + } + else + { + item.ForcedLocRefTypes = null; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.NativeTerminal) ?? true)) + { + item.NativeTerminal.SetTo(rhs.NativeTerminal.FormKeyNullable); + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.Properties) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.Properties); + try + { + if ((rhs.Properties != null)) + { + item.Properties = + rhs.Properties + .Select(r => + { + return r.DeepCopy( + errorMask: errorMask, + default(TranslationCrystal)); + }) + .ToExtendedList(); + } + else + { + item.Properties = null; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.AttachParentSlots) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.AttachParentSlots); + try + { + if ((rhs.AttachParentSlots != null)) + { + item.AttachParentSlots = + rhs.AttachParentSlots + .Select(r => (IFormLinkGetter)new FormLink(r.FormKey)) + .ToExtendedList>(); + } + else + { + item.AttachParentSlots = null; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.OpenSound) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.OpenSound); + try + { + if(rhs.OpenSound is {} rhsOpenSound) + { + item.OpenSound = rhsOpenSound.DeepCopy( + errorMask: errorMask, + copyMask?.GetSubCrystal((int)Container_FieldIndex.OpenSound)); + } + else + { + item.OpenSound = default; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.CloseSound) ?? true)) + { + errorMask?.PushIndex((int)Container_FieldIndex.CloseSound); + try + { + if(rhs.CloseSound is {} rhsCloseSound) + { + item.CloseSound = rhsCloseSound.DeepCopy( + errorMask: errorMask, + copyMask?.GetSubCrystal((int)Container_FieldIndex.CloseSound)); + } + else + { + item.CloseSound = default; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } + if ((copyMask?.GetShouldTranslate((int)Container_FieldIndex.DisplayFilter) ?? true)) + { + item.DisplayFilter.SetTo(rhs.DisplayFilter.FormKeyNullable); + } } public override void DeepCopyIn( @@ -1174,6 +3795,183 @@ public partial class ContainerBinaryWriteTranslation : { public new static readonly ContainerBinaryWriteTranslation Instance = new(); + public static void WriteRecordTypes( + IContainerGetter item, + MutagenWriter writer, + TypedWriteParams translationParams) + { + MajorRecordBinaryWriteTranslation.WriteRecordTypes( + item: item, + writer: writer, + translationParams: translationParams); + if (item.VirtualMachineAdapter is {} VirtualMachineAdapterItem) + { + ((VirtualMachineAdapterBinaryWriteTranslation)((IBinaryItem)VirtualMachineAdapterItem).BinaryWriteTranslator).Write( + item: VirtualMachineAdapterItem, + writer: writer, + translationParams: translationParams.With(RecordTypes.XXXX)); + } + var ObjectBoundsItem = item.ObjectBounds; + ((ObjectBoundsBinaryWriteTranslation)((IBinaryItem)ObjectBoundsItem).BinaryWriteTranslator).Write( + item: ObjectBoundsItem, + writer: writer, + translationParams: translationParams); + FloatBinaryTranslation.Instance.WriteNullable( + writer: writer, + item: item.ODTY, + header: translationParams.ConvertToCustom(RecordTypes.ODTY)); + if (item.ObjectPlacementDefaults is {} ObjectPlacementDefaultsItem) + { + ((ObjectPlacementDefaultsBinaryWriteTranslation)((IBinaryItem)ObjectPlacementDefaultsItem).BinaryWriteTranslator).Write( + item: ObjectPlacementDefaultsItem, + writer: writer, + translationParams: translationParams); + } + ByteArrayBinaryTranslation.Instance.Write( + writer: writer, + item: item.XALG, + header: translationParams.ConvertToCustom(RecordTypes.XALG)); + if (item.Transforms is {} TransformsItem) + { + ((TransformsBinaryWriteTranslation)((IBinaryItem)TransformsItem).BinaryWriteTranslator).Write( + item: TransformsItem, + writer: writer, + translationParams: translationParams); + } + FormLinkBinaryTranslation.Instance.WriteNullable( + writer: writer, + item: item.SnapTemplate, + header: translationParams.ConvertToCustom(RecordTypes.SNTP)); + FormLinkBinaryTranslation.Instance.WriteNullable( + writer: writer, + item: item.SnapBehavior, + header: translationParams.ConvertToCustom(RecordTypes.SNBH)); + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation.Instance.Write( + writer: writer, + items: item.Components, + transl: (MutagenWriter subWriter, IAComponentGetter subItem, TypedWriteParams conv) => + { + var Item = subItem; + ((AComponentBinaryWriteTranslation)((IBinaryItem)Item).BinaryWriteTranslator).Write( + item: Item, + writer: subWriter, + translationParams: conv); + }); + StringBinaryTranslation.Instance.WriteNullable( + writer: writer, + item: item.Name, + header: translationParams.ConvertToCustom(RecordTypes.FULL), + binaryType: StringBinaryType.NullTerminate, + source: StringsSource.Normal); + if (item.Model is {} ModelItem) + { + ((ModelBinaryWriteTranslation)((IBinaryItem)ModelItem).BinaryWriteTranslator).Write( + item: ModelItem, + writer: writer, + translationParams: translationParams); + } + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation.Instance.WriteWithCounter( + writer: writer, + items: item.Items, + counterType: RecordTypes.COCT, + counterLength: 4, + transl: (MutagenWriter subWriter, IContainerEntryGetter subItem, TypedWriteParams conv) => + { + var Item = subItem; + ((ContainerEntryBinaryWriteTranslation)((IBinaryItem)Item).BinaryWriteTranslator).Write( + item: Item, + writer: subWriter, + translationParams: conv); + }); + if (item.Destructible is {} DestructibleItem) + { + ((DestructibleBinaryWriteTranslation)((IBinaryItem)DestructibleItem).BinaryWriteTranslator).Write( + item: DestructibleItem, + writer: writer, + translationParams: translationParams); + } + using (HeaderExport.Subrecord(writer, translationParams.ConvertToCustom(RecordTypes.DATA))) + { + EnumBinaryTranslation.Instance.Write( + writer, + item.Flags, + length: 1); + } + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation>.Instance.WriteWithCounter( + writer: writer, + items: item.Keywords, + counterType: RecordTypes.KSIZ, + counterLength: 4, + recordType: translationParams.ConvertToCustom(RecordTypes.KWDA), + transl: (MutagenWriter subWriter, IFormLinkGetter subItem, TypedWriteParams conv) => + { + FormLinkBinaryTranslation.Instance.Write( + writer: subWriter, + item: subItem); + }); + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation>.Instance.Write( + writer: writer, + items: item.ForcedLocRefTypes, + recordType: translationParams.ConvertToCustom(RecordTypes.FTYP), + transl: (MutagenWriter subWriter, IFormLinkGetter subItem, TypedWriteParams conv) => + { + FormLinkBinaryTranslation.Instance.Write( + writer: subWriter, + item: subItem); + }); + FormLinkBinaryTranslation.Instance.WriteNullable( + writer: writer, + item: item.NativeTerminal, + header: translationParams.ConvertToCustom(RecordTypes.NTRM)); + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation.Instance.Write( + writer: writer, + items: item.Properties, + recordType: translationParams.ConvertToCustom(RecordTypes.PRPS), + transl: (MutagenWriter subWriter, IObjectPropertyGetter subItem, TypedWriteParams conv) => + { + var Item = subItem; + ((ObjectPropertyBinaryWriteTranslation)((IBinaryItem)Item).BinaryWriteTranslator).Write( + item: Item, + writer: subWriter, + translationParams: conv); + }); + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation>.Instance.Write( + writer: writer, + items: item.AttachParentSlots, + recordType: translationParams.ConvertToCustom(RecordTypes.APPR), + transl: (MutagenWriter subWriter, IFormLinkGetter subItem, TypedWriteParams conv) => + { + FormLinkBinaryTranslation.Instance.Write( + writer: subWriter, + item: subItem); + }); + using (HeaderExport.Subrecord(writer, RecordTypes.STOP)) { } + if (item.OpenSound is {} OpenSoundItem) + { + using (HeaderExport.Subrecord(writer, RecordTypes.WED0)) + { + ((SoundReferenceBinaryWriteTranslation)((IBinaryItem)OpenSoundItem).BinaryWriteTranslator).Write( + item: OpenSoundItem, + writer: writer, + translationParams: translationParams); + } + } + if (item.CloseSound is {} CloseSoundItem) + { + using (HeaderExport.Subrecord(writer, RecordTypes.WED1)) + { + ((SoundReferenceBinaryWriteTranslation)((IBinaryItem)CloseSoundItem).BinaryWriteTranslator).Write( + item: CloseSoundItem, + writer: writer, + translationParams: translationParams); + } + } + FormLinkBinaryTranslation.Instance.WriteNullable( + writer: writer, + item: item.DisplayFilter, + header: translationParams.ConvertToCustom(RecordTypes.ONAM)); + } + public void Write( MutagenWriter writer, IContainerGetter item, @@ -1190,10 +3988,12 @@ public void Write( writer: writer); if (!item.IsDeleted) { - MajorRecordBinaryWriteTranslation.WriteRecordTypes( + writer.MetaData.FormVersion = item.FormVersion; + WriteRecordTypes( item: item, writer: writer, translationParams: translationParams); + writer.MetaData.FormVersion = null; } } catch (Exception ex) @@ -1243,6 +4043,219 @@ internal partial class ContainerBinaryCreateTranslation : StarfieldMajorRecordBi public new static readonly ContainerBinaryCreateTranslation Instance = new ContainerBinaryCreateTranslation(); public override RecordType RecordType => RecordTypes.CONT; + public static ParseResult FillBinaryRecordTypes( + IContainerInternal item, + MutagenFrame frame, + PreviousParse lastParsed, + Dictionary? recordParseCount, + RecordType nextRecordType, + int contentLength, + TypedParseParams translationParams = default) + { + nextRecordType = translationParams.ConvertToStandard(nextRecordType); + switch (nextRecordType.TypeInt) + { + case RecordTypeInts.VMAD: + { + item.VirtualMachineAdapter = Mutagen.Bethesda.Starfield.VirtualMachineAdapter.CreateFromBinary( + frame: frame, + translationParams: translationParams.With(lastParsed.LengthOverride).DoNotShortCircuit()); + return (int)Container_FieldIndex.VirtualMachineAdapter; + } + case RecordTypeInts.OBND: + { + item.ObjectBounds = Mutagen.Bethesda.Starfield.ObjectBounds.CreateFromBinary(frame: frame); + return (int)Container_FieldIndex.ObjectBounds; + } + case RecordTypeInts.ODTY: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + item.ODTY = FloatBinaryTranslation.Instance.Parse(reader: frame.SpawnWithLength(contentLength)); + return (int)Container_FieldIndex.ODTY; + } + case RecordTypeInts.OPDS: + { + item.ObjectPlacementDefaults = Mutagen.Bethesda.Starfield.ObjectPlacementDefaults.CreateFromBinary(frame: frame); + return (int)Container_FieldIndex.ObjectPlacementDefaults; + } + case RecordTypeInts.XALG: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + item.XALG = ByteArrayBinaryTranslation.Instance.Parse(reader: frame.SpawnWithLength(contentLength)); + return (int)Container_FieldIndex.XALG; + } + case RecordTypeInts.PTT2: + { + item.Transforms = Mutagen.Bethesda.Starfield.Transforms.CreateFromBinary(frame: frame); + return (int)Container_FieldIndex.Transforms; + } + case RecordTypeInts.SNTP: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + item.SnapTemplate.SetTo(FormLinkBinaryTranslation.Instance.Parse(reader: frame)); + return (int)Container_FieldIndex.SnapTemplate; + } + case RecordTypeInts.SNBH: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + item.SnapBehavior.SetTo(FormLinkBinaryTranslation.Instance.Parse(reader: frame)); + return (int)Container_FieldIndex.SnapBehavior; + } + case RecordTypeInts.BFCB: + { + item.Components.SetTo( + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation.Instance.Parse( + reader: frame, + triggeringRecord: AComponent_Registration.TriggerSpecs, + translationParams: translationParams, + transl: AComponent.TryCreateFromBinary)); + return (int)Container_FieldIndex.Components; + } + case RecordTypeInts.FULL: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + item.Name = StringBinaryTranslation.Instance.Parse( + reader: frame.SpawnWithLength(contentLength), + source: StringsSource.Normal, + stringBinaryType: StringBinaryType.NullTerminate); + return (int)Container_FieldIndex.Name; + } + case RecordTypeInts.MODL: + case RecordTypeInts.MODT: + case RecordTypeInts.MOLM: + case RecordTypeInts.FLLD: + case RecordTypeInts.XFLG: + case RecordTypeInts.MODC: + case RecordTypeInts.MODF: + { + item.Model = Mutagen.Bethesda.Starfield.Model.CreateFromBinary( + frame: frame, + translationParams: translationParams.DoNotShortCircuit()); + return (int)Container_FieldIndex.Model; + } + case RecordTypeInts.CNTO: + case RecordTypeInts.COCT: + { + item.Items = + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation.Instance.ParsePerItem( + reader: frame, + countLengthLength: 4, + countRecord: RecordTypes.COCT, + triggeringRecord: ContainerEntry_Registration.TriggerSpecs, + translationParams: translationParams, + transl: ContainerEntry.TryCreateFromBinary) + .CastExtendedList(); + return (int)Container_FieldIndex.Items; + } + case RecordTypeInts.DEST: + case RecordTypeInts.DAMC: + case RecordTypeInts.DSDL: + case RecordTypeInts.DSTD: + { + item.Destructible = Mutagen.Bethesda.Starfield.Destructible.CreateFromBinary( + frame: frame, + translationParams: translationParams.DoNotShortCircuit()); + return (int)Container_FieldIndex.Destructible; + } + case RecordTypeInts.DATA: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + var dataFrame = frame.SpawnWithLength(contentLength); + if (dataFrame.Remaining < 1) return null; + item.Flags = EnumBinaryTranslation.Instance.Parse( + reader: dataFrame, + length: 1); + return (int)Container_FieldIndex.Flags; + } + case RecordTypeInts.KSIZ: + case RecordTypeInts.KWDA: + { + item.Keywords = + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation>.Instance.Parse( + reader: frame, + countLengthLength: 4, + countRecord: translationParams.ConvertToCustom(RecordTypes.KSIZ), + triggeringRecord: translationParams.ConvertToCustom(RecordTypes.KWDA), + transl: FormLinkBinaryTranslation.Instance.Parse) + .CastExtendedList>(); + return (int)Container_FieldIndex.Keywords; + } + case RecordTypeInts.FTYP: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + item.ForcedLocRefTypes = + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation>.Instance.Parse( + reader: frame.SpawnWithLength(contentLength), + transl: FormLinkBinaryTranslation.Instance.Parse) + .CastExtendedList>(); + return (int)Container_FieldIndex.ForcedLocRefTypes; + } + case RecordTypeInts.NTRM: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + item.NativeTerminal.SetTo(FormLinkBinaryTranslation.Instance.Parse(reader: frame)); + return (int)Container_FieldIndex.NativeTerminal; + } + case RecordTypeInts.PRPS: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + item.Properties = + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation.Instance.Parse( + reader: frame.SpawnWithLength(contentLength), + transl: ObjectProperty.TryCreateFromBinary) + .CastExtendedList(); + return (int)Container_FieldIndex.Properties; + } + case RecordTypeInts.APPR: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + item.AttachParentSlots = + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation>.Instance.Parse( + reader: frame.SpawnWithLength(contentLength), + transl: FormLinkBinaryTranslation.Instance.Parse) + .CastExtendedList>(); + return (int)Container_FieldIndex.AttachParentSlots; + } + case RecordTypeInts.STOP: + { + frame.ReadSubrecord(); + return default(int?); + } + case RecordTypeInts.WED0: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; // Skip header + item.OpenSound = Mutagen.Bethesda.Starfield.SoundReference.CreateFromBinary(frame: frame); + return (int)Container_FieldIndex.OpenSound; + } + case RecordTypeInts.WED1: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; // Skip header + item.CloseSound = Mutagen.Bethesda.Starfield.SoundReference.CreateFromBinary(frame: frame); + return (int)Container_FieldIndex.CloseSound; + } + case RecordTypeInts.ONAM: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + item.DisplayFilter.SetTo(FormLinkBinaryTranslation.Instance.Parse(reader: frame)); + return (int)Container_FieldIndex.DisplayFilter; + } + case RecordTypeInts.XXXX: + { + var overflowHeader = frame.ReadSubrecord(); + return ParseResult.OverrideLength(BinaryPrimitives.ReadUInt32LittleEndian(overflowHeader.Content)); + } + default: + return StarfieldMajorRecordBinaryCreateTranslation.FillBinaryRecordTypes( + item: item, + frame: frame, + lastParsed: lastParsed, + recordParseCount: recordParseCount, + nextRecordType: nextRecordType, + contentLength: contentLength, + translationParams: translationParams.WithNoConverter()); + } + } + } } @@ -1275,6 +4288,8 @@ internal partial class ContainerBinaryOverlay : void IPrintable.Print(StructuredStringBuilder sb, string? name) => this.Print(sb, name); + public override IEnumerable EnumerateFormLinks() => ContainerCommon.Instance.EnumerateFormLinks(this); + public override IEnumerable EnumerateAssetLinks(AssetLinkQuery queryCategories, IAssetLinkCache? linkCache, Type? assetType) => ContainerCommon.Instance.EnumerateAssetLinks(this, queryCategories, linkCache, assetType); [DebuggerBrowsable(DebuggerBrowsableState.Never)] protected override object BinaryWriteTranslator => ContainerBinaryWriteTranslation.Instance; void IBinaryItem.WriteToBinary( @@ -1288,7 +4303,82 @@ void IBinaryItem.WriteToBinary( } protected override Type LinkType => typeof(IContainer); + public Container.MajorFlag MajorFlags => (Container.MajorFlag)this.MajorRecordFlagsRaw; + #region VirtualMachineAdapter + private int? _VirtualMachineAdapterLengthOverride; + private RangeInt32? _VirtualMachineAdapterLocation; + public IVirtualMachineAdapterGetter? VirtualMachineAdapter => _VirtualMachineAdapterLocation.HasValue ? VirtualMachineAdapterBinaryOverlay.VirtualMachineAdapterFactory(_recordData.Slice(_VirtualMachineAdapterLocation!.Value.Min), _package, TypedParseParams.FromLengthOverride(_VirtualMachineAdapterLengthOverride)) : default; + IAVirtualMachineAdapterGetter? IHaveVirtualMachineAdapterGetter.VirtualMachineAdapter => this.VirtualMachineAdapter; + #endregion + #region ObjectBounds + private RangeInt32? _ObjectBoundsLocation; + private IObjectBoundsGetter? _ObjectBounds => _ObjectBoundsLocation.HasValue ? ObjectBoundsBinaryOverlay.ObjectBoundsFactory(_recordData.Slice(_ObjectBoundsLocation!.Value.Min), _package) : default; + public IObjectBoundsGetter ObjectBounds => _ObjectBounds ?? new ObjectBounds(); + #endregion + #region ODTY + private int? _ODTYLocation; + public Single? ODTY => _ODTYLocation.HasValue ? HeaderTranslation.ExtractSubrecordMemory(_recordData, _ODTYLocation.Value, _package.MetaData.Constants).Float() : default(Single?); + #endregion + #region ObjectPlacementDefaults + private RangeInt32? _ObjectPlacementDefaultsLocation; + public IObjectPlacementDefaultsGetter? ObjectPlacementDefaults => _ObjectPlacementDefaultsLocation.HasValue ? ObjectPlacementDefaultsBinaryOverlay.ObjectPlacementDefaultsFactory(_recordData.Slice(_ObjectPlacementDefaultsLocation!.Value.Min), _package) : default; + #endregion + #region XALG + private int? _XALGLocation; + public ReadOnlyMemorySlice? XALG => _XALGLocation.HasValue ? HeaderTranslation.ExtractSubrecordMemory(_recordData, _XALGLocation.Value, _package.MetaData.Constants) : default(ReadOnlyMemorySlice?); + #endregion + #region Transforms + private RangeInt32? _TransformsLocation; + public ITransformsGetter? Transforms => _TransformsLocation.HasValue ? TransformsBinaryOverlay.TransformsFactory(_recordData.Slice(_TransformsLocation!.Value.Min), _package) : default; + #endregion + #region SnapTemplate + private int? _SnapTemplateLocation; + public IFormLinkNullableGetter SnapTemplate => _SnapTemplateLocation.HasValue ? new FormLinkNullable(FormKey.Factory(_package.MetaData.MasterReferences!, BinaryPrimitives.ReadUInt32LittleEndian(HeaderTranslation.ExtractSubrecordMemory(_recordData, _SnapTemplateLocation.Value, _package.MetaData.Constants)))) : FormLinkNullable.Null; + #endregion + #region SnapBehavior + private int? _SnapBehaviorLocation; + public IFormLinkNullableGetter SnapBehavior => _SnapBehaviorLocation.HasValue ? new FormLinkNullable(FormKey.Factory(_package.MetaData.MasterReferences!, BinaryPrimitives.ReadUInt32LittleEndian(HeaderTranslation.ExtractSubrecordMemory(_recordData, _SnapBehaviorLocation.Value, _package.MetaData.Constants)))) : FormLinkNullable.Null; + #endregion + public IReadOnlyList Components { get; private set; } = Array.Empty(); + #region Name + private int? _NameLocation; + public ITranslatedStringGetter? Name => _NameLocation.HasValue ? StringBinaryTranslation.Instance.Parse(HeaderTranslation.ExtractSubrecordMemory(_recordData, _NameLocation.Value, _package.MetaData.Constants), StringsSource.Normal, parsingBundle: _package.MetaData) : default(TranslatedString?); + #region Aspects + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + string INamedRequiredGetter.Name => this.Name?.String ?? string.Empty; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + string? INamedGetter.Name => this.Name?.String; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + ITranslatedStringGetter ITranslatedNamedRequiredGetter.Name => this.Name ?? TranslatedString.Empty; + #endregion + #endregion + public IModelGetter? Model { get; private set; } + public IReadOnlyList? Items { get; private set; } + public IDestructibleGetter? Destructible { get; private set; } + private RangeInt32? _DATALocation; + #region Flags + private int _FlagsLocation => _DATALocation!.Value.Min; + private bool _Flags_IsSet => _DATALocation.HasValue; + public Container.Flag Flags => _Flags_IsSet ? (Container.Flag)_recordData.Span.Slice(_FlagsLocation, 0x1)[0] : default; + #endregion + #region Keywords + public IReadOnlyList>? Keywords { get; private set; } + IReadOnlyList>? IKeywordedGetter.Keywords => this.Keywords; + #endregion + public IReadOnlyList>? ForcedLocRefTypes { get; private set; } + #region NativeTerminal + private int? _NativeTerminalLocation; + public IFormLinkNullableGetter NativeTerminal => _NativeTerminalLocation.HasValue ? new FormLinkNullable(FormKey.Factory(_package.MetaData.MasterReferences!, BinaryPrimitives.ReadUInt32LittleEndian(HeaderTranslation.ExtractSubrecordMemory(_recordData, _NativeTerminalLocation.Value, _package.MetaData.Constants)))) : FormLinkNullable.Null; + #endregion + public IReadOnlyList? Properties { get; private set; } + public IReadOnlyList>? AttachParentSlots { get; private set; } + public ISoundReferenceGetter? OpenSound { get; private set; } + public ISoundReferenceGetter? CloseSound { get; private set; } + #region DisplayFilter + private int? _DisplayFilterLocation; + public IFormLinkNullableGetter DisplayFilter => _DisplayFilterLocation.HasValue ? new FormLinkNullable(FormKey.Factory(_package.MetaData.MasterReferences!, BinaryPrimitives.ReadUInt32LittleEndian(HeaderTranslation.ExtractSubrecordMemory(_recordData, _DisplayFilterLocation.Value, _package.MetaData.Constants)))) : FormLinkNullable.Null; + #endregion partial void CustomFactoryEnd( OverlayStream stream, int finalPos, @@ -1346,6 +4436,219 @@ public static IContainerGetter ContainerFactory( translationParams: translationParams); } + public override ParseResult FillRecordType( + OverlayStream stream, + int finalPos, + int offset, + RecordType type, + PreviousParse lastParsed, + Dictionary? recordParseCount, + TypedParseParams translationParams = default) + { + type = translationParams.ConvertToStandard(type); + switch (type.TypeInt) + { + case RecordTypeInts.VMAD: + { + _VirtualMachineAdapterLocation = new RangeInt32((stream.Position - offset), finalPos - offset); + _VirtualMachineAdapterLengthOverride = lastParsed.LengthOverride; + if (lastParsed.LengthOverride.HasValue) + { + stream.Position += lastParsed.LengthOverride.Value; + } + return (int)Container_FieldIndex.VirtualMachineAdapter; + } + case RecordTypeInts.OBND: + { + _ObjectBoundsLocation = new RangeInt32((stream.Position - offset), finalPos - offset); + return (int)Container_FieldIndex.ObjectBounds; + } + case RecordTypeInts.ODTY: + { + _ODTYLocation = (stream.Position - offset); + return (int)Container_FieldIndex.ODTY; + } + case RecordTypeInts.OPDS: + { + _ObjectPlacementDefaultsLocation = new RangeInt32((stream.Position - offset), finalPos - offset); + return (int)Container_FieldIndex.ObjectPlacementDefaults; + } + case RecordTypeInts.XALG: + { + _XALGLocation = (stream.Position - offset); + return (int)Container_FieldIndex.XALG; + } + case RecordTypeInts.PTT2: + { + _TransformsLocation = new RangeInt32((stream.Position - offset), finalPos - offset); + return (int)Container_FieldIndex.Transforms; + } + case RecordTypeInts.SNTP: + { + _SnapTemplateLocation = (stream.Position - offset); + return (int)Container_FieldIndex.SnapTemplate; + } + case RecordTypeInts.SNBH: + { + _SnapBehaviorLocation = (stream.Position - offset); + return (int)Container_FieldIndex.SnapBehavior; + } + case RecordTypeInts.BFCB: + { + this.Components = this.ParseRepeatedTypelessSubrecord( + stream: stream, + translationParams: translationParams, + trigger: AComponent_Registration.TriggerSpecs, + factory: AComponentBinaryOverlay.AComponentFactory); + return (int)Container_FieldIndex.Components; + } + case RecordTypeInts.FULL: + { + _NameLocation = (stream.Position - offset); + return (int)Container_FieldIndex.Name; + } + case RecordTypeInts.MODL: + case RecordTypeInts.MODT: + case RecordTypeInts.MOLM: + case RecordTypeInts.FLLD: + case RecordTypeInts.XFLG: + case RecordTypeInts.MODC: + case RecordTypeInts.MODF: + { + this.Model = ModelBinaryOverlay.ModelFactory( + stream: stream, + package: _package, + translationParams: translationParams.DoNotShortCircuit()); + return (int)Container_FieldIndex.Model; + } + case RecordTypeInts.CNTO: + case RecordTypeInts.COCT: + { + this.Items = BinaryOverlayList.FactoryByCountPerItem( + stream: stream, + package: _package, + countLength: 4, + trigger: ContainerEntry_Registration.TriggerSpecs, + countType: RecordTypes.COCT, + translationParams: translationParams, + getter: (s, p, recConv) => ContainerEntryBinaryOverlay.ContainerEntryFactory(new OverlayStream(s, p), p, recConv), + skipHeader: false); + return (int)Container_FieldIndex.Items; + } + case RecordTypeInts.DEST: + case RecordTypeInts.DAMC: + case RecordTypeInts.DSDL: + case RecordTypeInts.DSTD: + { + this.Destructible = DestructibleBinaryOverlay.DestructibleFactory( + stream: stream, + package: _package, + translationParams: translationParams.DoNotShortCircuit()); + return (int)Container_FieldIndex.Destructible; + } + case RecordTypeInts.DATA: + { + _DATALocation = new((stream.Position - offset) + _package.MetaData.Constants.SubConstants.TypeAndLengthLength, finalPos - offset - 1); + return (int)Container_FieldIndex.Flags; + } + case RecordTypeInts.KSIZ: + case RecordTypeInts.KWDA: + { + this.Keywords = BinaryOverlayList.FactoryByCount>( + stream: stream, + package: _package, + itemLength: 0x4, + countLength: 4, + countType: RecordTypes.KSIZ, + trigger: RecordTypes.KWDA, + getter: (s, p) => new FormLink(FormKey.Factory(p.MetaData.MasterReferences!, BinaryPrimitives.ReadUInt32LittleEndian(s)))); + return (int)Container_FieldIndex.Keywords; + } + case RecordTypeInts.FTYP: + { + var subMeta = stream.ReadSubrecordHeader(); + var subLen = finalPos - stream.Position; + this.ForcedLocRefTypes = BinaryOverlayList.FactoryByStartIndex>( + mem: stream.RemainingMemory.Slice(0, subLen), + package: _package, + itemLength: 4, + getter: (s, p) => new FormLink(FormKey.Factory(p.MetaData.MasterReferences!, BinaryPrimitives.ReadUInt32LittleEndian(s)))); + stream.Position += subLen; + return (int)Container_FieldIndex.ForcedLocRefTypes; + } + case RecordTypeInts.NTRM: + { + _NativeTerminalLocation = (stream.Position - offset); + return (int)Container_FieldIndex.NativeTerminal; + } + case RecordTypeInts.PRPS: + { + var subMeta = stream.ReadSubrecordHeader(); + var subLen = finalPos - stream.Position; + this.Properties = BinaryOverlayList.FactoryByStartIndex( + mem: stream.RemainingMemory.Slice(0, subLen), + package: _package, + itemLength: 12, + getter: (s, p) => ObjectPropertyBinaryOverlay.ObjectPropertyFactory(s, p)); + stream.Position += subLen; + return (int)Container_FieldIndex.Properties; + } + case RecordTypeInts.APPR: + { + var subMeta = stream.ReadSubrecordHeader(); + var subLen = finalPos - stream.Position; + this.AttachParentSlots = BinaryOverlayList.FactoryByStartIndex>( + mem: stream.RemainingMemory.Slice(0, subLen), + package: _package, + itemLength: 4, + getter: (s, p) => new FormLink(FormKey.Factory(p.MetaData.MasterReferences!, BinaryPrimitives.ReadUInt32LittleEndian(s)))); + stream.Position += subLen; + return (int)Container_FieldIndex.AttachParentSlots; + } + case RecordTypeInts.STOP: + { + stream.ReadSubrecord(); + return default(int?); + } + case RecordTypeInts.WED0: + { + stream.Position += _package.MetaData.Constants.SubConstants.HeaderLength; + this.OpenSound = SoundReferenceBinaryOverlay.SoundReferenceFactory( + stream: stream, + package: _package, + translationParams: translationParams.DoNotShortCircuit()); + return (int)Container_FieldIndex.OpenSound; + } + case RecordTypeInts.WED1: + { + stream.Position += _package.MetaData.Constants.SubConstants.HeaderLength; + this.CloseSound = SoundReferenceBinaryOverlay.SoundReferenceFactory( + stream: stream, + package: _package, + translationParams: translationParams.DoNotShortCircuit()); + return (int)Container_FieldIndex.CloseSound; + } + case RecordTypeInts.ONAM: + { + _DisplayFilterLocation = (stream.Position - offset); + return (int)Container_FieldIndex.DisplayFilter; + } + case RecordTypeInts.XXXX: + { + var overflowHeader = stream.ReadSubrecord(); + return ParseResult.OverrideLength(BinaryPrimitives.ReadUInt32LittleEndian(overflowHeader.Content)); + } + default: + return base.FillRecordType( + stream: stream, + finalPos: finalPos, + offset: offset, + type: type, + lastParsed: lastParsed, + recordParseCount: recordParseCount, + translationParams: translationParams.WithNoConverter()); + } + } #region To String public override void Print( diff --git a/Mutagen.Bethesda.Starfield/Records/ProtocolDefinition_Starfield.cs b/Mutagen.Bethesda.Starfield/Records/ProtocolDefinition_Starfield.cs index 76fd532d3a..17ebf6fdb3 100644 --- a/Mutagen.Bethesda.Starfield/Records/ProtocolDefinition_Starfield.cs +++ b/Mutagen.Bethesda.Starfield/Records/ProtocolDefinition_Starfield.cs @@ -132,6 +132,8 @@ public static void Register() DialogBranch_Registration.Instance, DialogResponses_Registration.Instance, DialogTopic_Registration.Instance, + DisplayCaseComponent_Registration.Instance, + DisplayCaseComponentItem_Registration.Instance, DoesNotExistConditionData_Registration.Instance, Door_Registration.Instance, DoorTriangle_Registration.Instance, diff --git a/Mutagen.Bethesda.Starfield/Records/RecordTypeInts_Generated.cs b/Mutagen.Bethesda.Starfield/Records/RecordTypeInts_Generated.cs index 7ae3129c03..7e5230d6b0 100644 --- a/Mutagen.Bethesda.Starfield/Records/RecordTypeInts_Generated.cs +++ b/Mutagen.Bethesda.Starfield/Records/RecordTypeInts_Generated.cs @@ -135,6 +135,8 @@ public partial class RecordTypeInts public const int DAMA = 0x414D4144; public const int DAMC = 0x434D4144; public const int DATA = 0x41544144; + public const int DCED = 0x44454344; + public const int DCSD = 0x44534344; public const int DEBR = 0x52424544; public const int DELE = 0x454C4544; public const int DENS = 0x534E4544; diff --git a/Mutagen.Bethesda.Starfield/Records/RecordTypes_Generated.cs b/Mutagen.Bethesda.Starfield/Records/RecordTypes_Generated.cs index c042be23b0..635161a60c 100644 --- a/Mutagen.Bethesda.Starfield/Records/RecordTypes_Generated.cs +++ b/Mutagen.Bethesda.Starfield/Records/RecordTypes_Generated.cs @@ -137,6 +137,8 @@ public partial class RecordTypes public static readonly RecordType DAMA = new(0x414D4144); public static readonly RecordType DAMC = new(0x434D4144); public static readonly RecordType DATA = new(0x41544144); + public static readonly RecordType DCED = new(0x44454344); + public static readonly RecordType DCSD = new(0x44534344); public static readonly RecordType DEBR = new(0x52424544); public static readonly RecordType DELE = new(0x454C4544); public static readonly RecordType DENS = new(0x534E4544); diff --git a/Mutagen.Bethesda.Starfield/Records/StarfieldMod.xml b/Mutagen.Bethesda.Starfield/Records/StarfieldMod.xml index 768a55a5c7..3d187700b8 100644 --- a/Mutagen.Bethesda.Starfield/Records/StarfieldMod.xml +++ b/Mutagen.Bethesda.Starfield/Records/StarfieldMod.xml @@ -31,6 +31,7 @@ + diff --git a/Mutagen.Bethesda.Starfield/Records/StarfieldMod_Generated.cs b/Mutagen.Bethesda.Starfield/Records/StarfieldMod_Generated.cs index 703da3da37..9c339dcfcc 100644 --- a/Mutagen.Bethesda.Starfield/Records/StarfieldMod_Generated.cs +++ b/Mutagen.Bethesda.Starfield/Records/StarfieldMod_Generated.cs @@ -89,6 +89,7 @@ protected StarfieldMod() _Curve3Ds_Object = new StarfieldGroup(this); _Armors_Object = new StarfieldGroup(this); _Books_Object = new StarfieldGroup(this); + _Containers_Object = new StarfieldGroup(this); _Weapons_Object = new StarfieldGroup(this); _Perks_Object = new StarfieldGroup(this); _ConstructibleObjects_Object = new StarfieldGroup(this); @@ -321,6 +322,13 @@ protected StarfieldMod() [DebuggerBrowsable(DebuggerBrowsableState.Never)] IStarfieldGroupGetter IStarfieldModGetter.Books => _Books_Object; #endregion + #region Containers + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private StarfieldGroup _Containers_Object; + public StarfieldGroup Containers => _Containers_Object; + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IStarfieldGroupGetter IStarfieldModGetter.Containers => _Containers_Object; + #endregion #region Weapons [DebuggerBrowsable(DebuggerBrowsableState.Never)] private StarfieldGroup _Weapons_Object; @@ -557,6 +565,7 @@ public Mask(TItem initialValue) this.Curve3Ds = new MaskItem?>(initialValue, new StarfieldGroup.Mask(initialValue)); this.Armors = new MaskItem?>(initialValue, new StarfieldGroup.Mask(initialValue)); this.Books = new MaskItem?>(initialValue, new StarfieldGroup.Mask(initialValue)); + this.Containers = new MaskItem?>(initialValue, new StarfieldGroup.Mask(initialValue)); this.Weapons = new MaskItem?>(initialValue, new StarfieldGroup.Mask(initialValue)); this.Perks = new MaskItem?>(initialValue, new StarfieldGroup.Mask(initialValue)); this.ConstructibleObjects = new MaskItem?>(initialValue, new StarfieldGroup.Mask(initialValue)); @@ -613,6 +622,7 @@ public Mask( TItem Curve3Ds, TItem Armors, TItem Books, + TItem Containers, TItem Weapons, TItem Perks, TItem ConstructibleObjects, @@ -667,6 +677,7 @@ public Mask( this.Curve3Ds = new MaskItem?>(Curve3Ds, new StarfieldGroup.Mask(Curve3Ds)); this.Armors = new MaskItem?>(Armors, new StarfieldGroup.Mask(Armors)); this.Books = new MaskItem?>(Books, new StarfieldGroup.Mask(Books)); + this.Containers = new MaskItem?>(Containers, new StarfieldGroup.Mask(Containers)); this.Weapons = new MaskItem?>(Weapons, new StarfieldGroup.Mask(Weapons)); this.Perks = new MaskItem?>(Perks, new StarfieldGroup.Mask(Perks)); this.ConstructibleObjects = new MaskItem?>(ConstructibleObjects, new StarfieldGroup.Mask(ConstructibleObjects)); @@ -731,6 +742,7 @@ protected Mask() public MaskItem?>? Curve3Ds { get; set; } public MaskItem?>? Armors { get; set; } public MaskItem?>? Books { get; set; } + public MaskItem?>? Containers { get; set; } public MaskItem?>? Weapons { get; set; } public MaskItem?>? Perks { get; set; } public MaskItem?>? ConstructibleObjects { get; set; } @@ -796,6 +808,7 @@ public bool Equals(Mask? rhs) if (!object.Equals(this.Curve3Ds, rhs.Curve3Ds)) return false; if (!object.Equals(this.Armors, rhs.Armors)) return false; if (!object.Equals(this.Books, rhs.Books)) return false; + if (!object.Equals(this.Containers, rhs.Containers)) return false; if (!object.Equals(this.Weapons, rhs.Weapons)) return false; if (!object.Equals(this.Perks, rhs.Perks)) return false; if (!object.Equals(this.ConstructibleObjects, rhs.ConstructibleObjects)) return false; @@ -854,6 +867,7 @@ public override int GetHashCode() hash.Add(this.Curve3Ds); hash.Add(this.Armors); hash.Add(this.Books); + hash.Add(this.Containers); hash.Add(this.Weapons); hash.Add(this.Perks); hash.Add(this.ConstructibleObjects); @@ -1031,6 +1045,11 @@ public bool All(Func eval) if (!eval(this.Books.Overall)) return false; if (this.Books.Specific != null && !this.Books.Specific.All(eval)) return false; } + if (Containers != null) + { + if (!eval(this.Containers.Overall)) return false; + if (this.Containers.Specific != null && !this.Containers.Specific.All(eval)) return false; + } if (Weapons != null) { if (!eval(this.Weapons.Overall)) return false; @@ -1303,6 +1322,11 @@ public bool Any(Func eval) if (eval(this.Books.Overall)) return true; if (this.Books.Specific != null && this.Books.Specific.Any(eval)) return true; } + if (Containers != null) + { + if (eval(this.Containers.Overall)) return true; + if (this.Containers.Specific != null && this.Containers.Specific.Any(eval)) return true; + } if (Weapons != null) { if (eval(this.Weapons.Overall)) return true; @@ -1466,6 +1490,7 @@ protected void Translate_InternalFill(Mask obj, Func eval) obj.Curve3Ds = this.Curve3Ds == null ? null : new MaskItem?>(eval(this.Curve3Ds.Overall), this.Curve3Ds.Specific?.Translate(eval)); obj.Armors = this.Armors == null ? null : new MaskItem?>(eval(this.Armors.Overall), this.Armors.Specific?.Translate(eval)); obj.Books = this.Books == null ? null : new MaskItem?>(eval(this.Books.Overall), this.Books.Specific?.Translate(eval)); + obj.Containers = this.Containers == null ? null : new MaskItem?>(eval(this.Containers.Overall), this.Containers.Specific?.Translate(eval)); obj.Weapons = this.Weapons == null ? null : new MaskItem?>(eval(this.Weapons.Overall), this.Weapons.Specific?.Translate(eval)); obj.Perks = this.Perks == null ? null : new MaskItem?>(eval(this.Perks.Overall), this.Perks.Specific?.Translate(eval)); obj.ConstructibleObjects = this.ConstructibleObjects == null ? null : new MaskItem?>(eval(this.ConstructibleObjects.Overall), this.ConstructibleObjects.Specific?.Translate(eval)); @@ -1624,6 +1649,10 @@ public void Print(StructuredStringBuilder sb, StarfieldMod.Mask? printMask { Books?.Print(sb); } + if (printMask?.Containers?.Overall ?? true) + { + Containers?.Print(sb); + } if (printMask?.Weapons?.Overall ?? true) { Weapons?.Print(sb); @@ -1773,6 +1802,7 @@ public List Warnings public MaskItem?>? Curve3Ds; public MaskItem?>? Armors; public MaskItem?>? Books; + public MaskItem?>? Containers; public MaskItem?>? Weapons; public MaskItem?>? Perks; public MaskItem?>? ConstructibleObjects; @@ -1863,6 +1893,8 @@ public List Warnings return Armors; case StarfieldMod_FieldIndex.Books: return Books; + case StarfieldMod_FieldIndex.Containers: + return Containers; case StarfieldMod_FieldIndex.Weapons: return Weapons; case StarfieldMod_FieldIndex.Perks: @@ -2008,6 +2040,9 @@ public void SetNthException(int index, Exception ex) case StarfieldMod_FieldIndex.Books: this.Books = new MaskItem?>(ex, null); break; + case StarfieldMod_FieldIndex.Containers: + this.Containers = new MaskItem?>(ex, null); + break; case StarfieldMod_FieldIndex.Weapons: this.Weapons = new MaskItem?>(ex, null); break; @@ -2177,6 +2212,9 @@ public void SetNthMask(int index, object obj) case StarfieldMod_FieldIndex.Books: this.Books = (MaskItem?>?)obj; break; + case StarfieldMod_FieldIndex.Containers: + this.Containers = (MaskItem?>?)obj; + break; case StarfieldMod_FieldIndex.Weapons: this.Weapons = (MaskItem?>?)obj; break; @@ -2286,6 +2324,7 @@ public bool IsInError() if (Curve3Ds != null) return true; if (Armors != null) return true; if (Books != null) return true; + if (Containers != null) return true; if (Weapons != null) return true; if (Perks != null) return true; if (ConstructibleObjects != null) return true; @@ -2364,6 +2403,7 @@ protected void PrintFillInternal(StructuredStringBuilder sb) Curve3Ds?.Print(sb); Armors?.Print(sb); Books?.Print(sb); + Containers?.Print(sb); Weapons?.Print(sb); Perks?.Print(sb); ConstructibleObjects?.Print(sb); @@ -2425,6 +2465,7 @@ public ErrorMask Combine(ErrorMask? rhs) ret.Curve3Ds = this.Curve3Ds.Combine(rhs.Curve3Ds, (l, r) => l.Combine(r)); ret.Armors = this.Armors.Combine(rhs.Armors, (l, r) => l.Combine(r)); ret.Books = this.Books.Combine(rhs.Books, (l, r) => l.Combine(r)); + ret.Containers = this.Containers.Combine(rhs.Containers, (l, r) => l.Combine(r)); ret.Weapons = this.Weapons.Combine(rhs.Weapons, (l, r) => l.Combine(r)); ret.Perks = this.Perks.Combine(rhs.Perks, (l, r) => l.Combine(r)); ret.ConstructibleObjects = this.ConstructibleObjects.Combine(rhs.ConstructibleObjects, (l, r) => l.Combine(r)); @@ -2501,6 +2542,7 @@ public class TranslationMask : ITranslationMask public StarfieldGroup.TranslationMask? Curve3Ds; public StarfieldGroup.TranslationMask? Armors; public StarfieldGroup.TranslationMask? Books; + public StarfieldGroup.TranslationMask? Containers; public StarfieldGroup.TranslationMask? Weapons; public StarfieldGroup.TranslationMask? Perks; public StarfieldGroup.TranslationMask? ConstructibleObjects; @@ -2578,6 +2620,7 @@ protected void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)> ret) ret.Add((Curve3Ds != null ? Curve3Ds.OnOverall : DefaultOn, Curve3Ds?.GetCrystal())); ret.Add((Armors != null ? Armors.OnOverall : DefaultOn, Armors?.GetCrystal())); ret.Add((Books != null ? Books.OnOverall : DefaultOn, Books?.GetCrystal())); + ret.Add((Containers != null ? Containers.OnOverall : DefaultOn, Containers?.GetCrystal())); ret.Add((Weapons != null ? Weapons.OnOverall : DefaultOn, Weapons?.GetCrystal())); ret.Add((Perks != null ? Perks.OnOverall : DefaultOn, Perks?.GetCrystal())); ret.Add((ConstructibleObjects != null ? ConstructibleObjects.OnOverall : DefaultOn, ConstructibleObjects?.GetCrystal())); @@ -2677,6 +2720,7 @@ public StarfieldMod( _Curve3Ds_Object = new StarfieldGroup(this); _Armors_Object = new StarfieldGroup(this); _Books_Object = new StarfieldGroup(this); + _Containers_Object = new StarfieldGroup(this); _Weapons_Object = new StarfieldGroup(this); _Perks_Object = new StarfieldGroup(this); _ConstructibleObjects_Object = new StarfieldGroup(this); @@ -2819,6 +2863,10 @@ public void AddRecords( { this.Books.RecordCache.Set(rhsMod.Books.RecordCache.Items); } + if (mask?.Containers ?? true) + { + this.Containers.RecordCache.Set(rhsMod.Containers.RecordCache.Items); + } if (mask?.Weapons ?? true) { this.Weapons.RecordCache.Set(rhsMod.Weapons.RecordCache.Items); @@ -2953,6 +3001,7 @@ public uint GetRecordCount() count += Curve3Ds.RecordCache.Count > 0 ? 1 : default(uint); count += Armors.RecordCache.Count > 0 ? 1 : default(uint); count += Books.RecordCache.Count > 0 ? 1 : default(uint); + count += Containers.RecordCache.Count > 0 ? 1 : default(uint); count += Weapons.RecordCache.Count > 0 ? 1 : default(uint); count += Perks.RecordCache.Count > 0 ? 1 : default(uint); count += ConstructibleObjects.RecordCache.Count > 0 ? 1 : default(uint); @@ -3279,6 +3328,7 @@ public partial interface IStarfieldMod : new StarfieldGroup Curve3Ds { get; } new StarfieldGroup Armors { get; } new StarfieldGroup Books { get; } + new StarfieldGroup Containers { get; } new StarfieldGroup Weapons { get; } new StarfieldGroup Perks { get; } new StarfieldGroup ConstructibleObjects { get; } @@ -3351,6 +3401,7 @@ public partial interface IStarfieldModGetter : IStarfieldGroupGetter Curve3Ds { get; } IStarfieldGroupGetter Armors { get; } IStarfieldGroupGetter Books { get; } + IStarfieldGroupGetter Containers { get; } IStarfieldGroupGetter Weapons { get; } IStarfieldGroupGetter Perks { get; } IStarfieldGroupGetter ConstructibleObjects { get; } @@ -3985,30 +4036,31 @@ internal enum StarfieldMod_FieldIndex Curve3Ds = 26, Armors = 27, Books = 28, - Weapons = 29, - Perks = 30, - ConstructibleObjects = 31, - StaticCollections = 32, - BendableSplines = 33, - LeveledItems = 34, - Weathers = 35, - FormLists = 36, - TerminalMenus = 37, - AnimatedObjects = 38, - Debris = 39, - DefaultObjects = 40, - Outfits = 41, - AimModels = 42, - AttractionRules = 43, - BiomeSwaps = 44, - Planets = 45, - SurfacePatternStyles = 46, - LegendaryItems = 47, - ActorValueModulations = 48, - MiscItems = 49, - Resources = 50, - ConditionRecords = 51, - Quests = 52, + Containers = 29, + Weapons = 30, + Perks = 31, + ConstructibleObjects = 32, + StaticCollections = 33, + BendableSplines = 34, + LeveledItems = 35, + Weathers = 36, + FormLists = 37, + TerminalMenus = 38, + AnimatedObjects = 39, + Debris = 40, + DefaultObjects = 41, + Outfits = 42, + AimModels = 43, + AttractionRules = 44, + BiomeSwaps = 45, + Planets = 46, + SurfacePatternStyles = 47, + LegendaryItems = 48, + ActorValueModulations = 49, + MiscItems = 50, + Resources = 51, + ConditionRecords = 52, + Quests = 53, } #endregion @@ -4019,9 +4071,9 @@ internal partial class StarfieldMod_Registration : ILoquiRegistration public static ProtocolKey ProtocolKey => ProtocolDefinition_Starfield.ProtocolKey; - public const ushort AdditionalFieldCount = 53; + public const ushort AdditionalFieldCount = 54; - public const ushort FieldCount = 53; + public const ushort FieldCount = 54; public static readonly Type MaskType = typeof(StarfieldMod.Mask<>); @@ -4116,6 +4168,7 @@ public void Clear(IStarfieldMod item) item.Curve3Ds.Clear(); item.Armors.Clear(); item.Books.Clear(); + item.Containers.Clear(); item.Weapons.Clear(); item.Perks.Clear(); item.ConstructibleObjects.Clear(); @@ -4166,6 +4219,7 @@ public void RemapLinks(IStarfieldMod obj, IReadOnlyDictionary obj.Activators.RemapLinks(mapping); obj.Armors.RemapLinks(mapping); obj.Books.RemapLinks(mapping); + obj.Containers.RemapLinks(mapping); obj.Weapons.RemapLinks(mapping); obj.Perks.RemapLinks(mapping); obj.ConstructibleObjects.RemapLinks(mapping); @@ -4247,6 +4301,7 @@ public void Remove( obj.Curve3Ds.Remove(keys); obj.Armors.Remove(keys); obj.Books.Remove(keys); + obj.Containers.Remove(keys); obj.Weapons.Remove(keys); obj.Perks.Remove(keys); obj.ConstructibleObjects.Remove(keys); @@ -4534,6 +4589,14 @@ public void Remove( type: type, keys: keys); break; + case "Container": + case "IContainerGetter": + case "IContainer": + case "IContainerInternal": + obj.Containers.Remove( + type: type, + keys: keys); + break; case "Weapon": case "IWeaponGetter": case "IWeapon": @@ -4736,6 +4799,7 @@ public void Remove( Remove(obj, keys, typeof(IActivatorGetter), throwIfUnknown: throwIfUnknown); Remove(obj, keys, typeof(IArmorGetter), throwIfUnknown: throwIfUnknown); Remove(obj, keys, typeof(IBookGetter), throwIfUnknown: throwIfUnknown); + Remove(obj, keys, typeof(IContainerGetter), throwIfUnknown: throwIfUnknown); Remove(obj, keys, typeof(IFormListGetter), throwIfUnknown: throwIfUnknown); Remove(obj, keys, typeof(ILeveledItemGetter), throwIfUnknown: throwIfUnknown); Remove(obj, keys, typeof(IMiscItemGetter), throwIfUnknown: throwIfUnknown); @@ -4745,6 +4809,7 @@ public void Remove( case "IStaticTargetGetter": Remove(obj, keys, typeof(IActivatorGetter), throwIfUnknown: throwIfUnknown); Remove(obj, keys, typeof(IBookGetter), throwIfUnknown: throwIfUnknown); + Remove(obj, keys, typeof(IContainerGetter), throwIfUnknown: throwIfUnknown); Remove(obj, keys, typeof(IMiscItemGetter), throwIfUnknown: throwIfUnknown); Remove(obj, keys, typeof(IWeaponGetter), throwIfUnknown: throwIfUnknown); break; @@ -4753,6 +4818,7 @@ public void Remove( Remove(obj, keys, typeof(IActivatorGetter), throwIfUnknown: throwIfUnknown); Remove(obj, keys, typeof(IArmorGetter), throwIfUnknown: throwIfUnknown); Remove(obj, keys, typeof(IBookGetter), throwIfUnknown: throwIfUnknown); + Remove(obj, keys, typeof(IContainerGetter), throwIfUnknown: throwIfUnknown); Remove(obj, keys, typeof(ILegendaryItemGetter), throwIfUnknown: throwIfUnknown); Remove(obj, keys, typeof(ILeveledItemGetter), throwIfUnknown: throwIfUnknown); Remove(obj, keys, typeof(IMiscItemGetter), throwIfUnknown: throwIfUnknown); @@ -4908,6 +4974,13 @@ public IEnumerable EnumerateListedAssetLinks(IStarfieldMod obj) yield return item; } } + if (obj.Containers is IAssetLinkContainer ContainerslinkCont) + { + foreach (var item in ContainerslinkCont.EnumerateListedAssetLinks()) + { + yield return item; + } + } if (obj.Weapons is IAssetLinkContainer WeaponslinkCont) { foreach (var item in WeaponslinkCont.EnumerateListedAssetLinks()) @@ -5035,6 +5108,7 @@ public void RemapAssetLinks( obj.Activators.RemapAssetLinks(mapping, queryCategories, linkCache); obj.Armors.RemapAssetLinks(mapping, queryCategories, linkCache); obj.Books.RemapAssetLinks(mapping, queryCategories, linkCache); + obj.Containers.RemapAssetLinks(mapping, queryCategories, linkCache); obj.Weapons.RemapAssetLinks(mapping, queryCategories, linkCache); obj.Perks.RemapAssetLinks(mapping, queryCategories, linkCache); obj.ConstructibleObjects.RemapAssetLinks(mapping, queryCategories, linkCache); @@ -5124,6 +5198,7 @@ public void FillEqualsMask( ret.Curve3Ds = MaskItemExt.Factory(item.Curve3Ds.GetEqualsMask(rhs.Curve3Ds, include), include); ret.Armors = MaskItemExt.Factory(item.Armors.GetEqualsMask(rhs.Armors, include), include); ret.Books = MaskItemExt.Factory(item.Books.GetEqualsMask(rhs.Books, include), include); + ret.Containers = MaskItemExt.Factory(item.Containers.GetEqualsMask(rhs.Containers, include), include); ret.Weapons = MaskItemExt.Factory(item.Weapons.GetEqualsMask(rhs.Weapons, include), include); ret.Perks = MaskItemExt.Factory(item.Perks.GetEqualsMask(rhs.Perks, include), include); ret.ConstructibleObjects = MaskItemExt.Factory(item.ConstructibleObjects.GetEqualsMask(rhs.ConstructibleObjects, include), include); @@ -5308,6 +5383,10 @@ protected static void ToStringFields( { item.Books?.Print(sb, "Books"); } + if (printMask?.Containers?.Overall ?? true) + { + item.Containers?.Print(sb, "Containers"); + } if (printMask?.Weapons?.Overall ?? true) { item.Weapons?.Print(sb, "Weapons"); @@ -5645,6 +5724,14 @@ public virtual bool Equals( } else if (!isBooksEqual) return false; } + if ((equalsMask?.GetShouldTranslate((int)StarfieldMod_FieldIndex.Containers) ?? true)) + { + if (EqualsMaskHelper.RefEquality(lhs.Containers, rhs.Containers, out var lhsContainers, out var rhsContainers, out var isContainersEqual)) + { + if (!object.Equals(lhsContainers, rhsContainers)) return false; + } + else if (!isContainersEqual) return false; + } if ((equalsMask?.GetShouldTranslate((int)StarfieldMod_FieldIndex.Weapons) ?? true)) { if (EqualsMaskHelper.RefEquality(lhs.Weapons, rhs.Weapons, out var lhsWeapons, out var rhsWeapons, out var isWeaponsEqual)) @@ -5872,6 +5959,7 @@ public virtual int GetHashCode(IStarfieldModGetter item) hash.Add(item.Curve3Ds); hash.Add(item.Armors); hash.Add(item.Books); + hash.Add(item.Containers); hash.Add(item.Weapons); hash.Add(item.Perks); hash.Add(item.ConstructibleObjects); @@ -6054,6 +6142,11 @@ public object GetNew() case "IBook": case "IBookInternal": return obj.Books; + case "Container": + case "IContainerGetter": + case "IContainer": + case "IContainerInternal": + return obj.Containers; case "Weapon": case "IWeaponGetter": case "IWeapon": @@ -6200,7 +6293,7 @@ public static void WriteParallel( mod: item, modHeader: item.ModHeader.DeepCopy(), modKey: modKey); - Stream[] outputStreams = new Stream[52]; + Stream[] outputStreams = new Stream[53]; List toDo = new List(); toDo.Add(() => WriteGroupParallel(item.GameSettings, 0, outputStreams, bundle, parallelParam)); toDo.Add(() => WriteGroupParallel(item.Keywords, 1, outputStreams, bundle, parallelParam)); @@ -6230,30 +6323,31 @@ public static void WriteParallel( toDo.Add(() => WriteGroupParallel(item.Curve3Ds, 25, outputStreams, bundle, parallelParam)); toDo.Add(() => WriteGroupParallel(item.Armors, 26, outputStreams, bundle, parallelParam)); toDo.Add(() => WriteGroupParallel(item.Books, 27, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.Weapons, 28, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.Perks, 29, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.ConstructibleObjects, 30, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.StaticCollections, 31, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.BendableSplines, 32, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.LeveledItems, 33, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.Weathers, 34, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.FormLists, 35, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.TerminalMenus, 36, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.AnimatedObjects, 37, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.Debris, 38, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.DefaultObjects, 39, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.Outfits, 40, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.AimModels, 41, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.AttractionRules, 42, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.BiomeSwaps, 43, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.Planets, 44, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.SurfacePatternStyles, 45, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.LegendaryItems, 46, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.ActorValueModulations, 47, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.MiscItems, 48, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.Resources, 49, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.ConditionRecords, 50, outputStreams, bundle, parallelParam)); - toDo.Add(() => WriteGroupParallel(item.Quests, 51, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.Containers, 28, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.Weapons, 29, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.Perks, 30, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.ConstructibleObjects, 31, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.StaticCollections, 32, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.BendableSplines, 33, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.LeveledItems, 34, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.Weathers, 35, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.FormLists, 36, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.TerminalMenus, 37, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.AnimatedObjects, 38, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.Debris, 39, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.DefaultObjects, 40, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.Outfits, 41, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.AimModels, 42, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.AttractionRules, 43, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.BiomeSwaps, 44, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.Planets, 45, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.SurfacePatternStyles, 46, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.LegendaryItems, 47, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.ActorValueModulations, 48, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.MiscItems, 49, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.Resources, 50, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.ConditionRecords, 51, outputStreams, bundle, parallelParam)); + toDo.Add(() => WriteGroupParallel(item.Quests, 52, outputStreams, bundle, parallelParam)); Parallel.Invoke(parallelParam.ParallelOptions, toDo.ToArray()); PluginUtilityTranslation.CompileStreamsInto( outputStreams.NotNull(), @@ -6388,6 +6482,10 @@ public IEnumerable EnumerateFormLinks(IStarfieldModGetter obj) { yield return item; } + foreach (var item in obj.Containers.EnumerateFormLinks()) + { + yield return item; + } foreach (var item in obj.Weapons.EnumerateFormLinks()) { yield return item; @@ -6590,6 +6688,10 @@ public IEnumerable EnumerateMajorRecords(IStarfieldModGetter { yield return item; } + foreach (var item in obj.Containers.EnumerateMajorRecords()) + { + yield return item; + } foreach (var item in obj.Weapons.EnumerateMajorRecords()) { yield return item; @@ -6973,6 +7075,15 @@ public IEnumerable EnumerateMajorRecords( yield return item; } yield break; + case "Container": + case "IContainerGetter": + case "IContainer": + case "IContainerInternal": + foreach (var item in obj.Containers.EnumerateMajorRecords(type, throwIfUnknown: throwIfUnknown)) + { + yield return item; + } + yield break; case "Weapon": case "IWeaponGetter": case "IWeapon": @@ -7465,6 +7576,15 @@ public IEnumerable( + srcGroup: obj.Containers, + type: typeof(IContainerGetter), + modKey: obj.ModKey, + group: (m) => m.Containers, + groupGetter: (m) => m.Containers)) + { + yield return item; + } foreach (var item in InterfaceEnumerationHelper.EnumerateGroupContexts( srcGroup: obj.Weapons, type: typeof(IWeaponGetter), @@ -8104,6 +8224,20 @@ public IEnumerable( + srcGroup: obj.Containers, + type: type, + modKey: obj.ModKey, + group: (m) => m.Containers, + groupGetter: (m) => m.Containers)) + { + yield return item; + } + yield break; case "Weapon": case "IWeaponGetter": case "IWeapon": @@ -8548,6 +8682,13 @@ public IEnumerable EnumerateAssetLinks(IStarfieldModGetter obj yield return item; } } + if (obj.Containers is IAssetLinkContainerGetter ContainerslinkCont) + { + foreach (var item in ContainerslinkCont.EnumerateAssetLinks(queryCategories: queryCategories, linkCache: linkCache, assetType: assetType)) + { + yield return item; + } + } if (obj.Weapons is IAssetLinkContainerGetter WeaponslinkCont) { foreach (var item in WeaponslinkCont.EnumerateAssetLinks(queryCategories: queryCategories, linkCache: linkCache, assetType: assetType)) @@ -9240,6 +9381,26 @@ public void DeepCopyIn( errorMask?.PopIndex(); } } + if ((copyMask?.GetShouldTranslate((int)StarfieldMod_FieldIndex.Containers) ?? true)) + { + errorMask?.PushIndex((int)StarfieldMod_FieldIndex.Containers); + try + { + item.Containers.DeepCopyIn( + rhs: rhs.Containers, + errorMask: errorMask, + copyMask: copyMask?.GetSubCrystal((int)StarfieldMod_FieldIndex.Containers)); + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } if ((copyMask?.GetShouldTranslate((int)StarfieldMod_FieldIndex.Weapons) ?? true)) { errorMask?.PushIndex((int)StarfieldMod_FieldIndex.Weapons); @@ -9838,6 +9999,7 @@ public class GroupMask public bool Curve3Ds; public bool Armors; public bool Books; + public bool Containers; public bool Weapons; public bool Perks; public bool ConstructibleObjects; @@ -9895,6 +10057,7 @@ public GroupMask(bool defaultValue) Curve3Ds = defaultValue; Armors = defaultValue; Books = defaultValue; + Containers = defaultValue; Weapons = defaultValue; Perks = defaultValue; ConstructibleObjects = defaultValue; @@ -10286,6 +10449,17 @@ public static void WriteRecordTypes( translationParams: translationParams); } } + if (importMask?.Containers ?? true) + { + var ContainersItem = item.Containers; + if (ContainersItem.RecordCache.Count > 0) + { + ((StarfieldGroupBinaryWriteTranslation)((IBinaryItem)ContainersItem).BinaryWriteTranslator).Write( + item: ContainersItem, + writer: writer, + translationParams: translationParams); + } + } if (importMask?.Weapons ?? true) { var WeaponsItem = item.Weapons; @@ -11002,6 +11176,20 @@ public static ParseResult FillBinaryRecordTypes( } return (int)StarfieldMod_FieldIndex.Books; } + case RecordTypeInts.CONT: + { + if (importMask?.Containers ?? true) + { + item.Containers.CopyInFromBinary( + frame: frame, + translationParams: null); + } + else + { + frame.Position += contentLength; + } + return (int)StarfieldMod_FieldIndex.Containers; + } case RecordTypeInts.WEAP: { if (importMask?.Weapons ?? true) @@ -11649,6 +11837,11 @@ public void Dispose() private IStarfieldGroupGetter? _Books => _BooksLocations != null ? StarfieldGroupBinaryOverlay.StarfieldGroupFactory(_stream, _BooksLocations, _package) : default; public IStarfieldGroupGetter Books => _Books ?? new StarfieldGroup(this); #endregion + #region Containers + private List? _ContainersLocations; + private IStarfieldGroupGetter? _Containers => _ContainersLocations != null ? StarfieldGroupBinaryOverlay.StarfieldGroupFactory(_stream, _ContainersLocations, _package) : default; + public IStarfieldGroupGetter Containers => _Containers ?? new StarfieldGroup(this); + #endregion #region Weapons private List? _WeaponsLocations; private IStarfieldGroupGetter? _Weapons => _WeaponsLocations != null ? StarfieldGroupBinaryOverlay.StarfieldGroupFactory(_stream, _WeaponsLocations, _package) : default; @@ -12031,6 +12224,12 @@ public ParseResult FillRecordType( _BooksLocations.Add(new RangeInt64((stream.Position - offset), finalPos - offset)); return (int)StarfieldMod_FieldIndex.Books; } + case RecordTypeInts.CONT: + { + _ContainersLocations ??= new(); + _ContainersLocations.Add(new RangeInt64((stream.Position - offset), finalPos - offset)); + return (int)StarfieldMod_FieldIndex.Containers; + } case RecordTypeInts.WEAP: { _WeaponsLocations ??= new(); diff --git a/Mutagen.Bethesda.Starfield/Records/TypeSolidifier_Generated.cs b/Mutagen.Bethesda.Starfield/Records/TypeSolidifier_Generated.cs index b27523a52b..0d172227fd 100644 --- a/Mutagen.Bethesda.Starfield/Records/TypeSolidifier_Generated.cs +++ b/Mutagen.Bethesda.Starfield/Records/TypeSolidifier_Generated.cs @@ -996,9 +996,9 @@ public static TopLevelTypedLoadOrderAccess /// ModListings to query /// A typed object to do further queries on Container - public static TypedLoadOrderAccess Container(this IEnumerable> listings) + public static TopLevelTypedLoadOrderAccess Container(this IEnumerable> listings) { - return new TypedLoadOrderAccess( + return new TopLevelTypedLoadOrderAccess( (bool includeDeletedRecords) => listings.WinningOverrides(includeDeletedRecords: includeDeletedRecords), (ILinkCache linkCache, bool includeDeletedRecords) => listings.WinningContextOverrides(linkCache, includeDeletedRecords: includeDeletedRecords)); } @@ -1008,9 +1008,9 @@ public static TypedLoadOrderAccess /// Mods to query /// A typed object to do further queries on Container - public static TypedLoadOrderAccess Container(this IEnumerable mods) + public static TopLevelTypedLoadOrderAccess Container(this IEnumerable mods) { - return new TypedLoadOrderAccess( + return new TopLevelTypedLoadOrderAccess( (bool includeDeletedRecords) => mods.WinningOverrides(includeDeletedRecords: includeDeletedRecords), (ILinkCache linkCache, bool includeDeletedRecords) => mods.WinningContextOverrides(linkCache, includeDeletedRecords: includeDeletedRecords)); } diff --git a/Mutagen.Bethesda.Tests/Processing/StarfieldProcessor.cs b/Mutagen.Bethesda.Tests/Processing/StarfieldProcessor.cs index 7c199254d4..a04c3cd089 100644 --- a/Mutagen.Bethesda.Tests/Processing/StarfieldProcessor.cs +++ b/Mutagen.Bethesda.Tests/Processing/StarfieldProcessor.cs @@ -133,6 +133,7 @@ protected override AStringsAlignment[] GetStringsFileAlignments(StringsSource so new RecordType[] { "WEAP", "FULL" }, new RecordType[] { "PERK", "FULL" }, new RecordType[] { "ARMO", "FULL" }, + new RecordType[] { "CONT", "FULL" }, new StringsAlignmentCustom("PERK", PerkStringHandler), new RecordType[] { "MISC", "FULL", "NNAM" }, new RecordType[] { "IRES", "FULL", "NNAM" },