Decompiled source of Auxilaryfunction v2.5.9

Auxilaryfunction.dll

Decompiled 2 months ago
using System;
using System.CodeDom.Compiler;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Resources;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using Auxilaryfunction.Patch;
using Auxilaryfunction.Services;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using UnityStandardAssets.ImageEffects;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Auxilaryfunction")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Auxilaryfunction")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("7fd6fcaf-8a28-43c7-adb5-3c05716882a7")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Auxilaryfunction
{
	[BepInPlugin("cn.blacksnipe.dsp.Auxilaryfunction", "Auxilaryfunction", "2.5.9")]
	public class Auxilaryfunction : BaseUnityPlugin
	{
		public const string GUID = "cn.blacksnipe.dsp.Auxilaryfunction";

		public const string NAME = "Auxilaryfunction";

		public const string VERSION = "2.5.9";

		public static string ErrorTitle = "辅助面板错误提示";

		public static GUIDraw guidraw;

		public static int automovetoPrebuildSecondElapseCounter;

		public static int autoaddtechid;

		public static int stationindex = 4;

		public static int locallogic;

		public static int remotelogic = 2;

		public static int pointsignalid;

		public static Light SunLight;

		public static List<int> assemblerpools;

		public static List<int> beltpools;

		public static List<int> ejectorpools;

		public static List<int> labpools;

		public static List<int> monitorpools;

		public static List<int> powergenGammapools;

		public static List<int> powerexchangertools;

		public static List<int> pointlayeridlist;

		public static List<int> readyresearch;

		public static List<int> stationpools;

		public static List<int> turrentpools;

		private float trashfunctiontime;

		public static float batchnum = 1f;

		public static bool temp;

		public static bool simulatorrender;

		public static bool simulatorchanging;

		public static bool HideDarkFogMonitor;

		public static bool HideDarkFogAssaultTip;

		public bool firstStart;

		public static bool ChangingQuickKey;

		public static bool GameDataImported;

		public static Dictionary<int, List<int>> EjectorDictionary;

		public static Player player;

		public static BuildingParameters buildingParameters;

		public static int[,] stationcopyItem = new int[5, 6];

		public static ERecipeType pointeRecipetype = (ERecipeType)0;

		public static bool StartAutoMovetounbuilt;

		public static bool autobuildgetitem;

		public static bool StartAutoMovetoDarkfog;

		public static bool autoRemoveRuin;

		public static int autoRemoveRuinId = -1;

		public static ConfigEntry<bool> AutoNavigateToDarkFogHive;

		public static ConfigEntry<int> AutoNavigateToDarkFogHiveKeepDistance;

		public static ConfigEntry<bool> SunLightOpen;

		public static ConfigEntry<bool> closeplayerflyaudio;

		public static ConfigEntry<bool> autosetSomevalue_bool;

		public static ConfigEntry<bool> noscaleuitech_bool;

		public static ConfigEntry<bool> TrashStorageWindow_bool;

		public static ConfigEntry<bool> autowarpcommand;

		public static ConfigEntry<bool> autoAddPlayerVel;

		public static ConfigEntry<bool> autonavigation_bool;

		public static ConfigEntry<bool> autoabsorttrash_bool;

		public static ConfigEntry<bool> onlygetbuildings;

		public static ConfigEntry<bool> autocleartrash_bool;

		public static ConfigEntry<bool> stationcopyItem_bool;

		public static ConfigEntry<bool> BluePrintDelete;

		public static ConfigEntry<bool> BluePrintRevoke;

		public static ConfigEntry<bool> BluePrintSetRecipe;

		public static ConfigEntry<bool> BluePrintSelectAll;

		public static ConfigEntry<bool> norender_shipdrone_bool;

		public static ConfigEntry<bool> norender_lab_bool;

		public static ConfigEntry<bool> norender_beltitem;

		public static ConfigEntry<bool> norender_DarkFog;

		public static ConfigEntry<bool> norender_dysonshell_bool;

		public static ConfigEntry<bool> norender_dysonswarm_bool;

		public static ConfigEntry<bool> norender_entity_bool;

		public static ConfigEntry<bool> norender_powerdisk_bool;

		public static ConfigEntry<bool> CloseUIRandomTip;

		public static ConfigEntry<bool> CloseUITutorialTip;

		public static ConfigEntry<bool> CloseUIAdvisor;

		public static ConfigEntry<bool> CloseMilestone;

		public static ConfigEntry<bool> autoaddtech_bool;

		public static ConfigEntry<bool> Quickstop_bool;

		public static ConfigEntry<bool> automovetounbuilt;

		public static ConfigEntry<bool> automovetodarkfog;

		public static ConfigEntry<bool> upsquickset;

		public static ConfigEntry<bool> autosavetimechange;

		public static ConfigEntry<bool> auto_supply_station;

		public static ConfigEntry<bool> autosetstationconfig;

		public static ConfigEntry<bool> auto_setejector_bool;

		public static ConfigEntry<bool> ShowStationInfo;

		public static ConfigEntry<bool> ShowStationInfoMode;

		public static ConfigEntry<bool> KeepBeltHeight;

		public static ConfigEntry<bool> autoAddwarp;

		public static ConfigEntry<double> stationwarpdist;

		public static ConfigEntry<bool> DysonPanelSingleLayer;

		public static ConfigEntry<bool> DysonPanelLayers;

		public static ConfigEntry<bool> DysonPanelSwarm;

		public static ConfigEntry<bool> DysonPanelDysonSphere;

		public static ConfigEntry<KeyboardShortcut> QuickKey;

		public static ConfigEntry<int> auto_add_techid;

		public static ConfigEntry<int> auto_add_techmaxLevel;

		public static ConfigEntry<int> auto_supply_Courier;

		public static ConfigEntry<int> stationdronedist;

		public static ConfigEntry<int> autosavetime;

		public static ConfigEntry<int> stationshipdist;

		public static ConfigEntry<int> auto_supply_starfuel;

		public static ConfigEntry<int> auto_supply_starfuelID;

		public static ConfigEntry<int> auto_supply_drone;

		public static ConfigEntry<int> auto_supply_ship;

		public static ConfigEntry<int> auto_supply_warp;

		public static ConfigEntry<int> veincollectorspeed;

		public static ConfigEntry<bool> SaveLastOpenBluePrintBrowserPathConfig;

		public static ConfigEntry<float> window_width;

		public static ConfigEntry<float> window_height;

		public static ConfigEntry<float> stationmaxpowerpertick;

		public static ConfigEntry<float> autowarpdistance;

		public static ConfigEntry<float> automovetoPrebuildSecondElapse;

		public static ConfigEntry<float> autowarpdistanceEnergyPercent;

		public static ConfigEntry<float> DroneStartCarry;

		public static ConfigEntry<float> ShipStartCarry;

		public static ConfigEntry<string> LastOpenBluePrintBrowserPathConfig;

		public static Thread autobuildThread;

		public static int maxCount = 0;

		public static GameObject[] tips = (GameObject[])(object)new GameObject[maxCount];

		public static GameObject stationTip;

		public static GameObject tipPrefab;

		public static GameObject beltWindow;

		public static GameObject SpeakerPanel;

		public static GameObject TurretWindow;

		public static GameObject PowerExchangerWindow;

		public static GameObject TrashStorageWindow;

		public static GameObject TrashCanButton;

		public static StorageComponent TrashStorage;

		public static UITurretWindow uiturretWindow;

		public static UIStorageWindow uiTrashStorageWindow;

		public static UIPowerExchangerWindow uipowerExchangerWindow;

		public static Harmony harmony;

		public static PlanetData LocalPlanet => GameMain.localPlanet;

		private void Start()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: Expected O, but got Unknown
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0972: Unknown result type (might be due to invalid IL or missing references)
			//IL_0977: Unknown result type (might be due to invalid IL or missing references)
			//IL_097b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0982: Invalid comparison between Unknown and I4
			//IL_0989: Unknown result type (might be due to invalid IL or missing references)
			//IL_098e: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_09a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_09bd: Invalid comparison between Unknown and I4
			//IL_09de: Unknown result type (might be due to invalid IL or missing references)
			harmony = new Harmony("cn.blacksnipe.dsp.Auxilaryfunction");
			harmony.PatchAll(typeof(AuxilaryfunctionPatch));
			AuxilaryTranslate.regallTranslate();
			trashfunctiontime = Time.time;
			QuickKey = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("打开窗口快捷键", "Key", new KeyboardShortcut((KeyCode)308, (KeyCode[])(object)new KeyCode[1] { (KeyCode)50 }), (ConfigDescription)null);
			GUIDraw.tempShowWindow = QuickKey.Value;
			auto_setejector_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("自动配置太阳帆弹射器", "auto_setejector_bool", false, (ConfigDescription)null);
			auto_supply_station = ((BaseUnityPlugin)this).Config.Bind<bool>("自动配置新运输站", "auto_supply_station", false, (ConfigDescription)null);
			autosetstationconfig = ((BaseUnityPlugin)this).Config.Bind<bool>("自动配置新运输站参数显示", "autosetstationconfig", true, (ConfigDescription)null);
			auto_supply_Courier = ((BaseUnityPlugin)this).Config.Bind<int>("自动填充配送机", "auto_supply_Courier", 10, (ConfigDescription)null);
			auto_supply_drone = ((BaseUnityPlugin)this).Config.Bind<int>("自动填充飞机数量", "auto_supply_drone", 10, (ConfigDescription)null);
			auto_supply_ship = ((BaseUnityPlugin)this).Config.Bind<int>("自动填充飞船数量", "auto_supply_ship", 5, (ConfigDescription)null);
			stationmaxpowerpertick = ((BaseUnityPlugin)this).Config.Bind<float>("自动设置最大充电功率", "autowarpdistance", 30f, (ConfigDescription)null);
			stationwarpdist = ((BaseUnityPlugin)this).Config.Bind<double>("自动设置物流站使用翘曲器距离", "stationwarpdist", 12.0, (ConfigDescription)null);
			DroneStartCarry = ((BaseUnityPlugin)this).Config.Bind<float>("自动设置物流站小飞机起送量", "DroneStartCarry", 0.1f, (ConfigDescription)null);
			ShipStartCarry = ((BaseUnityPlugin)this).Config.Bind<float>("自动设置物流站运输船起送量", "ShipStartCarry", 1f, (ConfigDescription)null);
			veincollectorspeed = ((BaseUnityPlugin)this).Config.Bind<int>("大型采矿机采矿速度", "veincollectorspeed", 10, (ConfigDescription)null);
			auto_supply_warp = ((BaseUnityPlugin)this).Config.Bind<int>("自动设置物流站翘曲器数量", "auto_supply_warp", 0, (ConfigDescription)null);
			stationdronedist = ((BaseUnityPlugin)this).Config.Bind<int>("自动设置物流站运输机最远距离", "stationdronedist", 180, (ConfigDescription)null);
			stationshipdist = ((BaseUnityPlugin)this).Config.Bind<int>("自动设置物流站运输船最远距离", "stationshipdist", 61, (ConfigDescription)null);
			GUIDraw.scale = ((BaseUnityPlugin)this).Config.Bind<int>("大小适配", "scale", 16, (ConfigDescription)null);
			SunLightOpen = ((BaseUnityPlugin)this).Config.Bind<bool>("夜灯", "SunLight", false, (ConfigDescription)null);
			closeplayerflyaudio = ((BaseUnityPlugin)this).Config.Bind<bool>("关闭玩家飞行声音", "closeplayerflyaudio", false, (ConfigDescription)null);
			BluePrintDelete = ((BaseUnityPlugin)this).Config.Bind<bool>("蓝图删除", "BluePrintDelete", false, (ConfigDescription)null);
			BluePrintRevoke = ((BaseUnityPlugin)this).Config.Bind<bool>("蓝图撤销", "BluePrintRevoke", false, (ConfigDescription)null);
			BluePrintSelectAll = ((BaseUnityPlugin)this).Config.Bind<bool>("蓝图全选", "BluePrintSelectAll", false, (ConfigDescription)null);
			BluePrintSetRecipe = ((BaseUnityPlugin)this).Config.Bind<bool>("蓝图配方", "BluePrintSetRecipe", false, (ConfigDescription)null);
			stationcopyItem_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("物流站复制物品配方", "stationcopyItem_bool", false, (ConfigDescription)null);
			autocleartrash_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("30s间隔自动清除垃圾", "autocleartrash_bool", false, (ConfigDescription)null);
			autoabsorttrash_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("30s间隔自动吸收垃圾", "autoabsorttrash_bool", false, (ConfigDescription)null);
			onlygetbuildings = ((BaseUnityPlugin)this).Config.Bind<bool>("只回收建筑", "onlygetbuildings", false, (ConfigDescription)null);
			autowarpcommand = ((BaseUnityPlugin)this).Config.Bind<bool>("自动导航使用翘曲", "autowarpcommand", false, (ConfigDescription)null);
			CloseUIRandomTip = ((BaseUnityPlugin)this).Config.Bind<bool>("关闭建筑栏提示", "CloseUIRandomTip", false, (ConfigDescription)null);
			CloseUITutorialTip = ((BaseUnityPlugin)this).Config.Bind<bool>("关闭教学提示", "CloseUITutorialTip", false, (ConfigDescription)null);
			CloseUIAdvisor = ((BaseUnityPlugin)this).Config.Bind<bool>("关闭顾问", "CloseUIAdvisor", false, (ConfigDescription)null);
			CloseMilestone = ((BaseUnityPlugin)this).Config.Bind<bool>("关闭里程碑", "CloseMilestone", false, (ConfigDescription)null);
			autoAddwarp = ((BaseUnityPlugin)this).Config.Bind<bool>("自动添加翘曲器", "autoAddwarp", false, (ConfigDescription)null);
			autonavigation_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("自动导航", "autonavigation_bool", false, (ConfigDescription)null);
			autoAddPlayerVel = ((BaseUnityPlugin)this).Config.Bind<bool>("自动加速", "autoAddPlayerVel", false, (ConfigDescription)null);
			autowarpdistance = ((BaseUnityPlugin)this).Config.Bind<float>("自动使用翘曲器距离", "autowarpdistance", 0f, (ConfigDescription)null);
			autowarpdistanceEnergyPercent = ((BaseUnityPlugin)this).Config.Bind<float>("自动曲速能量阈值", "autowarpdistanceEnergyPercent", 0f, (ConfigDescription)null);
			autoaddtech_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("自动添加科技队列", "autoaddtech_bool", false, (ConfigDescription)null);
			auto_add_techid = ((BaseUnityPlugin)this).Config.Bind<int>("自动添加科技队列科技ID", "auto_add_techid", 0, (ConfigDescription)null);
			auto_add_techmaxLevel = ((BaseUnityPlugin)this).Config.Bind<int>("自动添加科技队列科技等级上限", "auto_add_techmaxLevel", 500, (ConfigDescription)null);
			ShowStationInfo = ((BaseUnityPlugin)this).Config.Bind<bool>("展示物流站信息", "ShowStationInfo", false, (ConfigDescription)null);
			ShowStationInfoMode = ((BaseUnityPlugin)this).Config.Bind<bool>("展示物流站信息模式", "ShowStationInfoMode", false, (ConfigDescription)null);
			SaveLastOpenBluePrintBrowserPathConfig = ((BaseUnityPlugin)this).Config.Bind<bool>("记录上次蓝图路径", "SaveLastOpenBluePrintBrowserPathConfig", false, (ConfigDescription)null);
			noscaleuitech_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("科技页面不缩放", "noscaleuitech_bool", false, (ConfigDescription)null);
			norender_shipdrone_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("不渲染飞机飞船", "norender_shipdrone_bool", false, (ConfigDescription)null);
			norender_lab_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("不渲染研究室", "norender_lab_bool", false, (ConfigDescription)null);
			norender_beltitem = ((BaseUnityPlugin)this).Config.Bind<bool>("不渲染传送带货物", "norender_beltitem", false, (ConfigDescription)null);
			norender_dysonshell_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("不渲染戴森壳", "norender_dysonshell_bool", false, (ConfigDescription)null);
			norender_dysonswarm_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("不渲染戴森云", "norender_dysonswarm_bool", false, (ConfigDescription)null);
			norender_DarkFog = ((BaseUnityPlugin)this).Config.Bind<bool>("不渲染黑雾", "norender_DarkFog", false, (ConfigDescription)null);
			norender_entity_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("不渲染实体", "norender_entity_bool", false, (ConfigDescription)null);
			norender_powerdisk_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("不渲染电网覆盖", "norender_powerdisk_bool", false, (ConfigDescription)null);
			Quickstop_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("ctrl+空格开启暂停工厂和戴森球", "Quickstop_bool", false, (ConfigDescription)null);
			automovetounbuilt = ((BaseUnityPlugin)this).Config.Bind<bool>("自动走向未完成建筑", "automovetounbuilt", false, (ConfigDescription)null);
			automovetoPrebuildSecondElapse = ((BaseUnityPlugin)this).Config.Bind<float>("自动走向未完成建筑时间间隔", "automovetoPrebuildSecondElapse", 1f, (ConfigDescription)null);
			automovetodarkfog = ((BaseUnityPlugin)this).Config.Bind<bool>("自动飞向地面黑雾基地", "automovetodarkfog", false, (ConfigDescription)null);
			upsquickset = ((BaseUnityPlugin)this).Config.Bind<bool>("快速设置逻辑帧倍数", "upsquickset", false, (ConfigDescription)null);
			autosetSomevalue_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("自动配置建筑", "autosetSomevalue_bool", false, (ConfigDescription)null);
			auto_supply_starfuel = ((BaseUnityPlugin)this).Config.Bind<int>("人造恒星自动填充燃料数量", "auto_supply_starfuel", 4, (ConfigDescription)null);
			auto_supply_starfuelID = ((BaseUnityPlugin)this).Config.Bind<int>("人造恒星自动填充燃料ID", "auto_supply_starfuelID", 1803, (ConfigDescription)null);
			autosavetimechange = ((BaseUnityPlugin)this).Config.Bind<bool>("自动保存", "autosavetimechange", false, (ConfigDescription)null);
			KeepBeltHeight = ((BaseUnityPlugin)this).Config.Bind<bool>("保持传送带高度", "KeepBeltHeight", false, (ConfigDescription)null);
			autosavetime = ((BaseUnityPlugin)this).Config.Bind<int>("自动保存时间", "autosavetime", 25, (ConfigDescription)null);
			DysonPanelSingleLayer = ((BaseUnityPlugin)this).Config.Bind<bool>("单层壳列表", "DysonPanelSingleLayer", true, (ConfigDescription)null);
			DysonPanelLayers = ((BaseUnityPlugin)this).Config.Bind<bool>("多层壳列表", "DysonPanelLayers", true, (ConfigDescription)null);
			DysonPanelSwarm = ((BaseUnityPlugin)this).Config.Bind<bool>("戴森云列表", "DysonPanelSwarm", true, (ConfigDescription)null);
			DysonPanelDysonSphere = ((BaseUnityPlugin)this).Config.Bind<bool>("戴森壳列表", "DysonPanelDysonSphere", true, (ConfigDescription)null);
			TrashStorageWindow_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("背包垃圾桶", "TrashStorageWindow_bool", false, (ConfigDescription)null);
			window_height = ((BaseUnityPlugin)this).Config.Bind<float>("窗口高度", "window_height", 660f, (ConfigDescription)null);
			window_width = ((BaseUnityPlugin)this).Config.Bind<float>("窗口宽度", "window_width", 830f, (ConfigDescription)null);
			LastOpenBluePrintBrowserPathConfig = ((BaseUnityPlugin)this).Config.Bind<string>("上次打开蓝图路径", "LastOpenBluePrintBrowserPathConfig", "", (ConfigDescription)null);
			AutoNavigateToDarkFogHive = ((BaseUnityPlugin)this).Config.Bind<bool>("自动导航至黑雾巢穴", "AutoNavigateToDarkFogHive", false, (ConfigDescription)null);
			AutoNavigateToDarkFogHiveKeepDistance = ((BaseUnityPlugin)this).Config.Bind<int>("自动导航至黑雾巢穴跟随距离", "AutoNavigateToDarkFogHiveKeepDistance", 400, (ConfigDescription)null);
			if (closeplayerflyaudio.Value)
			{
				PlayerAudioMutePatch.Enable = true;
			}
			closeplayerflyaudio.SettingChanged += delegate
			{
				PlayerAudioMutePatch.Enable = closeplayerflyaudio.Value;
			};
			if (autonavigation_bool.Value)
			{
				PlayerOperation.Enable = true;
			}
			autonavigation_bool.SettingChanged += delegate
			{
				PlayerOperation.Enable = autonavigation_bool.Value;
			};
			if (SunLightOpen.Value)
			{
				SunLightPatch.Enable = SunLightOpen.Value;
			}
			SunLightOpen.SettingChanged += delegate
			{
				SunLightPatch.Enable = SunLightOpen.Value;
			};
			((Vector2)(ref GUIDraw.scrollPosition))[0] = 0f;
			((Vector2)(ref GUIDraw.dysonBluePrintscrollPosition))[0] = 0f;
			KeyboardShortcut value = QuickKey.Value;
			if ((int)((KeyboardShortcut)(ref value)).MainKey == 50)
			{
				value = QuickKey.Value;
				if (((KeyboardShortcut)(ref value)).Modifiers.Count() == 1)
				{
					value = QuickKey.Value;
					if ((int)((KeyboardShortcut)(ref value)).Modifiers.ElementAt(0) == 308)
					{
						QuickKey.Value = new KeyboardShortcut((KeyCode)308, (KeyCode[])(object)new KeyCode[1] { (KeyCode)50 });
					}
				}
			}
			assemblerpools = new List<int>();
			beltpools = new List<int>();
			ejectorpools = new List<int>();
			labpools = new List<int>();
			monitorpools = new List<int>();
			powergenGammapools = new List<int>();
			powerexchangertools = new List<int>();
			pointlayeridlist = new List<int>();
			readyresearch = new List<int>();
			stationpools = new List<int>();
			turrentpools = new List<int>();
			GameObject val = AssetBundle.LoadFromStream(Assembly.GetExecutingAssembly().GetManifestResourceStream("Auxilaryfunction.auxilarypanel")).LoadAsset<GameObject>("AuxilaryPanel");
			GameObject panel = Object.Instantiate<GameObject>(val, ((Component)UIRoot.instance.overlayCanvas).transform);
			guidraw = new GUIDraw(Math.Max(5, Math.Min(GUIDraw.scale.Value, 35)), panel);
			DysonBluePrintDataService.LoadDysonBluePrintData();
			ThreadPool.QueueUserWorkItem(delegate
			{
				SecondEvent();
			});
			autoaddtechid = auto_add_techid.Value;
		}

		private void Update()
		{
			AutoSaveTimeChange();
			GameUpdate();
			ChangeQuickKeyMethod();
			guidraw.GUIUpdate();
			if (upsquickset.Value && Input.GetKey((KeyCode)304))
			{
				if (Input.GetKey((KeyCode)270))
				{
					SpeedUpPatch.SpeedMultiple += 0.01f;
				}
				if (Input.GetKey((KeyCode)269))
				{
					SpeedUpPatch.SpeedMultiple -= 0.01f;
				}
				if ((double)SpeedUpPatch.SpeedMultiple < 0.01)
				{
					SpeedUpPatch.SpeedMultiple = 0.01f;
				}
				else if (SpeedUpPatch.SpeedMultiple > 10f)
				{
					SpeedUpPatch.SpeedMultiple = 10f;
				}
			}
		}

		private void SunLightSet()
		{
			//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			if (SunLightOpen.Value && GameMain.localPlanet != null)
			{
				UniverseSimulator universeSimulator = GameMain.universeSimulator;
				if (!((Object)(object)((universeSimulator == null) ? null : universeSimulator.LocalStarSimulator()?.sunLight) == (Object)null))
				{
					if ((Object)(object)SunLight == (Object)null)
					{
						SunLight = Object.Instantiate<Light>(GameMain.universeSimulator.LocalStarSimulator().sunLight, GameMain.mainPlayer.transform);
						((Behaviour)SunLight).enabled = true;
						((Component)SunLight).transform.position = GameMain.mainPlayer.position + GameMain.mainPlayer.transform.up * 5f;
						((Component)SunLight).transform.rotation = Quaternion.LookRotation(-GameMain.mainPlayer.transform.up);
						((Component)SunLight).transform.localPosition = new Vector3(0f, 5f, 0f);
						((Object)SunLight).name = "PlayerLight";
						SunLight.intensity = 1f;
					}
					if (FactoryModel.whiteMode0)
					{
						((Behaviour)SunLight).enabled = false;
					}
					else
					{
						((Behaviour)SunLight).enabled = true;
					}
					return;
				}
			}
			if ((Object)(object)SunLight != (Object)null)
			{
				Object.Destroy((Object)(object)((Component)SunLight).gameObject);
				SunLight = null;
			}
		}

		private void OnGUI()
		{
			guidraw.Draw();
		}

		private void SecondEvent()
		{
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			while (true)
			{
				if (!GameDataImported)
				{
					continue;
				}
				if (auto_setejector_bool.Value)
				{
					ResetEjector();
				}
				if (autoAddwarp.Value)
				{
					AutoAddwarp();
				}
				if (autoaddtech_bool.Value && autoaddtechid > 0 && GameMain.history != null && GameMain.history.techQueueLength == 0)
				{
					TechState val = GameMain.history.techStates[autoaddtechid];
					if (val.curLevel == val.maxLevel)
					{
						autoaddtechid = 0;
						auto_add_techid.Value = 0;
					}
					else if (val.curLevel < auto_add_techmaxLevel.Value)
					{
						GameMain.history.EnqueueTech(autoaddtechid);
					}
				}
				if (automovetounbuilt.Value)
				{
					try
					{
						AutoMovetounbuilt();
					}
					catch (Exception ex)
					{
						Console.WriteLine(ex.ToString());
					}
				}
				if (automovetodarkfog.Value)
				{
					try
					{
						AutoMoveToDarkfog();
					}
					catch (Exception ex2)
					{
						Console.WriteLine(ex2.ToString());
					}
				}
				Thread.Sleep(1000);
			}
		}

		private void AutoSaveTimeChange()
		{
			if (autosavetimechange.Value && UIAutoSave.autoSaveTime != (float)autosavetime.Value)
			{
				Debug.Log((object)"AutoSaveTimeChange");
				DSPGame.globalOption.autoSaveTime = autosavetime.Value;
				((GameOption)(ref DSPGame.globalOption)).Apply();
				UIAutoSave.autoSaveTime = autosavetime.Value;
			}
		}

		private void GameUpdate()
		{
			if (!GameDataImported)
			{
				player = null;
				firstStart = true;
				readyresearch.Clear();
				SpeedUpPatch.SpeedMultiple = 1f;
				autoaddtechid = 0;
				GUIDraw.blueprintopen = false;
				simulatorrender = false;
				PlayerOperation.FlyStatus = false;
				PlayerOperation.Enable = false;
				return;
			}
			if (GameMain.mainPlayer != null && player == null)
			{
				player = GameMain.mainPlayer;
				player.controller.actionInspect.onInspecteeChange += delegate(EObjectType _, int b)
				{
					if (b > 0)
					{
						guidraw.CloseTrashStorageWindow();
					}
				};
				if (autonavigation_bool.Value)
				{
					PlayerOperation.Enable = true;
				}
			}
			if (firstStart)
			{
				firstStart = false;
				PlayerOperation.ClearFollow();
				trashfunctiontime = Time.time;
				ReLoadEjectorDic();
				return;
			}
			StartAndStopGame();
			BluePrintoptimize();
			TrashFunction();
			EnqueueTech();
			autoaddtechid = auto_add_techid.Value;
			SunLightSet();
			if (autoRemoveRuin && autoRemoveRuinId >= 0)
			{
				Player obj = player;
				if (((obj == null) ? null : obj.controller?.actionBuild?.reformTool) != null)
				{
					player.controller.actionBuild.reformTool.RemoveBasePit(autoRemoveRuinId);
				}
			}
			autoRemoveRuinId = -1;
		}

		private void AutoMovetounbuilt()
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Invalid comparison between Unknown and I4
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0169: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_035f: Unknown result type (might be due to invalid IL or missing references)
			//IL_036e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a7: Unknown result type (might be due to invalid IL or missing references)
			if (!StartAutoMovetounbuilt || GameMain.localPlanet == null || GameMain.mainPlayer == null || (int)GameMain.mainPlayer.movementState != 2)
			{
				return;
			}
			automovetoPrebuildSecondElapseCounter++;
			if ((float)automovetoPrebuildSecondElapseCounter < automovetoPrebuildSecondElapse.Value)
			{
				return;
			}
			automovetoPrebuildSecondElapseCounter -= (int)automovetoPrebuildSecondElapse.Value;
			float num = 3000f;
			int num2 = -1;
			PrebuildData[] prebuildPool = GameMain.localPlanet.factory.prebuildPool;
			foreach (PrebuildData val in prebuildPool)
			{
				if (val.id == 0 || val.itemRequired > 0)
				{
					continue;
				}
				Vector3 val2;
				if (num2 != -1)
				{
					float num3 = num;
					val2 = val.pos - GameMain.mainPlayer.position;
					if (!(num3 > ((Vector3)(ref val2)).magnitude))
					{
						continue;
					}
				}
				num2 = val.id;
				val2 = val.pos - GameMain.mainPlayer.position;
				num = ((Vector3)(ref val2)).magnitude;
			}
			if (num2 == -1)
			{
				bool flag = true;
				PrebuildData[] prebuildPool2 = GameMain.localPlanet.factory.prebuildPool;
				foreach (PrebuildData val3 in prebuildPool2)
				{
					if (val3.id != 0 && val3.protoId != 0 && GameMain.mainPlayer.package.GetItemCount((int)val3.protoId) > 0)
					{
						num2 = val3.id;
						flag = false;
						break;
					}
				}
				if (!flag || !autobuildgetitem)
				{
					return;
				}
				int[] warningCounts = GameMain.data.warningSystem.warningCounts;
				WarningData[] warningPool = GameMain.data.warningSystem.warningPool;
				List<int> list = new List<int>();
				int num4 = 0;
				int num5 = player.package.grids.Length;
				int num6 = num5 - 1;
				while (num6 >= 0 && player.package.grids[num6].count == 0)
				{
					num6--;
					num4++;
				}
				for (int k = 1; k < GameMain.data.warningSystem.warningCursor; k++)
				{
					if (num4 <= 0)
					{
						break;
					}
					if (!list.Contains(warningPool[k].detailId))
					{
						if (player.package.GetItemCount(warningPool[k].detailId) > 0)
						{
							break;
						}
						list.Add(warningPool[k].detailId);
						FindItemAndMove(warningPool[k].detailId, warningCounts[warningPool[k].signalId]);
					}
				}
			}
			else if (num2 != -1 && num2 != 0 && num2 == GameMain.localPlanet.factory.prebuildPool[num2].id)
			{
				GameMain.mainPlayer.Order(OrderNode.MoveTo(((Vector3)(ref GameMain.localPlanet.factory.prebuildPool[num2].pos)).normalized * GameMain.localPlanet.realRadius), false);
			}
		}

		private void AutoMoveToDarkfog()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			//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_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_018f: Unknown result type (might be due to invalid IL or missing references)
			//IL_019e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_011a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: 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)
			autoRemoveRuinId = -1;
			if (GameMain.localPlanet == null || GameMain.mainPlayer == null || (int)GameMain.mainPlayer.movementState != 2 || !StartAutoMovetoDarkfog)
			{
				return;
			}
			EnemyDFGroundSystem enemySystem = GameMain.localPlanet.factory.enemySystem;
			float num = 100000000f;
			DFGBaseComponent val = null;
			for (int i = 1; i < enemySystem.bases.cursor; i++)
			{
				if (enemySystem.bases[i] == null || enemySystem.bases[i].id != i || (!autoRemoveRuin && enemySystem.CheckBaseCanRemoved(i) == 0))
				{
					continue;
				}
				Vector3 val2 = VectorLF3.op_Implicit(GameMain.localPlanet.factory.enemyPool[enemySystem.bases[i].enemyId].pos);
				Vector3 val3;
				if (val != null)
				{
					float num2 = num;
					val3 = val2 - player.position;
					if (!(num2 > ((Vector3)(ref val3)).magnitude))
					{
						continue;
					}
				}
				val = enemySystem.bases[i];
				val3 = val2 - player.position;
				num = ((Vector3)(ref val3)).magnitude;
			}
			if (val != null)
			{
				Vector3 val4 = VectorLF3.op_Implicit(GameMain.localPlanet.factory.enemyPool[val.enemyId].pos);
				GameMain.mainPlayer.Order(OrderNode.MoveTo(((Vector3)(ref val4)).normalized * GameMain.localPlanet.realRadius), false);
				if (autoRemoveRuin && enemySystem.CheckBaseCanRemoved(val.id) == 0)
				{
					autoRemoveRuinId = val.ruinId;
				}
			}
		}

		private static void FindItemAndMove(int itemId, int itemCount)
		{
			//IL_02a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02de: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0335: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			if (LocalPlanet == null || LocalPlanet.factory == null || LocalPlanet.gasItems != null || (Object)(object)LDB.items == (Object)null || ((ProtoSet<ItemProto>)(object)LDB.items).Select(itemId) == null)
			{
				return;
			}
			int num = player.package.grids.Length;
			int num2 = 0;
			if (player.package.grids[num - 1].count != 0)
			{
				player.package.Sort(true);
			}
			int num3 = num - 1;
			while (num3 >= 0 && player.package.grids[num3].count == 0)
			{
				num3--;
				num2++;
			}
			int num4 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(itemId).StackSize * num2;
			itemCount = ((num4 > itemCount) ? itemCount : num4);
			PlanetFactory factory = LocalPlanet.factory;
			if (factory.transport != null && factory.transport.stationPool != null)
			{
				int num5 = 0;
				int num6 = 0;
				StationComponent[] stationPool = factory.transport.stationPool;
				int num9 = default(int);
				foreach (StationComponent val in stationPool)
				{
					if (itemCount == 0)
					{
						break;
					}
					if (val != null && val.storage != null)
					{
						int num7 = itemCount;
						int num8 = itemId;
						val.TakeItem(ref num8, ref num7, ref num9);
						num5 += num7;
						itemCount -= num7;
						num6 += num9;
					}
				}
				player.TryAddItemToPackage(itemId, num5, num6, false, 0, false);
			}
			if (factory.factoryStorage == null || factory.factoryStorage.storagePool == null)
			{
				return;
			}
			if (factory.factoryStorage.storagePool != null)
			{
				StorageComponent[] storagePool = factory.factoryStorage.storagePool;
				int num10 = default(int);
				foreach (StorageComponent val2 in storagePool)
				{
					if (itemCount == 0)
					{
						break;
					}
					if (val2 != null)
					{
						int num11 = val2.TakeItem(itemId, itemCount, ref num10);
						itemCount -= num11;
						if (num11 > 0)
						{
							player.TryAddItemToPackage(itemId, num11, num10, false, 0, false);
						}
					}
				}
			}
			if (factory.factoryStorage.tankPool == null)
			{
				return;
			}
			TankComponent[] tankPool = factory.factoryStorage.tankPool;
			foreach (TankComponent val3 in tankPool)
			{
				if (itemCount == 0)
				{
					break;
				}
				if (val3.id > 0 && val3.fluidId > 0 && val3.fluidCount > 0 && itemId == val3.fluidId)
				{
					int num12 = ((val3.fluidCount > itemCount) ? itemCount : val3.fluidCount);
					int num13 = (int)((double)(val3.fluidInc / val3.fluidCount) + 0.5) * num12;
					factory.factoryStorage.tankPool[val3.id].fluidCount -= num12;
					factory.factoryStorage.tankPool[val3.id].fluidInc -= num13;
					itemCount -= num12;
					if (num12 > 0)
					{
						player.TryAddItemToPackage(itemId, num12, num13, false, 0, false);
					}
				}
			}
		}

		private void EnqueueTech()
		{
			if (readyresearch.Count <= 0)
			{
				return;
			}
			try
			{
				for (int i = 0; i < readyresearch.Count; i++)
				{
					if (GameMain.history.techQueueLength >= 7)
					{
						break;
					}
					if (GameMain.history.TechUnlocked(readyresearch[i]))
					{
						readyresearch.RemoveAt(i);
					}
					else if (!GameMain.history.TechInQueue(readyresearch[i]))
					{
						if (!GameMain.history.CanEnqueueTech(readyresearch[i]))
						{
							readyresearch.RemoveAt(i);
						}
						else
						{
							GameMain.history.EnqueueTech(readyresearch[i]);
						}
					}
				}
			}
			catch
			{
			}
		}

		private void ReLoadEjectorDic()
		{
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			EjectorDictionary = new Dictionary<int, List<int>>();
			if (GameMain.galaxy == null || GameMain.galaxy.stars == null)
			{
				return;
			}
			StarData[] stars = GameMain.galaxy.stars;
			foreach (StarData val in stars)
			{
				PlanetData[] planets = val.planets;
				foreach (PlanetData val2 in planets)
				{
					if (val2.factory == null || val2.factory.factorySystem == null)
					{
						continue;
					}
					FactorySystem factorySystem = val2.factory.factorySystem;
					List<int> list = new List<int>();
					int num = 0;
					EjectorComponent[] ejectorPool = factorySystem.ejectorPool;
					foreach (EjectorComponent val3 in ejectorPool)
					{
						if (val3.id > 0 && val3.entityId > 0)
						{
							int protoId = factorySystem.factory.entityPool[val3.entityId].protoId;
							list.Add(num);
						}
						num++;
					}
					if (list.Count > 0)
					{
						EjectorDictionary[val2.id] = list;
					}
				}
			}
		}

		public static void AddDroneShipToStation()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			if (LocalPlanet == null || (int)LocalPlanet.type == 5)
			{
				return;
			}
			int value = auto_supply_Courier.Value;
			int value2 = auto_supply_ship.Value;
			int value3 = auto_supply_drone.Value;
			int value4 = auto_supply_warp.Value;
			DispenserComponent[] dispenserPool = LocalPlanet.factory.transport.dispenserPool;
			int num2 = default(int);
			foreach (DispenserComponent val in dispenserPool)
			{
				if (val != null)
				{
					int num = value - val.idleCourierCount - val.workCourierCount;
					if (num > 0)
					{
						val.idleCourierCount += player.package.TakeItem(5003, num, ref num2);
					}
				}
			}
			StationComponent[] stationPool = LocalPlanet.factory.transport.stationPool;
			foreach (StationComponent val2 in stationPool)
			{
				if (val2 != null && !val2.isVeinCollector)
				{
					int num3 = (val2.isStellar ? 100 : 50);
					int num4 = ((value3 > num3) ? num3 : value3);
					int num5 = num4 - val2.workDroneCount - val2.idleDroneCount;
					if (num5 > 0)
					{
						val2.idleDroneCount += player.package.TakeItem(5001, num5, ref num2);
					}
					int num6 = value2 - val2.idleShipCount - val2.workShipCount;
					if (val2.isStellar && num6 > 0)
					{
						val2.idleShipCount += player.package.TakeItem(5002, num6, ref num2);
					}
					int num7 = value4 - val2.warperCount;
					if (num7 > 0)
					{
						val2.warperCount += player.package.TakeItem(1210, num7, ref num2);
					}
				}
			}
		}

		public static void ChangeAllVeinCollectorSpeedConfig()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			if (LocalPlanet == null || (int)LocalPlanet.type == 5)
			{
				return;
			}
			StationComponent[] stationPool = LocalPlanet.factory.transport.stationPool;
			foreach (StationComponent val in stationPool)
			{
				if (val != null && val.isVeinCollector)
				{
					LocalPlanet.factory.factorySystem.minerPool[val.minerId].speed = veincollectorspeed.Value * 1000;
				}
			}
		}

		public static void ChangeAllStationConfig()
		{
			if (LocalPlanet == null || LocalPlanet.factory == null || LocalPlanet.factory.transport == null || LocalPlanet.factory.transport.stationPool == null)
			{
				return;
			}
			StationComponent[] stationPool = LocalPlanet.factory.transport.stationPool;
			foreach (StationComponent val in stationPool)
			{
				if (val != null && !val.isVeinCollector)
				{
					val.tripRangeDrones = Math.Cos((double)stationdronedist.Value * Math.PI / 180.0);
					LocalPlanet.factory.powerSystem.consumerPool[val.pcId].workEnergyPerTick = (long)stationmaxpowerpertick.Value * 16667;
					if (stationmaxpowerpertick.Value > 60f && !val.isStellar)
					{
						LocalPlanet.factory.powerSystem.consumerPool[val.pcId].workEnergyPerTick = 1000020L;
					}
					val.deliveryDrones = ((DroneStartCarry.Value == 0f) ? 1 : ((int)(DroneStartCarry.Value * 10f) * 10));
					if (val.isStellar)
					{
						val.warpEnableDist = stationwarpdist.Value * 40000.0;
						val.deliveryShips = ((ShipStartCarry.Value == 0f) ? 1 : ((int)(ShipStartCarry.Value * 10f) * 10));
						val.tripRangeShips = ((stationshipdist.Value > 60) ? 24000000000L : (stationshipdist.Value * 2400000));
					}
				}
			}
		}

		public static void SetGasStation()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_0336: Unknown result type (might be due to invalid IL or missing references)
			//IL_033b: Unknown result type (might be due to invalid IL or missing references)
			//IL_034f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			//IL_0356: Unknown result type (might be due to invalid IL or missing references)
			//IL_0371: Unknown result type (might be due to invalid IL or missing references)
			//IL_0376: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Unknown result type (might be due to invalid IL or missing references)
			//IL_037a: Unknown result type (might be due to invalid IL or missing references)
			//IL_037c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0381: Unknown result type (might be due to invalid IL or missing references)
			//IL_0385: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03be: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_0424: Unknown result type (might be due to invalid IL or missing references)
			//IL_0448: Unknown result type (might be due to invalid IL or missing references)
			if (LocalPlanet == null || (int)LocalPlanet.type != 5)
			{
				return;
			}
			PlanetFactory factory = LocalPlanet.factory;
			if (factory != null)
			{
				StationComponent[] stationPool = factory.transport.stationPool;
				foreach (StationComponent val in stationPool)
				{
					if (val != null && val.isCollector)
					{
						UIMessageBox.Show("铺满轨道采集器失败", "当前星球存在采集器,请先清空所有建筑", "确定", 3);
						return;
					}
				}
			}
			StorageComponent package = player.package;
			int num = 0;
			for (int j = 0; j < package.size; j++)
			{
				if (package.grids[j].itemId == 2105)
				{
					num += package.grids[j].count;
					if (num >= 40)
					{
						break;
					}
				}
			}
			if (num >= 40)
			{
				int num2 = default(int);
				package.TakeItem(2105, 40, ref num2);
				Vector3 val2 = default(Vector3);
				for (int k = 0; k < 40; k++)
				{
					double num3 = 0.0;
					double num4 = 0.0;
					if (k % 10 == 0)
					{
						if (k < 20)
						{
							num3 = ((k == 0) ? Constant.posxz[0, 0] : (0.0 - Constant.posxz[0, 0]));
							num4 = ((k == 0) ? Constant.posxz[0, 1] : (0.0 - Constant.posxz[0, 1]));
						}
						else
						{
							num3 = ((k == 20) ? Constant.posxz[0, 1] : (0.0 - Constant.posxz[0, 1]));
							num4 = ((k == 20) ? Constant.posxz[0, 0] : (0.0 - Constant.posxz[0, 0]));
						}
					}
					else if (0 < k && k < 10)
					{
						num3 = Constant.posxz[k, 0];
						num4 = Constant.posxz[k, 1];
					}
					else if (k > 10 && k < 20)
					{
						num3 = 0.0 - Constant.posxz[k - 10, 0];
						num4 = Constant.posxz[k - 10, 1];
					}
					else if (k > 20 && k < 30)
					{
						num3 = Constant.posxz[k - 20, 0];
						num4 = 0.0 - Constant.posxz[k - 20, 1];
					}
					else if (k > 30)
					{
						num3 = 0.0 - Constant.posxz[k - 30, 0];
						num4 = 0.0 - Constant.posxz[k - 30, 1];
					}
					((Vector3)(ref val2))..ctor((float)(num3 * (double)player.planetData.realRadius), 0f, (float)(num4 * (double)player.planetData.realRadius));
					Vector3 val3 = 0.025f * ((Vector3)(ref val2)).normalized * player.planetData.realRadius;
					Quaternion val4 = Maths.SphericalRotation(val2, player.controller.actionBuild.clickTool.yaw);
					val2 += val3;
					PrebuildData val5 = default(PrebuildData);
					val5.protoId = 2105;
					val5.modelIndex = 117;
					val5.pos = val2 + val4 * Vector3.zero;
					val5.pos2 = val2 + val4 * Vector3.zero;
					val5.rot = val4 * Quaternion.identity;
					val5.rot2 = val4 * Quaternion.identity;
					val5.pickOffset = 0;
					val5.insertOffset = 0;
					val5.recipeId = 0;
					val5.filterId = 0;
					val5.paramCount = 0;
					PrebuildData val6 = val5;
					((PrebuildData)(ref val6)).InitParametersArray(0);
					((BuildTool)player.controller.actionBuild.clickTool).factory.AddPrebuildDataWithComponents(val6);
				}
			}
			else
			{
				UIMessageBox.Show("铺满轨道采集器失败", "背包里没有40个采集器,请重新准备", "确定", 3);
			}
		}

		public static void AddFuelToAllStar()
		{
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Unknown result type (might be due to invalid IL or missing references)
			if (LocalPlanet == null)
			{
				return;
			}
			PlanetFactory factory = LocalPlanet.factory;
			int value = auto_supply_starfuelID.Value;
			if (value < 1803 || value > 1804)
			{
				return;
			}
			PowerGeneratorComponent[] genPool = factory.powerSystem.genPool;
			int num2 = default(int);
			foreach (PowerGeneratorComponent val in genPool)
			{
				if (val.fuelMask == 4 && val.fuelCount < auto_supply_starfuel.Value)
				{
					int num = auto_supply_starfuel.Value - val.fuelCount;
					short num3 = (short)player.package.TakeItem(value, num, ref num2);
					if (num3 == 0)
					{
						break;
					}
					if (val.fuelCount == 0)
					{
						((PowerGeneratorComponent)(ref factory.powerSystem.genPool[val.id])).SetNewFuel(value, num3, (short)num2);
					}
					else if (val.fuelCount < auto_supply_starfuel.Value && value == val.fuelId)
					{
						factory.powerSystem.genPool[val.id].fuelCount += num3;
						factory.powerSystem.genPool[val.id].fuelInc += (short)num2;
					}
				}
			}
		}

		private void BluePrintoptimize()
		{
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0222: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dfb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e00: Unknown result type (might be due to invalid IL or missing references)
			//IL_05c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ce: Invalid comparison between Unknown and I4
			//IL_05da: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e0: Invalid comparison between Unknown and I4
			//IL_0726: Unknown result type (might be due to invalid IL or missing references)
			//IL_072b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0732: Unknown result type (might be due to invalid IL or missing references)
			//IL_0745: Unknown result type (might be due to invalid IL or missing references)
			//IL_05fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_060f: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0823: Unknown result type (might be due to invalid IL or missing references)
			//IL_0857: Unknown result type (might be due to invalid IL or missing references)
			//IL_088b: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0621: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ace: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b46: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b76: Unknown result type (might be due to invalid IL or missing references)
			GUIDraw.blueprintopen = false;
			Player obj = player;
			if (((obj == null) ? null : obj.controller?.actionBuild) == null)
			{
				return;
			}
			PlayerAction_Build actionBuild = player.controller.actionBuild;
			if (actionBuild.blueprintCopyTool != null && ((BuildTool)actionBuild.blueprintCopyTool).active && actionBuild.blueprintCopyTool.bpPool != null)
			{
				GUIDraw.blueprintopen = true;
				BuildTool_BlueprintCopy blueprintCopyTool = actionBuild.blueprintCopyTool;
				if (BluePrintSelectAll.Value && Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)97))
				{
					EntityData[] entityPool = LocalPlanet.factory.entityPool;
					foreach (EntityData val in entityPool)
					{
						if (val.id != 0)
						{
							blueprintCopyTool.preSelectObjIds.Add(val.id);
							blueprintCopyTool.selectedObjIds.Add(val.id);
						}
					}
					blueprintCopyTool.RefreshBlueprintData();
					blueprintCopyTool.DeterminePreviews();
				}
				if (BluePrintRevoke.Value && Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)122))
				{
					blueprintCopyTool.ClearSelection();
					blueprintCopyTool.ClearPreSelection();
					blueprintCopyTool.RefreshBlueprintData();
					for (int j = 0; j < LocalPlanet.factory.prebuildPool.Length; j++)
					{
						int protoId = LocalPlanet.factory.prebuildPool[j].protoId;
						if (LocalPlanet.factory.prebuildPool[j].itemRequired == 0)
						{
							player.TryAddItemToPackage(protoId, 1, 0, true, 0, false);
						}
						LocalPlanet.factory.RemovePrebuildWithComponents(j);
					}
					pointeRecipetype = (ERecipeType)0;
				}
				if (BluePrintSetRecipe.Value && Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)102))
				{
					GUIDraw.recipewindowx = (int)Input.mousePosition.x;
					GUIDraw.recipewindowy = (int)Input.mousePosition.y;
					List<int> list = new List<int>();
					if (stationpools.Count + labpools.Count + assemblerpools.Count + beltpools.Count + monitorpools.Count + ejectorpools.Count + powergenGammapools.Count + turrentpools.Count + powerexchangertools.Count > 0)
					{
						InitBluePrintData();
						return;
					}
					BuildPreview[] bpPool = blueprintCopyTool.bpPool;
					foreach (BuildPreview val2 in bpPool)
					{
						if (val2 == null || val2.item == null || val2.objId <= 0)
						{
							continue;
						}
						PrefabDesc prefabDesc = val2.item.prefabDesc;
						if (prefabDesc.isStation)
						{
							if (actionBuild.factory.entityPool[val2.objId].minerId <= 0)
							{
								stationpools.Add(actionBuild.factory.entityPool[val2.objId].stationId);
							}
						}
						else if (prefabDesc.isAssembler)
						{
							list.Add(val2.previewIndex);
						}
						else if (prefabDesc.isLab)
						{
							labpools.Add(actionBuild.factory.entityPool[val2.objId].labId);
						}
						else if (prefabDesc.isMonitor && actionBuild.factory.entityPool[val2.objId].monitorId > 0)
						{
							monitorpools.Add(actionBuild.factory.entityPool[val2.objId].monitorId);
						}
						else if (prefabDesc.isBelt && LocalPlanet.factory.entitySignPool[val2.objId].iconId0 != 0)
						{
							beltpools.Add(actionBuild.factory.entityPool[val2.objId].id);
						}
						else if (prefabDesc.isEjector)
						{
							ejectorpools.Add(actionBuild.factory.entityPool[val2.objId].ejectorId);
						}
						else if (prefabDesc.isPowerGen)
						{
							powergenGammapools.Add(actionBuild.factory.entityPool[val2.objId].powerGenId);
						}
						else if (prefabDesc.isTurret)
						{
							turrentpools.Add(actionBuild.factory.entityPool[val2.objId].turretId);
						}
						else if (prefabDesc.isPowerExchanger)
						{
							powerexchangertools.Add(actionBuild.factory.entityPool[val2.objId].powerExcId);
						}
					}
					if (list.Count > 0)
					{
						foreach (int item in list)
						{
							BuildPreview val3 = blueprintCopyTool.bpPool[item];
							if ((int)val3.item.prefabDesc.assemblerRecipeType > 0)
							{
								if ((int)pointeRecipetype == 0)
								{
									pointeRecipetype = val3.item.prefabDesc.assemblerRecipeType;
								}
								if (pointeRecipetype != val3.item.prefabDesc.assemblerRecipeType)
								{
									pointeRecipetype = (ERecipeType)0;
									assemblerpools.Clear();
									break;
								}
								assemblerpools.Add(actionBuild.factory.entityPool[val3.objId].assemblerId);
							}
						}
					}
					else if (labpools.Count <= 0 && ejectorpools.Count <= 0 && stationpools.Count <= 0 && powergenGammapools.Count <= 0)
					{
						if (powerexchangertools.Count > 0)
						{
							if (!PowerExchangerWindow.gameObject.activeSelf)
							{
								PowerExchangerWindow.gameObject.SetActive(true);
								PowerExchangerComponent val4 = GameMain.localPlanet.factory.powerSystem.excPool[powerexchangertools[0]];
								ItemProto val5 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(val4.emptyId);
								ItemProto val6 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(val4.fullId);
								uipowerExchangerWindow.emptyIcon.sprite = ((val5 == null) ? null : val5.iconSprite);
								uipowerExchangerWindow.fullIcon.sprite = ((val6 == null) ? null : val6.iconSprite);
							}
							else
							{
								powerexchangertools.Clear();
								PowerExchangerWindow.gameObject.SetActive(false);
							}
						}
						else if (turrentpools.Count > 0)
						{
							if (!TurretWindow.gameObject.activeSelf)
							{
								TurretWindow.gameObject.SetActive(true);
								uiturretWindow.mode0Icon.sprite = uiturretWindow.fullTransparentSprite;
								((Graphic)uiturretWindow.mode0Floor).color = uiturretWindow.disableModeColor;
								uiturretWindow.mode1Icon.sprite = uiturretWindow.fullTransparentSprite;
								((Graphic)uiturretWindow.mode1Floor).color = uiturretWindow.disableModeColor;
								uiturretWindow.mode2Icon.sprite = uiturretWindow.fullTransparentSprite;
								((Graphic)uiturretWindow.mode2Floor).color = uiturretWindow.disableModeColor;
								uiturretWindow.mode3Icon.sprite = uiturretWindow.fullTransparentSprite;
								((Graphic)uiturretWindow.mode3Floor).color = uiturretWindow.disableModeColor;
								for (int l = 0; l < uiturretWindow.groupSelectionBtns.Length; l++)
								{
									UIButton val7 = uiturretWindow.groupSelectionBtns[l];
									val7.highlighted = false;
								}
							}
							else
							{
								turrentpools.Clear();
								TurretWindow.gameObject.SetActive(false);
							}
						}
						else if (beltpools.Count > 0)
						{
							if (!beltWindow.gameObject.activeSelf)
							{
								int iconId = (int)LocalPlanet.factory.entitySignPool[beltpools[0]].iconId0;
								int num = (int)LocalPlanet.factory.entitySignPool[beltpools[0]].count0;
								beltWindow.gameObject.SetActive(true);
								pointsignalid = iconId;
								((Component)beltWindow.transform.Find("item-sign")).GetComponent<Image>().sprite = LDB.signals.IconSprite(iconId);
								((Component)beltWindow.transform.Find("number-input")).GetComponent<InputField>().text = num.ToString() ?? "";
							}
							else
							{
								beltpools.Clear();
								beltWindow.gameObject.SetActive(false);
								if (UISignalPicker.isOpened)
								{
									UISignalPicker.Close();
								}
							}
						}
						else if (monitorpools.Count > 0)
						{
							if (!SpeakerPanel.gameObject.activeSelf)
							{
								int speakerId = LocalPlanet.factory.cargoTraffic.monitorPool[monitorpools[0]].speakerId;
								SpeakerComponent val8 = LocalPlanet.factory.digitalSystem.speakerPool[speakerId];
								((Component)SpeakerPanel.transform.Find("speaker-panel")).GetComponent<UISpeakerPanel>().pitchSlider.value = (int)val8.pitch;
								((Component)SpeakerPanel.transform.Find("speaker-panel")).GetComponent<UISpeakerPanel>().volumeSlider.value = (int)val8.volume;
								((Component)SpeakerPanel.transform.Find("speaker-panel")).GetComponent<UISpeakerPanel>().toneCombo.itemIndex = ((val8.tone > 0) ? ((Component)SpeakerPanel.transform.Find("speaker-panel")).GetComponent<UISpeakerPanel>().toneCombo.ItemsData.IndexOf(val8.tone) : 0);
								SpeakerPanel.gameObject.SetActive(true);
								((Component)SpeakerPanel.transform.Find("speaker-panel")).gameObject.SetActive(true);
							}
							else
							{
								monitorpools.Clear();
								SpeakerPanel.gameObject.SetActive(false);
								((Component)SpeakerPanel.transform.Find("speaker-panel")).gameObject.SetActive(false);
							}
						}
					}
				}
				if (BluePrintDelete.Value && Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)120))
				{
					BuildPreview[] bpPool2 = blueprintCopyTool.bpPool;
					foreach (BuildPreview val9 in bpPool2)
					{
						if (val9 == null || val9.item == null || val9.objId <= 0)
						{
							continue;
						}
						int stationId = LocalPlanet.factory.entityPool[val9.objId].stationId;
						if (stationId > 0)
						{
							StationComponent val10 = LocalPlanet.factory.transport.stationPool[stationId];
							for (int n = 0; n < val10.storage.Length; n++)
							{
								int num2 = player.TryAddItemToPackage(val10.storage[n].itemId, val10.storage[n].count, 0, true, val9.objId, false);
								UIItemup.Up(val10.storage[n].itemId, num2);
							}
							val10.storage = (StationStore[])(object)new StationStore[val10.storage.Length];
							val10.needs = new int[val10.needs.Length];
						}
						actionBuild.DoDismantleObject(val9.objId);
					}
					blueprintCopyTool.ClearSelection();
					blueprintCopyTool.ClearPreSelection();
					blueprintCopyTool.ResetBlueprint();
					blueprintCopyTool.ResetBuildPreviews();
					blueprintCopyTool.RefreshBlueprintData();
				}
				if (((Object)(object)uiturretWindow != (Object)null && ((Component)uiturretWindow).gameObject.activeSelf && Input.GetKeyDown((KeyCode)323)) || Input.GetKeyDown((KeyCode)324) || Input.GetKeyDown((KeyCode)325))
				{
					Camera worldCamera = UIRoot.instance.overlayCanvas.worldCamera;
					if (!RectTransformUtility.RectangleContainsScreenPoint(uiturretWindow.selectBoxRt, Vector2.op_Implicit(Input.mousePosition), worldCamera) && ((Component)uiturretWindow.selectBoxRt).gameObject.activeSelf)
					{
						((Component)uiturretWindow.selectBoxRt).gameObject.SetActive(false);
					}
				}
			}
			else if (stationpools.Count + labpools.Count + assemblerpools.Count + beltpools.Count + monitorpools.Count + ejectorpools.Count + powergenGammapools.Count + turrentpools.Count + powerexchangertools.Count > 0)
			{
				InitBluePrintData();
			}
			if (actionBuild.blueprintPasteTool != null && ((BuildTool)actionBuild.blueprintPasteTool).active && actionBuild.blueprintPasteTool.bpPool != null)
			{
				BuildTool_BlueprintPaste blueprintPasteTool = actionBuild.blueprintPasteTool;
				if (Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)122))
				{
					blueprintPasteTool.ResetBuildPreviews();
					blueprintPasteTool.ResetStatesOnClose();
					blueprintPasteTool.RefreshBlueprintUI();
					player.controller.OpenBlueprintCopyMode();
				}
			}
		}

		public static void InitBluePrintData()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			pointeRecipetype = (ERecipeType)0;
			stationpools.Clear();
			assemblerpools.Clear();
			labpools.Clear();
			beltpools.Clear();
			monitorpools.Clear();
			powergenGammapools.Clear();
			turrentpools.Clear();
			powerexchangertools.Clear();
			ejectorpools.Clear();
			beltWindow.gameObject.SetActive(false);
			SpeakerPanel.gameObject.SetActive(false);
			TurretWindow.gameObject.SetActive(false);
			PowerExchangerWindow.gameObject.SetActive(false);
			uipowerExchangerWindow.exchangerMode1UIButton.highlighted = false;
			uipowerExchangerWindow.exchangerMode2UIButton.highlighted = true;
			uipowerExchangerWindow.exchangerMode3UIButton.highlighted = false;
			((Component)uipowerExchangerWindow.transition0).gameObject.SetActive(false);
			((Component)uipowerExchangerWindow.transition1).gameObject.SetActive(false);
			((Component)SpeakerPanel.transform.Find("speaker-panel")).gameObject.SetActive(false);
			if (UISignalPicker.isOpened)
			{
				UISignalPicker.Close();
			}
		}

		private void ChangeQuickKeyMethod()
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			if (GUIDraw.ChangeQuickKey)
			{
				setQuickKey();
				ChangingQuickKey = true;
			}
			else if (!GUIDraw.ChangeQuickKey && ChangingQuickKey)
			{
				QuickKey.Value = GUIDraw.tempShowWindow;
				ChangingQuickKey = false;
			}
		}

		private void StartAndStopGame()
		{
			if (Quickstop_bool.Value && Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)32))
			{
				GameTickPatch.Enable = !GameTickPatch.Enable;
			}
		}

		private void TrashFunction()
		{
			if (Time.time - trashfunctiontime < 30f || GameMain.data?.trashSystem == null)
			{
				return;
			}
			trashfunctiontime = Time.time;
			if (autoabsorttrash_bool.Value)
			{
				TrashContainer container = GameMain.data.trashSystem.container;
				for (int i = 0; i < container.trashCursor; i++)
				{
					int item = container.trashObjPool[i].item;
					if (item > 0 && container.trashObjPool[i].expire < 0)
					{
						if (onlygetbuildings.Value && !(((ProtoSet<ItemProto>)(object)LDB.items).Select(item)?.CanBuild ?? false))
						{
							container.RemoveTrash(i);
						}
						else
						{
							container.trashObjPool[i].expire = 35;
						}
					}
				}
			}
			if (autocleartrash_bool.Value)
			{
				GameMain.data.trashSystem.ClearAllTrash();
			}
		}

		private void AutoAddwarp()
		{
			Player obj = player;
			if (((obj != null) ? obj.mecha : null) != null && player.mecha.thrusterLevel >= 3 && !player.mecha.HasWarper())
			{
				int num = 1210;
				int num2 = 20;
				int num3 = default(int);
				player.package.TakeTailItems(ref num, ref num2, ref num3, false);
				if (num > 0 && num2 > 0)
				{
					int num4 = default(int);
					player.mecha.warpStorage.AddItem(num, num2, num3, ref num4, false);
				}
			}
		}

		private void ResetEjector()
		{
			//IL_0177: Unknown result type (might be due to invalid IL or missing references)
			//IL_017d: Invalid comparison between Unknown and I4
			if (GameMain.galaxy == null || GameMain.data == null || GameMain.data.dysonSpheres == null || EjectorDictionary == null || EjectorDictionary.Count == 0)
			{
				return;
			}
			foreach (int key in EjectorDictionary.Keys)
			{
				PlanetData val = GameMain.galaxy.PlanetById(key);
				if (val == null || val.factory == null || val.factory.factorySystem == null || GameMain.data.dysonSpheres[val.star.index] == null || GameMain.data.dysonSpheres[val.star.index].swarm == null || GameMain.data.dysonSpheres[val.star.index].swarm.orbits.Length == 0)
				{
					continue;
				}
				DysonSwarm swarm = GameMain.data.dysonSpheres[val.star.index].swarm;
				int orbitCursor = swarm.orbitCursor;
				List<int> list = EjectorDictionary[key];
				FactorySystem factorySystem = val.factory.factorySystem;
				foreach (int item in list)
				{
					if (factorySystem.ejectorPool == null || factorySystem.ejectorPool.Length <= item || factorySystem.ejectorPool[item].id == 0 || (int)factorySystem.ejectorPool[item].targetState == 1 || orbitCursor <= 1)
					{
						continue;
					}
					int num = factorySystem.ejectorPool[item].orbitId + 1;
					while (!swarm.OrbitEnabled(num))
					{
						num++;
						if (num >= orbitCursor)
						{
							num = 1;
						}
					}
					((EjectorComponent)(ref factorySystem.ejectorPool[item])).SetOrbit(num);
				}
			}
		}

		private void setQuickKey()
		{
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0138: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			bool flag = true;
			int[] array = new int[2];
			if (Input.GetKey((KeyCode)304) && flag)
			{
				flag = false;
				array[0] = 304;
			}
			if (Input.GetKey((KeyCode)306) && flag)
			{
				flag = false;
				array[0] = 306;
			}
			if (Input.GetKey((KeyCode)308) && flag)
			{
				flag = false;
				array[0] = 308;
			}
			bool flag2 = true;
			for (int i = 48; i <= 57 && flag2; i++)
			{
				if (Input.GetKey((KeyCode)i))
				{
					array[1] = i;
					flag2 = false;
					break;
				}
			}
			for (int j = 97; j <= 122 && flag2; j++)
			{
				if (Input.GetKey((KeyCode)j))
				{
					array[1] = j;
					flag2 = false;
					break;
				}
			}
			for (int k = 282; k <= 291 && flag2; k++)
			{
				if (Input.GetKey((KeyCode)k))
				{
					array[1] = k;
					flag2 = false;
					break;
				}
			}
			if (!(flag && flag2))
			{
				if (!flag && !flag2)
				{
					GUIDraw.tempShowWindow = new KeyboardShortcut((KeyCode)array[0], (KeyCode[])(object)new KeyCode[1] { (KeyCode)array[1] });
				}
				else
				{
					GUIDraw.tempShowWindow = new KeyboardShortcut((KeyCode)Math.Max(array[0], array[1]), Array.Empty<KeyCode>());
				}
			}
		}
	}
	public class AuxilaryfunctionPatch
	{
		[HarmonyPrefix]
		[HarmonyPatch(typeof(GameLoader), "CreateLoader")]
		public static void GameLoaderCreateLoaderPrefix()
		{
			Auxilaryfunction.GameDataImported = false;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameLoader), "SelfDestroy")]
		public static void GameLoaderCreateLoaderPostfix()
		{
			Auxilaryfunction.GameDataImported = true;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(FactorySystem), "NewMinerComponent")]
		public static void NewMinerComponentPatch(ref int __result, FactorySystem __instance)
		{
			if (Auxilaryfunction.auto_supply_station.Value && __instance.factory.entityPool[__instance.minerPool[__result].entityId].protoId == 2316)
			{
				__instance.minerPool[__result].speed = Auxilaryfunction.veincollectorspeed.Value * 1000;
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PowerSystem), "NewGeneratorComponent")]
		public static void NewGeneratorComponentPatch(ref int __result, PowerSystem __instance)
		{
			if (__instance.genPool[__result].fuelMask != 4 || !Auxilaryfunction.autosetSomevalue_bool.Value)
			{
				return;
			}
			int value = Auxilaryfunction.auto_supply_starfuelID.Value;
			if (value >= 1803 && value <= 1804)
			{
				int num = default(int);
				short num2 = (short)Auxilaryfunction.player.package.TakeItem(value, Auxilaryfunction.auto_supply_starfuel.Value, ref num);
				if (num2 != 0)
				{
					((PowerGeneratorComponent)(ref __instance.genPool[__result])).SetNewFuel(value, num2, (short)num);
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(FactorySystem), "NewEjectorComponent")]
		public static void NewEjectorComponentPatch(ref int __result, FactorySystem __instance)
		{
			if (Auxilaryfunction.EjectorDictionary.ContainsKey(__instance.planet.id))
			{
				Auxilaryfunction.EjectorDictionary[__instance.planet.id].Add(__result);
			}
			else
			{
				Auxilaryfunction.EjectorDictionary[__instance.planet.id] = new List<int> { __result };
			}
			((EjectorComponent)(ref __instance.ejectorPool[__result])).SetOrbit(1);
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlanetTransport), "NewStationComponent")]
		public static void NewStationComponentPatch(ref StationComponent __result, PlanetTransport __instance)
		{
			if (Auxilaryfunction.auto_supply_station.Value && !__result.isCollector && !__result.isVeinCollector)
			{
				int num = default(int);
				__result.idleDroneCount = Auxilaryfunction.player.package.TakeItem(5001, __result.isStellar ? Auxilaryfunction.auto_supply_drone.Value : ((Auxilaryfunction.auto_supply_drone.Value > 50) ? 50 : Auxilaryfunction.auto_supply_drone.Value), ref num);
				__result.tripRangeDrones = Math.Cos((double)Auxilaryfunction.stationdronedist.Value * Math.PI / 180.0);
				__instance.planet.factory.powerSystem.consumerPool[__result.pcId].workEnergyPerTick = (long)Auxilaryfunction.stationmaxpowerpertick.Value * 16667;
				if (Auxilaryfunction.stationmaxpowerpertick.Value > 60f && !__result.isStellar)
				{
					__instance.planet.factory.powerSystem.consumerPool[__result.pcId].workEnergyPerTick = 1000020L;
				}
				__result.deliveryDrones = ((Auxilaryfunction.DroneStartCarry.Value == 0f) ? 1 : ((int)(Auxilaryfunction.DroneStartCarry.Value * 10f) * 10));
				if (__result.isStellar)
				{
					__result.warperCount = Auxilaryfunction.player.package.TakeItem(1210, Auxilaryfunction.auto_supply_warp.Value, ref num);
					__result.warpEnableDist = Auxilaryfunction.stationwarpdist.Value * 40000.0;
					__result.deliveryShips = ((Auxilaryfunction.ShipStartCarry.Value == 0f) ? 1 : ((int)(Auxilaryfunction.ShipStartCarry.Value * 10f) * 10));
					__result.idleShipCount = Auxilaryfunction.player.package.TakeItem(5002, Auxilaryfunction.auto_supply_ship.Value, ref num);
					__result.tripRangeShips = ((Auxilaryfunction.stationshipdist.Value > 60) ? 24000000000L : (Auxilaryfunction.stationshipdist.Value * 2400000));
					if (GameMain.data.history.TechUnlocked(3404))
					{
						__result.warperCount = Auxilaryfunction.player.package.TakeItem(1210, Auxilaryfunction.auto_supply_warp.Value, ref num);
					}
				}
			}
			if (Auxilaryfunction.auto_supply_station.Value && __result.isVeinCollector)
			{
				__instance.factory.factorySystem.minerPool[__result.minerId].speed = Auxilaryfunction.veincollectorspeed.Value * 1000;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(FactorySystem), "RemoveEjectorComponent")]
		public static void RemoveEjectorComponentPatch(int id, FactorySystem __instance)
		{
			if (Auxilaryfunction.EjectorDictionary[__instance.planet.id].Contains(id))
			{
				Auxilaryfunction.EjectorDictionary[__instance.planet.id].Remove(id);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlanetTransport), "NewDispenserComponent")]
		public static void NewDispenserComponentPatch(int __result, PlanetTransport __instance)
		{
			if (Auxilaryfunction.auto_supply_station.Value)
			{
				int num = default(int);
				__instance.dispenserPool[__result].idleCourierCount = Auxilaryfunction.player.package.TakeItem(5003, Auxilaryfunction.auto_supply_Courier.Value, ref num);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(UIBlueprintBrowser), "SetCurrentDirectory")]
		public static void UIBlueprintBrowserSetCurrentDirectory(string fullpath)
		{
			if (Auxilaryfunction.SaveLastOpenBluePrintBrowserPathConfig.Value)
			{
				Auxilaryfunction.LastOpenBluePrintBrowserPathConfig.Value = fullpath;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(UIBlueprintBrowser), "_OnOpen")]
		public static void UIBlueprintBrowser_OnOpen(ref UIBlueprintBrowser __instance)
		{
			if (Auxilaryfunction.SaveLastOpenBluePrintBrowserPathConfig.Value && string.IsNullOrEmpty(__instance.openPath) && !string.IsNullOrEmpty(Auxilaryfunction.LastOpenBluePrintBrowserPathConfig.Value))
			{
				__instance.openPath = Auxilaryfunction.LastOpenBluePrintBrowserPathConfig.Value;
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(FactoryModel), "Update")]
		public static bool FactoryModelUpdatePatch()
		{
			return !Auxilaryfunction.norender_entity_bool.Value && !Auxilaryfunction.simulatorrender;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(FactoryModel), "LateUpdate")]
		public static bool FactoryModelLateUpdatePatch()
		{
			return !Auxilaryfunction.norender_entity_bool.Value && !Auxilaryfunction.simulatorrender;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(LogisticDroneRenderer), "Draw")]
		public static bool DroneDrawPatch()
		{
			return !Auxilaryfunction.norender_shipdrone_bool.Value && !Auxilaryfunction.simulatorrender;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(LogisticShipUIRenderer), "Draw")]
		public static bool LogisticShipUIRendererDrawPatch()
		{
			return !Auxilaryfunction.norender_shipdrone_bool.Value && !Auxilaryfunction.simulatorrender;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(LogisticCourierRenderer), "Draw")]
		public static bool CourierDrawPatch()
		{
			return !Auxilaryfunction.norender_shipdrone_bool.Value && !Auxilaryfunction.simulatorrender;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(LogisticShipRenderer), "Draw")]
		public static bool ShipDrawPatch()
		{
			return !Auxilaryfunction.norender_shipdrone_bool.Value && !Auxilaryfunction.simulatorrender;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(LabRenderer), "Render")]
		public static bool LabRendererPatch(LabRenderer __instance)
		{
			if (((ObjectRenderer)__instance).modelId == 70 || ((ObjectRenderer)__instance).modelId == 455)
			{
				return !Auxilaryfunction.norender_lab_bool.Value && !Auxilaryfunction.simulatorrender;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(SectorModel), "LateUpdate")]
		public static bool EnemyDFGroundRendererRenderPatch()
		{
			return !Auxilaryfunction.norender_DarkFog.Value && !Auxilaryfunction.simulatorrender;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(DysonSphere), "DrawModel")]
		public static bool DysonDrawModelPatch()
		{
			return !Auxilaryfunction.norender_dysonshell_bool.Value && !Auxilaryfunction.simulatorrender;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(DysonSphere), "DrawPost")]
		public static bool DysonDrawPostPatch()
		{
			return !Auxilaryfunction.norender_dysonswarm_bool.Value && !Auxilaryfunction.simulatorrender;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(UIPowerGizmo), "DrawArea")]
		public static bool UIPowerGizmoDrawAreaPatch()
		{
			return !Auxilaryfunction.norender_powerdisk_bool.Value && !Auxilaryfunction.simulatorrender;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(UIDarkFogMonitor), "Determine")]
		public static bool UIDarkFogMonitorDetermine()
		{
			return !Auxilaryfunction.HideDarkFogMonitor && !Auxilaryfunction.simulatorrender;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(UIDarkFogAssaultTip), "Determine")]
		public static bool UIDarkFogAssaultTipDetermine()
		{
			return !Auxilaryfunction.HideDarkFogAssaultTip && !Auxilaryfunction.simulatorrender;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(UIPowerGizmo), "DrawCover")]
		public static bool UIPowerGizmoDrawCoverPatch()
		{
			return !Auxilaryfunction.norender_powerdisk_bool.Value && !Auxilaryfunction.simulatorrender;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(CargoContainer), "Draw")]
		public static bool PathRenderingBatchDrawPatch()
		{
			return !Auxilaryfunction.norender_beltitem.Value;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(BuildingParameters), "CopyFromFactoryObject")]
		public static void CopyFromFactoryObjectPatch(int objectId, PlanetFactory factory)
		{
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Expected I4, but got Unknown
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d6: Expected I4, but got Unknown
			if (!Auxilaryfunction.stationcopyItem_bool.Value)
			{
				return;
			}
			if (Auxilaryfunction.player != null && (Object)(object)Auxilaryfunction.player.controller != (Object)null && Auxilaryfunction.player.controller.actionBuild != null)
			{
				PlayerAction_Build actionBuild = Auxilaryfunction.player.controller.actionBuild;
				if ((actionBuild.blueprintCopyTool != null || actionBuild.blueprintPasteTool != null) && (((BuildTool)actionBuild.blueprintPasteTool).active || ((BuildTool)actionBuild.blueprintCopyTool).active))
				{
					return;
				}
			}
			EntityData[] entityPool = factory.entityPool;
			if (objectId > entityPool.Length || objectId <= 0)
			{
				return;
			}
			int stationId = entityPool[objectId].stationId;
			if (stationId <= 0)
			{
				return;
			}
			StationComponent val = factory.transport.stationPool[stationId];
			for (int i = 0; i < 5; i++)
			{
				for (int j = 0; j < 6; j++)
				{
					Auxilaryfunction.stationcopyItem[i, j] = 0;
				}
			}
			for (int k = 0; k < val.storage.Length && k < 5; k++)
			{
				if (val.storage[k].itemId > 0)
				{
					Auxilaryfunction.stationcopyItem[k, 0] = val.storage[k].itemId;
					Auxilaryfunction.stationcopyItem[k, 1] = val.storage[k].max;
					Auxilaryfunction.stationcopyItem[k, 2] = (int)val.storage[k].localLogic;
					Auxilaryfunction.stationcopyItem[k, 3] = (int)val.storage[k].remoteLogic;
					Auxilaryfunction.stationcopyItem[k, 4] = val.storage[k].localOrder;
					Auxilaryfunction.stationcopyItem[k, 5] = val.storage[k].remoteOrder;
				}
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(BuildTool_Path), "DeterminePreviews")]
		public static void BuildTool_PathPatch(BuildTool_Path __instance)
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			if (!Auxilaryfunction.KeepBeltHeight.Value || !Input.GetKey((KeyCode)304))
			{
				return;
			}
			PlanetAuxData planetAux = Auxilaryfunction.player.controller.actionBuild.planetAux;
			if (planetAux != null && __instance.altitude == 0)
			{
				if (ObjectIsBeltOrSplitter(__instance, __instance.castObjectId))
				{
					__instance.altitude = Altitude(__instance.castObjectPos, planetAux);
				}
				else if (__instance.startObjectId != 0)
				{
					__instance.altitude = Altitude(__instance.pathPoints[0], planetAux);
				}
			}
		}

		private static int Altitude(Vector3 pos, PlanetAuxData aux)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: 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)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = aux.Snap(pos, true);
			return (int)Math.Round(Vector3.Distance(pos, val) / 1.3333333f);
		}

		private static bool ObjectIsBeltOrSplitter(BuildTool_Path tool, int objId)
		{
			if (objId == 0)
			{
				return false;
			}
			ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select((int)((BuildTool)tool).factory.entityPool[Math.Abs(objId)].protoId);
			return val != null && val.prefabDesc != null && (val.prefabDesc.isBelt || val.prefabDesc.isSplitter);
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(BuildingParameters), "PasteToFactoryObject")]
		public static void PasteToFactoryObjectPatch(int objectId, PlanetFactory factory)
		{
			if (!Auxilaryfunction.stationcopyItem_bool.Value)
			{
				return;
			}
			EntityData[] entityPool = factory.entityPool;
			if (objectId > entityPool.Length || objectId <= 0)
			{
				return;
			}
			int stationId = entityPool[objectId].stationId;
			if (stationId <= 0)
			{
				return;
			}
			StationComponent val = factory.transport.stationPool[stationId];
			if (val.isVeinCollector || val.isCollector)
			{
				return;
			}
			for (int i = 0; i < val.storage.Length && i < 5; i++)
			{
				if (Auxilaryfunction.stationcopyItem[i, 0] > 0)
				{
					if (val.storage[i].count > 0 && val.storage[i].itemId != Auxilaryfunction.stationcopyItem[i, 0])
					{
						Auxilaryfunction.player.TryAddItemToPackage(val.storage[i].itemId, val.storage[i].count, 0, false, 0, false);
					}
					factory.transport.SetStationStorage(stationId, i, Auxilaryfunction.stationcopyItem[i, 0], Auxilaryfunction.stationcopyItem[i, 1], (ELogisticStorage)Auxilaryfunction.stationcopyItem[i, 2], (ELogisticStorage)Auxilaryfunction.stationcopyItem[i, 3], Auxilaryfunction.player);
				}
				else
				{
					factory.transport.SetStationStorage(stationId, i, 0, 0, (ELogisticStorage)0, (ELogisticStorage)0, Auxilaryfunction.player);
				}
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(UIVariousPopupCard), "Refresh")]
		public static bool UIVariousPopupCardRefresh(UIVariousPopupCard __instance)
		{
			if (Auxilaryfunction.CloseMilestone.Value)
			{
				object data = ((ManualBehaviour)__instance).data;
				MilestoneProto val = (MilestoneProto)((data is MilestoneProto) ? data : null);
				if (val != null)
				{
					((ManualBehaviour)__instance)._Close();
					return false;
				}
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(UIAdvisorTip), "RequestAdvisorTip")]
		public static bool UIAdvisorTipRequestAdvisorTip()
		{
			return !Auxilaryfunction.CloseUIAdvisor.Value;
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(UIRandomTip), "_OnOpen")]
		public static void UIBuildMenu_OnOpenPatch(ref UIRandomTip __instance)
		{
			if (Auxilaryfunction.CloseUIRandomTip.Value)
			{
				((ManualBehaviour)__instance)._Close();
			}
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(UITutorialTip), "PopupTutorialTip")]
		public static bool UITutorialTipPopupTutorialTip()
		{
			if (Auxilaryfunction.CloseUITutorialTip.Value)
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(UITechTree), "UpdateScale")]
		public static bool UITechTreeUpdateScalePatch(UITechTree __instance)
		{
			if (Auxilaryfunction.noscaleuitech_bool.Value && ((Object)(object)__instance.selected != (Object)null || (Object)(object)__instance.centerViewNode != (Object)null))
			{
				return false;
			}
			return true;
		}

		[HarmonyPrefix]
		[HarmonyPatch(typeof(UniverseSimulator), "GameTick")]
		public static void GameDataOnDrawPatch(UniverseSimulator __instance)
		{
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Invalid comparison between Unknown and I4
			if (!Auxilaryfunction.simulatorchanging)
			{
				return;
			}
			int num = 0;
			((Component)__instance.backgroundStars).gameObject.SetActive(!Auxilaryfunction.simulatorrender);
			while (__instance.planetSimulators != null && num < __instance.planetSimulators.Length)
			{
				if ((Object)(object)__instance.planetSimulators[num] != (Object)null)
				{
					((Component)__instance.planetSimulators[num]).gameObject.SetActive(!Auxilaryfunction.simulatorrender);
				}
				num++;
			}
			num = 0;
			while (__instance.starSimulators != null && num < __instance.starSimulators.Length)
			{
				if ((Object)(object)__instance.starSimulators[num] != (Object)null)
				{
					if ((int)__instance.starSimulators[num].starData.type == 3 && (Object)(object)Configs.builtin.neutronStarPrefab.streamRenderer != (Object)null)
					{
						num++;
						continue;
					}
					((Component)__instance.starSimulators[num]).gameObject.SetActive(!Auxilaryfunction.simulatorrender);
				}
				num++;
			}
			Auxilaryfunction.simulatorchanging = false;
		}
	}
	public class PlayerOperation
	{
		private static Harmony _patch;

		private static bool enable;

		public static float t = 20f;

		public static int AuDis = 40000;

		public static bool FlyStatus;

		private static PlanetData focusPlanet;

		private static StarData focusStar;

		private static ESpaceGuideType guidetype;

		public static bool Enable
		{
			get
			{
				return enable;
			}
			set
			{
				if (enable != value)
				{
					enable = value;
					if (enable)
					{
						_patch = Harmony.CreateAndPatchAll(typeof(PlayerOperation), (string)null);
						return;
					}
					_patch.UnpatchSelf();
					FlyStatus = false;
					ClearFollow();
				}
			}
		}

		private static Mecha mecha => Auxilaryfunction.player.mecha;

		public static bool NeedNavigation => GameMain.mainPlayer.navigation.indicatorAstroId > 0 || GameMain.mainPlayer.navigation._indicatorMsgId > 0 || GameMain.mainPlayer.navigation._indicatorEnemyId > 0;

		private static double max_acc => Auxilaryfunction.player.controller.actionSail.max_acc;

		private static float maxSailSpeed => Auxilaryfunction.player.controller.actionSail.maxSailSpeed;

		private static float maxWarpSpeed => Auxilaryfunction.player.controller.actionSail.maxWarpSpeed;

		private static int indicatorAstroId => Auxilaryfunction.player.navigation.indicatorAstroId;

		private static int indicatorMsgId => Auxilaryfunction.player.navigation.indicatorMsgId;

		private static int indicatorEnemyId => Auxilaryfunction.player.navigation.indicatorEnemyId;

		private static bool CanWarp => Auxilaryfunction.LocalPlanet == null && Auxilaryfunction.autowarpcommand.Value && !Auxilaryfunction.player.warping && mecha.coreEnergy > mecha.warpStartPowerPerSpeed * (double)maxWarpSpeed;

		public static void ClearFollow()
		{
			Player player = Auxilaryfunction.player;
			if (((player != null) ? player.navigation : null) != null)
			{
				Auxilaryfunction.player.navigation.indicatorAstroId = 0;
				Auxilaryfunction.player.navigation.indicatorMsgId = 0;
				Auxilaryfunction.player.navigation.indicatorEnemyId = 0;
			}
			t = 20f;
			focusPlanet = null;
			focusStar = null;
			Debug.Log((object)"Auxilaryfunction.ClearFollow");
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(PlayerController), "GetInput")]
		public static void Postfix(PlayerController __instance)
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_027c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			//IL_029d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_0344: Unknown result type (might be due to invalid IL or missing references)
			//IL_0379: Unknown result type (might be due to invalid IL or missing references)
			//IL_036f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0444: Unknown result type (might be due to invalid IL or missing references)
			//IL_044a: Invalid comparison between Unknown and I4
			//IL_039e: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Unknown result type (might be due to invalid IL or missing references)
			//IL_047a: Invalid comparison between Unknown and I4
			//IL_0705: Unknown result type (might be due to invalid IL or missing references)
			//IL_070b: Invalid comparison between Unknown and I4
			//IL_0716: Unknown result type (might be due to invalid IL or missing references)
			//IL_0740: Unknown result type (might be due to invalid IL or missing references)
			//IL_0742: Unknown result type (might be due to invalid IL or missing references)
			//IL_0744: Unknown result type (might be due to invalid IL or missing references)
			//IL_076b: Unknown result type (might be due to invalid IL or missing references)
			//IL_078d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0793: Invalid comparison between Unknown and I4
			//IL_07c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0931: Unknown result type (might be due to invalid IL or missing references)
			//IL_0937: Invalid comparison between Unknown and I4
			//IL_0940: Unknown result type (might be due to invalid IL or missing references)
			//IL_0944: Unknown result type (might be due to invalid IL or missing references)
			//IL_094a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0925: Unknown result type (might be due to invalid IL or missing references)
			//IL_0860: Unknown result type (might be due to invalid IL or missing references)
			//IL_0867: Unknown result type (might be due to invalid IL or missing references)
			//IL_086c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0871: Unknown result type (might be due to invalid IL or missing references)
			//IL_0875: Unknown result type (might be due to invalid IL or missing references)
			//IL_087a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0886: Unknown result type (might be due to invalid IL or missing references)
			//IL_088b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0890: Unknown result type (might be due to invalid IL or missing references)
			//IL_0892: Unknown result type (might be due to invalid IL or missing references)
			//IL_08af: Unknown result type (might be due to invalid IL or missing references)
			//IL_08b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_08bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_08eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f7: Unknown result type (might be due to invalid IL or missing references)
			//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)
			if (Auxilaryfunction.autonavigation_bool.Value)
			{
				if (indicatorAstroId <= 1000000 && indicatorAstroId > 0)
				{
					if (indicatorAstroId % 100 != 0)
					{
						if (focusPlanet == null)
						{
							FlyStatus = true;
							focusPlanet = GameMain.galaxy.PlanetById(indicatorAstroId);
							guidetype = (ESpaceGuideType)2;
						}
						else if (focusPlanet.id != indicatorAstroId)
						{
							FlyStatus = true;
							focusPlanet = GameMain.galaxy.PlanetById(indicatorAstroId);
							guidetype = (ESpaceGuideType)2;
						}
					}
					else if (focusStar == null)
					{
						focusPlanet = null;
						FlyStatus = true;
						focusStar = GameMain.galaxy.StarById(indicatorAstroId / 100);
						guidetype = (ESpaceGuideType)1;
					}
					else if (focusStar.id != indicatorAstroId / 100)
					{
						FlyStatus = true;
						focusStar = GameMain.galaxy.StarById(indicatorAstroId / 100);
						guidetype = (ESpaceGuideType)1;
					}
				}
				else if (indicatorAstroId > 1000000)
				{
					if (focusPlanet != null || focusStar != null)
					{
						focusStar = null;
						focusPlanet = null;
					}
				}
				else if (indicatorAstroId == 0 && (focusPlanet != null || focusStar != null))
				{
					ClearFollow();
				}
			}
			if (!Auxilaryfunction.autonavigation_bool.Value || !FlyStatus || !NeedNavigation)
			{
				return;
			}
			if (indicatorAstroId <= 1000000 && indicatorAstroId == Auxilaryfunction.LocalPlanet?.id)
			{
				FlyStatus = false;
				return;
			}
			if (indicatorAstroId > 1000000 && !Auxilaryfunction.AutoNavigateToDarkFogHive.Value)
			{
				FlyStatus = false;
				return;
			}
			if (!Auxilaryfunction.player.sailing)
			{
				FlyAwayPlanet();
				return;
			}
			VectorLF3 val = default(VectorLF3);
			if (focusPlanet != null)
			{
				val = focusPlanet.uPosition;
			}
			else if (focusStar != null)
			{
				val = focusStar.uPosition;
			}
			else if (indicatorAstroId > 1000000)
			{
				val = GameMain.data.spaceSector.astros[Auxilaryfunction.player.navigation.indicatorAstroId - 1000000].uPos;
				guidetype = (ESpaceGuideType)6;
			}
			else if (indicatorEnemyId != 0)
			{
				ref EnemyData reference = ref GameMain.data.spaceSector.enemyPool[indicatorEnemyId];
				GameMain.data.spaceSector.TransformFromAstro_ref(reference.astroId, ref val, ref reference.pos);
				guidetype = (ESpaceGuideType)7;
			}
			else
			{
				if (indicatorMsgId == 0)
				{
					return;
				}
				if (indicatorMsgId > CosmicMessageProto.maxProtoId)
				{
					guidetype = (ESpaceGuideType)8;
				}
				else
				{
					guidetype = (ESpaceGuideType)5;
				}
				val = GameMain.gameScenario.cosmicMessageManager.messages[Auxilaryfunction.player.navigation.indicatorMsgId].uPosition;
			}
			VectorLF3 targetVel = Auxilaryfunction.player.uPosition - val;
			double magnitude = ((VectorLF3)(ref targetVel)).magnitude;
			bool flag = magnitude > (double)(Auxilaryfunction.autowarpdistance.Value * 2400000f) && CanWarp && mecha.coreEnergy * 100.0 / mecha.coreEnergyCap >= (double)Auxilaryfunction.autowarpdistanceEnergyPercent.Value;
			bool flag2 = false;
			if (magnitude < 8000.0)
			{
				flag2 = true;
			}
			else if (magnitude < 100000.0 && (int)guidetype == 1)
			{
				flag2 = true;
			}
			else if (magnitude < (double)(Auxilaryfunction.AutoNavigateToDarkFogHiveKeepDistance.Value * 100 + 1000) && (int)guidetype == 6)
			{
				flag2 = true;
			}
			if (Auxilaryfunction.player.warping && __instance.actionSail.currentWarpSpeed > 15000.0 && magnitude < (double)(AuDis * 70))
			{
				if (magnitude > (double)(AuDis * 26))
				{
					if (__instance.actionSail.currentWarpSpeed > (double)(AuDis * 120))
					{
						PlayerMove_Sail actionSail = __instance.actionSail;
						actionSail.warpSpeedControl -= 0.008;
					}
				}
				else if (magnitude > (double)(AuDis * 20))
				{
					if (__instance.actionSail.currentWarpSpeed > (double)(AuDis * 80))
					{
						PlayerMove_Sail actionSail2 = __instance.actionSail;
						actionSail2.warpSpeedControl -= 0.008;
					}
				}
				else if (magnitude > (double)(AuDis * 15))
				{
					if (__instance.actionSail.currentWarpSpeed > (double)(AuDis * 40))
					{
						PlayerMove_Sail actionSail3 = __instance.actionSail;
						actionSail3.warpSpeedControl -= 0.008;
					}
					if (__instance.actionSail.currentWarpSpeed > (double)(AuDis * 80))
					{
						PlayerMove_Sail actionSail4 = __instance.actionSail;
						actionSail4.warpSpeedControl -= 0.016;
					}
				}
				else if (magnitude > (double)(AuDis * 6))
				{
					if (__instance.actionSail.currentWarpSpeed > (double)(AuDis * 20))
					{
						PlayerMove_Sail actionSail5 = __instance.actionSail;
						actionSail5.warpSpe