Decompiled source of a89792 edit v1.0.1

DSPmechaAttackRange10.dll

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

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("DSPmechaAttackRange10")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("DSPmechaAttackRange10")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d5364ec8-08bb-4001-8806-1e5b7ae8bc39")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.0", FrameworkDisplayName = ".NET Framework 4")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace DSPmechaAttackRange10;

[BepInPlugin("cn.a89792.DSPmechaAttackRange", "射程3倍", "1.0")]
[BepInProcess("DSPGAME.exe")]
public class a89792_edit1 : BaseUnityPlugin
{
	public const string GUID = "cn.a89792.DSPmechaAttackRange";

	public const string NAME = "射程3倍";

	public const string VERSION = "1.0";

	private const string GAME_PROCESS = "DSPGAME.exe";

	internal static ManualLogSource Logger;

	internal static ConfigFile Config;

	private Harmony harmony;

	public static ConfigEntry<bool> configEnableDebug;

	public static ConfigEntry<bool> configOre1;

	public static ConfigEntry<float> configMechaAttackRange;

	public static ConfigEntry<float> configDisturbRange;

	public static ConfigEntry<bool> configEnemyDamage;

	public static ConfigEntry<bool> configGammaEdit;

	public static ConfigEntry<int> configProducivity1;

	public static ConfigEntry<bool> configAllProducivity1;

	public static ConfigEntry<bool> configHandCraftSpeed;

	public static ConfigEntry<bool> configIncreaseRangeWithUpgrade;

