Exemplo n.º 1
0
        public static void GetGameplayTags(BaseIcon icon, StructProperty s, string exportType)
        {
            if (s.Value is FGameplayTagContainer g)
            {
                if (g.GameplayTags.TryGetGameplayTag("Cosmetics.Source.", out var source))
                {
                    icon.CosmeticSource = source.String.Substring("Cosmetics.Source.".Length);
                }
                else if (g.GameplayTags.TryGetGameplayTag("Athena.ItemAction.", out var action))
                {
                    icon.CosmeticSource = action.String.Substring("Athena.ItemAction.".Length);
                }

                if (g.GameplayTags.TryGetGameplayTag("Cosmetics.Set.", out var set))
                {
                    icon.Description += GetCosmeticSet(set.String);
                }
                if (g.GameplayTags.TryGetGameplayTag("Cosmetics.Filter.Season.", out var season))
                {
                    icon.Description += GetCosmeticSeason(season.String);
                }

                UserFacingFlag.GetUserFacingFlags(
                    g.GameplayTags.GetAllGameplayTag("Cosmetics.UserFacingFlags.", "Homebase.Class.", "NPC.CharacterType.Survivor.Defender."),
                    icon, exportType);
            }
        }
Exemplo n.º 2
0
        public static bool GetDisplayAssetImage(BaseIcon icon, SoftObjectProperty o, string assetName)
        {
            string imageType = "DetailsImage";

            switch ("DA_Featured_" + assetName)
            {
            case "DA_Featured_Glider_ID_141_AshtonBoardwalk.uasset":
            case "DA_Featured_Glider_ID_150_TechOpsBlue.uasset":
            case "DA_Featured_Glider_ID_131_SpeedyMidnight.uasset":
            case "DA_Featured_Pickaxe_ID_178_SpeedyMidnight.uasset":
            case "DA_Featured_Glider_ID_015_Brite.uasset":
            case "DA_Featured_Glider_ID_016_Tactical.uasset":
            case "DA_Featured_Glider_ID_017_Assassin.uasset":
            case "DA_Featured_Pickaxe_ID_027_Scavenger.uasset":
            case "DA_Featured_Pickaxe_ID_028_Space.uasset":
            case "DA_Featured_Pickaxe_ID_029_Assassin.uasset":
                return(false);

            case "DA_Featured_Glider_ID_070_DarkViking.uasset":
            case "DA_Featured_CID_319_Athena_Commando_F_Nautilus.uasset":
                imageType = "TileImage";
                break;
            }

            string path = o?.Value.AssetPathName.String;

            if (string.IsNullOrEmpty(path))
            {
                path = "/Game/Catalog/DisplayAssets/DA_Featured_" + assetName.Substring(0, assetName.LastIndexOf("."));
            }

            PakPackage p = Utils.GetPropertyPakPackage(path);

            if (p.HasExport() && !p.Equals(default))
Exemplo n.º 3
0
 public static void GetPreviewImage(BaseIcon icon, StructProperty u)
 {
     if (u.Value is UObject o && o.TryGetValue("ResourceObject", out var v) && v is ObjectProperty resourceObject)
     {
         icon.IconImage = Utils.GetObjectTexture(resourceObject);
     }
 }
Exemplo n.º 4
0
        public void GenerateEntries(StorefrontEntry[] entries, ref Dictionary <StorefrontEntry, BitmapData> entr)
        {
            foreach (var entry in entries)
            {
                var item = entry.Items[0];

                if (IsInCache(entry.CacheId))
                {
                    entr.Add(entry, DataFromCache(entry.CacheId));
                    continue;
                }

                using (var icon = new BaseIcon
                {
                    DisplayName = entry.IsBundle ? entry.Bundle.Name.ToLowerAndUpper() : item.Name,
                    ShortDescription = (entry.IsBundle ? entry.Bundle.Info : item.Type.DisplayValue).ToUpper(),
                    Banner = entry.HasBanner ? entry.Banner.Value.ToUpper() : "",
                    Price = entry.FinalPrice,
                    IconImage = GetBitmapFromUrl(entry.IsBundle ? entry.Bundle.Image : item.Images.Featured ?? item.Images.Icon ?? item.Images.SmallIcon, $"{item.Id}{(entry.IsBundle ? "_Bundle" : "")}"),
                    RarityBackgroundImage = item.HasSeries && item.Series.Image != null ? GetBitmapFromUrl(item.Series.Image, item.Series.BackendValue) : null,
                    Width = EntryWidth,
                    Height = EntryHeight
                })
                {
                    ChicRarity.GetRarityColors(icon, item.Rarity.BackendValue);

                    entr.Add(entry, SaveToCache(ChicIcon.GenerateIcon(icon), entry.CacheId));
                }
            }
        }
Exemplo n.º 5
0
        public SKBitmap DrawEntry(ShopEntry entry)
        {
            if (IsInCache(entry.CacheId))
            {
                return(LoadFromCache(entry.CacheId));
            }

            var item = entry.Items[0];

            using (var icon = new BaseIcon
            {
                DisplayName = entry.IsBundle ? entry.Bundle.Name.ToLowerAndUpper() : item.Name,
                ShortDescription = "",//(entry.IsBundle ? entry.Bundle.Info : ""/*item.Type.DisplayValue*/).ToUpper(),
                BundleInfo = entry.IsBundle ? entry.Bundle.Info.ToUpper() : "",
                Banner = entry.HasBanner ? entry.Banner.Value.ToUpper() : "",
                Price = entry.FinalPrice,
                IconImage = GetBitmapFromUrl(entry.IsBundle ? entry.Bundle.Image : item.Image, $"{item.Id}{(entry.IsBundle ? "_Bundle" : "")}"),
                RarityBackgroundImage = item.HasSeries && item.Series.Image != null ? GetBitmapFromUrl(item.Series.Image, item.Series.BackendValue) : null,
                Width = EntryWidth,
                Height = EntryHeight
            })
            {
                ChicRarity.GetRarityColors(icon, item.Rarity.BackendValue);
                var bmp = ChicIcon.GenerateIcon(icon);
                SaveToCache(bmp, entry.CacheId, false);
                return(bmp);
            }
        }
Exemplo n.º 6
0
        public static bool GetDisplayAssetImage(BaseIcon icon, IUExport o, ref string assetName)
        {
            string path          = string.Empty;
            bool   displayExists = true;

            if (o.TryGetValue("DisplayAssetPath", out var d) && d is StructProperty da && da.Value is FSoftObjectPath daOut)
            {
                path = daOut.AssetPathName.String;
            }
Exemplo n.º 7
0
 public Reward()
 {
     RewardQuantity    = 0;
     RewardIcon        = null;
     TheReward         = null;
     RewardFillColor   = "";
     RewardBorderColor = "";
     IsCountShifted    = false;
 }
Exemplo n.º 8
0
        public static void GetPreviewImage(BaseIcon icon, ObjectProperty o, string assetName, bool hightRes)
        {
            string path = o.Value.Resource.OuterIndex.Resource.ObjectName.String;

            if (path.Equals("/Game/Athena/Items/Weapons/WID_Harvest_Pickaxe_STWCosmetic_Tier"))
            {
                path += "_" + assetName.Substring(assetName.LastIndexOf(".") - 1, 1);
            }

            PakPackage p = Utils.GetPropertyPakPackage(path);

            if (p.HasExport() && !p.Equals(default))
Exemplo n.º 9
0
        public static bool GetDisplayAssetImage(BaseIcon icon, SoftObjectProperty o, ref string assetName)
        {
            string imageType = "DetailsImage";

            switch ("DA_Featured_" + assetName)
            {
            case "DA_Featured_Glider_ID_141_AshtonBoardwalk.uasset":
            case "DA_Featured_Glider_ID_150_TechOpsBlue.uasset":
            case "DA_Featured_Glider_ID_131_SpeedyMidnight.uasset":
            case "DA_Featured_Pickaxe_ID_178_SpeedyMidnight.uasset":
            case "DA_Featured_Glider_ID_015_Brite.uasset":
            case "DA_Featured_Glider_ID_016_Tactical.uasset":
            case "DA_Featured_Glider_ID_017_Assassin.uasset":
            case "DA_Featured_Pickaxe_ID_027_Scavenger.uasset":
            case "DA_Featured_Pickaxe_ID_028_Space.uasset":
            case "DA_Featured_Pickaxe_ID_029_Assassin.uasset":
                return(false);

            case "DA_Featured_Glider_ID_070_DarkViking.uasset":
            case "DA_Featured_CID_319_Athena_Commando_F_Nautilus.uasset":
                imageType = "TileImage";
                break;
            }

            string path = o?.Value.AssetPathName.String;

            if (string.IsNullOrEmpty(path))
            {
                path = "/Game/Catalog/DisplayAssets/DA_Featured_" + assetName.Substring(0, assetName.LastIndexOf("."));
            }

            Package p = Utils.GetPropertyPakPackage(path);

            if (p != null && p.HasExport())
            {
                var obj = p.GetExport <UObject>();
                if (obj != null)
                {
                    if (obj.TryGetValue(imageType, out var v1) && v1 is StructProperty s && s.Value is UObject type &&
                        type.TryGetValue("ResourceObject", out var v2) && v2 is ObjectProperty resourceObject)
                    {
                        if (resourceObject.Value.Resource.OuterIndex.Resource != null && !resourceObject.Value.Resource.OuterIndex.Resource.ObjectName.String.Contains("/Game/Athena/Prototype/Textures/"))
                        {
                            icon.IconImage = Utils.GetObjectTexture(resourceObject);
                            assetName      = "DA_Featured_" + assetName;
                            return(true);
                        }
                    }
                }
            }
            return(false);
        }
Exemplo n.º 10
0
        public IActionResult DrawCosmetic(string cosmeticId, [FromQuery] bool cache = true)
        {
            try
            {
                if (string.IsNullOrEmpty(cosmeticId))
                {
                    return(BadRequest("{\"error\": \"emptyId\", \"message\": \"The id is empty dummy\"}"));
                }
                if (cache && Program.IsInCache(cosmeticId + ".png"))
                {
                    return(File(IOFile.ReadAllBytes($"{Program.Root}Cache/{cosmeticId}.png"), "image/png"));
                }

                var cosmetic = Program.FortniteApi.V2.Cosmetics.GetBr(cosmeticId).Data;
                if (cosmetic == null)
                {
                    throw new Exception($"cosmetic ({cosmeticId}) is null sadge");
                }

                using (var icon = new BaseIcon
                {
                    DisplayName = cosmetic.Name,
                    Description = cosmetic.Description,
                    ShortDescription = cosmetic.Type.DisplayValue,
                    //CosmeticSource = cosmetic.HasGameplayTags ? cosmetic.GameplayTags.Any(x => x.StartsWith("Cosmetics.Source.")) ? cosmetic.GameplayTags.First(x => x.StartsWith("Cosmetics.Source.")).Replace("Cosmetics.Source.", "") : "" : "",
                })
                {
                    icon.IconImage             = Program.BitmapFromUrl(cosmetic.Images.HasFeatured ? cosmetic.Images.Featured : cosmetic.Images.HasIcon ? cosmetic.Images.Icon : cosmetic.Images.HasSmallIcon ? cosmetic.Images.SmallIcon : null, "icon_" + cosmeticId);
                    icon.RarityBackgroundImage = cosmetic.HasSeries ? Program.BitmapFromUrl(cosmetic.Series.Image, cosmetic.Series.Value) : null;
                    ChicRarity.GetRarityColors(icon, cosmetic.Rarity.BackendValue);
                    Program.SaveToCache(ChicIcon.DrawIcon(icon), cosmeticId);
                }

                return(File(IOFile.ReadAllBytes($"{Program.Root}Cache/{cosmeticId}.png"), "image/png"));
            }
            catch (Exception e)
            {
                return(BadRequest(e));
            }
        }
Exemplo n.º 11
0
        public static bool GetDisplayAssetImage(BaseIcon icon, SoftObjectProperty o, ref string assetName)
        {
            string path = o?.Value.AssetPathName.String;

            if (string.IsNullOrEmpty(path))
            {
                path = "/Game/Catalog/MI_OfferImages/MI_" + assetName.Substring(0, assetName.LastIndexOf(".")).Replace("Athena_Commando_", "");
            }

            Package p = Utils.GetPropertyPakPackage(path);

            if (p != null && p.HasExport())
            {
                var obj = p.GetExport <UObject>();
                if (obj != null)
                {
                    if (obj.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("OfferImage") || name.Value.String.Equals("Texture"))
                                {
                                    icon.IconImage = Utils.GetObjectTexture(value);
                                    assetName      = "MI_" + assetName;
                                    return(true);
                                }
                            }
                        }
                    }
                }
            }
            return(false);
        }
