From d1c24e98af9e8f1eedce3dd7517d7cca97e1bded Mon Sep 17 00:00:00 2001 From: Asval Date: Wed, 20 Nov 2019 18:52:00 +0100 Subject: [PATCH] reverted 648f0fa93302a3416a144976601de2637b744dcd because it was filename sensitive and not needed anymore, might be back later with an universal way + fixed rgb/rgba to hex color conversion --- .../ChallengeID/ChallengeBundleInfos.cs | 36 ++++++------------- .../UScript/UScriptStruct/FColor.cs | 2 +- .../UScript/UScriptStruct/FLinearColor.cs | 4 +-- README.md | 2 +- 4 files changed, 15 insertions(+), 29 deletions(-) diff --git a/FModel/Methods/Assets/IconCreator/ChallengeID/ChallengeBundleInfos.cs b/FModel/Methods/Assets/IconCreator/ChallengeID/ChallengeBundleInfos.cs index cae3944b..41d03b96 100644 --- a/FModel/Methods/Assets/IconCreator/ChallengeID/ChallengeBundleInfos.cs +++ b/FModel/Methods/Assets/IconCreator/ChallengeID/ChallengeBundleInfos.cs @@ -138,33 +138,19 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID { try { - JToken targetChecker = null; - JToken targetQuantity = null; - - // It's individual, other challenges with tokens must be displayed? - // It's checked if it remains a token because it can change in the future - bool isToken = rewardsDataArray.Where(x => string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value(), "Token")).Any(); - if (string.Equals(System.IO.Path.GetFileName(assetPath), "Quest_S11_AlterEgo_08") && isToken) - { - targetChecker = rewardsDataArray.FirstOrDefault()["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][1]["tag_data"]; - targetQuantity = rewardsDataArray.FirstOrDefault()["struct_type"]["properties"][1]["tag_data"]; - } - else - { - //checking the whole array for the reward - //ignoring all Quest and Token until he find the reward - targetChecker = rewardsDataArray.Where(x => - !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value(), "Quest") && - !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value(), "Token")) + //checking the whole array for the reward + //ignoring all Quest and Token until he find the reward + JToken targetChecker = rewardsDataArray.Where(x => + !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value(), "Quest") && + !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value(), "Token")) .FirstOrDefault()["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][1]["tag_data"]; - //checking the whole array for the reward quantity - //ignoring all Quest and Token until he find the reward quantity - targetQuantity = rewardsDataArray.Where(x => - !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value(), "Quest") && - !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value(), "Token")) + //checking the whole array for the reward quantity + //ignoring all Quest and Token until he find the reward quantity + JToken targetQuantity = rewardsDataArray.Where(x => + !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value(), "Quest") && + !string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value(), "Token")) .FirstOrDefault()["struct_type"]["properties"][1]["tag_data"]; - } if (targetChecker != null) { @@ -273,4 +259,4 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID } } } -} +} \ No newline at end of file diff --git a/FModel/Methods/PakReader/ExportObject/UScript/UScriptStruct/FColor.cs b/FModel/Methods/PakReader/ExportObject/UScript/UScriptStruct/FColor.cs index 87ab4cf4..395688de 100644 --- a/FModel/Methods/PakReader/ExportObject/UScript/UScriptStruct/FColor.cs +++ b/FModel/Methods/PakReader/ExportObject/UScript/UScriptStruct/FColor.cs @@ -14,7 +14,7 @@ namespace PakReader [JsonProperty] public string Hex => a == 0 || a == 255 ? ToHex(r, g, b) : - ToHex(r, g, b, a); + ToHex(a, r, g, b); internal FColor(BinaryReader reader) { diff --git a/FModel/Methods/PakReader/ExportObject/UScript/UScriptStruct/FLinearColor.cs b/FModel/Methods/PakReader/ExportObject/UScript/UScriptStruct/FLinearColor.cs index 89b1301f..76f78f75 100644 --- a/FModel/Methods/PakReader/ExportObject/UScript/UScriptStruct/FLinearColor.cs +++ b/FModel/Methods/PakReader/ExportObject/UScript/UScriptStruct/FLinearColor.cs @@ -14,8 +14,8 @@ namespace PakReader [JsonProperty] public string Hex => a == 1 || a == 0 ? - ToHex((byte)Math.Round(r * 256), (byte)Math.Round(g * 256), (byte)Math.Round(b * 256)) : - ToHex((byte)Math.Round(r * 256), (byte)Math.Round(g * 256), (byte)Math.Round(b * 256), (byte)Math.Round(a * 256)); + ToHex((byte)Math.Round(r * 255), (byte)Math.Round(g * 255), (byte)Math.Round(b * 255)) : + ToHex((byte)Math.Round(a * 255), (byte)Math.Round(r * 255), (byte)Math.Round(g * 255), (byte)Math.Round(b * 255)); internal FLinearColor(BinaryReader reader) { diff --git a/README.md b/README.md index e44f6aa7..d45323c6 100644 --- a/README.md +++ b/README.md @@ -19,7 +19,7 @@ - +