コード例 #1
0
        private static string SearchSetDisplayName(string SetTagName)
        {
            JArray setArray = ItemSetsArray
                              .Where(x => string.Equals(x["Item1"].Value <string>(), SetTagName))
                              .Select(x => x["Item2"]["properties"].Value <JArray>())
                              .FirstOrDefault();

            if (setArray != null)
            {
                JToken set_namespace     = AssetsUtility.GetPropertyTagText <JToken>(setArray, "DisplayName", "namespace");
                JToken set_key           = AssetsUtility.GetPropertyTagText <JToken>(setArray, "DisplayName", "key");
                JToken set_source_string = AssetsUtility.GetPropertyTagText <JToken>(setArray, "DisplayName", "source_string");
                if (set_namespace != null && set_key != null && set_source_string != null)
                {
                    if (string.Equals(FProp.Default.FLanguage, "English"))
                    {
                        if (AssetTranslations.HotfixLocResDict != null &&
                            AssetTranslations.HotfixLocResDict.ContainsKey(set_namespace.Value <string>()) &&
                            AssetTranslations.HotfixLocResDict[set_namespace.Value <string>()].ContainsKey(set_key.Value <string>()) &&
                            AssetTranslations.HotfixLocResDict[set_namespace.Value <string>()][set_key.Value <string>()].ContainsKey("en"))
                        {
                            return(string.Format("\nPart of the {0} set.", AssetTranslations.HotfixLocResDict[set_namespace.Value <string>()][set_key.Value <string>()]["en"]));
                        }
                        return(string.Format("\nPart of the {0} set.", set_source_string.Value <string>()));
                    }
                    else
                    {
                        string cosmeticSet  = AssetTranslations.SearchTranslation(set_namespace.Value <string>(), set_key.Value <string>(), set_source_string.Value <string>());
                        string cosmeticPart = AssetTranslations.SearchTranslation("Fort.Cosmetics", "CosmeticItemDescription_SetMembership_NotRich", "\nPart of the {0} set.");
                        return(string.Format(cosmeticPart, cosmeticSet));
                    }
                }
            }
            return(string.Empty);
        }
コード例 #2
0
ファイル: CosmeticSeason.cs プロジェクト: zjfls/FModel
        public static string GetCosmeticSeason(string SeasonNumber)
        {
            string s       = SeasonNumber;
            int    snumber = int.Parse(SeasonNumber);

            if (snumber == 10)
            {
                s = "X";
            }

            string introduced = AssetTranslations.SearchTranslation("Fort.Cosmetics", "CosmeticItemDescription_Season", "\nIntroduced in <SeasonText>{0}</>.").Replace("<SeasonText>", string.Empty).Replace("</>", string.Empty); //2 separate because of Japanese
            string stext      = AssetTranslations.SearchTranslation("AthenaSeasonItemDefinitionInternal", "SeasonTextFormat", "Season {0}");

            //display Chapter {First Letter Of SeasonNumber + 1 (S11 -> Chapter 1 + 1 = 2)}, Season {Last Letter Of SeasonNumber (S11 -> Season 1)}
            //this can easily break lol but idk where are the right numbers for each item
            if (snumber > 10)
            {
                string schapter = AssetTranslations.SearchTranslation("AthenaSeasonItemDefinitionInternal", "ChapterTextFormat", "Chapter {0}");
                string sformat  = AssetTranslations.SearchTranslation("AthenaSeasonItemDefinitionInternal", "ChapterSeasonTextFormat", "{0}, {1}");

                stext = string.Format(introduced, string.Format(sformat, string.Format(schapter, int.Parse(s.Substring(0, 1)) + 1), string.Format(stext, s.Substring(s.Length - 1))));
                return(stext);
            }

            return(string.Format(introduced, string.Format(stext, s)));
        }
