Decompiled source of DockSpeed v1.1.2

plugins/DockSpeed.dll

Decompiled 8 hours ago
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 BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("0.0.0.0")]
namespace DockSpeed;

[BepInPlugin("sinthome358.dsp.dockspeed", "Dock Speed", "1.1.2")]
public sealed class DockSpeedPlugin : BaseUnityPlugin
{
	public const string GUID = "sinthome358.dsp.dockspeed";

	public const string MOD_NAME = "Dock Speed";

	public const string VERSION = "1.1.2";

	internal static ManualLogSource Log;

	internal static ConfigEntry<float> DroneMultiplier;

	internal static ConfigEntry<float> ShipMultiplier;

	internal static ConfigEntry<float> ShipFlightMultiplier;

	private static FieldInfo CollectorFlagField;

	private static readonly HashSet<string> LoggedCollectorRouteStates = new HashSet<string>();

	private const float SHIP_PAD_A = 0.03335f;

	private const float SHIP_PAD_B = 0.0334f;

	private const float SHIP_LIFT_BASE = 0.006f;

	private const float SHIP_LIFT_ADD = 1E-05f;

	private const float DRONE_STEP = 1f / 60f;

	private const float SHIP_FLIGHT_ACCEL = 0.12f;

	private void Awake()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_0080: Expected O, but got Unknown
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: Expected O, but got Unknown
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Expected O, but got Unknown
		//IL_0111: Expected O, but got Unknown
		Log = ((BaseUnityPlugin)this).Logger;
		DroneMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "DroneDockSpeedMultiplier", 4f, new ConfigDescription("物流运输机(行星内)起飞和降落阶段的速度倍率。1 = 原版;4 = 这两段耗时变为约四分之一。飞行速度不受影响。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>()));
		ShipMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ShipDockSpeedMultiplier", 4f, new ConfigDescription("星际物流运输船进出物流塔(停靠台与起降)阶段的速度倍率。1 = 原版;4 = 这几段耗时变为约四分之一。航行和曲速速度不受影响。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 20f), Array.Empty<object>()));
		ShipFlightMultiplier = ((BaseUnityPlugin)this).Config.Bind<float>("General", "ShipFlightPhaseMultiplier", 4f, new ConfigDescription("星际物流运输船出塔后到进入曲速前(起飞加速、转向对准)以及退出曲速后到入塔前(减速、对准、降落)的速度倍率。1 = 原版。曲速阶段本身不受影响。倍率越大,这两段越短,但过大可能让运输船的转向轨迹变得不自然。只要该运输船的远端目标站是轨道采集器,往返该站的飞行段都会自动豁免此倍率;运行时会记录识别结果,便于确认特判是否命中。", (AcceptableValueBase)(object)new AcceptableValueRange<float>(1f, 10f), Array.Empty<object>()));
		Type type = AccessTools.TypeByName("StationComponent");
		if (type == null)
		{
			Log.LogError((object)"找不到 StationComponent,模组不会生效(游戏版本可能变化)。");
			return;
		}
		Harmony val = new Harmony("sinthome358.dsp.dockspeed");
		TryPatch(val, type, "InternalTickLocal", "DroneTranspiler");
		TryPatch(val, type, "InternalTickRemote", "ShipTranspiler");
		Log.LogInfo((object)("倍率:运输机 x" + DroneMultiplier.Value + ",运输船进出塔 x" + ShipMultiplier.Value + ",运输船曲速前后飞行段 x" + ShipFlightMultiplier.Value));
	}

	private static void TryPatch(Harmony harmony, Type type, string method, string transpiler)
	{
		//IL_003f: Unknown result type (might be due to invalid IL or missing references)
		//IL_004b: Expected O, but got Unknown
		try
		{
			MethodInfo methodInfo = AccessTools.Method(type, method, (Type[])null, (Type[])null);
			if (methodInfo == null)
			{
				Log.LogError((object)("找不到 StationComponent." + method + ",对应部分不会生效。"));
			}
			else
			{
				harmony.Patch((MethodBase)methodInfo, (HarmonyMethod)null, (HarmonyMethod)null, new HarmonyMethod(typeof(DockSpeedPlugin), transpiler, (Type[])null), (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}
		catch (Exception ex)
		{
			Log.LogError((object)("修补 StationComponent." + method + " 失败:" + ex));
		}
	}

	private static bool IsLdcR4(CodeInstruction ins, float value)
	{
		if (ins.opcode != OpCodes.Ldc_R4 || !(ins.operand is float))
		{
			return false;
		}
		return Math.Abs((float)ins.operand - value) < 1E-07f;
	}

	private static IEnumerable<CodeInstruction> DroneTranspiler(IEnumerable<CodeInstruction> instructions)
	{
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Expected O, but got Unknown
		//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f7: Expected O, but got Unknown
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		float value = DroneMultiplier.Value;
		if (value <= 1f)
		{
			return list;
		}
		List<int> list2 = new List<int>();
		for (int i = 0; i + 2 < list.Count; i++)
		{
			if (IsLdcR4(list[i], 1f / 60f) && list[i + 1].opcode == OpCodes.Ldloc_0 && list[i + 2].opcode == OpCodes.Mul)
			{
				list2.Add(i + 2);
			}
		}
		if (list2.Count != 1)
		{
			Log.LogWarning((object)("运输机补丁:匹配数为 " + list2.Count + "(应为 1),为安全起见不修改。游戏版本可能已变化。"));
			return list;
		}
		List<CodeInstruction> list3 = new List<CodeInstruction>(list);
		list3.Insert(list2[0] + 1, new CodeInstruction(OpCodes.Ldc_R4, (object)value));
		list3.Insert(list2[0] + 2, new CodeInstruction(OpCodes.Mul, (object)null));
		Log.LogInfo((object)("运输机补丁已应用(x" + value + ")。"));
		return list3;
	}

	private static bool IsLocal(CodeInstruction ins, OpCode op, int index)
	{
		LocalBuilder localBuilder = ins.operand as LocalBuilder;
		if (ins.opcode == op && localBuilder != null)
		{
			return localBuilder.LocalIndex == index;
		}
		return false;
	}

	private static bool IsLoadArgument(CodeInstruction ins, int argumentIndex)
	{
		if (ins.opcode == OpCodes.Ldarg_0)
		{
			return argumentIndex == 0;
		}
		if (ins.opcode == OpCodes.Ldarg_1)
		{
			return argumentIndex == 1;
		}
		if (ins.opcode == OpCodes.Ldarg_2)
		{
			return argumentIndex == 2;
		}
		if (ins.opcode == OpCodes.Ldarg_3)
		{
			return argumentIndex == 3;
		}
		if (ins.opcode != OpCodes.Ldarg && ins.opcode != OpCodes.Ldarg_S)
		{
			return false;
		}
		if (ins.operand is ParameterInfo parameterInfo)
		{
			return parameterInfo.Position + 1 == argumentIndex;
		}
		if (ins.operand is byte b)
		{
			return b == argumentIndex;
		}
		if (ins.operand is short num)
		{
			return num == argumentIndex;
		}
		if (ins.operand is int num2)
		{
			return num2 == argumentIndex;
		}
		return false;
	}

	private static bool IsLoadLocal(CodeInstruction ins, LocalBuilder local)
	{
		if (local == null || (ins.opcode != OpCodes.Ldloc && ins.opcode != OpCodes.Ldloc_S))
		{
			return false;
		}
		if (ins.operand is LocalBuilder localBuilder)
		{
			return localBuilder.LocalIndex == local.LocalIndex;
		}
		return false;
	}

	private static bool ShouldBypassFlightMultiplier(object remoteStation, int otherGId, int direction, int itemCount)
	{
		bool flag = false;
		if (remoteStation != null && CollectorFlagField != null)
		{
			try
			{
				object value = CollectorFlagField.GetValue(remoteStation);
				flag = value is bool && (bool)value;
			}
			catch (Exception ex)
			{
				string item = "collector-field-error:" + otherGId;
				lock (LoggedCollectorRouteStates)
				{
					if (LoggedCollectorRouteStates.Add(item))
					{
						Log.LogWarning((object)("读取轨道采集器标记失败(otherGId=" + otherGId + "):" + ex.Message));
					}
				}
			}
		}
		string text = null;
		string text2 = null;
		bool flag2 = false;
		if (flag)
		{
			string text3 = ((direction < 0) ? "返航方向" : "前往目标站方向");
			text = "collector:" + otherGId + ":" + ((direction < 0) ? "return" : "outbound");
			text2 = "轨道采集器航线识别成功:otherGId=" + otherGId + ",方向=" + direction + "(" + text3 + "),itemCount=" + itemCount + ";该航线当前运输船的 ShipFlightPhaseMultiplier 已豁免(有效倍率 x1)。";
		}
		else if (direction < 0 && itemCount > 0)
		{
			text = "non-collector-loaded-return:" + otherGId;
			string text4 = ((remoteStation == null) ? "null" : remoteStation.GetType().FullName);
			text2 = "返航候选未识别为轨道采集器:otherGId=" + otherGId + ",direction=" + direction + ",itemCount=" + itemCount + ",目标站类型=" + text4 + ",isCollector=false。这表明当前游戏/其他模组中的站点标记与预期不同。";
			flag2 = true;
		}
		if (text != null)
		{
			lock (LoggedCollectorRouteStates)
			{
				if (LoggedCollectorRouteStates.Add(text))
				{
					if (flag2)
					{
						Log.LogWarning((object)text2);
					}
					else
					{
						Log.LogInfo((object)text2);
					}
				}
			}
		}
		return flag;
	}

	private static LocalBuilder StoredLocal(CodeInstruction ins)
	{
		if (ins.opcode != OpCodes.Stloc && ins.opcode != OpCodes.Stloc_S)
		{
			return null;
		}
		return ins.operand as LocalBuilder;
	}

	private static int FindShipDataPointerStore(IList<CodeInstruction> code, out LocalBuilder shipDataRefLocal, out Type shipDataType)
	{
		shipDataRefLocal = null;
		shipDataType = null;
		int num = -1;
		for (int i = 2; i + 1 < code.Count; i++)
		{
			if (code[i].opcode != OpCodes.Ldelema || !(code[i].operand is Type type) || type.Name != "ShipData")
			{
				continue;
			}
			FieldInfo fieldInfo = code[i - 2].operand as FieldInfo;
			if (code[i - 2].opcode != OpCodes.Ldfld || fieldInfo == null || fieldInfo.Name != "workShipDatas")
			{
				continue;
			}
			LocalBuilder localBuilder = StoredLocal(code[i + 1]);
			if (localBuilder != null && localBuilder.LocalType.IsByRef && !(localBuilder.LocalType.GetElementType() == null) && !(localBuilder.LocalType.GetElementType().Name != "ShipData"))
			{
				if (num >= 0)
				{
					return -1;
				}
				num = i + 1;
				shipDataRefLocal = localBuilder;
				shipDataType = type;
			}
		}
		return num;
	}

	private static IEnumerable<CodeInstruction> ShipTranspiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_05e6: Unknown result type (might be due to invalid IL or missing references)
		//IL_05ed: Expected O, but got Unknown
		//IL_0643: Unknown result type (might be due to invalid IL or missing references)
		//IL_064d: Expected O, but got Unknown
		//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_06c9: Expected O, but got Unknown
		//IL_06de: Unknown result type (might be due to invalid IL or missing references)
		//IL_06e5: Expected O, but got Unknown
		//IL_06f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_06f7: Expected O, but got Unknown
		//IL_0712: Unknown result type (might be due to invalid IL or missing references)
		//IL_071c: Expected O, but got Unknown
		//IL_0724: Unknown result type (might be due to invalid IL or missing references)
		//IL_072e: Expected O, but got Unknown
		//IL_0735: Unknown result type (might be due to invalid IL or missing references)
		//IL_073f: Expected O, but got Unknown
		//IL_074c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0756: Expected O, but got Unknown
		//IL_075e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0768: Expected O, but got Unknown
		//IL_0770: Unknown result type (might be due to invalid IL or missing references)
		//IL_077a: Expected O, but got Unknown
		//IL_0786: Unknown result type (might be due to invalid IL or missing references)
		//IL_0790: Expected O, but got Unknown
		//IL_0797: Unknown result type (might be due to invalid IL or missing references)
		//IL_07a1: Expected O, but got Unknown
		//IL_07a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_07b2: Expected O, but got Unknown
		//IL_07bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_07c9: Expected O, but got Unknown
		//IL_07d5: Unknown result type (might be due to invalid IL or missing references)
		//IL_07df: Expected O, but got Unknown
		//IL_07e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_07f1: Expected O, but got Unknown
		//IL_07f9: Unknown result type (might be due to invalid IL or missing references)
		//IL_0803: Expected O, but got Unknown
		//IL_080a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0814: Expected O, but got Unknown
		//IL_081c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0826: Expected O, but got Unknown
		//IL_082e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0838: Expected O, but got Unknown
		//IL_0840: Unknown result type (might be due to invalid IL or missing references)
		//IL_084a: Expected O, but got Unknown
		//IL_0852: Unknown result type (might be due to invalid IL or missing references)
		//IL_085c: Expected O, but got Unknown
		//IL_0864: Unknown result type (might be due to invalid IL or missing references)
		//IL_086e: Expected O, but got Unknown
		//IL_0876: Unknown result type (might be due to invalid IL or missing references)
		//IL_0880: Expected O, but got Unknown
		//IL_0888: Unknown result type (might be due to invalid IL or missing references)
		//IL_0892: Expected O, but got Unknown
		//IL_089f: Unknown result type (might be due to invalid IL or missing references)
		//IL_08a9: Expected O, but got Unknown
		//IL_08b9: Unknown result type (might be due to invalid IL or missing references)
		//IL_08c3: Expected O, but got Unknown
		//IL_08d0: Unknown result type (might be due to invalid IL or missing references)
		//IL_08da: Expected O, but got Unknown
		//IL_08ee: Unknown result type (might be due to invalid IL or missing references)
		//IL_08f8: Expected O, but got Unknown
		//IL_08ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0909: Expected O, but got Unknown
		//IL_0911: Unknown result type (might be due to invalid IL or missing references)
		//IL_091b: Expected O, but got Unknown
		//IL_0933: Unknown result type (might be due to invalid IL or missing references)
		//IL_093d: Expected O, but got Unknown
		//IL_0944: Unknown result type (might be due to invalid IL or missing references)
		//IL_094e: Expected O, but got Unknown
		//IL_0956: Unknown result type (might be due to invalid IL or missing references)
		//IL_0960: Expected O, but got Unknown
		//IL_0967: Unknown result type (might be due to invalid IL or missing references)
		//IL_0971: Expected O, but got Unknown
		//IL_0979: Unknown result type (might be due to invalid IL or missing references)
		//IL_0983: Expected O, but got Unknown
		//IL_04c9: Unknown result type (might be due to invalid IL or missing references)
		//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_04e5: Expected O, but got Unknown
		//IL_051f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0524: Unknown result type (might be due to invalid IL or missing references)
		//IL_053b: Expected O, but got Unknown
		//IL_056b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0575: Expected O, but got Unknown
		//IL_0587: Unknown result type (might be due to invalid IL or missing references)
		//IL_0591: Expected O, but got Unknown
		List<CodeInstruction> list = new List<CodeInstruction>(instructions);
		float value = ShipMultiplier.Value;
		float value2 = ShipFlightMultiplier.Value;
		bool flag = value > 1f;
		bool flag2 = value2 > 1f;
		if (!flag && !flag2)
		{
			return list;
		}
		List<int> list2 = new List<int>();
		List<int> list3 = new List<int>();
		List<int> list4 = new List<int>();
		List<int> list5 = new List<int>();
		for (int i = 0; i < list.Count; i++)
		{
			if (IsLdcR4(list[i], 0.03335f))
			{
				list2.Add(i);
			}
			else if (IsLdcR4(list[i], 0.0334f))
			{
				list3.Add(i);
			}
			if (i + 3 < list.Count && IsLdcR4(list[i], 0.006f) && list[i + 1].opcode == OpCodes.Mul && IsLdcR4(list[i + 2], 1E-05f) && list[i + 3].opcode == OpCodes.Add)
			{
				list4.Add(i + 3);
			}
			MethodInfo methodInfo = list[i].operand as MethodInfo;
			if (list[i].opcode == OpCodes.Call && methodInfo != null && methodInfo.Name == "Log" && methodInfo.DeclaringType != null && methodInfo.DeclaringType.Name == "Mathf" && i + 4 < list.Count && IsLdcR4(list[i + 1], 1f) && list[i + 2].opcode == OpCodes.Add && IsLocal(list[i + 3], OpCodes.Stloc_S, 10) && IsLocal(list[i + 4], OpCodes.Ldloc_S, 8))
			{
				list5.Add(i + 4);
			}
		}
		bool flag3 = list2.Count == 2 && list3.Count == 2 && list4.Count == 1;
		bool flag4 = false;
		LocalBuilder localBuilder = null;
		LocalBuilder localBuilder2 = null;
		LocalBuilder shipDataRefLocal = null;
		Type shipDataType = null;
		FieldInfo fieldInfo = null;
		FieldInfo fieldInfo2 = null;
		FieldInfo fieldInfo3 = null;
		FieldInfo fieldInfo4 = null;
		Type type = AccessTools.TypeByName("StationComponent");
		int num = -1;
		int num2 = 0;
		if (flag2 && list5.Count == 1 && list5[0] > 0)
		{
			localBuilder = list[list5[0] - 1].operand as LocalBuilder;
			if (localBuilder != null)
			{
				for (int j = 0; j + 5 < list.Count; j++)
				{
					if (IsLoadArgument(list[j], 3) && IsLdcR4(list[j + 1], 0.12f) && list[j + 2].opcode == OpCodes.Mul && IsLoadLocal(list[j + 3], localBuilder) && list[j + 4].opcode == OpCodes.Mul)
					{
						LocalBuilder localBuilder3 = StoredLocal(list[j + 5]);
						if (localBuilder3 != null)
						{
							num2++;
							localBuilder2 = localBuilder3;
						}
					}
				}
			}
			num = FindShipDataPointerStore(list, out shipDataRefLocal, out shipDataType);
			if (shipDataType != null)
			{
				fieldInfo = AccessTools.Field(shipDataType, "otherGId");
				fieldInfo2 = AccessTools.Field(shipDataType, "direction");
				fieldInfo3 = AccessTools.Field(shipDataType, "itemCount");
			}
			if (type != null)
			{
				fieldInfo4 = AccessTools.Field(type, "isCollector");
			}
			flag4 = list5.Count == 1 && localBuilder != null && num2 == 1 && localBuilder2 != null && num >= 0 && shipDataRefLocal != null && fieldInfo != null && fieldInfo2 != null && fieldInfo3 != null && fieldInfo4 != null && generator != null;
		}
		if (flag && !flag3)
		{
			Log.LogWarning((object)("运输船进出塔补丁:匹配数异常(起点停靠台 " + list2.Count + "/2,终点停靠台 " + list3.Count + "/2,起降 " + list4.Count + "/1),这一部分不修改。游戏版本可能已变化。"));
			flag = false;
		}
		if (flag2 && !flag4)
		{
			Log.LogWarning((object)"运输船飞行段补丁:性能系数、加速度局部变量或 ShipData 字段的匹配结果异常,为安全起见不修改飞行段;请检查游戏版本是否变化。");
			flag2 = false;
		}
		if (!flag && !flag2)
		{
			return list;
		}
		List<CodeInstruction> list6 = new List<CodeInstruction>(list);
		if (flag)
		{
			foreach (int item2 in list2)
			{
				list6[item2] = new CodeInstruction(list6[item2])
				{
					operand = 0.03335f * value
				};
			}
			foreach (int item3 in list3)
			{
				list6[item3] = new CodeInstruction(list6[item3])
				{
					operand = 0.0334f * value
				};
			}
			list6.Insert(list4[0] + 1, new CodeInstruction(OpCodes.Ldc_R4, (object)value));
			list6.Insert(list4[0] + 2, new CodeInstruction(OpCodes.Mul, (object)null));
			Log.LogInfo((object)("运输船进出塔补丁已应用(x" + value + ")。"));
		}
		if (flag2)
		{
			LocalBuilder localBuilder4 = generator.DeclareLocal(typeof(float));
			int num3 = list5[0];
			CodeInstruction val = list6[num3];
			CodeInstruction val2 = new CodeInstruction(OpCodes.Ldloc, (object)localBuilder);
			val2.labels.AddRange(val.labels);
			val2.blocks.AddRange(val.blocks);
			val.labels.Clear();
			val.blocks.Clear();
			list6.Insert(num3, val2);
			list6.Insert(num3 + 1, new CodeInstruction(OpCodes.Stloc, (object)localBuilder4));
			int num4 = FindShipDataPointerStore(list6, out shipDataRefLocal, out shipDataType);
			if (num4 < 0)
			{
				Log.LogWarning((object)"运输船飞行段补丁:无法重新定位 ShipData 循环,取消飞行段修改。");
				return list6;
			}
			CollectorFlagField = fieldInfo4;
			Label label = generator.DefineLabel();
			Label label2 = generator.DefineLabel();
			MethodInfo methodInfo2 = AccessTools.Method(typeof(DockSpeedPlugin), "ShouldBypassFlightMultiplier", (Type[])null, (Type[])null);
			if (methodInfo2 == null)
			{
				Log.LogWarning((object)"运输船飞行段补丁:找不到轨道采集器判定辅助方法,取消飞行段修改。请检查源码版本。");
				return list;
			}
			CodeInstruction val3 = new CodeInstruction(OpCodes.Ldloc, (object)localBuilder4);
			val3.labels.Add(label);
			CodeInstruction item = new CodeInstruction(OpCodes.Ldloc, (object)localBuilder4);
			CodeInstruction val4 = new CodeInstruction(OpCodes.Ldarg, (object)(short)3);
			val4.labels.Add(label2);
			List<CodeInstruction> list7 = new List<CodeInstruction>
			{
				new CodeInstruction(OpCodes.Ldloc, (object)shipDataRefLocal),
				new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo),
				new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
				new CodeInstruction(OpCodes.Ble, (object)label),
				new CodeInstruction(OpCodes.Ldloc, (object)shipDataRefLocal),
				new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo),
				new CodeInstruction(OpCodes.Ldarg, (object)(short)6),
				new CodeInstruction(OpCodes.Ldlen, (object)null),
				new CodeInstruction(OpCodes.Conv_I4, (object)null),
				new CodeInstruction(OpCodes.Bge, (object)label),
				new CodeInstruction(OpCodes.Ldarg, (object)(short)6),
				new CodeInstruction(OpCodes.Ldloc, (object)shipDataRefLocal),
				new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo),
				new CodeInstruction(OpCodes.Ldelem_Ref, (object)null),
				new CodeInstruction(OpCodes.Ldloc, (object)shipDataRefLocal),
				new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo),
				new CodeInstruction(OpCodes.Ldloc, (object)shipDataRefLocal),
				new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo2),
				new CodeInstruction(OpCodes.Ldloc, (object)shipDataRefLocal),
				new CodeInstruction(OpCodes.Ldfld, (object)fieldInfo3),
				new CodeInstruction(OpCodes.Call, (object)methodInfo2),
				new CodeInstruction(OpCodes.Brfalse, (object)label),
				item,
				new CodeInstruction(OpCodes.Stloc, (object)localBuilder),
				new CodeInstruction(OpCodes.Br, (object)label2),
				val3,
				new CodeInstruction(OpCodes.Ldc_R4, (object)value2),
				new CodeInstruction(OpCodes.Mul, (object)null),
				new CodeInstruction(OpCodes.Stloc, (object)localBuilder),
				val4,
				new CodeInstruction(OpCodes.Ldc_R4, (object)0.12f),
				new CodeInstruction(OpCodes.Mul, (object)null),
				new CodeInstruction(OpCodes.Ldloc, (object)localBuilder),
				new CodeInstruction(OpCodes.Mul, (object)null),
				new CodeInstruction(OpCodes.Stloc, (object)localBuilder2)
			};
			int num5 = num4 + 1;
			if (num5 < list6.Count && list6[num5].labels.Count > 0)
			{
				list7[0].labels.AddRange(list6[num5].labels);
				list6[num5].labels.Clear();
			}
			list6.InsertRange(num5, list7);
			Log.LogInfo((object)("运输船飞行段补丁已应用(普通航线 x" + value2 + ";轨道采集器关联航线往返均自动豁免;运行时识别状态将各记录一次)。"));
		}
		return list6;
	}
}