using System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.Versioning; using BTD_Mod_Helper; using BTD_Mod_Helper.Api; using BTD_Mod_Helper.Api.Components; using BTD_Mod_Helper.Api.Enums; using BTD_Mod_Helper.Api.ModOptions; using BTD_Mod_Helper.Extensions; using FrontierRemix; using HarmonyLib; using Il2Cpp; using Il2CppAssets.Scripts.Data.Legends; using Il2CppAssets.Scripts.Unity; using Il2CppAssets.Scripts.Unity.Bridge; using Il2CppAssets.Scripts.Unity.Menu; using Il2CppAssets.Scripts.Unity.UI_New.InGame; using Il2CppAssets.Scripts.Unity.UI_New.Legends; using Il2CppAssets.Scripts.Unity.UI_New.Popups; using Il2CppInterop.Runtime.InteropTypes; using Il2CppNinjaKiwi.Common.ResourceUtils; using Il2CppSystem; using Il2CppSystem.Collections.Generic; using Il2CppSystem.Threading.Tasks; using MelonLoader; using Microsoft.CodeAnalysis; using UnityEngine; using UnityEngine.EventSystems; using UnityEngine.Events; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)] [assembly: MelonInfo(typeof(FrontierRemixMod), "Frontier Remix", "1.0.3", "doombubbles", null)] [assembly: MelonGame("Ninja Kiwi", "BloonsTD6")] [assembly: MelonGame("Ninja Kiwi", "BloonsTD6-Epic")] [assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")] [assembly: AssemblyCompany("FrontierRemix")] [assembly: AssemblyConfiguration("Release")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: AssemblyInformationalVersion("1.0.0+c1065281d24e36c89673570cb91899ef768fd5f3")] [assembly: AssemblyProduct("FrontierRemix")] [assembly: AssemblyTitle("FrontierRemix")] [assembly: AssemblyVersion("1.0.0.0")] [module: RefSafetyRules(11)] [CompilerGenerated] internal sealed class <>z__ReadOnlyArray : IEnumerable, ICollection, IList, IEnumerable, IReadOnlyCollection, IReadOnlyList, ICollection, IList { int ICollection.Count => _items.Length; bool ICollection.IsSynchronized => false; object ICollection.SyncRoot => this; object? IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } bool IList.IsFixedSize => true; bool IList.IsReadOnly => true; int IReadOnlyCollection.Count => _items.Length; T IReadOnlyList.this[int index] => _items[index]; int ICollection.Count => _items.Length; bool ICollection.IsReadOnly => true; T IList.this[int index] { get { return _items[index]; } set { throw new NotSupportedException(); } } public <>z__ReadOnlyArray(T[] items) { _items = items; } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.CopyTo(Array array, int index) { ((ICollection)_items).CopyTo(array, index); } int IList.Add(object? value) { throw new NotSupportedException(); } void IList.Clear() { throw new NotSupportedException(); } bool IList.Contains(object? value) { return ((IList)_items).Contains(value); } int IList.IndexOf(object? value) { return ((IList)_items).IndexOf(value); } void IList.Insert(int index, object? value) { throw new NotSupportedException(); } void IList.Remove(object? value) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } IEnumerator IEnumerable.GetEnumerator() { return ((IEnumerable)_items).GetEnumerator(); } void ICollection.Add(T item) { throw new NotSupportedException(); } void ICollection.Clear() { throw new NotSupportedException(); } bool ICollection.Contains(T item) { return ((ICollection)_items).Contains(item); } void ICollection.CopyTo(T[] array, int arrayIndex) { ((ICollection)_items).CopyTo(array, arrayIndex); } bool ICollection.Remove(T item) { throw new NotSupportedException(); } int IList.IndexOf(T item) { return ((IList)_items).IndexOf(item); } void IList.Insert(int index, T item) { throw new NotSupportedException(); } void IList.RemoveAt(int index) { throw new NotSupportedException(); } } namespace Microsoft.CodeAnalysis { [CompilerGenerated] [Embedded] internal sealed class EmbeddedAttribute : Attribute { } } namespace System.Runtime.CompilerServices { [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)] internal sealed class NullableAttribute : Attribute { public readonly byte[] NullableFlags; public NullableAttribute(byte P_0) { NullableFlags = new byte[1] { P_0 }; } public NullableAttribute(byte[] P_0) { NullableFlags = P_0; } } [CompilerGenerated] [Embedded] [AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)] internal sealed class RefSafetyRulesAttribute : Attribute { public readonly int Version; public RefSafetyRulesAttribute(int P_0) { Version = P_0; } } } namespace FrontierRemix { public class FrontierRemixMod : BloonsTD6Mod { [HarmonyPatch(typeof(FrontierMap), "Update")] internal static class FrontierMap_Update { [HarmonyPostfix] internal static void Postfix(FrontierMap __instance) { //IL_0076: Unknown result type (might be due to invalid IL or missing references) //IL_0096: Expected O, but got Unknown if (MapHotkey.JustPressed() && !PopupScreen.instance.IsPopupActive()) { if (MenuManager.instance.IsMenuOpenOrOpening(new string[1] { "FrontierFastTravelUI" })) { MenuManager.instance.ForceCloseMenu("FrontierFastTravelUI", true); } else { MenuManager.instance.OpenMenu("FrontierFastTravelUI", (Object)null, false); } Game.instance.audioFactory.PlaySound(new AudioClipReference("3b84a9b3562e1a541b97c9a6a2524331"), "EnterBuildingSound", -1, 0.5f, 0f, false, (string)null, false, false, true, (AudioType)0); } __instance.lootDuration = 2f / Math.Max(Speed, 1f); try { if (FrontierSpeedReset.JustPressed() && !Mathf.Approximately(Speed, 1f)) { Speed = 1f; } else if (FrontierSpeed1Key.JustPressed() && !Mathf.Approximately(Speed, ModSettingDouble.op_Implicit((ModSettingDouble)(object)FrontierSpeed1))) { Speed = ModSettingDouble.op_Implicit((ModSettingDouble)(object)FrontierSpeed1); } else if (FrontierSpeed2Key.JustPressed() && !Mathf.Approximately(Speed, ModSettingDouble.op_Implicit((ModSettingDouble)(object)FrontierSpeed2))) { Speed = ModSettingDouble.op_Implicit((ModSettingDouble)(object)FrontierSpeed2); } else { if (!FrontierSpeed3Key.JustPressed() || Mathf.Approximately(Speed, ModSettingDouble.op_Implicit((ModSettingDouble)(object)FrontierSpeed3))) { return; } Speed = ModSettingDouble.op_Implicit((ModSettingDouble)(object)FrontierSpeed3); } ModHelper.Msg((object)$"Frontier Speed is now {Speed}x"); } finally { Time.timeScale = Speed; } } } [HarmonyPatch(typeof(FrontierMapScreen), "Close")] internal static class FrontierMapScreen_Close { [HarmonyPostfix] internal static void Postfix(FrontierMapScreen __instance) { Time.timeScale = 1f; } } [HarmonyPatch(typeof(LegendsMapCameraRig), "Update")] internal static class LegendsMapCameraRig_Update { private const string FreeCam = "freeCam"; private const string FollowCam = "followCam"; [HarmonyPostfix] internal static void Postfix(LegendsMapCameraRig __instance) { if (!FreeCamKey.JustPressed() || PopupScreen.instance.IsPopupActive()) { return; } LegendsMapCameraSettings selectedCameraSettings = __instance.selectedCameraSettings; string text = ((selectedCameraSettings != null) ? selectedCameraSettings.settingsName : null); string text2 = text; if (!(text2 == "freeCam")) { if (text2 == "followCam") { __instance.ChangeSettings("freeCam", (Transform)null, false); } } else { __instance.ChangeSettings("followCam", (Transform)null, false); } } } [HarmonyPatch(typeof(LegendsTileNavigator), "UpdateMovement")] internal static class FrontierMonkeyMovement_Init { [HarmonyPrefix] internal static void Prefix(LegendsTileNavigator __instance) { if (Il2CppSystemObjectExt.Is((Il2CppObjectBase)(object)__instance) && ModSettingBool.op_Implicit(LongRangePathFinding)) { __instance.longDistancePathFinding = true; __instance.pathfindingRange = 1000; __instance.maxPathfindingTries = 100; __instance.maxPathfindingTriesLong = 1000; } } } [HarmonyPatch(typeof(LegendsMapInput), "GetMouseInput")] internal static class LegendsMapInput_GetMouseInput { [HarmonyPrefix] internal static void Prefix(LegendsMapInput __instance) { if (__instance.inputEnabled && !EventSystem.current.IsPointerOverGameObject()) { __instance.clickTimer += Time.unscaledDeltaTime - Time.deltaTime; __instance.clickCooldownTimer += Time.unscaledDeltaTime - Time.deltaTime; } } } [HarmonyPatch(typeof(FrontierMapScreen), "CampfireHintButtonClicked")] internal static class FrontierMapScreen_CampfireHintButtonClicked { [HarmonyPrefix] internal static void Prefix(FrontierMapScreen __instance) { if (__instance.frontierMap.runningHighlightPathTask == null) { return; } ((Task)__instance.frontierMap.GetPathToCampfire()).ContinueWith(Action.op_Implicit((Action)delegate(Task t) { List result = ((Il2CppObjectBase)t).Cast>>().Result; if (Il2CppGenerics.Any(result)) { ((LegendsMap)__instance.frontierMap).GetPlayerNav().TravelAlongPathSequenceAsync(result, Il2CppGenerics.First(result), false); } })); } } [HarmonyPatch(typeof(FrontierFishingMinigame), "Awake")] internal static class FrontierFishingMinigame_Awake { [HarmonyPostfix] internal static void Postfix(FrontierFishingMinigame __instance) { //IL_003e: Unknown result type (might be due to invalid IL or missing references) //IL_0049: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Unknown result type (might be due to invalid IL or missing references) //IL_00c0: Unknown result type (might be due to invalid IL or missing references) GameObject gameObject = ((Component)__instance).gameObject; Info val = default(Info); ((Info)(ref val))..ctor("AutoFish", 150f); ((Info)(ref val)).set_X(-175f); ((Info)(ref val)).set_Y(175f); ((Info)(ref val)).set_Anchor(new Vector2(1f, 0f)); ModHelperCheckbox val2 = GameObjectExt.AddModHelperComponent(gameObject, ModHelperCheckbox.Create(val, autoFish, "8124838d28bc28247b820f6dd97ecea6", UnityAction.op_Implicit((Action)delegate(bool b) { autoFish = b; }), (string)null, 0)); ((Info)(ref val))..ctor("Label", 300f, 100f); ((Info)(ref val)).set_Y(-36f); ((Info)(ref val)).set_Anchor(new Vector2(0.5f, 0f)); ((ModHelperComponent)val2).AddText(val, "Auto Fish", 60f); } } [HarmonyPatch(typeof(FrontierFishingMinigame), "Update")] internal static class FrontierFishingMinigame_Update { [HarmonyPrefix] internal static void Prefix(FrontierFishingMinigame __instance) { if (autoFish) { ((FrontierMinigame)__instance).hitBtnHeld = ((FrontierMinigame)__instance).targetPos > ((FrontierMinigame)__instance).t; InputSystemController_GetMouseButtonDown.overrideMouse = __instance.map.frontierMap.lootSequenceRunning; } } } [HarmonyPatch] internal static class FrontierFishingMinigame_IdleState { private static IEnumerable TargetMethods() { return new <>z__ReadOnlyArray(new MethodBase[2] { AccessTools.Method(typeof(FrontierFishingMinigame), "IdleState", (Type[])null, (Type[])null), AccessTools.Method(typeof(FrontierFishingMinigame), "LoseGame", (Type[])null, (Type[])null) }); } [HarmonyPostfix] internal static void Postfix(FrontierFishingMinigame __instance) { if (autoFish) { TaskScheduler.ScheduleTask((Action)__instance.StartWaitingAsync, (ScheduleType)2, 1, (Func)null); } } } [HarmonyPatch(typeof(FrontierFishLootDisplay), "Bind")] internal static class FrontierFishLootDisplay_Bind { [HarmonyPostfix] internal static void Postfix(FrontierLoot loot) { FrontierFishingLoot val = default(FrontierFishingLoot); if (autoFish && Il2CppSystemObjectExt.Is((Il2CppObjectBase)(object)loot, ref val)) { ModHelper.Msg((object)$"Caught {StringExt.Localize(((FrontierLoot)val).GetLootNameLocKey())}! Weight: {val.weight:F2} Value: {val.value}"); } } } [HarmonyPatch(typeof(InputSystemController), "GetMouseButtonDown")] internal static class InputSystemController_GetMouseButtonDown { internal static bool overrideMouse; [HarmonyPostfix] internal static void Postfix(ref bool __result) { if (autoFish && overrideMouse) { __result = true; } overrideMouse = false; } } public static readonly ModSettingBool LongRangePathFinding = new ModSettingBool(true) { description = "Enables you to click and move in the Frontier Legends map at any range" }; private static readonly ModSettingHotkey FreeCamKey = new ModSettingHotkey((KeyCode)32, (HotkeyModifier)0) { description = "Keybinding to toggle Free Cam mode in the Frontier Legends map." }; public static readonly ModSettingHotkey MapHotkey = new ModSettingHotkey((KeyCode)109, (HotkeyModifier)0) { description = "Open up the Frontier Fast travel map from anywhere" }; private static readonly ModSettingHotkey FrontierSpeedReset = new ModSettingHotkey((KeyCode)282, (HotkeyModifier)0); private static readonly ModSettingFloat FrontierSpeed1; private static readonly ModSettingHotkey FrontierSpeed1Key; private static readonly ModSettingFloat FrontierSpeed2; private static readonly ModSettingHotkey FrontierSpeed2Key; private static readonly ModSettingFloat FrontierSpeed3; private static readonly ModSettingHotkey FrontierSpeed3Key; private static bool autoFish; public static float Speed { get; private set; } static FrontierRemixMod() { //IL_0001: Unknown result type (might be due to invalid IL or missing references) //IL_0006: Unknown result type (might be due to invalid IL or missing references) //IL_0016: Expected O, but got Unknown //IL_0019: Unknown result type (might be due to invalid IL or missing references) //IL_001e: Unknown result type (might be due to invalid IL or missing references) //IL_002e: Expected O, but got Unknown //IL_0031: Unknown result type (might be due to invalid IL or missing references) //IL_0036: Unknown result type (might be due to invalid IL or missing references) //IL_0046: Expected O, but got Unknown //IL_004c: Unknown result type (might be due to invalid IL or missing references) //IL_0056: Expected O, but got Unknown //IL_005b: Unknown result type (might be due to invalid IL or missing references) //IL_0060: Unknown result type (might be due to invalid IL or missing references) //IL_006d: Expected O, but got Unknown //IL_006d: Unknown result type (might be due to invalid IL or missing references) //IL_007b: Expected O, but got Unknown //IL_0080: Expected O, but got Unknown //IL_0086: Unknown result type (might be due to invalid IL or missing references) //IL_0090: Expected O, but got Unknown //IL_0095: Unknown result type (might be due to invalid IL or missing references) //IL_009a: Unknown result type (might be due to invalid IL or missing references) //IL_00a7: Expected O, but got Unknown //IL_00a7: Unknown result type (might be due to invalid IL or missing references) //IL_00b5: Expected O, but got Unknown //IL_00ba: Expected O, but got Unknown //IL_00c0: Unknown result type (might be due to invalid IL or missing references) //IL_00ca: Expected O, but got Unknown //IL_00cf: Unknown result type (might be due to invalid IL or missing references) //IL_00d4: Unknown result type (might be due to invalid IL or missing references) //IL_00e1: Expected O, but got Unknown //IL_00e1: Unknown result type (might be due to invalid IL or missing references) //IL_00ef: Expected O, but got Unknown //IL_00f4: Expected O, but got Unknown //IL_00fa: Unknown result type (might be due to invalid IL or missing references) //IL_0104: Expected O, but got Unknown ModSettingFloat val = new ModSettingFloat(1.5f); ((ModSettingNumber)val).min = 1.0; ((ModSettingNumber)val).max = 10.0; FrontierSpeed1 = val; FrontierSpeed1Key = new ModSettingHotkey((KeyCode)283, (HotkeyModifier)0); ModSettingFloat val2 = new ModSettingFloat(2f); ((ModSettingNumber)val2).min = 1.0; ((ModSettingNumber)val2).max = 10.0; FrontierSpeed2 = val2; FrontierSpeed2Key = new ModSettingHotkey((KeyCode)284, (HotkeyModifier)0); ModSettingFloat val3 = new ModSettingFloat(3f); ((ModSettingNumber)val3).min = 1.0; ((ModSettingNumber)val3).max = 10.0; FrontierSpeed3 = val3; FrontierSpeed3Key = new ModSettingHotkey((KeyCode)285, (HotkeyModifier)0); Speed = 1f; } } public static class ModHelperData { public const string WorksOnVersion = "54.1"; public const string Version = "1.0.3"; public const string Name = "Frontier Remix"; public const string Description = "Adds some Quality of Life changes to Frontier Legends. Current Features:\n- Press Space to toggle Freecam Mode in the Frontier Map\n- Use F1-F4 to Fast Forward within the Frontier Map\n- Press M to open the Frontier Fast Travel Map from any location\n- Auto Fishing toggle on the Fishing screen\n- Auto walk to nearest campfire by clicking the campfire button twice"; public const string RepoOwner = "doombubbles"; public const string PrevRepoName = "frontier-remix"; public const string RepoName = "FrontierRemix"; public const bool SquareIcon = true; } }