예제 #1
0
        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;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
예제 #2
0
        private static void SearchWeaponStats(string rowname)
        {
            JArray weaponPropertiesArray = AssetsUtility.GetPropertyTagItemData <JArray>(WeaponsStatsArray, rowname, "properties");

            if (weaponPropertiesArray != null)
            {
                int    count      = 0;
                int    borderY    = 518;
                JToken ReloadTime = AssetsUtility.GetPropertyTag <JToken>(weaponPropertiesArray, "ReloadTime");
                JToken ClipSize   = AssetsUtility.GetPropertyTag <JToken>(weaponPropertiesArray, "ClipSize");
                JToken DmgPB      = AssetsUtility.GetPropertyTag <JToken>(weaponPropertiesArray, "DmgPB");

                if (ReloadTime != null)
                {
                    count++;
                    borderY += 37;
                    IconCreator.ICDrawingContext.DrawRectangle(new SolidColorBrush(ImagesUtility.ParseColorFromHex("#6D6D6D")), null, new Rect(0, borderY, 515, 34));

                    BitmapImage bmp = new BitmapImage();
                    bmp.BeginInit();
                    bmp.CacheOption = BitmapCacheOption.OnLoad;
                    bmp.UriSource   = new Uri(RELOAD_CUSTOM_ICON);
                    bmp.EndInit();
                    bmp.Freeze();

                    Typeface      typeface      = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
                    FormattedText formattedText =
                        new FormattedText(
                            $"{AssetTranslations.SearchTranslation("", "6EA26D1A4252034FBD869A90F9A6E49A", "Reload Time")} ({AssetTranslations.SearchTranslation("", "6BA53D764BA5CC13E821D2A807A72365", "seconds")}) : {ReloadTime.Value<string>()}".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, 587 - formattedText.Height);

                    IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
                    IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(12, 560, 24, 24));
                }

                if (ClipSize != null)
                {
                    count++;
                    borderY += 37;
                    IconCreator.ICDrawingContext.DrawRectangle(new SolidColorBrush(ImagesUtility.ParseColorFromHex("#6D6D6D")), null, new Rect(0, borderY, 515, 34));

                    BitmapImage bmp = new BitmapImage();
                    bmp.BeginInit();
                    bmp.CacheOption = BitmapCacheOption.OnLoad;
                    bmp.UriSource   = new Uri(MAGSIZE_CUSTOM_ICON);
                    bmp.EndInit();
                    bmp.Freeze();

                    Typeface      typeface      = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
                    FormattedText formattedText =
                        new FormattedText(
                            $"{AssetTranslations.SearchTranslation("", "068239DD4327B36124498C9C5F61C038", "Magazine Size")} : {ClipSize.Value<string>()}".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, 624 - formattedText.Height);

                    IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
                    IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(12, 598, 24, 24));
                }

                if (DmgPB != null)
                {
                    count++;
                    borderY += 37;
                    IconCreator.ICDrawingContext.DrawRectangle(new SolidColorBrush(ImagesUtility.ParseColorFromHex("#6D6D6D")), null, new Rect(0, borderY, 515, 34));

                    BitmapImage bmp = new BitmapImage();
                    bmp.BeginInit();
                    bmp.CacheOption = BitmapCacheOption.OnLoad;
                    bmp.UriSource   = new Uri(DAMAGE_CUSTOM_ICON);
                    bmp.EndInit();
                    bmp.Freeze();

                    Typeface      typeface      = new Typeface(TextsUtility.FBurbank, FontStyles.Normal, FontWeights.Normal, FontStretches.Normal);
                    FormattedText formattedText =
                        new FormattedText(
                            $"{AssetTranslations.SearchTranslation("", "BF7E3CF34A9ACFF52E95EAAD4F09F133", "Damage to Player")} : {DmgPB.Value<string>()}".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, 661 - formattedText.Height);

                    IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
                    IconCreator.ICDrawingContext.DrawImage(bmp, new Rect(12, 634, 24, 24));
                }

                //RESIZE
                IconCreator.ICDrawingContext.DrawRectangle(Brushes.Transparent, null, new Rect(new Point(0, 0), new Size(515, 560 + 35 * count)));
            }
        }
예제 #3
0
파일: Rarity.cs 프로젝트: SebasDeb/FModel
        public static void DrawRarityBackground(JArray AssetProperties)
        {
            JToken serieToken  = AssetsUtility.GetPropertyTagImport <JToken>(AssetProperties, "Series");
            JToken rarityToken = AssetsUtility.GetPropertyTag <JToken>(AssetProperties, "Rarity");

            if (AssetsLoader.ExportType == "FortAmmoItemDefinition")
            {
                DrawBackground(ImagesUtility.ParseColorFromHex("#6D6D6D"), ImagesUtility.ParseColorFromHex("#464646"), ImagesUtility.ParseColorFromHex("#9E9E9E"));
            }
            else if (serieToken != null)
            {
                GetSerieAsset(serieToken, rarityToken);
            }
            else if (string.Equals(FProp.Default.FRarity_Design, "Accurate Colors"))
            {
                GetRarityData(rarityToken);
            }
            else
            {
                DrawNormalRarity(rarityToken);
            }
        }
예제 #4
0
파일: Rarity.cs 프로젝트: SebasDeb/FModel
        private static void DrawNormalRarity(JToken rarityToken)
        {
            switch (rarityToken != null ? rarityToken.Value <string>() : string.Empty)
            {
            case "EFortRarity::Transcendent":
                DrawBackground(ImagesUtility.ParseColorFromHex("#D51944"), ImagesUtility.ParseColorFromHex("#86072D"), ImagesUtility.ParseColorFromHex("#FF3F58"));
                break;

            case "EFortRarity::Mythic":
                DrawBackground(ImagesUtility.ParseColorFromHex("#BA9C36"), ImagesUtility.ParseColorFromHex("#73581A"), ImagesUtility.ParseColorFromHex("#EED951"));
                break;

            case "EFortRarity::Legendary":
                DrawBackground(ImagesUtility.ParseColorFromHex("#C06A38"), ImagesUtility.ParseColorFromHex("#73331A"), ImagesUtility.ParseColorFromHex("#EC9650"));
                break;

            case "EFortRarity::Epic":
            case "EFortRarity::Quality":
                DrawBackground(ImagesUtility.ParseColorFromHex("#8138C2"), ImagesUtility.ParseColorFromHex("#421A73"), ImagesUtility.ParseColorFromHex("#B251ED"));
                break;

            case "EFortRarity::Rare":
                DrawBackground(ImagesUtility.ParseColorFromHex("#3669BB"), ImagesUtility.ParseColorFromHex("#1A4473"), ImagesUtility.ParseColorFromHex("#5180EE"));
                break;

            case "EFortRarity::Common":
                DrawBackground(ImagesUtility.ParseColorFromHex("#6D6D6D"), ImagesUtility.ParseColorFromHex("#464646"), ImagesUtility.ParseColorFromHex("#9E9E9E"));
                break;

            default:
                DrawBackground(ImagesUtility.ParseColorFromHex("#5EBC36"), ImagesUtility.ParseColorFromHex("#3C731A"), ImagesUtility.ParseColorFromHex("#74EF52"));
                break;
            }
        }
예제 #5
0
        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(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));
                            }
                        }
                    }
                }
            }
        }