Пример #1
0
        public BaseGCosmetic(IUExport export, string exportType) : this(exportType)
        {
            // rarity
            Rarity.GetInGameRarity(this, export.GetExport <EnumProperty>("Rarity"));

            // image
            if (export.GetExport <SoftObjectProperty>("IconTexture") is SoftObjectProperty previewImage)
            {
                this.IconImage = Utils.GetSoftObjectTexture(previewImage);
            }
            else if (export.GetExport <ObjectProperty>("IconTexture") is ObjectProperty iconTexture)
            {
                this.IconImage = Utils.GetObjectTexture(iconTexture);
            }

            // text
            if (export.GetExport <TextProperty>("DisplayName", "Title") is TextProperty displayName)
            {
                DisplayName = Text.GetTextPropertyBase(displayName);
            }
            if (export.GetExport <TextProperty>("Description") is TextProperty description)
            {
                Description = Text.GetTextPropertyBase(description);
            }
        }
Пример #2
0
        public BaseOffer(IUExport export) : this()
        {
            if (export.GetExport <StructProperty>("DetailsImage", "TileImage") is StructProperty typeImage)
            {
                if (typeImage.Value is UObject t && t.TryGetValue("ResourceObject", out var v) && v is ObjectProperty resourceObject)
                {
                    IconImage = Utils.GetObjectTexture(resourceObject);
                }
            }

            if (export.GetExport <StructProperty>("Gradient") is StructProperty gradient)
            {
                if (gradient.Value is UObject g &&
                    g.TryGetValue("Start", out var s1) && s1 is StructProperty t1 && t1.Value is FLinearColor start &&
                    g.TryGetValue("Stop", out var s2) && s2 is StructProperty t2 && t2.Value is FLinearColor stop)
                {
                    RarityBackgroundColors = new SKColor[2] {
                        SKColor.Parse(start.Hex), SKColor.Parse(stop.Hex)
                    };
                }
            }

            if (export.GetExport <StructProperty>("Background") is StructProperty background)
            {
                if (background.Value is FLinearColor b)
                {
                    RarityBorderColor = SKColor.Parse(b.Hex);
                }
            }
        }
Пример #3
0
        public BaseMapUIData(IUExport export) : this()
        {
            if (export.GetExport <TextProperty>("DisplayName") is TextProperty displayName)
            {
                DisplayName = Text.GetTextPropertyBase(displayName) ?? "";
            }
            if (export.GetExport <TextProperty>("Description") is TextProperty description)
            {
                Description = Text.GetTextPropertyBase(description) ?? "";
            }
            if (export.GetExport <TextProperty>("Coordinates") is TextProperty coordinates)
            {
                Coordinates = Text.GetTextPropertyBase(coordinates) ?? "";
            }

            if (export.GetExport <ObjectProperty>("Splash") is ObjectProperty icon)
            {
                Splash = Utils.GetObjectTexture(icon);
            }

            VLogo = Utils.GetTexture("/Game/UI/Shared/Icons/Valorant_logo_cutout").Resize(48, 48);

            if (Splash != null)
            {
                Width  = Splash.Width;
                Height = Splash.Height;
            }
        }
Пример #4
0
        public BaseUIData(IUExport export) : this()
        {
            if (export.GetExport <TextProperty>("DisplayName") is TextProperty displayName)
            {
                DisplayName = Text.GetTextPropertyBase(displayName);
            }
            if (export.GetExport <TextProperty>("Description") is TextProperty description)
            {
                Description = Text.GetTextPropertyBase(description);
                if (!string.IsNullOrEmpty(Description))
                {
                    Height += (int)descriptionPaint.TextSize * Helper.SplitLines(Description, descriptionPaint, Width - Margin).Length;
                    Height += (int)descriptionPaint.TextSize;
                }
            }

            if (export.GetExport <ObjectProperty>("FullRender", "VerticalPromoImage", "LargeIcon", "DisplayIcon") is ObjectProperty icon)
            {
                SKBitmap raw = Utils.GetObjectTexture(icon);
                if (raw != null)
                {
                    int coef  = Width / raw.Width;
                    int sizeX = raw.Width * coef;
                    int sizeY = raw.Height * coef;
                    Height   += sizeY;
                    IconImage = raw.Resize(sizeX, sizeY);
                }
            }
        }