Exemplo n.º 12
0
        public static void GetRarity(BaseIcon icon, ObjectProperty o)
        {
            PakPackage p = Utils.GetPropertyPakPackage(o.Value.Resource.OuterIndex.Resource.ObjectName.String);

            if (p.HasExport() && !p.Equals(default))
Exemplo n.º 13
0
        public static void GetAmmoData(BaseIcon icon, SoftObjectProperty ammoData)
        {
            PakPackage p = Utils.GetPropertyPakPackage(ammoData.Value.AssetPathName.String);

            if (p.HasExport() && !p.Equals(default))
Exemplo n.º 14
0
 public static void GetAmmoData(BaseIcon icon, SoftObjectProperty ammoData)
 {
     if (!ammoData.Value.AssetPathName.String.StartsWith("/Game/Athena/Items/Consumables/"))
     {
         PakPackage p = Utils.GetPropertyPakPackage(ammoData.Value.AssetPathName.String);
         if (p.HasExport() && !p.Equals(default))
Exemplo n.º 15
0
        public static void GetInGameRarity(BaseIcon icon, EnumProperty e)
        {
            PakPackage p = Utils.GetPropertyPakPackage("/Game/Balance/RarityData");

            if (p.HasExport() && !p.Equals(default))
Exemplo n.º 16
0
 public static void GetPreviewImage(BaseIcon icon, ObjectProperty o, string assetName) => GetPreviewImage(icon, o, assetName, true);
Exemplo n.º 17
0
 public static void DrawCenteredMultilineText(SKCanvas canvas, string text, int maxLineCount, BaseIcon icon, ETextSide side, SKRect area, SKPaint paint)
 => DrawCenteredMultilineText(canvas, text, maxLineCount, icon.Size, icon.Margin, side, area, paint);
Exemplo n.º 18
0
        public static void GetInGameRarity(BaseIcon icon, EnumProperty e)
        {
            Package p = Utils.GetPropertyPakPackage("/Game/Balance/RarityData");

            if (p != null && p.HasExport())
            {
                var d = p.GetExport <UObject>();
                if (d != null)
                {
                    EFortRarity rarity = EFortRarity.Uncommon;
                    switch (e?.Value.String)
                    {
                    case "EFortRarity::Common":
                    case "EFortRarity::Handmade":
                        rarity = EFortRarity.Common;
                        break;

                    case "EFortRarity::Rare":
                    case "EFortRarity::Sturdy":
                        rarity = EFortRarity.Rare;
                        break;

                    case "EFortRarity::Epic":
                    case "EFortRarity::Quality":
                        rarity = EFortRarity.Epic;
                        break;

                    case "EFortRarity::Legendary":
                    case "EFortRarity::Fine":
                        rarity = EFortRarity.Legendary;
                        break;

                    case "EFortRarity::Mythic":
                    case "EFortRarity::Elegant":
                        rarity = EFortRarity.Mythic;
                        break;

                    case "EFortRarity::Transcendent":
                    case "EFortRarity::Masterwork":
                        rarity = EFortRarity.Transcendent;
                        break;

                    case "EFortRarity::Unattainable":
                    case "EFortRarity::Badass":
                        rarity = EFortRarity.Unattainable;
                        break;
                    }

                    if (d.Values.ElementAt((int)rarity) is StructProperty s && s.Value is UObject colors)
                    {
                        if (colors.TryGetValue("Color1", out var c1) && c1 is StructProperty s1 && s1.Value is FLinearColor color1 &&
                            colors.TryGetValue("Color2", out var c2) && c2 is StructProperty s2 && s2.Value is FLinearColor color2 &&
                            colors.TryGetValue("Color3", out var c3) && c3 is StructProperty s3 && s3.Value is FLinearColor color3)
                        {
                            icon.RarityBackgroundColors = new SKColor[2] {
                                SKColor.Parse(color1.Hex), SKColor.Parse(color3.Hex)
                            };
                            icon.RarityBorderColor = new SKColor[2] {
                                SKColor.Parse(color2.Hex), SKColor.Parse(color1.Hex)
                            };
                        }
                    }
                }
            }
            else
            {
                GetHardCodedRarity(icon, e);
            }
        }
Exemplo n.º 19
0
 public static void GetUserFacingFlags(List <string> uffs, BaseIcon icon, string exportType)
 {
     if (uffs.Count > 0)
     {
         PakPackage p = Utils.GetPropertyPakPackage("/Game/Items/ItemCategories"); //PrimaryCategories - SecondaryCategories - TertiaryCategories
         if (p.HasExport() && !p.Equals(default))