Decompiled source of Auxilaryfunction v2.8.5

Auxilaryfunction.dll

Decompiled 3 hours 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.Models;
using Auxilaryfunction.Patch;
using Auxilaryfunction.Services;
using BepInEx;
using BepInEx.Configuration;
using HarmonyLib;
using UnityEngine;
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.8.5")]
	public class Auxilaryfunction : BaseUnityPlugin
	{
		public const string GUID = "cn.blacksnipe.dsp.Auxilaryfunction";

		public const string NAME = "Auxilaryfunction";

		public const string VERSION = "2.8.5";

		public static int autoaddtechid;

		public static bool autobuildgetitem;

		public static Thread autobuildThread;

		public static int automovetoPrebuildSecondElapseCounter;

		public static bool autoRemoveRuin;

		public static int autoRemoveRuinId = -1;

		public static float batchnum = 1f;

		public static BuildingParameters buildingParameters;

		public static bool ChangingBluePrintQuickKey;

		public static bool ChangingQuickKey;

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

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

		public static bool GameDataImported;

		public static GUIDraw guidraw;

		public static Harmony harmony;

		public static bool HideDarkFogAssaultTip;

		public static bool HideDarkFogMonitor;

		public static int locallogic;

		public static int maxCount = 0;

		public static Player player;

		public static List<int> pointlayeridlist;

		public static int pointsignalid;

		public static List<int> readyresearch;

		public static int remotelogic = 2;

		public static bool simulatorchanging;

		public static bool simulatorrender;

		public static bool StartAutoMovetoDarkfog;

		public static bool StartAutoMovetounbuilt;

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

		public static int stationindex = 4;

		public static RectTransform stationTipRectTransform;

		public static GameObject stationTipRoot;

		public static StationTip[] stationtips = new StationTip[maxCount];

		public static GameObject StationWindow;

		public static Light SunLight;

		public static bool temp;

		public static GameObject tipPrefab;

		public static GameObject TrashCanButton;

		public static StorageComponent TrashStorage;

		public static GameObject TrashStorageWindow;

		public static UIStationWindow uiStationWindow;

		public static UIStorageWindow uiTrashStorageWindow;

		public bool firstStart;

		private float trashfunctiontime;

		public static ConfigEntry<int> auto_add_techid;

		public static ConfigEntry<int> auto_add_techmaxLevel;

		public static ConfigEntry<bool> auto_setejector_bool;

		public static ConfigEntry<int> auto_supply_Courier;

		public static ConfigEntry<int> auto_supply_drone;

		public static ConfigEntry<int> auto_supply_ship;

		public static ConfigEntry<int> auto_supply_starfuel;

		public static ConfigEntry<int> auto_supply_starfuelID;

		public static ConfigEntry<bool> auto_supply_station;

		public static ConfigEntry<int> auto_supply_warp;

		public static ConfigEntry<bool> autoabsorttrash_bool;

		public static ConfigEntry<bool> autoAddPlayerVel;

		public static ConfigEntry<bool> autoaddtech_bool;

		public static ConfigEntry<bool> autoAddwarp;

		public static ConfigEntry<bool> autocleartrash_bool;

		public static ConfigEntry<bool> automovetodarkfog;

		public static ConfigEntry<float> automovetoPrebuildSecondElapse;

		public static ConfigEntry<bool> automovetounbuilt;

		public static ConfigEntry<bool> AutoNavigateToDarkFogHive;

		public static ConfigEntry<int> AutoNavigateToDarkFogHiveKeepDistance;

		public static ConfigEntry<bool> autonavigation_bool;

		public static ConfigEntry<int> autosavetime;

		public static ConfigEntry<bool> autosavetimechange;

		public static ConfigEntry<bool> autosetCourier_bool;

		public static ConfigEntry<bool> autosetSomevalue_bool;

		public static ConfigEntry<bool> autosetstationconfig;

		public static ConfigEntry<bool> autowarpcommand;

		public static ConfigEntry<float> autowarpdistance;

		public static ConfigEntry<float> autowarpdistanceEnergyPercent;

		public static ConfigEntry<bool> BluePrintDelete;

		public static ConfigEntry<bool> BluePrintSelectAll;

		public static ConfigEntry<KeyboardShortcut> BluePrintShowWindow;

		public static ConfigEntry<bool> CloseMilestone;

		public static ConfigEntry<bool> closeplayerflyaudio;

		public static ConfigEntry<bool> CloseUIAdvisor;

		public static ConfigEntry<bool> CloseUIRandomTip;

		public static ConfigEntry<bool> CloseUITutorialTip;

		public static ConfigEntry<bool> CloseUIGeneralTip;

		public static ConfigEntry<float> DroneStartCarry;

		public static ConfigEntry<bool> DysonPanelDysonSphere;

		public static ConfigEntry<bool> DysonPanelLayers;

		public static ConfigEntry<bool> DysonPanelSingleLayer;

		public static ConfigEntry<bool> DysonPanelSwarm;

		public static ConfigEntry<bool> KeepBeltHeight;

		public static ConfigEntry<string> LastOpenBluePrintBrowserPathConfig;

		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_lab_bool;

		public static ConfigEntry<bool> norender_powerdisk_bool;

		public static ConfigEntry<bool> norender_shipdrone_bool;

		public static ConfigEntry<bool> noscaleuitech_bool;

		public static ConfigEntry<bool> onlygetbuildings;

		public static ConfigEntry<KeyboardShortcut> QuickKey;

		public static ConfigEntry<bool> Quickstop_bool;

		public static ConfigEntry<bool> SaveLastOpenBluePrintBrowserPathConfig;

		public static ConfigEntry<float> ShipStartCarry;

		public static ConfigEntry<bool> ShowStationInfo;

		public static ConfigEntry<bool> ShowStationInfoMode;

		public static ConfigEntry<bool> stationcopyItem_bool;

		public static ConfigEntry<int> stationdronedist;

		public static ConfigEntry<float> stationmaxpowerpertick;

		public static ConfigEntry<int> stationshipdist;

		public static ConfigEntry<double> stationwarpdist;

		public static ConfigEntry<bool> SunLightOpen;

		public static ConfigEntry<bool> TrashStorageWindow_bool;

		public static ConfigEntry<bool> upsquickset;

		public static ConfigEntry<int> veincollectorspeed;

		public static ConfigEntry<float> window_height;

		public static ConfigEntry<float> window_width;

		public static PlanetData LocalPlanet => GameMain.localPlanet;

		public static void AddCourierToAllStar()
		{
			if (LocalPlanet == null)
			{
				return;
			}
			int value = auto_supply_Courier.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);
					}
				}
			}
		}

		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_ship.Value;
			int value2 = auto_supply_drone.Value;
			int value3 = auto_supply_warp.Value;
			StationComponent[] stationPool = LocalPlanet.factory.transport.stationPool;
			int num4 = default(int);
			foreach (StationComponent val in stationPool)
			{
				if (val != null && !val.isVeinCollector)
				{
					int num = (val.isStellar ? 100 : 50);
					int num2 = ((value2 > num) ? num : value2);
					int num3 = num2 - val.workDroneCount - val.idleDroneCount;
					if (num3 > 0)
					{
						val.idleDroneCount += player.package.TakeItem(5001, num3, ref num4);
					}
					int num5 = value - val.idleShipCount - val.workShipCount;
					if (val.isStellar && num5 > 0)
					{
						val.idleShipCount += player.package.TakeItem(5002, num5, ref num4);
					}
					int num6 = value3 - val.warperCount;
					if (num6 > 0)
					{
						val.warperCount += player.package.TakeItem(1210, num6, ref num4);
					}
				}
			}
		}

		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;
					}
				}
			}
		}

		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 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 SetGasStation()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Invalid comparison between Unknown and I4
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_037d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0382: Unknown result type (might be due to invalid IL or missing references)
			//IL_0384: Unknown result type (might be due to invalid IL or missing references)
			//IL_039f: 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_03a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: 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_03d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03de: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_03ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0404: Unknown result type (might be due to invalid IL or missing references)
			//IL_0406: Unknown result type (might be due to invalid IL or missing references)
			//IL_040b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_0417: Unknown result type (might be due to invalid IL or missing references)
			//IL_0419: Unknown result type (might be due to invalid IL or missing references)
			//IL_041e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0423: Unknown result type (might be due to invalid IL or missing references)
			//IL_0450: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_0476: 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;
					}
				}
				if (factory.prebuildCount > 0)
				{
					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 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a06: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a0f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a16: Invalid comparison between Unknown and I4
			//IL_0a1d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a22: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a38: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a47: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a51: Invalid comparison between Unknown and I4
			//IL_0a72: 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);
			BluePrintShowWindow = ((BaseUnityPlugin)this).Config.Bind<KeyboardShortcut>("打开蓝图窗口快捷键", "BluePrintQuickKey", new KeyboardShortcut((KeyCode)306, (KeyCode[])(object)new KeyCode[1] { (KeyCode)102 }), (ConfigDescription)null);
			GUIDraw.tempShowWindow = QuickKey.Value;
			GUIDraw.tempBluePrintShowWindow = BluePrintShowWindow.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);
			BluePrintSelectAll = ((BaseUnityPlugin)this).Config.Bind<bool>("蓝图全选", "BluePrintSelectAll", 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);
			CloseUIGeneralTip = ((BaseUnityPlugin)this).Config.Bind<bool>("关闭科技解锁提示", "CloseUIGeneralTip", 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);
			autosetCourier_bool = ((BaseUnityPlugin)this).Config.Bind<bool>("自动填充配送运输机", "autosetCourier_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;
			}
			if (CloseMilestone.Value)
			{
				LDB.audios["unlock-1"].Volume = 0f;
			}
			CloseMilestone.SettingChanged += delegate
			{
				LDB.audios["unlock-1"].Volume = (CloseMilestone.Value ? 0f : AuxilaryfunctionPatch.originUnlockVolumn);
				Debug.Log((object)LDB.audios["unlock-1"].Volume);
			};
			closeplayerflyaudio.SettingChanged += delegate
			{
				PlayerAudioMutePatch.Enable = closeplayerflyaudio.Value;
			};
			if (autonavigation_bool.Value)
			{
				PlayerOperationPatch.Enable = true;
			}
			autonavigation_bool.SettingChanged += delegate
			{
				PlayerOperationPatch.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 });
					}
				}
			}
			pointlayeridlist = new List<int>();
			readyresearch = 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 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 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 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 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 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 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)
			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 (BluePrintDelete.Value && Input.GetKey((KeyCode)306) && Input.GetKeyDown((KeyCode)120))
				{
					BuildPreview[] bpPool = blueprintCopyTool.bpPool;
					foreach (BuildPreview val2 in bpPool)
					{
						if (val2 == null || val2.item == null || val2.objId <= 0)
						{
							continue;
						}
						int stationId = LocalPlanet.factory.entityPool[val2.objId].stationId;
						if (stationId > 0)
						{
							StationComponent val3 = LocalPlanet.factory.transport.stationPool[stationId];
							for (int k = 0; k < val3.storage.Length; k++)
							{
								int num = player.TryAddItemToPackage(val3.storage[k].itemId, val3.storage[k].count, 0, true, val2.objId, false);
								UIItemup.Up(val3.storage[k].itemId, num);
							}
							val3.storage = (StationStore[])(object)new StationStore[val3.storage.Length];
							val3.needs = new int[val3.needs.Length];
						}
						actionBuild.DoDismantleObject(val2.objId);
					}
					blueprintCopyTool.ClearSelection();
					blueprintCopyTool.ClearPreSelection();
					blueprintCopyTool.ResetBlueprint();
					blueprintCopyTool.ResetBuildPreviews();
					blueprintCopyTool.RefreshBlueprintData();
				}
			}
			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();
				}
			}
		}

		private void ChangeQuickKeyMethod()
		{
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			if (ChangingQuickKey)
			{
				GUIDraw.ChangeBluePrintQuickKey = false;
				ChangingBluePrintQuickKey = false;
			}
			else if (ChangingBluePrintQuickKey)
			{
				GUIDraw.ChangeQuickKey = false;
				ChangingQuickKey = false;
			}
			if (GUIDraw.ChangeQuickKey)
			{
				setQuickKey();
				ChangingQuickKey = true;
			}
			else if (!GUIDraw.ChangeQuickKey && ChangingQuickKey)
			{
				QuickKey.Value = GUIDraw.tempShowWindow;
				ChangingQuickKey = false;
			}
			if (GUIDraw.ChangeBluePrintQuickKey)
			{
				setBluePrintQuickKey();
				ChangingBluePrintQuickKey = true;
			}
			else if (!GUIDraw.ChangeBluePrintQuickKey && ChangingBluePrintQuickKey)
			{
				BluePrintShowWindow.Value = GUIDraw.tempBluePrintShowWindow;
				ChangingBluePrintQuickKey = 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 GameUpdate()
		{
			if (!GameDataImported)
			{
				player = null;
				firstStart = true;
				readyresearch.Clear();
				SpeedUpPatch.SpeedMultiple = 1f;
				autoaddtechid = 0;
				GUIDraw.blueprintopen = false;
				simulatorrender = false;
				PlayerOperationPatch.FlyStatus = false;
				PlayerOperationPatch.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)
				{
					PlayerOperationPatch.Enable = true;
				}
			}
			if (firstStart)
			{
				firstStart = false;
				PlayerOperationPatch.ClearFollow();
				trashfunctiontime = Time.time;
				ReLoadEjectorDic();
				BluePrintBatchModifyBuild.Init();
				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 OnGUI()
		{
			guidraw.Draw();
		}

		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;
					}
				}
			}
		}

		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 SecondEvent()
		{
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: 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)
					{
						if (guidraw.AutoUnlockTechInSandBox)
						{
							GameMain.history.UnlockTechUnlimited(autoaddtechid, true);
						}
						else
						{
							GameMain.history.EnqueueTech(autoaddtechid);
						}
					}
				}
				if (automovetounbuilt.Value)
				{
					try
					{
						AutoMovetounbuilt();
					}
					catch (Exception ex)
					{
						UIMessageBox.Show(ErrorTitle.getTranslate(), ex.ToString(), Localization.Translate("确定"), 3, (Response)null);
					}
				}
				if (automovetodarkfog.Value)
				{
					try
					{
						AutoMoveToDarkfog();
					}
					catch (Exception ex2)
					{
						Console.WriteLine(ex2.ToString());
					}
				}
				Thread.Sleep(1000);
			}
		}

		private void setBluePrintQuickKey()
		{
			//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.tempBluePrintShowWindow = new KeyboardShortcut((KeyCode)array[0], (KeyCode[])(object)new KeyCode[1] { (KeyCode)array[1] });
				}
				else
				{
					GUIDraw.tempBluePrintShowWindow = new KeyboardShortcut((KeyCode)Math.Max(array[0], array[1]), Array.Empty<KeyCode>());
				}
			}
		}

		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>());
				}
			}
		}

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

		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 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 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;
				}
			}
		}
	}
	public class AuxilaryfunctionPatch
	{
		public static float originUnlockVolumn;

		[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(UIBlueprintInspector), "Refresh")]
		public static void UIBlueprintInspectorRefresh(bool refreshComponent)
		{
			BluePrintBatchModifyBuild.NeedRefresh = refreshComponent;
		}

		[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.autosetCourier_bool.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(UIGeneralTips), "OnTechUnlocked")]
		public static bool UIGeneralTipsOnTechUnlocked()
		{
			if (Auxilaryfunction.CloseUIGeneralTip.Value)
			{
				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 static class AuxilaryTranslate
	{
		public static HashSet<string> notranslateStr = new HashSet<string>();

		private static Dictionary<string, string> TranslateDict = new Dictionary<string, string>();

		public static string getTranslate(this string s)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Invalid comparison between Unknown and I4
			if ((int)Localization.CurrentLanguage.glyph > 0)
			{
				return s;
			}
			if (TranslateDict.ContainsKey(s))
			{
				return TranslateDict[s];
			}
			notranslateStr.Add(s);
			return s;
		}

		public static void regallTranslate()
		{
			TranslateDict.Clear();
			TranslateDict.Add("辅助面板错误提示", "Auxilaryfunction Error");
			TranslateDict.Add("默认面板", "Default Panel");
			TranslateDict.Add("戴森球面板", "Dyson Sphere Panel");
			TranslateDict.Add("选择一个蓝图后,点击右侧的层级可以自动导入", "Select BluePrintFile,you can click enabled layers to paste");
			TranslateDict.Add("单层壳", "Single Layer");
			TranslateDict.Add("多层壳", "Layers");
			TranslateDict.Add("戴森云", "Dyson Swarm");
			TranslateDict.Add("戴森球(包括壳、云)", "Dyson Sphere(include layers and swarm)");
			TranslateDict.Add("打开戴森球蓝图文件夹", "Open DysonBlueprint Folder");
			TranslateDict.Add("刷新文件", "Refresh files list");
			TranslateDict.Add("复制选中文件代码", "Copy selected file cotent");
			TranslateDict.Add("清除剪贴板", "clear clipboard");
			TranslateDict.Add("应用蓝图", "Apply Selected BluePrint File");
			TranslateDict.Add("自动生成最大半径戴森壳", "Auto Add bigest layers");
			TranslateDict.Add("删除全部空壳", "Delete all empty layers");
			TranslateDict.Add("可用戴森壳层级:", "Enabled layers:");
			TranslateDict.Add("不可用戴森壳层级:", "Disabled layers:");
			TranslateDict.Add("勾选即可点击删除", "Tick to click delete layer");
			TranslateDict.Add("路径为空,请重新选择", "The path is empty, please select again");
			TranslateDict.Add("文件读取失败", "file read failed");
			TranslateDict.Add("文件不存在", "file does not exist");
			TranslateDict.Add("自动清除空戴森球", "Auto Clear Empty Dyson");
			TranslateDict.Add("每次打开戴森球面板(Y)都会自动进行清理", "Auto Clear Empty Dyson when you open DysonPanel(Y)");
			TranslateDict.Add("记录上次蓝图路径", "Record the last blueprint path");
			TranslateDict.Add("单层壳蓝图请选择层级", " Single layer blueprint please select the layer");
			TranslateDict.Add("自动配置新运输站", "AutoStation");
			TranslateDict.Add("配置参数", "Configurations");
			TranslateDict.Add("填充飞机数量", "Fill the number of drones");
			TranslateDict.Add("填充飞船数量", "Fill the number of vessel");
			TranslateDict.Add("最大充电功率", "Max. Charging Power");
			TranslateDict.Add("运输机最远路程", "Transport range of Drones");
			TranslateDict.Add("运输船最远路程", "Transport range of Vessels");
			TranslateDict.Add("曲速启用路程", "Distance to enable Warp");
			TranslateDict.Add("运输机起送量", "Min. Load of Drones");
			TranslateDict.Add("运输船起送量", "Min. Load of Vessels");
			TranslateDict.Add("翘曲填充数量", "Fill the number of warper");
			TranslateDict.Add("大型采矿机采矿速率", "Advanced mining machine gathering Speed");
			TranslateDict.Add("批量配置当前星球大型采矿机采矿速率", "set all advanced mining machine gathering Speed");
			TranslateDict.Add("铺满轨道采集器", "Full orbital Collector this planet(gas)");
			TranslateDict.Add("填充当前星球配送机飞机飞船、翘曲器", "Fill all stations with courier,vessels,drones,warpers");
			TranslateDict.Add("批量配置当前星球物流站", "set all stations");
			TranslateDict.Add("不渲染戴森壳", "Don't render Dyson shell");
			TranslateDict.Add("不渲染戴森云", "Don't render Dyson swarm");
			TranslateDict.Add("不渲染研究站", "Don't render lab");
			TranslateDict.Add("不渲染传送带货物", "Don't render belt item");
			TranslateDict.Add("不渲染运输船和飞机", "Don't render vessels,drones");
			TranslateDict.Add("不渲染实体", "Don't render entity");
			TranslateDict.Add("不渲染全部", "Don't render at all");
			TranslateDict.Add("不渲染电网覆盖", "Don't render power grid");
			TranslateDict.Add("关闭玩家走路飞行声音", "Turn off the player's walking and flying sound");
			TranslateDict.Add("自动添加翘曲器", "Auto add Warp");
			TranslateDict.Add("自动添加机甲燃料", "Auto add fuel");
			TranslateDict.Add("停止工厂", "stop factory");
			TranslateDict.Add("ctrl+空格快速开关", "quick start and stop(ctrl+space)");
			TranslateDict.Add("个", "");
			TranslateDict.Add("剩余", "surplus");
			TranslateDict.Add("回收", "recycle");
			TranslateDict.Add("个未完成建筑,该星球无法初始化", "unfinished building,The planet cannot be initialized.");
			TranslateDict.Add("自动飞向未完成建筑", "Auto fly to unfinished buildings");
			TranslateDict.Add("自动飞向地面黑雾基地", "Autp fly to dark fog on ground");
			TranslateDict.Add("自动添加科技队列", "Auto add tech queue");
			TranslateDict.Add("未选择", "no selected");
			TranslateDict.Add("自动配置太阳帆弹射器", "Auto set Ejector");
			TranslateDict.Add("自动导航", "Auto navigation");
			TranslateDict.Add("自动导航使用曲速", "Auto use warper");
			TranslateDict.Add("自动使用翘曲器距离", "Auto use warper distance");
			TranslateDict.Add("自动添加科技等级上限", "Auto add technology level cap");
			TranslateDict.Add("光年", "light-years");
			TranslateDict.Add("精准拿取", "Accurately take");
			TranslateDict.Add("建筑计数", "Building count");
			TranslateDict.Add("一键闭嘴", "One key to shut up");
			TranslateDict.Add("科技面板选中不缩放", "Technologies panel no scale");
			TranslateDict.Add("蓝图全选", "Blueprint SelectAll");
			TranslateDict.Add("蓝图删除", "Blueprint Delete");
			TranslateDict.Add("蓝图撤销", "Blueprint Revocation");
			TranslateDict.Add("蓝图设置配方", "Blueprint setting recipe");
			TranslateDict.Add("蓝图复制直接粘贴", "Blueprint copy and paste directly");
			TranslateDict.Add("物流站信息显示", "Show station info");
			TranslateDict.Add("详细模式", "Detailed mode");
			TranslateDict.Add("简易模式", "Simple Mode");
			TranslateDict.Add("物流站物品设置复制粘贴", "Station grids copy(<) and paste(>)");
			TranslateDict.Add("30s间隔自动吸收垃圾", "Auto. recycle Litter in 30s");
			TranslateDict.Add("只回收建筑", "Recycle only buildings");
			TranslateDict.Add("30s间隔自动清除垃圾", "Auto. clear Litter in 30s");
			TranslateDict.Add("改变窗口快捷键", "Change Window shortcut");
			TranslateDict.Add("点击确认", "Click to confirm");
			TranslateDict.Add("生产加速", "Production Speedup");
			TranslateDict.Add("额外产出", "Extra Products");
			TranslateDict.Add("初始化预制建筑池", "Initialize all planet prebuild pool");
			TranslateDict.Add("自动画最密戴森球", "Auto. draw DysonSphere");
			TranslateDict.Add("缓慢最密画法", "slow draw method");
			TranslateDict.Add("根", "root");
			TranslateDict.Add("带壳", "With Shell");
			TranslateDict.Add("带", "yes");
			TranslateDict.Add("不带", "no");
			TranslateDict.Add("只画单层", "only single layer");
			TranslateDict.Add("启动", "start draw");
			TranslateDict.Add("正在画", "Drawing");
			TranslateDict.Add("停止", "Stop");
			TranslateDict.Add("启动时间流速修改", "Start time flow rate modification");
			TranslateDict.Add("流速倍率", "Flow rate multiplier");
			TranslateDict.Add("加速减速", "Speed up and slow down");
			TranslateDict.Add("自动填充人造恒星", "Auto add fuel to Artificial Star");
			TranslateDict.Add("人造恒星燃料数量", "Artificial Star fuel quantity");
			TranslateDict.Add("填充当前星球人造恒星", "Fill the current planet with artificial stars");
			TranslateDict.Add("保持传送带高度(shift)", "Keep belt height(shift)");
			TranslateDict.Add("修改自动保存时长", "Modify AutosaveTime");
			TranslateDict.Add("自动保存时间", "Autosavetime");
			TranslateDict.Add("文字科技树", "Text technology tree");
			TranslateDict.Add("限制材料", "Restricted material");
			TranslateDict.Add("自动乱点", "Auto random select");
			TranslateDict.Add("暂停导航", "stop navigation");
			TranslateDict.Add("继续导航", "continue navigation");
			TranslateDict.Add("取消方向指示", "cacel Indicatior");
			TranslateDict.Add("辅助面板", "Auxilaryfunction");
			TranslateDict.Add("无", "none");
			TranslateDict.Add("粘贴物流站配方", "paste station grids set");
			TranslateDict.Add("上限", "Upper limit");
			TranslateDict.Add("本地", "Local");
			TranslateDict.Add("星际", "Remote");
			TranslateDict.Add("第", "No.");
			TranslateDict.Add("格", "Grid");
			TranslateDict.Add("准备研究", "Research Queue");
			TranslateDict.Add("科技", "Technologies");
			TranslateDict.Add("关闭白色面板", "ClosePanel");
			TranslateDict.Add("升级", "Upgrades");
			TranslateDict.Add("光子生成", "Photon Generation");
			TranslateDict.Add("直接发电", "Power Generation");
			TranslateDict.Add("科技等级上限", "TechLevel Upper Limit");
			TranslateDict.Add("行为设置", "Behavior");
			TranslateDict.Add("忽略配队设置", "Ignore Pairing");
			TranslateDict.Add("优先配队设置", "Priority Pairing");
			TranslateDict.Add("只看配队设置", "Exclusive Pairing");
			TranslateDict.Add("物流站名称", "Station Name");
			TranslateDict.Add("设置名称", "Set Station Name");
			TranslateDict.Add("设置分组", "Set group");
			TranslateDict.Add("设置物流站物品", "Set Station Items");
			TranslateDict.Add("设置物流站参数", "Set Station Config");
			TranslateDict.Add("设置分组行为", "Set Behavior");
			TranslateDict.Add("垃圾桶", "trash can");
			TranslateDict.Add("暂无选中设备", "No equipment selected");
			TranslateDict.Add("开关显示垃圾桶,垃圾桶关闭后自动清理内部物品", "Switch to display the trash can and automatically clean the contents when the trash can is closed");
			TranslateDict.Add("火种列表", "Tinder list");
			TranslateDict.Add("无火种", "No tinder");
			TranslateDict.Add("通讯器列表", "List of communicators");
			TranslateDict.Add("与玩家距离", "Distance from the player");
			TranslateDict.Add("导航", "navigation");
			TranslateDict.Add("黑雾巢穴自动导航", "Auto move to DarkFog");
			TranslateDict.Add("跟随距离", "Follow Distance");
			TranslateDict.Add("模型屏蔽", "Model masking");
			TranslateDict.Add("UI屏蔽", "UI masking");
			TranslateDict.Add("声音屏蔽", "Sound blocking");
			TranslateDict.Add("机甲自动化", "Mecha automation");
			TranslateDict.Add("自动菜单", "Auto Menu");
			TranslateDict.Add("渲染屏蔽", "Render Mask");
			TranslateDict.Add("便捷小功能", "Convenience Features");
			TranslateDict.Add("战斗", "Battles");
			TranslateDict.Add("蓝图设置", "Blueprint settings");
			TranslateDict.Add("填充当前星球飞机飞船、翘曲器", "Fill current planet aircraft ships, warpers");
			TranslateDict.Add("自动填充配送运输机", "Auto-fill delivery transports");
			TranslateDict.Add("填充配送运输机数量", "Fill the number of delivery transports");
			TranslateDict.Add("填充当前星球配送机", "Fill current planet's dispensers");
			TranslateDict.Add("自动加速", "Auto Acceleration");
			TranslateDict.Add("自动曲速最低距离", "Auto Warp Minimum Distance");
			TranslateDict.Add("自动曲速最低能量", "Auto-warp minimum energy");
			TranslateDict.Add("不渲染黑雾", "Do not render black fog");
			TranslateDict.Add("关闭建筑栏提示", "Turn off building bar prompts");
			TranslateDict.Add("关闭教学提示", "Turn off teaching tips");
			TranslateDict.Add("关闭顾问", "Turn off advisors");
			TranslateDict.Add("关闭里程碑提示", "Turn off milestone alerts");
			TranslateDict.Add("隐藏黑雾威胁度检测", "Hide black fog threat level detection");
			TranslateDict.Add("隐藏黑雾入侵提示", "Hide Black Fog Intrusion Alerts");
			TranslateDict.Add("蓝图功能优化", "Blueprint optimization");
			TranslateDict.Add("物流站功能优化", "Logistics Station Optimization");
			TranslateDict.Add("背包垃圾桶", "Backpack trash can");
			TranslateDict.Add("夜灯", "Night Light");
			TranslateDict.Add("当前选中", "Currently selected");
			TranslateDict.Add("进入蓝图模式可使用", "Available in Blueprint Mode");
			TranslateDict.Add("全选当前星球建筑", "Select all buildings on current planet");
			TranslateDict.Add("删除选中建筑", "Delete selected buildings");
			TranslateDict.Add("可修改建筑", "Modify buildings");
			TranslateDict.Add("科研模式", "Research mode");
			TranslateDict.Add("辅助面板提示", "Auxiliary Panel Tips");
		}
	}
	public class Constant
	{
		public static string[] PitchLetter = new string[12]
		{
			"C", "C#", "D", "D#", "E", "F", "F#", "G", "G#", "A",
			"A#", "B"
		};

		public static double[,] posxz = new double[10, 2]
		{
			{ 0.0, 1.0 },
			{ 0.1563, -0.9877 },
			{ 0.3089, -0.9511 },
			{ 0.4539, -0.8911 },
			{ 0.5877, -0.8091 },
			{ 0.7071, -0.7071 },
			{ 0.8091, -0.5877 },
			{ 0.891, -0.454 },
			{ 0.9511, -0.3089 },
			{ 0.9877, -0.1564 }
		};

		public static string[] StationNames = new string[8] { "星球矿机", "垃圾站", "星球无限供货机", "喷涂加工厂", "星球熔炉矿机", "星球量子传输站", "星系量子传输站", "设置翘曲需求" };

		public static GUIStyle[] StationStoreStyles = (GUIStyle[])(object)new GUIStyle[3];

		public static GUIStyle GetStationStorelogicStyle(ELogisticStorage i)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: 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_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Expected I4, but got Unknown
			return (GUIStyle)((int)i switch
			{
				0 => StationStoreStyles[0], 
				1 => StationStoreStyles[1], 
				2 => StationStoreStyles[2], 
				_ => GUI.skin.button, 
			});
		}

		public static string GetLogisticText(ELogisticStorage logic, bool isStellar, bool careStellar)
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Invalid comparison between Unknown and I4
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Invalid comparison between Unknown and I4
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Invalid comparison between Unknown and I4
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Invalid comparison between Unknown and I4
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0076: Invalid comparison between Unknown and I4
			if (careStellar && !isStellar)
			{
				if ((int)logic == 1)
				{
					return Localization.Translate("本地供应");
				}
				if ((int)logic == 2)
				{
					return Localization.Translate("本地需求");
				}
				return Localization.Translate("本地仓储");
			}
			if (careStellar && isStellar)
			{
				if ((int)logic == 1)
				{
					return Localization.Translate("星际供应");
				}
				if ((int)logic == 2)
				{
					return Localization.Translate("星际需求");
				}
				return Localization.Translate("星际仓储");
			}
			if ((int)logic == 1)
			{
				return Localization.Translate("供应");
			}
			if ((int)logic == 2)
			{
				return Localization.Translate("需求");
			}
			return Localization.Translate("仓储");
		}
	}
	internal class NumberTranslate
	{
		public static string DistanceTranslate(double distance)
		{
			if (distance < 1599.5)
			{
				return distance.ToString("0") + " m";
			}
			if (distance < 2400000.0)
			{
				return (distance / 40000.0).ToString("0.00") + " AU";
			}
			return (distance / 2400000.0).ToString("0.00") + " " + Localization.Translate("光年");
		}
	}
}
namespace Auxilaryfunction.Services
{
	public class DysonBluePrintDataService
	{
		public static TempDysonBlueprintData selectDysonBlueprintData = new TempDysonBlueprintData();

