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))
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; } } } }
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); } } }
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); } }
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); } } }
public static bool TryDrawValorantIcon(string assetPath, IUExport export) { var d = new DirectoryInfo(assetPath); string assetName = d.Name; if (Text.TypeFaces.NeedReload(false)) { Text.TypeFaces = new Typefaces(); // when opening bundle creator settings without loading paks first } BaseUIData icon = new BaseUIData(export); if (icon.IconImage != null) { using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Premul)) using (var c = new SKCanvas(ret)) { icon.Draw(c); Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512 ImageBoxVm.imageBoxViewModel.Set(ret, assetName); } return(true); } return(false); }
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))
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; } }
PackageReader(BinaryReader uasset, BinaryReader uexp, Stream ubulk) { Loader = uasset; PackageFileSummary = new FPackageFileSummary(Loader); NameMap = SerializeNameMap(); ImportMap = SerializeImportMap(); ExportMap = SerializeExportMap(); DataExports = new IUExport[ExportMap.Length]; DataExportTypes = new FName[ExportMap.Length]; Loader = uexp; for (int i = 0; i < ExportMap.Length; i++) { FObjectExport Export = ExportMap[i]; { FName ExportType; if (Export.ClassIndex.IsNull) { ExportType = DataExportTypes[i] = ReadFName(); // check if this is true, I don't know if Fortnite ever uses this } else if (Export.ClassIndex.IsExport) { ExportType = DataExportTypes[i] = ExportMap[Export.ClassIndex.AsExport].SuperIndex.Resource.ObjectName; } else if (Export.ClassIndex.IsImport) { ExportType = DataExportTypes[i] = ImportMap[Export.ClassIndex.AsImport].ObjectName; } else { throw new FileLoadException("Can't get class name"); // Shouldn't reach this unless the laws of math have bent to MagmaReef's will } if (ExportType.String.Equals("BlueprintGeneratedClass")) { continue; } var pos = Position = Export.SerialOffset - PackageFileSummary.TotalHeaderSize; DataExports[i] = ExportType.String switch { "Texture2D" => new UTexture2D(this, ubulk, ExportMap.Sum(e => e.SerialSize) + PackageFileSummary.TotalHeaderSize), "CurveTable" => new UCurveTable(this), "DataTable" => new UDataTable(this), "FontFace" => new UFontFace(this, ubulk), "SoundWave" => new USoundWave(this, ubulk, ExportMap.Sum(e => e.SerialSize) + PackageFileSummary.TotalHeaderSize), "StringTable" => new UStringTable(this), _ => new UObject(this), }; #if DEBUG if (pos + Export.SerialSize != Position) { System.Diagnostics.Debug.WriteLine($"[ExportType={ExportType.String}] Didn't read {Export.ObjectName} correctly (at {Position}, should be {pos + Export.SerialSize}, {pos + Export.SerialSize - Position} behind)"); } #endif } } return; }
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; } }
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; }
PackageReader(BinaryReader uasset, BinaryReader uexp, Stream ubulk) { Loader = uasset; PackageFileSummary = new FPackageFileSummary(Loader); NameMap = SerializeNameMap(); ImportMap = SerializeImportMap(); ExportMap = SerializeExportMap(); Exports = new IUExport[ExportMap.Length]; ExportTypes = new string[ExportMap.Length]; Loader = uexp; for (int i = 0; i < ExportMap.Length; i++) { var Export = ExportMap[i]; // Serialize everything, not just specifically assets // if (Export.bIsAsset) { // We need to get the class name from the import/export maps FName ObjectClassName; if (Export.ClassIndex.IsNull) { ObjectClassName = ReadFName(); // check if this is true, I don't know if Fortnite ever uses this } else if (Export.ClassIndex.IsExport) { ObjectClassName = ExportMap[Export.ClassIndex.AsExport].ObjectName; } else if (Export.ClassIndex.IsImport) { ObjectClassName = ImportMap[Export.ClassIndex.AsImport].ObjectName; } else { throw new FileLoadException("Can't get class name"); // Shouldn't reach this unless the laws of math have bent to MagmaReef's will } var pos = Position = Export.SerialOffset - PackageFileSummary.TotalHeaderSize; ExportTypes[i] = ObjectClassName.String; Exports[i] = ObjectClassName.String switch { "Texture2D" => new UTexture2D(this, ubulk, ExportMap.Sum(e => e.SerialSize) + PackageFileSummary.TotalHeaderSize), "CurveTable" => new UCurveTable(this), "DataTable" => new UDataTable(this), "FontFace" => new UFontFace(this, ubulk), "SoundWave" => new USoundWave(this, ubulk, ExportMap.Sum(e => e.SerialSize) + PackageFileSummary.TotalHeaderSize), "StringTable" => new UStringTable(this), _ => new UObject(this), }; if (pos + Export.SerialSize != Position) { System.Diagnostics.Debug.WriteLine($"Didn't read {Export.ObjectName} ({ObjectClassName}) correctly (at {Position}, should be {pos + Export.SerialSize}, {pos + Export.SerialSize - Position} behind)"); } } } return; }
public static bool TryDrawValorantIcon(string assetPath, string exportType, IUExport export) { var d = new DirectoryInfo(assetPath); string assetName = d.Name; if (Text.TypeFaces.NeedReload(false)) { Text.TypeFaces = new Typefaces(); } switch (exportType) { case "MapUIData": { BaseMapUIData icon = new BaseMapUIData(export); using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Premul)) using (var c = new SKCanvas(ret)) { icon.Draw(c); ImageBoxVm.imageBoxViewModel.Set(ret, assetName); } return(true); } case "ArmorUIData": case "SprayUIData": case "ThemeUIData": case "ContractUIData": case "CurrencyUIData": case "GameModeUIData": case "CharacterUIData": case "SprayLevelUIData": case "EquippableUIData": case "PlayerCardUIData": case "Gun_UIData_Base_C": case "CharacterRoleUIData": case "EquippableSkinUIData": case "EquippableCharmUIData": case "EquippableSkinLevelUIData": case "EquippableSkinChromaUIData": case "EquippableCharmLevelUIData": { BaseUIData icon = new BaseUIData(export); using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Premul)) using (var c = new SKCanvas(ret)) { icon.Draw(c); Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512 ImageBoxVm.imageBoxViewModel.Set(ret, assetName); } return(true); } } return(false); }
public static T GetExport <T>(this IUExport export, params string[] names) { foreach (string name in names) { if (export != null && export.TryGetValue(name, out var obj) && obj is T) { return((T)obj); } } return(default);
/// <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); } }
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); } } } }
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))
private Dictionary <string, object> GetJsonDict(IUExport export) { if (export != null) { var ret = new Dictionary <string, object>(export.Count); foreach (KeyValuePair <string, object> KvP in export) { if (KvP.Value == null) { ret[KvP.Key] = null; } else { ret[KvP.Key] = KvP.Value.GetType().Name switch { "ByteProperty" => ((ByteProperty)KvP.Value).GetValue(), "BoolProperty" => ((BoolProperty)KvP.Value).GetValue(), "IntProperty" => ((IntProperty)KvP.Value).GetValue(), "FloatProperty" => ((FloatProperty)KvP.Value).GetValue(), "ObjectProperty" => ((ObjectProperty)KvP.Value).GetValue(), "NameProperty" => ((NameProperty)KvP.Value).GetValue(), "DoubleProperty" => ((DoubleProperty)KvP.Value).GetValue(), "ArrayProperty" => ((ArrayProperty)KvP.Value).GetValue(), "StructProperty" => ((StructProperty)KvP.Value).GetValue(), "StrProperty" => ((StrProperty)KvP.Value).GetValue(), "TextProperty" => ((TextProperty)KvP.Value).GetValue(), "InterfaceProperty" => ((InterfaceProperty)KvP.Value).GetValue(), "SoftObjectProperty" => ((SoftObjectProperty)KvP.Value).GetValue(), "UInt64Property" => ((UInt64Property)KvP.Value).GetValue(), "UInt32Property" => ((UInt32Property)KvP.Value).GetValue(), "UInt16Property" => ((UInt16Property)KvP.Value).GetValue(), "Int64Property" => ((Int64Property)KvP.Value).GetValue(), "Int16Property" => ((Int16Property)KvP.Value).GetValue(), "Int8Property" => ((Int8Property)KvP.Value).GetValue(), "MapProperty" => ((MapProperty)KvP.Value).GetValue(), "SetProperty" => ((SetProperty)KvP.Value).GetValue(), "EnumProperty" => ((EnumProperty)KvP.Value).GetValue(), "UObject" => ((UObject)KvP.Value).GetValue(), _ => KvP.Value, } }; } return(ret); } return(null); }
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); } }
public BaseIcon(IUExport export, string assetName, bool forceHR) : this() { if (export.GetExport <ObjectProperty>("Series") is { } series) { Serie.GetRarity(this, series); }
/// <summary> /// we draw based on the fist export type of the asset, no need to check others it's a waste of time /// i don't cache images because i don't wanna store a lot of SKCanvas in the memory /// </summary> /// <returns>true if an icon has been drawn</returns> public static bool TryDrawFortniteIcon(string assetPath, string exportType, IUExport export) { var d = new DirectoryInfo(assetPath); string assetName = d.Name; string assetFolder = d.Parent.Name; if (Text.TypeFaces.NeedReload(false)) { Text.TypeFaces = new Typefaces(); // when opening bundle creator settings without loading paks first } // please respect my wave if you wanna add a new exportType // Athena first, then Fort, thank you switch (exportType) { case "AthenaConsumableEmoteItemDefinition": case "AthenaSkyDiveContrailItemDefinition": case "AthenaLoadingScreenItemDefinition": case "AthenaVictoryPoseItemDefinition": case "AthenaPetCarrierItemDefinition": case "AthenaMusicPackItemDefinition": case "AthenaBattleBusItemDefinition": case "AthenaCharacterItemDefinition": case "AthenaBackpackItemDefinition": case "AthenaPickaxeItemDefinition": case "AthenaGadgetItemDefinition": case "AthenaGliderItemDefinition": case "AthenaDailyQuestDefinition": case "AthenaSprayItemDefinition": case "AthenaDanceItemDefinition": case "AthenaEmojiItemDefinition": case "AthenaItemWrapDefinition": case "AthenaToyItemDefinition": case "FortHeroType": case "FortTokenType": case "FortAbilityKit": case "FortWorkerType": case "FortBannerTokenType": case "FortVariantTokenType": case "FortFeatItemDefinition": case "FortStatItemDefinition": case "FortTrapItemDefinition": case "FortAmmoItemDefinition": case "FortQuestItemDefinition": case "FortBadgeItemDefinition": case "FortAwardItemDefinition": case "FortGadgetItemDefinition": case "FortPlaysetItemDefinition": case "FortGiftBoxItemDefinition": case "FortSpyTechItemDefinition": case "FortAccoladeItemDefinition": case "FortCardPackItemDefinition": case "FortDefenderItemDefinition": case "FortCurrencyItemDefinition": case "FortResourceItemDefinition": case "FortSchematicItemDefinition": case "FortIngredientItemDefinition": case "FortWeaponMeleeItemDefinition": case "FortContextTrapItemDefinition": case "FortPlayerPerksItemDefinition": case "FortPlaysetPropItemDefinition": case "FortHomebaseNodeItemDefinition": case "FortWeaponRangedItemDefinition": case "FortNeverPersistItemDefinition": case "FortPlaysetGrenadeItemDefinition": case "FortPersonalVehicleItemDefinition": case "FortHardcoreModifierItemDefinition": case "FortConsumableAccountItemDefinition": case "FortConversionControlItemDefinition": case "FortPersistentResourceItemDefinition": case "FortCampaignHeroLoadoutItemDefinition": case "FortConditionalResourceItemDefinition": case "FortChallengeBundleScheduleDefinition": case "FortWeaponMeleeDualWieldItemDefinition": case "FortDailyRewardScheduleTokenDefinition": { BaseIcon icon = new BaseIcon(export, exportType, ref assetName); int height = icon.Size + icon.AdditionalSize; using (var ret = new SKBitmap(icon.Size, height, SKColorType.Rgba8888, SKAlphaType.Premul)) using (var c = new SKCanvas(ret)) { if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground) { Rarity.DrawRarity(c, icon); } LargeSmallImage.DrawPreviewImage(c, icon); if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground) { if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoText) { Text.DrawBackground(c, icon); Text.DrawDisplayName(c, icon); Text.DrawDescription(c, icon); if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.Mini) { if (!icon.ShortDescription.Equals(icon.DisplayName) && !icon.ShortDescription.Equals(icon.Description)) { Text.DrawToBottom(c, icon, ETextSide.Left, icon.ShortDescription); } Text.DrawToBottom(c, icon, ETextSide.Right, icon.CosmeticSource); } } UserFacingFlag.DrawUserFacingFlags(c, icon); // has more things to show if (height > icon.Size) { Statistics.DrawStats(c, icon); } } Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512 ImageBoxVm.imageBoxViewModel.Set(ret, assetName); } return(true); } case "FortMtxOfferData": { BaseOffer icon = new BaseOffer(export); using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Premul)) using (var c = new SKCanvas(ret)) { if ((EIconDesign)Properties.Settings.Default.AssetsIconDesign != EIconDesign.NoBackground) { icon.DrawBackground(c); } icon.DrawImage(c); Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512 ImageBoxVm.imageBoxViewModel.Set(ret, assetName); } return(true); } case "FortItemSeriesDefinition": { BaseIcon icon = new BaseIcon(); using (var ret = new SKBitmap(icon.Size, icon.Size, SKColorType.Rgba8888, SKAlphaType.Opaque)) using (var c = new SKCanvas(ret)) { Serie.GetRarity(icon, export); Rarity.DrawRarity(c, icon); Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512 ImageBoxVm.imageBoxViewModel.Set(ret, assetName); } return(true); } case "PlaylistUserOptionEnum": case "PlaylistUserOptionBool": case "PlaylistUserOptionString": case "PlaylistUserOptionIntEnum": case "PlaylistUserOptionIntRange": case "PlaylistUserOptionColorEnum": case "PlaylistUserOptionFloatEnum": case "PlaylistUserOptionFloatRange": case "PlaylistUserOptionPrimaryAsset": case "PlaylistUserOptionCollisionProfileEnum": { BaseUserOption icon = new BaseUserOption(export); using (var ret = new SKBitmap(icon.Width, icon.Height, SKColorType.Rgba8888, SKAlphaType.Opaque)) using (var c = new SKCanvas(ret)) { icon.Draw(c); Watermark.DrawWatermark(c); // watermark should only be applied on icons with width = 512 ImageBoxVm.imageBoxViewModel.Set(ret, assetName); } return(true); } case "FortChallengeBundleItemDefinition": { BaseBundle icon = new BaseBundle(export, assetFolder); using (var ret = new SKBitmap(icon.Width, icon.HeaderHeight + icon.AdditionalSize, SKColorType.Rgba8888, SKAlphaType.Opaque)) using (var c = new SKCanvas(ret)) { HeaderStyle.DrawHeaderPaint(c, icon); HeaderStyle.DrawHeaderText(c, icon); QuestStyle.DrawQuests(c, icon); QuestStyle.DrawCompletionRewards(c, icon); ImageBoxVm.imageBoxViewModel.Set(ret, assetName); } return(true); } } return(false); }
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";
/// <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; }
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; }
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); }
public BaseBBDefinition(IUExport export, string exportType) : this(exportType) { if (export.GetExport <SoftObjectProperty>("IconTextureAssetData") is {} previewImage) { IconImage = Utils.GetSoftObjectTexture(previewImage); }