コード例 #3
0
        private void SetUserSettings()
        {
            bool restart = false;

            if (!string.Equals(FProp.Default.FPak_Path, InputTextBox.Text))
            {
                FProp.Default.FPak_Path = InputTextBox.Text;
                restart = true;
            }

            FProp.Default.FDiffFileSize = (bool)bDiffFileSize.IsChecked;
            FProp.Default.ReloadAES     = (bool)bReloadAES.IsChecked;
            FProp.Default.FOpenSounds   = (bool)bOpenSounds.IsChecked;

            if (!string.Equals(FProp.Default.FOutput_Path, OutputTextBox.Text))
            {
                FProp.Default.FOutput_Path = OutputTextBox.Text;
                restart = true;
            }

            if (AssetEntries.AssetEntriesDict != null && !string.Equals(FProp.Default.FLanguage, ((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString()))
            {
                AssetTranslations.SetAssetTranslation(((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString());
            }
            FProp.Default.FLanguage = ((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString();

            FProp.Default.FRarity_Design = ((ComboBoxItem)ComboBox_Design.SelectedItem).Content.ToString();
            FProp.Default.FIsFeatured    = (bool)bFeaturedIcon.IsChecked;
            FProp.Default.FUseWatermark  = (bool)bWatermarkIcon.IsChecked;

            FProp.Default.FWatermarkOpacity = Convert.ToInt32(Opacity_Slider.Value);
            FProp.Default.FWatermarkScale   = Scale_Slider.Value;
            FProp.Default.FWatermarkXPos    = xPos_Slider.Value;
            FProp.Default.FWatermarkYPos    = yPos_Slider.Value;

            FProp.Default.FChallengeWatermark    = WatermarkChallenge_TextBox.Text;
            FProp.Default.FUseChallengeWatermark = (bool)bCustomChallenge.IsChecked;
            FProp.Default.FBannerOpacity         = Convert.ToInt32(OpacityBanner_Slider.Value);

            FProp.Default.Save();

            if (restart)
            {
                DarkMessageBox.Show("FModel is about to restart because you applied your new path(s)", "FModel Path(s) Changed", MessageBoxButton.OK, MessageBoxImage.Information);
                DebugHelper.WriteLine("FModel is restarting");
                System.Windows.Forms.Application.Restart();
                Application.Current.Shutdown();
            }
            else
            {
                DebugHelper.WriteUserSettings();
            }
        }
コード例 #4
0
        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);
        }
コード例 #5
0
        private void Button_Click(object sender, RoutedEventArgs e)
        {
            AssetsEntriesDict = new Dictionary <string, Dictionary <string, string> >();
            foreach (AssetProperties a in Assets)
            {
                AssetsEntriesDict[a.Name]              = new Dictionary <string, string>();
                AssetsEntriesDict[a.Name]["Path"]      = a.Path;
                AssetsEntriesDict[a.Name]["isChecked"] = a.IsChecked.ToString();

                if (a.IsChecked)
                {
                    DebugHelper.WriteLine("UpdateMode: User is about to extract everything in " + a.Path);
                }
            }

            string selectedLang = ((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString();

            if (AssetEntries.AssetEntriesDict != null && !string.Equals(FProp.Default.FLanguage, selectedLang))
            {
                AssetTranslations.SetAssetTranslation(selectedLang);
            }
            FProp.Default.FLanguage = selectedLang;

            FProp.Default.FRarity_Design = ((ComboBoxItem)ComboBox_Design.SelectedItem).Content.ToString();
            FProp.Default.FIsFeatured    = (bool)bFeaturedIcon.IsChecked;
            FProp.Default.FUseWatermark  = (bool)bWatermarkIcon.IsChecked;

            FProp.Default.FWatermarkOpacity = Convert.ToInt32(Opacity_Slider.Value);
            FProp.Default.FUM_AssetsType    = JsonConvert.SerializeObject(AssetsEntriesDict, Formatting.Indented);
            FProp.Default.Save();

            DebugHelper.WriteLine("=============== UPDATE MODE ===============");
            DebugHelper.WriteLine("FRarity_Design > " + FProp.Default.FRarity_Design);
            DebugHelper.WriteLine("FLanguage > " + FProp.Default.FLanguage);
            DebugHelper.WriteLine("FIsFeatured > " + FProp.Default.FIsFeatured);
            DebugHelper.WriteLine("FUseWatermark > " + FProp.Default.FUseWatermark);
            DebugHelper.WriteLine("FWatermarkFilePath > " + FProp.Default.FWatermarkFilePath);
            DebugHelper.WriteLine("FWatermarkOpacity > " + FProp.Default.FWatermarkOpacity);
            DebugHelper.WriteLine("FWatermarkScale > " + FProp.Default.FWatermarkScale);
            DebugHelper.WriteLine("FWatermarkXPos > " + FProp.Default.FWatermarkXPos);
            DebugHelper.WriteLine("FWatermarkYPos > " + FProp.Default.FWatermarkYPos);
            DebugHelper.WriteLine("FOpenSounds > " + FProp.Default.FOpenSounds);
            DebugHelper.WriteLine("FAutoExtractRaw > " + FProp.Default.FAutoExtractRaw);
            DebugHelper.WriteLine("FAutoSaveJson > " + FProp.Default.FAutoSaveJson);
            DebugHelper.WriteLine("FAutoSaveImg > " + FProp.Default.FAutoSaveImg);
            DebugHelper.WriteLine("=============================================");

            Close();
        }
コード例 #6
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);
                    }
                }
            }
        }
コード例 #7
0
ファイル: CosmeticSet.cs プロジェクト: zjfls/FModel
        private static string SearchSetDisplayName(string SetTagName)
        {
            JArray setArray = ItemSetsArray
                              .Where(x => string.Equals(x["Item1"].Value <string>(), SetTagName))
                              .Select(x => x["Item2"]["properties"].Value <JArray>())
                              .FirstOrDefault();

            if (setArray != null)
            {
                JToken set_namespace     = AssetsUtility.GetPropertyTagText <JToken>(setArray, "DisplayName", "namespace");
                JToken set_key           = AssetsUtility.GetPropertyTagText <JToken>(setArray, "DisplayName", "key");
                JToken set_source_string = AssetsUtility.GetPropertyTagText <JToken>(setArray, "DisplayName", "source_string");
                if (set_namespace != null && set_key != null && set_source_string != null)
                {
                    string cosmeticSet  = AssetTranslations.SearchTranslation(set_namespace.Value <string>(), set_key.Value <string>(), set_source_string.Value <string>());
                    string cosmeticPart = AssetTranslations.SearchTranslation("Fort.Cosmetics", "CosmeticItemDescription_SetMembership_NotRich", "\nPart of the {0} set.");
                    return(string.Format(cosmeticPart, cosmeticSet));
                }
            }
            return(string.Empty);
        }
コード例 #8
0
        private void SetUserSettings()
        {
            if (!string.Equals(FProp.Default.FPak_Path, InputTextBox.Text))
            {
                FProp.Default.FPak_Path = InputTextBox.Text;
                DarkMessageBox.Show("Please, restart FModel to apply your new input path", "FModel Input Path Changed", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            FProp.Default.FDiffFileSize = (bool)bDiffFileSize.IsChecked;
            FProp.Default.ReloadAES     = (bool)bReloadAES.IsChecked;
            FProp.Default.FOpenSounds   = (bool)bOpenSounds.IsChecked;

            if (!string.Equals(FProp.Default.FOutput_Path, OutputTextBox.Text))
            {
                FProp.Default.FOutput_Path = OutputTextBox.Text;
                DarkMessageBox.Show("Please, restart FModel to apply your new output path", "FModel Output Path Changed", MessageBoxButton.OK, MessageBoxImage.Information);
            }

            if (AssetEntries.AssetEntriesDict != null && !string.Equals(FProp.Default.FLanguage, ((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString()))
            {
                AssetTranslations.SetAssetTranslation(((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString());
            }
            FProp.Default.FLanguage = ((ComboBoxItem)ComboBox_Language.SelectedItem).Content.ToString();

            FProp.Default.FRarity_Design = ((ComboBoxItem)ComboBox_Design.SelectedItem).Content.ToString();
            FProp.Default.FIsFeatured    = (bool)bFeaturedIcon.IsChecked;
            FProp.Default.FUseWatermark  = (bool)bWatermarkIcon.IsChecked;

            FProp.Default.FWatermarkOpacity = Convert.ToInt32(Opacity_Slider.Value);
            FProp.Default.FWatermarkScale   = Scale_Slider.Value;
            FProp.Default.FWatermarkXPos    = xPos_Slider.Value;
            FProp.Default.FWatermarkYPos    = yPos_Slider.Value;

            FProp.Default.FChallengeWatermark    = WatermarkChallenge_TextBox.Text;
            FProp.Default.FUseChallengeWatermark = (bool)bCustomChallenge.IsChecked;
            FProp.Default.FBannerOpacity         = Convert.ToInt32(OpacityBanner_Slider.Value);

            FProp.Default.Save();
        }
コード例 #9
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(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));
                            }
                        }
                    }
                }
            }
        }
