Example #1
0
        private static void DrawFeaturedImage(JArray AssetProperties, string displayAssetPath)
        {
            string jsonData = AssetsUtility.GetAssetJsonDataByPath(displayAssetPath);

            if (jsonData != null && AssetsUtility.IsValidJson(jsonData))
            {
                FWindow.FCurrentAsset = Path.GetFileName(displayAssetPath);

                JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
                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;
                    }
                }
            }
        }
Example #2
0
        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);
            }
        }
Example #3
0
        public static void DrawIconImage(JArray AssetProperties, bool isFeatured)
        {
            if (isFeatured)
            {
                JToken displayAssetPathToken = AssetsUtility.GetPropertyTagStruct <JToken>(AssetProperties, "DisplayAssetPath", "asset_path_name");
                if (displayAssetPathToken != null)
                {
                    string displayAssetPath = FoldersUtility.FixFortnitePath(displayAssetPathToken.Value <string>());
                    DrawFeaturedImageFromTagData(AssetProperties, displayAssetPath);
                }
                else if (AssetEntries.AssetEntriesDict.ContainsKey("/FortniteGame/Content/Catalog/DisplayAssets/DA_Featured_" + FWindow.FCurrentAsset + ".uasset"))
                {
                    string displayAssetPath = "/FortniteGame/Content/Catalog/DisplayAssets/DA_Featured_" + FWindow.FCurrentAsset;
                    DrawFeaturedImageFromTagData(AssetProperties, displayAssetPath);
                }
                else
                {
                    DrawIconImage(AssetProperties, false);
                }
            }
            else
            {
                JToken heroToken   = AssetsUtility.GetPropertyTagImport <JToken>(AssetProperties, "HeroDefinition");
                JToken weaponToken = AssetsUtility.GetPropertyTagImport <JToken>(AssetProperties, "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)));
                    }
                }
                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)));
                    }
                }
                else
                {
                    DrawLargeSmallImage(AssetProperties);
                }
            }
        }
        public static void DrawChallenge(JArray AssetProperties, string lastfolder)
        {
            isBanner        = false;
            hasDisplayStyle = false;
            SolidColorBrush PrimaryColor;
            SolidColorBrush SecondaryColor;
            Stream          image       = null;
            string          displayName = string.Empty;

            JArray displayStyleArray = AssetsUtility.GetPropertyTagStruct <JArray>(AssetProperties, "DisplayStyle", "properties");

            if (FProp.Default.FUseChallengeWatermark)
            {
                string[] primaryParts   = FProp.Default.FPrimaryColor.Split(':');
                string[] secondaryParts = FProp.Default.FSecondaryColor.Split(':');
                PrimaryColor   = new SolidColorBrush(Color.FromRgb(Convert.ToByte(primaryParts[0]), Convert.ToByte(primaryParts[1]), Convert.ToByte(primaryParts[2])));
                SecondaryColor = new SolidColorBrush(Color.FromRgb(Convert.ToByte(secondaryParts[0]), Convert.ToByte(secondaryParts[1]), Convert.ToByte(secondaryParts[2])));

                if (string.IsNullOrEmpty(FProp.Default.FBannerFilePath) && displayStyleArray != null)
                {
                    hasDisplayStyle = true;
                    image           = ChallengesUtility.GetChallengeBundleImage(displayStyleArray);
                }
            }
            else if (displayStyleArray != null)
            {
                hasDisplayStyle = true;
                PrimaryColor    = ChallengesUtility.GetPrimaryColor(displayStyleArray);
                SecondaryColor  = ChallengesUtility.GetSecondaryColor(displayStyleArray, lastfolder);
                image           = ChallengesUtility.GetChallengeBundleImage(displayStyleArray);
            }
            else
            {
                PrimaryColor   = ChallengesUtility.RandomSolidColorBrush();
                SecondaryColor = ChallengesUtility.RandomSolidColorBrush();
            }

            JToken name_namespace     = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "DisplayName", "namespace");
            JToken name_key           = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "DisplayName", "key");
            JToken name_source_string = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "DisplayName", "source_string");

            if (name_namespace != null && name_key != null && name_source_string != null)
            {
                displayName = AssetTranslations.SearchTranslation(name_namespace.Value <string>(), name_key.Value <string>(), name_source_string.Value <string>());
            }

            DrawHeader(displayName, lastfolder, PrimaryColor, SecondaryColor, image);
            DrawQuests(PrimaryColor, SecondaryColor);

            ChallengeCompletionRewards.DrawChallengeCompletion(AssetProperties, PrimaryColor, SecondaryColor, y);
        }
