diff --git a/FModel/Forms/TweetForm.cs b/FModel/Forms/TweetForm.cs index b302f227..161dbf01 100644 --- a/FModel/Forms/TweetForm.cs +++ b/FModel/Forms/TweetForm.cs @@ -52,6 +52,7 @@ namespace FModel.Forms tweetText = richTextBox1.Text; })); + Properties.Settings.Default.Save(); if (service == null) { service = new TwitterService(Properties.Settings.Default.tConsKey, Properties.Settings.Default.tConsSecret); diff --git a/FModel/MainWindow.cs b/FModel/MainWindow.cs index ca647625..12204660 100644 --- a/FModel/MainWindow.cs +++ b/FModel/MainWindow.cs @@ -145,7 +145,7 @@ namespace FModel AddPaKs(Path.GetFileName(arCurrentUsedPak)); //add to toolstrip } } - else { new UpdateMyConsole("[FModel]" + Path.GetFileName(arCurrentUsedPak) + " is locked by another process.", Color.Red, true).AppendToConsole(); } + else { new UpdateMyConsole("[FModel] " + Path.GetFileName(arCurrentUsedPak) + " is locked by another process.", Color.Red, true).AppendToConsole(); } } } } @@ -1016,6 +1016,10 @@ namespace FModel { CreateItemIcon(itemId[i], "ammo"); } + else if (itemId[i].ExportType == "FortBannerTokenType") + { + CreateItemIcon(itemId[i], "athIteDef"); //athIteDef because there's a cosmetic source + } else if (questJson != null && (Settings.Default.createIconForSTWHeroes && (itemId[i].ExportType == "FortHeroType" && (questJson.Contains("ItemDefinition") || questJson.Contains("TestDefsSkydive") || questJson.Contains("GameplayPrototypes"))))) //Contains x not to trigger HID from BR { CreateItemIcon(itemId[i], "stwHeroes"); @@ -1134,7 +1138,7 @@ namespace FModel BundleDesign.drawBackground(bmp, bundleParser); } - if (BundleInfos.BundleData[0].rewardItemId != null && string.Equals(BundleInfos.BundleData[0].rewardItemId, "AthenaFortbyte", StringComparison.CurrentCultureIgnoreCase)) + if (BundleInfos.BundleData.Count > 0 && BundleInfos.BundleData[0].rewardItemId != null && string.Equals(BundleInfos.BundleData[0].rewardItemId, "AthenaFortbyte", StringComparison.CurrentCultureIgnoreCase)) isFortbyte = true; // Fortbytes: Sort by number @@ -1398,7 +1402,7 @@ namespace FModel if (saveTheDialog.ShowDialog() == DialogResult.OK) { pictureBox1.Image.Save(saveTheDialog.FileName, ImageFormat.Png); - new UpdateMyConsole(ThePak.CurrentUsedItem, Color.DarkRed).AppendToConsole(); + new UpdateMyConsole(Path.GetFileNameWithoutExtension(saveTheDialog.FileName), Color.DarkRed).AppendToConsole(); new UpdateMyConsole(" successfully saved", Color.Black, true).AppendToConsole(); } } diff --git a/FModel/Methods/AESManager/DynamicKeys/AddToUI.cs b/FModel/Methods/AESManager/DynamicKeys/AddToUI.cs index 549877c3..982214dc 100644 --- a/FModel/Methods/AESManager/DynamicKeys/AddToUI.cs +++ b/FModel/Methods/AESManager/DynamicKeys/AddToUI.cs @@ -43,7 +43,11 @@ namespace FModel DynamicKeysManager.serialize(token.ToString().ToUpper().Substring(2), item.thePak); - displayNewPaks(item.thePak); + displayNewPaks(token.ToString().ToUpper().Substring(2), item.thePak); + } + else + { + DynamicKeysManager.serialize("", item.thePak); } } new UpdateMyConsole("", Color.Green, true).AppendToConsole(); @@ -84,12 +88,12 @@ namespace FModel /// if pakname not found that means the key is brand new and has to be added but in this case we just "print" it as a FYI to the user /// /// the pak name - private static void displayNewPaks(string pakName) + private static void displayNewPaks(string pakKey, string pakName) { if (_oldKeysList != null) { //display new paks that can be opened - bool wasThereBeforeStartup = _oldKeysList.Where(i => i.thePak == pakName).Any(); + bool wasThereBeforeStartup = _oldKeysList.Where(i => i.theKey == pakKey).Any(); if (!wasThereBeforeStartup) { new UpdateMyConsole(pakName, Color.Firebrick).AppendToConsole(); diff --git a/FModel/Methods/IconGenerator/ChallengeGenerator/BundleDesign.cs b/FModel/Methods/IconGenerator/ChallengeGenerator/BundleDesign.cs index 7998955d..476ba512 100644 --- a/FModel/Methods/IconGenerator/ChallengeGenerator/BundleDesign.cs +++ b/FModel/Methods/IconGenerator/ChallengeGenerator/BundleDesign.cs @@ -8,6 +8,7 @@ using System.Windows.Forms; using System; using Newtonsoft.Json.Linq; using FModel.Parser.LocResParser; +using System.Diagnostics; namespace FModel { @@ -65,13 +66,30 @@ namespace FModel toDrawOn.DrawString(BundleInfos.getBundleDisplayName(myItem), new Font(Settings.Default.IconLanguage == "Japanese" ? FontUtilities.pfc.Families[2] : FontUtilities.pfc.Families[1], 115), new SolidBrush(Color.White), new Point(325, 70)); //image - string textureFile = Path.GetFileName(myBundle.DisplayStyle.DisplayImage.AssetPathName).Substring(0, Path.GetFileName(myBundle.DisplayStyle.DisplayImage.AssetPathName).LastIndexOf('.')); - Image challengeIcon; - using (var bmpTemp = new Bitmap(JohnWick.AssetToTexture2D(textureFile))) + if (myBundle.DisplayStyle.DisplayImage != null) { - challengeIcon = new Bitmap(bmpTemp); + string textureFile = Path.GetFileName(myBundle.DisplayStyle.DisplayImage.AssetPathName).Substring(0, Path.GetFileName(myBundle.DisplayStyle.DisplayImage.AssetPathName).LastIndexOf('.')); + Image challengeIcon; + using (var bmpTemp = new Bitmap(JohnWick.AssetToTexture2D(textureFile))) + { + challengeIcon = new Bitmap(bmpTemp); + } + toDrawOn.DrawImage(ImageUtilities.ResizeImage(challengeIcon, 282, 282), new Point(40, 0)); + } + else if (myBundle.LargePreviewImage != null) + { + string textureFile = Path.GetFileName(myBundle.LargePreviewImage.AssetPathName).Substring(0, Path.GetFileName(myBundle.LargePreviewImage.AssetPathName).LastIndexOf('.')); + Image challengeIcon; + using (var bmpTemp = new Bitmap(JohnWick.AssetToTexture2D(textureFile))) + { + challengeIcon = new Bitmap(bmpTemp); + } + toDrawOn.DrawImage(ImageUtilities.ResizeImage(challengeIcon, 282, 282), new Point(40, 0)); + } + else + { + toDrawOn.DrawImage(ImageUtilities.ResizeImage(Resources.unknown512, 282, 282), new Point(40, 0)); } - toDrawOn.DrawImage(ImageUtilities.ResizeImage(challengeIcon, 282, 282), new Point(40, 0)); //fill the rest toDrawOn.FillRectangle(new SolidBrush(ControlPaint.Dark(BundleInfos.getSecondaryColor(myBundle), (float)0.1)), new Rectangle(0, 271, myBitmap.Width, myBitmap.Height)); diff --git a/FModel/Methods/IconGenerator/ChallengeGenerator/BundleInfos.cs b/FModel/Methods/IconGenerator/ChallengeGenerator/BundleInfos.cs index 34be7059..d3db4b59 100644 --- a/FModel/Methods/IconGenerator/ChallengeGenerator/BundleInfos.cs +++ b/FModel/Methods/IconGenerator/ChallengeGenerator/BundleInfos.cs @@ -6,6 +6,7 @@ using Newtonsoft.Json; using Newtonsoft.Json.Linq; using System; using System.Collections.Generic; +using System.Diagnostics; using System.Drawing; using System.IO; using System.Linq; @@ -84,24 +85,24 @@ namespace FModel string oldQuest = string.Empty; long oldCount = 0; + //fortbyte check + bool isFortbyte = false; + Parser.Quests.Reward assetTypeToken = null; + if (questParser[x].Rewards != null) //this caused a null exception for some challenges (most of them in the Styles folder) + { + assetTypeToken = questParser[x].Rewards.Where(item => item.ItemPrimaryAssetId.PrimaryAssetType.Name == "Token").FirstOrDefault(); + if (assetTypeToken != null) + { + isFortbyte = assetTypeToken.ItemPrimaryAssetId.PrimaryAssetName == "AthenaFortbyte"; + } + } + for (int p = 0; p < questParser[x].Objectives.Length; p++) { long newCount = questParser[x].Objectives[p].Count; if (questParser[x].ObjectiveCompletionCount > 0) newCount = questParser[x].ObjectiveCompletionCount; - //fortbyte check - bool isFortbyte = false; - Parser.Quests.Reward assetTypeToken = null; - if (questParser[x].Rewards != null) //this caused a null exception for some challenges (most of them in the Styles folder) - { - assetTypeToken = questParser[x].Rewards.Where(item => item.ItemPrimaryAssetId.PrimaryAssetType.Name == "Token").FirstOrDefault(); - if (assetTypeToken != null) - { - isFortbyte = assetTypeToken.ItemPrimaryAssetId.PrimaryAssetName == "AthenaFortbyte"; - } - } - // In the game "Description" has priority over "Objectives.Description" string descriptionKey = questParser[x].Objectives[p].Description.Key; string descriptionSource = questParser[x].Objectives[p].Description.SourceString; diff --git a/FModel/Methods/PakHelper/PakHelper.cs b/FModel/Methods/PakHelper/PakHelper.cs index f357a072..7e76de16 100644 --- a/FModel/Methods/PakHelper/PakHelper.cs +++ b/FModel/Methods/PakHelper/PakHelper.cs @@ -36,11 +36,10 @@ namespace FModel { _extractor = new PakExtractor(Settings.Default.PAKsPath + "\\" + ThePak.mainPaksList[i].thePak, Settings.Default.AESKey); } - else { _extractor.Dispose(); break; } + else { break; } } catch (Exception) { - _extractor.Dispose(); break; } @@ -68,7 +67,6 @@ namespace FModel catch (Exception) { new UpdateMyConsole("0x" + pakKey + " doesn't work with " + ThePak.dynamicPaksList[i].thePak, Color.Red, true).AppendToConsole(); - _extractor.Dispose(); continue; } diff --git a/FModel/Resources/wTemplateFv1.png b/FModel/Resources/wTemplateFv1.png index 9c7a35ac..022564f3 100644 Binary files a/FModel/Resources/wTemplateFv1.png and b/FModel/Resources/wTemplateFv1.png differ diff --git a/FModel/Resources/wTemplatev1.png b/FModel/Resources/wTemplatev1.png index 76c6eea5..830c415e 100644 Binary files a/FModel/Resources/wTemplatev1.png and b/FModel/Resources/wTemplatev1.png differ diff --git a/README.md b/README.md index ea01f9e7..daaa079b 100644 --- a/README.md +++ b/README.md @@ -61,7 +61,7 @@ Also if you find this project useful, feel free to give it a :star: thank you :k 1. Read, Search, Extract, Serialize 2. Icon Creation for various BR/STW Cosmetics or Challenges with language support 3. Icon Merger - 4. Fortnite Api Authentication to automatically get Keys for Dynamic PAKs + 4. Automatic detection for Dynamic PAKs Keys 5. Twitter Api Authentication to send Tweets from within FModel ### What i'm using - [Fortnite Asset Parser](https://github.com/SirWaddles/JohnWickParse) - *C# Bind*