From 5504eae33ef9e35c5efe3803a5bea0e7fcd67eeb Mon Sep 17 00:00:00 2001 From: Justin Swanson Date: Wed, 27 Nov 2024 21:24:38 -0600 Subject: [PATCH] Starfield Quest QDUP --- .../Records/Major Records/Quest.xml | 3 + .../Records/Major Records/Quest_Generated.cs | 250 ++++++++++++++++-- .../Records/RecordTypeInts_Generated.cs | 1 + .../Records/RecordTypes_Generated.cs | 1 + 4 files changed, 233 insertions(+), 22 deletions(-) diff --git a/Mutagen.Bethesda.Starfield/Records/Major Records/Quest.xml b/Mutagen.Bethesda.Starfield/Records/Major Records/Quest.xml index ca887674bc..721b2781bb 100644 --- a/Mutagen.Bethesda.Starfield/Records/Major Records/Quest.xml +++ b/Mutagen.Bethesda.Starfield/Records/Major Records/Quest.xml @@ -12,6 +12,9 @@ + + + diff --git a/Mutagen.Bethesda.Starfield/Records/Major Records/Quest_Generated.cs b/Mutagen.Bethesda.Starfield/Records/Major Records/Quest_Generated.cs index f1af8e682e..d1a7259bf8 100644 --- a/Mutagen.Bethesda.Starfield/Records/Major Records/Quest_Generated.cs +++ b/Mutagen.Bethesda.Starfield/Records/Major Records/Quest_Generated.cs @@ -191,6 +191,20 @@ public IFormLinkNullable SourceQuest } [DebuggerBrowsable(DebuggerBrowsableState.Never)] IFormLinkNullableGetter IQuestGetter.SourceQuest => this.SourceQuest; + #endregion + #region QDUPs + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + private ExtendedList>? _QDUPs; + public ExtendedList>? QDUPs + { + get => this._QDUPs; + set => this._QDUPs = value; + } + #region Interface Members + [DebuggerBrowsable(DebuggerBrowsableState.Never)] + IReadOnlyList>? IQuestGetter.QDUPs => _QDUPs; + #endregion + #endregion #region TextDisplayGlobals [DebuggerBrowsable(DebuggerBrowsableState.Never)] @@ -439,6 +453,7 @@ public Mask(TItem initialValue) this.Location = initialValue; this.QuestTimeLimit = initialValue; this.SourceQuest = initialValue; + this.QDUPs = new MaskItem?>(initialValue, Enumerable.Empty<(int Index, TItem Value)>()); this.TextDisplayGlobals = new MaskItem?>(initialValue, Enumerable.Empty<(int Index, TItem Value)>()); this.Filter = initialValue; this.Summary = initialValue; @@ -479,6 +494,7 @@ public Mask( TItem Location, TItem QuestTimeLimit, TItem SourceQuest, + TItem QDUPs, TItem TextDisplayGlobals, TItem Filter, TItem Summary, @@ -518,6 +534,7 @@ public Mask( this.Location = Location; this.QuestTimeLimit = QuestTimeLimit; this.SourceQuest = SourceQuest; + this.QDUPs = new MaskItem?>(QDUPs, Enumerable.Empty<(int Index, TItem Value)>()); this.TextDisplayGlobals = new MaskItem?>(TextDisplayGlobals, Enumerable.Empty<(int Index, TItem Value)>()); this.Filter = Filter; this.Summary = Summary; @@ -559,6 +576,7 @@ protected Mask() public TItem Location; public TItem QuestTimeLimit; public TItem SourceQuest; + public MaskItem?>? QDUPs; public MaskItem?>? TextDisplayGlobals; public TItem Filter; public TItem Summary; @@ -602,6 +620,7 @@ public bool Equals(Mask? rhs) if (!object.Equals(this.Location, rhs.Location)) return false; if (!object.Equals(this.QuestTimeLimit, rhs.QuestTimeLimit)) return false; if (!object.Equals(this.SourceQuest, rhs.SourceQuest)) return false; + if (!object.Equals(this.QDUPs, rhs.QDUPs)) return false; if (!object.Equals(this.TextDisplayGlobals, rhs.TextDisplayGlobals)) return false; if (!object.Equals(this.Filter, rhs.Filter)) return false; if (!object.Equals(this.Summary, rhs.Summary)) return false; @@ -637,6 +656,7 @@ public override int GetHashCode() hash.Add(this.Location); hash.Add(this.QuestTimeLimit); hash.Add(this.SourceQuest); + hash.Add(this.QDUPs); hash.Add(this.TextDisplayGlobals); hash.Add(this.Filter); hash.Add(this.Summary); @@ -696,6 +716,17 @@ public override bool All(Func eval) if (!eval(this.Location)) return false; if (!eval(this.QuestTimeLimit)) return false; if (!eval(this.SourceQuest)) return false; + if (this.QDUPs != null) + { + if (!eval(this.QDUPs.Overall)) return false; + if (this.QDUPs.Specific != null) + { + foreach (var item in this.QDUPs.Specific) + { + if (!eval(item.Value)) return false; + } + } + } if (this.TextDisplayGlobals != null) { if (!eval(this.TextDisplayGlobals.Overall)) return false; @@ -872,6 +903,17 @@ public override bool Any(Func eval) if (eval(this.Location)) return true; if (eval(this.QuestTimeLimit)) return true; if (eval(this.SourceQuest)) return true; + if (this.QDUPs != null) + { + if (eval(this.QDUPs.Overall)) return true; + if (this.QDUPs.Specific != null) + { + foreach (var item in this.QDUPs.Specific) + { + if (!eval(item.Value)) return false; + } + } + } if (this.TextDisplayGlobals != null) { if (eval(this.TextDisplayGlobals.Overall)) return true; @@ -1050,6 +1092,20 @@ protected void Translate_InternalFill(Mask obj, Func eval) obj.Location = eval(this.Location); obj.QuestTimeLimit = eval(this.QuestTimeLimit); obj.SourceQuest = eval(this.SourceQuest); + if (QDUPs != null) + { + obj.QDUPs = new MaskItem?>(eval(this.QDUPs.Overall), Enumerable.Empty<(int Index, R Value)>()); + if (QDUPs.Specific != null) + { + var l = new List<(int Index, R Item)>(); + obj.QDUPs.Specific = l; + foreach (var item in QDUPs.Specific) + { + R mask = eval(item.Value); + l.Add((item.Index, mask)); + } + } + } if (TextDisplayGlobals != null) { obj.TextDisplayGlobals = new MaskItem?>(eval(this.TextDisplayGlobals.Overall), Enumerable.Empty<(int Index, R Value)>()); @@ -1295,6 +1351,27 @@ public void Print(StructuredStringBuilder sb, Quest.Mask? printMask = null { sb.AppendItem(SourceQuest, "SourceQuest"); } + if ((printMask?.QDUPs?.Overall ?? true) + && QDUPs is {} QDUPsItem) + { + sb.AppendLine("QDUPs =>"); + using (sb.Brace()) + { + sb.AppendItem(QDUPsItem.Overall); + if (QDUPsItem.Specific != null) + { + foreach (var subItem in QDUPsItem.Specific) + { + using (sb.Brace()) + { + { + sb.AppendItem(subItem); + } + } + } + } + } + } if ((printMask?.TextDisplayGlobals?.Overall ?? true) && TextDisplayGlobals is {} TextDisplayGlobalsItem) { @@ -1565,6 +1642,7 @@ public void Print(StructuredStringBuilder sb, Quest.Mask? printMask = null public Exception? Location; public Exception? QuestTimeLimit; public Exception? SourceQuest; + public MaskItem?>? QDUPs; public MaskItem?>? TextDisplayGlobals; public Exception? Filter; public Exception? Summary; @@ -1613,6 +1691,8 @@ public void Print(StructuredStringBuilder sb, Quest.Mask? printMask = null return QuestTimeLimit; case Quest_FieldIndex.SourceQuest: return SourceQuest; + case Quest_FieldIndex.QDUPs: + return QDUPs; case Quest_FieldIndex.TextDisplayGlobals: return TextDisplayGlobals; case Quest_FieldIndex.Filter: @@ -1693,6 +1773,9 @@ public override void SetNthException(int index, Exception ex) case Quest_FieldIndex.SourceQuest: this.SourceQuest = ex; break; + case Quest_FieldIndex.QDUPs: + this.QDUPs = new MaskItem?>(ex, null); + break; case Quest_FieldIndex.TextDisplayGlobals: this.TextDisplayGlobals = new MaskItem?>(ex, null); break; @@ -1794,6 +1877,9 @@ public override void SetNthMask(int index, object obj) case Quest_FieldIndex.SourceQuest: this.SourceQuest = (Exception?)obj; break; + case Quest_FieldIndex.QDUPs: + this.QDUPs = (MaskItem?>)obj; + break; case Quest_FieldIndex.TextDisplayGlobals: this.TextDisplayGlobals = (MaskItem?>)obj; break; @@ -1873,6 +1959,7 @@ public override bool IsInError() if (Location != null) return true; if (QuestTimeLimit != null) return true; if (SourceQuest != null) return true; + if (QDUPs != null) return true; if (TextDisplayGlobals != null) return true; if (Filter != null) return true; if (Summary != null) return true; @@ -1960,6 +2047,26 @@ protected override void PrintFillInternal(StructuredStringBuilder sb) { sb.AppendItem(SourceQuest, "SourceQuest"); } + if (QDUPs is {} QDUPsItem) + { + sb.AppendLine("QDUPs =>"); + using (sb.Brace()) + { + sb.AppendItem(QDUPsItem.Overall); + if (QDUPsItem.Specific != null) + { + foreach (var subItem in QDUPsItem.Specific) + { + using (sb.Brace()) + { + { + sb.AppendItem(subItem); + } + } + } + } + } + } if (TextDisplayGlobals is {} TextDisplayGlobalsItem) { sb.AppendLine("TextDisplayGlobals =>"); @@ -2207,6 +2314,7 @@ public ErrorMask Combine(ErrorMask? rhs) ret.Location = this.Location.Combine(rhs.Location); ret.QuestTimeLimit = this.QuestTimeLimit.Combine(rhs.QuestTimeLimit); ret.SourceQuest = this.SourceQuest.Combine(rhs.SourceQuest); + ret.QDUPs = new MaskItem?>(Noggog.ExceptionExt.Combine(this.QDUPs?.Overall, rhs.QDUPs?.Overall), Noggog.ExceptionExt.Combine(this.QDUPs?.Specific, rhs.QDUPs?.Specific)); ret.TextDisplayGlobals = new MaskItem?>(Noggog.ExceptionExt.Combine(this.TextDisplayGlobals?.Overall, rhs.TextDisplayGlobals?.Overall), Noggog.ExceptionExt.Combine(this.TextDisplayGlobals?.Specific, rhs.TextDisplayGlobals?.Specific)); ret.Filter = this.Filter.Combine(rhs.Filter); ret.Summary = this.Summary.Combine(rhs.Summary); @@ -2259,6 +2367,7 @@ public ErrorMask Combine(ErrorMask? rhs) public bool Location; public bool QuestTimeLimit; public bool SourceQuest; + public bool QDUPs; public bool TextDisplayGlobals; public bool Filter; public bool Summary; @@ -2294,6 +2403,7 @@ public TranslationMask( this.Location = defaultOn; this.QuestTimeLimit = defaultOn; this.SourceQuest = defaultOn; + this.QDUPs = defaultOn; this.TextDisplayGlobals = defaultOn; this.Filter = defaultOn; this.Summary = defaultOn; @@ -2322,6 +2432,7 @@ protected override void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal ret.Add((Location, null)); ret.Add((QuestTimeLimit, null)); ret.Add((SourceQuest, null)); + ret.Add((QDUPs, null)); ret.Add((TextDisplayGlobals, null)); ret.Add((Filter, null)); ret.Add((Summary, null)); @@ -2558,6 +2669,7 @@ public partial interface IQuest : new IFormLinkNullable Location { get; set; } new IFormLinkNullable QuestTimeLimit { get; set; } new IFormLinkNullable SourceQuest { get; set; } + new ExtendedList>? QDUPs { get; set; } new ExtendedList> TextDisplayGlobals { get; } new String? Filter { get; set; } new String? Summary { get; set; } @@ -2631,6 +2743,7 @@ public partial interface IQuestGetter : IFormLinkNullableGetter Location { get; } IFormLinkNullableGetter QuestTimeLimit { get; } IFormLinkNullableGetter SourceQuest { get; } + IReadOnlyList>? QDUPs { get; } IReadOnlyList> TextDisplayGlobals { get; } String? Filter { get; } String? Summary { get; } @@ -3072,26 +3185,27 @@ internal enum Quest_FieldIndex Location = 14, QuestTimeLimit = 15, SourceQuest = 16, - TextDisplayGlobals = 17, - Filter = 18, - Summary = 19, - DialogConditions = 20, - UnusedConditions = 21, - Stages = 22, - Objectives = 23, - Aliases = 24, - QuestGroup = 25, - SwfFile = 26, - MissionTypeKeyword = 27, - MissionBoardDescription = 28, - MissionBoardInfoPanels = 29, - Keywords = 30, - ScriptComment = 31, - Timestamp = 32, - Unknown = 33, - DialogBranches = 34, - DialogTopics = 35, - Scenes = 36, + QDUPs = 17, + TextDisplayGlobals = 18, + Filter = 19, + Summary = 20, + DialogConditions = 21, + UnusedConditions = 22, + Stages = 23, + Objectives = 24, + Aliases = 25, + QuestGroup = 26, + SwfFile = 27, + MissionTypeKeyword = 28, + MissionBoardDescription = 29, + MissionBoardInfoPanels = 30, + Keywords = 31, + ScriptComment = 32, + Timestamp = 33, + Unknown = 34, + DialogBranches = 35, + DialogTopics = 36, + Scenes = 37, } #endregion @@ -3102,9 +3216,9 @@ internal partial class Quest_Registration : ILoquiRegistration public static ProtocolKey ProtocolKey => ProtocolDefinition_Starfield.ProtocolKey; - public const ushort AdditionalFieldCount = 30; + public const ushort AdditionalFieldCount = 31; - public const ushort FieldCount = 37; + public const ushort FieldCount = 38; public static readonly Type MaskType = typeof(Quest.Mask<>); @@ -3150,6 +3264,7 @@ internal partial class Quest_Registration : ILoquiRegistration RecordTypes.LNAM, RecordTypes.QTLM, RecordTypes.QSRC, + RecordTypes.QDUP, RecordTypes.QTGL, RecordTypes.FLTR, RecordTypes.NAM3, @@ -3306,6 +3421,7 @@ public void Clear(IQuestInternal item) item.Location.Clear(); item.QuestTimeLimit.Clear(); item.SourceQuest.Clear(); + item.QDUPs = null; item.TextDisplayGlobals.Clear(); item.Filter = default; item.Summary = default; @@ -3350,6 +3466,7 @@ public void RemapLinks(IQuest obj, IReadOnlyDictionary mapping obj.Location.Relink(mapping); obj.QuestTimeLimit.Relink(mapping); obj.SourceQuest.Relink(mapping); + obj.QDUPs?.RemapLinks(mapping); obj.TextDisplayGlobals.RemapLinks(mapping); obj.DialogConditions.RemapLinks(mapping); obj.UnusedConditions?.RemapLinks(mapping); @@ -3812,6 +3929,10 @@ public void FillEqualsMask( ret.Location = item.Location.Equals(rhs.Location); ret.QuestTimeLimit = item.QuestTimeLimit.Equals(rhs.QuestTimeLimit); ret.SourceQuest = item.SourceQuest.Equals(rhs.SourceQuest); + ret.QDUPs = item.QDUPs.CollectionEqualsHelper( + rhs.QDUPs, + (l, r) => object.Equals(l, r), + include); ret.TextDisplayGlobals = item.TextDisplayGlobals.CollectionEqualsHelper( rhs.TextDisplayGlobals, (l, r) => object.Equals(l, r), @@ -3968,6 +4089,21 @@ protected static void ToStringFields( { sb.AppendItem(item.SourceQuest.FormKeyNullable, "SourceQuest"); } + if ((printMask?.QDUPs?.Overall ?? true) + && item.QDUPs is {} QDUPsItem) + { + sb.AppendLine("QDUPs =>"); + using (sb.Brace()) + { + foreach (var subItem in QDUPsItem) + { + using (sb.Brace()) + { + sb.AppendItem(subItem.FormKey); + } + } + } + } if (printMask?.TextDisplayGlobals?.Overall ?? true) { sb.AppendLine("TextDisplayGlobals =>"); @@ -4264,6 +4400,10 @@ public virtual bool Equals( { if (!lhs.SourceQuest.Equals(rhs.SourceQuest)) return false; } + if ((equalsMask?.GetShouldTranslate((int)Quest_FieldIndex.QDUPs) ?? true)) + { + if (!lhs.QDUPs.SequenceEqualNullable(rhs.QDUPs)) return false; + } if ((equalsMask?.GetShouldTranslate((int)Quest_FieldIndex.TextDisplayGlobals) ?? true)) { if (!lhs.TextDisplayGlobals.SequenceEqualNullable(rhs.TextDisplayGlobals)) return false; @@ -4394,6 +4534,7 @@ public virtual int GetHashCode(IQuestGetter item) hash.Add(item.Location); hash.Add(item.QuestTimeLimit); hash.Add(item.SourceQuest); + hash.Add(item.QDUPs); hash.Add(item.TextDisplayGlobals); if (item.Filter is {} Filteritem) { @@ -4490,6 +4631,13 @@ public IEnumerable EnumerateFormLinks(IQuestGetter obj) { yield return SourceQuestInfo; } + if (obj.QDUPs is {} QDUPsItem) + { + foreach (var item in QDUPsItem) + { + yield return FormLinkInformation.Factory(item); + } + } foreach (var item in obj.TextDisplayGlobals) { yield return FormLinkInformation.Factory(item); @@ -5286,6 +5434,33 @@ public void DeepCopyIn( { item.SourceQuest.SetTo(rhs.SourceQuest.FormKeyNullable); } + if ((copyMask?.GetShouldTranslate((int)Quest_FieldIndex.QDUPs) ?? true)) + { + errorMask?.PushIndex((int)Quest_FieldIndex.QDUPs); + try + { + if ((rhs.QDUPs != null)) + { + item.QDUPs = + rhs.QDUPs + .Select(b => (IFormLinkGetter)new FormLink(b.FormKey)) + .ToExtendedList>(); + } + else + { + item.QDUPs = null; + } + } + catch (Exception ex) + when (errorMask != null) + { + errorMask.ReportException(ex); + } + finally + { + errorMask?.PopIndex(); + } + } if ((copyMask?.GetShouldTranslate((int)Quest_FieldIndex.TextDisplayGlobals) ?? true)) { errorMask?.PushIndex((int)Quest_FieldIndex.TextDisplayGlobals); @@ -5833,6 +6008,16 @@ public static void WriteRecordTypes( writer: writer, item: item.SourceQuest, header: translationParams.ConvertToCustom(RecordTypes.QSRC)); + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation>.Instance.Write( + writer: writer, + items: item.QDUPs, + recordType: translationParams.ConvertToCustom(RecordTypes.QDUP), + 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.TextDisplayGlobals, @@ -6138,6 +6323,16 @@ public static ParseResult FillBinaryRecordTypes( item.SourceQuest.SetTo(FormLinkBinaryTranslation.Instance.Parse(reader: frame)); return (int)Quest_FieldIndex.SourceQuest; } + case RecordTypeInts.QDUP: + { + frame.Position += frame.MetaData.Constants.SubConstants.HeaderLength; + item.QDUPs = + Mutagen.Bethesda.Plugins.Binary.Translations.ListBinaryTranslation>.Instance.Parse( + reader: frame.SpawnWithLength(contentLength), + transl: FormLinkBinaryTranslation.Instance.Parse) + .CastExtendedList>(); + return (int)Quest_FieldIndex.QDUPs; + } case RecordTypeInts.QTGL: { item.TextDisplayGlobals.SetTo( @@ -6409,6 +6604,7 @@ void IBinaryItem.WriteToBinary( private int? _SourceQuestLocation; public IFormLinkNullableGetter SourceQuest => FormLinkBinaryTranslation.Instance.NullableRecordOverlayFactory(_package, _recordData, _SourceQuestLocation); #endregion + public IReadOnlyList>? QDUPs { get; private set; } public IReadOnlyList> TextDisplayGlobals { get; private set; } = Array.Empty>(); #region Filter private int? _FilterLocation; @@ -6598,6 +6794,16 @@ public override ParseResult FillRecordType( _SourceQuestLocation = (stream.Position - offset); return (int)Quest_FieldIndex.SourceQuest; } + case RecordTypeInts.QDUP: + { + this.QDUPs = BinaryOverlayList.FactoryByStartIndexWithTrigger>( + stream: stream, + package: _package, + finalPos: finalPos, + itemLength: 4, + getter: (s, p) => FormLinkBinaryTranslation.Instance.OverlayFactory(p, s)); + return (int)Quest_FieldIndex.QDUPs; + } case RecordTypeInts.QTGL: { this.TextDisplayGlobals = BinaryOverlayList.FactoryByArray>( diff --git a/Mutagen.Bethesda.Starfield/Records/RecordTypeInts_Generated.cs b/Mutagen.Bethesda.Starfield/Records/RecordTypeInts_Generated.cs index 6c21253253..6ec3a90d1b 100644 --- a/Mutagen.Bethesda.Starfield/Records/RecordTypeInts_Generated.cs +++ b/Mutagen.Bethesda.Starfield/Records/RecordTypeInts_Generated.cs @@ -747,6 +747,7 @@ public partial class RecordTypeInts public const int PTTA = 0x41545450; public const int PUSE = 0x45535550; public const int PUSH = 0x48535550; + public const int QDUP = 0x50554451; public const int QMDP = 0x50444D51; public const int QMDS = 0x53444D51; public const int QMDT = 0x54444D51; diff --git a/Mutagen.Bethesda.Starfield/Records/RecordTypes_Generated.cs b/Mutagen.Bethesda.Starfield/Records/RecordTypes_Generated.cs index aa6b9045be..13d45d84c2 100644 --- a/Mutagen.Bethesda.Starfield/Records/RecordTypes_Generated.cs +++ b/Mutagen.Bethesda.Starfield/Records/RecordTypes_Generated.cs @@ -749,6 +749,7 @@ public partial class RecordTypes public static readonly RecordType PTTA = new(0x41545450); public static readonly RecordType PUSE = new(0x45535550); public static readonly RecordType PUSH = new(0x48535550); + public static readonly RecordType QDUP = new(0x50554451); public static readonly RecordType QMDP = new(0x50444D51); public static readonly RecordType QMDS = new(0x53444D51); public static readonly RecordType QMDT = new(0x54444D51);