Skip to content

Commit

Permalink
Merge branch 'dev' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
Noggog committed Aug 19, 2020
2 parents 7b6935a + b14a40b commit a928818
Show file tree
Hide file tree
Showing 622 changed files with 4,248 additions and 1,932 deletions.
2 changes: 1 addition & 1 deletion Mutagen.Bethesda.Core/Links/ImmutableLoadOrderLinkCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -186,7 +186,7 @@ void AddRecords(TMod mod, Type type)
}
else
{
AddRecords(targetMod, typeof(IMajorRecordGetter));
AddRecords(targetMod, typeof(TMajor));
}
// Check again
if (cache.Dictionary.TryGetValue(formKey, out majorRecObj))
Expand Down
62 changes: 53 additions & 9 deletions Mutagen.Bethesda.Core/Load Order/LoadOrder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -172,26 +172,24 @@ public static IList<ModKey> FromPath(FilePath path)
}

/// <summary>
/// Returns a load order listing from the usual sources
/// Parses a file to retrieve all ModKeys in expected plugin file format,
/// Will order mods by timestamps if applicable
/// Will add implicit base mods if applicable
/// </summary>
/// <param name="game">Game type</param>
/// <param name="path">Path of plugin list</param>
/// <param name="dataPath">Path to game's data folder</param>
/// <param name="throwOnMissingMods">Whether to throw and exception if mods are missing</param>
/// <returns>Enumerable of modkeys representing a load order</returns>
/// <exception cref="ArgumentException">Line in plugin file is unexpected</exception>
/// <exception cref="FileNotFoundException">If plugin file not located</exception>
/// <exception cref="MissingModException">If throwOnMissingMods true and file is missing</exception>
public static IEnumerable<ModKey> GetUsualLoadOrder(
public static IEnumerable<ModKey> FromPath(
GameRelease game,
FilePath path,
DirectoryPath dataPath,
bool throwOnMissingMods = true)
{
if (!TryGetPluginsFile(game, out var path))
{
throw new FileNotFoundException("Could not locate plugins file");
}

var mods = FromPath(path);
AddImplicitMods(game, dataPath, mods);
if (NeedsTimestampAlignment(game.ToCategory()))
{
return AlignToTimestamps(mods, dataPath, throwOnMissingMods: throwOnMissingMods);
Expand All @@ -202,6 +200,52 @@ public static IEnumerable<ModKey> GetUsualLoadOrder(
}
}

private readonly static ModKey[] _sseImplicitMods = new ModKey[]
{
"Skyrim.esm",
"Update.esm",
"Dawnguard.esm",
"HearthFires.esm",
"Dragonborn.esm",
};

internal static void AddImplicitMods(
GameRelease release,
DirectoryPath dataPath,
IList<ModKey> loadOrder)
{
if (release != GameRelease.SkyrimSE) return;
foreach (var implicitMod in _sseImplicitMods.Reverse())
{
if (loadOrder.Contains(implicitMod)) continue;
if (!File.Exists(Path.Combine(dataPath.Path, implicitMod.FileName))) continue;
loadOrder.Insert(0, implicitMod);
}
}

/// <summary>
/// Returns a load order listing from the usual sources
/// </summary>
/// <param name="game">Game type</param>
/// <param name="dataPath">Path to game's data folder</param>
/// <param name="throwOnMissingMods">Whether to throw and exception if mods are missing</param>
/// <returns>Enumerable of modkeys representing a load order</returns>
/// <exception cref="ArgumentException">Line in plugin file is unexpected</exception>
/// <exception cref="FileNotFoundException">If plugin file not located</exception>
/// <exception cref="MissingModException">If throwOnMissingMods true and file is missing</exception>
public static IEnumerable<ModKey> GetUsualLoadOrder(
GameRelease game,
DirectoryPath dataPath,
bool throwOnMissingMods = true)
{
if (!TryGetPluginsFile(game, out var path))
{
throw new FileNotFoundException("Could not locate plugins file");
}

return FromPath(game, path, dataPath, throwOnMissingMods);
}

/// <summary>
/// Constructs a load order filled with mods constructed
/// </summary>
Expand Down
2 changes: 1 addition & 1 deletion Mutagen.Bethesda.Core/Mutagen.Bethesda.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
</ItemGroup>
<PropertyGroup>
<PackageId>Mutagen.Bethesda.Core</PackageId>
<Version>0.13.1</Version>
<Version>0.13.2</Version>
<Authors>Noggog</Authors>
<Company>Mutagen</Company>
<Product>Mutagen</Product>
Expand Down
8 changes: 8 additions & 0 deletions Mutagen.Bethesda.Core/Records/MajorRecord_Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -398,6 +398,7 @@ public class TranslationMask : ITranslationMask
{
#region Members
private TranslationCrystal? _crystal;
public readonly bool DefaultOn;
public bool MajorRecordFlagsRaw;
public bool FormKey;
public bool VersionControl;
Expand All @@ -407,6 +408,7 @@ public class TranslationMask : ITranslationMask
#region Ctors
public TranslationMask(bool defaultOn)
{
this.DefaultOn = defaultOn;
this.MajorRecordFlagsRaw = defaultOn;
this.FormKey = defaultOn;
this.VersionControl = defaultOn;
Expand All @@ -431,6 +433,12 @@ protected virtual void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)
ret.Add((VersionControl, null));
ret.Add((EditorID, null));
}

public static implicit operator TranslationMask(bool defaultOn)
{
return new TranslationMask(defaultOn);
}

}
#endregion

Expand Down
8 changes: 8 additions & 0 deletions Mutagen.Bethesda.Core/Records/MasterReference_Generated.cs
Original file line number Diff line number Diff line change
Expand Up @@ -339,13 +339,15 @@ public class TranslationMask : ITranslationMask
{
#region Members
private TranslationCrystal? _crystal;
public readonly bool DefaultOn;
public bool Master;
public bool FileSize;
#endregion

#region Ctors
public TranslationMask(bool defaultOn)
{
this.DefaultOn = defaultOn;
this.Master = defaultOn;
this.FileSize = defaultOn;
}
Expand All @@ -366,6 +368,12 @@ protected void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)> ret)
ret.Add((Master, null));
ret.Add((FileSize, null));
}

