private static void DrawUnlockType(SolidColorBrush PrimaryColor, SolidColorBrush SecondaryColor, string path, int y) { Stream image = AssetsUtility.GetStreamImageFromPath(path); if (image != null) { using (image) { BitmapImage bmp = new BitmapImage(); bmp.BeginInit(); bmp.CacheOption = BitmapCacheOption.OnLoad; bmp.StreamSource = image; bmp.EndInit(); bmp.Freeze(); IconCreator.ICDrawingContext.DrawRectangle(ChallengesUtility.LightBrush(PrimaryColor, 0.04f), null, new Rect(20, y, 50, 35)); Point dStart = new Point(20, y); LineSegment[] dSegments = new[] { new LineSegment(new Point(31, y), true), new LineSegment(new Point(31, y + 20), true), new LineSegment(new Point(25, y + 15), true), new LineSegment(new Point(29, y + 35), true), new LineSegment(new Point(20, y + 35), true), }; PathFigure dFigure = new PathFigure(dStart, dSegments, true); PathGeometry dGeo = new PathGeometry(new[] { dFigure }); IconCreator.ICDrawingContext.DrawGeometry(ChallengesUtility.DarkBrush(PrimaryColor, 0.3f), null, dGeo); IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(50 - 15, y + 2, 32, 32)); } } }
private static void DrawAdditionalWrapImage(JArray AssetProperties) { JToken largePreviewImage = AssetProperties.FirstOrDefault(x => string.Equals(x["name"].Value <string>(), "LargePreviewImage")); JToken smallPreviewImage = AssetProperties.FirstOrDefault(x => string.Equals(x["name"].Value <string>(), "SmallPreviewImage")); 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(); IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(275, 272, 122, 122)); } } } } }
private static void DrawSerieImage(string AssetPath) { using (Stream image = AssetsUtility.GetStreamImageFromPath(AssetPath)) { 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)); } } }
private static void GetUFFImage(JArray Properties) { JToken categoryBrushToken = AssetsUtility.GetPropertyTag <JToken>(Properties, "CategoryBrush"); if (categoryBrushToken != null) { JArray categoryBrushProperties = categoryBrushToken["struct_type"]["properties"].Value <JArray>(); if (categoryBrushProperties != null) { JToken BrushXXSToken = AssetsUtility.GetPropertyTag <JToken>(categoryBrushProperties, "Brush_XXS"); if (BrushXXSToken != null) { JArray brushXXSProperties = BrushXXSToken["struct_type"]["properties"].Value <JArray>(); if (brushXXSProperties != null) { JToken resourceObjectToken = AssetsUtility.GetPropertyTagOuterImport <JToken>(brushXXSProperties, "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(); xCoords += 25; IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(xCoords, 4, 25, 25)); } } } } } } } }
private static void DrawLargeSmallImage(JArray propertiesArray) { JToken largePreviewImage = propertiesArray.FirstOrDefault(x => string.Equals(x["name"].Value <string>(), "LargePreviewImage")); JToken smallPreviewImage = propertiesArray.FirstOrDefault(x => string.Equals(x["name"].Value <string>(), "SmallPreviewImage")); 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) { // CID_716_Athena_Commando_M_BlueFlames if (smallPreviewImage != null && assetPathName.Value <string>().Equals("/Game/UI/Foundation/Textures/Icons/Heroes/Athena/Soldier/T-Soldier-HID-716-Athena-Commando-M-BlueFlames-L.T-Soldier-HID-716-Athena-Commando-M-BlueFlames-L")) { assetPathName = smallPreviewImage["tag_data"]["asset_path_name"]; } 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(3, 3, 509, 509)); } } } } }
private static void DrawAbilityKit(string assetPath) { if (!string.IsNullOrEmpty(assetPath)) { string jsonData = AssetsUtility.GetAssetJsonDataByPath(assetPath); if (jsonData != null && AssetsUtility.IsValidJson(jsonData)) { JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData); 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; } } } } } } } } }
public static void DrawIconAmmoData(string path) { string jsonData = AssetsUtility.GetAssetJsonDataByPath(path); if (jsonData != null && AssetsUtility.IsValidJson(jsonData)) { dynamic AssetData = JsonConvert.DeserializeObject(jsonData); JToken AssetAmmo = JArray.FromObject(AssetData)[0]; JToken largePreviewImage = AssetAmmo["properties"].Value <JArray>().FirstOrDefault(x => string.Equals(x["name"].Value <string>(), "LargePreviewImage")); JToken smallPreviewImage = AssetAmmo["properties"].Value <JArray>().FirstOrDefault(x => string.Equals(x["name"].Value <string>(), "SmallPreviewImage")); 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(Properties.Settings.Default.FLanguage.Equals("Japanese") ? TextsUtility.JPBurbank : 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, (Properties.Settings.Default.FLanguage.Equals("Japanese") ? 548 : 550) - formattedText.Height); IconCreator.ICDrawingContext.DrawText(formattedText, textLocation); } IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(9, 519, 32, 32)); } } } } } }
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 DrawLargeSmallImage(JArray propertiesArray, string quantity, int y, int mode = 0) { JToken largePreviewImage = propertiesArray.Where(x => string.Equals(x["name"].Value <string>(), "LargePreviewImage")).FirstOrDefault(); JToken smallPreviewImage = propertiesArray.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(); Rect rect = new Rect(902, y + 3, 64, 64); if (mode > 0) { rect = new Rect(947, y + 12, 48, 48); SolidColorBrush color = null; SolidColorBrush border = null; switch (mode) { case 1: color = new SolidColorBrush(Color.FromRgb(255, 219, 103)); border = new SolidColorBrush(Color.FromRgb(143, 74, 32)); break; case 2: color = new SolidColorBrush(Color.FromRgb(230, 253, 177)); border = new SolidColorBrush(Color.FromRgb(81, 131, 15)); break; case 3: color = new SolidColorBrush(Color.FromRgb(220, 230, 255)); border = new SolidColorBrush(Color.FromRgb(100, 160, 175)); break; } Typeface typeface = new Typeface(TextsUtility.Burbank, FontStyles.Normal, FontWeights.Black, FontStretches.Normal); FormattedText formattedText = new FormattedText( quantity, CultureInfo.CurrentUICulture, FlowDirection.LeftToRight, typeface, 30, color, IconCreator.PPD); formattedText.TextAlignment = TextAlignment.Right; formattedText.MaxTextWidth = 945; formattedText.MaxLineCount = 1; Point textLocation = new Point(0, y + 23); Geometry geometry = formattedText.BuildGeometry(textLocation); Pen pen = new Pen(border, 1); pen.LineJoin = PenLineJoin.Round; IconCreator.ICDrawingContext.DrawGeometry(color, pen, geometry); } IconCreator.ICDrawingContext.DrawImage(bmp, rect); } } } } }
private static void DrawTextVariables(JArray AssetProperties) { DrawDisplayName(_displayName); DrawDescription(_description); switch (AssetsLoader.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": DrawToBottom("Left", _shortDescription); DrawToBottom("Right", _cosmeticSource); break; case "FortWeaponRangedItemDefinition": case "AthenaGadgetItemDefinition": DrawToBottom("Left", _maxStackSize); DrawToBottom("Right", _itemAction); break; case "FortVariantTokenType": DrawToBottom("Left", _shortDescription); DrawToBottom("Right", _cosmeticItemDefinition); break; case "FortHeroType": HeroGameplayDefinition.GetHeroPerk(AssetProperties); break; } if (_userFacingFlagsToken != null) { foreach (JToken uFF in _userFacingFlagsToken) { IconUserFacingFlags.DrawUserFacingFlag(uFF); } IconUserFacingFlags.xCoords = 4 - 25; //reset uFF coords } if (_userHeroFlagsToken != null) { foreach (JToken uFF in _userHeroFlagsToken) { IconUserFacingFlags.DrawHeroFacingFlag(uFF); } IconUserFacingFlags.xCoords = 4 - 25; //reset uFF coords } if (_userWeaponFlagsToken != null) { foreach (JToken uFF in _userWeaponFlagsToken) { IconUserFacingFlags.DrawWeaponFacingFlag(uFF); } IconUserFacingFlags.xCoords = 4 - 25; //reset uFF coords } if (!string.IsNullOrEmpty(_miniMapIconBrushPath) && !_miniMapIconBrushPath.Contains("UI_Radar_EnemyDot_White")) { using (System.IO.Stream image = AssetsUtility.GetStreamImageFromPath(_miniMapIconBrushPath)) { if (image != null) { System.Windows.Media.Imaging.BitmapImage bmp = new System.Windows.Media.Imaging.BitmapImage(); bmp.BeginInit(); bmp.CacheOption = System.Windows.Media.Imaging.BitmapCacheOption.OnLoad; bmp.StreamSource = image; bmp.EndInit(); bmp.Freeze(); IconUserFacingFlags.xCoords += 25; IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(IconUserFacingFlags.xCoords, 4, 25, 25)); IconUserFacingFlags.xCoords = 4 - 25; //reset uFF coords } } } }
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) && (renderSwitchPath.Contains("MI_UI_FeaturedRenderSwitch_") || renderSwitchPath.Contains("M-Wraps-StreetDemon") || renderSwitchPath.Contains("/FortniteGame/Content/UI/Foundation/Textures/Icons/Wraps/FeaturedMaterials/"))) { string jsonData = AssetsUtility.GetAssetJsonDataByPath(renderSwitchPath.Substring(0, renderSwitchPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase))); if (jsonData != null && AssetsUtility.IsValidJson(jsonData)) { JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData); if (AssetMainToken != null) { JArray renderSwitchProperties = AssetMainToken["properties"].Value <JArray>(); if (renderSwitchProperties != null) { JArray textureParameterArray = AssetsUtility.GetPropertyTagText <JArray>(renderSwitchProperties, "TextureParameterValues", "data"); textureParameterArray = textureParameterArray[textureParameterArray.Count() > 1 && !AssetsLoader.ExportType.Equals("AthenaItemWrapDefinition") ? 1 : 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); } } } } } } } } }