diff --git a/LATEST.md b/LATEST.md index 7bc2602..5d2842d 100644 --- a/LATEST.md +++ b/LATEST.md @@ -1,2 +1 @@ -- Fixed for BTD6 v37.0 -- Fixed error message when selecting the Rare Quincy Action Figure \ No newline at end of file +- Fixed for BTD6 v38.1 \ No newline at end of file diff --git a/ModHelperData.cs b/ModHelperData.cs index 0de57a6..120c15c 100644 --- a/ModHelperData.cs +++ b/ModHelperData.cs @@ -3,7 +3,7 @@ namespace PathsPlusPlus; internal static class ModHelperData { public const string WorksOnVersion = "37.0"; - public const string Version = "1.0.1"; + public const string Version = "1.0.2"; public const string Name = "Paths++"; public const string Description = "A helper mod allowing additional upgrade paths to be made for towers.\n\n" + diff --git a/Patches/UiPatches.cs b/Patches/UiPatches.cs index 101aa49..4c13a73 100644 --- a/Patches/UiPatches.cs +++ b/Patches/UiPatches.cs @@ -297,4 +297,30 @@ private static void Postfix(Tower tower, int path, ref Il2CppReferenceArray +/// Fix v38.1 inlining of TowerSelectionMenu.IsUpgradePathClosed method +/// +[HarmonyPatch(typeof(UpgradeObject), nameof(UpgradeObject.UpdateVisuals))] +internal static class UpgradeObject_UpdateVisuals +{ + [HarmonyPrefix] + private static bool Prefix(UpgradeObject __instance, int path, bool upgradeClicked) + { + if (ModHelper.HasMod("UltimateCrosspathing")) return false; + + if (__instance.towerSelectionMenu.IsUpgradePathClosed(path)) + { + __instance.upgradeButton.SetUpgradeModel(null); + } + __instance.CheckLocked(); + var maxTier = __instance.CheckBlockedPath(); + var maxTierRestricted = __instance.CheckRestrictedPath(); + __instance.SetTier(__instance.tier, maxTier, maxTierRestricted); + __instance.currentUpgrade.UpdateVisuals(); + __instance.upgradeButton.UpdateVisuals(path, upgradeClicked); + + return false; + } } \ No newline at end of file