public static implicit operator TranslationMask(bool defaultOn)
{
return new TranslationMask(defaultOn);
}

}
#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

<ItemGroup>
<PackageReference Include="Loqui" Version="1.2.1" />
<PackageReference Include="Loqui.Generation" Version="1.3.1" />
<PackageReference Include="Loqui.Generation" Version="1.4.0" />
<PackageReference Include="Noggog.CSharpExt" Version="1.1.0" />
<PackageReference Include="System.Linq.Async" Version="4.1.1" />
</ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Mutagen.Bethesda.Generation/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class Program

static void AttachDebugInspector()
{
string testString = "errorMask = MasterReference.ErrorMask.Factory(errorMaskBuilder);";
string testString = "Add((AIData?.Overall ?? true, AIData?.Specific?.GetCrystal(";
FileGeneration.LineAppended
.Where(i => i.Contains(testString))
.Subscribe(s =>
Expand Down
2 changes: 1 addition & 1 deletion Mutagen.Bethesda.Kernel/Mutagen.Bethesda.Kernel.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<PackageLicenseExpression>GPL-3.0-only</PackageLicenseExpression>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<Version>0.13.1</Version>
<Version>0.13.2</Version>
</PropertyGroup>

<Target Name="PreBuild" BeforeTargets="PreBuildEvent">
Expand Down
2 changes: 1 addition & 1 deletion Mutagen.Bethesda.Oblivion/Mutagen.Bethesda.Oblivion.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<TargetFramework>netstandard2.1</TargetFramework>
<PackageRequireLicenseAcceptance>true</PackageRequireLicenseAcceptance>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.13.1</Version>
<Version>0.13.2</Version>
<Authors>Noggog</Authors>
<Company>Mutagen</Company>
<Product>Mutagen</Product>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,7 @@ public class TranslationMask : ITranslationMask
{
#region Members
private TranslationCrystal? _crystal;
public readonly bool DefaultOn;
public bool CompareOperator;
public bool Flags;
public bool Fluff;
Expand All @@ -529,6 +530,7 @@ public class TranslationMask : ITranslationMask
#region Ctors
public TranslationMask(bool defaultOn)
{
this.DefaultOn = defaultOn;
this.CompareOperator = defaultOn;
this.Flags = defaultOn;
this.Fluff = defaultOn;
Expand Down Expand Up @@ -561,6 +563,12 @@ protected void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)> ret)
ret.Add((SecondParameter, null));
ret.Add((ThirdParameter, null));
}

public static implicit operator TranslationMask(bool defaultOn)
{
return new TranslationMask(defaultOn);
}

}
#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,7 @@ public class TranslationMask : ITranslationMask
{
#region Members
private TranslationCrystal? _crystal;
public readonly bool DefaultOn;
public bool Unknown0;
public bool Unknown1;
public bool Unknown2;
Expand All @@ -376,6 +377,7 @@ public class TranslationMask : ITranslationMask
#region Ctors
public TranslationMask(bool defaultOn)
{
this.DefaultOn = defaultOn;
this.Unknown0 = defaultOn;
this.Unknown1 = defaultOn;
this.Unknown2 = defaultOn;
Expand All @@ -398,6 +400,12 @@ protected void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)> ret)
ret.Add((Unknown1, null));
ret.Add((Unknown2, null));
}