		public static List<TempDysonBlueprintData> tempDysonBlueprintData = new List<TempDysonBlueprintData>();

		public static void LoadDysonBluePrintData()
		{
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Invalid comparison between Unknown and I4
			DysonBluePrintDataService.tempDysonBlueprintData = new List<TempDysonBlueprintData>();
			string text = new StringBuilder(GameConfig.overrideDocumentFolder).Append(GameConfig.gameName).Append("/DysonBluePrint/").ToString();
			if (!Directory.Exists(text))
			{
				Directory.CreateDirectory(text);
				Stream manifestResourceStream = Assembly.GetExecutingAssembly().GetManifestResourceStream("Auxilaryfunction.450节点+框架+32壳面.txt");
				byte[] array = new byte[manifestResourceStream.Length];
				manifestResourceStream.Read(array, 0, (int)manifestResourceStream.Length);
				manifestResourceStream.Close();
				UTF8Encoding uTF8Encoding = new UTF8Encoding();
				string @string = uTF8Encoding.GetString(array);
				try
				{
					File.WriteAllText(Path.Combine(text, "450节点+框架+32壳面.txt"), @string);
				}
				catch
				{
				}
			}
			string[] files = Directory.GetFiles(text, "*.txt", SearchOption.AllDirectories);
			for (int i = 0; i < files.Length; i++)
			{
				string content = File.ReadAllText(files[i]);
				TempDysonBlueprintData tempDysonBlueprintData = new TempDysonBlueprintData
				{
					name = files[i].Substring(text.Length),
					path = files[i]
				};
				tempDysonBlueprintData.ReadDysonSphereBluePrint(content);
				if ((int)tempDysonBlueprintData.type > 0)
				{
					DysonBluePrintDataService.tempDysonBlueprintData.Add(tempDysonBlueprintData);
				}
			}
		}

