From 9774737e679898cfc3d03b276ab3533bd7a093fe Mon Sep 17 00:00:00 2001 From: GMatrixGames Date: Thu, 13 Jun 2024 13:35:22 -0400 Subject: [PATCH] Fix icons on //Fortnite/Release-30.10 --- FModel/Creator/Bases/FN/BaseIcon.cs | 12 ++++++++++-- FModel/Creator/Utils.cs | 16 +++++++++++++++- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/FModel/Creator/Bases/FN/BaseIcon.cs b/FModel/Creator/Bases/FN/BaseIcon.cs index 9c5f2d30..00eda4aa 100644 --- a/FModel/Creator/Bases/FN/BaseIcon.cs +++ b/FModel/Creator/Bases/FN/BaseIcon.cs @@ -24,21 +24,29 @@ public class BaseIcon : UCreator protected string ShortDescription { get; set; } protected string CosmeticSource { get; set; } protected Dictionary UserFacingFlags { get; set; } + private FInstancedStruct[] DataList { get; set; } public BaseIcon(UObject uObject, EIconStyle style) : base(uObject, style) { } public void ParseForReward(bool isUsingDisplayAsset) { + if (Object.TryGetValue(out FInstancedStruct[] dataList, "DataList")) + { + DataList = dataList; + GetSeries(DataList); + } + // rarity if (Object.TryGetValue(out FPackageIndex series, "Series")) GetSeries(series); - else if (Object.TryGetValue(out FInstancedStruct[] dataList, "DataList")) GetSeries(dataList); else if (Object.TryGetValue(out FStructFallback componentContainer, "ComponentContainer")) GetSeries(componentContainer); else GetRarity(Object.GetOrDefault("Rarity", EFortRarity.Uncommon)); // default is uncommon // preview if (isUsingDisplayAsset && Utils.TryGetDisplayAsset(Object, out var preview)) Preview = preview; - else if (Object.TryGetValue(out FPackageIndex itemDefinition, "HeroDefinition", "WeaponDefinition")) + else if (Preview == null) + Preview = Utils.GetBitmap(DataList); + else if (Preview == null && Object.TryGetValue(out FPackageIndex itemDefinition, "HeroDefinition", "WeaponDefinition")) Preview = Utils.GetBitmap(itemDefinition); else if (Object.TryGetValue(out FSoftObjectPath largePreview, "LargePreviewImage", "EntryListIcon", "SmallPreviewImage", "BundleImage", "ItemDisplayAsset", "LargeIcon", "ToastIcon", "SmallIcon")) Preview = Utils.GetBitmap(largePreview); diff --git a/FModel/Creator/Utils.cs b/FModel/Creator/Utils.cs index 57bc1213..071fc1b5 100644 --- a/FModel/Creator/Utils.cs +++ b/FModel/Creator/Utils.cs @@ -11,6 +11,7 @@ using CUE4Parse.UE4.Assets.Exports.Texture; using CUE4Parse.UE4.Objects.UObject; using CUE4Parse.UE4.Versions; using CUE4Parse_Conversion.Textures; +using CUE4Parse.UE4.Assets.Objects; using FModel.Framework; using FModel.Extensions; using FModel.Services; @@ -85,6 +86,19 @@ public static class Utils } } + public static SKBitmap GetBitmap(FInstancedStruct[] structs) + { + foreach (var struc in structs) + { + if (struc.NonConstStruct?.TryGetValue(out FSoftObjectPath icon, "LargeIcon", "Icon") == true && !icon.AssetPathName.IsNone) + { + return GetBitmap(icon); + } + } + + return null; + } + public static SKBitmap GetBitmap(UMaterialInstanceConstant material) { if (material == null) return null; @@ -400,4 +414,4 @@ public static class Utils return ret; } -} +} \ No newline at end of file