Example #5
0
        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;
                        }
                    }
                }
            }
        }
Example #6
0
        private static void DrawWithInGameColors(JArray colorsArray, bool shouldBeReversed = false)
        {
            Color background       = new Color();
            Color backgroundupdown = new Color();
            Color border           = new Color();

            JToken backgroundRed   = AssetsUtility.GetPropertyTagStruct <JToken>(colorsArray, "Color3", "r");
            JToken backgroundGreen = AssetsUtility.GetPropertyTagStruct <JToken>(colorsArray, "Color3", "g");
            JToken backgroundBlue  = AssetsUtility.GetPropertyTagStruct <JToken>(colorsArray, "Color3", "b");

            if (backgroundRed != null && backgroundGreen != null && backgroundBlue != null)
            {
                int r = (int)(backgroundRed.Value <double>() * 255);
                int g = (int)(backgroundGreen.Value <double>() * 255);
                int b = (int)(backgroundBlue.Value <double>() * 255);

                background = Color.FromRgb((byte)r, (byte)g, (byte)b);
            }

            JToken backgroundupdownRed   = AssetsUtility.GetPropertyTagStruct <JToken>(colorsArray, "Color1", "r");
            JToken backgroundupdownGreen = AssetsUtility.GetPropertyTagStruct <JToken>(colorsArray, "Color1", "g");
            JToken backgroundupdownBlue  = AssetsUtility.GetPropertyTagStruct <JToken>(colorsArray, "Color1", "b");

            if (backgroundupdownRed != null && backgroundupdownGreen != null && backgroundupdownBlue != null)
            {
                int r = (int)(backgroundupdownRed.Value <double>() * 255);
                int g = (int)(backgroundupdownGreen.Value <double>() * 255);
                int b = (int)(backgroundupdownBlue.Value <double>() * 255);

                backgroundupdown = Color.FromRgb((byte)r, (byte)g, (byte)b);
            }

            JToken borderRed   = AssetsUtility.GetPropertyTagStruct <JToken>(colorsArray, "Color2", "r");
            JToken borderGreen = AssetsUtility.GetPropertyTagStruct <JToken>(colorsArray, "Color2", "g");
            JToken borderBlue  = AssetsUtility.GetPropertyTagStruct <JToken>(colorsArray, "Color2", "b");

            if (borderRed != null && borderGreen != null && borderBlue != null)
            {
                int r = (int)(borderRed.Value <double>() * 255);
                int g = (int)(borderGreen.Value <double>() * 255);
                int b = (int)(borderBlue.Value <double>() * 255);

                border = Color.FromRgb((byte)r, (byte)g, (byte)b);
            }

            DrawBackground(shouldBeReversed ? backgroundupdown : background, shouldBeReversed ? background : backgroundupdown, ChangeColorBrightness(border, 0.25f), true);
        }
Example #7
0
 private static void SearchWeaponFacingFlag(string uFFTarget)
 {
     foreach (JToken data in SecondaryCategoriesDataArray)
     {
         JArray propertiesArray = data["struct_type"]["properties"].Value <JArray>();
         if (propertiesArray != null)
         {
             JArray wTagsArray = AssetsUtility.GetPropertyTagStruct <JArray>(propertiesArray, "TagContainer", "gameplay_tags");
             if (wTagsArray != null)
             {
                 if (wTagsArray.FirstOrDefault(i => i.Value <string>().ToLowerInvariant().Contains(uFFTarget.ToLowerInvariant())) != null)
                 {
                     GetUFFImage(propertiesArray);
                 }
             }
         }
     }
 }