コード例 #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;
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #11
0
        private static void DrawCompletionText(string completionCount, SolidColorBrush PrimaryColor, SolidColorBrush SecondaryColor, int y)
        {
            Typeface typeface = new Typeface(FProp.Default.FLanguage.Equals("Japanese") ? TextsUtility.JPBurbank : TextsUtility.Burbank, FontStyles.Normal, FontWeights.Black, FontStretches.Normal);

            #region DESIGN
            IconCreator.ICDrawingContext.DrawRectangle(ChallengesUtility.DarkBrush(PrimaryColor, 0.3f), null, new Rect(0, y, 1024, 90));
            IconCreator.ICDrawingContext.DrawRectangle(PrimaryColor, null, new Rect(25, y, 1024 - 50, 70));

            Point         dStart    = new Point(32, y + 5);
            LineSegment[] dSegments = new[]
            {
                new LineSegment(new Point(29, y + 67), true),
                new LineSegment(new Point(1024 - 160, y + 62), true),
                new LineSegment(new Point(1024 - 150, y + 4), true)
            };
            PathFigure   dFigure = new PathFigure(dStart, dSegments, true);
            PathGeometry dGeo    = new PathGeometry(new[] { dFigure });
            IconCreator.ICDrawingContext.DrawGeometry(ChallengesUtility.LightBrush(PrimaryColor, 0.04f), null, dGeo);

            dStart    = new Point(39, y + 35);
            dSegments = new[]
            {
                new LineSegment(new Point(45, y + 32), true),
                new LineSegment(new Point(48, y + 37), true),
                new LineSegment(new Point(42, y + 40), true)
            };
            dFigure = new PathFigure(dStart, dSegments, true);
            dGeo    = new PathGeometry(new[] { dFigure });
            IconCreator.ICDrawingContext.DrawGeometry(SecondaryColor, null, dGeo);
            #endregion

            string all = "Complete ALL CHALLENGES to earn the reward item";
            string any = "Complete ANY " + completionCount + " CHALLENGES to earn the reward item";
            if (!string.Equals(FProp.Default.FLanguage, "English"))
            {
                all = AssetTranslations.SearchTranslation("AthenaChallengeDetailsEntry", "CompletionRewardFormat_All", "Complete ALL CHALLENGES to earn the reward item");
                any = AssetTranslations.SearchTranslation("AthenaChallengeDetailsEntry", "CompletionRewardFormat", "Complete ANY " + completionCount + " CHALLENGES to earn the reward item");

                #region FIX TRANSLATIONS
                //because HtmlAgilityPack fail to detect the end of the tag when it's </>
                if (all.Contains("</>"))
                {
                    all = all.Replace("</>", "</text>");
                }
                if (any.Contains("</>"))
                {
                    any = any.Replace("</>", "</text>");
                }

                // Polish
                if (all.Contains("|plural"))
                {
                    int    indexStart   = all.IndexOf("|plural(") + 8;
                    int    indexEnd     = all.IndexOf(")", indexStart);
                    string extractDatas = all.Substring(indexStart, indexEnd - indexStart);

                    // one = 1, few >= 2 and <= 4, many > 4, other = ??
                    System.Collections.Generic.Dictionary <string, string> various = extractDatas.Split(',').Select(x => x.Split('=')).Where(x => x.Length == 2).ToDictionary(x => x[0], x => x[1]);
                    if (various != null && various.Any())
                    {
                        int    compCount   = int.Parse(completionCount);
                        string variousText = various.ContainsKey("other") ? various["other"] : "";
                        if (compCount == 1 && various.ContainsKey("one"))
                        {
                            variousText = various["one"];
                        }
                        else if (compCount >= 2 && compCount <= 4 && various.ContainsKey("few"))
                        {
                            variousText = various["few"];
                        }
                        else if (compCount > 4 && various.ContainsKey("many"))
                        {
                            variousText = various["many"];
                        }

                        all = all.Replace($"|plural({extractDatas})", "").Replace("{0} {0}", "{0} " + variousText);
                    }
                }

                // Polish
                if (any.Contains("|plural"))
                {
                    int    indexStart   = any.IndexOf("|plural(") + 8;
                    int    indexEnd     = any.IndexOf(")", indexStart);
                    string extractDatas = any.Substring(indexStart, indexEnd - indexStart);

                    // one = 1, few >= 2 and <= 4, many > 4, other = ??
                    System.Collections.Generic.Dictionary <string, string> various = extractDatas.Split(',').Select(x => x.Split('=')).Where(x => x.Length == 2).ToDictionary(x => x[0], x => x[1]);
                    if (various != null && various.Any())
                    {
                        int    compCount   = int.Parse(completionCount);
                        string variousText = various.ContainsKey("other") ? various["other"] : "";
                        if (compCount == 1 && various.ContainsKey("one"))
                        {
                            variousText = various["one"];
                        }
                        else if (compCount >= 2 && compCount <= 4 && various.ContainsKey("few"))
                        {
                            variousText = various["few"];
                        }
                        else if (compCount > 4 && various.ContainsKey("many"))
                        {
                            variousText = various["many"];
                        }

                        any = any.Replace($"|plural({extractDatas})", "").Replace("{0} {0}", "{0} " + variousText);
                    }
                }

                HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
                doc.LoadHtml(all);
                if (doc.DocumentNode.InnerText.Contains(" {0}")) //avoid white space
                {
                    if (all.Contains("</text>"))
                    {
                        all = doc.DocumentNode.InnerText.Replace(doc.DocumentNode.SelectSingleNode("text").InnerText, doc.DocumentNode.SelectSingleNode("text").InnerText.ToUpper());
                        all = all.Replace(" {0}", string.Empty);
                    }
                    else
                    {
                        all = doc.DocumentNode.InnerText.Replace(" {0}", string.Empty);
                    }
                }
                else
                {
                    if (all.Contains("</text>"))
                    {
                        all = doc.DocumentNode.InnerText.Replace(doc.DocumentNode.SelectSingleNode("text").InnerText, doc.DocumentNode.SelectSingleNode("text").InnerText.ToUpper());
                        all = all.Replace("{0}", string.Empty);
                    }
                    else
                    {
                        all = doc.DocumentNode.InnerText.Replace("{0}", string.Empty);
                    }
                }

                doc = new HtmlAgilityPack.HtmlDocument();
                doc.LoadHtml(any);
                if (doc.DocumentNode.InnerText.Contains("{QuestNumber}")) //russian
                {
                    if (any.Contains("</text>"))
                    {
                        any = doc.DocumentNode.InnerText.Replace(doc.DocumentNode.SelectSingleNode("text").InnerText, doc.DocumentNode.SelectSingleNode("text").InnerText.ToUpper());
                        any = any.Replace("{QuestNumber}", completionCount);
                    }
                    else
                    {
                        any = doc.DocumentNode.InnerText.Replace("{QuestNumber}", completionCount);
                    }
                }
                else
                {
                    if (any.Contains("</text>"))
                    {
                        any = doc.DocumentNode.InnerText.Replace(doc.DocumentNode.SelectSingleNode("text").InnerText, doc.DocumentNode.SelectSingleNode("text").InnerText.ToUpper());
                        any = string.Format(any, completionCount);
                    }
                    else
                    {
                        any = string.Format(doc.DocumentNode.InnerText, completionCount);
                    }
                }

                if (all.Contains("  "))
                {
                    all = all.Replace("  ", " ");
                }                                                         //double space in Spanish (LA)               i.e. with QuestBundle_PirateParty
                if (any.Contains("  "))
                {
                    any = any.Replace("  ", " ");
                }
                #endregion
            }

            FormattedText formattedText =
                new FormattedText(
                    string.Equals(completionCount, "-1") ? all : any,
                    CultureInfo.CurrentUICulture,
                    FlowDirection.LeftToRight,
                    typeface,
                    30,
                    Brushes.White,
                    IconCreator.PPD
                    );
            formattedText.TextAlignment = TextAlignment.Left;
            formattedText.MaxTextWidth  = 800;
            formattedText.MaxLineCount  = 1;
            Point textLocation = new Point(60, y + (FProp.Default.FLanguage.Equals("Japanese") ? 17 : 23));
            IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
        }
