Decompiled source of MoreCruiser v1.1.0

MoreCruiser.dll

Decompiled 4 months ago
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoreCruiser")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreCruiser")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3c5c81bb-8ef9-4463-97e6-32b290f712bf")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MoreCruiser;

[BepInPlugin("qh3.MoreCruiser", "MoreCruiser", "1.0.0")]
public class Plugin : BaseUnityPlugin
{
	public static Plugin Instance;

	private static readonly Harmony harmony = new Harmony("qh3.MoreCruiser");

	internal static ManualLogSource Log = Logger.CreateLogSource("qh3.MoreCruiser");

	private void Awake()
	{
		Log.LogInfo((object)"Loading BigMap Mod");
		Instance = this;
		harmony.PatchAll(typeof(Terminal_Patch));
	}
}
[HarmonyPatch(typeof(Terminal))]
internal class Terminal_Patch
{
	[HarmonyPatch("LoadNewNodeIfAffordable")]
	[HarmonyTranspiler]
	private static IEnumerable<CodeInstruction> LoadNewNodeIfAffordableTranspiler(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = instructions.ToList();
		Plugin.Log.LogInfo((object)"开始打印LoadNewNodeIfAffordable");
		for (int i = 0; i < list.Count; i++)
		{
			CodeInstruction val = list[i];
			if (!(val.opcode.Name == "ldfld") || !(val.operand is FieldInfo fieldInfo) || !(fieldInfo.Name == "buyVehicleIndex"))
			{
				continue;
			}
			CodeInstruction val2 = list[i + 6];
			if (val2.opcode.Name == "call" && val2.operand is MethodInfo methodInfo && methodInfo.Name == "FindObjectOfType" && methodInfo.GetGenericArguments()[0] == typeof(VehicleController))
			{
				for (int j = i + 3; j <= i + 33; j++)
				{
					list[j].opcode = OpCodes.Nop;
				}
				break;
			}
		}
		return list;
	}
}