diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index 61026afe..48ddc559 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -236,19 +236,19 @@ ResXFileCodeGenerator - Resources.Designer.cs Designer + Resources.Designer.cs - - True - Resources.resx - True - SettingsSingleFileGenerator Settings.Designer.cs + + True + True + Resources.resx + True Settings.settings @@ -290,10 +290,6 @@ - - - - diff --git a/FModel/Forms/Settings.Designer.cs b/FModel/Forms/Settings.Designer.cs index 293fa5d3..988f4bce 100644 --- a/FModel/Forms/Settings.Designer.cs +++ b/FModel/Forms/Settings.Designer.cs @@ -38,6 +38,8 @@ namespace FModel.Forms this.label1 = new System.Windows.Forms.Label(); this.OKButton = new System.Windows.Forms.Button(); this.groupBox4 = new System.Windows.Forms.GroupBox(); + this.comboBox2 = new System.Windows.Forms.ComboBox(); + this.label2 = new System.Windows.Forms.Label(); this.comboBox1 = new System.Windows.Forms.ComboBox(); this.label10 = new System.Windows.Forms.Label(); this.checkBox8 = new System.Windows.Forms.CheckBox(); @@ -60,8 +62,7 @@ namespace FModel.Forms this.pictureBox1 = new System.Windows.Forms.PictureBox(); this.textBox6 = new System.Windows.Forms.TextBox(); this.label12 = new System.Windows.Forms.Label(); - this.comboBox2 = new System.Windows.Forms.ComboBox(); - this.label2 = new System.Windows.Forms.Label(); + this.button5 = new System.Windows.Forms.Button(); this.groupBox3.SuspendLayout(); this.groupBox2.SuspendLayout(); this.groupBox4.SuspendLayout(); @@ -174,6 +175,28 @@ namespace FModel.Forms this.groupBox4.TabStop = false; this.groupBox4.Text = "Icon Creation"; // + // comboBox2 + // + this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; + this.comboBox2.FormattingEnabled = true; + this.comboBox2.Items.AddRange(new object[] { + "Default", + "Flat"}); + this.comboBox2.Location = new System.Drawing.Point(85, 48); + this.comboBox2.Name = "comboBox2"; + this.comboBox2.Size = new System.Drawing.Size(294, 21); + this.comboBox2.TabIndex = 31; + this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.ComboBox2_SelectedIndexChanged); + // + // label2 + // + this.label2.AutoSize = true; + this.label2.Location = new System.Drawing.Point(6, 51); + this.label2.Name = "label2"; + this.label2.Size = new System.Drawing.Size(73, 13); + this.label2.TabIndex = 30; + this.label2.Text = "Rarity Design:"; + // // comboBox1 // this.comboBox1.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; @@ -304,6 +327,7 @@ namespace FModel.Forms // // groupBox6 // + this.groupBox6.Controls.Add(this.button5); this.groupBox6.Controls.Add(this.button3); this.groupBox6.Controls.Add(this.button2); this.groupBox6.Controls.Add(this.label7); @@ -422,27 +446,15 @@ namespace FModel.Forms this.label12.TabIndex = 9; this.label12.Text = "Watermark:"; // - // comboBox2 + // button5 // - this.comboBox2.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; - this.comboBox2.FormattingEnabled = true; - this.comboBox2.Items.AddRange(new object[] { - "Default", - "Flat"}); - this.comboBox2.Location = new System.Drawing.Point(85, 48); - this.comboBox2.Name = "comboBox2"; - this.comboBox2.Size = new System.Drawing.Size(294, 21); - this.comboBox2.TabIndex = 31; - this.comboBox2.SelectedIndexChanged += new System.EventHandler(this.ComboBox2_SelectedIndexChanged); - // - // label2 - // - this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(6, 51); - this.label2.Name = "label2"; - this.label2.Size = new System.Drawing.Size(73, 13); - this.label2.TabIndex = 30; - this.label2.Text = "Rarity Design:"; + this.button5.Location = new System.Drawing.Point(168, 48); + this.button5.Name = "button5"; + this.button5.Size = new System.Drawing.Size(124, 23); + this.button5.TabIndex = 34; + this.button5.Text = "Delete Current Banner"; + this.button5.UseVisualStyleBackColor = true; + this.button5.Click += new System.EventHandler(this.Button5_Click); // // Settings // @@ -514,5 +526,6 @@ namespace FModel.Forms private System.Windows.Forms.Label label7; private System.Windows.Forms.ComboBox comboBox2; private System.Windows.Forms.Label label2; + private System.Windows.Forms.Button button5; } } diff --git a/FModel/Forms/Settings.cs b/FModel/Forms/Settings.cs index d068e9db..de85cdeb 100644 --- a/FModel/Forms/Settings.cs +++ b/FModel/Forms/Settings.cs @@ -34,7 +34,6 @@ namespace FModel.Forms { textBox6.Text = "@UseTheWatermarkBecauseWhyNot - {Date}"; } - else { textBox6.Text = Properties.Settings.Default.challengesWatermark; } checkBox_tryToOpen.Checked = Properties.Settings.Default.tryToOpenAssets; @@ -55,12 +54,16 @@ namespace FModel.Forms button3.Enabled = Properties.Settings.Default.isChallengesTheme; button4.Enabled = Properties.Settings.Default.isChallengesTheme; checkBox2.Checked = Properties.Settings.Default.isChallengesTheme; - trackBar3.Enabled = Properties.Settings.Default.isChallengesTheme; + trackBar3.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName); + button5.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName); trackBar3.Value = Properties.Settings.Default.challengesOpacity; string[] colorParts = Properties.Settings.Default.challengesColors.Split(','); headerColor = Color.FromArgb(255, Int32.Parse(colorParts[0]), Int32.Parse(colorParts[1]), Int32.Parse(colorParts[2])); - if (File.Exists(Properties.Settings.Default.challengesBannerFileName)) { drawChallengeTemplate(headerColor, true); } - else { pictureBox1.Image = Resources.cTemplate; } + if (!checkBox2.Checked) + { + pictureBox1.Image = Resources.cTemplate; + } + else { drawChallengeTemplate(headerColor, File.Exists(Properties.Settings.Default.challengesBannerFileName)); } //FEATURED checkBox8.Checked = Properties.Settings.Default.loadFeaturedImage; @@ -292,7 +295,7 @@ namespace FModel.Forms { button3.Enabled = checkBox2.Checked; button4.Enabled = checkBox2.Checked; - trackBar3.Enabled = checkBox2.Checked; + trackBar3.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName); if (!checkBox2.Checked) { @@ -423,6 +426,9 @@ namespace FModel.Forms Properties.Settings.Default.Save(); drawChallengeTemplate(headerColor, File.Exists(Properties.Settings.Default.challengesBannerFileName)); + + trackBar3.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName); + button5.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName); } } @@ -441,5 +447,16 @@ namespace FModel.Forms { bmp.Dispose(); } + + private void Button5_Click(object sender, EventArgs e) + { + Properties.Settings.Default.challengesBannerFileName = ""; + Properties.Settings.Default.Save(); + + drawChallengeTemplate(headerColor, File.Exists(Properties.Settings.Default.challengesBannerFileName)); + + trackBar3.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName); + button5.Enabled = File.Exists(Properties.Settings.Default.challengesBannerFileName); + } } } diff --git a/FModel/Methods/IconGenerator/ItemGenerator/DrawText.cs b/FModel/Methods/IconGenerator/ItemGenerator/DrawText.cs index e8b6d90e..c2d31bfd 100644 --- a/FModel/Methods/IconGenerator/ItemGenerator/DrawText.cs +++ b/FModel/Methods/IconGenerator/ItemGenerator/DrawText.cs @@ -5,6 +5,7 @@ using Newtonsoft.Json.Linq; using System.Drawing; using System.Linq; using System.IO; +using System.Collections.Generic; namespace FModel { @@ -18,12 +19,13 @@ namespace FModel private static string ItemAction { get; set; } private static string WeaponDataTable { get; set; } private static string WeaponRowName { get; set; } - private static string CosmeticUff { get; set; } + private static string[] CosmeticUff { get; set; } private static string HeroType { get; set; } private static string DefenderType { get; set; } private static string MinToMax { get; set; } private static JArray cosmeticsSetsArray { get; set; } private static JArray weaponsStatsArray { get; set; } + private static JArray tertiaryCategoriesArray { get; set; } private static string weaponStatsFilename { get; set; } public static void DrawTexts(JToken theItem, Graphics myGraphic, string mode) @@ -95,7 +97,7 @@ namespace FModel ItemAction = ""; WeaponDataTable = ""; WeaponRowName = ""; - CosmeticUff = ""; + CosmeticUff = null; HeroType = ""; DefenderType = ""; MinToMax = ""; @@ -162,10 +164,14 @@ namespace FModel ItemAction = athenaItemAction.Value().Substring(18); } - JToken userFacingFlags = gameplayTagsArray.Children().FirstOrDefault(x => x.ToString().StartsWith("Cosmetics.UserFacingFlags.")); + IEnumerable userFacingFlags = gameplayTagsArray.Children().Where(x => x.ToString().StartsWith("Cosmetics.UserFacingFlags.")); if (userFacingFlags != null) { - CosmeticUff = userFacingFlags.Value(); + CosmeticUff = new string[userFacingFlags.Count()]; + for (int i = 0; i < CosmeticUff.Length; i++) + { + CosmeticUff[i] = userFacingFlags.ElementAt(i).Value().Substring("Cosmetics.UserFacingFlags.".Length); + } } JToken defenderType = gameplayTagsArray.Children().FirstOrDefault(x => x.ToString().StartsWith("NPC.CharacterType.Survivor.Defender.")); @@ -226,37 +232,136 @@ namespace FModel } } + private static void DrawCosmeticUff(JToken theItem, Graphics myGraphic) + { + if (tertiaryCategoriesArray == null) + { + string extractedCosmeticsSetsPath = JohnWick.ExtractAsset(ThePak.AllpaksDictionary["ItemCategories"], "ItemCategories"); + if (extractedCosmeticsSetsPath != null) + { + if (extractedCosmeticsSetsPath.Contains(".uasset") || extractedCosmeticsSetsPath.Contains(".uexp") || extractedCosmeticsSetsPath.Contains(".ubulk")) + { + JohnWick.MyAsset = new PakAsset(extractedCosmeticsSetsPath.Substring(0, extractedCosmeticsSetsPath.LastIndexOf('.'))); + try + { + if (JohnWick.MyAsset.GetSerialized() != null) + { + dynamic AssetData = JsonConvert.DeserializeObject(JohnWick.MyAsset.GetSerialized()); + JToken tertiaryCategories = AssetData[0]["TertiaryCategories"]; + if (tertiaryCategories != null) + { + tertiaryCategoriesArray = tertiaryCategories.Value(); + DrawCosmeticUffFromArray(theItem, myGraphic); + } + } + } + catch (JsonSerializationException) + { + //do not crash when JsonSerialization does weird stuff + } + } + } + } + else { DrawCosmeticUffFromArray(theItem, myGraphic); } + } /// /// search for a known Cosmetics.UserFacingFlags, if found draw the uff icon /// Cosmetics.UserFacingFlags icons are basically the style icon or the animated/reactive/traversal icon /// /// /// - private static void DrawCosmeticUff(JToken theItem, Graphics myGraphic) + private static void DrawCosmeticUffFromArray(JToken theItem, Graphics myGraphic) { - Image imageLogo = null; - Point pointCoords = new Point(6, 6); - if (CosmeticUff != null) { - if (CosmeticUff.Contains("Animated")) - imageLogo = Resources.Animated64; - else if (CosmeticUff.Contains("HasUpgradeQuests") && !theItem["export_type"].Value().Equals("AthenaPetCarrierItemDefinition")) - imageLogo = Resources.Quests64; - else if (CosmeticUff.Contains("HasUpgradeQuests") && theItem["export_type"].Value().Equals("AthenaPetCarrierItemDefinition")) - imageLogo = Resources.Pets64; - else if (CosmeticUff.Contains("HasVariants")) - imageLogo = Resources.Variant64; - else if (CosmeticUff.Contains("Reactive")) - imageLogo = Resources.Adaptive64; - else if (CosmeticUff.Contains("Traversal")) - imageLogo = Resources.Traversal64; + int xCoord = 6; + for (int x = 0; x < tertiaryCategoriesArray.Count; x++) + { + JToken categoryName = tertiaryCategoriesArray[x]["CategoryName"]; + if (categoryName != null) + { + JToken text = categoryName["source_string"]; + if (text != null) + { + if (CosmeticUff.Any(target => target.Contains("Animated")) && string.Equals(text.Value(), "Animated")) + { + Image imageLogo = getUffFromBrush(x); + drawImageLogo(myGraphic, imageLogo, xCoord); + xCoord += 28; + } + else if (CosmeticUff.Any(target => target.Contains("HasVariants")) && string.Equals(text.Value(), "Unlockable Styles")) + { + Image imageLogo = getUffFromBrush(x); + drawImageLogo(myGraphic, imageLogo, xCoord); + xCoord += 28; + } + else if (CosmeticUff.Any(target => target.Contains("Reactive")) && string.Equals(text.Value(), "Reactive")) + { + Image imageLogo = getUffFromBrush(x); + drawImageLogo(myGraphic, imageLogo, xCoord); + xCoord += 28; + } + else if (CosmeticUff.Any(target => target.Contains("Traversal")) && string.Equals(text.Value(), "Traversal")) + { + Image imageLogo = getUffFromBrush(x); + drawImageLogo(myGraphic, imageLogo, xCoord); + xCoord += 28; + } + else if (CosmeticUff.Any(target => target.Contains("BuiltInEmote")) && string.Equals(text.Value(), "Built-in")) + { + Image imageLogo = getUffFromBrush(x); + drawImageLogo(myGraphic, imageLogo, xCoord); + xCoord += 28; + } + else if (CosmeticUff.Any(target => target.Contains("HasUpgradeQuests")) && string.Equals(text.Value(), "Unlockable Styles") && !theItem["export_type"].Value().Equals("AthenaPetCarrierItemDefinition")) + { + Image imageLogo = Resources.Quests64; + drawImageLogo(myGraphic, imageLogo, xCoord); + xCoord += 28; + } + else if (CosmeticUff.Any(target => target.Contains("HasUpgradeQuests")) && string.Equals(text.Value(), "Unlockable Styles") && theItem["export_type"].Value().Equals("AthenaPetCarrierItemDefinition")) + { + Image imageLogo = Resources.Pets64; + drawImageLogo(myGraphic, imageLogo, xCoord); + xCoord += 28; + } + } + } + } } - - if (imageLogo != null) + } + private static Image getUffFromBrush(int index) + { + JToken categoryBrush = tertiaryCategoriesArray[index]["CategoryBrush"]; + if (categoryBrush != null) { - myGraphic.DrawImage(ImageUtilities.ResizeImage(imageLogo, 28, 28), pointCoords); - imageLogo.Dispose(); + JToken brush_XXS = categoryBrush["Brush_XXS"]; + if (brush_XXS != null) + { + JToken resourceObject = brush_XXS["ResourceObject"]; + if (resourceObject != null) + { + string texture = JohnWick.AssetToTexture2D(resourceObject.Value()); + if (!string.IsNullOrEmpty(texture)) + { + return Image.FromFile(texture); + } + else { return null; } + } + else { return null; } + } + else { return null; } + } + else { return null; } + } + private static void drawImageLogo(Graphics myGraphic, Image logo, int x) + { + if (logo != null) + { + Point pointCoords = new Point(x, 6); + + myGraphic.DrawImage(ImageUtilities.ResizeImage(logo, 28, 28), pointCoords); + logo.Dispose(); } } diff --git a/FModel/Methods/IconGenerator/ItemGenerator/ItemIcon.cs b/FModel/Methods/IconGenerator/ItemGenerator/ItemIcon.cs index ad18be2a..ff4b76a3 100644 --- a/FModel/Methods/IconGenerator/ItemGenerator/ItemIcon.cs +++ b/FModel/Methods/IconGenerator/ItemGenerator/ItemIcon.cs @@ -3,7 +3,6 @@ using FModel.Properties; using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; -using System.Collections.Generic; using System.Drawing; using System.IO; using System.Linq; diff --git a/FModel/Properties/Resources.Designer.cs b/FModel/Properties/Resources.Designer.cs index 4128625e..040753ad 100644 --- a/FModel/Properties/Resources.Designer.cs +++ b/FModel/Properties/Resources.Designer.cs @@ -60,26 +60,6 @@ namespace FModel.Properties { } } - /// - /// Recherche une ressource localisée de type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Adaptive64 { - get { - object obj = ResourceManager.GetObject("Adaptive64", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - - /// - /// Recherche une ressource localisée de type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Animated64 { - get { - object obj = ResourceManager.GetObject("Animated64", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Recherche une ressource localisée de type System.Byte[]. /// @@ -310,16 +290,6 @@ namespace FModel.Properties { } } - /// - /// Recherche une ressource localisée de type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Traversal64 { - get { - object obj = ResourceManager.GetObject("Traversal64", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Recherche une ressource localisée de type System.Drawing.Icon semblable à (Icône). /// @@ -350,16 +320,6 @@ namespace FModel.Properties { } } - /// - /// Recherche une ressource localisée de type System.Drawing.Bitmap. - /// - internal static System.Drawing.Bitmap Variant64 { - get { - object obj = ResourceManager.GetObject("Variant64", resourceCulture); - return ((System.Drawing.Bitmap)(obj)); - } - } - /// /// Recherche une ressource localisée de type System.Drawing.Bitmap. /// diff --git a/FModel/Properties/Resources.resx b/FModel/Properties/Resources.resx index 281b8d53..891d868c 100644 --- a/FModel/Properties/Resources.resx +++ b/FModel/Properties/Resources.resx @@ -142,18 +142,6 @@ ..\Resources\FModel_Logo.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - ..\Resources\T-Icon-Adaptive-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\T-Icon-Animated-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\T-Icon-Traversal-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - - - ..\Resources\T-Icon-Variant-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a - ..\Resources\T-Icon-Quests-64.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a diff --git a/FModel/Resources/T-Icon-Adaptive-64.png b/FModel/Resources/T-Icon-Adaptive-64.png deleted file mode 100644 index 95b4789c..00000000 Binary files a/FModel/Resources/T-Icon-Adaptive-64.png and /dev/null differ diff --git a/FModel/Resources/T-Icon-Animated-64.png b/FModel/Resources/T-Icon-Animated-64.png deleted file mode 100644 index eea5002d..00000000 Binary files a/FModel/Resources/T-Icon-Animated-64.png and /dev/null differ diff --git a/FModel/Resources/T-Icon-Traversal-64.png b/FModel/Resources/T-Icon-Traversal-64.png deleted file mode 100644 index 9ac1e6a4..00000000 Binary files a/FModel/Resources/T-Icon-Traversal-64.png and /dev/null differ diff --git a/FModel/Resources/T-Icon-Variant-64.png b/FModel/Resources/T-Icon-Variant-64.png deleted file mode 100644 index 5f82477b..00000000 Binary files a/FModel/Resources/T-Icon-Variant-64.png and /dev/null differ diff --git a/README.md b/README.md index 91e9a511..14fea0af 100644 --- a/README.md +++ b/README.md @@ -56,28 +56,28 @@ [Demonstration](https://streamable.com/c39oz) ## DOCUMENTATION -### Q&A -_What's FModel?_ +### FAQ +- _What's FModel?_ - FModel is a Fortnite .PAK files explorer mainly known to create icons for different BR/STW items as well as all BR challenges -_Where can i download FModel?_ -[Latest Version](https://github.com/iAmAsval/FModel/releases/latest/download/FModel.zip) +- _Where can i download FModel?_ + - [Latest Version](https://github.com/iAmAsval/FModel/releases/latest/download/FModel.zip) -_I'm sure the key is correct but opening the file with this key isn't working_ +- _I'm sure the key is correct but opening the file with this key isn't working_ - First, make sure `C:\Windows\System32\vcruntime140.dll` isn't missing. If it's missing you can download it by installing [Microsoft Visual C++ Redistributable](https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads). - If it's not missing you can open on issue on GitHub or contact us on Twitter @AsvalFN @MaikyMOficial @iFireMonkey -_I can't compile the solution on Visual Studio_ +- _I can't compile the solution on Visual Studio_ - If issues occur when compiling the source code, make sure that the software is being built for x64. -_Why FModel?_ +- _Why FModel?_ - The name come from the popular Unreal Engine Viewer [UModel](https://github.com/gildor2/UModel) - - It wasn't made to be a competitor but more to complete what was missing exclusively on Fortnite - - Icon creation with languages support, an area to display the serialized asset, single pak file loader, and more). + - It wasn't made to be a competitor but more to complete what was missing for Fortnite + - Icon creation with languages support, an area to display the serialized asset, single pak file loader, and more. If you find this project useful, feel free to give it a :star: thank you :kissing_heart: