Skip to content

Commit

Permalink
Fixes for 38.1
Browse files Browse the repository at this point in the history
  • Loading branch information
mend-dev committed Jul 28, 2023
1 parent 0aaab93 commit 516d78e
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
4 changes: 2 additions & 2 deletions ModHelperData.cs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
namespace BTD6Rogue;

public static class ModHelperData {
public const string WorksOnVersion = "37.0";
public const string Version = "1.5.0";
public const string WorksOnVersion = "38.1";
public const string Version = "1.5.1";

public const string Name = "BTD6Rogue";
public const string Description =
Expand Down
20 changes: 20 additions & 0 deletions Patches/UpgradePathPatch.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using HarmonyLib;
using Il2CppAssets.Scripts.Unity.UI_New.InGame;
using Il2CppAssets.Scripts.Simulation.Towers;
using BTD_Mod_Helper;

namespace BTD6Rogue;

Expand All @@ -23,4 +24,23 @@ private static void Postfix(TowerSelectionMenu __instance, int path, ref bool __
if (tower.GetUpgrade(path) != null && tower.GetUpgrade(path).tier >= BTD6Rogue.mod.rogueTowers[tower.towerModel.baseId].limitPaths[2]) { __result = true; } else if (tower.GetUpgrade(path) != null) { __result = false; }
}
}
}

// thanks doombubbles for the code :thumbs_up:
[HarmonyPatch(typeof(UpgradeObject), nameof(UpgradeObject.UpdateVisuals))]
internal static class UpgradeObject_UpdateVisuals {
[HarmonyPrefix]
private static bool Prefix(UpgradeObject __instance, int path, bool upgradeClicked) {
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;
}
}

0 comments on commit 516d78e

Please sign in to comment.