diff --git a/FModel/App.config b/FModel/App.config index 65f4e78a..aff2ae65 100644 --- a/FModel/App.config +++ b/FModel/App.config @@ -22,6 +22,9 @@ 0 + + False + \ No newline at end of file diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index d4103fc2..55801622 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -146,6 +146,8 @@ + + diff --git a/FModel/Options.Designer.cs b/FModel/Options.Designer.cs index 8dbf976b..8124662a 100644 --- a/FModel/Options.Designer.cs +++ b/FModel/Options.Designer.cs @@ -44,11 +44,12 @@ this.textBox2 = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); this.groupBox4 = new System.Windows.Forms.GroupBox(); - this.label6 = new System.Windows.Forms.Label(); - this.checkBox2 = new System.Windows.Forms.CheckBox(); - this.checkBox3 = new System.Windows.Forms.CheckBox(); - this.checkBox4 = new System.Windows.Forms.CheckBox(); this.checkBox5 = new System.Windows.Forms.CheckBox(); + this.checkBox4 = new System.Windows.Forms.CheckBox(); + this.checkBox3 = new System.Windows.Forms.CheckBox(); + this.checkBox2 = new System.Windows.Forms.CheckBox(); + this.label6 = new System.Windows.Forms.Label(); + this.checkBox6 = new System.Windows.Forms.CheckBox(); this.groupBox1.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.imgsPerRow)).BeginInit(); this.groupBox2.SuspendLayout(); @@ -200,6 +201,7 @@ // // groupBox4 // + this.groupBox4.Controls.Add(this.checkBox6); this.groupBox4.Controls.Add(this.checkBox5); this.groupBox4.Controls.Add(this.checkBox4); this.groupBox4.Controls.Add(this.checkBox3); @@ -212,54 +214,64 @@ this.groupBox4.TabStop = false; this.groupBox4.Text = "Icon Creation"; // - // label6 + // checkBox5 // - this.label6.AutoSize = true; - this.label6.Location = new System.Drawing.Point(6, 20); - this.label6.Name = "label6"; - this.label6.Size = new System.Drawing.Size(112, 13); - this.label6.TabIndex = 0; - this.label6.Text = "Supported Subfolders:"; - // - // checkBox2 - // - this.checkBox2.AutoSize = true; - this.checkBox2.Location = new System.Drawing.Point(124, 19); - this.checkBox2.Name = "checkBox2"; - this.checkBox2.Size = new System.Drawing.Size(74, 17); - this.checkBox2.TabIndex = 1; - this.checkBox2.Text = "Cosmetics"; - this.checkBox2.UseVisualStyleBackColor = true; - // - // checkBox3 - // - this.checkBox3.AutoSize = true; - this.checkBox3.Location = new System.Drawing.Point(329, 19); - this.checkBox3.Name = "checkBox3"; - this.checkBox3.Size = new System.Drawing.Size(147, 17); - this.checkBox3.TabIndex = 2; - this.checkBox3.Text = "Consumables && Weapons"; - this.checkBox3.UseVisualStyleBackColor = true; + this.checkBox5.AutoSize = true; + this.checkBox5.Location = new System.Drawing.Point(189, 19); + this.checkBox5.Name = "checkBox5"; + this.checkBox5.Size = new System.Drawing.Size(64, 17); + this.checkBox5.TabIndex = 4; + this.checkBox5.Text = "Variants"; + this.checkBox5.UseVisualStyleBackColor = true; // // checkBox4 // this.checkBox4.AutoSize = true; - this.checkBox4.Location = new System.Drawing.Point(501, 19); + this.checkBox4.Location = new System.Drawing.Point(415, 19); this.checkBox4.Name = "checkBox4"; this.checkBox4.Size = new System.Drawing.Size(53, 17); this.checkBox4.TabIndex = 3; this.checkBox4.Text = "Traps"; this.checkBox4.UseVisualStyleBackColor = true; // - // checkBox5 + // checkBox3 // - this.checkBox5.AutoSize = true; - this.checkBox5.Location = new System.Drawing.Point(230, 19); - this.checkBox5.Name = "checkBox5"; - this.checkBox5.Size = new System.Drawing.Size(64, 17); - this.checkBox5.TabIndex = 4; - this.checkBox5.Text = "Variants"; - this.checkBox5.UseVisualStyleBackColor = true; + this.checkBox3.AutoSize = true; + this.checkBox3.Location = new System.Drawing.Point(261, 19); + this.checkBox3.Name = "checkBox3"; + this.checkBox3.Size = new System.Drawing.Size(147, 17); + this.checkBox3.TabIndex = 2; + this.checkBox3.Text = "Consumables && Weapons"; + this.checkBox3.UseVisualStyleBackColor = true; + // + // checkBox2 + // + this.checkBox2.AutoSize = true; + this.checkBox2.Location = new System.Drawing.Point(108, 19); + this.checkBox2.Name = "checkBox2"; + this.checkBox2.Size = new System.Drawing.Size(74, 17); + this.checkBox2.TabIndex = 1; + this.checkBox2.Text = "Cosmetics"; + this.checkBox2.UseVisualStyleBackColor = true; + // + // label6 + // + this.label6.AutoSize = true; + this.label6.Location = new System.Drawing.Point(6, 20); + this.label6.Name = "label6"; + this.label6.Size = new System.Drawing.Size(96, 13); + this.label6.TabIndex = 0; + this.label6.Text = "Supported Folders:"; + // + // checkBox6 + // + this.checkBox6.AutoSize = true; + this.checkBox6.Location = new System.Drawing.Point(476, 19); + this.checkBox6.Name = "checkBox6"; + this.checkBox6.Size = new System.Drawing.Size(78, 17); + this.checkBox6.TabIndex = 14; + this.checkBox6.Text = "Challenges"; + this.checkBox6.UseVisualStyleBackColor = true; // // OptionsWindow // @@ -312,5 +324,6 @@ private System.Windows.Forms.CheckBox checkBox3; private System.Windows.Forms.CheckBox checkBox4; private System.Windows.Forms.CheckBox checkBox5; + private System.Windows.Forms.CheckBox checkBox6; } } \ No newline at end of file diff --git a/FModel/Options.cs b/FModel/Options.cs index e6728d8f..7e32dc2c 100644 --- a/FModel/Options.cs +++ b/FModel/Options.cs @@ -29,6 +29,7 @@ namespace FModel checkBox5.Checked = Properties.Settings.Default.createIconForVariants; checkBox3.Checked = Properties.Settings.Default.createIconForConsumablesWeapons; checkBox4.Checked = Properties.Settings.Default.createIconForTraps; + checkBox6.Checked = Properties.Settings.Default.createIconForChallenges; PAKBefore = Properties.Settings.Default.FortnitePAKs; OutputBefore = Properties.Settings.Default.ExtractOutput; @@ -76,6 +77,14 @@ namespace FModel { Properties.Settings.Default.createIconForTraps = false; } + if (checkBox6.Checked == true) + { + Properties.Settings.Default.createIconForChallenges = true; + } + if (checkBox6.Checked == false) + { + Properties.Settings.Default.createIconForChallenges = false; + } Properties.Settings.Default.ExtractOutput = textBox1.Text; diff --git a/FModel/PAKWindow.cs b/FModel/PAKWindow.cs index 6509092b..c3edcb0c 100644 --- a/FModel/PAKWindow.cs +++ b/FModel/PAKWindow.cs @@ -19,6 +19,7 @@ using System.Runtime.InteropServices; using System.Threading.Tasks; using System.Windows.Forms; using System.Threading; +using System.Text.RegularExpressions; namespace FModel { @@ -31,6 +32,7 @@ namespace FModel public static string[] SelectedArray; public static string[] challengesArray; public static Dictionary questStageDict; + public static Dictionary questDictFinal; PrivateFontCollection pfc = new PrivateFontCollection(); StringFormat centeredString = new StringFormat(); @@ -38,6 +40,8 @@ namespace FModel StringFormat centeredStringLine = new StringFormat(); private int fontLength; private byte[] fontdata; + private int fontLength2; + private byte[] fontdata2; [DllImport("uxtheme.dll", ExactSpelling = true, CharSet = CharSet.Unicode)] private static extern int SetWindowTheme(IntPtr hwnd, string pszSubAppName, string pszSubIdList); @@ -103,6 +107,7 @@ namespace FModel Properties.Settings.Default.createIconForVariants = true; Properties.Settings.Default.createIconForConsumablesWeapons = true; Properties.Settings.Default.createIconForTraps = true; + Properties.Settings.Default.createIconForChallenges = true; docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() + "\\FModel"; if (string.IsNullOrEmpty(Properties.Settings.Default.ExtractOutput)) @@ -205,6 +210,12 @@ namespace FModel Marshal.Copy(fontdata, 0, weirdData, fontLength); pfc.AddMemoryFont(weirdData, fontLength); + fontLength2 = Properties.Resources.BurbankBigCondensed_Black.Length; + fontdata2 = Properties.Resources.BurbankBigCondensed_Black; + System.IntPtr weirdData2 = Marshal.AllocCoTaskMem(fontLength2); + Marshal.Copy(fontdata2, 0, weirdData2, fontLength2); + pfc.AddMemoryFont(weirdData2, fontLength2); + centeredString.Alignment = StringAlignment.Center; rightString.Alignment = StringAlignment.Far; centeredStringLine.LineAlignment = StringAlignment.Center; @@ -679,6 +690,8 @@ namespace FModel if (!questStageDict.ContainsKey(questParser2[p2].Objectives[pp].Description)) //AVOID DUPLICATA, THANKS EPIC... { questStageDict.Add(questParser2[p2].Objectives[pp].Description, questParser2[p2].Objectives[pp].Count); + questDictFinal.Add(questParser2[p2].Objectives[pp].Description, questParser2[p2].Objectives[pp].Count); + AppendText(questParser2[p2].Objectives[pp].Description, Color.SteelBlue); AppendText("\t\tCount: " + questParser2[p2].Objectives[pp].Count, Color.DarkRed, true); } @@ -716,6 +729,7 @@ namespace FModel scintilla1.Text = ""; ItemIconPictureBox.Image = null; questStageDict = new Dictionary(); + questDictFinal = new Dictionary(); if (!Directory.Exists(docPath + "\\Extracted\\")) //Create Extracted Subfolder Directory.CreateDirectory(docPath + "\\Extracted\\"); @@ -1982,6 +1996,7 @@ namespace FModel for (int iii = 0; iii < ChallengeParser.Length; iii++) { + ItemName = ChallengeParser[iii].DisplayName.ToUpper(); challengesArray = new string[ChallengeParser[iii].QuestInfos.Length]; for (int y = 0; y < ChallengeParser[iii].QuestInfos.Length; y++) { @@ -2023,13 +2038,25 @@ namespace FModel string newQuest = questParser[p].Objectives[pp].Description; if (newQuest != oldQuest) { + if (!questDictFinal.ContainsKey(questParser[p].Objectives[pp].Description)) + { + questDictFinal.Add(questParser[p].Objectives[pp].Description, questParser[p].Objectives[pp].Count); + } AppendText(questParser[p].Objectives[pp].Description, Color.SteelBlue); AppendText("\t\tCount: " + questParser[p].Objectives[pp].Count, Color.DarkRed, true); + oldQuest = questParser[p].Objectives[pp].Description; } - for (int ppp = 0; ppp < questParser[p].Rewards.Length; ppp++) + try { - loopStageQuest(questParser[p].Rewards[ppp].ItemPrimaryAssetId.PrimaryAssetType.Name, questParser[p].Rewards[ppp].ItemPrimaryAssetId.PrimaryAssetName); + for (int ppp = 0; ppp < questParser[p].Rewards.Length; ppp++) + { + loopStageQuest(questParser[p].Rewards[ppp].ItemPrimaryAssetId.PrimaryAssetType.Name, questParser[p].Rewards[ppp].ItemPrimaryAssetId.PrimaryAssetName); + } + } + catch (Exception ex) + { + Console.WriteLine(ex.Message); } } } @@ -2051,6 +2078,63 @@ namespace FModel } } } + + if (Properties.Settings.Default.createIconForChallenges == true) + { + Bitmap bmp = new Bitmap(Properties.Resources.Quest); + Graphics g = Graphics.FromImage(bmp); + g.TextRenderingHint = TextRenderingHint.AntiAlias; + int iamY = 400; + foreach (var d in questDictFinal) + { + iamY += 100; + g.DrawString(d.Key, new Font(pfc.Families[1], 50), new SolidBrush(Color.White), new Point(100, iamY)); + g.DrawString("/" + d.Value, new Font(pfc.Families[1], 50), new SolidBrush(Color.FromArgb(255, 149, 213, 255)), new Point(2410, iamY), rightString); + g.DrawLine(new Pen(Color.FromArgb(30, 255, 255, 255)), 100, iamY - 10, 2410, iamY - 10); + } + try + { + string seasonFolder = filesJSON.Substring(filesJSON.Substring(0, filesJSON.LastIndexOf("\\")).LastIndexOf("\\") + 1).ToUpper(); + g.DrawString(seasonFolder.Substring(0, seasonFolder.LastIndexOf("\\")), new Font(pfc.Families[1], 42), new SolidBrush(Color.FromArgb(255, 149, 213, 255)), new Point(340, 40)); + } + catch (NullReferenceException) + { + AppendText("[NullReferenceException] ", Color.Red); + AppendText("No ", Color.Black); + AppendText("Season ", Color.SteelBlue); + AppendText("found", Color.Black, true); + } //LAST SUBFOLDER + try + { + g.DrawString(ItemName, new Font(pfc.Families[1], 115), new SolidBrush(Color.White), new Point(325, 70)); + } + catch (NullReferenceException) + { + AppendText("[NullReferenceException] ", Color.Red); + AppendText("No ", Color.Black); + AppendText("DisplayName ", Color.SteelBlue); + AppendText("found", Color.Black, true); + } //NAME + using (Bitmap bmp2 = bmp) + { + var newImg = bmp2.Clone( + new Rectangle { X = 0, Y = 0, Width = bmp.Width, Height = iamY + 280 }, + bmp2.PixelFormat); + ItemIconPictureBox.Image = newImg; + } //CUT + } + + if (((ToolStripMenuItem)ExtractAsset.Items[1]).Checked == true) + { + AppendText("Auto saving icons set to ", Color.Black); + AppendText("True", Color.Green, true); + ItemIconPictureBox.Image.Save(docPath + "\\Generated Icons\\" + ItemName + ".png", ImageFormat.Png); + + AppendText("✔ ", Color.Green); + AppendText(ItemName, Color.DarkRed); + AppendText(" successfully saved to ", Color.Black); + AppendText(docPath + "\\Generated Icons\\" + ItemName + ".png", Color.SteelBlue, true); + } } //ASSET IS A CHALLENGE => if (IDParser[ii].ExportType == "Texture2D") { @@ -2230,18 +2314,21 @@ namespace FModel private void SaveImageButton_Click(object sender, EventArgs e) { - SaveFileDialog saveTheDialog = new SaveFileDialog(); - saveTheDialog.Title = "Save Icon"; - saveTheDialog.Filter = "PNG Files (*.png)|*.png"; - saveTheDialog.InitialDirectory = docPath + "\\Generated Icons\\"; - saveTheDialog.FileName = ItemName; - if (saveTheDialog.ShowDialog() == DialogResult.OK) + if (ItemIconPictureBox.Image != null) { - ItemIconPictureBox.Image.Save(saveTheDialog.FileName, ImageFormat.Png); - AppendText("✔ ", Color.Green); - AppendText(ItemName, Color.DarkRed); - AppendText(" successfully saved to ", Color.Black); - AppendText(saveTheDialog.FileName, Color.SteelBlue, true); + SaveFileDialog saveTheDialog = new SaveFileDialog(); + saveTheDialog.Title = "Save Icon"; + saveTheDialog.Filter = "PNG Files (*.png)|*.png"; + saveTheDialog.InitialDirectory = docPath + "\\Generated Icons\\"; + saveTheDialog.FileName = ItemName; + if (saveTheDialog.ShowDialog() == DialogResult.OK) + { + ItemIconPictureBox.Image.Save(saveTheDialog.FileName, ImageFormat.Png); + AppendText("✔ ", Color.Green); + AppendText(ItemName, Color.DarkRed); + AppendText(" successfully saved to ", Color.Black); + AppendText(saveTheDialog.FileName, Color.SteelBlue, true); + } } } private void OpenImageTS_Click(object sender, EventArgs e) diff --git a/FModel/Properties/Resources.Designer.cs b/FModel/Properties/Resources.Designer.cs index baccfa92..a5f0442d 100644 --- a/FModel/Properties/Resources.Designer.cs +++ b/FModel/Properties/Resources.Designer.cs @@ -70,6 +70,16 @@ namespace FModel.Properties { } } + /// + /// Recherche une ressource localisée de type System.Byte[]. + /// + internal static byte[] BurbankBigCondensed_Black { + get { + object obj = ResourceManager.GetObject("BurbankBigCondensed_Black", resourceCulture); + return ((byte[])(obj)); + } + } + /// /// Recherche une ressource localisée de type System.Byte[]. /// @@ -150,6 +160,16 @@ namespace FModel.Properties { } } + /// + /// Recherche une ressource localisée de type System.Drawing.Bitmap. + /// + internal static System.Drawing.Bitmap Quest { + get { + object obj = ResourceManager.GetObject("Quest", 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 559ce868..47177aac 100644 --- a/FModel/Properties/Resources.resx +++ b/FModel/Properties/Resources.resx @@ -157,4 +157,10 @@ ..\FNTools_Logo.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + + ..\Resources\BurbankBigCondensed-Black.otf;System.Byte[], mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ..\Resources\Quest.png;System.Drawing.Bitmap, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a + \ No newline at end of file diff --git a/FModel/Properties/Settings.Designer.cs b/FModel/Properties/Settings.Designer.cs index 421b66d6..49a25d02 100644 --- a/FModel/Properties/Settings.Designer.cs +++ b/FModel/Properties/Settings.Designer.cs @@ -125,5 +125,17 @@ namespace FModel.Properties { this["createIconForVariants"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + [global::System.Configuration.DefaultSettingValueAttribute("False")] + public bool createIconForChallenges { + get { + return ((bool)(this["createIconForChallenges"])); + } + set { + this["createIconForChallenges"] = value; + } + } } } diff --git a/FModel/Properties/Settings.settings b/FModel/Properties/Settings.settings index 84fd1e7a..202b7f7d 100644 --- a/FModel/Properties/Settings.settings +++ b/FModel/Properties/Settings.settings @@ -29,5 +29,8 @@ + + False + \ No newline at end of file diff --git a/FModel/Resources/BurbankBigCondensed-Black.otf b/FModel/Resources/BurbankBigCondensed-Black.otf new file mode 100644 index 00000000..0960123f Binary files /dev/null and b/FModel/Resources/BurbankBigCondensed-Black.otf differ diff --git a/FModel/Resources/Quest.png b/FModel/Resources/Quest.png new file mode 100644 index 00000000..36032b6e Binary files /dev/null and b/FModel/Resources/Quest.png differ diff --git a/README.md b/README.md index f89b5069..8f2ed706 100644 --- a/README.md +++ b/README.md @@ -29,7 +29,7 @@ - Asset is a **_Sound_**: - Try to convert the Asset to OGG and play the sound - Asset is a **_Bundle Of Challenges_**: - - Will display all challenges' description & amount needed to complete them + - Try to create an [Icon](https://i.imgur.com/s18aMEe.png) with all challenges' description & amount needed to complete them - Asset is a **_Font_**: - Try to convert the Asset to OTF