	private static CodeMatch damageEdit1 = new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(DFGTurretDesc), "attackDamage"), (string)null);

	private static CodeMatch damageEdit2 = new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(DFGTurretDesc), "attackDamageInc"), (string)null);

	private static CodeMatch damageEdit3 = new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(DFSTurretDesc), "attackDamage"), (string)null);

	private static CodeMatch damageEdit4 = new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(DFSTurretDesc), "attackDamageInc"), (string)null);

	private static CodeMatch damageEdit5 = new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(EnemyUnitDesc), "attackDamage0"), (string)null);

	private static CodeMatch damageEdit6 = new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(EnemyUnitDesc), "attackDamageInc0"), (string)null);

	private static CodeMatch damageEdit7 = new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(EnemyUnitDesc), "attackDamage1"), (string)null);

	private static CodeMatch damageEdit8 = new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(EnemyUnitDesc), "attackDamageInc1"), (string)null);

	private static CodeMatch damageEdit9 = new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(EnemyUnitDesc), "attackDamage2"), (string)null);

	private static CodeMatch damageEdit10 = new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(EnemyUnitDesc), "attackDamageInc2"), (string)null);

	private void Awake()
	{
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Expected O, but got Unknown
		Logger = ((BaseUnityPlugin)this).Logger;
		Config = ((BaseUnityPlugin)this).Config;
		Logger.LogDebug((object)"Awake.");
		try
		{
			InitialConfigSetup();
		}
		catch (Exception ex)
		{
			Logger.LogError((object)("Awake不能载入设置" + ex.Message));
			throw ex;
		}
		try
		{
			harmony = new Harmony("cn.a89792.DSPmechaAttackRange");
			harmony.PatchAll(typeof(a89792_edit1));
		}
		catch (Exception ex2)
		{
			Logger.LogError((object)("Awake不能注入: " + ex2.Message));
			throw ex2;
		}
		Logger.LogInfo((object)"Awake初始化完毕");
	}

	public void InitialConfigSetup()
	{
		try
		{
			configEnableDebug = Config.Bind<bool>("Config", "是否调试", false, "是否输出log");
			configDisturbRange = Config.Bind<float>("Config", "干扰塔射程", 120f, "原版40");
			configOre1 = Config.Bind<bool>("Config", "挖矿不消耗", true, "挖矿不消耗");
			configGammaEdit = Config.Bind<bool>("Config", "锅超级暖机", true, "64倍暖机");
			configMechaAttackRange = Config.Bind<float>("Config", "机甲射程倍数", 3f, "机甲射程倍数");
			configProducivity1 = Config.Bind<int>("Config", "黄增产剂产能千分比", 9999, "原版125,注意耗电不跟随变化,别超过int");
			configHandCraftSpeed = Config.Bind<bool>("Config", "手搓10倍速", true, "手搓10倍速");
			configAllProducivity1 = Config.Bind<bool>("Config", "全配方产能", true, "比如制作黑棒");
			configEnemyDamage = Config.Bind<bool>("Config", "降低怪物攻击", true, "全是弱鸡");
			EditProliferator1();
		}
		catch (Exception ex)
		{
			Logger.LogError((object)("InitialConfigSetup - Bind Config: " + ex.Message));
			throw ex;
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(PlayerAction_Combat), "GetAmmoLocalAttackRange")]
	public static void PlayerAction_Combat_GetAmmoLocalAttackRange_Postfix(ref float __result)
	{
		__result = configMechaAttackRange.Value * __result;
	}

	[HarmonyPrefix]
	[HarmonyPatch(typeof(TurretComponent), "Shoot_Disturb")]
	public static void TurretComponent_Shoot_Disturb_Prefix(ref PrefabDesc pdesc)
	{
		pdesc.turretMaxAttackRange = configDisturbRange.Value;
	}

	private static void EditProliferator1()
	{
		EditValue1(ref Cargo.incTable);
		EditValue2(ref Cargo.incTableMilli);
	}

	private static void EditValue1(ref int[] incTable1)
	{
		int[] obj = new int[11]
		{
			0, 0, 200, 225, 250, 275, 300, 325, 350, 375,
			400
		};
		obj[1] = configProducivity1.Value;
		int[] array = obj;
		for (int i = 0; i < incTable1.Length; i++)
		{
			incTable1[i] = array[i];
		}
	}

	private static void EditValue2(ref double[] incTableMilli1)
	{
		double[] obj = new double[11]
		{
			0.0, 0.0, 0.2, 0.225, 0.25, 0.275, 0.3, 0.325, 0.35, 0.375,
			0.4
		};
		obj[1] = 0.001 * (double)configProducivity1.Value;
		double[] array = obj;
		for (int i = 0; i < incTableMilli1.Length; i++)
		{
			incTableMilli1[i] = array[i];
		}
	}

	[HarmonyPostfix]
	[HarmonyPatch(typeof(RecipeProto), "get_productive")]
	public static void RecipeProto_get_productive_Postfix(ref bool __result)
	{
		__result = true;
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(PrefabDesc), "ReadPrefab")]
	private static IEnumerable<CodeInstruction> EditDamage2(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		if (configEnemyDamage.Value)
		{
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { damageEdit2 }).Repeat((Action<CodeMatcher>)delegate(CodeMatcher codeMatcher)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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
				codeMatcher.RemoveInstruction().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5]
				{
					new CodeInstruction(OpCodes.Pop, (object)null),
					new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null)
				});
			}, (Action<string>)null);
			return val.InstructionEnumeration();
		}
		return instructions;
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(PrefabDesc), "ReadPrefab")]
	private static IEnumerable<CodeInstruction> EditDamage3(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		if (configEnemyDamage.Value)
		{
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { damageEdit3 }).Repeat((Action<CodeMatcher>)delegate(CodeMatcher codeMatcher)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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
				codeMatcher.RemoveInstruction().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5]
				{
					new CodeInstruction(OpCodes.Pop, (object)null),
					new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null)
				});
			}, (Action<string>)null);
			return val.InstructionEnumeration();
		}
		return instructions;
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(PrefabDesc), "ReadPrefab")]
	private static IEnumerable<CodeInstruction> EditDamage4(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		if (configEnemyDamage.Value)
		{
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { damageEdit4 }).Repeat((Action<CodeMatcher>)delegate(CodeMatcher codeMatcher)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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
				codeMatcher.RemoveInstruction().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5]
				{
					new CodeInstruction(OpCodes.Pop, (object)null),
					new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null)
				});
			}, (Action<string>)null);
			return val.InstructionEnumeration();
		}
		return instructions;
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(PrefabDesc), "ReadPrefab")]
	private static IEnumerable<CodeInstruction> EditDamage5(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		if (configEnemyDamage.Value)
		{
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { damageEdit5 }).Repeat((Action<CodeMatcher>)delegate(CodeMatcher codeMatcher)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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
				codeMatcher.RemoveInstruction().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5]
				{
					new CodeInstruction(OpCodes.Pop, (object)null),
					new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null)
				});
			}, (Action<string>)null);
			return val.InstructionEnumeration();
		}
		return instructions;
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(PrefabDesc), "ReadPrefab")]
	private static IEnumerable<CodeInstruction> EditDamage6(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		if (configEnemyDamage.Value)
		{
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { damageEdit6 }).Repeat((Action<CodeMatcher>)delegate(CodeMatcher codeMatcher)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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
				codeMatcher.RemoveInstruction().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5]
				{
					new CodeInstruction(OpCodes.Pop, (object)null),
					new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null)
				});
			}, (Action<string>)null);
			return val.InstructionEnumeration();
		}
		return instructions;
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(PrefabDesc), "ReadPrefab")]
	private static IEnumerable<CodeInstruction> EditDamage7(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		if (configEnemyDamage.Value)
		{
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { damageEdit7 }).Repeat((Action<CodeMatcher>)delegate(CodeMatcher codeMatcher)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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
				codeMatcher.RemoveInstruction().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5]
				{
					new CodeInstruction(OpCodes.Pop, (object)null),
					new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null)
				});
			}, (Action<string>)null);
			return val.InstructionEnumeration();
		}
		return instructions;
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(PrefabDesc), "ReadPrefab")]
	private static IEnumerable<CodeInstruction> EditDamage8(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		if (configEnemyDamage.Value)
		{
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { damageEdit8 }).Repeat((Action<CodeMatcher>)delegate(CodeMatcher codeMatcher)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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
				codeMatcher.RemoveInstruction().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5]
				{
					new CodeInstruction(OpCodes.Pop, (object)null),
					new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null)
				});
			}, (Action<string>)null);
			return val.InstructionEnumeration();
		}
		return instructions;
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(PrefabDesc), "ReadPrefab")]
	private static IEnumerable<CodeInstruction> EditDamage9(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		if (configEnemyDamage.Value)
		{
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { damageEdit9 }).Repeat((Action<CodeMatcher>)delegate(CodeMatcher codeMatcher)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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
				codeMatcher.RemoveInstruction().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5]
				{
					new CodeInstruction(OpCodes.Pop, (object)null),
					new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null)
				});
			}, (Action<string>)null);
			return val.InstructionEnumeration();
		}
		return instructions;
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(PrefabDesc), "ReadPrefab")]
	private static IEnumerable<CodeInstruction> EditDamage10(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		if (configEnemyDamage.Value)
		{
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { damageEdit10 }).Repeat((Action<CodeMatcher>)delegate(CodeMatcher codeMatcher)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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
				codeMatcher.RemoveInstruction().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5]
				{
					new CodeInstruction(OpCodes.Pop, (object)null),
					new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null)
				});
			}, (Action<string>)null);
			return val.InstructionEnumeration();
		}
		return instructions;
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(PrefabDesc), "ReadPrefab")]
	private static IEnumerable<CodeInstruction> EditDamage1(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		if (configEnemyDamage.Value)
		{
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1] { damageEdit1 }).Repeat((Action<CodeMatcher>)delegate(CodeMatcher codeMatcher)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_0022: Unknown result type (might be due to invalid IL or missing references)
				//IL_0028: Expected O, but got Unknown
				//IL_0030: Unknown result type (might be due to invalid IL or missing references)
				//IL_0036: Expected O, but got Unknown
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0044: 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
				codeMatcher.RemoveInstruction().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[5]
				{
					new CodeInstruction(OpCodes.Pop, (object)null),
					new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null),
					new CodeInstruction(OpCodes.Nop, (object)null)
				});
			}, (Action<string>)null);
			return val.InstructionEnumeration();
		}
		return instructions;
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(FactorySystem), "GameTick", new Type[]
	{
		typeof(long),
		typeof(bool)
	})]
	[HarmonyPatch(typeof(FactorySystem), "GameTick", new Type[]
	{
		typeof(long),
		typeof(bool),
		typeof(int),
		typeof(int),
		typeof(int)
	})]
	[HarmonyPatch(typeof(ItemProto), "GetPropValue")]
	[HarmonyPatch(typeof(PlanetTransport), "GameTick")]
	[HarmonyPatch(typeof(UIMinerWindow), "_OnUpdate")]
	[HarmonyPatch(typeof(UIMiningUpgradeLabel), "Update")]
	[HarmonyPatch(typeof(UIPlanetDetail), "OnPlanetDataSet")]
	[HarmonyPatch(typeof(UIPlanetDetail), "RefreshDynamicProperties")]
	[HarmonyPatch(typeof(UIStarDetail), "OnStarDataSet")]
	[HarmonyPatch(typeof(UIStarDetail), "RefreshDynamicProperties")]
	[HarmonyPatch(typeof(UIStationStorage), "RefreshValues")]
	[HarmonyPatch(typeof(UIVeinCollectorPanel), "_OnUpdate")]
	private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
	{
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0014: Expected O, but got Unknown
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		if (configOre1.Value)
		{
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(GameHistoryData), "miningCostRate"), (string)null)
			}).Repeat((Action<CodeMatcher>)delegate(CodeMatcher codeMatcher)
			{
				//IL_0014: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Expected O, but got Unknown
				//IL_002b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0031: Expected O, but got Unknown
				codeMatcher.RemoveInstruction().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Pop, (object)null),
					new CodeInstruction(OpCodes.Ldc_R4, (object)0f)
				});
			}, (Action<string>)null);
			return val.InstructionEnumeration();
		}
		return instructions;
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(MechaForge), "GameTick")]
	public static IEnumerable<CodeInstruction> HandCraftSpeed1(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = instructions.ToList();
		if (list[90].opcode != OpCodes.Ldc_R4)
		{
			Logger.LogInfo((object)"▲手搓函数变动");
			return list.AsEnumerable();
		}
		if (configHandCraftSpeed.Value)
		{
			list[90].operand = 100000f;
		}
		return list.AsEnumerable();
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(EjectorComponent), "InternalUpdate")]
	public static IEnumerable<CodeInstruction> RailGun1(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = instructions.ToList();
		if (list[461].opcode != OpCodes.Ldc_R8 || list[465].opcode != OpCodes.Ldc_R4)
		{
			Logger.LogInfo((object)"▲射帆函数变动");
			return list.AsEnumerable();
		}
		list[461].operand = 0.0;
		list[465].operand = 1f;
		return list.AsEnumerable();
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(PowerGeneratorComponent), "EnergyCap_Gamma_Req")]
	public static IEnumerable<CodeInstruction> Gamma1(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = instructions.ToList();
		if (list[59].opcode != OpCodes.Ldc_R4)
		{
			Logger.LogInfo((object)"▲暖机函数1变动");
			return list.AsEnumerable();
		}
		if (configGammaEdit.Value)
		{
			list[59].operand = 96f;
		}
		return list.AsEnumerable();
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(PowerGeneratorComponent), "MaxOutputCurrent_Gamma")]
	public static IEnumerable<CodeInstruction> Gamma2(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = instructions.ToList();
		if (list[9].opcode != OpCodes.Ldc_R4)
		{
			Logger.LogInfo((object)"▲暖机函数2变动");
			return list.AsEnumerable();
		}
		if (configGammaEdit.Value)
		{
			list[9].operand = 96f;
		}
		return list.AsEnumerable();
	}

	[HarmonyTranspiler]
	[HarmonyPatch(typeof(PowerGeneratorComponent), "RequiresCurrent_Gamma")]
	public static IEnumerable<CodeInstruction> Gamma3(IEnumerable<CodeInstruction> instructions)
	{
		List<CodeInstruction> list = instructions.ToList();
		if (list[11].opcode != OpCodes.Ldc_R4)
		{
			Logger.LogInfo((object)"▲暖机函数3变动");
			return list.AsEnumerable();
		}
		if (configGammaEdit.Value)
		{
			list[11].operand = 96f;
		}
		return list.AsEnumerable();
	}
}