From f63db43a314fdc7c0c5834d1230a4b2b70b888b8 Mon Sep 17 00:00:00 2001 From: Asval Date: Sun, 12 May 2019 21:48:51 +0200 Subject: [PATCH] FModel 2.3 --- FModel/MainWindow.cs | 75 ++++++++++++++++++++++++++++++-------------- README.md | 6 ++-- 2 files changed, 54 insertions(+), 27 deletions(-) diff --git a/FModel/MainWindow.cs b/FModel/MainWindow.cs index 95693574..6f82fe14 100644 --- a/FModel/MainWindow.cs +++ b/FModel/MainWindow.cs @@ -1734,32 +1734,32 @@ namespace FModel Image rarityBg = Resources.T512; toDrawOn.DrawImage(rarityBg, new Point(0, 0)); } - if (theItem.Rarity == "EFortRarity::Mythic") + else if (theItem.Rarity == "EFortRarity::Mythic") { Image rarityBg = Resources.M512; toDrawOn.DrawImage(rarityBg, new Point(0, 0)); } - if (theItem.Rarity == "EFortRarity::Legendary") + else if (theItem.Rarity == "EFortRarity::Legendary") { Image rarityBg = Resources.L512; toDrawOn.DrawImage(rarityBg, new Point(0, 0)); } - if (theItem.Rarity == "EFortRarity::Epic" || theItem.Rarity == "EFortRarity::Quality") + else if (theItem.Rarity == "EFortRarity::Epic" || theItem.Rarity == "EFortRarity::Quality") { Image rarityBg = Resources.E512; toDrawOn.DrawImage(rarityBg, new Point(0, 0)); } - if (theItem.Rarity == "EFortRarity::Rare") + else if (theItem.Rarity == "EFortRarity::Rare") { Image rarityBg = Resources.R512; toDrawOn.DrawImage(rarityBg, new Point(0, 0)); } - if (theItem.Rarity == "EFortRarity::Common" || SpecialMode == "ammo") // Force common rarity if ammo, as ammo is always common in FN + else if (theItem.Rarity == "EFortRarity::Common" || SpecialMode == "ammo") // Force common rarity if ammo, as ammo is always common in FN { Image rarityBg = Resources.C512; toDrawOn.DrawImage(rarityBg, new Point(0, 0)); } - if (theItem.Rarity == null) + else { Image rarityBg = Resources.U512; toDrawOn.DrawImage(rarityBg, new Point(0, 0)); @@ -2004,29 +2004,56 @@ namespace FModel UpdateConsole("Parsing " + catName.Substring(catName.LastIndexOf('.') + 1) + "...", Color.FromArgb(255, 244, 132, 66), "Waiting"); for (int i = 0; i < featuredId.Length; i++) { - if (featuredId[i].DetailsImage != null) + //Thanks EPIC + if (CurrentUsedItem == "DA_Featured_CID_319_Athena_Commando_F_Nautilus") { - string textureFile = featuredId[i].DetailsImage.ResourceObject; - - if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0") - JwpmProcess("extract \"" + Settings.Default.PAKsPath + "\\" + CurrentUsedPak + "\" \"" + textureFile + "\" \"" + DefaultOutputPath + "\" " + Settings.Default.AESKey); - else - JwpmProcess("extract \"" + Settings.Default.PAKsPath + "\\" + AllpaksDictionary[textureFile] + "\" \"" + textureFile + "\" \"" + DefaultOutputPath + "\" " + Settings.Default.AESKey); - string textureFilePath = Directory.GetFiles(DefaultOutputPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).Where(x => !x.EndsWith(".png")).FirstOrDefault(); - - if (textureFilePath != null && textureFilePath.Contains("MI_UI_FeaturedRenderSwitch_")) + if (featuredId[i].TileImage != null) { - ItemIconPath = GetRenderSwitchMaterialTexture(textureFile, textureFilePath); + string textureFile = featuredId[i].TileImage.ResourceObject; + + if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0") + JwpmProcess("extract \"" + Settings.Default.PAKsPath + "\\" + CurrentUsedPak + "\" \"" + textureFile + "\" \"" + DefaultOutputPath + "\" " + Settings.Default.AESKey); + else + JwpmProcess("extract \"" + Settings.Default.PAKsPath + "\\" + AllpaksDictionary[textureFile] + "\" \"" + textureFile + "\" \"" + DefaultOutputPath + "\" " + Settings.Default.AESKey); + string textureFilePath = Directory.GetFiles(DefaultOutputPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).Where(x => !x.EndsWith(".png")).FirstOrDefault(); + + if (textureFilePath != null) + { + MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf('\\')) + "\\" + textureFile); + MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf('\\')) + "\\" + textureFile + ".png"); + ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf('\\')) + "\\" + textureFile + ".png"; + UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success"); + } + else + UpdateConsole("Error while extracting " + textureFile, Color.FromArgb(255, 244, 66, 66), "Error"); } - else if (textureFilePath != null && !textureFilePath.Contains("MI_UI_FeaturedRenderSwitch_")) + } + else + { + if (featuredId[i].DetailsImage != null) { - MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf('\\')) + "\\" + textureFile); - MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf('\\')) + "\\" + textureFile + ".png"); - ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf('\\')) + "\\" + textureFile + ".png"; - UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success"); + string textureFile = featuredId[i].DetailsImage.ResourceObject; + + if (CurrentUsedPakGuid != null && CurrentUsedPakGuid != "0-0-0-0") + JwpmProcess("extract \"" + Settings.Default.PAKsPath + "\\" + CurrentUsedPak + "\" \"" + textureFile + "\" \"" + DefaultOutputPath + "\" " + Settings.Default.AESKey); + else + JwpmProcess("extract \"" + Settings.Default.PAKsPath + "\\" + AllpaksDictionary[textureFile] + "\" \"" + textureFile + "\" \"" + DefaultOutputPath + "\" " + Settings.Default.AESKey); + string textureFilePath = Directory.GetFiles(DefaultOutputPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).Where(x => !x.EndsWith(".png")).FirstOrDefault(); + + if (textureFilePath != null && textureFilePath.Contains("MI_UI_FeaturedRenderSwitch_")) + { + ItemIconPath = GetRenderSwitchMaterialTexture(textureFile, textureFilePath); + } + else if (textureFilePath != null && !textureFilePath.Contains("MI_UI_FeaturedRenderSwitch_")) + { + MyAsset = new PakAsset(textureFilePath.Substring(0, textureFilePath.LastIndexOf('\\')) + "\\" + textureFile); + MyAsset.SaveTexture(textureFilePath.Substring(0, textureFilePath.LastIndexOf('\\')) + "\\" + textureFile + ".png"); + ItemIconPath = textureFilePath.Substring(0, textureFilePath.LastIndexOf('\\')) + "\\" + textureFile + ".png"; + UpdateConsole(textureFile + " successfully converted to .PNG", Color.FromArgb(255, 66, 244, 66), "Success"); + } + else + UpdateConsole("Error while extracting " + textureFile, Color.FromArgb(255, 244, 66, 66), "Error"); } - else - UpdateConsole("Error while extracting " + textureFile, Color.FromArgb(255, 244, 66, 66), "Error"); } } } diff --git a/README.md b/README.md index f8410a9e..872623e5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # FModel -[![](https://img.shields.io/github/downloads/iAmAsval/FModel/total.svg?color=green&label=Downloads&logo=buzzfeed&logoColor=white)](https://github.com/iAmAsval/FModel/releases) +[![](https://img.shields.io/github/downloads/iAmAsval/FModel/total.svg?color=green&label=Total%20Downloads&logo=buzzfeed&logoColor=white)](https://github.com/iAmAsval/FModel/releases) [![](https://img.shields.io/badge/License-GPL-blue.svg?logo=gnu)](https://github.com/iAmAsval/FModel/blob/master/LICENSE) [![](https://img.shields.io/badge/Twitter-@AsvalFN-1da1f2.svg?logo=twitter)](https://twitter.com/AsvalFN) [![](https://img.shields.io/badge/Discord-Need%20Help%3F-7289da.svg?logo=discord)](https://discord.gg/JmWvXKb) @@ -12,7 +12,7 @@ ### Prerequisites [.NET Framework 4.7.1](https://dotnet.microsoft.com/download/dotnet-framework/net471) ### Download -[![](https://img.shields.io/badge/Release-Executable-orange.svg?logo=github)](https://github.com/iAmAsval/FModel/releases/tag/2.2.2) +[![](https://img.shields.io/badge/Release-Executable-orange.svg?logo=github)](https://github.com/iAmAsval/FModel/releases/tag/2.3) ### How does it works **1.** Once you start the executable, you'll be asked to set your path to your Fortnite .PAK files. Meanwhile a `FModel` subfolder will be created in your `Documents` folder and it'll automatically download the latest version of the custom [Fortnite Asset Parser](https://github.com/SirWaddles/JohnWickParse) in this subfolder. @@ -88,7 +88,6 @@ This project is mainly based on what [UModel](https://github.com/gildor2/UModel) I'd highly suggest you to use [UModel](https://github.com/gildor2/UModel) instead if you wanna use something made professionnaly. ## TODO -- [ ] STW Icons - [ ] Get new file content - [ ] Display support for .locres files + compare - [x] Code refactoring @@ -96,6 +95,7 @@ I'd highly suggest you to use [UModel](https://github.com/gildor2/UModel) instea - [x] Stop button - [x] Auto update - [x] CTRL F, CTRL G, CTRL I for jsonTextBox +- [x] STW Icons - [x] Update Mode - [x] Search through PAKs - [x] Improve speed