public static implicit operator TranslationMask(bool defaultOn)
{
return new TranslationMask(defaultOn);
}

}
#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -454,6 +454,7 @@ public class TranslationMask : ITranslationMask
{
#region Members
private TranslationCrystal? _crystal;
public readonly bool DefaultOn;
public bool MagicEffect;
public bool Magnitude;
public bool Area;
Expand All @@ -465,6 +466,7 @@ public class TranslationMask : ITranslationMask
#region Ctors
public TranslationMask(bool defaultOn)
{
this.DefaultOn = defaultOn;
this.MagicEffect = defaultOn;
this.Magnitude = defaultOn;
this.Area = defaultOn;
Expand Down Expand Up @@ -493,6 +495,12 @@ protected void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)> ret)
ret.Add((Type, null));
ret.Add((ActorValue, null));
}

public static implicit operator TranslationMask(bool defaultOn)
{
return new TranslationMask(defaultOn);
}

}
#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,15 +367,15 @@ public class TranslationMask : ITranslationMask
{
#region Members
private TranslationCrystal? _crystal;
public MaskItem<bool, EffectData.TranslationMask?> Data;
public MaskItem<bool, ScriptEffect.TranslationMask?> ScriptEffect;
public readonly bool DefaultOn;
public EffectData.TranslationMask? Data;
public ScriptEffect.TranslationMask? ScriptEffect;
#endregion

#region Ctors
public TranslationMask(bool defaultOn)
{
this.Data = new MaskItem<bool, EffectData.TranslationMask?>(defaultOn, null);
this.ScriptEffect = new MaskItem<bool, ScriptEffect.TranslationMask?>(defaultOn, null);
this.DefaultOn = defaultOn;
}

#endregion
Expand All @@ -391,9 +391,15 @@ public TranslationCrystal GetCrystal()

protected void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)> ret)
{
ret.Add((Data?.Overall ?? true, Data?.Specific?.GetCrystal()));
ret.Add((ScriptEffect?.Overall ?? true, ScriptEffect?.Specific?.GetCrystal()));
ret.Add((Data != null || DefaultOn, Data?.GetCrystal()));
ret.Add((ScriptEffect != null || DefaultOn, ScriptEffect?.GetCrystal()));
}

public static implicit operator TranslationMask(bool defaultOn)
{
return new TranslationMask(defaultOn);
}

}
#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,15 @@ public class TranslationMask : ITranslationMask
{
#region Members
private TranslationCrystal? _crystal;
public readonly bool DefaultOn;
public bool Reference;
public bool Flags;
#endregion

#region Ctors
public TranslationMask(bool defaultOn)
{
this.DefaultOn = defaultOn;
this.Reference = defaultOn;
this.Flags = defaultOn;
}
Expand All @@ -369,6 +371,12 @@ protected void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)> ret)
ret.Add((Reference, null));
ret.Add((Flags, null));
}

public static implicit operator TranslationMask(bool defaultOn)
{
return new TranslationMask(defaultOn);
}

}
#endregion

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1484,6 +1484,7 @@ public class TranslationMask<T_TranslMask> : ITranslationMask
{
#region Members
private TranslationCrystal? _crystal;
public readonly bool DefaultOn;
public bool Level;
public bool Unknown;
public bool Reference;
Expand All @@ -1494,6 +1495,7 @@ public class TranslationMask<T_TranslMask> : ITranslationMask
#region Ctors
public TranslationMask(bool defaultOn)
{
this.DefaultOn = defaultOn;
this.Level = defaultOn;
this.Unknown = defaultOn;
this.Reference = defaultOn;
Expand All @@ -1520,6 +1522,12 @@ protected void GetCrystal(List<(bool On, TranslationCrystal? SubCrystal)> ret)
ret.Add((Count, null));
ret.Add((Unknown2, null));
}

public static implicit operator TranslationMask<T_TranslMask>(bool defaultOn)
{
return new TranslationMask<T_TranslMask>(defaultOn);
}

}
}
}
Loading

0 comments on commit a928818

Please sign in to comment.