Пример #5
0
        public BasePlaylist(IUExport export)
        {
            FallbackImage          = SKBitmap.Decode(Application.GetResourceStream(new Uri("pack://application:,,,/Resources/T_Placeholder_Item_Image.png"))?.Stream);
            IconImage              = FallbackImage;
            RarityBackgroundColors = new[] { SKColor.Parse("5EBC36"), SKColor.Parse("305C15") };
            RarityBorderColor      = new[] { SKColor.Parse("74EF52"), SKColor.Parse("74EF52") };

            if (export.GetExport <TextProperty>("UIDisplayName", "DisplayName") is { } displayName)
            {
                DisplayName = Text.GetTextPropertyBase(displayName);
            }
            if (export.GetExport <TextProperty>("UIDescription", "Description") is { } description)
            {
                Description = Text.GetTextPropertyBase(description);
            }

            Width = Height = 512;

            if (export.GetExport <NameProperty>("PlaylistName") is { } playlistName&& !playlistName.Value.IsNone)
            {
                ApiResponse <PlaylistV1> playlist = Endpoints.FortniteAPI.V1.Playlists.Get(playlistName.Value.String);

                if (playlist.IsSuccess && playlist.Data.Images.HasShowcase)
                {
                    byte[] imageBytes = Endpoints.GetRawData(playlist.Data.Images.Showcase);

                    if (imageBytes != null)
                    {
                        IconImage = SKBitmap.Decode(imageBytes);
                        Width     = IconImage.Width;
                        Height    = IconImage.Height;
                    }
                }
            }
        }
Пример #6
0
        public BaseOfferMaterial(IUExport export) : this()
        {
            if (export.GetExport <ArrayProperty>("VectorParameterValues") is ArrayProperty vectorParameterValues)
            {
                foreach (StructProperty vectorParameter in vectorParameterValues.Value)
                {
                    if (vectorParameter.Value is UObject parameter &&
                        parameter.TryGetValue("ParameterValue", out var i) && i is StructProperty v && v.Value is FLinearColor value &&
                        parameter.TryGetValue("ParameterInfo", out var i1) && i1 is StructProperty i2 && i2.Value is UObject info &&
                        info.TryGetValue("Name", out var j1) && j1 is NameProperty name)
                    {
                        if (name.Value.String.Equals("Background_Color_A"))
                        {
                            RarityBackgroundColors[0] = SKColor.Parse(value.Hex);
                            RarityBorderColor         = RarityBackgroundColors[0];
                        }
                        else if (name.Value.String.Equals("Background_Color_B"))
                        {
                            RarityBackgroundColors[1] = SKColor.Parse(value.Hex);
                        }
                    }
                }
            }

            if (export.GetExport <ArrayProperty>("TextureParameterValues") is ArrayProperty textureParameterValues)
            {
                foreach (StructProperty textureParameter in textureParameterValues.Value)
                {
                    if (textureParameter.Value is UObject parameter &&
                        parameter.TryGetValue("ParameterValue", out var i) && i is ObjectProperty value &&
                        parameter.TryGetValue("ParameterInfo", out var i1) && i1 is StructProperty i2 && i2.Value is UObject info &&
                        info.TryGetValue("Name", out var j1) && j1 is NameProperty name)
                    {
                        if (name.Value.String.Equals("SeriesTexture"))
                        {
                            RarityBackgroundImage = Utils.GetObjectTexture(value);
                        }
                        else if (IconImage == null && value.Value.Resource.OuterIndex.Resource != null && (name.Value.String.Equals("OfferImage") || name.Value.String.Contains("Texture")))
                        {
                            IconImage = Utils.GetObjectTexture(value);
                            if (IconImage == null)
                            {
                                IconImage = Utils.GetTexture($"{value.Value.Resource.OuterIndex.Resource.ObjectName.String}_1");
                            }
                            if (IconImage == null)
                            {
                                IconImage = Utils.GetTexture($"{value.Value.Resource.OuterIndex.Resource.ObjectName.String}_01");
                            }
                        }
                    }
                }
            }

            if (IconImage == null)
            {
                IconImage = FallbackImage;
            }
        }
