From 3890db712bf4d9fa166f0e0b6df7bb176bfd505a Mon Sep 17 00:00:00 2001 From: Asval Date: Wed, 22 May 2019 11:45:14 +0200 Subject: [PATCH] bitmap resize for fortbyte challenges + fixed colors --- FModel/FModel.csproj | 2 +- FModel/MainWindow.cs | 15 +++++++-------- FModel/Methods/JohnWick/JohnWick.cs | 25 ++++++++++--------------- 3 files changed, 18 insertions(+), 24 deletions(-) diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index 7f92f83a..5093b1af 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -5,7 +5,7 @@ Debug AnyCPU {8FABCD3A-9D55-4B54-B237-B259D815DEB8} - WinExe + Exe FModel FModel v4.7.1 diff --git a/FModel/MainWindow.cs b/FModel/MainWindow.cs index bfa64dd0..a6475e88 100644 --- a/FModel/MainWindow.cs +++ b/FModel/MainWindow.cs @@ -2435,19 +2435,18 @@ namespace FModel int sBlue; string seasonFolder = questJson.Substring(questJson.Substring(0, questJson.LastIndexOf("\\", StringComparison.Ordinal)).LastIndexOf("\\", StringComparison.Ordinal) + 1).ToUpper(); + sRed = (int)(myBundle.DisplayStyle.AccentColor.R * 255); + sGreen = (int)(myBundle.DisplayStyle.AccentColor.G * 255); + sBlue = (int)(myBundle.DisplayStyle.AccentColor.B * 255); - if (seasonFolder.Substring(0, seasonFolder.LastIndexOf("\\", StringComparison.Ordinal)) != "LTM") + if (sRed <= 25 && sGreen <= 25 && sBlue <= 25) { sRed = (int)(myBundle.DisplayStyle.SecondaryColor.R * 255); sGreen = (int)(myBundle.DisplayStyle.SecondaryColor.G * 255); sBlue = (int)(myBundle.DisplayStyle.SecondaryColor.B * 255); } - else - { - sRed = (int)(myBundle.DisplayStyle.AccentColor.R * 255); - sGreen = (int)(myBundle.DisplayStyle.AccentColor.G * 255); - sBlue = (int)(myBundle.DisplayStyle.AccentColor.B * 255); - } + + Console.WriteLine(sRed + " " + sGreen + " " + sBlue); int seasonRed = Convert.ToInt32(sRed / 1.5); int seasonGreen = Convert.ToInt32(sGreen / 1.5); @@ -2964,7 +2963,7 @@ namespace FModel } private void CreateFortByteChallengesIcon(ItemsIdParser theItem, string theParsedJson, string questJson = null) { - Bitmap bmp = new Bitmap(2500, 7500); + Bitmap bmp = new Bitmap(2500, 10000); Graphics g = Graphics.FromImage(bmp); g.TextRenderingHint = TextRenderingHint.AntiAliasGridFit; g.SmoothingMode = SmoothingMode.HighQuality; diff --git a/FModel/Methods/JohnWick/JohnWick.cs b/FModel/Methods/JohnWick/JohnWick.cs index c9b8342a..4164b485 100644 --- a/FModel/Methods/JohnWick/JohnWick.cs +++ b/FModel/Methods/JohnWick/JohnWick.cs @@ -42,8 +42,6 @@ namespace FModel public static string ExtractAsset(string currentPak, string currentItem) { - string toReturn = string.Empty; - MyExtractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + currentPak, Settings.Default.AESKey); string[] myArray = MyExtractor.GetFileList().ToArray(); @@ -53,6 +51,7 @@ namespace FModel else results = Array.FindAll(myArray, s => s.Contains("/" + currentItem + ".")); + string AssetPath = string.Empty; for (int i = 0; i < results.Length; i++) { int index = Array.IndexOf(myArray, results[i]); @@ -60,21 +59,20 @@ namespace FModel uint y = (uint)index; byte[] b = MyExtractor.GetData(y); - toReturn = WriteFile(currentItem, results[i], b); + AssetPath = WriteFile(currentItem, results[i], b).Replace("/", "\\"); } - - return toReturn.Replace("/", "\\"); + return AssetPath; } public static string AssetToTexture2D(string AssetName) { - string toReturn = string.Empty; - string textureFilePath; if (ThePak.CurrentUsedPakGuid != null && ThePak.CurrentUsedPakGuid != "0-0-0-0") textureFilePath = ExtractAsset(ThePak.CurrentUsedPak, AssetName); else textureFilePath = ExtractAsset(ThePak.AllpaksDictionary[AssetName ?? throw new InvalidOperationException()], AssetName); + + string TexturePath = string.Empty; if (textureFilePath != null && (textureFilePath.Contains("MI_UI_FeaturedRenderSwitch_") || textureFilePath.Contains("M_UI_ChallengeTile_PCB"))) { return GetRenderSwitchMaterialTexture(AssetName, textureFilePath); @@ -83,15 +81,13 @@ namespace FModel { MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal))); MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png"); - toReturn = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png"; + TexturePath = textureFilePath.Substring(0, textureFilePath.LastIndexOf(".", StringComparison.Ordinal)) + ".png"; } - - return toReturn; + return TexturePath; } public static string GetRenderSwitchMaterialTexture(string AssetName, string AssetPath) { - string toReturn = string.Empty; - + string TexturePath = string.Empty; if (AssetPath.Contains(".uasset") || AssetPath.Contains(".uexp") || AssetPath.Contains(".ubulk")) { MyAsset = new PakAsset(AssetPath.Substring(0, AssetPath.LastIndexOf('.'))); @@ -107,15 +103,14 @@ namespace FModel { string textureFile = rsmid[i].TextureParameterValues.FirstOrDefault()?.ParameterValue; - toReturn = AssetToTexture2D(textureFile); + TexturePath = AssetToTexture2D(textureFile); } } } } catch (JsonSerializationException) { } } - - return toReturn; + return TexturePath; } } }