diff --git a/FModel/Options.Designer.cs b/FModel/Options.Designer.cs index 747506f7..8dbf976b 100644 --- a/FModel/Options.Designer.cs +++ b/FModel/Options.Designer.cs @@ -37,22 +37,29 @@ this.textBox3 = new System.Windows.Forms.TextBox(); this.label4 = new System.Windows.Forms.Label(); this.groupBox1 = new System.Windows.Forms.GroupBox(); + this.imgsPerRow = new System.Windows.Forms.NumericUpDown(); + this.label5 = new System.Windows.Forms.Label(); this.groupBox2 = new System.Windows.Forms.GroupBox(); this.groupBox3 = new System.Windows.Forms.GroupBox(); this.textBox2 = new System.Windows.Forms.TextBox(); this.label3 = new System.Windows.Forms.Label(); - this.label5 = new System.Windows.Forms.Label(); - this.imgsPerRow = new System.Windows.Forms.NumericUpDown(); + 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.groupBox1.SuspendLayout(); + ((System.ComponentModel.ISupportInitialize)(this.imgsPerRow)).BeginInit(); this.groupBox2.SuspendLayout(); this.groupBox3.SuspendLayout(); - ((System.ComponentModel.ISupportInitialize)(this.imgsPerRow)).BeginInit(); + this.groupBox4.SuspendLayout(); this.SuspendLayout(); // // optionsOKButton // this.optionsOKButton.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); - this.optionsOKButton.Location = new System.Drawing.Point(475, 169); + this.optionsOKButton.Location = new System.Drawing.Point(475, 218); this.optionsOKButton.Name = "optionsOKButton"; this.optionsOKButton.Size = new System.Drawing.Size(97, 21); this.optionsOKButton.TabIndex = 1; @@ -120,13 +127,37 @@ this.groupBox1.Controls.Add(this.label5); this.groupBox1.Controls.Add(this.textBox3); this.groupBox1.Controls.Add(this.label4); - this.groupBox1.Location = new System.Drawing.Point(12, 144); + this.groupBox1.Location = new System.Drawing.Point(12, 193); this.groupBox1.Name = "groupBox1"; this.groupBox1.Size = new System.Drawing.Size(414, 46); this.groupBox1.TabIndex = 10; this.groupBox1.TabStop = false; this.groupBox1.Text = "Merger"; // + // imgsPerRow + // + this.imgsPerRow.Location = new System.Drawing.Point(364, 19); + this.imgsPerRow.Maximum = new decimal(new int[] { + 20, + 0, + 0, + 0}); + this.imgsPerRow.Name = "imgsPerRow"; + this.imgsPerRow.ReadOnly = true; + this.imgsPerRow.Size = new System.Drawing.Size(44, 20); + this.imgsPerRow.TabIndex = 12; + this.imgsPerRow.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; + this.imgsPerRow.ThousandsSeparator = true; + // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(270, 22); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(88, 13); + this.label5.TabIndex = 10; + this.label5.Text = "Images Per Row:"; + // // groupBox2 // this.groupBox2.Controls.Add(this.textBox1); @@ -167,35 +198,75 @@ this.label3.TabIndex = 3; this.label3.Text = "Input:"; // - // label5 + // groupBox4 // - this.label5.AutoSize = true; - this.label5.Location = new System.Drawing.Point(270, 22); - this.label5.Name = "label5"; - this.label5.Size = new System.Drawing.Size(88, 13); - this.label5.TabIndex = 10; - this.label5.Text = "Images Per Row:"; + this.groupBox4.Controls.Add(this.checkBox5); + this.groupBox4.Controls.Add(this.checkBox4); + this.groupBox4.Controls.Add(this.checkBox3); + this.groupBox4.Controls.Add(this.checkBox2); + this.groupBox4.Controls.Add(this.label6); + this.groupBox4.Location = new System.Drawing.Point(12, 144); + this.groupBox4.Name = "groupBox4"; + this.groupBox4.Size = new System.Drawing.Size(560, 43); + this.groupBox4.TabIndex = 13; + this.groupBox4.TabStop = false; + this.groupBox4.Text = "Icon Creation"; // - // imgsPerRow + // label6 // - this.imgsPerRow.Location = new System.Drawing.Point(364, 19); - this.imgsPerRow.Maximum = new decimal(new int[] { - 20, - 0, - 0, - 0}); - this.imgsPerRow.Name = "imgsPerRow"; - this.imgsPerRow.ReadOnly = true; - this.imgsPerRow.Size = new System.Drawing.Size(44, 20); - this.imgsPerRow.TabIndex = 12; - this.imgsPerRow.TextAlign = System.Windows.Forms.HorizontalAlignment.Center; - this.imgsPerRow.ThousandsSeparator = true; + 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; + // + // checkBox4 + // + this.checkBox4.AutoSize = true; + this.checkBox4.Location = new System.Drawing.Point(501, 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 + // + 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; // // OptionsWindow // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(584, 198); + this.ClientSize = new System.Drawing.Size(584, 249); + this.Controls.Add(this.groupBox4); this.Controls.Add(this.groupBox3); this.Controls.Add(this.groupBox2); this.Controls.Add(this.groupBox1); @@ -209,11 +280,13 @@ this.Text = "FModel Options"; this.groupBox1.ResumeLayout(false); this.groupBox1.PerformLayout(); + ((System.ComponentModel.ISupportInitialize)(this.imgsPerRow)).EndInit(); this.groupBox2.ResumeLayout(false); this.groupBox2.PerformLayout(); this.groupBox3.ResumeLayout(false); this.groupBox3.PerformLayout(); - ((System.ComponentModel.ISupportInitialize)(this.imgsPerRow)).EndInit(); + this.groupBox4.ResumeLayout(false); + this.groupBox4.PerformLayout(); this.ResumeLayout(false); } @@ -233,5 +306,11 @@ private System.Windows.Forms.Label label3; private System.Windows.Forms.Label label5; private System.Windows.Forms.NumericUpDown imgsPerRow; + private System.Windows.Forms.GroupBox groupBox4; + private System.Windows.Forms.CheckBox checkBox2; + private System.Windows.Forms.Label label6; + private System.Windows.Forms.CheckBox checkBox3; + private System.Windows.Forms.CheckBox checkBox4; + private System.Windows.Forms.CheckBox checkBox5; } } \ No newline at end of file diff --git a/FModel/Options.cs b/FModel/Options.cs index 5bd8946c..e6728d8f 100644 --- a/FModel/Options.cs +++ b/FModel/Options.cs @@ -25,6 +25,10 @@ namespace FModel textBox2.Text = Properties.Settings.Default.FortnitePAKs; textBox3.Text = Properties.Settings.Default.mergerFileName; imgsPerRow.Value = Properties.Settings.Default.mergerImagesRow; + checkBox2.Checked = Properties.Settings.Default.createIconForCosmetics; + checkBox5.Checked = Properties.Settings.Default.createIconForVariants; + checkBox3.Checked = Properties.Settings.Default.createIconForConsumablesWeapons; + checkBox4.Checked = Properties.Settings.Default.createIconForTraps; PAKBefore = Properties.Settings.Default.FortnitePAKs; OutputBefore = Properties.Settings.Default.ExtractOutput; @@ -40,6 +44,40 @@ namespace FModel { Properties.Settings.Default.ExtractAndSerialize = false; } + if (checkBox2.Checked == true) + { + Properties.Settings.Default.createIconForCosmetics = true; + } + if (checkBox2.Checked == false) + { + Properties.Settings.Default.createIconForCosmetics = false; + } + if (checkBox5.Checked == true) + { + Properties.Settings.Default.createIconForVariants = true; + } + if (checkBox5.Checked == false) + { + Properties.Settings.Default.createIconForVariants = false; + } + if (checkBox3.Checked == true) + { + Properties.Settings.Default.createIconForConsumablesWeapons = true; + } + if (checkBox3.Checked == false) + { + Properties.Settings.Default.createIconForConsumablesWeapons = false; + } + if (checkBox4.Checked == true) + { + Properties.Settings.Default.createIconForTraps = true; + } + if (checkBox4.Checked == false) + { + Properties.Settings.Default.createIconForTraps = false; + } + + Properties.Settings.Default.ExtractOutput = textBox1.Text; Properties.Settings.Default.FortnitePAKs = textBox2.Text; Properties.Settings.Default.mergerFileName = textBox3.Text; diff --git a/FModel/PAKWindow.cs b/FModel/PAKWindow.cs index dd7850c5..4777af6d 100644 --- a/FModel/PAKWindow.cs +++ b/FModel/PAKWindow.cs @@ -93,6 +93,10 @@ namespace FModel SetTreeViewTheme(PAKTreeView.Handle); Properties.Settings.Default.ExtractAndSerialize = true; //SERIALIZE BY DEFAULT + Properties.Settings.Default.createIconForCosmetics = true; + Properties.Settings.Default.createIconForVariants = true; + Properties.Settings.Default.createIconForConsumablesWeapons = true; + Properties.Settings.Default.createIconForTraps = true; docPath = Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments).ToString() + "\\FModel"; if (string.IsNullOrEmpty(Properties.Settings.Default.ExtractOutput)) @@ -717,17 +721,18 @@ namespace FModel AppendText("Auto loading data set to ", Color.Black); AppendText("True", Color.Green, true); - if (filesJSON.Contains("Athena\\Items\\Cosmetics") || filesJSON.Contains("Athena\\Items\\CosmeticVariantTokens") || filesJSON.Contains("Athena\\Items\\Weapons")) //ASSET IS AN ID => CREATE ICON + if (filesJSON.Contains("Athena\\Items\\") && (filesJSON.Contains("Cosmetics") || filesJSON.Contains("Consumables") || filesJSON.Contains("Traps") || filesJSON.Contains("Gameplay") || filesJSON.Contains("Weapons") || filesJSON.Contains("CosmeticVariantTokens"))) //ASSET IS AN ID => CREATE ICON { AppendText("Parsing...", Color.Black, true); for (int iii = 0; iii < IDParser.Length; iii++) { - if (IDParser[iii].ExportType.Contains("Item") && IDParser[iii].ExportType.Contains("Definition")) + if (Properties.Settings.Default.createIconForCosmetics == true && (IDParser[iii].ExportType.Contains("Athena") && IDParser[iii].ExportType.Contains("Item") && IDParser[iii].ExportType.Contains("Definition"))) { AppendText("✔ ", Color.Green); AppendText(currentItem, Color.DarkRed); - AppendText(" is an ", Color.Black); - AppendText("ID file", Color.SteelBlue, true); + AppendText(" is a ", Color.Black); + AppendText("Cosmetic ID", Color.SteelBlue); + AppendText(" file", Color.Black, true); ItemName = IDParser[iii].DisplayName; Bitmap bmp = new Bitmap(522, 522); @@ -1001,7 +1006,7 @@ namespace FModel { jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); } - else if (IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/")) + else if (IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Items/")) { jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); } @@ -1074,7 +1079,7 @@ namespace FModel { jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); } - else if (IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/")) + else if (IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Items/")) { jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); } @@ -1181,28 +1186,12 @@ namespace FModel } catch (IndexOutOfRangeException) { - try - { - g.DrawString(IDParser[iii].GameplayTags.GameplayTagsGameplayTags[Array.FindIndex(IDParser[iii].GameplayTags.GameplayTagsGameplayTags, x => x.StartsWith("Weapon.Ranged."))].Substring(14), new Font(pfc.Families[0], 13), new SolidBrush(Color.White), new Point(522 - 5, 500), rightString); - } - catch (NullReferenceException) - { - AppendText("[NullReferenceException] ", Color.Red); - AppendText("No ", Color.Black); - AppendText("GameplayTags ", Color.SteelBlue); - AppendText("found", Color.Black, true); - } - catch (IndexOutOfRangeException) - { - AppendText("[IndexOutOfRangeException] ", Color.Red); - AppendText("No ", Color.Black); - AppendText("GameplayTags ", Color.SteelBlue); - AppendText("as ", Color.Black); - AppendText("Cosmetics.Source ", Color.SteelBlue); - AppendText("or ", Color.Black); - AppendText("Weapon.Ranged ", Color.SteelBlue); - AppendText("found", Color.Black, true); - } + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("No ", Color.Black); + AppendText("GameplayTags ", Color.SteelBlue); + AppendText("as ", Color.Black); + AppendText("Cosmetics.Source ", Color.SteelBlue); + AppendText("found", Color.Black, true); } //COSMETIC SOURCE ItemIconPictureBox.Image = bmp; @@ -1217,13 +1206,14 @@ namespace FModel AppendText(" successfully saved to ", Color.Black); AppendText(docPath + "\\Generated Icons\\" + ItemName + ".png", Color.SteelBlue, true); } - } - if (IDParser[iii].ExportType == "FortVariantTokenType") + } //Cosmetics + if (Properties.Settings.Default.createIconForConsumablesWeapons == true && (IDParser[iii].ExportType.Contains("FortWeaponRangedItemDefinition") || IDParser[iii].ExportType.Contains("FortWeaponMeleeItemDefinition"))) { AppendText("✔ ", Color.Green); AppendText(currentItem, Color.DarkRed); AppendText(" is an ", Color.Black); - AppendText("Cosmetic Variant file", Color.SteelBlue, true); + AppendText("ID", Color.SteelBlue); + AppendText(" file", Color.Black, true); ItemName = IDParser[iii].DisplayName; Bitmap bmp = new Bitmap(522, 522); @@ -1261,7 +1251,7 @@ namespace FModel { jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); } - else if (IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/")) + else if (IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Items/")) { jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); } @@ -1334,7 +1324,471 @@ namespace FModel { jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); } - else if (IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/")) + else if (IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Items/")) + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + else + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + }); + filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + } + try + { + if (filesPath != null) + { + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(filesPath.Substring(0, filesPath.LastIndexOf('.')), Color.SteelBlue, true); + + itemIconPath = filesPath.Substring(0, filesPath.LastIndexOf('.')) + ".png"; + if (!File.Exists(itemIconPath)) + { + await Task.Run(() => + { + jwpmProcess("texture \"" + filesPath.Substring(0, filesPath.LastIndexOf('.')) + "\""); + }); + itemIconPath = filesPath.Substring(0, filesPath.LastIndexOf('.')) + ".png"; + } + + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully converted to a PNG image with path ", Color.Black); + AppendText(itemIconPath, Color.SteelBlue, true); + } + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("Can't extract ", Color.Black); + AppendText(textureFile, Color.SteelBlue); + AppendText(" in ", Color.Black); + AppendText("pakchunk0_s7-WindowsClient.pak", Color.DarkRed, true); + } + } + + if (File.Exists(itemIconPath)) + { + Image ItemIcon = Image.FromFile(itemIconPath); + g.DrawImage(ItemIcon, new Point(5, 5)); + } + else + { + Image ItemIcon = Properties.Resources.unknown512; + g.DrawImage(ItemIcon, new Point(0, 0)); + } + + Image bg512 = Properties.Resources.BG512; + g.DrawImage(bg512, new Point(5, 383)); + + try + { + g.DrawString(ItemName, new Font(pfc.Families[0], 35), new SolidBrush(Color.White), new Point(522 / 2, 395), centeredString); + } + catch (NullReferenceException) + { + AppendText("[NullReferenceException] ", Color.Red); + AppendText("No ", Color.Black); + AppendText("DisplayName ", Color.SteelBlue); + AppendText("found", Color.Black, true); + } //NAME + try + { + g.DrawString(IDParser[iii].Description, new Font("Arial", 10), new SolidBrush(Color.White), new Point(522 / 2, 465), centeredStringLine); + } + catch (NullReferenceException) + { + AppendText("[NullReferenceException] ", Color.Red); + AppendText("No ", Color.Black); + AppendText("Description ", Color.SteelBlue); + AppendText("found", Color.Black, true); + } //DESCRIPTION + try + { + g.DrawString(IDParser[iii].GameplayTags.GameplayTagsGameplayTags[Array.FindIndex(IDParser[iii].GameplayTags.GameplayTagsGameplayTags, x => x.StartsWith("Athena.ItemAction."))].Substring(18), new Font(pfc.Families[0], 13), new SolidBrush(Color.White), new Point(522 - 5, 500), rightString); + } + catch (NullReferenceException) + { + AppendText("[NullReferenceException] ", Color.Red); + AppendText("No ", Color.Black); + AppendText("GameplayTags ", Color.SteelBlue); + AppendText("found", Color.Black, true); + } + catch (IndexOutOfRangeException) + { + try + { + g.DrawString(IDParser[iii].GameplayTags.GameplayTagsGameplayTags[Array.FindIndex(IDParser[iii].GameplayTags.GameplayTagsGameplayTags, x => x.StartsWith("Weapon."))].Substring(7), new Font(pfc.Families[0], 13), new SolidBrush(Color.White), new Point(522 - 5, 500), rightString); + } + catch (NullReferenceException) + { + AppendText("[NullReferenceException] ", Color.Red); + AppendText("No ", Color.Black); + AppendText("GameplayTags ", Color.SteelBlue); + AppendText("found", Color.Black, true); + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("No ", Color.Black); + AppendText("GameplayTags ", Color.SteelBlue); + AppendText("as ", Color.Black); + AppendText("Athena.ItemAction ", Color.SteelBlue); + AppendText("or ", Color.Black); + AppendText("Weapon ", Color.SteelBlue); + AppendText("found", Color.Black, true); + } + } //ACTION + + ItemIconPictureBox.Image = bmp; + 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); + } + } //Consumables & Weapons + if (Properties.Settings.Default.createIconForTraps == true && (IDParser[iii].ExportType.Contains("FortTrapItemDefinition") || IDParser[iii].ExportType.Contains("FortContextTrapItemDefinition"))) + { + AppendText("✔ ", Color.Green); + AppendText(currentItem, Color.DarkRed); + AppendText(" is a ", Color.Black); + AppendText("Trap ID", Color.SteelBlue); + AppendText(" file", Color.Black, true); + + ItemName = IDParser[iii].DisplayName; + Bitmap bmp = new Bitmap(522, 522); + Graphics g = Graphics.FromImage(bmp); + g.TextRenderingHint = TextRenderingHint.AntiAlias; + + getItemRarity(IDParser[iii], g); + + string itemIconPath = string.Empty; + + if (IDParser[iii].LargePreviewImage != null) + { + string textureFile = Path.GetFileName(IDParser[iii].LargePreviewImage.AssetPathName).Substring(0, Path.GetFileName(IDParser[iii].LargePreviewImage.AssetPathName).LastIndexOf('.')); + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" detected as a ", Color.Black); + AppendText("Texture2D file", Color.SteelBlue, true); + + var filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + if (!File.Exists(filesPath)) + { + if (currentGUID != "0-0-0-0") //DYNAMIC PAK + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + }); + filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + else //NORMAL PAK + { + await Task.Run(() => + { + if (IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/2dAssets/")) + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + else if (IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Items/")) + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + else + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + }); + filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + } + try + { + if (filesPath != null) + { + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(filesPath.Substring(0, filesPath.LastIndexOf('.')), Color.SteelBlue, true); + + itemIconPath = filesPath.Substring(0, filesPath.LastIndexOf('.')) + ".png"; + if (!File.Exists(itemIconPath)) + { + await Task.Run(() => + { + jwpmProcess("texture \"" + filesPath.Substring(0, filesPath.LastIndexOf('.')) + "\""); + }); + itemIconPath = filesPath.Substring(0, filesPath.LastIndexOf('.')) + ".png"; + } + + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully converted to a PNG image with path ", Color.Black); + AppendText(itemIconPath, Color.SteelBlue, true); + } + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("Can't extract ", Color.Black); + AppendText(textureFile, Color.SteelBlue); + AppendText(" in ", Color.Black); + AppendText("pakchunk0_s7-WindowsClient.pak", Color.DarkRed, true); + } + } + else if (IDParser[iii].SmallPreviewImage != null) + { + string textureFile = Path.GetFileName(IDParser[iii].SmallPreviewImage.AssetPathName).Substring(0, Path.GetFileName(IDParser[iii].SmallPreviewImage.AssetPathName).LastIndexOf('.')); + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" detected as a ", Color.Black); + AppendText("Texture2D file", Color.SteelBlue, true); + + var filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + if (!File.Exists(filesPath)) + { + if (currentGUID != "0-0-0-0") + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + }); + filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + else + { + await Task.Run(() => + { + if (IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/2dAssets/")) + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + else if (IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Items/")) + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + else + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + }); + filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + } + try + { + if (filesPath != null) + { + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(filesPath.Substring(0, filesPath.LastIndexOf('.')), Color.SteelBlue, true); + + itemIconPath = filesPath.Substring(0, filesPath.LastIndexOf('.')) + ".png"; + if (!File.Exists(itemIconPath)) + { + await Task.Run(() => + { + jwpmProcess("texture \"" + filesPath.Substring(0, filesPath.LastIndexOf('.')) + "\""); + }); + itemIconPath = filesPath.Substring(0, filesPath.LastIndexOf('.')) + ".png"; + } + + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully converted to a PNG image with path ", Color.Black); + AppendText(itemIconPath, Color.SteelBlue, true); + } + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("Can't extract ", Color.Black); + AppendText(textureFile, Color.SteelBlue); + AppendText(" in ", Color.Black); + AppendText("pakchunk0_s7-WindowsClient.pak", Color.DarkRed, true); + } + } + + if (File.Exists(itemIconPath)) + { + Image ItemIcon = Image.FromFile(itemIconPath); + g.DrawImage(ItemIcon, new Point(5, 5)); + } + else + { + Image ItemIcon = Properties.Resources.unknown512; + g.DrawImage(ItemIcon, new Point(0, 0)); + } + + Image bg512 = Properties.Resources.BG512; + g.DrawImage(bg512, new Point(5, 383)); + + try + { + g.DrawString(ItemName, new Font(pfc.Families[0], 35), new SolidBrush(Color.White), new Point(522 / 2, 395), centeredString); + } + catch (NullReferenceException) + { + AppendText("[NullReferenceException] ", Color.Red); + AppendText("No ", Color.Black); + AppendText("DisplayName ", Color.SteelBlue); + AppendText("found", Color.Black, true); + } //NAME + try + { + g.DrawString(IDParser[iii].Description, new Font("Arial", 10), new SolidBrush(Color.White), new Point(522 / 2, 465), centeredStringLine); + } + catch (NullReferenceException) + { + AppendText("[NullReferenceException] ", Color.Red); + AppendText("No ", Color.Black); + AppendText("Description ", Color.SteelBlue); + AppendText("found", Color.Black, true); + } //DESCRIPTION + + ItemIconPictureBox.Image = bmp; + 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); + } + } //Traps + if (Properties.Settings.Default.createIconForVariants == true && (IDParser[iii].ExportType == "FortVariantTokenType")) + { + AppendText("✔ ", Color.Green); + AppendText(currentItem, Color.DarkRed); + AppendText(" is a ", Color.Black); + AppendText("Cosmetic Variant", Color.SteelBlue); + AppendText(" file", Color.Black, true); + + ItemName = IDParser[iii].DisplayName; + Bitmap bmp = new Bitmap(522, 522); + Graphics g = Graphics.FromImage(bmp); + g.TextRenderingHint = TextRenderingHint.AntiAlias; + + getItemRarity(IDParser[iii], g); + + string itemIconPath = string.Empty; + + if (IDParser[iii].LargePreviewImage != null) + { + string textureFile = Path.GetFileName(IDParser[iii].LargePreviewImage.AssetPathName).Substring(0, Path.GetFileName(IDParser[iii].LargePreviewImage.AssetPathName).LastIndexOf('.')); + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" detected as a ", Color.Black); + AppendText("Texture2D file", Color.SteelBlue, true); + + var filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + if (!File.Exists(filesPath)) + { + if (currentGUID != "0-0-0-0") //DYNAMIC PAK + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + }); + filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + else //NORMAL PAK + { + await Task.Run(() => + { + if (IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/2dAssets/")) + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + else if (IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Items/")) + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + else + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0_s7-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + }); + filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + } + try + { + if (filesPath != null) + { + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully extracted to ", Color.Black); + AppendText(filesPath.Substring(0, filesPath.LastIndexOf('.')), Color.SteelBlue, true); + + itemIconPath = filesPath.Substring(0, filesPath.LastIndexOf('.')) + ".png"; + if (!File.Exists(itemIconPath)) + { + await Task.Run(() => + { + jwpmProcess("texture \"" + filesPath.Substring(0, filesPath.LastIndexOf('.')) + "\""); + }); + itemIconPath = filesPath.Substring(0, filesPath.LastIndexOf('.')) + ".png"; + } + + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" successfully converted to a PNG image with path ", Color.Black); + AppendText(itemIconPath, Color.SteelBlue, true); + } + } + catch (IndexOutOfRangeException) + { + AppendText("[IndexOutOfRangeException] ", Color.Red); + AppendText("Can't extract ", Color.Black); + AppendText(textureFile, Color.SteelBlue); + AppendText(" in ", Color.Black); + AppendText("pakchunk0_s7-WindowsClient.pak", Color.DarkRed, true); + } + } + else if (IDParser[iii].SmallPreviewImage != null) + { + string textureFile = Path.GetFileName(IDParser[iii].SmallPreviewImage.AssetPathName).Substring(0, Path.GetFileName(IDParser[iii].SmallPreviewImage.AssetPathName).LastIndexOf('.')); + AppendText("✔ ", Color.Green); + AppendText(textureFile, Color.DarkRed); + AppendText(" detected as a ", Color.Black); + AppendText("Texture2D file", Color.SteelBlue, true); + + var filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + if (!File.Exists(filesPath)) + { + if (currentGUID != "0-0-0-0") + { + await Task.Run(() => + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); + }); + filesPath = Directory.GetFiles(docPath + "\\Extracted", textureFile + ".*", SearchOption.AllDirectories).FirstOrDefault(); + } + else + { + await Task.Run(() => + { + if (IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/2dAssets/")) + { + jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\pakchunk0-WindowsClient.pak" + "\" \"" + textureFile + "\" \"" + docPath + "\""); + } + else if (IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/TestAssets/") || IDParser[iii].SmallPreviewImage.AssetPathName.Contains("/Game/Athena/Prototype/") || IDParser[iii].LargePreviewImage.AssetPathName.Contains("/Game/Athena/Items/")) { jwpmProcess("extract \"" + Properties.Settings.Default.FortnitePAKs + "\\" + currentPAK + "\" \"" + textureFile + "\" \"" + docPath + "\""); } @@ -1452,7 +1906,7 @@ namespace FModel AppendText(" successfully saved to ", Color.Black); AppendText(docPath + "\\Generated Icons\\" + ItemName + ".png", Color.SteelBlue, true); } - } + } //CosmeticVariantTokens } } for (int ii = 0; ii < IDParser.Length; ii++) diff --git a/FModel/Properties/Settings.Designer.cs b/FModel/Properties/Settings.Designer.cs index a2193d08..421b66d6 100644 --- a/FModel/Properties/Settings.Designer.cs +++ b/FModel/Properties/Settings.Designer.cs @@ -81,5 +81,49 @@ namespace FModel.Properties { this["mergerImagesRow"] = value; } } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool createIconForCosmetics { + get { + return ((bool)(this["createIconForCosmetics"])); + } + set { + this["createIconForCosmetics"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool createIconForConsumablesWeapons { + get { + return ((bool)(this["createIconForConsumablesWeapons"])); + } + set { + this["createIconForConsumablesWeapons"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool createIconForTraps { + get { + return ((bool)(this["createIconForTraps"])); + } + set { + this["createIconForTraps"] = value; + } + } + + [global::System.Configuration.UserScopedSettingAttribute()] + [global::System.Diagnostics.DebuggerNonUserCodeAttribute()] + public bool createIconForVariants { + get { + return ((bool)(this["createIconForVariants"])); + } + set { + this["createIconForVariants"] = value; + } + } } } diff --git a/FModel/Properties/Settings.settings b/FModel/Properties/Settings.settings index b07ba364..84fd1e7a 100644 --- a/FModel/Properties/Settings.settings +++ b/FModel/Properties/Settings.settings @@ -17,5 +17,17 @@ 0 + + + + + + + + + + + + \ No newline at end of file