Example #8
0
        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 jsonData = AssetsUtility.GetAssetJsonDataByPath(seriesFullPath.Substring(0, seriesFullPath.LastIndexOf(".", StringComparison.InvariantCultureIgnoreCase)));
                if (jsonData != null)
                {
                    if (AssetsUtility.IsValidJson(jsonData))
                    {
                        JToken AssetMainToken = AssetsUtility.ConvertJson2Token(jsonData);
                        if (AssetMainToken != null)
                        {
                            JArray propertiesArray = AssetMainToken["properties"].Value <JArray>();
                            if (propertiesArray != null)
                            {
                                JArray colorsArray = AssetsUtility.GetPropertyTagStruct <JArray>(propertiesArray, "Colors", "properties");
                                if (colorsArray != null)
                                {
                                    DrawWithInGameColors(colorsArray, string.Equals(seriesFullPath, "/FortniteGame/Content/Athena/Items/Cosmetics/Series/MarvelSeries.uasset")); //REVERSE COLORS IF MARVEL BECAUSE IT LOOKS WEIRD
                                }

                                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);
            }
        }
Example #9
0
        private static void DrawHeroPerk(JArray AssetProperties)
        {
            JArray heroPerkArray = AssetsUtility.GetPropertyTagStruct <JArray>(AssetProperties, "HeroPerk", "properties");

            if (heroPerkArray != null)
            {
                JToken grantedAbilityKitToken = AssetsUtility.GetPropertyTagText <JToken>(heroPerkArray, "GrantedAbilityKit", "asset_path_name");
                if (grantedAbilityKitToken != null)
                {
                    string path = FoldersUtility.FixFortnitePath(grantedAbilityKitToken.Value <string>());
                    DrawAbilityKit(path);

                    JToken cRequirements_namespace     = AssetsUtility.GetPropertyTagText <JToken>(heroPerkArray, "CommanderRequirementsText", "namespace");
                    JToken cRequirements_key           = AssetsUtility.GetPropertyTagText <JToken>(heroPerkArray, "CommanderRequirementsText", "key");
                    JToken cRequirements_source_string = AssetsUtility.GetPropertyTagText <JToken>(heroPerkArray, "CommanderRequirementsText", "source_string");

                    if (cRequirements_namespace != null && cRequirements_key != null && cRequirements_source_string != null)
                    {
                        string cRequirements = AssetTranslations.SearchTranslation(cRequirements_namespace.Value <string>(), cRequirements_key.Value <string>(), cRequirements_source_string.Value <string>());

                        Typeface typeface = new Typeface(new FontFamily("Arial"), FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);

                        FormattedText formattedText =
                            new FormattedText(
                                cRequirements,
                                CultureInfo.CurrentUICulture,
                                FlowDirection.LeftToRight,
                                typeface,
                                13,
                                Brushes.White,
                                IconCreator.PPD
                                );
                        formattedText.TextAlignment = TextAlignment.Right;
                        formattedText.MaxTextWidth  = 515;
                        formattedText.MaxLineCount  = 1;

                        Point textLocation = new Point(-5, 543 - formattedText.Height);

                        IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
                    }
                }
            }
        }
Example #10
0
        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;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
Example #11
0
        private static void SetTextVariables(JArray AssetProperties)
        {
            _displayName            = string.Empty;
            _description            = string.Empty;
            _shortDescription       = string.Empty;
            _cosmeticSource         = string.Empty;
            _cosmeticItemDefinition = string.Empty;
            _itemAction             = string.Empty;
            _maxStackSize           = string.Empty;
            _userFacingFlagsToken   = null;

            JToken name_namespace     = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "DisplayName", "namespace");
            JToken name_key           = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "DisplayName", "key");
            JToken name_source_string = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "DisplayName", "source_string");

            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");

            JToken short_description_namespace     = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "ShortDescription", "namespace");
            JToken short_description_key           = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "ShortDescription", "key");
            JToken short_description_source_string = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "ShortDescription", "source_string");

            JToken cosmetic_item  = AssetsUtility.GetPropertyTagImport <JToken>(AssetProperties, "cosmetic_item");
            JToken max_stack_size = AssetsUtility.GetPropertyTag <JToken>(AssetProperties, "MaxStackSize");
            JToken ammo_data      = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "AmmoData", "asset_path_name");

            JArray gTagsArray = AssetsUtility.GetPropertyTagStruct <JArray>(AssetProperties, "GameplayTags", "gameplay_tags");

            if (name_namespace != null && name_key != null && name_source_string != null)
            {
                _displayName = AssetTranslations.SearchTranslation(name_namespace.Value <string>(), name_key.Value <string>(), name_source_string.Value <string>());
            }

            if (description_namespace != null && description_key != null && description_source_string != null)
            {
                _description = AssetTranslations.SearchTranslation(description_namespace.Value <string>(), description_key.Value <string>(), description_source_string.Value <string>());
            }

            if (short_description_namespace != null && short_description_key != null && short_description_source_string != null)
            {
                _shortDescription = AssetTranslations.SearchTranslation(short_description_namespace.Value <string>(), short_description_key.Value <string>(), short_description_source_string.Value <string>());
            }
            else if (AssetsLoader.ExportType == "AthenaItemWrapDefinition")
            {
                _shortDescription = AssetTranslations.SearchTranslation("Fort.Cosmetics", "ItemWrapShortDescription", "Wrap");
            }

            if (cosmetic_item != null)
            {
                _cosmeticItemDefinition = cosmetic_item.Value <string>();
            }
            if (max_stack_size != null)
            {
                _maxStackSize = "Max Stack Size: " + max_stack_size.Value <string>();
            }
            if (ammo_data != null && ammo_data.Value <string>().Contains("Ammo"))
            {
                string path = FoldersUtility.FixFortnitePath(ammo_data.Value <string>());
                IconAmmoData.DrawIconAmmoData(path);

                JArray weapon_stat_handle = AssetsUtility.GetPropertyTagStruct <JArray>(AssetProperties, "WeaponStatHandle", "properties");
                if (weapon_stat_handle != null)
                {
                    JToken stats_file = AssetsUtility.GetPropertyTagImport <JToken>(weapon_stat_handle, "DataTable");
                    JToken row_name   = AssetsUtility.GetPropertyTag <JToken>(weapon_stat_handle, "RowName");
                    if (stats_file != null && row_name != null)
                    {
                        WeaponStats.DrawWeaponStats(stats_file.Value <string>(), row_name.Value <string>());
                    }
                }
            }

            if (gTagsArray != null)
            {
                JToken cSetToken = gTagsArray.Children <JToken>().FirstOrDefault(x => x.ToString().StartsWith("Cosmetics.Set."));
                if (cSetToken != null)
                {
                    string cosmeticSet = CosmeticSet.GetCosmeticSet(cSetToken.Value <string>());
                    if (!string.IsNullOrEmpty(cosmeticSet))
                    {
                        _description += cosmeticSet;
                    }
                }

                JToken cSourceToken = gTagsArray.Children <JToken>().FirstOrDefault(x => x.ToString().StartsWith("Cosmetics.Source."));
                if (cSourceToken != null)
                {
                    _cosmeticSource = cSourceToken.Value <string>().Substring("Cosmetics.Source.".Length);
                }

                JToken cActionToken = gTagsArray.Children <JToken>().FirstOrDefault(x => x.ToString().StartsWith("Athena.ItemAction."));
                if (cActionToken != null)
                {
                    _itemAction = cActionToken.Value <string>().Substring("Athena.ItemAction.".Length);
                }

                _userFacingFlagsToken = gTagsArray.Children <JToken>().Where(x => x.ToString().StartsWith("Cosmetics.UserFacingFlags."));
            }
        }
