public static void DrawUserFacingFlag(JToken uFF) { if (ItemCategoriesArray == null) { PakReader.PakReader reader = AssetsUtility.GetPakReader("/FortniteGame/Content/Items/ItemCategories"); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries("/FortniteGame/Content/Items/ItemCategories"); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList, true); if (AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JArray AssetArray = JArray.FromObject(AssetData); JToken tertiaryCategoriesToken = AssetsUtility.GetPropertyTag <JToken>(AssetArray[0]["properties"].Value <JArray>(), "TertiaryCategories"); if (tertiaryCategoriesToken != null) { ItemCategoriesArray = tertiaryCategoriesToken["data"].Value <JArray>(); string uFFTargeted = uFF.Value <string>().Substring("Cosmetics.UserFacingFlags.".Length); SearchUserFacingFlag(uFFTargeted); } } } } else { string uFFTargeted = uFF.Value <string>().Substring("Cosmetics.UserFacingFlags.".Length); SearchUserFacingFlag(uFFTargeted); } }
private static void DrawImageFromTagData(string assetPath, string quantity, int y, int mode = 0) { PakReader.PakReader reader = AssetsUtility.GetPakReader(assetPath); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(assetPath); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList); if (AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JToken AssetMainToken = null; if (jsonData.StartsWith("[") && jsonData.EndsWith("]")) { JArray AssetArray = JArray.FromObject(AssetData); AssetMainToken = AssetArray[0]; } else if (jsonData.StartsWith("{") && jsonData.EndsWith("}")) { AssetMainToken = AssetData; } if (AssetMainToken != null) { JArray AssetProperties = AssetMainToken["properties"].Value <JArray>(); DrawLargeSmallImage(AssetProperties, quantity, y, mode); } } } }
public static void DrawWeaponStats(string file, string rowname) { if (WeaponsStatsArray == null) { //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry> string filepath = AssetEntries.AssetEntriesDict.Where(x => x.Key.Contains("/" + file + ".uasset")).Select(d => d.Key).FirstOrDefault(); if (!string.IsNullOrEmpty(filepath)) { PakReader.PakReader reader = AssetsUtility.GetPakReader(filepath.Substring(0, filepath.LastIndexOf("."))); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(filepath.Substring(0, filepath.LastIndexOf("."))); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList, true); if (AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JArray AssetArray = JArray.FromObject(AssetData); WeaponsStatsArray = AssetArray[0]["rows"].Value <JArray>(); SearchWeaponStats(rowname); } } } } else { SearchWeaponStats(rowname); } }
private static void GetSerieAsset(JToken serieToken, JToken rarityToken) { //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry> string seriesFullPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + serieToken.Value <string>().ToLowerInvariant() + ".uasset")).Select(d => d.Key).FirstOrDefault(); if (!string.IsNullOrEmpty(seriesFullPath)) { string path = seriesFullPath.Substring(0, seriesFullPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)); PakReader.PakReader reader = AssetsUtility.GetPakReader(path); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(path); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList); if (AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JToken AssetMainToken = null; if (jsonData.StartsWith("[") && jsonData.EndsWith("]")) { JArray AssetArray = JArray.FromObject(AssetData); AssetMainToken = AssetArray[0]; } else if (jsonData.StartsWith("{") && jsonData.EndsWith("}")) { AssetMainToken = AssetData; } if (AssetMainToken != null) { JArray propertiesArray = AssetMainToken["properties"].Value <JArray>(); if (propertiesArray != null) { JArray colorsArray = AssetsUtility.GetPropertyTagStruct <JArray>(propertiesArray, "Colors", "properties"); if (colorsArray != null) { DrawSerieBackground(colorsArray); } JToken backgroundTextureToken = AssetsUtility.GetPropertyTagText <JToken>(propertiesArray, "BackgroundTexture", "asset_path_name"); if (backgroundTextureToken != null) { string imagePath = FoldersUtility.FixFortnitePath(backgroundTextureToken.Value <string>()); DrawSerieImage(imagePath); } } } } } else { DrawNormalRarity(rarityToken); } } else { DrawNormalRarity(rarityToken); } }
public static void GetHeroPerk(JArray AssetProperties) { JToken heroGameplayDefinitionToken = AssetsUtility.GetPropertyTagImport <JToken>(AssetProperties, "HeroGameplayDefinition"); if (heroGameplayDefinitionToken != null) { string assetPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + heroGameplayDefinitionToken.Value <string>().ToLowerInvariant() + ".")).Select(d => d.Key).FirstOrDefault(); if (!string.IsNullOrEmpty(assetPath)) { PakReader.PakReader reader = AssetsUtility.GetPakReader(assetPath); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(assetPath.Substring(0, assetPath.Length - ".uasset".Length)); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList); if (AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JToken AssetMainToken = null; if (jsonData.StartsWith("[") && jsonData.EndsWith("]")) { JArray AssetArray = JArray.FromObject(AssetData); AssetMainToken = AssetArray[0]; } else if (jsonData.StartsWith("{") && jsonData.EndsWith("}")) { AssetMainToken = AssetData; } if (AssetMainToken != null) { JArray heroGameplayProperties = AssetMainToken["properties"].Value <JArray>(); if (heroGameplayProperties != null) { _borderY = 518; _textY = 550; _imageY = 519; DrawHeroPerk(heroGameplayProperties); DrawTierAbilityKits(heroGameplayProperties); //RESIZE IconCreator.ICDrawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(new Point(0, 0), new Size(515, 560 + 35 * 3))); } } } } } } }
private static void DrawFeaturedImage(JArray AssetProperties, string displayAssetPath) { PakReader.PakReader reader = AssetsUtility.GetPakReader(displayAssetPath); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(displayAssetPath); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList); if (AssetsUtility.IsValidJson(jsonData)) { FWindow.FCurrentAsset = Path.GetFileName(displayAssetPath); dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JToken AssetMainToken = null; if (jsonData.StartsWith("[") && jsonData.EndsWith("]")) { JArray AssetArray = JArray.FromObject(AssetData); AssetMainToken = AssetArray[0]; } else if (jsonData.StartsWith("{") && jsonData.EndsWith("}")) { AssetMainToken = AssetData; } if (AssetMainToken != null) { JArray displayAssetProperties = AssetMainToken["properties"].Value <JArray>(); switch (displayAssetPath.Substring(displayAssetPath.LastIndexOf("/", StringComparison.InvariantCultureIgnoreCase) + 1)) { case "DA_Featured_Glider_ID_070_DarkViking": case "DA_Featured_CID_319_Athena_Commando_F_Nautilus": JArray TileImageProperties = AssetsUtility.GetPropertyTagStruct <JArray>(displayAssetProperties, "TileImage", "properties"); if (TileImageProperties != null) { DrawFeaturedImageFromDisplayAssetProperty(AssetProperties, TileImageProperties); } break; default: JArray DetailsImageProperties = AssetsUtility.GetPropertyTagStruct <JArray>(displayAssetProperties, "DetailsImage", "properties"); if (DetailsImageProperties != null) { DrawFeaturedImageFromDisplayAssetProperty(AssetProperties, DetailsImageProperties); } break; } } } } }
public static string GetCosmeticSet(string SetTagName) { if (ItemSetsArray == null) { PakReader.PakReader reader = AssetsUtility.GetPakReader("/FortniteGame/Content/Athena/Items/Cosmetics/Metadata/CosmeticSets"); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries("/FortniteGame/Content/Athena/Items/Cosmetics/Metadata/CosmeticSets"); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList, true); if (AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JArray AssetArray = JArray.FromObject(AssetData); ItemSetsArray = AssetArray[0]["rows"].Value <JArray>(); return(SearchSetDisplayName(SetTagName)); } } } else { return(SearchSetDisplayName(SetTagName)); } return(string.Empty); }
private static void DrawBannerIcon(string bannerName, int y) { //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry> string assetPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.Contains("/BannerIcons.uasset")).Select(d => d.Key).FirstOrDefault(); if (!string.IsNullOrEmpty(assetPath)) { PakReader.PakReader reader = AssetsUtility.GetPakReader(assetPath.Substring(0, assetPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase))); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(assetPath.Substring(0, assetPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase))); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList); if (AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JToken AssetMainToken = null; if (jsonData.StartsWith("[") && jsonData.EndsWith("]")) { JArray AssetArray = JArray.FromObject(AssetData); AssetMainToken = AssetArray[0]; } else if (jsonData.StartsWith("{") && jsonData.EndsWith("}")) { AssetMainToken = AssetData; } if (AssetMainToken != null) { JArray propertiesArray = AssetMainToken["rows"].Value <JArray>(); if (propertiesArray != null) { JArray target = AssetsUtility.GetPropertyTagItemData <JArray>(propertiesArray, bannerName, "properties"); if (target != null) { JToken largeImage = target.Where(x => string.Equals(x["name"].Value <string>(), "LargeImage")).FirstOrDefault(); JToken smallImage = target.Where(x => string.Equals(x["name"].Value <string>(), "SmallImage")).FirstOrDefault(); if (largeImage != null || smallImage != null) { JToken assetPathName = largeImage != null ? largeImage["tag_data"]["asset_path_name"] : smallImage != null ? smallImage["tag_data"]["asset_path_name"] : null; if (assetPathName != null) { string texturePath = FoldersUtility.FixFortnitePath(assetPathName.Value <string>()); using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath)) { if (image != null) { BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.CacheOption = BitmapCacheOption.OnLoad; bmp.StreamSource = image; bmp.EndInit(); bmp.Freeze(); IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(902, y + 3, 64, 64)); } } } } } } } } } } else { BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.CacheOption = BitmapCacheOption.OnLoad; bmp.StreamSource = Application.GetResourceStream(new Uri("pack://application:,,,/Resources/unknown512.png")).Stream; bmp.EndInit(); bmp.Freeze(); IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(902, y + 3, 64, 64)); } }
private static void DrawNormalIcon(string path, string quantity, int y, int mode = 0) { PakReader.PakReader reader = AssetsUtility.GetPakReader(path); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(path); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList); if (AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JToken AssetMainToken = null; if (jsonData.StartsWith("[") && jsonData.EndsWith("]")) { JArray AssetArray = JArray.FromObject(AssetData); AssetMainToken = AssetArray[0]; } else if (jsonData.StartsWith("{") && jsonData.EndsWith("}")) { AssetMainToken = AssetData; } if (AssetMainToken != null) { JArray propertiesArray = AssetMainToken["properties"].Value <JArray>(); if (propertiesArray != null) { JToken heroToken = AssetsUtility.GetPropertyTagImport <JToken>(propertiesArray, "HeroDefinition"); JToken weaponToken = AssetsUtility.GetPropertyTagImport <JToken>(propertiesArray, "WeaponDefinition"); if (heroToken != null) { //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry> string assetPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + heroToken.Value <string>().ToLowerInvariant() + ".uasset")).Select(d => d.Key).FirstOrDefault(); if (!string.IsNullOrEmpty(assetPath)) { DrawImageFromTagData(assetPath.Substring(0, assetPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)), quantity, y, mode); } } else if (weaponToken != null) { string weaponName = weaponToken.Value <string>(); if (weaponToken.Value <string>().Equals("WID_Harvest_Pickaxe_STWCosmetic_Tier")) //STW PICKAXES MANUAL FIX { weaponName = "WID_Harvest_Pickaxe_STWCosmetic_Tier_" + FWindow.FCurrentAsset.Substring(FWindow.FCurrentAsset.Length - 1); } //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry> string assetPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + weaponName.ToLowerInvariant() + ".uasset")).Select(d => d.Key).FirstOrDefault(); if (!string.IsNullOrEmpty(assetPath)) { DrawImageFromTagData(assetPath.Substring(0, assetPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)), quantity, y, mode); } } else { DrawLargeSmallImage(propertiesArray, quantity, y, mode); } } } } } else { BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.CacheOption = BitmapCacheOption.OnLoad; bmp.StreamSource = Application.GetResourceStream(new Uri("pack://application:,,,/Resources/unknown512.png")).Stream; bmp.EndInit(); bmp.Freeze(); IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(902, y + 3, 64, 64)); } }
public static void DrawIconAmmoData(string path) { PakReader.PakReader reader = AssetsUtility.GetPakReader(path); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(path); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList); if (AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JToken AssetAmmo = JArray.FromObject(AssetData)[0]; JToken largePreviewImage = AssetAmmo["properties"].Value <JArray>().Where(x => string.Equals(x["name"].Value <string>(), "LargePreviewImage")).FirstOrDefault(); JToken smallPreviewImage = AssetAmmo["properties"].Value <JArray>().Where(x => string.Equals(x["name"].Value <string>(), "SmallPreviewImage")).FirstOrDefault(); if (largePreviewImage != null || smallPreviewImage != null) { JToken assetPathName = largePreviewImage != null ? largePreviewImage["tag_data"]["asset_path_name"] : smallPreviewImage != null ? smallPreviewImage["tag_data"]["asset_path_name"] : null; if (assetPathName != null) { string texturePath = FoldersUtility.FixFortnitePath(assetPathName.Value <string>()); using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath)) { if (image != null) { BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.CacheOption = BitmapCacheOption.OnLoad; bmp.StreamSource = image; bmp.EndInit(); bmp.Freeze(); //RESIZE IconCreator.ICDrawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(new Point(0, 0), new Size(515, 560))); //background IconCreator.ICDrawingContext.DrawRectangle(new SolidColorBrush(ImagesUtility.ParseColorFromHex("#6D6D6D")), null, new Rect(0, 518, 515, 34)); JToken name_namespace = AssetsUtility.GetPropertyTagText <JToken>(AssetAmmo["properties"].Value <JArray>(), "DisplayName", "namespace"); JToken name_key = AssetsUtility.GetPropertyTagText <JToken>(AssetAmmo["properties"].Value <JArray>(), "DisplayName", "key"); JToken name_source_string = AssetsUtility.GetPropertyTagText <JToken>(AssetAmmo["properties"].Value <JArray>(), "DisplayName", "source_string"); if (name_namespace != null && name_key != null && name_source_string != null) { string displayName = AssetTranslations.SearchTranslation(name_namespace.Value <string>(), name_key.Value <string>(), name_source_string.Value <string>()); Typeface typeface = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal); FormattedText formattedText = new FormattedText( displayName.ToUpperInvariant(), CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, typeface, 25, Brushes.White, IconCreator.PPD ); formattedText.TextAlignment = TextAlignment.Center; formattedText.MaxTextWidth = 515; formattedText.MaxLineCount = 1; Point textLocation = new Point(0, 550 - formattedText.Height); IconCreator.ICDrawingContext.DrawText(formattedText, textLocation); } IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(9, 519, 32, 32)); } } } } } } }
private static void DrawAbilityKit(string assetPath) { if (!string.IsNullOrEmpty(assetPath)) { PakReader.PakReader reader = AssetsUtility.GetPakReader(assetPath); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(assetPath); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList); if (AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JToken AssetMainToken = null; if (jsonData.StartsWith("[") && jsonData.EndsWith("]")) { JArray AssetArray = JArray.FromObject(AssetData); AssetMainToken = AssetArray[0]; } else if (jsonData.StartsWith("{") && jsonData.EndsWith("}")) { AssetMainToken = AssetData; } if (AssetMainToken != null) { JArray abilityKitProperties = AssetMainToken["properties"].Value <JArray>(); if (abilityKitProperties != null) { JToken name_namespace = AssetsUtility.GetPropertyTagText <JToken>(abilityKitProperties, "DisplayName", "namespace"); JToken name_key = AssetsUtility.GetPropertyTagText <JToken>(abilityKitProperties, "DisplayName", "key"); JToken name_source_string = AssetsUtility.GetPropertyTagText <JToken>(abilityKitProperties, "DisplayName", "source_string"); JArray iconBrushArray = AssetsUtility.GetPropertyTagStruct <JArray>(abilityKitProperties, "IconBrush", "properties"); if (iconBrushArray != null) { JToken resourceObjectToken = AssetsUtility.GetPropertyTagOuterImport <JToken>(iconBrushArray, "ResourceObject"); if (resourceObjectToken != null) { string texturePath = FoldersUtility.FixFortnitePath(resourceObjectToken.Value <string>()); using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath)) { if (image != null) { BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.CacheOption = BitmapCacheOption.OnLoad; bmp.StreamSource = image; bmp.EndInit(); bmp.Freeze(); //background IconCreator.ICDrawingContext.DrawRectangle(new SolidColorBrush(ImagesUtility.ParseColorFromHex("#6D6D6D")), null, new Rect(0, _borderY, 515, 34)); if (name_namespace != null && name_key != null && name_source_string != null) { string displayName = AssetTranslations.SearchTranslation(name_namespace.Value <string>(), name_key.Value <string>(), name_source_string.Value <string>()); Typeface typeface = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal); FormattedText formattedText = new FormattedText( displayName.ToUpperInvariant(), CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, typeface, 25, Brushes.White, IconCreator.PPD ); formattedText.TextAlignment = TextAlignment.Left; formattedText.MaxTextWidth = 515; formattedText.MaxLineCount = 1; Point textLocation = new Point(50, _textY - formattedText.Height); IconCreator.ICDrawingContext.DrawText(formattedText, textLocation); } IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(9, _imageY, 32, 32)); _borderY += 37; _textY += 37; _imageY += 37; } } } } } } } } } }
private static void LoadAsset(string assetPath) { PakReader.PakReader reader = AssetsUtility.GetPakReader(assetPath); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(assetPath); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList, true); FWindow.FMain.Dispatcher.InvokeAsync(() => { FWindow.FMain.AssetPropertiesBox_Main.Text = jsonData; if (FWindow.FMain.MI_AutoExportRaw.IsChecked) { AssetsUtility.ExportAssetData(assetPath); } if (FWindow.FMain.MI_AutoSaveJson.IsChecked) { AssetsUtility.SaveAssetProperties(); } }); if (AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JToken AssetMainToken; if (jsonData.StartsWith("[") && jsonData.EndsWith("]")) { JArray AssetArray = JArray.FromObject(AssetData); AssetMainToken = AssetArray[0]; } else if (jsonData.StartsWith("{") && jsonData.EndsWith("}")) { AssetMainToken = AssetData; } else { AssetMainToken = null; } if (AssetMainToken != null && AssetMainToken["export_type"] != null && AssetMainToken["properties"] != null) { ExportType = AssetMainToken["export_type"].Value <string>(); DrawingVisual VisualImage = null; switch (ExportType) { case "AthenaBackpackItemDefinition": case "AthenaBattleBusItemDefinition": case "AthenaCharacterItemDefinition": case "AthenaConsumableEmoteItemDefinition": case "AthenaSkyDiveContrailItemDefinition": case "AthenaDanceItemDefinition": case "AthenaEmojiItemDefinition": case "AthenaGliderItemDefinition": case "AthenaItemWrapDefinition": case "AthenaLoadingScreenItemDefinition": case "AthenaMusicPackItemDefinition": case "AthenaPetCarrierItemDefinition": case "AthenaPickaxeItemDefinition": case "AthenaSprayItemDefinition": case "AthenaToyItemDefinition": case "AthenaVictoryPoseItemDefinition": case "FortBannerTokenType": case "AthenaGadgetItemDefinition": case "FortWeaponRangedItemDefinition": case "FortWeaponMeleeItemDefinition": case "FortWeaponMeleeDualWieldItemDefinition": case "FortIngredientItemDefinition": case "FortVariantTokenType": case "FortAmmoItemDefinition": case "FortHeroType": case "FortDefenderItemDefinition": case "FortContextTrapItemDefinition": case "FortTrapItemDefinition": case "FortCardPackItemDefinition": case "FortPlaysetGrenadeItemDefinition": case "FortConsumableAccountItemDefinition": case "FortBadgeItemDefinition": case "FortCurrencyItemDefinition": case "FortConversionControlItemDefinition": case "FortHomebaseNodeItemDefinition": case "FortPersonalVehicleItemDefinition": case "FortCampaignHeroLoadoutItemDefinition": case "FortNeverPersistItemDefinition": case "FortPersistentResourceItemDefinition": case "FortResourceItemDefinition": case "FortGadgetItemDefinition": case "FortStatItemDefinition": case "FortTokenType": case "FortDailyRewardScheduleTokenDefinition": case "FortWorkerType": case "FortConditionalResourceItemDefinition": case "FortAwardItemDefinition": case "FortChallengeBundleScheduleDefinition": case "FortAbilityKit": case "FortSchematicItemDefinition": case "FortAccoladeItemDefinition": VisualImage = IconCreator.IconCreator.DrawNormalIconKThx(AssetMainToken["properties"].Value <JArray>()); break; case "FortChallengeBundleItemDefinition": VisualImage = IconCreator.IconCreator.DrawChallengeKThx(AssetMainToken["properties"].Value <JArray>(), assetPath); break; } if (VisualImage != null) { ImagesUtility.LoadImageAfterExtraction(VisualImage); } } } } }
/// <summary> /// this is kinda complex but at the end it only gets quest files names, counts, rewards, rewards quantity and the unlock type of the quests /// and repeat the process if he find stage quests /// </summary> /// <param name="BundleProperties"></param> /// <param name="assetPath"></param> private static void GetQuestData(JArray BundleProperties, string assetPath) { PakReader.PakReader reader = AssetsUtility.GetPakReader(assetPath); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(assetPath); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList); if (AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JToken AssetMainToken = null; if (jsonData.StartsWith("[") && jsonData.EndsWith("]")) { JArray AssetArray = JArray.FromObject(AssetData); AssetMainToken = AssetArray[0]; } else if (jsonData.StartsWith("{") && jsonData.EndsWith("}")) { AssetMainToken = AssetData; } if (AssetMainToken != null) { JArray AssetProperties = AssetMainToken["properties"].Value <JArray>(); if (AssetProperties != null) { string questDescription = string.Empty; long questCount = 0; string unlockType = string.Empty; string rewardPath = string.Empty; string rewardQuantity = string.Empty; //this come from the bundle properties array not the quest properties array JToken questUnlockTypeToken = AssetsUtility.GetPropertyTag <JToken>(BundleProperties, "QuestUnlockType"); if (questUnlockTypeToken != null) { unlockType = questUnlockTypeToken.Value <string>(); } //objectives array to catch the quest description and quest count JArray objectivesDataArray = AssetsUtility.GetPropertyTagText <JArray>(AssetProperties, "Objectives", "data"); if (objectivesDataArray != null) { if (objectivesDataArray[0]["struct_name"] != null && objectivesDataArray[0]["struct_type"] != null && string.Equals(objectivesDataArray[0]["struct_name"].Value <string>(), "FortMcpQuestObjectiveInfo")) { JArray objectivesDataProperties = objectivesDataArray[0]["struct_type"]["properties"].Value <JArray>(); //this description come from the main quest array (not the objectives array) JToken description_namespace = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "Description", "namespace"); JToken description_key = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "Description", "key"); JToken description_source_string = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "Description", "source_string"); if (description_namespace != null && description_key != null && description_source_string != null) { questDescription = AssetTranslations.SearchTranslation(description_namespace.Value <string>(), description_key.Value <string>(), description_source_string.Value <string>()); } else { //this description come from the objectives quest array description_namespace = AssetsUtility.GetPropertyTagText <JToken>(objectivesDataProperties, "Description", "namespace"); description_key = AssetsUtility.GetPropertyTagText <JToken>(objectivesDataProperties, "Description", "key"); description_source_string = AssetsUtility.GetPropertyTagText <JToken>(objectivesDataProperties, "Description", "source_string"); if (description_namespace != null && description_key != null && description_source_string != null) { questDescription = AssetTranslations.SearchTranslation(description_namespace.Value <string>(), description_key.Value <string>(), description_source_string.Value <string>()); } } if (objectivesDataProperties != null) { JToken countToken = AssetsUtility.GetPropertyTag <JToken>(objectivesDataProperties, "Count"); if (countToken != null) { questCount = countToken.Value <long>(); JToken objectiveCompletionCountToken = AssetsUtility.GetPropertyTag <JToken>(AssetProperties, "ObjectiveCompletionCount"); if (objectiveCompletionCountToken != null) { questCount = objectiveCompletionCountToken.Value <long>(); } } } } } //rewards array to catch the reward name (not path) and the quantity JArray rewardsDataArray = AssetsUtility.GetPropertyTagText <JArray>(AssetProperties, "Rewards", "data"); JArray hiddenRewardsDataArray = AssetsUtility.GetPropertyTagText <JArray>(AssetProperties, "HiddenRewards", "data"); if (rewardsDataArray != null) { if (rewardsDataArray[0]["struct_name"] != null && rewardsDataArray[0]["struct_type"] != null && string.Equals(rewardsDataArray[0]["struct_name"].Value <string>(), "FortItemQuantityPair")) { try { //checking the whole array for the reward //ignoring all Quest and Token until he find the reward JToken targetChecker = rewardsDataArray.Where(x => !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value <string>(), "Quest") && !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value <string>(), "Token")) .FirstOrDefault()["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][1]["tag_data"]; //checking the whole array for the reward quantity //ignoring all Quest and Token until he find the reward quantity JToken targetQuantity = rewardsDataArray.Where(x => !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value <string>(), "Quest") && !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value <string>(), "Token")) .FirstOrDefault()["struct_type"]["properties"][1]["tag_data"]; if (targetChecker != null) { //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry> string primaryAssetNameFullPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + targetChecker.Value <string>().ToLowerInvariant() + ".uasset")).Select(d => d.Key).FirstOrDefault(); if (!string.IsNullOrEmpty(primaryAssetNameFullPath)) { rewardPath = primaryAssetNameFullPath.Substring(0, primaryAssetNameFullPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)); } if (targetQuantity != null) { rewardQuantity = targetQuantity.Value <string>(); } BundleInfosEntry currentData = new BundleInfosEntry(questDescription, questCount, unlockType, rewardPath, rewardQuantity); if (!BundleData.Any(item => item.TheQuestDescription.Equals(currentData.TheQuestDescription, StringComparison.InvariantCultureIgnoreCase) && item.TheQuestCount == currentData.TheQuestCount)) { BundleData.Add(currentData); } } else { BundleInfosEntry currentData = new BundleInfosEntry(questDescription, questCount, unlockType, "", ""); if (!BundleData.Any(item => item.TheQuestDescription.Equals(currentData.TheQuestDescription, StringComparison.InvariantCultureIgnoreCase) && item.TheQuestCount == currentData.TheQuestCount)) { BundleData.Add(currentData); } } } catch (Exception) { if (hiddenRewardsDataArray != null) { if (hiddenRewardsDataArray[0]["struct_name"] != null && hiddenRewardsDataArray[0]["struct_type"] != null && string.Equals(hiddenRewardsDataArray[0]["struct_name"].Value <string>(), "FortHiddenRewardQuantityPair")) { JArray hiddenRewardPropertiesArray = hiddenRewardsDataArray[0]["struct_type"]["properties"].Value <JArray>(); if (hiddenRewardPropertiesArray != null) { JToken templateIdToken = AssetsUtility.GetPropertyTag <JToken>(hiddenRewardPropertiesArray, "TemplateId"); if (templateIdToken != null) { rewardPath = templateIdToken.Value <string>(); } //reward quantity (if 1, this won't be displayed) JToken hiddenQuantityToken = AssetsUtility.GetPropertyTag <JToken>(hiddenRewardPropertiesArray, "Quantity"); if (hiddenQuantityToken != null) { rewardQuantity = hiddenQuantityToken.Value <string>(); } BundleInfosEntry currentData = new BundleInfosEntry(questDescription, questCount, unlockType, rewardPath, rewardQuantity); if (!BundleData.Any(item => item.TheQuestDescription.Equals(currentData.TheQuestDescription, StringComparison.InvariantCultureIgnoreCase) && item.TheQuestCount == currentData.TheQuestCount)) { BundleData.Add(currentData); } } } } else { BundleInfosEntry currentData = new BundleInfosEntry(questDescription, questCount, unlockType, "", ""); if (!BundleData.Any(item => item.TheQuestDescription.Equals(currentData.TheQuestDescription, StringComparison.InvariantCultureIgnoreCase) && item.TheQuestCount == currentData.TheQuestCount)) { BundleData.Add(currentData); } } } } } else { BundleInfosEntry currentData = new BundleInfosEntry(questDescription, questCount, unlockType, "", ""); if (!BundleData.Any(item => item.TheQuestDescription.Equals(currentData.TheQuestDescription, StringComparison.InvariantCultureIgnoreCase) && item.TheQuestCount == currentData.TheQuestCount)) { BundleData.Add(currentData); } } //catch stage AFTER adding the current quest to the list if (rewardsDataArray != null) { foreach (JToken token in rewardsDataArray) { JToken targetChecker = token["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]; if (targetChecker != null && string.Equals(targetChecker.Value <string>(), "Quest")) { JToken primaryAssetNameToken = token["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][1]["tag_data"]; if (primaryAssetNameToken != null) { //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry> string primaryAssetNameFullPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.Contains("/" + primaryAssetNameToken.Value <string>())).Select(d => d.Key).FirstOrDefault(); if (!string.IsNullOrEmpty(primaryAssetNameFullPath)) { new UpdateMyProcessEvents(System.IO.Path.GetFileNameWithoutExtension(primaryAssetNameFullPath), "Waiting").Update(); GetQuestData(BundleProperties, primaryAssetNameFullPath.Substring(0, primaryAssetNameFullPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase))); } } } } } } } } } }
private static void DrawFeaturedImageFromDisplayAssetProperty(JArray AssetProperties, JArray displayAssetProperties) { JToken resourceObjectOuterImportToken = AssetsUtility.GetPropertyTagOuterImport <JToken>(displayAssetProperties, "ResourceObject"); JToken resourceObjectImportToken = AssetsUtility.GetPropertyTagImport <JToken>(displayAssetProperties, "ResourceObject"); if (resourceObjectOuterImportToken != null && resourceObjectOuterImportToken.Value <string>() != null) { string texturePath = FoldersUtility.FixFortnitePath(resourceObjectOuterImportToken.Value <string>()); if (texturePath.Contains("/FortniteGame/Content/Athena/Prototype/Textures/")) { DrawIconImage(AssetProperties, false); } else { using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath)) { if (image != null) { BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.CacheOption = BitmapCacheOption.OnLoad; bmp.StreamSource = image; bmp.EndInit(); bmp.Freeze(); IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(3, 3, 509, 509)); } } if (AssetsLoader.ExportType == "AthenaItemWrapDefinition" && texturePath.Contains("WeaponRenders")) { DrawAdditionalWrapImage(AssetProperties); } } } else if (resourceObjectImportToken != null) { //this will catch the full path if asset exists to be able to grab his PakReader and List<FPakEntry> string renderSwitchPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.Contains("/" + resourceObjectImportToken.Value <string>())).Select(d => d.Key).FirstOrDefault(); if (!string.IsNullOrEmpty(renderSwitchPath)) { if (renderSwitchPath.Contains("MI_UI_FeaturedRenderSwitch_") || renderSwitchPath.Contains("M-Wraps-StreetDemon") || renderSwitchPath.Contains("/FortniteGame/Content/UI/Foundation/Textures/Icons/Wraps/FeaturedMaterials/")) { PakReader.PakReader reader = AssetsUtility.GetPakReader(renderSwitchPath.Substring(0, renderSwitchPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase))); if (reader != null) { List <FPakEntry> entriesList = AssetsUtility.GetPakEntries(renderSwitchPath.Substring(0, renderSwitchPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase))); string jsonData = AssetsUtility.GetAssetJsonData(reader, entriesList); if (AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JToken AssetMainToken = null; if (jsonData.StartsWith("[") && jsonData.EndsWith("]")) { JArray AssetArray = JArray.FromObject(AssetData); AssetMainToken = AssetArray[0]; } else if (jsonData.StartsWith("{") && jsonData.EndsWith("}")) { AssetMainToken = AssetData; } if (AssetMainToken != null) { JArray renderSwitchProperties = AssetMainToken["properties"].Value <JArray>(); if (renderSwitchProperties != null) { JArray textureParameterArray = AssetsUtility.GetPropertyTagText <JArray>(renderSwitchProperties, "TextureParameterValues", "data")[0]["struct_type"]["properties"].Value <JArray>(); if (textureParameterArray != null) { JToken parameterValueToken = AssetsUtility.GetPropertyTagOuterImport <JToken>(textureParameterArray, "ParameterValue"); if (parameterValueToken != null) { string texturePath = FoldersUtility.FixFortnitePath(parameterValueToken.Value <string>()); using (Stream image = AssetsUtility.GetStreamImageFromPath(texturePath)) { if (image != null) { BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.CacheOption = BitmapCacheOption.OnLoad; bmp.StreamSource = image; bmp.EndInit(); bmp.Freeze(); IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(3, 3, 509, 509)); } } if (AssetsLoader.ExportType == "AthenaItemWrapDefinition" && texturePath.Contains("WeaponRenders")) { DrawAdditionalWrapImage(AssetProperties); } } } } } } } } } } }