reverted 648f0fa933 because it was filename sensitive and not needed anymore, might be back later with an universal way + fixed rgb/rgba to hex color conversion

This commit is contained in:
Asval 2019-11-20 18:52:00 +01:00
parent 648f0fa933
commit d1c24e98af
4 changed files with 15 additions and 29 deletions

View File

@ -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<string>(), "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<string>(), "Quest") &&
!string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value<string>(), "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<string>(), "Quest") &&
!string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value<string>(), "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<string>(), "Quest") &&
!string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value<string>(), "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<string>(), "Quest") &&
!string.Equals(x["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][0]["tag_data"].Value<string>(), "Token"))
.FirstOrDefault()["struct_type"]["properties"][1]["tag_data"];
}
if (targetChecker != null)
{
@ -273,4 +259,4 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID
}
}
}
}
}

View File

@ -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)
{

View File

@ -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)
{

View File

@ -19,7 +19,7 @@
</a>
<a href="https://twitter.com/AsvalFN"><img src="https://img.shields.io/badge/Twitter-@AsvalFN-1da1f2.svg?logo=twitter"></a>
<a href="https://discord.gg/fdkNYYQ">
<img src="https://img.shields.io/badge/Discord-Need%20Help%3F-778cd4.svg?logo=discord">
<img src="https://img.shields.io/discord/637265123144237061.svg?label=Discord&logo=discord&color=778cd4">
</a>
<a href="https://www.paypal.me/FModel">
<img src="https://img.shields.io/badge/Paypal-Donate-00457C.svg?logo=paypal">