From f429e7c91143d090ebb1f8b100bdf93b90602908 Mon Sep 17 00:00:00 2001 From: shade Date: Fri, 29 Jul 2022 15:31:52 -0400 Subject: [PATCH] multiversus --- FModel/Creator/Bases/FN/BaseCommunity.cs | 2 +- FModel/Creator/Bases/FN/BaseIcon.cs | 2 +- .../Creator/Bases/MV/BaseMultiversusIcon.cs | 122 ++++++++++++++++++ FModel/Creator/Bases/UCreator.cs | 8 +- FModel/Creator/CreatorPackage.cs | 8 +- FModel/Creator/Typefaces.cs | 27 +++- FModel/Creator/Utils.cs | 3 +- FModel/Enums.cs | 8 +- FModel/FModel.csproj | 2 +- FModel/Settings/UserSettings.cs | 18 ++- 10 files changed, 182 insertions(+), 18 deletions(-) create mode 100644 FModel/Creator/Bases/MV/BaseMultiversusIcon.cs diff --git a/FModel/Creator/Bases/FN/BaseCommunity.cs b/FModel/Creator/Bases/FN/BaseCommunity.cs index 8daf66a4..1e0a7294 100644 --- a/FModel/Creator/Bases/FN/BaseCommunity.cs +++ b/FModel/Creator/Bases/FN/BaseCommunity.cs @@ -272,4 +272,4 @@ public class BaseCommunity : BaseIcon // draw } } -} \ No newline at end of file +} diff --git a/FModel/Creator/Bases/FN/BaseIcon.cs b/FModel/Creator/Bases/FN/BaseIcon.cs index dd00cb57..048e6a0e 100644 --- a/FModel/Creator/Bases/FN/BaseIcon.cs +++ b/FModel/Creator/Bases/FN/BaseIcon.cs @@ -281,4 +281,4 @@ public class BaseIcon : UCreator x += size; } } -} \ No newline at end of file +} diff --git a/FModel/Creator/Bases/MV/BaseMultiversusIcon.cs b/FModel/Creator/Bases/MV/BaseMultiversusIcon.cs new file mode 100644 index 00000000..a25c044b --- /dev/null +++ b/FModel/Creator/Bases/MV/BaseMultiversusIcon.cs @@ -0,0 +1,122 @@ +using CUE4Parse.UE4.Assets.Exports; +using CUE4Parse.UE4.Assets.Exports.Material; +using CUE4Parse.UE4.Objects.Core.i18N; +using CUE4Parse.UE4.Objects.Core.Math; +using CUE4Parse.UE4.Objects.UObject; +using FModel.Creator.Bases.FN; +using SkiaSharp; + +namespace FModel.Creator.Bases.MV; + +public class BaseMultiversusIcon : BaseIcon +{ + public BaseMultiversusIcon(UObject uObject, EIconStyle style) : base(uObject, style) + { + } + + public override void ParseForInfo() + { + if (Object.TryGetValue(out var backgroundColor, "BackgroundColor")) + { + var bgColor = SKColor.Parse(backgroundColor.Hex); + Background = new[] { bgColor, bgColor }; + } + else if (Object.TryGetValue(out var rarity, "Rarity")) + { + Background = GetRarityBackground(rarity.ToString()); + Border = new[] { GetRarityBorder(rarity.ToString()) }; + } + + if (Object.TryGetValue(out var nameColor, "DisplayNameColor")) + { + Border = new[] { SKColor.Parse(nameColor.Hex) }; + } + + if (Object.TryGetValue(out var rewardThumbnail, "RewardThumbnail")) + Preview = Utils.GetBitmap(rewardThumbnail); + + else if (Object.TryGetValue(out var portaitPtr, "CollectionsPortraitMaterial", "CharacterSelectPortraitMaterial") + && portaitPtr.TryLoad(out var portait)) + Preview = Utils.GetBitmap(portait); + + else if (Object.TryGetValue(out var skins, "Skins") && + skins[0].TryLoad(out var defaultSkin) && + defaultSkin.TryGetValue(out var skinRewardThumb, "RewardThumbnail")) + Preview = Utils.GetBitmap(skinRewardThumb); + + else if (Object.TryGetValue(out var eogPortrait, "EOGPortrait")) + Preview = Utils.GetBitmap(eogPortrait); + + if (Object.TryGetValue(out var displayName, "DisplayName")) + DisplayName = displayName.Text; + + if (Object.TryGetValue(out var description, "Overview", "Bio")) + Description = description.Text; + + if (Object.TryGetValue(out var property, "Property")) + ShortDescription = property.Text; + + if (Object.TryGetValue(out var unlockLocation, "UnlockLocation")) + CosmeticSource = unlockLocation.ToString().Split("::")[1]; + } + + private static SKColor[] GetRarityBackground(string rarity) + { + string rarityName = rarity.Split("::")[1]; + + switch (rarityName) // the colors here are the base color and brighter color that the game uses for rarities from the "Rarity to Color" blueprint function + { + case "Common": + return new[] + { + SKColor.Parse(new FLinearColor(0.068478f, 0.651406f, 0.016807f, 1.000000f).Hex), + SKColor.Parse(new FLinearColor(0.081422f, 1.000000f, 0.000000f, 1.000000f).Hex) + }; + case "Rare": + return new[] + { + SKColor.Parse(new FLinearColor(0.035911f, 0.394246f, 0.900000f, 1.000000f).Hex), + SKColor.Parse(new FLinearColor(0.033333f, 0.434207f, 1.000000f, 1.000000f).Hex) + }; + case "Epic": + return new[] + { + SKColor.Parse(new FLinearColor(0.530391f, 0.060502f, 0.900000f, 1.000000f).Hex), + SKColor.Parse(new FLinearColor(0.579907f, 0.045833f, 1.000000f, 1.000000f).Hex) + }; + case "Legendary": + return new[] + { + SKColor.Parse(new FLinearColor(1.000000f, 0.223228f, 0.002428f, 1.000000f).Hex), + SKColor.Parse(new FLinearColor(1.000000f, 0.479320f, 0.030713f, 1.000000f).Hex) + }; + case "None": + default: + return new[] + { + SKColor.Parse(new FLinearColor(0.194618f, 0.651406f, 0.630757f, 1.000000f).Hex), + SKColor.Parse(new FLinearColor(0.273627f, 0.955208f, 0.914839f, 1.000000f).Hex) + }; + } + } + + private static SKColor GetRarityBorder(string rarity) + { + string rarityName = rarity.Split("::")[1]; + + switch (rarityName) // the colors here are the desaturated versions of the rarity colors + { + case "Common": + return SKColor.Parse(new FLinearColor(0.172713f, 0.651406f, 0.130281f, 1.000000f).Hex); + case "Rare": + return SKColor.Parse(new FLinearColor(0.198220f, 0.527026f, 0.991102f, 1.000000f).Hex); + case "Epic": + return SKColor.Parse(new FLinearColor(0.642017f, 0.198220f, 0.991102f, 1.000000f).Hex); + case "Legendary": + return SKColor.Parse(new FLinearColor(1.000000f, 0.328434f, 0.200000f, 1.000000f).Hex); + case "None": + default: + return SKColor.Parse(new FLinearColor(0.308843f, 0.571125f, 0.557810f, 1.000000f).Hex); + } + } +} diff --git a/FModel/Creator/Bases/UCreator.cs b/FModel/Creator/Bases/UCreator.cs index d0577b37..7dbceba6 100644 --- a/FModel/Creator/Bases/UCreator.cs +++ b/FModel/Creator/Bases/UCreator.cs @@ -43,13 +43,13 @@ public abstract class UCreator protected readonly SKPaint DisplayNamePaint = new() { IsAntialias = true, FilterQuality = SKFilterQuality.High, - Typeface = Utils.Typefaces.DisplayName, TextSize = _NAME_TEXT_SIZE, + Typeface = Utils.Typefaces.DisplayName ?? Utils.Typefaces.Default, TextSize = _NAME_TEXT_SIZE, Color = SKColors.White, TextAlign = SKTextAlign.Center }; protected readonly SKPaint DescriptionPaint = new() { IsAntialias = true, FilterQuality = SKFilterQuality.High, - Typeface = Utils.Typefaces.Description, TextSize = 13, + Typeface = Utils.Typefaces.Description ?? Utils.Typefaces.Default, TextSize = 13, Color = SKColors.White }; protected readonly SKPaint ImagePaint = new() @@ -214,7 +214,7 @@ public abstract class UCreator switch (side) { case SKTextAlign.Left: - _shortDescriptionPaint.Typeface = Utils.Typefaces.Bottom ?? Utils.Typefaces.DisplayName; + _shortDescriptionPaint.Typeface = Utils.Typefaces.Bottom ?? Utils.Typefaces.DisplayName ?? Utils.Typefaces.Default; var shaper = new CustomSKShaper(_shortDescriptionPaint.Typeface); shaper.Shape(text, _shortDescriptionPaint); @@ -226,4 +226,4 @@ public abstract class UCreator break; } } -} \ No newline at end of file +} diff --git a/FModel/Creator/CreatorPackage.cs b/FModel/Creator/CreatorPackage.cs index 22a842e7..59067ed6 100644 --- a/FModel/Creator/CreatorPackage.cs +++ b/FModel/Creator/CreatorPackage.cs @@ -4,6 +4,7 @@ using CUE4Parse.UE4.Assets.Exports; using FModel.Creator.Bases; using FModel.Creator.Bases.BB; using FModel.Creator.Bases.FN; +using FModel.Creator.Bases.MV; using FModel.Creator.Bases.SB; namespace FModel.Creator; @@ -173,6 +174,11 @@ public class CreatorPackage : IDisposable case "PlaylistUserOptionCollisionProfileEnum": creator = new BaseUserControl(_object, _style); return true; + // Multiversus + case "CharacterData": + case "SkinData": + creator = new BaseMultiversusIcon(_object, _style); + return true; // Battle Breakers case "WExpGenericAccountItemDefinition": case "WExpGearAccountItemDefinition": @@ -248,4 +254,4 @@ public class CreatorPackage : IDisposable { _object = null; } -} \ No newline at end of file +} diff --git a/FModel/Creator/Typefaces.cs b/FModel/Creator/Typefaces.cs index 2b84b600..cdeb696e 100644 --- a/FModel/Creator/Typefaces.cs +++ b/FModel/Creator/Typefaces.cs @@ -1,4 +1,4 @@ -using System; +using System; using System.IO; using System.Windows; using CUE4Parse.UE4.Versions; @@ -41,6 +41,11 @@ public class Typefaces private const string _BURBANK_SMALL_BLACK = "burbanksmall-black"; private const string _BURBANK_SMALL_BOLD = "burbanksmall-bold"; + // Multiversus + private const string _MULTIVERSUS_BASE_PATH = "/Game/Panda_Main/UI/Fonts/"; + private const string _MONTSERRAT_BOLD = "Montserrat/Montserrat-Bold"; + private const string _VCCARDINAL_CONDENSED_BOLDITALIC_ITALIC = "VCCardinal/VCCardinalCondensed-BoldItalic"; + // Spellbreak private const string _SPELLBREAK_BASE_PATH = "/Game/UI/Fonts/"; private const string _MONTSERRAT_SEMIBOLD = "Montserrat-Semibold"; @@ -264,6 +269,24 @@ public class Typefaces } else Description = Default; + break; + } + case FGame.Multiversus: + { + if (viewModel.Provider.TrySaveAsset(_MULTIVERSUS_BASE_PATH + _VCCARDINAL_CONDENSED_BOLDITALIC_ITALIC + _EXT, out data)) + { + var m = new MemoryStream(data) { Position = 0 }; + DisplayName = SKTypeface.FromStream(m); + } + else DisplayName = Default; + + if (viewModel.Provider.TrySaveAsset(_MULTIVERSUS_BASE_PATH + _MONTSERRAT_BOLD + _EXT, out data)) + { + var m = new MemoryStream(data) { Position = 0 }; + Description = SKTypeface.FromStream(m); + } + else Description = Default; + break; } } @@ -275,4 +298,4 @@ public class Typefaces var m = new MemoryStream(data) { Position = 0 }; return SKTypeface.FromStream(m); } -} \ No newline at end of file +} diff --git a/FModel/Creator/Utils.cs b/FModel/Creator/Utils.cs index 96757c73..73c84c97 100644 --- a/FModel/Creator/Utils.cs +++ b/FModel/Creator/Utils.cs @@ -93,6 +93,7 @@ public static class Utils switch (textureParameter.ParameterInfo.Name.Text) { case "MainTex": + case "Texture": case "TextureA": case "TextureB": case "OfferImage": @@ -391,4 +392,4 @@ public static class Utils return ret; } -} \ No newline at end of file +} diff --git a/FModel/Enums.cs b/FModel/Enums.cs index 04fff3f1..d40cf8a8 100644 --- a/FModel/Enums.cs +++ b/FModel/Enums.cs @@ -1,4 +1,4 @@ -using System.ComponentModel; +using System.ComponentModel; namespace FModel; @@ -91,7 +91,9 @@ public enum FGame [Description("GTA: The Trilogy - Definitive Edition")] Gameface, [Description("Sea of Thieves")] - Athena + Athena, + [Description("Multiversus")] + Multiversus } public enum ELoadingMode @@ -138,4 +140,4 @@ public enum EIconStyle Cataba, // [Description("Community")] // CommunityMade -} \ No newline at end of file +} diff --git a/FModel/FModel.csproj b/FModel/FModel.csproj index d44cd668..5a2ca7dd 100644 --- a/FModel/FModel.csproj +++ b/FModel/FModel.csproj @@ -11,7 +11,7 @@ false true win-x64 - true + false true FModel.App diff --git a/FModel/Settings/UserSettings.cs b/FModel/Settings/UserSettings.cs index 3c1bda62..2d67c5eb 100644 --- a/FModel/Settings/UserSettings.cs +++ b/FModel/Settings/UserSettings.cs @@ -286,7 +286,8 @@ namespace FModel.Settings {FGame.TslGame, Constants._NO_PRESET_TRIGGER}, {FGame.PortalWars, Constants._NO_PRESET_TRIGGER}, {FGame.Gameface, Constants._NO_PRESET_TRIGGER}, - {FGame.Athena, Constants._NO_PRESET_TRIGGER} + {FGame.Athena, Constants._NO_PRESET_TRIGGER}, + {FGame.Multiversus, Constants._NO_PRESET_TRIGGER} }; public IDictionary Presets { @@ -314,7 +315,8 @@ namespace FModel.Settings {FGame.TslGame, EGame.GAME_PlayerUnknownsBattlegrounds}, {FGame.PortalWars, EGame.GAME_UE4_LATEST}, {FGame.Gameface, EGame.GAME_GTATheTrilogyDefinitiveEdition}, - {FGame.Athena, EGame.GAME_SeaOfThieves} + {FGame.Athena, EGame.GAME_SeaOfThieves}, + {FGame.Multiversus, EGame.GAME_UE4_LATEST} }; public IDictionary OverridedGame { @@ -342,7 +344,8 @@ namespace FModel.Settings {FGame.TslGame, null}, {FGame.PortalWars, null}, {FGame.Gameface, null}, - {FGame.Athena, null} + {FGame.Athena, null}, + {FGame.Multiversus, null} }; public IDictionary> OverridedCustomVersions { @@ -370,7 +373,8 @@ namespace FModel.Settings {FGame.TslGame, null}, {FGame.PortalWars, null}, {FGame.Gameface, null}, - {FGame.Athena, null} + {FGame.Athena, null}, + {FGame.Multiversus, null} }; public IDictionary> OverridedOptions { @@ -435,6 +439,12 @@ namespace FModel.Settings new("Strings", "g3/Content/Localization/") } }, + { + FGame.Multiversus, new List() + { + new("Characters", "MultiVersus/Content/Panda_Main/Characters/") + } + }, {FGame.StateOfDecay2, new List()}, {FGame.Prospect, new List()}, {FGame.Indiana, new List()},