From 1b6cb54248f171f9a558dbde5d0bc5861a259647 Mon Sep 17 00:00:00 2001 From: MaikyM <51415805+MaikyM@users.noreply.github.com> Date: Thu, 6 Feb 2020 11:22:47 -0600 Subject: [PATCH] Implemented GetChallengeStageContinuation. - A more logical way for the challenge stages. - Fixed QuestBundle_Event_Sourdropper stages. --- .../ChallengeID/ChallengeBundleInfos.cs | 31 +++++++------------ 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/FModel/Methods/Assets/IconCreator/ChallengeID/ChallengeBundleInfos.cs b/FModel/Methods/Assets/IconCreator/ChallengeID/ChallengeBundleInfos.cs index 1a63ee3d..2c23e0b5 100644 --- a/FModel/Methods/Assets/IconCreator/ChallengeID/ChallengeBundleInfos.cs +++ b/FModel/Methods/Assets/IconCreator/ChallengeID/ChallengeBundleInfos.cs @@ -271,25 +271,7 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID JToken primaryAssetNameToken = token["struct_type"]["properties"][0]["tag_data"]["struct_type"]["properties"][1]["tag_data"]; if (primaryAssetNameToken != null) { - string primaryAssetName = primaryAssetNameToken.Value(); - - // Manual fix: QuestBundle_Event_Galileo Stages - if (assetPath.StartsWith("/FortniteGame/Content/Athena/Items/Quests/BattlePass/Season11/Galileo/")) - { - JArray objectivesGalileoArray = AssetsUtility.GetPropertyTagText(AssetProperties, "Objectives", "data"); - if (objectivesGalileoArray != null) - { - JToken questGalileoToken = objectivesGalileoArray[0]["struct_type"]["properties"][0]["tag_data"]; - if (questGalileoToken != null) - { - if (!string.Equals(primaryAssetName, questGalileoToken.Value())) - { - int questGalileoStageId = int.Parse(questGalileoToken.Value().Substring(questGalileoToken.Value().Length - 1, 1)) + 1; - primaryAssetName = questGalileoToken.Value().Remove(questGalileoToken.Value().Length - 1).Replace("questobj", "quest").Replace("_npc_or_player", "") + "_" + questGalileoStageId; - } - } - } - } + string primaryAssetName = GetChallengeStageContinuation(assetPath, primaryAssetNameToken.Value(), AssetProperties); //this will catch the full path if asset exists to be able to grab his PakReader and List string primaryAssetNameFullPath = AssetEntries.AssetEntriesDict.Where(x => x.Key.ToLowerInvariant().Contains("/" + primaryAssetName.ToLowerInvariant())).Select(d => d.Key).FirstOrDefault(); @@ -310,5 +292,16 @@ namespace FModel.Methods.Assets.IconCreator.ChallengeID } } } + + static string GetChallengeStageContinuation(string assetPath, string assetName, JArray AssetProperties) + { + string assetPathTemp = System.IO.Path.GetFileNameWithoutExtension(assetPath); + string assetPathTempN = assetPathTemp.Substring(assetPathTemp.LastIndexOf("_") + 1); + string assetNameTemp = assetName.Substring(assetName.LastIndexOf("_") + 1); + if (int.TryParse(assetPathTempN, out int assetNumber) && !int.TryParse(assetNameTemp, out _) && assetPathTemp.StartsWith(assetName)) + assetName += $"_{assetNumber + 1}"; + + return assetName; + } } }