From dc6b4b9ef7f845e022f9157c9fea36f6d3ed6d0c Mon Sep 17 00:00:00 2001 From: Timothy Baldridge Date: Sat, 24 Aug 2019 17:59:22 -0600 Subject: [PATCH] We now copy custom LOOT rules --- Wabbajack.Common/Consts.cs | 1 + Wabbajack/Compiler.cs | 30 +++++++++++++++++++++++++++++- 2 files changed, 30 insertions(+), 1 deletion(-) diff --git a/Wabbajack.Common/Consts.cs b/Wabbajack.Common/Consts.cs index 2b1bd260..3a508212 100644 --- a/Wabbajack.Common/Consts.cs +++ b/Wabbajack.Common/Consts.cs @@ -11,6 +11,7 @@ namespace Wabbajack.Common public static class Consts { public static string GameFolderFilesDir = "Game Folder Files"; + public static string LOOTFolderFilesDir = "LOOT Config Files"; public static string ModPackMagic = "Celebration!, Cheese for Everyone!"; public static string BSACreationDir = "TEMP_BSA_FILES"; public static string MegaPrefix = "https://mega.nz/#!"; diff --git a/Wabbajack/Compiler.cs b/Wabbajack/Compiler.cs index a8507cfd..da535f70 100644 --- a/Wabbajack/Compiler.cs +++ b/Wabbajack/Compiler.cs @@ -150,6 +150,15 @@ namespace Wabbajack .Where(p => p.FileExists()) .Select(p => new RawSourceFile(VFS.Lookup(p)) { Path = Path.Combine(Consts.GameFolderFilesDir, p.RelativeTo(GamePath))}); + var loot_path = Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "LOOT"); + + Info($"Indexing {loot_path}"); + VFS.AddRoot(loot_path); + + var loot_files = Directory.EnumerateFiles(loot_path, "userlist.yaml", SearchOption.AllDirectories) + .Where(p => p.FileExists()) + .Select(p => new RawSourceFile(VFS.Lookup(p)) { Path = Path.Combine(Consts.LOOTFolderFilesDir, p.RelativeTo(loot_path)) }); + Info($"Indexing Archives"); IndexedArchives = Directory.EnumerateFiles(MO2DownloadsFolder) @@ -174,7 +183,9 @@ namespace Wabbajack Info("Searching for mod files"); - AllFiles = mo2_files.Concat(game_files).ToList(); + AllFiles = mo2_files.Concat(game_files) + .Concat(loot_files) + .ToList(); Info("Found {0} files to build into mod list", AllFiles.Count); @@ -496,6 +507,7 @@ namespace Wabbajack IncludeThisProfile(), // Ignore the ModOrganizer.ini file it contains info created by MO2 on startup IncludeStubbedMO2Ini(), + IncludeLootFiles(), IgnoreStartsWith(Path.Combine(Consts.GameFolderFilesDir, "Data")), IgnoreStartsWith(Path.Combine(Consts.GameFolderFilesDir, "Papyrus Compiler")), IgnoreStartsWith(Path.Combine(Consts.GameFolderFilesDir, "Skyrim")), @@ -524,6 +536,22 @@ namespace Wabbajack }; } + private Func IncludeLootFiles() + { + var prefix = Consts.LOOTFolderFilesDir + "\\"; + return source => + { + + if (source.Path.StartsWith(prefix)) + { + var result = source.EvolveTo(); + result.SourceData = File.ReadAllBytes(source.AbsolutePath).ToBase64(); + return result; + } + return null; + }; + } + private Func IncludeStubbedMO2Ini() { return source =>