Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of SprintMap v0.1.0
SprintMap.dll
Decompiled 2 weeks agousing System; using System.Collections.Generic; using System.Reflection; using System.Reflection.Emit; using System.Runtime.CompilerServices; using BepInEx; using BepInEx.Configuration; using BepInEx.Logging; using HarmonyLib; [assembly: CompilationRelaxations(8)] [assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)] [assembly: AssemblyVersion("0.0.0.0")] namespace SprintMap; [BepInProcess("REPO.exe")] [BepInPlugin("com.sprintmap.repo", "SprintMap", "0.1.0")] public class SprintMapPlugin : BaseUnityPlugin { public static bool AllowMapWhileSprinting = true; private Harmony _harmony; internal static SprintMapPlugin Instance { get; private set; } internal static ManualLogSource Logger => Instance._logger; private ManualLogSource _logger => ((BaseUnityPlugin)this).Logger; public static ConfigEntry<bool> Enabled { get; private set; } private void Awake() { Instance = this; Enabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Enabled", true, "总开关:true=奔跑时可查看 TAB 小地图;false=恢复游戏原生行为(奔跑时强制关闭地图)"); AllowMapWhileSprinting = Enabled.Value; Patch(); Logger.LogInfo((object)$"SprintMap v{((BaseUnityPlugin)this).Info.Metadata.Version} loaded. enabled={AllowMapWhileSprinting}"); } private void Patch() { //IL_0012: Unknown result type (might be due to invalid IL or missing references) //IL_001c: Expected O, but got Unknown //IL_0090: Unknown result type (might be due to invalid IL or missing references) //IL_009c: Expected O, but got Unknown _harmony = new Harmony(((BaseUnityPlugin)this).Info.Metadata.GUID); Type type = AccessTools.TypeByName("MapToolController"); if (type == null) { Logger.LogError((object)"Type MapToolController not found, patch aborted."); return; } MethodInfo methodInfo = AccessTools.Method(type, "Update", (Type[])null, (Type[])null); if (methodInfo == null) { Logger.LogError((object)"Method MapToolController.Update not found, patch aborted."); } else { _harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(MapToolControllerPatch), "Transpiler", (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null); } } } public static class MapToolControllerPatch { public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions) { //IL_014b: Unknown result type (might be due to invalid IL or missing references) //IL_0155: Expected O, but got Unknown //IL_015e: Unknown result type (might be due to invalid IL or missing references) //IL_0168: Expected O, but got Unknown //IL_0171: Unknown result type (might be due to invalid IL or missing references) //IL_017b: Expected O, but got Unknown //IL_0184: Unknown result type (might be due to invalid IL or missing references) //IL_018e: Expected O, but got Unknown List<CodeInstruction> list = new List<CodeInstruction>(instructions); FieldInfo field = typeof(SprintMapPlugin).GetField("AllowMapWhileSprinting", BindingFlags.Static | BindingFlags.Public); bool flag = false; for (int i = 0; i < list.Count; i++) { if (list[i].opcode != OpCodes.Ldfld) { continue; } FieldInfo fieldInfo = list[i].operand as FieldInfo; if (!(fieldInfo == null) && !(fieldInfo.Name != "sprinting") && !(fieldInfo.DeclaringType == null) && !(fieldInfo.DeclaringType.Name != "PlayerController")) { int j; for (j = i + 1; j < list.Count && list[j].opcode == OpCodes.Nop; j++) { } if (j < list.Count && (list[j].opcode == OpCodes.Brtrue || list[j].opcode == OpCodes.Brtrue_S)) { List<CodeInstruction> list2 = new List<CodeInstruction>(); list2.Add(new CodeInstruction(OpCodes.Ldsfld, (object)field)); list2.Add(new CodeInstruction(OpCodes.Ldc_I4_1, (object)null)); list2.Add(new CodeInstruction(OpCodes.Xor, (object)null)); list2.Add(new CodeInstruction(OpCodes.And, (object)null)); List<CodeInstruction> collection = list2; list.InsertRange(j, collection); flag = true; break; } } } if (flag) { SprintMapPlugin.Logger.LogInfo((object)"SprintMap transpiler OK: sprinting gate patched."); } else { SprintMapPlugin.Logger.LogWarning((object)"SprintMap transpiler NO_MATCH: MapToolController.Update IL changed or sprinting check not found; mod is inert (native behavior). Check game version and re-locate patch point."); } return list; } }