using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using HarmonyLib;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("NoGobleClick")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
namespace NoGobleClick;
[BepInPlugin("starfi5h.plugin.NoGobleClick", "NoGobleClick", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
public const string GUID = "starfi5h.plugin.NoGobleClick";
public const string NAME = "NoGobleClick";
public const string VERSION = "1.0.0";
private Harmony harmony;
public void Awake()
{
//IL_0006: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Expected O, but got Unknown
harmony = new Harmony("starfi5h.plugin.NoGobleClick");
harmony.PatchAll(typeof(Plugin));
}
[HarmonyPrefix]
[HarmonyPatch(typeof(UIGlobemap), "LocateLogic")]
private static void LocateLogic_Prefix(ref bool ___ignoreLocate)
{
___ignoreLocate = !VFInput._godModeMechaMove;
}
[HarmonyTranspiler]
[HarmonyPatch(typeof(PlayerAction_Rts), "GameTick")]
public static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
{
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Expected O, but got Unknown
//IL_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0052: Expected O, but got Unknown
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Expected O, but got Unknown
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: Expected O, but got Unknown
//IL_009c: Unknown result type (might be due to invalid IL or missing references)
//IL_00a2: Expected O, but got Unknown
FieldInfo fieldInfo = AccessTools.Field(typeof(CommandState), "type");
CodeMatcher val = new CodeMatcher(instructions, (ILGenerator)null);
val.End().MatchBack(false, (CodeMatch[])(object)new CodeMatch[5]
{
new CodeMatch((OpCode?)OpCodes.Ret, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldloc_0, (object)null, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldfld, (object)fieldInfo, (string)null),
new CodeMatch((OpCode?)OpCodes.Ldc_I4_6, (object)null, (string)null),
new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction i) => i.opcode == OpCodes.Beq), (string)null)
});
if (val.IsInvalid)
{
Debug.LogWarning((object)"[Transpiler] 未能匹配到目標 IL 指令段落!");
return instructions;
}
val.Advance(1);
object operand = val.InstructionAt(3).operand;
val.SetAndAdvance(OpCodes.Nop, (object)null).SetAndAdvance(OpCodes.Nop, (object)null).SetAndAdvance(OpCodes.Nop, (object)null)
.Set(OpCodes.Br_S, operand);
return val.InstructionEnumeration();
}
}