コード例 #12
0
        private static void LoadPAKFiles(bool bAllPAKs = false)
        {
            if (PAKEntries.PAKEntriesList != null && PAKEntries.PAKEntriesList.Any())
            {
                AssetEntries.ArraySearcher    = new Dictionary <string, FPakEntry[]>();
                AssetEntries.AssetEntriesDict = new Dictionary <string, PakReader.PakReader>();

                //MAIN PAKs LOOP
                foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList.Where(x => !x.bTheDynamicPAK))
                {
                    if (!string.IsNullOrEmpty(FProp.Default.FPak_MainAES))
                    {
                        DebugHelper.WriteLine($".PAKs: Loading {Pak.ThePAKPath} with key: {FProp.Default.FPak_MainAES}");

                        byte[] AESKey = AESUtility.StringToByteArray(FProp.Default.FPak_MainAES);
                        PakReader.PakReader reader = null;
                        try
                        {
                            reader = new PakReader.PakReader(Pak.ThePAKPath, AESKey);
                        }
                        catch (Exception ex)
                        {
                            DebugHelper.WriteException(ex, Pak.ThePAKPath);

                            if (string.Equals(ex.Message, "The AES key is invalid"))
                            {
                                UIHelper.DisplayError();
                            }
                            else
                            {
                                new UpdateMyConsole(ex.Message, CColors.Red, true).Append(); return;
                            }
                            break;
                        }

                        if (reader != null)
                        {
                            PAKEntries.PAKToDisplay.Add(Path.GetFileName(Pak.ThePAKPath), reader.FileInfos);

                            if (bAllPAKs)
                            {
                                new UpdateMyProcessEvents($"{Path.GetFileNameWithoutExtension(Pak.ThePAKPath)} mount point: {reader.MountPoint}", "Loading").Update();
                            }
                            foreach (FPakEntry entry in reader.FileInfos)
                            {
                                AssetEntries.AssetEntriesDict[entry.Name] = reader;
                                AssetEntries.ArraySearcher[entry.Name]    = reader.FileInfos;
                            }
                        }
                    }
                }

                //DYNAMIC PAKs LOOP
                foreach (PAKInfosEntry Pak in PAKEntries.PAKEntriesList.Where(x => x.bTheDynamicPAK))
                {
                    byte[] AESKey         = null;
                    string AESFromManager = string.Empty;
                    if (AESEntries.AESEntriesList != null && AESEntries.AESEntriesList.Any())
                    {
                        AESFromManager = AESEntries.AESEntriesList.Where(x => string.Equals(x.ThePAKName, Path.GetFileNameWithoutExtension(Pak.ThePAKPath))).Select(x => x.ThePAKKey).FirstOrDefault();
                        if (!string.IsNullOrEmpty(AESFromManager))
                        {
                            DebugHelper.WriteLine($".PAKs: Loading {Pak.ThePAKPath} with key: {AESFromManager}");
                            AESKey = AESUtility.StringToByteArray(AESFromManager);
                        }
                    }

                    if (AESKey != null)
                    {
                        PakReader.PakReader reader = null;
                        try
                        {
                            reader = new PakReader.PakReader(Pak.ThePAKPath, AESKey);
                        }
                        catch (Exception ex)
                        {
                            DebugHelper.WriteException(ex, Pak.ThePAKPath);

                            if (string.Equals(ex.Message, "The AES key is invalid"))
                            {
                                UIHelper.DisplayError(Path.GetFileNameWithoutExtension(Pak.ThePAKPath), AESFromManager);
                            }
                            else
                            {
                                new UpdateMyConsole(ex.Message, CColors.Red, true).Append(); return;
                            }
                            continue;
                        }

                        if (reader != null)
                        {
                            PAKEntries.PAKToDisplay.Add(Path.GetFileName(Pak.ThePAKPath), reader.FileInfos);

                            if (bAllPAKs)
                            {
                                new UpdateMyProcessEvents($"{Path.GetFileNameWithoutExtension(Pak.ThePAKPath)} mount point: {reader.MountPoint}", "Loading").Update();
                            }
                            foreach (FPakEntry entry in reader.FileInfos)
                            {
                                AssetEntries.AssetEntriesDict[entry.Name] = reader;
                                AssetEntries.ArraySearcher[entry.Name]    = reader.FileInfos;
                            }
                        }
                    }
                    else
                    {
                        DebugHelper.WriteLine($".PAKs: No key found for {Pak.ThePAKPath}");
                    }
                }

                AssetTranslations.SetAssetTranslation(FProp.Default.FLanguage);
            }
        }