Example #12
0
        private static void SetTextVariables(JArray AssetProperties)
        {
            _displayName            = string.Empty;
            _description            = string.Empty;
            _shortDescription       = string.Empty;
            _cosmeticSource         = string.Empty;
            _cosmeticItemDefinition = string.Empty;
            _itemAction             = string.Empty;
            _maxStackSize           = string.Empty;
            _miniMapIconBrushPath   = string.Empty;
            _userFacingFlagsToken   = null;
            _userHeroFlagsToken     = null;
            _userWeaponFlagsToken   = null;

            JToken name_namespace     = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "DisplayName", "namespace");
            JToken name_key           = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "DisplayName", "key");
            JToken name_source_string = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "DisplayName", "source_string");

            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");

            JToken short_description_namespace     = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "ShortDescription", "namespace");
            JToken short_description_key           = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "ShortDescription", "key");
            JToken short_description_source_string = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "ShortDescription", "source_string");

            JToken cosmetic_item  = AssetsUtility.GetPropertyTagImport <JToken>(AssetProperties, "cosmetic_item");
            JToken max_stack_size = AssetsUtility.GetPropertyTag <JToken>(AssetProperties, "MaxStackSize");
            JToken ammo_data      = AssetsUtility.GetPropertyTagText <JToken>(AssetProperties, "AmmoData", "asset_path_name");

            JArray gTagsArray       = AssetsUtility.GetPropertyTagStruct <JArray>(AssetProperties, "GameplayTags", "gameplay_tags");
            JArray hTagsArray       = AssetsUtility.GetPropertyTagStruct <JArray>(AssetProperties, "RequiredGPTags", "gameplay_tags");
            JArray wTagsArray       = AssetsUtility.GetPropertyTagStruct <JArray>(AssetProperties, "AnalyticTags", "gameplay_tags");
            JArray MiniMapIconArray = AssetsUtility.GetPropertyTagStruct <JArray>(AssetProperties, "MiniMapIconBrush", "properties");

            if (name_namespace != null && name_key != null && name_source_string != null)
            {
                _displayName = AssetTranslations.SearchTranslation(name_namespace.Value <string>(), name_key.Value <string>(), name_source_string.Value <string>());
            }

            if (description_namespace != null && description_key != null && description_source_string != null)
            {
                _description = AssetTranslations.SearchTranslation(description_namespace.Value <string>(), description_key.Value <string>(), description_source_string.Value <string>());
            }

            if (short_description_namespace != null && short_description_key != null && short_description_source_string != null)
            {
                _shortDescription = AssetTranslations.SearchTranslation(short_description_namespace.Value <string>(), short_description_key.Value <string>(), short_description_source_string.Value <string>());
            }
            else if (AssetsLoader.ExportType == "AthenaItemWrapDefinition")
            {
                _shortDescription = AssetTranslations.SearchTranslation("Fort.Cosmetics", "ItemWrapShortDescription", "Wrap");
            }

            if (cosmetic_item != null)
            {
                _cosmeticItemDefinition = cosmetic_item.Value <string>();
            }
            if (max_stack_size != null)
            {
                _maxStackSize = "Max Stack Size: " + max_stack_size["struct_type"]["properties"][0]["tag_data"].Value <string>();
            }
            if (ammo_data != null && ammo_data.Value <string>().Contains("Ammo"))
            {
                string path = FoldersUtility.FixFortnitePath(ammo_data.Value <string>());
                IconAmmoData.DrawIconAmmoData(path);

                JArray weapon_stat_handle = AssetsUtility.GetPropertyTagStruct <JArray>(AssetProperties, "WeaponStatHandle", "properties");
                if (weapon_stat_handle != null)
                {
                    JToken stats_file = AssetsUtility.GetPropertyTagImport <JToken>(weapon_stat_handle, "DataTable");
                    JToken row_name   = AssetsUtility.GetPropertyTag <JToken>(weapon_stat_handle, "RowName");
                    if (stats_file != null && row_name != null)
                    {
                        WeaponStats.DrawWeaponStats(stats_file.Value <string>(), row_name.Value <string>());
                    }
                }
            }

            if (gTagsArray != null)
            {
                JToken cSetToken = gTagsArray.Children <JToken>().FirstOrDefault(x => x.ToString().StartsWith("Cosmetics.Set."));
                if (cSetToken != null)
                {
                    string cosmeticSet = CosmeticSet.GetCosmeticSet(cSetToken.Value <string>());
                    if (!string.IsNullOrEmpty(cosmeticSet))
                    {
                        _description += cosmeticSet;
                    }
                }

                JToken cFilterToken = gTagsArray.Children <JToken>().FirstOrDefault(x => x.ToString().StartsWith("Cosmetics.Filter.Season."));
                if (cFilterToken != null)
                {
                    string cosmeticFilter = CosmeticSeason.GetCosmeticSeason(cFilterToken.Value <string>().Substring("Cosmetics.Filter.Season.".Length));
                    if (!string.IsNullOrEmpty(cosmeticFilter))
                    {
                        _description += cosmeticFilter;
                    }
                }

                JToken cSourceToken = gTagsArray.Children <JToken>().FirstOrDefault(x => x.ToString().StartsWith("Cosmetics.Source."));
                if (cSourceToken != null)
                {
                    _cosmeticSource = cSourceToken.Value <string>().Substring("Cosmetics.Source.".Length);
                }

                JToken cActionToken = gTagsArray.Children <JToken>().FirstOrDefault(x => x.ToString().StartsWith("Athena.ItemAction."));
                if (cActionToken != null)
                {
                    _itemAction = cActionToken.Value <string>().Substring("Athena.ItemAction.".Length);
                }

                _userFacingFlagsToken = gTagsArray.Children <JToken>().Where(x => x.ToString().StartsWith("Cosmetics.UserFacingFlags."));
            }

            if (hTagsArray != null)
            {
                _userHeroFlagsToken = hTagsArray.Children <JToken>().Where(x => x.ToString().StartsWith("Unlocks.Class."));
            }

            if (wTagsArray != null)
            {
                _userWeaponFlagsToken = wTagsArray.Children <JToken>().Where(x => x.ToString().StartsWith("Weapon.Ranged.", StringComparison.InvariantCultureIgnoreCase));
            }
            else if (MiniMapIconArray != null)
            {
                JToken resourceObjectToken = AssetsUtility.GetPropertyTagOuterImport <JToken>(MiniMapIconArray, "ResourceObject");
                if (resourceObjectToken != null)
                {
                    _miniMapIconBrushPath = FoldersUtility.FixFortnitePath(resourceObjectToken.Value <string>());
                }
            }
        }