Decompiled source of CheatEnabler v2.3.32

CheatEnabler.dll

Decompiled a month ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Threading;
using System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CheatEnabler.Functions;
using CheatEnabler.Patches;
using CommonAPI.Systems;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UXAssist.Common;
using UXAssist.Functions;
using UXAssist.UI;
using UnityEngine;
using UnityEngine.Bindings;
using UnityEngine.Events;
using UnityEngine.UI;

[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: AssemblyCompany("CheatEnabler")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("DSP MOD - CheatEnabler")]
[assembly: AssemblyFileVersion("2.3.32.0")]
[assembly: AssemblyInformationalVersion("2.3.32+4b632db315a5ef41a9754d9921d999cf327c4542")]
[assembly: AssemblyProduct("CheatEnabler")]
[assembly: AssemblyTitle("CheatEnabler")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.3.32.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace CheatEnabler
{
	[BepInPlugin("org.soardev.cheatenabler", "CheatEnabler", "2.3.32")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class CheatEnabler : BaseUnityPlugin
	{
		public static readonly ManualLogSource Logger = Logger.CreateLogSource("CheatEnabler");

		private Type[] _patches;

		private void Awake()
		{
			GamePatch.DevShortcutsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DevShortcuts", false, "Enable DevMode shortcuts");
			GamePatch.AbnormalDisablerEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "DisableAbnormalChecks", false, "disable all abnormal checks");
			GamePatch.UnlockTechEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "UnlockTech", false, "Unlock clicked tech by holding key-modifilers(Shift/Alt/Ctrl)");
			FactoryPatch.ImmediateEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "ImmediateBuild", false, "Build immediately");
			FactoryPatch.ArchitectModeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "Architect", false, "Architect Mode");
			FactoryPatch.NoConditionEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "BuildWithoutCondition", false, "Build without condition");
			FactoryPatch.NoCollisionEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "NoCollision", false, "No collision");
			FactoryPatch.BeltSignalGeneratorEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "BeltSignalGenerator", false, "Belt signal generator");
			FactoryPatch.BeltSignalNumberAltFormat = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "BeltSignalNumberFormat", false, "Belt signal number format alternative format (AAAA=generation speed in minutes, B=proliferate points, C=stack count):\n  AAAABC by default\n  BCAAAA as alternative");
			FactoryPatch.BeltSignalCountGenEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "BeltSignalCountGenerations", true, "Belt signal count generations as production in statistics");
			FactoryPatch.BeltSignalCountRemEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "BeltSignalCountRemovals", true, "Belt signal count removals as comsumption in statistics");
			FactoryPatch.BeltSignalCountRecipeEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "BeltSignalCountRecipe", false, "Belt signal count all raws and intermediates in statistics");
			FactoryPatch.RemovePowerSpaceLimitEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "RemovePowerDistanceLimit", false, "Remove distance limit for wind turbines and geothermals");
			FactoryPatch.BoostWindPowerEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "BoostWindPower", false, "Boost wind power");
			FactoryPatch.BoostSolarPowerEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "BoostSolarPower", false, "Boost solar power");
			FactoryPatch.BoostFuelPowerEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "BoostFuelPower", false, "Boost fuel power");
			FactoryPatch.BoostGeothermalPowerEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "BoostGeothermalPower", false, "Boost geothermal power");
			FactoryPatch.WindTurbinesPowerGlobalCoverageEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "PowerGlobalCoverage", false, "Global power coverage");
			FactoryPatch.GreaterPowerUsageInLogisticsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "GreaterPowerUsageInLogistics", false, "Increase maximum power usage in Logistic Stations and Advanced Mining Machines");
			FactoryPatch.ControlPanelRemoteLogisticsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "ControlPanelRemoteLogistics", false, "Retrieve/Place items from/to remote planets on logistics control panel");
			ResourcePatch.InfiniteResourceEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Planet", "AlwaysInfiniteResource", false, "always infinite natural resource");
			ResourcePatch.FastMiningEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Planet", "FastMining", false, "super-fast mining speed");
			PlanetPatch.WaterPumpAnywhereEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Planet", "WaterPumpAnywhere", false, "Can pump water anywhere (while water type is not None)");
			PlanetPatch.TerraformAnywayEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Planet", "TerraformAnyway", false, "Can do terraform without enough soil piless");
			PlayerPatch.InstantHandCraftEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "InstantHandCraft", false, "Enable instant hand-craft");
			PlayerPatch.InstantTeleportEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "InstantTeleport", false, "Enable instant teleport (like that in Sandbox mode)");
			PlayerPatch.WarpWithoutSpaceWarpersEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Player", "WarpWithoutWarper", false, "Enable warp without warper");
			DysonSpherePatch.SkipBulletEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DysonSphere", "SkipBullet", false, "Skip bullet");
			DysonSpherePatch.FireAllBulletsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DysonSphere", "FireAllBullets", false, "Fire all bullets at once");
			DysonSpherePatch.SkipAbsorbEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DysonSphere", "SkipAbsorb", false, "Skip absorption");
			DysonSpherePatch.QuickAbsorbEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DysonSphere", "QuickAbsorb", false, "Quick absorb");
			DysonSpherePatch.EjectAnywayEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DysonSphere", "EjectAnyway", false, "Eject anyway");
			DysonSpherePatch.OverclockEjectorEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DysonSphere", "OverclockEjector", false, "Overclock ejector");
			DysonSpherePatch.OverclockSiloEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DysonSphere", "OverclockSilo", false, "Overclock silo");
			DysonSpherePatch.UnlockMaxOrbitRadiusEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DysonSphere", "UnlockMaxOrbitRadius", false, "Unlock Dyson Sphere max orbit radius");
			DysonSpherePatch.UnlockMaxOrbitRadiusValue = ((BaseUnityPlugin)this).Config.Bind<float>("DysonSphere", "MaxOrbitRadiusValue", 10000000f, "Unlocked Dyson Sphere max orbit radius value");
			DysonSphereFunctions.IllegalDysonShellFunctionsEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("DysonSphere", "IllegalDysonShellFunctions", false, "Enable illegal dyson shell functions");
			DysonSphereFunctions.ShellsCountForFunctions = ((BaseUnityPlugin)this).Config.Bind<int>("DysonSphere", "ShellsCountForFunctions", 2048, "Shells count for various functions");
			CombatPatch.MechaInvincibleEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Battle", "MechaInvincible", false, "Mecha and Drones/Fleets invincible");
			CombatPatch.BuildingsInvincibleEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Battle", "BuildingsInvincible", false, "Buildings invincible");
			UIConfigWindow.Init();
			_patches = Util.GetTypesFiltered(Assembly.GetExecutingAssembly(), (Func<Type, bool>)((Type t) => string.Equals(t.Namespace, "CheatEnabler.Patches", StringComparison.Ordinal) || string.Equals(t.Namespace, "CheatEnabler.Functions", StringComparison.Ordinal)));
			Type[] patches = _patches;
			if (patches != null)
			{
				CollectionExtensions.Do<Type>((IEnumerable<Type>)patches, (Action<Type>)delegate(Type type)
				{
					type.GetMethod("Init")?.Invoke(null, null);
				});
			}
		}

		private void Start()
		{
			Type[] patches = _patches;
			if (patches != null)
			{
				CollectionExtensions.Do<Type>((IEnumerable<Type>)patches, (Action<Type>)delegate(Type type)
				{
					type.GetMethod("Start")?.Invoke(null, null);
				});
			}
		}

		private void OnDestroy()
		{
			Type[] patches = _patches;
			if (patches != null)
			{
				CollectionExtensions.Do<Type>((IEnumerable<Type>)patches, (Action<Type>)delegate(Type type)
				{
					type.GetMethod("Uninit")?.Invoke(null, null);
				});
			}
		}

		private void Update()
		{
			if (!VFInput.inputing)
			{
				FactoryPatch.OnInputUpdate();
			}
		}
	}
	public static class UIConfigWindow
	{
		private class MaxOrbitRadiusValueMapper : RangeValueMapper<float>
		{
			public MaxOrbitRadiusValueMapper()
				: base(1, 20)
			{
			}

			public override int ValueToIndex(float value)
			{
				int num = Mathf.FloorToInt(value / 500000f);
				if (num < 1)
				{
					num = 1;
				}
				if (num > 20)
				{
					num = 20;
				}
				return num;
			}

			public override float IndexToValue(int index)
			{
				return (float)index * 500000f;
			}
		}

		private class ShellsCountMapper : RangeValueMapper<int>
		{
			public ShellsCountMapper()
				: base(1, 139)
			{
			}

			public override int ValueToIndex(int value)
			{
				if (value < 256)
				{
					if (value >= 4)
					{
						if (value < 64)
						{
							return value / 4 + 3;
						}
						return value / 16 + 15;
					}
					return value;
				}
				if (value < 4096)
				{
					return value / 64 + 27;
				}
				return value / 256 + 75;
			}

			public override int IndexToValue(int index)
			{
				if (index < 31)
				{
					if (index >= 4)
					{
						if (index < 19)
						{
							return (index - 3) * 4;
						}
						return (index - 15) * 16;
					}
					return index;
				}
				if (index < 91)
				{
					return (index - 27) * 64;
				}
				return (index - 75) * 256;
			}
		}

		[CompilerGenerated]
		private static class <>O
		{
			public static Action<MyConfigWindow, RectTransform> <0>__CreateUI;

			public static Action <1>__UpdateUI;

			public static UnityAction <2>__RemoveAllMetadataConsumptions;

			public static UnityAction <3>__RemoveCurrentMetadataConsumptions;

			public static UnityAction <4>__ClearMetadataBanAchievements;

			public static UnityAction <5>__CompleteShellsInstantly;

			public static UnityAction <6>__TeleportToOuterSpace;

			public static UnityAction <7>__TeleportToSelectedAstronomical;
		}

		[Serializable]
		[CompilerGenerated]
		private sealed class <>c
		{
			public static readonly <>c <>9 = new <>c();

			public static UnityAction <>9__6_0;

			public static UnityAction <>9__6_3;

			public static UnityAction <>9__6_4;

			public static UnityAction <>9__6_5;

			public static UnityAction <>9__6_6;

			public static Response <>9__6_14;

			public static UnityAction <>9__6_9;

			public static Response <>9__6_15;

			public static UnityAction <>9__6_10;

			public static Response <>9__6_16;

			public static UnityAction <>9__6_11;

			internal void <CreateUI>b__6_0()
			{
				//IL_0005: Unknown result type (might be due to invalid IL or missing references)
				//IL_000a: Unknown result type (might be due to invalid IL or missing references)
				GameMain.data.account = AccountData.me;
			}

			internal void <CreateUI>b__6_3()
			{
				PlanetFunctions.BuryAllVeins(bury: true);
			}

			internal void <CreateUI>b__6_4()
			{
				PlanetFunctions.BuryAllVeins(bury: false);
			}

			internal void <CreateUI>b__6_5()
			{
				Player mainPlayer = GameMain.mainPlayer;
				if (mainPlayer != null)
				{
					BuildTool_Reform reformTool = mainPlayer.controller.actionBuild.reformTool;
					if (GameMain.localPlanet?.factory != null)
					{
						GameMain.localPlanet.factory.PlanetReformAll(reformTool.brushType, reformTool.brushColor, reformTool.buryVeins);
					}
				}
			}

			internal void <CreateUI>b__6_6()
			{
				if (GameMain.localPlanet?.factory != null)
				{
					GameMain.localPlanet.factory.PlanetReformRevert();
				}
			}

			internal void <CreateUI>b__6_9()
			{
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Expected O, but got Unknown
				string text = Localization.Translate("Generate illegal dyson shell");
				string text2 = Localization.Translate("WARNING: This operation can be very slow, continue?");
				string text3 = Localization.Translate("取消");
				string text4 = Localization.Translate("确定");
				object obj = <>9__6_14;
				if (obj == null)
				{
					Response val = delegate
					{
						DysonSphereFunctions.CreatePossibleFramesAndShells();
					};
					<>9__6_14 = val;
					obj = (object)val;
				}
				UIMessageBox.Show(text, text2, text3, text4, 1, (Response)null, (Response)obj);
			}

			internal void <CreateUI>b__6_14()
			{
				DysonSphereFunctions.CreatePossibleFramesAndShells();
			}

			internal void <CreateUI>b__6_10()
			{
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Expected O, but got Unknown
				string text = Localization.Translate("Keep max production shells and remove others");
				string text2 = Localization.Translate("WARNING: This operation is DANGEROUS, continue?");
				string text3 = Localization.Translate("取消");
				string text4 = Localization.Translate("确定");
				object obj = <>9__6_15;
				if (obj == null)
				{
					Response val = delegate
					{
						DysonSphereFunctions.KeepMaxProductionShells();
					};
					<>9__6_15 = val;
					obj = (object)val;
				}
				UIMessageBox.Show(text, text2, text3, text4, 1, (Response)null, (Response)obj);
			}

			internal void <CreateUI>b__6_15()
			{
				DysonSphereFunctions.KeepMaxProductionShells();
			}

			internal void <CreateUI>b__6_11()
			{
				//IL_003e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Unknown result type (might be due to invalid IL or missing references)
				//IL_0049: Expected O, but got Unknown
				string text = Localization.Translate("Duplicate shells from that with highest production");
				string text2 = Localization.Translate("WARNING: This operation can be very slow, continue?");
				string text3 = Localization.Translate("取消");
				string text4 = Localization.Translate("确定");
				object obj = <>9__6_16;
				if (obj == null)
				{
					Response val = delegate
					{
						DysonSphereFunctions.DuplicateShellsWithHighestProduction();
					};
					<>9__6_16 = val;
					obj = (object)val;
				}
				UIMessageBox.Show(text, text2, text3, text4, 1, (Response)null, (Response)obj);
			}

			internal void <CreateUI>b__6_16()
			{
				DysonSphereFunctions.DuplicateShellsWithHighestProduction();
			}
		}

		private static RectTransform _windowTrans;

		private static UIButton _resignGameBtn;

		private static UIButton _clearBanBtn;

		public static void Init()
		{
			I18N.Add("Factory", "Factory", "工厂");
			I18N.Add("Planet", "Planet", "行星");
			I18N.Add("Mecha/Combat", "Mecha/Combat", "机甲/战斗");
			I18N.Add("Enable Dev Shortcuts", "Enable Dev Shortcuts", "开发模式快捷键");
			I18N.Add("Disable Abnormal Checks", "Disable Abnormal Checks", "关闭数据异常检查");
			I18N.Add("Hotkey", "Hotkey", "快捷键");
			I18N.Add("Unlock Tech with Key-Modifiers", "Unlock Tech with Key-Modifiers", "使用组合键点击解锁科技");
			I18N.Add("Dev Shortcuts", "Dev Shortcuts", "开发模式快捷键");
			I18N.Add("Dev Shortcuts Tips", "Caution: Some function may trigger abnormal check!\nNumpad 1: Gets all items and extends bag.\nNumpad 2: Boosts walk speed, gathering speed and mecha energy restoration.\nNumpad 3: Fills planet with foundations and bury all veins.\nNumpad 4: +1 construction drone.\nNumpad 5: Upgrades drone engine tech to full.\nNumpad 6: Unlocks researching tech.\nNumpad 7: Unlocks Drive Engine 1.\nNumpad 8: Unlocks Drive Engine 2 and maximize energy.\nNumpad 9: Unlocks ability to warp.\nNumpad 0: No costs for Logistic Storages' output.\nLCtrl + T: Unlocks all techs (not upgrades).\nLCtrl + Q: Adds 10000 to every metadata.\nLCtrl + W: Enters Sandbox Mode.\nLCtrl + Shift + W: Leaves Sandbox Mode.\nNumpad *: Proliferates items on hand.\nNumpad /: Removes proliferations from items on hand.\nPageDown: Remembers Pose of game camera.\nPageUp: Locks game camera using remembered Pose.", "警告:某些功能可能触发异常检查!\n小键盘1:获得所有物品并扩展背包\n小键盘2:加快行走速度及采集速度,加快能量恢复速度\n小键盘3:将地基铺设整个星球并掩埋所有矿物\n小键盘4:建设机器人 +1\n小键盘5:建设机器人满级\n小键盘6:解锁当前科技\n小键盘7:解锁驱动技术I\n小键盘8:解锁驱动技术II 最大化能量\n小键盘9:机甲曲速解锁\n小键盘0:物流站通过传送带出物品无消耗\n左Ctrl + T:解锁所有非升级科技\n左Ctrl + Q:增加各项元数据10000点\n左Ctrl + W:进入沙盒模式\n左Ctrl + Shift + W:离开沙盒模式\n小键盘乘号 *:给手上物品喷涂增产剂\n小键盘除号 /:清除手上物品的增产剂\nPageDown:记录摄像机当前的Pose\nPageUp:用记录的Pose锁定摄像机");
			I18N.Add("Unlock Tech with Key-Modifiers Tips", "Click tech on tree while holding:\n  Shift: Tech level + 1\n  Ctrl: Tech level + 10\n  Ctrl + Shift: Tech level + 100\n  Alt: Tech level to MAX\n\nNote: all direct prerequisites will be unlocked as well.", "按住以下组合键点击科技树:\n  Shift:科技等级+1\n  Ctrl:科技等级+10\n  Ctrl+Shift:科技等级+100\n  Alt:科技等级升到最大\n\n注意:所有直接前置科技也会被解锁");
			I18N.Add("Remove all metadata consumption records", "Remove all metadata consumption records", "移除所有元数据消耗记录");
			I18N.Add("Remove metadata consumption record in current game", "Remove metadata consumption record in current game", "移除当前存档的元数据消耗记录");
			I18N.Add("Clear metadata flag which bans achievements", "Clear metadata flag which bans achievements in current game", "解除当前存档因使用元数据导致的成就限制");
			I18N.Add("Assign gamesave to current account", "Assign gamesave to current account", "将游戏存档绑定给当前账号");
			I18N.Add("Finish build immediately", "Finish build immediately", "建造秒完成");
			I18N.Add("Architect mode", "Architect mode", "建筑师模式");
			I18N.Add("Build without condition", "Build without condition check", "无条件建造");
			I18N.Add("No collision", "No collision", "无碰撞");
			I18N.Add("Belt signal generator", "Belt signal generator", "传送带信号物品生成");
			I18N.Add("Belt signal alt format", "Belt signal alt format", "传送带信号替换格式");
			I18N.Add("Belt signal alt format tips", "Belt signal number format alternative format:\n  AAAABC by default\n  BCAAAA as alternative\nAAAA=generation speed in minutes, B=proliferate points, C=stack count", "传送带信号物品生成数量格式:\n  默认为AAAABC\n  勾选替换为BCAAAA\nAAAA=生成速度,B=增产点数,C=堆叠数量");
			I18N.Add("Count generations as production in statistics", "Count generations as production in statistics", "统计信息里将生成计算为产物");
			I18N.Add("Count removals as consumption in statistics", "Count removals as consumption in statistics", "统计信息里将移除计算为消耗");
			I18N.Add("Count all raws and intermediates in statistics", "Count all raw materials in statistics", "统计信息里计算所有原料和中间产物");
			I18N.Add("Remove power space limit", "Remove space limit for winds and geothermals", "移除风力发电和地热发电的间距限制");
			I18N.Add("Boost wind power", "Boost wind power(x100,000)", "提升风力发电(x100,000)");
			I18N.Add("Boost solar power", "Boost solar power(x100,000)", "提升太阳能发电(x100,000)");
			I18N.Add("Boost fuel power", "Boost fuel power(x50,000)", "提升燃料发电(x50,000)");
			I18N.Add("Boost fuel power 2", "(x20,000 for deuteron, x10,000 for antimatter)", "(氘核燃料棒x20,000,反物质燃料棒x10,000)");
			I18N.Add("Wind Turbines do global power coverage", "Wind Turbines do global power coverage", "风力涡轮机供电覆盖全球");
			I18N.Add("Boost geothermal power", "Boost geothermal power(x50,000)", "提升地热发电(x50,000)");
			I18N.Add("Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "Increase maximum power usage in Logistic Stations and Advanced Mining Machines", "提升物流塔和大型采矿机的最大功耗");
			I18N.Add("Retrieve/Place items from/to remote planets on logistics control panel", "Retrieve/Place items from/to remote planets on logistics control panel", "在物流总控面板上可以从非本地行星取放物品");
			I18N.Add("Infinite Natural Resources", "Infinite natural resources", "自然资源采集不消耗");
			I18N.Add("Fast Mining", "Fast mining", "高速采集");
			I18N.Add("Pump Anywhere", "Pump anywhere", "平地抽水");
			I18N.Add("Skip bullet period", "Skip bullet period", "跳过子弹阶段");
			I18N.Add("Fire all bullets at once", "Fire all bullets at once", "一次弹射所有太阳帆");
			I18N.Add("Skip absorption period", "Skip absorption period", "跳过吸收阶段");
			I18N.Add("Quick absorb", "Quick absorb", "快速吸收");
			I18N.Add("Eject anyway", "Eject anyway", "全球弹射");
			I18N.Add("Overclock Ejectors", "Overclock Ejectors (10x)", "高速弹射器(10倍射速)");
			I18N.Add("Overclock Silos", "Overclock Silos (10x)", "高速发射井(10倍射速)");
			I18N.Add("Unlock Dyson Sphere max orbit radius", "Unlock Dyson Sphere max orbit radius", "解锁戴森球最大轨道半径");
			I18N.Add("Complete Dyson Sphere shells instantly", "Complete Dyson Sphere shells instantly", "立即完成戴森壳建造");
			I18N.Add("Generate illegal dyson shell", "Generate an illegal dyson shell (Put/Paste nodes first)", "生成单层仙术戴森壳(请先设置/粘贴节点)");
			I18N.Add("Keep max production shells and remove others", "Keep max production shells and remove others", "保留发电量最高的戴森壳并移除其他戴森壳");
			I18N.Add("Duplicate shells from that with highest production", "Duplicate shells from that with highest production", "从发电量最高的壳复制戴森壳");
			I18N.Add("WARNING: This operation can be very slow, continue?", "WARNING: This operation can be very slow, continue?", "警告:此操作可能非常慢,继续吗?");
			I18N.Add("WARNING: This operation is DANGEROUS, continue?", "WARNING: This operation is DANGEROUS, continue?", "警告:此操作非常危险,继续吗?");
			I18N.Add("Terraform without enough soil piles", "Terraform without enough soil piles", "沙土不够时依然可以整改地形");
			I18N.Add("Instant hand-craft", "Instant hand-craft", "快速手动制造");
			I18N.Add("Instant teleport (like that in Sandbox mode)", "Instant teleport (like that in Sandbox mode)", "快速传送(和沙盒模式一样)");
			I18N.Add("Mecha and Drones/Fleets invicible", "Mecha and Drones/Fleets invicible", "机甲和战斗无人机无敌");
			I18N.Add("Buildings invicible", "Buildings invincible", "建筑无敌");
			I18N.Add("Enable warp without space warpers", "Enable warp without space warpers", "无需空间翘曲器即可曲速飞行");
			I18N.Add("Teleport to outer space", "Teleport to outer space", "传送到外太空");
			I18N.Add("Teleport to selected astronomical", "Teleport to selected astronomical", "传送到选中的天体");
			I18N.Apply();
			MyConfigWindow.OnUICreated = (Action<MyConfigWindow, RectTransform>)Delegate.Combine(MyConfigWindow.OnUICreated, new Action<MyConfigWindow, RectTransform>(CreateUI));
			MyConfigWindow.OnUpdateUI = (Action)Delegate.Combine(MyConfigWindow.OnUpdateUI, new Action(UpdateUI));
		}

		private static void CreateUI(MyConfigWindow wnd, RectTransform trans)
		{
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			//IL_017d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Expected O, but got Unknown
			//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c6: Expected O, but got Unknown
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_020a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Expected O, but got Unknown
			//IL_0600: Unknown result type (might be due to invalid IL or missing references)
			//IL_0605: Unknown result type (might be due to invalid IL or missing references)
			//IL_060b: Expected O, but got Unknown
			//IL_0643: Unknown result type (might be due to invalid IL or missing references)
			//IL_0648: Unknown result type (might be due to invalid IL or missing references)
			//IL_064e: Expected O, but got Unknown
			//IL_0686: Unknown result type (might be due to invalid IL or missing references)
			//IL_068b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0691: Expected O, but got Unknown
			//IL_06c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_06d4: Expected O, but got Unknown
			//IL_089c: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_08a7: Expected O, but got Unknown
			//IL_08e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f3: Expected O, but got Unknown
			//IL_0931: Unknown result type (might be due to invalid IL or missing references)
			//IL_0936: Unknown result type (might be due to invalid IL or missing references)
			//IL_093c: Expected O, but got Unknown
			//IL_097a: Unknown result type (might be due to invalid IL or missing references)
			//IL_097f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0985: Expected O, but got Unknown
			//IL_0a9a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa5: Expected O, but got Unknown
			//IL_0ad9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ade: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae4: Expected O, but got Unknown
			_windowTrans = trans;
			float num = 0f;
			float num2 = 10f;
			((MyWindowWithTabs)wnd).AddSplitter(trans, 10f);
			((MyWindowWithTabs)wnd).AddTabGroup(trans, "Cheat Enabler", "tab-group-cheatenabler");
			RectTransform val = ((MyWindowWithTabs)wnd).AddTab(_windowTrans, "General");
			MyCheckBox val2 = ((MyWindow)wnd).AddCheckBox(num, num2, val, GamePatch.DevShortcutsEnabled, "Enable Dev Shortcuts", 15);
			num += val2.Width + 5f;
			num2 += 6f;
			((MyWindow)wnd).AddTipsButton2(num, num2, val, "Dev Shortcuts", "Dev Shortcuts Tips", "dev-shortcuts-tips", "tips-button");
			num = 0f;
			num2 += 30f;
			((MyWindow)wnd).AddCheckBox(num, num2, val, GamePatch.AbnormalDisablerEnabled, "Disable Abnormal Checks", 15);
			num2 += 36f;
			val2 = ((MyWindow)wnd).AddCheckBox(num, num2, val, GamePatch.UnlockTechEnabled, "Unlock Tech with Key-Modifiers", 15);
			num += val2.Width + 5f;
			num2 += 6f;
			((MyWindow)wnd).AddTipsButton2(num, num2, val, "Unlock Tech with Key-Modifiers", "Unlock Tech with Key-Modifiers Tips", "unlock-tech-tips", "tips-button");
			num = 0f;
			num2 += 66f;
			float num3 = num;
			float num4 = num2;
			object obj = <>O.<2>__RemoveAllMetadataConsumptions;
			if (obj == null)
			{
				UnityAction val3 = PlayerFunctions.RemoveAllMetadataConsumptions;
				<>O.<2>__RemoveAllMetadataConsumptions = val3;
				obj = (object)val3;
			}
			((MyWindow)wnd).AddButton(num3, num4, 400f, val, "Remove all metadata consumption records", 16, "button-remove-all-metadata-consumption", (UnityAction)obj);
			num2 += 36f;
			float num5 = num;
			float num6 = num2;
			object obj2 = <>O.<3>__RemoveCurrentMetadataConsumptions;
			if (obj2 == null)
			{
				UnityAction val4 = PlayerFunctions.RemoveCurrentMetadataConsumptions;
				<>O.<3>__RemoveCurrentMetadataConsumptions = val4;
				obj2 = (object)val4;
			}
			((MyWindow)wnd).AddButton(num5, num6, 400f, val, "Remove metadata consumption record in current game", 16, "button-remove-current-metadata-consumption", (UnityAction)obj2);
			num2 += 36f;
			float num7 = num;
			float num8 = num2;
			object obj3 = <>O.<4>__ClearMetadataBanAchievements;
			if (obj3 == null)
			{
				UnityAction val5 = PlayerFunctions.ClearMetadataBanAchievements;
				<>O.<4>__ClearMetadataBanAchievements = val5;
				obj3 = (object)val5;
			}
			_clearBanBtn = ((MyWindow)wnd).AddButton(num7, num8, 400f, val, "Clear metadata flag which bans achievements", 16, "button-clear-ban-list", (UnityAction)obj3);
			num = 300f;
			num2 = 10f;
			float num9 = num;
			float num10 = num2;
			object obj4 = <>c.<>9__6_0;
			if (obj4 == null)
			{
				UnityAction val6 = delegate
				{
					//IL_0005: Unknown result type (might be due to invalid IL or missing references)
					//IL_000a: Unknown result type (might be due to invalid IL or missing references)
					GameMain.data.account = AccountData.me;
				};
				<>c.<>9__6_0 = val6;
				obj4 = (object)val6;
			}
			_resignGameBtn = ((MyWindow)wnd).AddButton(num9, num10, 300f, val, "Assign gamesave to current account", 16, "resign-game-btn", (UnityAction)obj4);
			RectTransform val7 = ((MyWindowWithTabs)wnd).AddTab(_windowTrans, "Factory");
			num = 0f;
			num2 = 10f;
			((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.ImmediateEnabled, "Finish build immediately", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.ArchitectModeEnabled, "Architect mode", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.NoConditionEnabled, "Build without condition", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.NoCollisionEnabled, "No collision", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.BeltSignalGeneratorEnabled, "Belt signal generator", 15);
			num += 26f;
			num2 += 26f;
			MyCheckBox cb1 = ((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.BeltSignalCountGenEnabled, "Count generations as production in statistics", 13);
			num2 += 26f;
			MyCheckBox cb2 = ((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.BeltSignalCountRemEnabled, "Count removals as consumption in statistics", 13);
			num2 += 26f;
			MyCheckBox cb3 = ((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.BeltSignalCountRecipeEnabled, "Count all raws and intermediates in statistics", 13);
			num2 += 26f;
			MyCheckBox cb4 = ((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.BeltSignalNumberAltFormat, "Belt signal alt format", 13);
			num += cb4.Width + 5f;
			num2 += 6f;
			UIButton tip1 = ((MyWindow)wnd).AddTipsButton2(num, num2, val7, "Belt signal alt format", "Belt signal alt format tips", "belt-signal-alt-format-tips", "tips-button");
			num = 0f;
			num2 += 30f;
			((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.GreaterPowerUsageInLogisticsEnabled, "Increase maximum power usage in Logistic Stations and Advanced Mining Machines", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.ControlPanelRemoteLogisticsEnabled, "Retrieve/Place items from/to remote planets on logistics control panel", 15);
			FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged += OnBeltSignalChanged;
			((MyWindow)wnd).OnFree += delegate
			{
				FactoryPatch.BeltSignalGeneratorEnabled.SettingChanged -= OnBeltSignalChanged;
			};
			OnBeltSignalChanged(null, null);
			num = 350f;
			num2 = 10f;
			((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.RemovePowerSpaceLimitEnabled, "Remove power space limit", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.WindTurbinesPowerGlobalCoverageEnabled, "Wind Turbines do global power coverage", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.BoostWindPowerEnabled, "Boost wind power", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.BoostSolarPowerEnabled, "Boost solar power", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.BoostGeothermalPowerEnabled, "Boost geothermal power", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.BoostFuelPowerEnabled, "Boost fuel power", 15);
			num2 += 26f;
			((MyWindow)wnd).AddText2(num + 32f, num2, val7, "Boost fuel power 2", 13, "label");
			RectTransform val8 = ((MyWindowWithTabs)wnd).AddTab(_windowTrans, "Planet");
			num = 0f;
			num2 = 10f;
			((MyWindow)wnd).AddCheckBox(num, num2, val8, ResourcePatch.InfiniteResourceEnabled, "Infinite Natural Resources", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val8, ResourcePatch.FastMiningEnabled, "Fast Mining", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val8, PlanetPatch.WaterPumpAnywhereEnabled, "Pump Anywhere", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val8, PlanetPatch.TerraformAnywayEnabled, "Terraform without enough soil piles", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val8, PlayerPatch.InstantHandCraftEnabled, "Instant hand-craft", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val8, PlayerPatch.InstantTeleportEnabled, "Instant teleport (like that in Sandbox mode)", 15);
			num = 400f;
			num2 = 10f;
			float num11 = num;
			float num12 = num2;
			object obj5 = <>c.<>9__6_3;
			if (obj5 == null)
			{
				UnityAction val9 = delegate
				{
					PlanetFunctions.BuryAllVeins(bury: true);
				};
				<>c.<>9__6_3 = val9;
				obj5 = (object)val9;
			}
			((MyWindow)wnd).AddButton(num11, num12, 200f, val8, "矿物掩埋标题", 16, "button-bury-all", (UnityAction)obj5);
			num2 += 36f;
			float num13 = num;
			float num14 = num2;
			object obj6 = <>c.<>9__6_4;
			if (obj6 == null)
			{
				UnityAction val10 = delegate
				{
					PlanetFunctions.BuryAllVeins(bury: false);
				};
				<>c.<>9__6_4 = val10;
				obj6 = (object)val10;
			}
			((MyWindow)wnd).AddButton(num13, num14, 200f, val8, "矿物还原标题", 16, "button-bury-restore-all", (UnityAction)obj6);
			num2 += 36f;
			float num15 = num;
			float num16 = num2;
			object obj7 = <>c.<>9__6_5;
			if (obj7 == null)
			{
				UnityAction val11 = delegate
				{
					Player mainPlayer = GameMain.mainPlayer;
					if (mainPlayer != null)
					{
						BuildTool_Reform reformTool = mainPlayer.controller.actionBuild.reformTool;
						if (GameMain.localPlanet?.factory != null)
						{
							GameMain.localPlanet.factory.PlanetReformAll(reformTool.brushType, reformTool.brushColor, reformTool.buryVeins);
						}
					}
				};
				<>c.<>9__6_5 = val11;
				obj7 = (object)val11;
			}
			((MyWindow)wnd).AddButton(num15, num16, 200f, val8, "铺满地基提示", 16, "button-reform-all", (UnityAction)obj7);
			num2 += 36f;
			float num17 = num;
			float num18 = num2;
			object obj8 = <>c.<>9__6_6;
			if (obj8 == null)
			{
				UnityAction val12 = delegate
				{
					if (GameMain.localPlanet?.factory != null)
					{
						GameMain.localPlanet.factory.PlanetReformRevert();
					}
				};
				<>c.<>9__6_6 = val12;
				obj8 = (object)val12;
			}
			((MyWindow)wnd).AddButton(num17, num18, 200f, val8, "还原地形提示", 16, "button-reform-revert-all", (UnityAction)obj8);
			RectTransform val13 = ((MyWindowWithTabs)wnd).AddTab(_windowTrans, "Dyson Sphere");
			num = 0f;
			num2 = 10f;
			((MyWindow)wnd).AddCheckBox(num, num2, val13, DysonSpherePatch.SkipBulletEnabled, "Skip bullet period", 15);
			num2 += 26f;
			((MyWindow)wnd).AddCheckBox(num + 26f, num2, val13, DysonSpherePatch.FireAllBulletsEnabled, "Fire all bullets at once", 13);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val13, DysonSpherePatch.SkipAbsorbEnabled, "Skip absorption period", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val13, DysonSpherePatch.QuickAbsorbEnabled, "Quick absorb", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val13, DysonSpherePatch.EjectAnywayEnabled, "Eject anyway", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val13, DysonSpherePatch.OverclockEjectorEnabled, "Overclock Ejectors", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val13, DysonSpherePatch.OverclockSiloEnabled, "Overclock Silos", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val13, DysonSpherePatch.UnlockMaxOrbitRadiusEnabled, "Unlock Dyson Sphere max orbit radius", 15);
			num2 += 30f;
			MySlider slider = ((MyWindow)wnd).AddSlider<float>(num + 20f, num2, val13, DysonSpherePatch.UnlockMaxOrbitRadiusValue, (ValueMapper<float>)(object)new MaxOrbitRadiusValueMapper(), "##,#m", 0f).WithSmallerHandle(-40f, 0f);
			DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged += UnlockMaxOrbitRadiusChanged;
			((MyWindow)wnd).OnFree += delegate
			{
				DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.SettingChanged -= UnlockMaxOrbitRadiusChanged;
			};
			UnlockMaxOrbitRadiusChanged(null, null);
			num = 300f;
			num2 = 10f;
			float num19 = num;
			float num20 = num2;
			object obj9 = <>O.<5>__CompleteShellsInstantly;
			if (obj9 == null)
			{
				UnityAction val14 = DysonSphereFunctions.CompleteShellsInstantly;
				<>O.<5>__CompleteShellsInstantly = val14;
				obj9 = (object)val14;
			}
			((MyWindow)wnd).AddButton(num19, num20, 300f, val13, "Complete Dyson Sphere shells instantly", 16, "button-complete-dyson-sphere-shells-instantly", (UnityAction)obj9);
			num2 += 72f;
			float num21 = num;
			float num22 = num2;
			object obj10 = <>c.<>9__6_9;
			if (obj10 == null)
			{
				UnityAction val15 = delegate
				{
					//IL_003e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0043: Unknown result type (might be due to invalid IL or missing references)
					//IL_0049: Expected O, but got Unknown
					string text9 = Localization.Translate("Generate illegal dyson shell");
					string text10 = Localization.Translate("WARNING: This operation can be very slow, continue?");
					string text11 = Localization.Translate("取消");
					string text12 = Localization.Translate("确定");
					object obj17 = <>c.<>9__6_14;
					if (obj17 == null)
					{
						Response val23 = delegate
						{
							DysonSphereFunctions.CreatePossibleFramesAndShells();
						};
						<>c.<>9__6_14 = val23;
						obj17 = (object)val23;
					}
					UIMessageBox.Show(text9, text10, text11, text12, 1, (Response)null, (Response)obj17);
				};
				<>c.<>9__6_9 = val15;
				obj10 = (object)val15;
			}
			UIButton btn1 = ((MyWindow)wnd).AddButton(num21, num22, 300f, val13, "Generate illegal dyson shell", 16, "button-generate-illegal-dyson-shells", (UnityAction)obj10);
			num2 += 36f;
			float num23 = num;
			float num24 = num2;
			object obj11 = <>c.<>9__6_10;
			if (obj11 == null)
			{
				UnityAction val16 = delegate
				{
					//IL_003e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0043: Unknown result type (might be due to invalid IL or missing references)
					//IL_0049: Expected O, but got Unknown
					string text5 = Localization.Translate("Keep max production shells and remove others");
					string text6 = Localization.Translate("WARNING: This operation is DANGEROUS, continue?");
					string text7 = Localization.Translate("取消");
					string text8 = Localization.Translate("确定");
					object obj16 = <>c.<>9__6_15;
					if (obj16 == null)
					{
						Response val22 = delegate
						{
							DysonSphereFunctions.KeepMaxProductionShells();
						};
						<>c.<>9__6_15 = val22;
						obj16 = (object)val22;
					}
					UIMessageBox.Show(text5, text6, text7, text8, 1, (Response)null, (Response)obj16);
				};
				<>c.<>9__6_10 = val16;
				obj11 = (object)val16;
			}
			UIButton btn2 = ((MyWindow)wnd).AddButton(num23, num24, 300f, val13, "Keep max production shells and remove others", 16, "button-keep-max-production-shells", (UnityAction)obj11);
			num2 += 36f;
			float num25 = num;
			float num26 = num2;
			object obj12 = <>c.<>9__6_11;
			if (obj12 == null)
			{
				UnityAction val17 = delegate
				{
					//IL_003e: Unknown result type (might be due to invalid IL or missing references)
					//IL_0043: Unknown result type (might be due to invalid IL or missing references)
					//IL_0049: Expected O, but got Unknown
					string text = Localization.Translate("Duplicate shells from that with highest production");
					string text2 = Localization.Translate("WARNING: This operation can be very slow, continue?");
					string text3 = Localization.Translate("取消");
					string text4 = Localization.Translate("确定");
					object obj15 = <>c.<>9__6_16;
					if (obj15 == null)
					{
						Response val21 = delegate
						{
							DysonSphereFunctions.DuplicateShellsWithHighestProduction();
						};
						<>c.<>9__6_16 = val21;
						obj15 = (object)val21;
					}
					UIMessageBox.Show(text, text2, text3, text4, 1, (Response)null, (Response)obj15);
				};
				<>c.<>9__6_11 = val17;
				obj12 = (object)val17;
			}
			UIButton btn3 = ((MyWindow)wnd).AddButton(num25, num26, 300f, val13, "Duplicate shells from that with highest production", 16, "button-duplicate-shells-from-the-highest-production", (UnityAction)obj12);
			num2 += 30f;
			MySlider slider2 = ((MyWindow)wnd).AddSlider<int>(num + 20f, num2, val13, DysonSphereFunctions.ShellsCountForFunctions, (ValueMapper<int>)(object)new ShellsCountMapper(), "G", 0f);
			DysonSphereFunctions.IllegalDysonShellFunctionsEnabled.SettingChanged += onIllegalDysonShellFunctionsChanged;
			((MyWindow)wnd).OnFree += delegate
			{
				DysonSphereFunctions.IllegalDysonShellFunctionsEnabled.SettingChanged -= onIllegalDysonShellFunctionsChanged;
			};
			onIllegalDysonShellFunctionsChanged(null, null);
			RectTransform val18 = ((MyWindowWithTabs)wnd).AddTab(_windowTrans, "Mecha/Combat");
			num = 0f;
			num2 = 10f;
			((MyWindow)wnd).AddCheckBox(num, num2, val18, CombatPatch.MechaInvincibleEnabled, "Mecha and Drones/Fleets invicible", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val18, CombatPatch.BuildingsInvincibleEnabled, "Buildings invicible", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val18, PlayerPatch.WarpWithoutSpaceWarpersEnabled, "Enable warp without space warpers", 15);
			num = 400f;
			num2 = 10f;
			float num27 = num;
			float num28 = num2;
			object obj13 = <>O.<6>__TeleportToOuterSpace;
			if (obj13 == null)
			{
				UnityAction val19 = PlayerFunctions.TeleportToOuterSpace;
				<>O.<6>__TeleportToOuterSpace = val19;
				obj13 = (object)val19;
			}
			((MyWindow)wnd).AddButton(num27, num28, 200f, val18, "Teleport to outer space", 16, "button-teleport-to-outer-space", (UnityAction)obj13);
			num2 += 36f;
			float num29 = num;
			float num30 = num2;
			object obj14 = <>O.<7>__TeleportToSelectedAstronomical;
			if (obj14 == null)
			{
				UnityAction val20 = PlayerFunctions.TeleportToSelectedAstronomical;
				<>O.<7>__TeleportToSelectedAstronomical = val20;
				obj14 = (object)val20;
			}
			((MyWindow)wnd).AddButton(num29, num30, 200f, val18, "Teleport to selected astronomical", 16, "button-teleport-to-selected-astronomical", (UnityAction)obj14);
			void OnBeltSignalChanged(object o, EventArgs e)
			{
				bool value2 = FactoryPatch.BeltSignalGeneratorEnabled.Value;
				((Component)cb1).gameObject.SetActive(value2);
				((Component)cb2).gameObject.SetActive(value2);
				((Component)cb3).gameObject.SetActive(value2);
				((Component)cb4).gameObject.SetActive(value2);
				((Component)tip1).gameObject.SetActive(value2);
			}
			void UnlockMaxOrbitRadiusChanged(object o, EventArgs e)
			{
				((Behaviour)slider.slider).enabled = DysonSpherePatch.UnlockMaxOrbitRadiusEnabled.Value;
			}
			void onIllegalDysonShellFunctionsChanged(object o, EventArgs e)
			{
				bool value = DysonSphereFunctions.IllegalDysonShellFunctionsEnabled.Value;
				((Component)btn1).gameObject.SetActive(value);
				((Component)btn2).gameObject.SetActive(value);
				((Component)btn3).gameObject.SetActive(value);
				((Component)slider2).gameObject.SetActive(value);
			}
		}

		private static void UpdateUI()
		{
			UpdateButtons();
		}

		private static void UpdateButtons()
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			GameData data = GameMain.data;
			if (data == null)
			{
				return;
			}
			bool flag = data.account != AccountData.me;
			if (((Component)_resignGameBtn).gameObject.activeSelf != flag)
			{
				((Component)_resignGameBtn).gameObject.SetActive(flag);
			}
			GameHistoryData history = data.history;
			if (history != null)
			{
				bool hasUsedPropertyBanAchievement = history.hasUsedPropertyBanAchievement;
				if (((Component)_clearBanBtn).gameObject.activeSelf != hasUsedPropertyBanAchievement)
				{
					((Component)_clearBanBtn).gameObject.SetActive(hasUsedPropertyBanAchievement);
				}
			}
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "org.soardev.cheatenabler";

		public const string PLUGIN_NAME = "CheatEnabler";

		public const string PLUGIN_VERSION = "2.3.32";
	}
}
namespace CheatEnabler.Patches
{
	public static class CombatPatch
	{
		private class MechaInvincible : PatchImpl<MechaInvincible>
		{
			[HarmonyTranspiler]
			[HarmonyPatch(/*Could not decode attribute arguments.*/)]
			private static IEnumerable<CodeInstruction> Player_get_invincible_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Expected O, but got Unknown
				//IL_0035: Unknown result type (might be due to invalid IL or missing references)
				//IL_003b: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				val.Start().RemoveInstructions(val.Length).Insert((CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
					new CodeInstruction(OpCodes.Ret, (object)null)
				});
				return val.InstructionEnumeration();
			}

			[HarmonyTranspiler]
			[HarmonyPatch(typeof(SkillSystem), "DamageGroundObjectByLocalCaster")]
			[HarmonyPatch(typeof(SkillSystem), "DamageGroundObjectByRemoteCaster")]
			[HarmonyPatch(typeof(SkillSystem), "DamageObject")]
			private static IEnumerable<CodeInstruction> SkillSystem_DamageObject_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator, MethodBase __originalMethod)
			{
				//IL_000f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0015: Expected O, but got Unknown
				//IL_003f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0045: Expected O, but got Unknown
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_006c: Expected O, but got Unknown
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Expected O, but got Unknown
				//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a8: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[4]
				{
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ci) => CodeInstructionExtensions.IsLdarg(ci, (int?)null)), (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(SkillTargetLocal), "type"), (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldc_I4_6, (object)null, (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ci) => ci.opcode == OpCodes.Bne_Un || ci.opcode == OpCodes.Bne_Un_S), (string)null)
				});
				val.Repeat((Action<CodeMatcher>)delegate(CodeMatcher m)
				{
					//IL_0015: Unknown result type (might be due to invalid IL or missing references)
					//IL_001b: Expected O, but got Unknown
					//IL_0042: Unknown result type (might be due to invalid IL or missing references)
					//IL_0048: Expected O, but got Unknown
					m.Advance(4).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
					{
						new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
						new CodeInstruction(OpCodes.Starg_S, (object)((__originalMethod.Name == "DamageObject") ? 1 : 2))
					});
				}, (Action<string>)null);
				return val.InstructionEnumeration();
			}
		}

		private class BuildingsInvincible : PatchImpl<BuildingsInvincible>
		{
			[HarmonyTranspiler]
			[HarmonyPatch(typeof(SkillSystem), "DamageGroundObjectByLocalCaster")]
			[HarmonyPatch(typeof(SkillSystem), "DamageGroundObjectByRemoteCaster")]
			private static IEnumerable<CodeInstruction> SkillSystem_DamageObject_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0032: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Expected O, but got Unknown
				//IL_0059: Unknown result type (might be due to invalid IL or missing references)
				//IL_005f: Expected O, but got Unknown
				//IL_0081: Unknown result type (might be due to invalid IL or missing references)
				//IL_0087: Expected O, but got Unknown
				//IL_0095: Unknown result type (might be due to invalid IL or missing references)
				//IL_009b: Expected O, but got Unknown
				//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ba: Expected O, but got Unknown
				//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cd: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[4]
				{
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ci) => CodeInstructionExtensions.IsLdarg(ci, (int?)null)), (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(SkillTargetLocal), "type"), (string)null),
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ci) => ci.opcode == OpCodes.Brtrue || ci.opcode == OpCodes.Brtrue_S), (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldarg_1, (object)null, (string)null)
				}).Advance(3).Insert((CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Ldc_I4_0, (object)null),
					new CodeInstruction(OpCodes.Starg_S, (object)2)
				});
				return val.InstructionEnumeration();
			}
		}

		public static ConfigEntry<bool> MechaInvincibleEnabled;

		public static ConfigEntry<bool> BuildingsInvincibleEnabled;

		public static void Init()
		{
			MechaInvincibleEnabled.SettingChanged += delegate
			{
				PatchImpl<MechaInvincible>.Enable(MechaInvincibleEnabled.Value);
			};
			BuildingsInvincibleEnabled.SettingChanged += delegate
			{
				PatchImpl<BuildingsInvincible>.Enable(BuildingsInvincibleEnabled.Value);
			};
		}

		public static void Start()
		{
			PatchImpl<MechaInvincible>.Enable(MechaInvincibleEnabled.Value);
			PatchImpl<BuildingsInvincible>.Enable(BuildingsInvincibleEnabled.Value);
		}

		public static void Uninit()
		{
			PatchImpl<BuildingsInvincible>.Enable(false);
			PatchImpl<MechaInvincible>.Enable(false);
		}
	}
	public class DysonSpherePatch : PatchImpl<DysonSpherePatch>
	{
		private class SkipBulletPatch : PatchImpl<SkipBulletPatch>
		{
			private struct DysonSailCache
			{
				public DysonSail Sail;

				public int OrbitId;

				public void FromData(in VectorLF3 delta1, in VectorLF3 delta2, int orbitId)
				{
					Sail.px = (float)delta1.x;
					Sail.py = (float)delta1.y;
					Sail.pz = (float)delta1.z;
					Sail.vx = (float)delta2.x;
					Sail.vy = (float)delta2.y;
					Sail.vz = (float)delta2.z;
					Sail.gs = 1f;
					OrbitId = orbitId;
				}
			}

			private static long _sailLifeTime;

			private static DysonSailCache[][] _sailsCache;

			private static int[] _sailsCacheLen;

			private static int[] _sailsCacheCapacity;

			private static bool _fireAllBullets;

			public static void SetFireAllBullets(bool value)
			{
				_fireAllBullets = value;
			}

			protected override void OnEnable()
			{
				UpdateSailLifeTime();
				UpdateSailsCacheForThisGame();
				GameLogic.OnGameBegin = (Action)Delegate.Combine(GameLogic.OnGameBegin, new Action(GameMain_Begin_Postfix));
			}

			protected override void OnDisable()
			{
				GameLogic.OnGameBegin = (Action)Delegate.Remove(GameLogic.OnGameBegin, new Action(GameMain_Begin_Postfix));
			}

			private static void UpdateSailLifeTime()
			{
				if (GameMain.history != null)
				{
					_sailLifeTime = (long)(GameMain.history.solarSailLife * 60f + 0.1f);
				}
			}

			private static void UpdateSailsCacheForThisGame()
			{
				if (GameMain.data?.galaxy != null)
				{
					int starCount = GameMain.data.galaxy.starCount;
					_sailsCache = new DysonSailCache[starCount][];
					_sailsCacheLen = new int[starCount];
					_sailsCacheCapacity = new int[starCount];
					Array.Clear(_sailsCacheLen, 0, starCount);
					Array.Clear(_sailsCacheCapacity, 0, starCount);
				}
			}

			private static void SetSailsCacheCapacity(int index, int capacity)
			{
				DysonSailCache[] array = new DysonSailCache[capacity];
				int num = _sailsCacheLen[index];
				if (num > 0)
				{
					Array.Copy(_sailsCache[index], array, num);
				}
				_sailsCache[index] = array;
				_sailsCacheCapacity[index] = capacity;
			}

			private static void GameMain_Begin_Postfix()
			{
				UpdateSailsCacheForThisGame();
				UpdateSailLifeTime();
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(GameHistoryData), "UnlockTechFunction")]
			private static void GameHistoryData_SetForNewGame_Postfix(int func)
			{
				if (func == 12)
				{
					UpdateSailLifeTime();
				}
			}

			[HarmonyTranspiler]
			[HarmonyPatch(typeof(EjectorComponent), "InternalUpdate")]
			private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_002d: Expected O, but got Unknown
				//IL_0056: Unknown result type (might be due to invalid IL or missing references)
				//IL_005c: Expected O, but got Unknown
				//IL_007d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0083: Expected O, but got Unknown
				//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00be: Expected O, but got Unknown
				//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
				//IL_00cc: Expected O, but got Unknown
				//IL_00da: Unknown result type (might be due to invalid IL or missing references)
				//IL_00e0: Expected O, but got Unknown
				//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f4: Expected O, but got Unknown
				//IL_0101: Unknown result type (might be due to invalid IL or missing references)
				//IL_0107: Expected O, but got Unknown
				//IL_0124: Unknown result type (might be due to invalid IL or missing references)
				//IL_012a: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Ldc_R4, (object)10f, (string)null)
				}).Advance(2);
				int pos = val.Pos;
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
				{
					new CodeMatch((OpCode?)OpCodes.Ldc_I4_M1, (object)null, (string)null),
					new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(EjectorComponent), "direction"), (string)null)
				}).Advance(2);
				int pos2 = val.Pos;
				val.Start().Advance(pos).RemoveInstructions(pos2 - pos)
					.Insert((CodeInstruction[])(object)new CodeInstruction[6]
					{
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Ldarg_3, (object)null),
						new CodeInstruction(OpCodes.Ldloc_S, (object)9),
						new CodeInstruction(OpCodes.Ldloc_S, (object)11),
						new CodeInstruction(OpCodes.Ldarg_S, (object)6),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(SkipBulletPatch), "AddDysonSail", (Type[])null, (Type[])null))
					});
				return val.InstructionEnumeration();
			}

			private static void AddDysonSail(ref EjectorComponent ejector, DysonSwarm swarm, VectorLF3 uPos, VectorLF3 endVec, int[] consumeRegister)
			{
				//IL_0013: Unknown result type (might be due to invalid IL or missing references)
				//IL_001a: Unknown result type (might be due to invalid IL or missing references)
				//IL_001f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: Unknown result type (might be due to invalid IL or missing references)
				//IL_0025: Unknown result type (might be due to invalid IL or missing references)
				//IL_0026: Unknown result type (might be due to invalid IL or missing references)
				//IL_0027: Unknown result type (might be due to invalid IL or missing references)
				//IL_0038: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0042: Unknown result type (might be due to invalid IL or missing references)
				//IL_0047: Unknown result type (might be due to invalid IL or missing references)
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				//IL_0078: Unknown result type (might be due to invalid IL or missing references)
				//IL_0185: Unknown result type (might be due to invalid IL or missing references)
				//IL_0195: Unknown result type (might be due to invalid IL or missing references)
				//IL_019a: Unknown result type (might be due to invalid IL or missing references)
				//IL_019f: Unknown result type (might be due to invalid IL or missing references)
				//IL_011b: Unknown result type (might be due to invalid IL or missing references)
				//IL_012b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0130: Unknown result type (might be due to invalid IL or missing references)
				//IL_0135: Unknown result type (might be due to invalid IL or missing references)
				int index = swarm.starData.index;
				int orbitId = ejector.orbitId;
				VectorLF3 delta = endVec - swarm.starData.uPosition;
				VectorLF3 delta2 = VectorLF3.Cross(endVec - uPos, VectorLF3.op_Implicit(swarm.orbits[orbitId].up));
				VectorLF3 val = ((VectorLF3)(ref delta2)).normalized * Math.Sqrt(swarm.dysonSphere.gravity / swarm.orbits[orbitId].radius);
				int bulletCount = ejector.bulletCount;
				lock (swarm)
				{
					DysonSailCache[] array = _sailsCache[index];
					int num = _sailsCacheLen[index];
					if (array == null)
					{
						SetSailsCacheCapacity(index, 256);
						array = _sailsCache[index];
					}
					if (_fireAllBullets)
					{
						int num2 = _sailsCacheCapacity[index];
						int num3 = num + bulletCount;
						if (num3 > num2)
						{
							do
							{
								num2 *= 2;
							}
							while (num3 > num2);
							SetSailsCacheCapacity(index, num2);
							array = _sailsCache[index];
						}
						_sailsCacheLen[index] = num + bulletCount;
						int num4 = num + bulletCount;
						for (int i = num; i < num4; i++)
						{
							ref DysonSailCache reference = ref array[i];
							delta2 = val + RandomTable.SphericNormal(ref swarm.randSeed, 0.5);
							reference.FromData(in delta, in delta2, orbitId);
						}
					}
					else
					{
						int num5 = _sailsCacheCapacity[index];
						if (num >= num5)
						{
							SetSailsCacheCapacity(index, num5 * 2);
							array = _sailsCache[index];
						}
						_sailsCacheLen[index] = num + 1;
						ref DysonSailCache reference2 = ref array[num];
						delta2 = val + RandomTable.SphericNormal(ref swarm.randSeed, 0.5);
						reference2.FromData(in delta, in delta2, orbitId);
					}
				}
				if (_fireAllBullets)
				{
					if (!ejector.incUsed)
					{
						ejector.incUsed = ejector.bulletInc >= bulletCount;
					}
					ejector.bulletInc = 0;
					ejector.bulletCount = 0;
					lock (consumeRegister)
					{
						consumeRegister[ejector.bulletId] += bulletCount;
					}
				}
				else
				{
					int num6 = ejector.bulletInc / bulletCount;
					if (!ejector.incUsed)
					{
						ejector.incUsed = num6 > 0;
					}
					ejector.bulletInc -= num6;
					ejector.bulletCount = bulletCount - 1;
					if (ejector.bulletCount == 0)
					{
						ejector.bulletInc = 0;
					}
					lock (consumeRegister)
					{
						consumeRegister[ejector.bulletId]++;
					}
				}
				ejector.time = ejector.coldSpend;
				ejector.direction = -1;
			}

			[HarmonyPrefix]
			[HarmonyPatch(typeof(DysonSwarm), "GameTick")]
			public static void DysonSwarm_GameTick_Prefix(DysonSwarm __instance, long time)
			{
				//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
				int index = __instance.starData.index;
				int num = _sailsCacheLen[index];
				if (num == 0)
				{
					return;
				}
				_sailsCacheLen[index] = 0;
				DysonSailCache[] array = _sailsCache[index];
				long num2 = time + _sailLifeTime;
				int num3 = num - 1;
				if (_instantAbsorb)
				{
					DysonSphere dysonSphere = __instance.dysonSphere;
					DysonSphereLayer[] layersSorted = dysonSphere.layersSorted;
					int layerCount = dysonSphere.layerCount;
					int[] productRegister = dysonSphere.productRegister;
					int[] consumeRegister = dysonSphere.consumeRegister;
					if (layerCount > 0)
					{
						int num4 = ((int)time >> 4) % layerCount;
						for (int num5 = layerCount - 1; num5 >= 0; num5--)
						{
							DysonSphereLayer obj = layersSorted[(num4 + num5) % layerCount];
							DysonNode[] nodePool = obj.nodePool;
							int num6 = obj.nodeCursor - 1;
							if (num6 > 0)
							{
								int num7 = (int)time % num6;
								for (int num8 = num6; num8 > 0; num8--)
								{
									int num9 = (num7 + num8) % num6 + 1;
									DysonNode val = nodePool[num9];
									if (val != null && val.id == num9 && val.sp >= val.spMax)
									{
										while (val.cpReqOrder > 0)
										{
											val.cpOrdered++;
											if (val.ConstructCp() == null)
											{
												break;
											}
											if (num3 == 0)
											{
												productRegister[11901] += num;
												consumeRegister[11901] += num;
												productRegister[11903] += num;
												return;
											}
											num3--;
										}
									}
								}
							}
						}
					}
					int num10 = num - 1 - num3;
					if (num10 > 0)
					{
						productRegister[11901] += num10;
						consumeRegister[11901] += num10;
						productRegister[11903] += num10;
					}
				}
				while (num3 >= 0)
				{
					__instance.AddSolarSail(array[num3].Sail, array[num3].OrbitId, num2);
					num3--;
				}
			}
		}

		private class SkipAbsorbPatch : PatchImpl<SkipAbsorbPatch>
		{
			protected override void OnEnable()
			{
				_instantAbsorb = QuickAbsorbEnabled.Value;
			}

			protected override void OnDisable()
			{
				_instantAbsorb = false;
			}

			[HarmonyTranspiler]
			[HarmonyPatch(typeof(DysonSwarm), "AbsorbSail")]
			private static IEnumerable<CodeInstruction> DysonSwarm_AbsorbSail_Transpiler2(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: 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_006a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0070: Expected O, but got Unknown
				//IL_008d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0093: Expected O, but got Unknown
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a6: Expected O, but got Unknown
				//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b4: Expected O, but got Unknown
				//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d5: Expected O, but got Unknown
				//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f6: Expected O, but got Unknown
				//IL_0107: Unknown result type (might be due to invalid IL or missing references)
				//IL_010d: Expected O, but got Unknown
				//IL_011e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0124: Expected O, but got Unknown
				//IL_012c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0132: Expected O, but got Unknown
				//IL_013b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0141: Expected O, but got Unknown
				//IL_014a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0150: Expected O, but got Unknown
				//IL_0159: Unknown result type (might be due to invalid IL or missing references)
				//IL_015f: Expected O, but got Unknown
				//IL_0168: Unknown result type (might be due to invalid IL or missing references)
				//IL_016e: Expected O, but got Unknown
				//IL_0177: Unknown result type (might be due to invalid IL or missing references)
				//IL_018f: Expected O, but got Unknown
				//IL_0199: Unknown result type (might be due to invalid IL or missing references)
				//IL_019f: Expected O, but got Unknown
				//IL_01bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_01c3: Expected O, but got Unknown
				//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
				//IL_01d2: Expected O, but got Unknown
				//IL_01db: Unknown result type (might be due to invalid IL or missing references)
				//IL_01e1: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				Label label = generator.DefineLabel();
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(ExpiryOrder), "index"), (string)null)
				}).Advance(1).RemoveInstructions(val.Length - val.Pos)
					.Insert((CodeInstruction[])(object)new CodeInstruction[18]
					{
						new CodeInstruction(OpCodes.Ldarg_1, (object)null),
						new CodeInstruction(OpCodes.Callvirt, (object)AccessTools.Method(typeof(DysonNode), "ConstructCp", (Type[])null, (Type[])null)),
						new CodeInstruction(OpCodes.Brfalse_S, (object)label),
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(DysonSwarm), "dysonSphere")),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(DysonSphere), "productRegister")),
						new CodeInstruction(OpCodes.Ldc_I4, (object)11903),
						new CodeInstruction(OpCodes.Ldelema, (object)typeof(int)),
						new CodeInstruction(OpCodes.Dup, (object)null),
						new CodeInstruction(OpCodes.Ldind_I4, (object)null),
						new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
						new CodeInstruction(OpCodes.Add, (object)null),
						new CodeInstruction(OpCodes.Stind_I4, (object)null),
						CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldarg_0, (object)null), new Label[1] { label }),
						new CodeInstruction(OpCodes.Ldloc_1, (object)null),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(DysonSwarm), "RemoveSolarSail", (Type[])null, (Type[])null)),
						new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
						new CodeInstruction(OpCodes.Ret, (object)null)
					});
				return val.InstructionEnumeration();
			}
		}

		private class QuickAbsorbPatch : PatchImpl<QuickAbsorbPatch>
		{
			protected override void OnEnable()
			{
				_instantAbsorb = SkipAbsorbEnabled.Value;
			}

			protected override void OnDisable()
			{
				_instantAbsorb = false;
			}

			[HarmonyTranspiler]
			[HarmonyPatch(typeof(DysonSphereLayer), "GameTick")]
			private static IEnumerable<CodeInstruction> DysonSphereLayer_GameTick_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_001c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0022: Expected O, but got Unknown
				//IL_002a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0030: Expected O, but got Unknown
				//IL_004d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0053: Expected O, but got Unknown
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Expected O, but got Unknown
				//IL_0094: Unknown result type (might be due to invalid IL or missing references)
				//IL_009a: Expected O, but got Unknown
				//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c1: Expected O, but got Unknown
				//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
				//IL_00da: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				val.Start().InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3]
				{
					new CodeInstruction(OpCodes.Ldarg_0, (object)null),
					new CodeInstruction(OpCodes.Ldarg_1, (object)null),
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(QuickAbsorbPatch), "DoAbsorb", (Type[])null, (Type[])null))
				}).MatchForward(false, (CodeMatch[])(object)new CodeMatch[3]
				{
					new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(DysonSphereLayer), "dysonSphere"), (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(DysonSphere), "swarm"), (string)null)
				})
					.Insert((CodeInstruction[])(object)new CodeInstruction[1]
					{
						new CodeInstruction(OpCodes.Ret, (object)null)
					});
				return val.InstructionEnumeration();
			}

			private static void DoAbsorb(DysonSphereLayer layer, long gameTick)
			{
				int num = layer.nodeCursor - 1;
				if (num <= 0)
				{
					return;
				}
				DysonNode[] nodePool = layer.nodePool;
				DysonSwarm swarm = layer.dysonSphere.swarm;
				int num2 = ((int)gameTick >> 6) % num;
				for (int num3 = num - ((int)gameTick & 0x3F); num3 > 0; num3 -= 64)
				{
					int num4 = (num2 + num3) % num + 1;
					DysonNode val = nodePool[num4];
					if (val != null && val.id == num4 && val.sp >= val.spMax)
					{
						for (int num5 = val.cpReqOrder; num5 > 0; num5--)
						{
							if (!swarm.AbsorbSail(val, gameTick))
							{
								return;
							}
						}
					}
				}
			}
		}

		private class EjectAnywayPatch : PatchImpl<EjectAnywayPatch>
		{
			[HarmonyTranspiler]
			[HarmonyPatch(typeof(EjectorComponent), "InternalUpdate")]
			private static IEnumerable<CodeInstruction> EjectorComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0037: Unknown result type (might be due to invalid IL or missing references)
				//IL_003d: Expected O, but got Unknown
				//IL_0062: Unknown result type (might be due to invalid IL or missing references)
				//IL_0068: Expected O, but got Unknown
				//IL_0089: Unknown result type (might be due to invalid IL or missing references)
				//IL_008f: Expected O, but got Unknown
				//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00df: Expected O, but got Unknown
				//IL_0108: Unknown result type (might be due to invalid IL or missing references)
				//IL_010e: Expected O, but got Unknown
				//IL_012f: Unknown result type (might be due to invalid IL or missing references)
				//IL_0135: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				val.End().MatchBack(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction instr) => instr.opcode == OpCodes.Ldc_R8 && Math.Abs((double)instr.operand - 0.08715574) < 1E-08), (string)null)
				});
				int num = val.Pos - 3;
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
				{
					new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(EjectorComponent), "bulletCount"), (string)null)
				});
				int pos = val.Pos;
				val.Start().Advance(num).RemoveInstructions(pos - num)
					.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
					{
						new CodeMatch((Func<CodeInstruction, bool>)((CodeInstruction ci) => CodeInstructionExtensions.IsStloc(ci, (LocalBuilder)null)), (string)null)
					})
					.Advance(1);
				num = val.Pos;
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[2]
				{
					new CodeMatch((OpCode?)OpCodes.Ldarg_0, (object)null, (string)null),
					new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(EjectorComponent), "autoOrbit"), (string)null)
				});
				pos = val.Pos;
				val.Start().Advance(num).RemoveInstructions(pos - num);
				return val.InstructionEnumeration();
			}
		}

		private class OverclockEjector : PatchImpl<OverclockEjector>
		{
			[HarmonyTranspiler]
			[HarmonyPatch(typeof(EjectorComponent), "InternalUpdate")]
			private static IEnumerable<CodeInstruction> EjectComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: 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
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Expected O, but got Unknown
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Stloc_1, (object)null, (string)null)
				}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Ldc_I4_S, (object)10),
					new CodeInstruction(OpCodes.Mul, (object)null)
				}).Advance(1);
				int pos = val.Pos;
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Stloc_1, (object)null, (string)null)
				}).Advance(1);
				int pos2 = val.Pos;
				val.Start().Advance(pos).RemoveInstructions(pos2 - pos);
				return val.InstructionEnumeration();
			}

			[HarmonyTranspiler]
			[HarmonyPatch(typeof(UIEjectorWindow), "_OnUpdate")]
			private static IEnumerable<CodeInstruction> UIEjectAndSiloWindow__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Expected O, but got Unknown
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Expected O, but got Unknown
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Expected O, but got Unknown
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Expected O, but got Unknown
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)AccessTools.Field(typeof(Cargo), "accTableMilli"), (string)null)
				}).Advance(-1);
				object operand = val.Operand;
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Stloc_S, operand, (string)null)
				}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Ldc_R4, (object)10f),
					new CodeInstruction(OpCodes.Mul, (object)null)
				}).Advance(1);
				int pos = val.Pos;
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Stloc_S, operand, (string)null)
				}).Advance(1);
				int pos2 = val.Pos;
				val.Start().Advance(pos).RemoveInstructions(pos2 - pos);
				return val.InstructionEnumeration();
			}
		}

		private class OverclockSilo : PatchImpl<OverclockSilo>
		{
			[HarmonyTranspiler]
			[HarmonyPatch(typeof(SiloComponent), "InternalUpdate")]
			private static IEnumerable<CodeInstruction> SiloComponent_InternalUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_001e: Unknown result type (might be due to invalid IL or missing references)
				//IL_0024: 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
				//IL_004b: Unknown result type (might be due to invalid IL or missing references)
				//IL_0051: Expected O, but got Unknown
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_0080: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Stloc_1, (object)null, (string)null)
				}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Ldc_I4_S, (object)10),
					new CodeInstruction(OpCodes.Mul, (object)null)
				}).Advance(1);
				int pos = val.Pos;
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Stloc_1, (object)null, (string)null)
				}).Advance(1);
				int pos2 = val.Pos;
				val.Start().Advance(pos).RemoveInstructions(pos2 - pos);
				return val.InstructionEnumeration();
			}

			[HarmonyTranspiler]
			[HarmonyPatch(typeof(UISiloWindow), "_OnUpdate")]
			private static IEnumerable<CodeInstruction> UIEjectAndSiloWindow__OnUpdate_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Expected O, but got Unknown
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0067: Expected O, but got Unknown
				//IL_0083: Unknown result type (might be due to invalid IL or missing references)
				//IL_0089: Expected O, but got Unknown
				//IL_0091: Unknown result type (might be due to invalid IL or missing references)
				//IL_0097: Expected O, but got Unknown
				//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c6: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Ldsfld, (object)AccessTools.Field(typeof(Cargo), "accTableMilli"), (string)null)
				}).Advance(-1);
				object operand = val.Operand;
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Stloc_S, operand, (string)null)
				}).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[2]
				{
					new CodeInstruction(OpCodes.Ldc_R4, (object)10f),
					new CodeInstruction(OpCodes.Mul, (object)null)
				}).Advance(1);
				int pos = val.Pos;
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Stloc_S, operand, (string)null)
				}).Advance(1);
				int pos2 = val.Pos;
				val.Start().Advance(pos).RemoveInstructions(pos2 - pos);
				return val.InstructionEnumeration();
			}
		}

		private class UnlockMaxOrbitRadius : PatchImpl<UnlockMaxOrbitRadius>
		{
			protected override void OnEnable()
			{
				OnViewStarChange(null, null);
				UnlockMaxOrbitRadiusValue.SettingChanged += OnViewStarChange;
			}

			protected override void OnDisable()
			{
				OnViewStarChange(null, null);
				UnlockMaxOrbitRadiusValue.SettingChanged -= OnViewStarChange;
			}

			public static void OnViewStarChange(object o, EventArgs e)
			{
				UIDysonEditor val = UIRoot.instance?.uiGame?.dysonEditor;
				if (!((Object)(object)val == (Object)null) && ((Component)val).gameObject.activeSelf)
				{
					val.selection?.onViewStarChange?.Invoke();
				}
			}

			[HarmonyTranspiler]
			[HarmonyPatch(typeof(DysonSphere), "CheckLayerRadius")]
			[HarmonyPatch(typeof(DysonSphere), "CheckSwarmRadius")]
			[HarmonyPatch(typeof(DysonSphere), "QueryLayerRadius")]
			[HarmonyPatch(typeof(DysonSphere), "QuerySwarmRadius")]
			[HarmonyPatch(typeof(UIDEAddLayerDialogue), "OnViewStarChange")]
			[HarmonyPatch(typeof(UIDEAddSwarmDialogue), "OnViewStarChange")]
			[HarmonyPatch(typeof(UIDysonEditor), "OnViewStarChange")]
			[HarmonyPatch(typeof(UIDESwarmOrbitInfo), "_OnInit")]
			[HarmonyPatch(typeof(UIDysonOrbitPreview), "UpdateAscNodeGizmos")]
			private static IEnumerable<CodeInstruction> MaxOrbitRadiusPatch_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0031: Unknown result type (might be due to invalid IL or missing references)
				//IL_0037: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Ldfld, (object)AccessTools.Field(typeof(DysonSphere), "maxOrbitRadius"), (string)null)
				});
				val.Repeat((Action<CodeMatcher>)delegate(CodeMatcher m)
				{
					//IL_0015: Unknown result type (might be due to invalid IL or missing references)
					//IL_001b: Expected O, but got Unknown
					//IL_0036: Unknown result type (might be due to invalid IL or missing references)
					//IL_003c: Expected O, but got Unknown
					//IL_0057: Unknown result type (might be due to invalid IL or missing references)
					//IL_005d: Expected O, but got Unknown
					m.Advance(1).InsertAndAdvance((CodeInstruction[])(object)new CodeInstruction[3]
					{
						new CodeInstruction(OpCodes.Pop, (object)null),
						new CodeInstruction(OpCodes.Ldsfld, (object)AccessTools.Field(typeof(DysonSpherePatch), "UnlockMaxOrbitRadiusValue")),
						new CodeInstruction(OpCodes.Call, (object)AccessTools.PropertyGetter(typeof(ConfigEntry<float>), "Value"))
					});
				}, (Action<string>)null);
				return val.InstructionEnumeration();
			}
		}

		public static ConfigEntry<bool> SkipBulletEnabled;

		public static ConfigEntry<bool> FireAllBulletsEnabled;

		public static ConfigEntry<bool> SkipAbsorbEnabled;

		public static ConfigEntry<bool> QuickAbsorbEnabled;

		public static ConfigEntry<bool> EjectAnywayEnabled;

		public static ConfigEntry<bool> OverclockEjectorEnabled;

		public static ConfigEntry<bool> OverclockSiloEnabled;

		public static ConfigEntry<bool> UnlockMaxOrbitRadiusEnabled;

		public static ConfigEntry<float> UnlockMaxOrbitRadiusValue;

		private static bool _instantAbsorb;

		public static void Init()
		{
			SkipBulletEnabled.SettingChanged += delegate
			{
				PatchImpl<SkipBulletPatch>.Enable(SkipBulletEnabled.Value);
			};
			SkipAbsorbEnabled.SettingChanged += delegate
			{
				PatchImpl<SkipAbsorbPatch>.Enable(SkipAbsorbEnabled.Value);
			};
			QuickAbsorbEnabled.SettingChanged += delegate
			{
				PatchImpl<QuickAbsorbPatch>.Enable(QuickAbsorbEnabled.Value);
			};
			EjectAnywayEnabled.SettingChanged += delegate
			{
				PatchImpl<EjectAnywayPatch>.Enable(EjectAnywayEnabled.Value);
			};
			OverclockEjectorEnabled.SettingChanged += delegate
			{
				PatchImpl<OverclockEjector>.Enable(OverclockEjectorEnabled.Value);
			};
			OverclockSiloEnabled.SettingChanged += delegate
			{
				PatchImpl<OverclockSilo>.Enable(OverclockSiloEnabled.Value);
			};
			UnlockMaxOrbitRadiusEnabled.SettingChanged += delegate
			{
				PatchImpl<UnlockMaxOrbitRadius>.Enable(UnlockMaxOrbitRadiusEnabled.Value);
			};
			FireAllBulletsEnabled.SettingChanged += delegate
			{
				SkipBulletPatch.SetFireAllBullets(FireAllBulletsEnabled.Value);
			};
		}

		public static void Start()
		{
			PatchImpl<SkipBulletPatch>.Enable(SkipBulletEnabled.Value);
			PatchImpl<SkipAbsorbPatch>.Enable(SkipAbsorbEnabled.Value);
			PatchImpl<QuickAbsorbPatch>.Enable(QuickAbsorbEnabled.Value);
			PatchImpl<EjectAnywayPatch>.Enable(EjectAnywayEnabled.Value);
			PatchImpl<OverclockEjector>.Enable(OverclockEjectorEnabled.Value);
			PatchImpl<OverclockSilo>.Enable(OverclockSiloEnabled.Value);
			PatchImpl<UnlockMaxOrbitRadius>.Enable(UnlockMaxOrbitRadiusEnabled.Value);
			PatchImpl<DysonSpherePatch>.Enable(true);
			SkipBulletPatch.SetFireAllBullets(FireAllBulletsEnabled.Value);
		}

		public static void Uninit()
		{
			PatchImpl<DysonSpherePatch>.Enable(false);
			PatchImpl<SkipBulletPatch>.Enable(false);
			PatchImpl<SkipAbsorbPatch>.Enable(false);
			PatchImpl<QuickAbsorbPatch>.Enable(false);
			PatchImpl<EjectAnywayPatch>.Enable(false);
			PatchImpl<OverclockEjector>.Enable(false);
			PatchImpl<OverclockSilo>.Enable(false);
			PatchImpl<UnlockMaxOrbitRadius>.Enable(false);
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(DysonNode), "OrderConstructCp")]
		private static IEnumerable<CodeInstruction> DysonNode_OrderConstructCp_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: Expected O, but got Unknown
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Callvirt, (object)AccessTools.Method(typeof(DysonSwarm), "AbsorbSail", (Type[])null, (Type[])null), (string)null)
			}).Advance(1).SetInstructionAndAdvance(new CodeInstruction(OpCodes.Pop, (object)null))
				.Insert((CodeInstruction[])(object)new CodeInstruction[1]
				{
					new CodeInstruction(OpCodes.Ret, (object)null)
				});
			return val.InstructionEnumeration();
		}

		[HarmonyTranspiler]
		[HarmonyPatch(typeof(DysonSwarm), "AbsorbSail")]
		private static IEnumerable<CodeInstruction> DysonSwarm_AbsorbSail_Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Expected O, but got Unknown
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Expected O, but got Unknown
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Expected O, but got Unknown
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Expected O, but got Unknown
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Expected O, but got Unknown
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Expected O, but got Unknown
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Expected O, but got Unknown
			CodeMatcher val = new CodeMatcher(instructions, generator);
			val.MatchForward(false, (CodeMatch[])(object)new CodeMatch[1]
			{
				new CodeMatch((OpCode?)OpCodes.Stfld, (object)AccessTools.Field(typeof(ExpiryOrder), "time"), (string)null)
			}).Advance(1).Insert((CodeInstruction[])(object)new CodeInstruction[6]
			{
				new CodeInstruction(OpCodes.Ldarg_1, (object)null),
				new CodeInstruction(OpCodes.Ldarg_1, (object)null),
				new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(DysonNode), "cpOrdered")),
				new CodeInstruction(OpCodes.Ldc_I4_1, (object)null),
				new CodeInstruction(OpCodes.Add, (object)null),
				new CodeInstruction(OpCodes.Stfld, (object)AccessTools.Field(typeof(DysonNode), "cpOrdered"))
			});
			return val.InstructionEnumeration();
		}
	}
	public class FactoryPatch : PatchImpl<FactoryPatch>
	{
		private class CargoTrafficPatch : PatchImpl<CargoTrafficPatch>
		{
			public static bool IsBatchBuilding;

			public static bool DisableRefreshBatchesBuffers;

			[HarmonyPrefix]
			[HarmonyPriority(800)]
			[HarmonyPatch(typeof(CargoTraffic), "AlterBeltRenderer")]
			private static bool CargoTraffic_AlterBeltRenderer_Prefix(int beltId)
			{
				if (!IsBatchBuilding)
				{
					return true;
				}
				_alterBeltRendererIds.Add(beltId);
				return false;
			}

			[HarmonyPrefix]
			[HarmonyPriority(800)]
			[HarmonyPatch(typeof(CargoTraffic), "AlterPathRenderer")]
			private static bool CargoTraffic_AlterPathRenderer_Prefix(int pathId)
			{
				if (!IsBatchBuilding)
				{
					return true;
				}
				_alterPathRendererIds.Add(pathId);
				return false;
			}

			[HarmonyPrefix]
			[HarmonyPriority(800)]
			[HarmonyPatch(typeof(CargoTraffic), "RefreshPathUV")]
			private static bool CargoTraffic_RefreshPathUV_Prefix(int pathId)
			{
				if (!IsBatchBuilding)
				{
					return true;
				}
				_refreshPathUVIds.Add(pathId);
				return false;
			}

			[HarmonyPrefix]
			[HarmonyPriority(800)]
			[HarmonyPatch(typeof(CargoTraffic), "RefreshBeltBatchesBuffers")]
			[HarmonyPatch(typeof(CargoTraffic), "RefreshPathBatchesBuffers")]
			private static bool CargoTraffic_RefreshBeltBatchesBuffers_Prefix()
			{
				return !DisableRefreshBatchesBuffers;
			}
		}

		private class ImmediateBuild : PatchImpl<ImmediateBuild>
		{
			protected override void OnEnable()
			{
				Player mainPlayer = GameMain.mainPlayer;
				PlanetFactory val = ((mainPlayer != null) ? mainPlayer.factory : null);
				if (val != null)
				{
					ArrivePlanet(val);
				}
			}

			[HarmonyTranspiler]
			[HarmonyPatch(typeof(BuildTool_Addon), "CreatePrebuilds")]
			[HarmonyPatch(typeof(BuildTool_BlueprintPaste), "CreatePrebuilds")]
			[HarmonyPatch(typeof(BuildTool_Click), "CreatePrebuilds")]
			[HarmonyPatch(typeof(BuildTool_Inserter), "CreatePrebuilds")]
			[HarmonyPatch(typeof(BuildTool_Path), "CreatePrebuilds")]
			private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions, ILGenerator generator)
			{
				//IL_0002: Unknown result type (might be due to invalid IL or missing references)
				//IL_0008: Expected O, but got Unknown
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Expected O, but got Unknown
				//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
				//IL_00f5: Expected O, but got Unknown
				//IL_0111: Unknown result type (might be due to invalid IL or missing references)
				//IL_0117: Expected O, but got Unknown
				//IL_0134: Unknown result type (might be due to invalid IL or missing references)
				//IL_013a: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				val.End().MatchBack(false, (CodeMatch[])(object)new CodeMatch[1]
				{
					new CodeMatch((OpCode?)OpCodes.Ret, (object)null, (string)null)
				});
				if (val.IsInvalid)
				{
					CheatEnabler.Logger.LogWarning((object)"Failed to patch CreatePrebuilds");
					return val.InstructionEnumeration();
				}
				val.Advance(-1);
				if (val.Opcode != OpCodes.Nop && (val.Opcode != OpCodes.Call || !CodeInstructionExtensions.OperandIs(val.Instruction, (MemberInfo)AccessTools.Method(typeof(GC), "Collect", (Type[])null, (Type[])null))))
				{
					CheatEnabler.Logger.LogWarning((object)$"Failed to patch CreatePrebuilds: last instruction is not `Nop` or `Call GC.Collect()`: {val.Instruction}");
					return val.InstructionEnumeration();
				}
				List<Label> labels = val.Labels;
				val.Labels = new List<Label>();
				val.Insert((CodeInstruction[])(object)new CodeInstruction[3]
				{
					CodeInstructionExtensions.WithLabels(new CodeInstruction(OpCodes.Ldarg_0, (object)null), (IEnumerable<Label>)labels),
					new CodeInstruction(OpCodes.Ldfld, (object)AccessTools.Field(typeof(BuildTool), "factory")),
					new CodeInstruction(OpCodes.Call, (object)AccessTools.Method(typeof(FactoryPatch), "ArrivePlanet", (Type[])null, (Type[])null))
				});
				return val.InstructionEnumeration();
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(PlanetFunctions), "BuildOrbitalCollectors")]
			private static void UXAssist_PlanetFunctions_BuildOrbitalCollectors_Postfix()
			{
				Player mainPlayer = GameMain.mainPlayer;
				PlanetFactory val = ((mainPlayer != null) ? mainPlayer.factory : null);
				if (val != null)
				{
					ArrivePlanet(val);
				}
			}
		}

		private class ArchitectMode : PatchImpl<ArchitectMode>
		{
			private static bool[] _canBuildItems;

			protected override void OnEnable()
			{
				Player mainPlayer = GameMain.mainPlayer;
				PlanetFactory val = ((mainPlayer != null) ? mainPlayer.factory : null);
				if (val != null)
				{
					ArrivePlanet(val);
				}
			}

			[HarmonyPrefix]
			[HarmonyPatch(/*Could not decode attribute arguments.*/)]
			[HarmonyPatch(/*Could not decode attribute arguments.*/)]
			public static bool TakeTailItemsPatch(StorageComponent __instance, int itemId)
			{
				if (__instance == null || __instance.id != GameMain.mainPlayer.package.id)
				{
					return true;
				}
				if (itemId <= 0)
				{
					return true;
				}
				if (_canBuildItems == null)
				{
					DoInit();
				}
				if (itemId < 12000)
				{
					return !_canBuildItems[itemId];
				}
				return true;
			}

			[HarmonyPostfix]
			[HarmonyPatch(typeof(StorageComponent), "GetItemCount", new Type[] { typeof(int) })]
			public static void GetItemCountPatch(StorageComponent __instance, int itemId, ref int __result)
			{
				if (__result <= 99 && __instance != null && __instance.id == GameMain.mainPlayer.package.id && itemId > 0)
				{
					if (_canBuildItems == null)
					{
						DoInit();
					}
					if (itemId < 12000 && _canBuildItems[itemId])
					{
						__result = 100;
					}
				}
			}

			private static void DoInit()
			{
				//IL_0023: Unknown result type (might be due to invalid IL or missing references)
				//IL_0029: Invalid comparison between Unknown and I4
				_canBuildItems = new bool[12000];
				ItemProto[] dataArray = ((ProtoSet<ItemProto>)(object)LDB.items).dataArray;
				foreach (ItemProto val in dataArray)
				{
					if (((int)val.Type == 5 || val.CanBuild) && ((Proto)val).ID < 12000)
					{
						_canBuildItems[((Proto)val).ID] = true;
					}
				}
			}
		}

		private class NoConditionBuild : PatchImpl<NoConditionBuild>
		{
			[CompilerGenerated]
			private sealed class <BuildTool_CheckBuildConditions_Transpiler>d__2 : IEnumerable<CodeInstruction>, IEnumerable, IEnumerator<CodeInstruction>, IDisposable, IEnumerator
			{
				private int <>1__state;

				private CodeInstruction <>2__current;

				private int <>l__initialThreadId;

				CodeInstruction IEnumerator<CodeInstruction>.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				object IEnumerator.Current
				{
					[DebuggerHidden]
					get
					{
						return <>2__current;
					}
				}

				[DebuggerHidden]
				public <BuildTool_CheckBuildConditions_Transpiler>d__2(int <>1__state)
				{
					this.<>1__state = <>1__state;
					<>l__initialThreadId = Environment.CurrentManagedThreadId;
				}

				[DebuggerHidden]
				void IDisposable.Dispose()
				{
					<>1__state = -2;
				}

				private bool MoveNext()
				{
					//IL_0029: Unknown result type (might be due to invalid IL or missing references)
					//IL_0033: Expected O, but got Unknown
					//IL_004a: Unknown result type (might be due to invalid IL or missing references)
					//IL_0054: Expected O, but got Unknown
					switch (<>1__state)
					{
					default:
						return false;
					case 0:
						<>1__state = -1;
						<>2__current = new CodeInstruction(OpCodes.Ldc_I4_1, (object)null);
						<>1__state = 1;
						return true;
					case 1:
						<>1__state = -1;
						<>2__current = new CodeInstruction(OpCodes.Ret, (object)null);
						<>1__state = 2;
						return true;
					case 2:
						<>1__state = -1;
						return false;
					}
				}

				bool IEnumerator.MoveNext()
				{
					//ILSpy generated this explicit interface implementation from .override directive in MoveNext
					return this.MoveNext();
				}

				[DebuggerHidden]
				void IEnumerator.Reset()
				{
					throw new NotSupportedException();
				}

				[DebuggerHidden]
				IEnumerator<CodeInstruction> IEnumerable<CodeInstruction>.GetEnumerator()
				{
					if (<>1__state == -2 && <>l__initialThreadId == Environment.CurrentManagedThreadId)
					{
						<>1__state = 0;
						return this;
					}
					return new <BuildTool_CheckBuildConditions_Transpiler>d__2(0);
				}

				[DebuggerHidden]
				IEnumerator IEnumerable.GetEnumerator()
				{
					return ((IEnumerable<CodeInstruction>)this).GetEnumerator();
				}
			}

			protected override void OnEnable()
			{
				GameData data = GameMain.data;
				if (data != null)
				{
					WarningSystem warningSystem = data.warningSystem;
					if (warningSystem != null)
					{
						warningSystem.UpdateCriticalWarningText();
					}
				}
			}

			protected override void OnDisable()
			{
				GameData data = GameMain.data;
				if (data != null)
				{
					WarningSystem warningSystem = data.warningSystem;
					if (warningSystem != null)
					{
						warningSystem.UpdateCriticalWarningText();
					}
				}
			}

			[IteratorStateMachine(typeof(<BuildTool_CheckBuildConditions_Transpiler>d__2))]
			[HarmonyTranspiler]
			[HarmonyPriority(0)]
			[HarmonyPatch(typeof(BuildTool_Addon), "CheckBuildConditions")]
			[HarmonyPatch(typeof(BuildTool_Inserter), "CheckBuildCondit