コード例 #13
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)));
            }
        }
コード例 #14
0
        private static void DrawCompletionText(string completionCount, SolidColorBrush PrimaryColor, SolidColorBrush SecondaryColor, int y)
        {
            Typeface typeface = new Typeface(TextsUtility.Burbank, FontStyles.Normal, FontWeights.Black, FontStretches.Normal);

            #region DESIGN
            IconCreator.ICDrawingContext.DrawRectangle(ChallengesUtility.DarkBrush(PrimaryColor, 0.3f), null, new Rect(0, y, 1024, 90));
            IconCreator.ICDrawingContext.DrawRectangle(PrimaryColor, null, new Rect(25, y, 1024 - 50, 70));

            Point         dStart    = new Point(32, y + 5);
            LineSegment[] dSegments = new[]
            {
                new LineSegment(new Point(29, y + 67), true),
                new LineSegment(new Point(1024 - 160, y + 62), true),
                new LineSegment(new Point(1024 - 150, y + 4), true)
            };
            PathFigure   dFigure = new PathFigure(dStart, dSegments, true);
            PathGeometry dGeo    = new PathGeometry(new[] { dFigure });
            IconCreator.ICDrawingContext.DrawGeometry(ChallengesUtility.LightBrush(PrimaryColor, 0.04f), null, dGeo);

            dStart    = new Point(39, y + 35);
            dSegments = new[]
            {
                new LineSegment(new Point(45, y + 32), true),
                new LineSegment(new Point(48, y + 37), true),
                new LineSegment(new Point(42, y + 40), true)
            };
            dFigure = new PathFigure(dStart, dSegments, true);
            dGeo    = new PathGeometry(new[] { dFigure });
            IconCreator.ICDrawingContext.DrawGeometry(SecondaryColor, null, dGeo);
            #endregion

            string all = "Complete ALL CHALLENGES to earn the reward item";
            string any = "Complete ANY " + completionCount + " CHALLENGES to earn the reward item";
            if (!string.Equals(FProp.Default.FLanguage, "English"))
            {
                all = AssetTranslations.SearchTranslation("AthenaChallengeDetailsEntry", "CompletionRewardFormat_All", "Complete ALL CHALLENGES to earn the reward item");
                any = AssetTranslations.SearchTranslation("AthenaChallengeDetailsEntry", "CompletionRewardFormat", "Complete ANY " + completionCount + " CHALLENGES to earn the reward item");

                #region FIX TRANSLATIONS
                //because HtmlAgilityPack fail to detect the end of the tag when it's </>
                if (all.Contains("</>"))
                {
                    all = all.Replace("</>", "</text>");
                }
                if (any.Contains("</>"))
                {
                    any = any.Replace("</>", "</text>");
                }

                HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
                doc.LoadHtml(all);
                if (doc.DocumentNode.InnerText.Contains(" {0}")) //avoid white space
                {
                    if (all.Contains("</text>"))
                    {
                        all = doc.DocumentNode.InnerText.Replace(doc.DocumentNode.SelectSingleNode("text").InnerText, doc.DocumentNode.SelectSingleNode("text").InnerText.ToUpper());
                        all = all.Replace(" {0}", string.Empty);
                    }
                    else
                    {
                        all = doc.DocumentNode.InnerText.Replace(" {0}", string.Empty);
                    }
                }
                else
                {
                    if (all.Contains("</text>"))
                    {
                        all = doc.DocumentNode.InnerText.Replace(doc.DocumentNode.SelectSingleNode("text").InnerText, doc.DocumentNode.SelectSingleNode("text").InnerText.ToUpper());
                        all = all.Replace("{0}", string.Empty);
                    }
                    else
                    {
                        all = doc.DocumentNode.InnerText.Replace("{0}", string.Empty);
                    }
                }

                doc = new HtmlAgilityPack.HtmlDocument();
                doc.LoadHtml(any);
                if (doc.DocumentNode.InnerText.Contains("{QuestNumber}")) //russian
                {
                    if (any.Contains("</text>"))
                    {
                        any = doc.DocumentNode.InnerText.Replace(doc.DocumentNode.SelectSingleNode("text").InnerText, doc.DocumentNode.SelectSingleNode("text").InnerText.ToUpper());
                        any = any.Replace("{QuestNumber}", completionCount);
                    }
                    else
                    {
                        any = doc.DocumentNode.InnerText.Replace("{QuestNumber}", completionCount);
                    }
                }
                else
                {
                    if (any.Contains("</text>"))
                    {
                        any = doc.DocumentNode.InnerText.Replace(doc.DocumentNode.SelectSingleNode("text").InnerText, doc.DocumentNode.SelectSingleNode("text").InnerText.ToUpper());
                        any = string.Format(any, completionCount);
                    }
                    else
                    {
                        any = string.Format(doc.DocumentNode.InnerText, completionCount);
                    }
                }

                if (all.Contains("  "))
                {
                    all = all.Replace("  ", " ");
                }                                                         //double space in Spanish (LA)               i.e. with QuestBundle_PirateParty
                if (any.Contains("  "))
                {
                    any = any.Replace("  ", " ");
                }
                #endregion
            }

            FormattedText formattedText =
                new FormattedText(
                    string.Equals(completionCount, "-1") ? all : any,
                    CultureInfo.CurrentUICulture,
                    FlowDirection.LeftToRight,
                    typeface,
                    30,
                    Brushes.White,
                    IconCreator.PPD
                    );
            formattedText.TextAlignment = TextAlignment.Left;
            formattedText.MaxTextWidth  = 800;
            formattedText.MaxLineCount  = 1;
            Point textLocation = new Point(60, y + 23);
            IconCreator.ICDrawingContext.DrawText(formattedText, textLocation);
        }
コード例 #15
0
        /// <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)));
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #16
0
ファイル: IconText.cs プロジェクト: UntouchedOdin0/FModel
        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."));
            }
        }
コード例 #17
0
ファイル: IconText.cs プロジェクト: zjfls/FModel
        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>());
                }
            }
        }