		public static string ReaddataFromFile(string path)
		{
			if (selectDysonBlueprintData.path == "")
			{
				UIMessageBox.Show(Auxilaryfunction.ErrorTitle.getTranslate(), "路径为空,请重新选择".getTranslate(), Localization.Translate("确定"), 3, (Response)null);
				return "";
			}
			if (File.Exists(path))
			{
				try
				{
					return File.ReadAllText(path);
				}
				catch
				{
					UIMessageBox.Show(Auxilaryfunction.ErrorTitle.getTranslate(), "文件读取失败".getTranslate(), Localization.Translate("确定"), 3, (Response)null);
				}
			}
			UIMessageBox.Show(Auxilaryfunction.ErrorTitle.getTranslate(), "文件不存在".getTranslate(), Localization.Translate("确定"), 3, (Response)null);
			return "";
		}

		public static void RemoveLayerById(int Id)
		{
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Expected O, but got Unknown
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			DysonSphere dysonSphere = UIRoot.instance.uiGame.dysonEditor.selection.viewDysonSphere;
			if (dysonSphere == null)
			{
				return;
			}
			DysonSphereLayer layer = dysonSphere.layersIdBased[Id];
			if (layer == null)
			{
				return;
			}
			if (layer.nodeCount > 0 || layer.frameCount > 0 || layer.shellCount > 0)
			{
				UIMessageBox.Show(Localization.Translate("删除层级非空标题"), Localization.Translate("删除层级非空描述"), Localization.Translate("取消"), Localization.Translate("确定"), 1, (Response)null, (Response)delegate
				{
					if (dysonSphere.layersSorted.Contains(layer))
					{
						DysonSphereLayer obj = layer;
						if (ob