Пример #7
0
 /// <summary>
 /// used to get low res icons ONLY
 /// </summary>
 /// <param name="export"></param>
 /// <param name="assetName"></param>
 public BaseIcon(IUExport export, string assetName) : this()
 {
     if (export.GetExport <ObjectProperty>("HeroDefinition", "WeaponDefinition") is ObjectProperty itemDef)
     {
         LargeSmallImage.GetPreviewImage(this, itemDef, assetName, false);
     }
     else if (export.GetExport <SoftObjectProperty>("SmallPreviewImage", "SmallImage") is SoftObjectProperty previewImage)
     {
         LargeSmallImage.GetPreviewImage(this, previewImage);
     }
 }
Пример #8
0
 public BaseItemAccess(IUExport export) : this()
 {
     if (export.GetExport <ObjectProperty>("access_item") is ObjectProperty accessItem)
     {
         SItem = accessItem.Value.Resource.ObjectName.String;
         PakPackage p = Utils.GetPropertyPakPackage(accessItem.Value.Resource.OuterIndex.Resource.ObjectName.String);
         if (p.HasExport() && !p.Equals(default))
Пример #9
0
        public BaseBundle(IUExport export, string assetFolder) : this()
        {
            if (export.GetExport <StructProperty>("DisplayStyle") is StructProperty displayStyle)
            {
                DisplayStyle = new Header(displayStyle, assetFolder);
            }
            if (export.GetExport <TextProperty>("DisplayName") is TextProperty displayName)
            {
                DisplayName = Text.GetTextPropertyBase(displayName);
            }

            if (export.GetExport <ArrayProperty>("CareerQuestBitShifts") is ArrayProperty careerQuestBitShifts)
            {
                foreach (SoftObjectProperty questPath in careerQuestBitShifts.Value)
                {
                    PakPackage p = Utils.GetPropertyPakPackage(questPath.Value.AssetPathName.String);
                    if (p.HasExport() && !p.Equals(default))
Пример #10
0
        public BaseIcon(IUExport export, string assetName, bool forceHR) : this()
        {
            if (export.GetExport <ObjectProperty>("Series") is ObjectProperty series)
            {
                Serie.GetRarity(this, series);
            }
            else if (Properties.Settings.Default.UseGameColors)                          // override default green
            {
                Rarity.GetInGameRarity(this, export.GetExport <EnumProperty>("Rarity")); // uncommon will be triggered by Rarity being null
            }
            else if (export.GetExport <EnumProperty>("Rarity") is EnumProperty rarity)
            {
                Rarity.GetHardCodedRarity(this, rarity);
            }

            if (export.GetExport <ObjectProperty>("HeroDefinition", "WeaponDefinition") is ObjectProperty itemDef)
            {
                LargeSmallImage.GetPreviewImage(this, itemDef, assetName, forceHR);
            }
            else if (export.GetExport <SoftObjectProperty>(forceHR ? "LargePreviewImage" : "SmallPreviewImage", forceHR ? "ItemDisplayAsset" : "SmallImage") is SoftObjectProperty previewImage)
            {
                LargeSmallImage.GetPreviewImage(this, previewImage);
            }
            else if (export.GetExport <ObjectProperty>("access_item") is ObjectProperty accessItem)
            {
                PakPackage p = Utils.GetPropertyPakPackage(accessItem.Value.Resource.OuterIndex.Resource.ObjectName.String);
                if (p.HasExport() && !p.Equals(default))
Пример #11
0
 public BaseLabel(IUExport export) : this()
 {
     if (export.GetExport <ArrayProperty>("ExplicitAssets") is ArrayProperty explicitAssetsArray)
     {
         foreach (var o in explicitAssetsArray.Value)
         {
             if (o is SoftObjectProperty s)
             {
                 ExplicitAsset.GetAsset(this, s);
             }
         }
     }
 }
Пример #12
0
        public BaseIcon(IUExport export, string assetName, bool forceHR) : this()
        {
            if (export.GetExport <ObjectProperty>("Series") is ObjectProperty series)
            {
                Serie.GetRarity(this, series);
            }
            else if (Properties.Settings.Default.UseGameColors)                          // override default green
            {
                Rarity.GetInGameRarity(this, export.GetExport <EnumProperty>("Rarity")); // uncommon will be triggered by Rarity being null
            }
            else if (export.GetExport <EnumProperty>("Rarity") is EnumProperty rarity)
            {
                Rarity.GetHardCodedRarity(this, rarity);
            }

            if (export.GetExport <ObjectProperty>("HeroDefinition", "WeaponDefinition") is ObjectProperty itemDef)
            {
                LargeSmallImage.GetPreviewImage(this, itemDef, assetName, forceHR);
            }
            else if (export.GetExport <SoftObjectProperty>(forceHR ? "LargePreviewImage" : "SmallPreviewImage", forceHR ? "ItemDisplayAsset" : "SmallImage") is SoftObjectProperty previewImage)
            {
                LargeSmallImage.GetPreviewImage(this, previewImage);
            }
        }
Пример #13
0
 public BaseIcon(IUExport export, string assetName, bool forceHR) : this()
 {
     if (export.GetExport <ObjectProperty>("Series") is { } series)
     {
         Serie.GetRarity(this, series);
     }
Пример #14
0
 public BaseGCosmetic(IUExport export, string exportType) : this(exportType)
 {
     // rarity
     EnumProperty r = export.GetExport <EnumProperty>("Rarity");
     Rarity.GetInGameRarity(this, r);
     this.RarityDisplayName = r != null ? r?.Value.String["EXRarity::".Length..] : "Common";
Пример #15
0
        /// <summary>
        /// Order:
        ///     1. Rarity
        ///     2. Image
        ///     3. Text
        ///         1. DisplayName
        ///         2. Description
        ///         3. Misc
        ///     4. GameplayTags
        ///         1. order doesn't matter
        ///         2. the importance here is to get the description before gameplay tags
        /// </summary>
        public BaseIcon(IUExport export, string exportType, ref string assetName) : this()
        {
            // rarity
            if (export.GetExport <ObjectProperty>("Series") is ObjectProperty series)
            {
                Serie.GetRarity(this, series);
            }
            else if (Properties.Settings.Default.UseGameColors)                          // override default green
            {
                Rarity.GetInGameRarity(this, export.GetExport <EnumProperty>("Rarity")); // uncommon will be triggered by Rarity being null
            }
            else if (export.GetExport <EnumProperty>("Rarity") is EnumProperty rarity)
            {
                Rarity.GetHardCodedRarity(this, rarity);
            }

            // image
            if (Properties.Settings.Default.UseItemShopIcon &&
                DisplayAssetImage.GetDisplayAssetImage(this, export.GetExport <SoftObjectProperty>("DisplayAssetPath"), ref assetName))
            {
            }   // ^^^^ will return false if image not found, if so, we try to get the normal icon
            else if (export.GetExport <ObjectProperty>("HeroDefinition", "WeaponDefinition") is ObjectProperty itemDef)
            {
                LargeSmallImage.GetPreviewImage(this, itemDef, assetName);
            }
            else if (export.GetExport <SoftObjectProperty>("LargePreviewImage", "SmallPreviewImage", "ItemDisplayAsset") is SoftObjectProperty previewImage)
            {
                LargeSmallImage.GetPreviewImage(this, previewImage);
            }
            else if (export.GetExport <StructProperty>("IconBrush") is StructProperty iconBrush) // abilities
            {
                LargeSmallImage.GetPreviewImage(this, iconBrush);
            }

            // text
            if (export.GetExport <TextProperty>("DisplayName", "DefaultHeaderText", "UIDisplayName") is TextProperty displayName)
            {
                DisplayName = Text.GetTextPropertyBase(displayName);
            }
            if (export.GetExport <TextProperty>("Description", "DefaultBodyText") is TextProperty description)
            {
                Description = Text.GetTextPropertyBase(description);
            }
            else if (export.GetExport <ArrayProperty>("Description") is ArrayProperty arrayDescription) // abilities
            {
                Description = Text.GetTextPropertyBase(arrayDescription);
            }
            if (export.GetExport <StructProperty>("MaxStackSize") is StructProperty maxStackSize)
            {
                ShortDescription = Text.GetMaxStackSize(maxStackSize);
            }
            else if (export.GetExport <TextProperty>("ShortDescription") is TextProperty shortDescription)
            {
                ShortDescription = Text.GetTextPropertyBase(shortDescription);
            }
            else if (exportType.Equals("AthenaItemWrapDefinition")) // if no ShortDescription it's most likely a wrap
            {
                ShortDescription = Localizations.GetLocalization("Fort.Cosmetics", "ItemWrapShortDescription", "Wrap");
            }

            // gameplaytags
            if (export.GetExport <StructProperty>("GameplayTags") is StructProperty gameplayTags)
            {
                GameplayTag.GetGameplayTags(this, gameplayTags, exportType);
            }
            else if (export.GetExport <ObjectProperty>("cosmetic_item") is ObjectProperty cosmeticItem) // variants
            {
                CosmeticSource = cosmeticItem.Value.Resource.ObjectName.String;
            }

            if (export.GetExport <SoftObjectProperty>("AmmoData") is SoftObjectProperty ammoData)
            {
                Statistics.GetAmmoData(this, ammoData);
            }
            if (export.GetExport <StructProperty>("WeaponStatHandle") is StructProperty weaponStatHandle)
            {
                Statistics.GetWeaponStats(this, weaponStatHandle);
            }
            if (export.GetExport <ObjectProperty>("HeroGameplayDefinition") is ObjectProperty heroGameplayDefinition)
            {
                Statistics.GetHeroStats(this, heroGameplayDefinition);
            }

            /* Please do not add Schematics support because it takes way too much memory */
            /* Thank the STW Dev Team for using a 5,69Mb file to get... Oh nvm, they all left */

            AdditionalSize = 48 * Stats.Count;
        }
Пример #16
0
        public BaseUserOption(IUExport export)
        {
            if (export.GetExport <TextProperty>("OptionDisplayName") is TextProperty optionDisplayName)
            {
                OptionDisplayName = Text.GetTextPropertyBase(optionDisplayName).ToUpperInvariant();
            }
            if (export.GetExport <TextProperty>("OptionDescription") is TextProperty optionDescription)
            {
                OptionDescription = Text.GetTextPropertyBase(optionDescription);
                if (!string.IsNullOrEmpty(OptionDescription))
                {
                    Height += (int)descriptionPaint.TextSize * Helper.SplitLines(OptionDescription, descriptionPaint, Width - Margin).Length;
                    Height += (int)descriptionPaint.TextSize;
                }
            }

            if (export.GetExport <ArrayProperty>("OptionValues") is ArrayProperty optionValues)
            {
                OptionValues = new List <Options>(optionValues.Value.Length);
                for (int i = 0; i < OptionValues.Capacity; i++)
                {
                    if (optionValues.Value[i] is StructProperty s && s.Value is UObject option)
                    {
                        if (option.TryGetValue("DisplayName", out var v1) && v1 is TextProperty displayName)
                        {
                            var opt = new Options {
                                Option = Text.GetTextPropertyBase(displayName).ToUpperInvariant()
                            };
                            if (option.TryGetValue("Value", out var v) && v is StructProperty value && value.Value is FLinearColor color)
                            {
                                opt.Color = SKColor.Parse(color.Hex).WithAlpha(150);
                            }
                            OptionValues.Add(opt);
                        }
                        else if (option.TryGetValue("PrimaryAssetName", out var v2) && v2 is NameProperty primaryAssetName)
                        {
                            OptionValues.Add(new Options {
                                Option = primaryAssetName.Value.String
                            });
                        }
                    }
                }
            }

            if (export.GetExport <TextProperty>("OptionOnText") is TextProperty optionOnText)
            {
                OptionValues.Add(new Options {
                    Option = Text.GetTextPropertyBase(optionOnText).ToUpperInvariant()
                });
            }
            if (export.GetExport <TextProperty>("OptionOffText") is TextProperty optionOffText)
            {
                OptionValues.Add(new Options {
                    Option = Text.GetTextPropertyBase(optionOffText).ToUpperInvariant()
                });
            }

            if (export.GetExport <IntProperty>("Min", "DefaultValue") is IntProperty iMin &&
                export.GetExport <IntProperty>("Max") is IntProperty iMax)
            {
                int increment = iMin.Value;
                if (export.GetExport <IntProperty>("IncrementValue") is IntProperty incrementValue)
                {
                    increment = incrementValue.Value;
                }

                for (int i = iMin.Value; i <= iMax.Value; i += increment)
                {
                    OptionValues.Add(new Options {
                        Option = i.ToString()
                    });
                }
            }

            if (export.GetExport <FloatProperty>("Min") is FloatProperty fMin &&
                export.GetExport <FloatProperty>("Max") is FloatProperty fMax)
            {
                float increment = fMin.Value;
                if (export.GetExport <FloatProperty>("IncrementValue") is FloatProperty incrementValue)
                {
                    increment = incrementValue.Value;
                }

                for (float i = fMin.Value; i <= fMax.Value; i += increment)
                {
                    OptionValues.Add(new Options {
                        Option = i.ToString()
                    });
                }
            }

            Height += Margin;
            Height += 35 * OptionValues.Count;
        }
Пример #17
0
        public BaseSeason(IUExport export, string assetFolder) : this()
        {
            if (export.GetExport <TextProperty>("DisplayName") is TextProperty displayName)
            {
                DisplayName = Text.GetTextPropertyBase(displayName);
            }

            if (export.GetExport <StructProperty>("SeasonFirstWinRewards") is StructProperty s && s.Value is UObject seasonFirstWinRewards &&
                seasonFirstWinRewards.GetExport <ArrayProperty>("Rewards") is ArrayProperty rewards)
            {
                foreach (StructProperty reward in rewards.Value)
                {
                    if (reward.Value is UObject o &&
                        o.GetExport <SoftObjectProperty>("ItemDefinition") is SoftObjectProperty itemDefinition &&
                        o.GetExport <IntProperty>("Quantity") is IntProperty quantity)
                    {
                        FirstWinReward = new Reward(quantity, itemDefinition.Value);
                    }
                }
            }

            if (export.GetExport <StructProperty>("BookXpScheduleFree") is StructProperty r2 && r2.Value is UObject bookXpScheduleFree &&
                bookXpScheduleFree.GetExport <ArrayProperty>("Levels") is ArrayProperty levels2)
            {
                for (int i = 0; i < levels2.Value.Length; i++)
                {
                    BookXpSchedule[i] = new List <Reward>(); // init list for all reward index and once
                    if (levels2.Value[i] is StructProperty level && level.Value is UObject l &&
                        l.GetExport <ArrayProperty>("Rewards") is ArrayProperty elRewards && elRewards.Value.Length > 0)
                    {
                        foreach (StructProperty reward in elRewards.Value)
                        {
                            if (reward.Value is UObject o &&
                                o.GetExport <SoftObjectProperty>("ItemDefinition") is SoftObjectProperty itemDefinition &&
                                !itemDefinition.Value.AssetPathName.String.StartsWith("/Game/Items/Tokens/") &&
                                o.GetExport <IntProperty>("Quantity") is IntProperty quantity)
                            {
                                BookXpSchedule[i].Add(new Reward(quantity, itemDefinition.Value));
                            }
                        }
                    }
                }
            }

            if (export.GetExport <StructProperty>("BookXpSchedulePaid") is StructProperty r1 && r1.Value is UObject bookXpSchedulePaid &&
                bookXpSchedulePaid.GetExport <ArrayProperty>("Levels") is ArrayProperty levels1)
            {
                for (int i = 0; i < levels1.Value.Length; i++)
                {
                    if (levels1.Value[i] is StructProperty level && level.Value is UObject l &&
                        l.GetExport <ArrayProperty>("Rewards") is ArrayProperty elRewards && elRewards.Value.Length > 0)
                    {
                        foreach (StructProperty reward in elRewards.Value)
                        {
                            if (reward.Value is UObject o &&
                                o.GetExport <SoftObjectProperty>("ItemDefinition") is SoftObjectProperty itemDefinition &&
                                //!itemDefinition.Value.AssetPathName.String.StartsWith("/Game/Items/Tokens/") &&
                                o.GetExport <IntProperty>("Quantity") is IntProperty quantity)
                            {
                                BookXpSchedule[i].Add(new Reward(quantity, itemDefinition.Value));
                            }
                        }
                    }
                }
            }

            FolderName      = assetFolder;
            AdditionalSize += 100 * (BookXpSchedule.Count / 10);
        }
Пример #18
0
 public BaseBBDefinition(IUExport export, string exportType) : this(exportType)
 {
     if (export.GetExport <SoftObjectProperty>("IconTextureAssetData") is {} previewImage)
     {
         IconImage = Utils.GetSoftObjectTexture(previewImage);
     }