Decompiled source of CheatEnabler v2.4.4

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.4.4.0")]
[assembly: AssemblyInformationalVersion("2.4.4+d7f8dc55d4e953663af613059d7c995f1caf1b49")]
[assembly: AssemblyProduct("CheatEnabler")]
[assembly: AssemblyTitle("CheatEnabler")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("2.4.4.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.4.4")]
	[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.BeltSignalUseProliferatorEnabled = ((BaseUnityPlugin)this).Config.Bind<bool>("Build", "BeltSignalUseProliferator", false, "Belt signal count proliferators used for raws/intermediates and finished products");
			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>__RemoveAllFrames;

			public static UnityAction <7>__TeleportToOuterSpace;

			public static UnityAction <8>__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_15;

			public static UnityAction <>9__6_9;

			public static Response <>9__6_16;

			public static UnityAction <>9__6_10;

			public static Response <>9__6_17;

			public static UnityAction <>9__6_11;

			public static Response <>9__6_18;

			public static UnityAction <>9__6_12;

			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_15;
				if (obj == null)
				{
					Response val = delegate
					{
						DysonSphereFunctions.CreateIllegalDysonShellWithMaxOutput();
					};
					<>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.CreateIllegalDysonShellWithMaxOutput();
			}

			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_16;
				if (obj == null)
				{
					Response val = delegate
					{
						DysonSphereFunctions.KeepMaxProductionShells();
					};
					<>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.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_17;
				if (obj == null)
				{
					Response val = delegate
					{
						DysonSphereFunctions.DuplicateShellsWithHighestProduction();
					};
					<>9__6_17 = val;
					obj = (object)val;
				}
				UIMessageBox.Show(text, text2, text3, text4, 1, (Response)null, (Response)obj);
			}

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

			internal void <CreateUI>b__6_12()
			{
				//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 quickly");
				string text2 = Localization.Translate("WARNING: This operation can be very slow, continue?");
				string text3 = Localization.Translate("取消");
				string text4 = Localization.Translate("确定");
				object obj = <>9__6_18;
				if (obj == null)
				{
					Response val = delegate
					{
						DysonSphereFunctions.CreateIllegalDysonShellQuickly(DysonSphereFunctions.ShellsCountForFunctions.Value);
					};
					<>9__6_18 = val;
					obj = (object)val;
				}
				UIMessageBox.Show(text, text2, text3, text4, 1, (Response)null, (Response)obj);
			}

			internal void <CreateUI>b__6_18()
			{
				DysonSphereFunctions.CreateIllegalDysonShellQuickly(DysonSphereFunctions.ShellsCountForFunctions.Value);
			}
		}

		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("Count proliferators used for raws/intermediates and finished products", "Use proliferators for raws/intermediates and finished products", "原料、中间产物以及成品使用增产剂");
			I18N.Add("Count proliferators used for raws/intermediates and finished products tips", "Following items use extra products: Titanium Alloy, Prism, Frame Material, Proliferator Mk.II, Proliferator Mk.III, Magnetic Coil, Electric Motor, Electromagnetic Turbine, Super-magnetic Ring, Circuit Board, Thruster, Reinforced Thruster, Plasma Exciter, Particle Broadband, Graviton Lens, Quantum Chip, Annihilation Constraint Sphere, Deuteron Fuel Rod, Space Warper, Dyson Sphere Component, Small Carrier Rocket, Electromagnetic Matrix, Structure Matrix, Information Matrix, Gravity Matrix, Universe Matrix\nFollowing items does not use proliferators: Casimir Crystal, Energy Matrix\nOther items use speed up production.", "以下物品使用额外产出: 钛合金, 棱镜, 框架材料, 增产剂 Mk.II, 增产剂 Mk.III, 磁线圈, 电动机, 电磁涡轮, 超级磁场环, 电路板, 推进器, 加力推进器, 电浆激发器, 粒子宽带, 引力透镜, 量子芯片, 湮灭约束球, 氘核燃料棒, 空间翘曲器, 戴森球组件, 小型运载火箭, 电磁矩阵, 结构矩阵, 信息矩阵, 引力矩阵, 宇宙矩阵\n以下物品不使用增产剂: 卡西米尔晶体, 能量矩阵\n其他物品使用加速生产");
			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("Remove all frames on Dyson Sphere", "Remove all frames on Dyson Sphere", "移除戴森球上的所有框架");
			I18N.Add("Generate illegal dyson shell", "Generate an illegal dyson shell (!!1st shell layer will be replaced!!)", "生成单层仙术戴森壳(!!会先删除第一层戴森壳!!)");
			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("Generate illegal dyson shell quickly", "Generate illegal dyson shell quickly", "快速生成仙术戴森壳");
			I18N.Add("Shells count", "Shells count", "壳面数量");
			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_0660: Unknown result type (might be due to invalid IL or missing references)
			//IL_0665: Unknown result type (might be due to invalid IL or missing references)
			//IL_066b: Expected O, but got Unknown
			//IL_06a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ae: Expected O, but got Unknown
			//IL_06e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_06eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_06f1: Expected O, but got Unknown
			//IL_0729: Unknown result type (might be due to invalid IL or missing references)
			//IL_072e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0734: Expected O, but got Unknown
			//IL_08fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_0901: Unknown result type (might be due to invalid IL or missing references)
			//IL_0907: Expected O, but got Unknown
			//IL_093b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0940: Unknown result type (might be due to invalid IL or missing references)
			//IL_0946: Expected O, but got Unknown
			//IL_0988: Unknown result type (might be due to invalid IL or missing references)
			//IL_098d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0993: Expected O, but got Unknown
			//IL_09d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_09dc: Expected O, but got Unknown
			//IL_0a1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a25: Expected O, but got Unknown
			//IL_0a8f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a94: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9a: Expected O, but got Unknown
			//IL_0bdf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0bea: Expected O, but got Unknown
			//IL_0c1e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c23: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c29: 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.BeltSignalUseProliferatorEnabled, "Count proliferators used for raws/intermediates and finished products", 13);
			num2 += 6f;
			UIButton tip1 = ((MyWindow)wnd).AddTipsButton2(num + cb4.Width + 5f, num2, val7, "Count proliferators used for raws/intermediates and finished products", "Count proliferators used for raws/intermediates and finished products tips", "count-proliferators-used-for-raws-intermediates-and-finished-products-tips", "tips-button");
			num2 += 20f;
			MyCheckBox cb5 = ((MyWindow)wnd).AddCheckBox(num, num2, val7, FactoryPatch.BeltSignalNumberAltFormat, "Belt signal alt format", 13);
			num2 += 6f;
			UIButton tip2 = ((MyWindow)wnd).AddTipsButton2(num + cb5.Width + 5f, 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 += 36f;
			float num21 = num;
			float num22 = num2;
			object obj10 = <>O.<6>__RemoveAllFrames;
			if (obj10 == null)
			{
				UnityAction val15 = DysonSphereFunctions.RemoveAllFrames;
				<>O.<6>__RemoveAllFrames = val15;
				obj10 = (object)val15;
			}
			((MyWindow)wnd).AddButton(num21, num22, 300f, val13, "Remove all frames on Dyson Sphere", 16, "button-remove-all-frames-on-dyson-sphere", (UnityAction)obj10);
			num2 += 72f;
			float num23 = num2;
			float num24 = num;
			float num25 = num2;
			object obj11 = <>c.<>9__6_9;
			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 text13 = Localization.Translate("Generate illegal dyson shell");
					string text14 = Localization.Translate("WARNING: This operation can be very slow, continue?");
					string text15 = Localization.Translate("取消");
					string text16 = Localization.Translate("确定");
					object obj20 = <>c.<>9__6_15;
					if (obj20 == null)
					{
						Response val26 = delegate
						{
							DysonSphereFunctions.CreateIllegalDysonShellWithMaxOutput();
						};
						<>c.<>9__6_15 = val26;
						obj20 = (object)val26;
					}
					UIMessageBox.Show(text13, text14, text15, text16, 1, (Response)null, (Response)obj20);
				};
				<>c.<>9__6_9 = val16;
				obj11 = (object)val16;
			}
			UIButton btn1 = ((MyWindow)wnd).AddButton(num24, num25, 300f, val13, "Generate illegal dyson shell", 16, "button-generate-illegal-dyson-shells", (UnityAction)obj11);
			num2 += 36f;
			float num26 = num;
			float num27 = num2;
			object obj12 = <>c.<>9__6_10;
			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 text9 = Localization.Translate("Keep max production shells and remove others");
					string text10 = Localization.Translate("WARNING: This operation is DANGEROUS, continue?");
					string text11 = Localization.Translate("取消");
					string text12 = Localization.Translate("确定");
					object obj19 = <>c.<>9__6_16;
					if (obj19 == null)
					{
						Response val25 = delegate
						{
							DysonSphereFunctions.KeepMaxProductionShells();
						};
						<>c.<>9__6_16 = val25;
						obj19 = (object)val25;
					}
					UIMessageBox.Show(text9, text10, text11, text12, 1, (Response)null, (Response)obj19);
				};
				<>c.<>9__6_10 = val17;
				obj12 = (object)val17;
			}
			UIButton btn2 = ((MyWindow)wnd).AddButton(num26, num27, 300f, val13, "Keep max production shells and remove others", 16, "button-keep-max-production-shells", (UnityAction)obj12);
			num2 += 36f;
			float num28 = num;
			float num29 = num2;
			object obj13 = <>c.<>9__6_11;
			if (obj13 == null)
			{
				UnityAction val18 = 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("Duplicate shells from that with highest production");
					string text6 = Localization.Translate("WARNING: This operation can be very slow, continue?");
					string text7 = Localization.Translate("取消");
					string text8 = Localization.Translate("确定");
					object obj18 = <>c.<>9__6_17;
					if (obj18 == null)
					{
						Response val24 = delegate
						{
							DysonSphereFunctions.DuplicateShellsWithHighestProduction();
						};
						<>c.<>9__6_17 = val24;
						obj18 = (object)val24;
					}
					UIMessageBox.Show(text5, text6, text7, text8, 1, (Response)null, (Response)obj18);
				};
				<>c.<>9__6_11 = val18;
				obj13 = (object)val18;
			}
			UIButton btn3 = ((MyWindow)wnd).AddButton(num28, num29, 300f, val13, "Duplicate shells from that with highest production", 16, "button-duplicate-shells-from-the-highest-production", (UnityAction)obj13);
			num2 += 30f;
			MySlider slider2 = ((MyWindow)wnd).AddSlider<int>(num + 20f, num2, val13, DysonSphereFunctions.ShellsCountForFunctions, (ValueMapper<int>)(object)new ShellsCountMapper(), "G", 0f);
			num2 = num23;
			float num30 = num;
			float num31 = num2;
			object obj14 = <>c.<>9__6_12;
			if (obj14 == null)
			{
				UnityAction val19 = 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("Generate illegal dyson shell quickly");
					string text2 = Localization.Translate("WARNING: This operation can be very slow, continue?");
					string text3 = Localization.Translate("取消");
					string text4 = Localization.Translate("确定");
					object obj17 = <>c.<>9__6_18;
					if (obj17 == null)
					{
						Response val23 = delegate
						{
							DysonSphereFunctions.CreateIllegalDysonShellQuickly(DysonSphereFunctions.ShellsCountForFunctions.Value);
						};
						<>c.<>9__6_18 = val23;
						obj17 = (object)val23;
					}
					UIMessageBox.Show(text, text2, text3, text4, 1, (Response)null, (Response)obj17);
				};
				<>c.<>9__6_12 = val19;
				obj14 = (object)val19;
			}
			UIButton btn4 = ((MyWindow)wnd).AddButton(num30, num31, 300f, val13, "Generate illegal dyson shell quickly", 16, "button-generate-illegal-dyson-shells-quickly", (UnityAction)obj14);
			num2 += 30f;
			Text txt2 = ((MyWindow)wnd).AddText2(num, num2, val13, "Shells count", 15, "text-shells-count");
			MySlider slider3 = ((MyWindow)wnd).AddSlider<int>(num + txt2.preferredWidth + 5f, num2 + 6f, 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 val20 = ((MyWindowWithTabs)wnd).AddTab(_windowTrans, "Mecha/Combat");
			num = 0f;
			num2 = 10f;
			((MyWindow)wnd).AddCheckBox(num, num2, val20, CombatPatch.MechaInvincibleEnabled, "Mecha and Drones/Fleets invicible", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val20, CombatPatch.BuildingsInvincibleEnabled, "Buildings invicible", 15);
			num2 += 36f;
			((MyWindow)wnd).AddCheckBox(num, num2, val20, PlayerPatch.WarpWithoutSpaceWarpersEnabled, "Enable warp without space warpers", 15);
			num = 400f;
			num2 = 10f;
			float num32 = num;
			float num33 = num2;
			object obj15 = <>O.<7>__TeleportToOuterSpace;
			if (obj15 == null)
			{
				UnityAction val21 = PlayerFunctions.TeleportToOuterSpace;
				<>O.<7>__TeleportToOuterSpace = val21;
				obj15 = (object)val21;
			}
			((MyWindow)wnd).AddButton(num32, num33, 200f, val20, "Teleport to outer space", 16, "button-teleport-to-outer-space", (UnityAction)obj15);
			num2 += 36f;
			float num34 = num;
			float num35 = num2;
			object obj16 = <>O.<8>__TeleportToSelectedAstronomical;
			if (obj16 == null)
			{
				UnityAction val22 = PlayerFunctions.TeleportToSelectedAstronomical;
				<>O.<8>__TeleportToSelectedAstronomical = val22;
				obj16 = (object)val22;
			}
			((MyWindow)wnd).AddButton(num34, num35, 200f, val20, "Teleport to selected astronomical", 16, "button-teleport-to-selected-astronomical", (UnityAction)obj16);
			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)cb5).gameObject.SetActive(value2);
				((Component)tip1).gameObject.SetActive(value2);
				((Component)tip2).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);
				((Component)btn4).gameObject.SetActive(!value);
				((Component)txt2).gameObject.SetActive(!value);
				((Component)slider3).gameObject.SetActive(!value);
			}
		}

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

		private static void UpdateButtons()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_resignGameBtn == (Object)null || (Object)(object)_clearBanBtn == (Object)null)
			{
				return;
			}
			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.4.4";
	}
}
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(OnGameBegin));
			}

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

			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 OnGameBegin()
			{
				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_01cd: 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;
												__instance.dysonSphere.needRecalculatePower = true;
												return;
											}
											num3--;
										}
									}
								}
							}
						}
					}
					int num10 = num - 1 - num3;
					if (num10 > 0)
					{
						productRegister[11901] += num10;
						consumeRegister[11901] += num10;
						productRegister[11903] += num10;
						__instance.dysonSphere.needRecalculatePower = true;
					}
				}
				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 && PatchImpl<QuickAbsorbPatch>.GetHarmony() != null;
			}

			protected override void OnDisable()
			{
				_instantAbsorb = QuickAbsorbEnabled.Value && PatchImpl<QuickAbsorbPatch>.GetHarmony() != null;
			}

			[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_0069: Unknown result type (might be due to invalid IL or missing references)
				//IL_006f: Expected O, but got Unknown
				//IL_0077: Unknown result type (might be due to invalid IL or missing references)
				//IL_007d: Expected O, but got Unknown
				//IL_0085: Unknown result type (might be due to invalid IL or missing references)
				//IL_008b: Expected O, but got Unknown
				//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c0: Expected O, but got Unknown
				//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ce: Expected O, but got Unknown
				CodeMatcher val = new CodeMatcher(instructions, generator);
				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[6]
					{
						new CodeInstruction(OpCodes.Ldarg_0, (object)null),
						new CodeInstruction(OpCodes.Ldarg_1, (object)null),
						new CodeInstruction(OpCodes.Ldloc_1, (object)null),
						Transpilers.EmitDelegate<Action<DysonSwarm, DysonNode, int>>((Action<DysonSwarm, DysonNode, int>)delegate(DysonSwarm swarm, DysonNode node, int index)
						{
							if (node.ConstructCp() != null)
							{
								swarm.dysonSphere.productRegister[11903]++;
								swarm.dysonSphere.needRecalculatePower = true;
							}
							swarm.RemoveSolarSail(index);
						}),
						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 && PatchImpl<SkipAbsorbPatch>.GetHarmony() != null;
			}

			protected override void OnDisable()
			{
				_instantAbsorb = SkipAbsorbEnabled.Value && PatchImpl<SkipAbsorbPatch>.GetHarmony() != null;
			}

			[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>
		{
			private static bool _isBatchBuilding;

			private static bool _disableRefreshBatchesBuffers;

			private static bool _anyBelt;

			private static readonly HashSet<int> _alterBeltRendererIds = new HashSet<int>();

			private static readonly HashSet<int> _alterPathRendererIds = new HashSet<int>();

			private static readonly HashSet<int> _refreshPathUVIds = new HashSet<int>();

			public static bool IsBatchBuilding => _isBatchBuilding;

			public static void StartBatchBuilding(PlanetFactory factory)
			{
				factory.BeginFlattenTerrain();
				factory.cargoTraffic._batch_buffer_no_refresh = true;
				PlanetFactory.batchBuild = true;
				_isBatchBuilding = true;
				_disableRefreshBatchesBuffers = true;
				_anyBelt = false;
			}

			public static void EndBatchBuilding(PlanetFactory factory)
			{
				PlanetFactory.batchBuild = false;
				factory.cargoTraffic._batch_buffer_no_refresh = false;
				factory.EndFlattenTerrain();
				_isBatchBuilding = false;
				CargoTraffic cargoTraffic = factory.cargoTraffic;
				EntityData[] entityPool = factory.entityPool;
				ColliderContainer[] array = factory.planet.physics?.colChunks;
				foreach (int alterBeltRendererId in _alterBeltRendererIds)
				{
					cargoTraffic.AlterBeltRenderer(alterBeltRendererId, entityPool, array, false);
				}
				foreach (int alterPathRendererId in _alterPathRendererIds)
				{
					cargoTraffic.AlterPathRenderer(alterPathRendererId, false);
				}
				foreach (int refreshPathUVId in _refreshPathUVIds)
				{
					cargoTraffic.RefreshPathUV(refreshPathUVId);
				}
				_alterBeltRendererIds.Clear();
				_alterPathRendererIds.Clear();
				_refreshPathUVIds.Clear();
				_disableRefreshBatchesBuffers = false;
				if (_anyBelt)
				{
					factory.cargoTraffic.RefreshBeltBatchesBuffers();
					factory.cargoTraffic.RefreshPathBatchesBuffers();
				}
				_anyBelt = false;
				PlanetPhysics physics = factory.planet.physics;
				if (physics != null)
				{
					RaycastLogic raycastLogic = physics.raycastLogic;
					if (raycastLogic != null)
					{
						raycastLogic.NotifyBatchObjectRemove();
					}
				}
				PlanetAudio audio = factory.planet.audio;
				if (audio != null)
				{
					audio.SetPlanetAudioDirty();
				}
			}

			public static void TryEndBatchBuilding(PlanetFactory factory)
			{
				if (_isBatchBuilding)
				{
					EndBatchBuilding(factory);
				}
			}

			public static void InstantBuild(Player player, PlanetFactory factory, int id)
			{
				if (!_isBatchBuilding)
				{
					StartBatchBuilding(factory);
				}
				_anyBelt = _anyBelt || _beltIds.Contains(factory.prebuildPool[id].protoId);
				factory.BuildFinally(player, id, false, true);
			}

			[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) ? null : val.planet?.data) != 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_00e