Decompiled source of FractionateEverything v1.4.3

FractionateEverything.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using BuildBarTool;
using CommonAPI;
using CommonAPI.Systems;
using CommonAPI.Systems.ModLocalization;
using FractionateEverything.Compatibility;
using FractionateEverything.Main;
using FractionateEverything.Utils;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using ProjectGenesis.Patches.Logic.QTools;
using ProjectGenesis.Patches.UI.QTools;
using ProjectGenesis.Patches.UI.QTools.MyComboBox;
using ProjectGenesis.Utils;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
using crecheng.DSPModSave;
using xiaoye97;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("FractionateEverything")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("FractionateEverything")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("3204cf73-a6e8-4c3b-a91d-e4baf6fca974")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8.1", FrameworkDisplayName = ".NET Framework 4.8.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace FractionateEverything
{
	[BepInPlugin("com.menglei.dsp.FractionateEverything", "FractionateEverything", "1.4.3")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[CommonAPISubmoduleDependency(new string[] { "ProtoRegistry", "TabSystem", "LocalizationModule" })]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class FractionateEverything : BaseUnityPlugin, IModCanSave
	{
		public const string GUID = "com.menglei.dsp.FractionateEverything";

		public const string NAME = "FractionateEverything";

		public const string VERSION_Main = "1.4.3";

		public const string VERSION_Debug = "";

		public const string VERSION = "1.4.3";

		private static ManualLogSource logger;

		public const string Tech1134IconPath = "Icons/Tech/1134";

		public static int tab分馏1;

		public static int tab分馏2;

		public static string ModPath;

		public static ResourceData fracicons;

		public static readonly Harmony harmony = new Harmony("com.menglei.dsp.FractionateEverything");

		private static bool _finished;

		private static ConfigFile configFile;

		public static ConfigEntry<string> CurrentVersionEntry;

		public static ConfigEntry<bool> DisableMessageBoxEntry;

		public static ConfigEntry<bool> AddedBlueprintsEntry;

		public static ConfigEntry<int> IconVersionEntry;

		public static ConfigEntry<bool> EnableDestroyEntry;

		public static ConfigEntry<bool> EnableFuelRodFracEntry;

		public static ConfigEntry<bool> EnableMatrixFracEntry;

		public static ConfigEntry<bool> EnableBuildingAsTrashEntry;

		public static bool isVersionChanged => CurrentVersionEntry.Value != "1.4.3";

		public static bool disableMessageBox => DisableMessageBoxEntry.Value;

		public static bool addedBlueprints => AddedBlueprintsEntry.Value;

		public static int iconVersion => IconVersionEntry.Value;

		public static bool enableDestroy => EnableDestroyEntry.Value;

		public static bool enableFuelRodFrac => EnableFuelRodFracEntry.Value;

		public static bool enableMatrixFrac => EnableMatrixFracEntry.Value;

		public static bool enableBuildingAsTrash => EnableBuildingAsTrashEntry.Value;

		public static void LogDebug(object data)
		{
			logger.LogDebug(data);
		}

		public static void LogInfo(object data)
		{
			logger.LogInfo(data);
		}

		public static void LogWarning(object data)
		{
			logger.LogWarning(data);
		}

		public static void LogError(object data)
		{
			logger.LogError(data);
		}

		public static void LogFatal(object data)
		{
			logger.LogFatal(data);
		}

		public void LoadConfig()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Expected O, but got Unknown
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c0: Expected O, but got Unknown
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_010e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Expected O, but got Unknown
			//IL_013a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Expected O, but got Unknown
			//IL_0166: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Expected O, but got Unknown
			configFile = ((BaseUnityPlugin)this).Config;
			CurrentVersionEntry = ((BaseUnityPlugin)this).Config.Bind<string>("config", "CurrentVersion", "", new ConfigDescription("Current game version, used to control whether or not to show the update pop-up window.\n当前游戏版本,用于控制是否显示更新弹窗。", (AcceptableValueBase)(object)new AcceptableStringValue(""), (object[])null));
			DisableMessageBoxEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("config", "DisableMessageBox", false, new ConfigDescription("Don't show message when FractionateEverything is loaded.\n禁用游戏加载完成后显示的万物分馏提示信息。", (AcceptableValueBase)(object)new AcceptableBoolValue(defVal: false), (object[])null));
			AddedBlueprintsEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("config", "AddedBlueprints", false, new ConfigDescription("Indicates whether the blueprint has been added. Change this to false to re-add the blueprint.\n指示是否添加过蓝图。该项改为false即可重新添加蓝图。", (AcceptableValueBase)(object)new AcceptableBoolValue(defVal: false), (object[])null));
			IconVersionEntry = ((BaseUnityPlugin)this).Config.Bind<int>("config", "IconVersion", 3, new ConfigDescription("Which style of the fractionate recipe icon to use.\n1 for original deuterium fractionate style, 2 for slanting line segmentation style, 3 for circular segmentation style.\n使用哪个样式的分馏配方图标。\n1表示原版重氢分馏样式,2表示斜线分割样式,3表示圆弧分割样式。", (AcceptableValueBase)(object)new AcceptableIntValue(3, 1, 3), (object[])null));
			EnableDestroyEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("config", "EnableDestroy", true, new ConfigDescription("Whether to enable the probability of destruction in fractionate recipes (recommended enable).\nWhen enabled, if the fractionation recipe has a probability of destruction, there is a certain probability that the input item will disappear during fractionation.\n是否启用分馏配方中的损毁概率(建议开启)。\n启用情况下,如果分馏配方具有损毁概率,则分馏时会有一定概率导致原料直接消失。", (AcceptableValueBase)(object)new AcceptableBoolValue(defVal: true), (object[])null));
			EnableFuelRodFracEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("config", "EnableFuelRodFracEntry", false, new ConfigDescription("Whether to enable fuel rod fractionation.\n是否启用燃料棒分馏。", (AcceptableValueBase)(object)new AcceptableBoolValue(defVal: false), (object[])null));
			EnableMatrixFracEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("config", "EnableMatrixFracEntry", false, new ConfigDescription("Whether to enable matrix fractionation (recommended disable).\n是否启用矩阵分馏(建议关闭)。", (AcceptableValueBase)(object)new AcceptableBoolValue(defVal: false), (object[])null));
			EnableBuildingAsTrashEntry = ((BaseUnityPlugin)this).Config.Bind<bool>("config", "EnableBuildingAsTrashEntry", false, new ConfigDescription("Whether buildings can input into Trash Recycle Fractionator (recommended disable).\n建筑能否输入垃圾回收分馏塔(建议关闭)。", (AcceptableValueBase)(object)new AcceptableBoolValue(defVal: false), (object[])null));
			(Traverse.Create((object)((BaseUnityPlugin)this).Config).Property("OrphanedEntries", (object[])null).GetValue() as IDictionary)?.Clear();
			((BaseUnityPlugin)this).Config.Save();
		}

		public static void SetConfig()
		{
			DisableMessageBoxEntry.Value = true;
			CurrentVersionEntry.Value = "1.4.3";
			AddedBlueprintsEntry.Value = true;
			configFile.Save();
		}

		public static void SetConfig(int iconVersion, bool enableDestroy, bool enableFuelRodFrac, bool enableMatrixFrac, bool enableBuildingAsTrash)
		{
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Invalid comparison between Unknown and I4
			bool flag = iconVersion != IconVersionEntry.Value;
			bool flag2 = enableDestroy != EnableDestroyEntry.Value;
			bool flag3 = enableFuelRodFrac != EnableFuelRodFracEntry.Value;
			bool flag4 = enableMatrixFrac != EnableMatrixFracEntry.Value;
			bool flag5 = enableBuildingAsTrash != EnableBuildingAsTrashEntry.Value;
			IconVersionEntry.Value = iconVersion;
			EnableDestroyEntry.Value = enableDestroy;
			EnableFuelRodFracEntry.Value = enableFuelRodFrac;
			EnableMatrixFracEntry.Value = enableMatrixFrac;
			logger.LogInfo((object)("Fractionate Everything setting changed.\n" + $" iconVersion:{iconVersion}" + $" enableDestroy:{enableDestroy}" + $" enableFuelRodFrac:{enableFuelRodFrac}" + $" enableMatrixFrac:{enableMatrixFrac}"));
			configFile.Save();
			if (flag || flag2 || flag3 || flag4)
			{
				RecipeProto[] dataArray = ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray;
				foreach (RecipeProto val in dataArray)
				{
					if ((int)val.Type == 8 && ((Proto)val).ID != 115)
					{
						val.ModifyIconAndDesc();
						val.Preload(val.index);
					}
				}
			}
			if (flag5)
			{
				ItemProto obj = ((ProtoSet<ItemProto>)(object)LDB.items).Select(2324);
				obj.Description = (enableBuildingAsTrash ? "I垃圾回收分馏塔2" : "I垃圾回收分馏塔");
				obj.Preload(obj.index);
			}
		}

		public void Awake()
		{
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Expected O, but got Unknown
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0095: Expected O, but got Unknown
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_015e: Expected O, but got Unknown
			//IL_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Expected O, but got Unknown
			using (ProtoRegistry.StartModLoad("com.menglei.dsp.FractionateEverything"))
			{
				logger = ((BaseUnityPlugin)this).Logger;
				Translation.AddTranslations();
				LoadConfig();
				tab分馏1 = TabSystem.RegisterTab("com.menglei.dsp.FractionateEverything:com.menglei.dsp.FractionateEverythingTab1", new TabData(Localization.Translate("分馏页面1"), "Icons/Tech/1134"));
				tab分馏2 = TabSystem.RegisterTab("com.menglei.dsp.FractionateEverything:com.menglei.dsp.FractionateEverythingTab2", new TabData(Localization.Translate("分馏页面2"), "Icons/Tech/1134"));
				Assembly executingAssembly = Assembly.GetExecutingAssembly();
				ModPath = Path.GetDirectoryName(executingAssembly.Location);
				fracicons = new ResourceData("com.menglei.dsp.FractionateEverything", "fracicons", ModPath);
				fracicons.LoadAssetBundle("fracicons");
				ProtoRegistry.AddResource(fracicons);
				LDBTool.PreAddDataAction = (Action)Delegate.Combine(LDBTool.PreAddDataAction, new Action(PreAddData));
				LDBTool.PostAddDataAction = (Action)Delegate.Combine(LDBTool.PostAddDataAction, new Action(PostAddData));
				Type[] types = executingAssembly.GetTypes();
				foreach (Type type in types)
				{
					if (type.Namespace != null && !type.Namespace.StartsWith("FractionateEverything.Compatibility"))
					{
						harmony.PatchAll(type);
					}
				}
				Harmony obj = harmony;
				MethodInfo methodInfo = AccessTools.Method(typeof(VFPreload), "InvokeOnLoadWorkEnded", (Type[])null, (Type[])null);
				HarmonyMethod val = new HarmonyMethod(typeof(FractionateEverything), "FinalAction", (Type[])null);
				val.after = new string[1] { "me.xiaoye97.plugin.Dyson.LDBTool" };
				obj.Patch((MethodBase)methodInfo, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				Harmony obj2 = harmony;
				MethodInfo methodInfo2 = AccessTools.Method(typeof(Localization), "LoadLanguage", (Type[])null, (Type[])null);
				val = new HarmonyMethod(typeof(TranslationUtils), "LoadLanguagePostfixAfterCommonApi", (Type[])null);
				val.after = new string[1] { "dsp.common-api.CommonAPI" };
				obj2.Patch((MethodBase)methodInfo2, (HarmonyMethod)null, val, (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
			}
		}

		public void PreAddData()
		{
			Tech.AddTechs();
			FractionatorBuildings.CreateAndPreAddNewFractionators();
		}

		public void PostAddData()
		{
			((ProtoSet<ModelProto>)(object)LDB.models).OnAfterDeserialize();
			ModelProto.InitMaxModelIndex();
			ModelProto.InitModelIndices();
			ModelProto.InitModelOrders();
			TechProto[] dataArray = ((ProtoSet<TechProto>)(object)LDB.techs).dataArray;
			for (int i = 0; i < dataArray.Length; i++)
			{
				dataArray[i].Preload();
			}
			dataArray = ((ProtoSet<TechProto>)(object)LDB.techs).dataArray;
			foreach (TechProto val in dataArray)
			{
				val.PreTechsImplicit = val.PreTechsImplicit.Except(val.PreTechs).ToArray();
				val.UnlockRecipes = val.UnlockRecipes.Distinct().ToArray();
				val.Preload2();
			}
			FractionatorBuildings.SetUnlockInfo();
		}

		public static void FinalAction()
		{
			if (!_finished)
			{
				PreloadAndInitAll();
				FractionatorLogic.Init();
				FractionatorBuildings.SetFractionatorCacheSize();
				FractionateRecipes.AddFracRecipes();
				_finished = true;
			}
		}

		public static void PreloadAndInitAll()
		{
			ItemProto.InitFuelNeeds();
			ItemProto.InitTurretNeeds();
			ItemProto.InitFluids();
			ItemProto.InitTurrets();
			ItemProto.InitEnemyDropTables();
			ItemProto.InitConstructableItems();
			ItemProto.InitItemIds();
			ItemProto.InitItemIndices();
			ItemProto.InitMechaMaterials();
			ItemProto.InitFighterIndices();
			ModelProto.InitMaxModelIndex();
			ModelProto.InitModelIndices();
			ModelProto.InitModelOrders();
			RecipeProto.InitFractionatorNeeds();
			RaycastLogic.LoadStatic();
			StorageComponent.staticLoaded = false;
			StorageComponent.LoadStatic();
		}

		public void Import(BinaryReader binaryReader)
		{
			_ = (Object)(object)DSPGame.Game == (Object)null;
		}

		public void Export(BinaryWriter binaryWriter)
		{
			_ = (Object)(object)DSPGame.Game == (Object)null;
		}

		public void IntoOtherSave()
		{
			if (!((Object)(object)DSPGame.Game == (Object)null))
			{
				_ = DSPGame.IsMenuDemo;
			}
		}
	}
}
namespace FractionateEverything.Utils
{
	public class AcceptableIntValue : AcceptableValueBase
	{
		[CompilerGenerated]
		private int <min>P;

		[CompilerGenerated]
		private int <max>P;

		private readonly int defVal;

		public AcceptableIntValue(int defVal, int min, int max)
		{
			<min>P = min;
			<max>P = max;
			this.defVal = ((defVal >= <min>P && defVal <= <max>P) ? defVal : <min>P);
			((AcceptableValueBase)this)..ctor(typeof(int));
		}

		public override object Clamp(object value)
		{
			return ((AcceptableValueBase)this).IsValid(value) ? ((int)value) : defVal;
		}

		public override bool IsValid(object value)
		{
			if (value.GetType() == ((AcceptableValueBase)this).ValueType && (int)value >= <min>P)
			{
				return (int)value <= <max>P;
			}
			return false;
		}

		public override string ToDescriptionString()
		{
			return null;
		}
	}
	public class AcceptableBoolValue : AcceptableValueBase
	{
		[CompilerGenerated]
		private bool <defVal>P;

		public AcceptableBoolValue(bool defVal)
		{
			<defVal>P = defVal;
			((AcceptableValueBase)this)..ctor(typeof(bool));
		}

		public override object Clamp(object value)
		{
			return ((AcceptableValueBase)this).IsValid(value) ? ((bool)value) : <defVal>P;
		}

		public override bool IsValid(object value)
		{
			return value.GetType() == ((AcceptableValueBase)this).ValueType;
		}

		public override string ToDescriptionString()
		{
			return null;
		}
	}
	public class AcceptableStringValue : AcceptableValueBase
	{
		[CompilerGenerated]
		private string <defVal>P;

		public AcceptableStringValue(string defVal)
		{
			<defVal>P = defVal;
			((AcceptableValueBase)this)..ctor(typeof(string));
		}

		public override object Clamp(object value)
		{
			if (!((AcceptableValueBase)this).IsValid(value))
			{
				return <defVal>P;
			}
			return (string)value;
		}

		public override bool IsValid(object value)
		{
			return value.GetType() == ((AcceptableValueBase)this).ValueType;
		}

		public override string ToDescriptionString()
		{
			return null;
		}
	}
	public static class AddProtoUtils
	{
		public static void AddItem(ItemProto item)
		{
			AddItem(new List<Proto>(1) { (Proto)(object)item });
		}

		public static void AddItem(List<Proto> itemList)
		{
			typeof(LDBTool).GetMethod("AddProtosToSet", AccessTools.all)?.MakeGenericMethod(typeof(ItemProto)).Invoke(null, new object[2]
			{
				LDB.items,
				itemList
			});
		}

		public static void AddRecipe(RecipeProto recipe)
		{
			AddRecipe(new List<RecipeProto>(1) { recipe });
		}

		public static void AddRecipe(List<RecipeProto> recipeList)
		{
			List<Proto> list = new List<Proto>();
			list.AddRange((IEnumerable<Proto>)recipeList);
			typeof(LDBTool).GetMethod("AddProtosToSet", AccessTools.all)?.MakeGenericMethod(typeof(RecipeProto)).Invoke(null, new object[2]
			{
				LDB.recipes,
				list
			});
		}

		public static void AddModel(ModelProto model)
		{
			AddModel(new List<Proto>(1) { (Proto)(object)model });
		}

		public static void AddModel(List<Proto> modelList)
		{
			typeof(LDBTool).GetMethod("AddProtosToSet", AccessTools.all)?.MakeGenericMethod(typeof(ModelProto)).Invoke(null, new object[2]
			{
				LDB.models,
				modelList
			});
		}

		public static void AddTech(TechProto tech)
		{
			AddTech(new List<Proto>(1) { (Proto)(object)tech });
		}

		public static void AddTech(List<Proto> techList)
		{
			typeof(LDBTool).GetMethod("AddProtosToSet", AccessTools.all)?.MakeGenericMethod(typeof(TechProto)).Invoke(null, new object[2]
			{
				LDB.techs,
				techList
			});
		}
	}
	public static class FormatUtils
	{
		public static string FormatP(this float value)
		{
			int i = 3;
			StringBuilder stringBuilder = new StringBuilder("0.###");
			for (; i < 10; i++)
			{
				if ((double)value * Math.Pow(10.0, i) >= 1.0)
				{
					return value.ToString(stringBuilder.Append("%").ToString());
				}
				stringBuilder.Append("#");
			}
			return "0%";
		}
	}
	public class RecipeHelper
	{
		private int currID = 1010;

		private readonly List<int> recipeIDList = new List<int>();

		public static int maxRowCount;

		public static int maxColumnCount;

		private int tab;

		private int row;

		private int column;

		private readonly int firstEmptyGridIndex;

		private Dictionary<RecipeProto, int> gridIndexDic = new Dictionary<RecipeProto, int>();

		public RecipeHelper(int firstPage)
		{
			RecipeProto[] dataArray = ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray;
			foreach (RecipeProto val in dataArray)
			{
				if (val != null && val.GridIndex > 0)
				{
					recipeIDList.Add(((Proto)val).ID);
				}
			}
			tab = firstPage + 1;
			row = 6;
			column = 7;
			firstEmptyGridIndex = tab * 1000 + row * 100 + column + 1;
			if (GenesisBook.Enable)
			{
				maxRowCount = 7;
				maxColumnCount = 17;
			}
			else
			{
				maxRowCount = 8;
				maxColumnCount = 14;
			}
			dataArray = ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray;
			foreach (RecipeProto val2 in dataArray)
			{
				if (val2 != null && val2.GridIndex > 0)
				{
					gridIndexDic.Add(val2, val2.GridIndex);
				}
			}
		}

		public int GetUnusedRecipeID()
		{
			while (((ProtoSet<RecipeProto>)(object)LDB.recipes).Select(currID) != null || recipeIDList.Contains(currID))
			{
				currID++;
			}
			recipeIDList.Add(currID);
			return currID;
		}

		public void ModifyGridIndex(RecipeProto r, int tab, int rowColumn)
		{
			ModifyGridIndex(r, tab * 1000 + rowColumn);
		}

		public void ModifyGridIndex(RecipeProto r, int gridIndex)
		{
			if (gridIndex == r.GridIndex)
			{
				return;
			}
			if (gridIndexDic.ContainsValue(gridIndex))
			{
				gridIndex = -1;
			}
			if (gridIndex <= 0)
			{
				column++;
				if (column > maxColumnCount)
				{
					column = 1;
					row++;
				}
				int num = tab * 1000 + row * 100 + column;
				if (row > maxRowCount)
				{
					FractionateEverything.LogWarning($"配方{((Proto)r).name}图标超出显示范围,当前GridIndex={num}");
				}
				gridIndexDic[r] = num;
				r.GridIndex = num;
				return;
			}
			if (gridIndexDic.ContainsKey(r))
			{
				int num2 = gridIndexDic[r];
				gridIndexDic.Remove(r);
				if (num2 / 1000 == tab && num2 >= firstEmptyGridIndex)
				{
					Dictionary<RecipeProto, int> dictionary = new Dictionary<RecipeProto, int>();
					foreach (KeyValuePair<RecipeProto, int> item in gridIndexDic)
					{
						if (item.Value / 1000 == tab && item.Value > num2)
						{
							int num3 = item.Value % 1000 / 100;
							if (item.Value % 1000 % 100 >= 2)
							{
								item.Key.GridIndex = item.Value - 1;
							}
							else
							{
								item.Key.GridIndex = tab * 1000 + (num3 - 1) * 100 + maxColumnCount;
							}
							dictionary.Add(item.Key, item.Key.GridIndex);
						}
						else
						{
							dictionary.Add(item.Key, item.Value);
						}
					}
					gridIndexDic = dictionary;
					column--;
					if (column <= 0)
					{
						row--;
						column = maxColumnCount;
					}
				}
			}
			gridIndexDic.Add(r, gridIndex);
			r.GridIndex = gridIndex;
		}
	}
	public static class ProtoID
	{
		internal const int I伊卡洛斯 = 0;

		internal const int I行星基地 = 1;

		internal const int I巨构星际组装厂 = 2;

		internal const int I铁矿 = 1001;

		internal const int I铜矿 = 1002;

		internal const int I硅石 = 1003;

		internal const int I钛石 = 1004;

		internal const int I石矿 = 1005;

		internal const int I煤矿 = 1006;

		internal const int I木材 = 1030;

		internal const int I植物燃料 = 1031;

		internal const int I可燃冰 = 1011;

		internal const int I金伯利矿石 = 1012;

		internal const int I分形硅石 = 1013;

		internal const int I光栅石 = 1014;

		internal const int I刺笋结晶 = 1015;

		internal const int I单极磁石 = 1016;

		internal const int I铁块 = 1101;

		internal const int I铜块 = 1104;

		internal const int I高纯硅块 = 1105;

		internal const int I钛块 = 1106;

		internal const int I石材 = 1108;

		internal const int I高能石墨 = 1109;

		internal const int I钢材 = 1103;

		internal const int I钛合金 = 1107;

		internal const int I玻璃 = 1110;

		internal const int I钛化玻璃 = 1119;

		internal const int I棱镜 = 1111;

		internal const int I金刚石 = 1112;

		internal const int I晶格硅 = 1113;

		internal const int I齿轮 = 1201;

		internal const int I磁铁 = 1102;

		internal const int I磁线圈_GB铜线圈 = 1202;

		internal const int I电动机 = 1203;

		internal const int I电磁涡轮 = 1204;

		internal const int I超级磁场环 = 1205;

		internal const int I粒子容器 = 1206;

		internal const int I奇异物质 = 1127;

		internal const int I电路板 = 1301;

		internal const int I处理器 = 1303;

		internal const int I量子芯片 = 1305;

		internal const int I微晶元件 = 1302;

		internal const int I位面过滤器 = 1304;

		internal const int I粒子宽带 = 1402;

		internal const int I电浆激发器 = 1401;

		internal const int I光子合并器 = 1404;

		internal const int I太阳帆 = 1501;

		internal const int I = 1000;

		internal const int I原油 = 1007;

		internal const int I精炼油_GB焦油 = 1114;

		internal const int I硫酸 = 1116;

		internal const int I = 1120;

		internal const int I重氢 = 1121;

		internal const int I反物质 = 1122;

		internal const int I临界光子 = 1208;

		internal const int I液氢燃料棒 = 1801;

		internal const int I氘核燃料棒 = 1802;

		internal const int I反物质燃料棒 = 1803;

		internal const int I奇异湮灭燃料棒 = 1804;

		internal const int I塑料_GB聚丙烯 = 1115;

		internal const int I石墨烯 = 1123;

		internal const int I碳纳米管 = 1124;

		internal const int I有机晶体 = 1117;

		internal const int I钛晶石 = 1118;

		internal const int I卡西米尔晶体 = 1126;

		internal const int I燃烧单元 = 1128;

		internal const int I爆破单元 = 1129;

		internal const int I晶石爆破单元 = 1130;

		internal const int I引力透镜 = 1209;

		internal const int I空间翘曲器 = 1210;

		internal const int I湮灭约束球 = 1403;

		internal const int I动力引擎 = 1407;

		internal const int I推进器 = 1405;

		internal const int I加力推进器 = 1406;

		internal const int I配送运输机 = 5003;

		internal const int I物流运输机 = 5001;

		internal const int I星际物流运输船 = 5002;

		internal const int I框架材料 = 1125;

		internal const int I戴森球组件 = 1502;

		internal const int I小型运载火箭 = 1503;

		internal const int I地基 = 1131;

		internal const int I增产剂MkI = 1141;

		internal const int I增产剂MkII = 1142;

		internal const int I增产剂MkIII_GB增产剂 = 1143;

		internal const int I机枪弹箱 = 1601;

		internal const int I钛化弹箱 = 1602;

		internal const int I超合金弹箱 = 1603;

		internal const int I炮弹组 = 1604;

		internal const int I高爆炮弹组 = 1605;

		internal const int I晶石炮弹组 = 1606;

		internal const int I等离子胶囊 = 1607;

		internal const int I反物质胶囊 = 1608;

		internal const int I导弹组 = 1609;

		internal const int I超音速导弹组 = 1610;

		internal const int I引力导弹组 = 1611;

		internal const int I干扰胶囊 = 1612;

		internal const int I压制胶囊 = 1613;

		internal const int I原型机 = 5101;

		internal const int I精准无人机 = 5102;

		internal const int I攻击无人机 = 5103;

		internal const int I护卫舰 = 5111;

		internal const int I驱逐舰 = 5112;

		internal const int I黑雾矩阵 = 5201;

		internal const int I硅基神经元 = 5202;

		internal const int I物质重组器 = 5203;

		internal const int I负熵奇点 = 5204;

		internal const int I核心素 = 5205;

		internal const int I能量碎片 = 5206;

		internal const int I传送带 = 2001;

		internal const int I高速传送带 = 2002;

		internal const int I极速传送带 = 2003;

		internal const int I分拣器 = 2011;

		internal const int I高速分拣器 = 2012;

		internal const int I极速分拣器 = 2013;

		internal const int I集装分拣器 = 2014;

		internal const int I四向分流器 = 2020;

		internal const int I自动集装机 = 2040;

		internal const int I流速监测器 = 2030;

		internal const int I喷涂机 = 2313;

		internal const int I物流配送器 = 2107;

		internal const int I小型储物仓 = 2101;

		internal const int I大型储物仓 = 2102;

		internal const int I储液罐 = 2106;

		internal const int I制造台MkI_GB基础制造台 = 2303;

		internal const int I制造台MkII_GB标准制造单元 = 2304;

		internal const int I制造台MkIII_GB高精度装配线 = 2305;

		internal const int I重组式制造台_GB物质重组工厂 = 2318;

		internal const int I电力感应塔 = 2201;

		internal const int I无线输电塔 = 2202;

		internal const int I卫星配电站 = 2212;

		internal const int I风力涡轮机 = 2203;

		internal const int I火力发电厂 = 2204;

		internal const int I微型聚变发电站_GB裂变能源发电站 = 2211;

		internal const int I地热发电站 = 2213;

		internal const int I采矿机 = 2301;

		internal const int I大型采矿机 = 2316;

		internal const int I抽水站 = 2306;

		internal const int I电弧熔炉 = 2302;

		internal const int I位面熔炉 = 2315;

		internal const int I负熵熔炉 = 2319;

		internal const int I原油萃取站 = 2307;

		internal const int I原油精炼厂 = 2308;

		internal const int I化工厂 = 2309;

		internal const int I量子化工厂_GB先进化学反应釜 = 2317;

		internal const int I分馏塔 = 2314;

		internal const int I太阳能板 = 2205;

		internal const int I蓄电器 = 2206;

		internal const int I蓄电器满 = 2207;

		internal const int I电磁轨道弹射器 = 2311;

		internal const int I射线接收站 = 2208;

		internal const int I垂直发射井 = 2312;

		internal const int I能量枢纽 = 2209;

		internal const int I微型粒子对撞机 = 2310;

		internal const int I人造恒星_GB人造恒星MKI = 2210;

		internal const int I行星内物流运输站 = 2103;

		internal const int I星际物流运输站 = 2104;

		internal const int I轨道采集器 = 2105;

		internal const int I矩阵研究站 = 2901;

		internal const int I自演化研究站 = 2902;

		internal const int I高斯机枪塔 = 3001;

		internal const int I高频激光塔_GB高频激光塔MKI = 3002;

		internal const int I聚爆加农炮_GB聚爆加农炮MKI = 3003;

		internal const int I磁化电浆炮 = 3004;

		internal const int I导弹防御塔 = 3005;

		internal const int I干扰塔 = 3006;

		internal const int I信号塔 = 3007;

		internal const int I行星护盾发生器 = 3008;

		internal const int I战场分析基站 = 3009;

		internal const int I近程电浆塔 = 3010;

		internal const int I电磁矩阵 = 6001;

		internal const int I能量矩阵 = 6002;

		internal const int I结构矩阵 = 6003;

		internal const int I信息矩阵 = 6004;

		internal const int I引力矩阵 = 6005;

		internal const int I宇宙矩阵 = 6006;

		internal const int I沙土 = 1099;

		internal const int IMS引力发生装置 = 9480;

		internal const int IMS位面约束环 = 9481;

		internal const int IMS引力钻头 = 9482;

		internal const int IMS隧穿激发装置 = 9483;

		internal const int IMS谐振盘 = 9484;

		internal const int IMS光子探针 = 9485;

		internal const int IMS量子计算机 = 9486;

		internal const int IMS星际组装厂组件 = 9487;

		internal const int IMS物质解压器运载火箭 = 9488;

		internal const int IMS科学枢纽运载火箭 = 9489;

		internal const int IMS谐振发射器运载火箭 = 9490;

		internal const int IMS星际组装厂运载火箭 = 9491;

		internal const int IMS晶体重构器运载火箭 = 9492;

		internal const int IMS多功能集成组件 = 9500;

		internal const int IMS力场发生器 = 9503;

		internal const int IMS复合态晶体 = 9504;

		internal const int IMS电磁力抑制器 = 9505;

		internal const int IMS胶子发生器 = 9506;

		internal const int IMS强力过载装置 = 9507;

		internal const int IMS导流框架 = 9508;

		internal const int IMS恒星炮组件 = 9509;

		internal const int IMS恒星炮运载火箭 = 9510;

		internal const int IVD水滴 = 9511;

		internal const int IMS铁金属重构装置 = 9493;

		internal const int IMS铜金属重构装置 = 9494;

		internal const int IMS高纯硅重构装置 = 9495;

		internal const int IMS钛金属重构装置 = 9496;

		internal const int IMS单极磁石重构装置 = 9497;

		internal const int IMS晶体接收器 = 9498;

		internal const int IMS组件集成装置 = 9499;

		internal const int IMS石墨提炼装置 = 9501;

		internal const int IMS光栅晶体接收器 = 9502;

		internal const int IMS物资交换物流站 = 9512;

		internal const int IVD水滴额外伤害 = 8035;

		internal const int IVD星河卫士勋章 = 9513;

		internal const int IGB钨矿 = 6201;

		internal const int IGB铝矿 = 6202;

		internal const int IGB铝块 = 6203;

		internal const int IGB铝合金 = 6204;

		internal const int IGB二氧化碳 = 6206;

		internal const int IGB硫矿 = 6207;

		internal const int IGB混凝土 = 6208;

		internal const int IGB四氢双环戊二烯JP10 = 6212;

		internal const int IGB四氢双环戊二烯燃料棒 = 6216;

		internal const int IGB煤油燃料棒 = 6217;

		internal const int IGB = 6220;

		internal const int IGB同位素温差发电机 = 6221;

		internal const int IGB放射性矿物 = 6222;

		internal const int IGB铀矿 = 6225;

		internal const int IGB钚矿 = 6226;

		internal const int IGB含铀核燃料 = 6227;

		internal const int IGB含钚核燃料 = 6228;

		internal const int IGB量子储液罐 = 6229;

		internal const int IGB矿物处理厂 = 6230;

		internal const int IGB量子储物仓 = 6231;

		internal const int IGB = 6234;

		internal const int IGB氦三 = 6235;

		internal const int IGB钚燃料棒 = 6241;

		internal const int IGB铀燃料棒 = 6242;

		internal const int IGBMOX燃料棒 = 6243;

		internal const int IGB氦三燃料棒 = 6244;

		internal const int IGB氘氦混合燃料棒 = 6245;

		internal const int IGB石粉 = 6251;

		internal const int IGB铁矿粉 = 6252;

		internal const int IGB铜矿粉 = 6253;

		internal const int IGB硅矿粉 = 6254;

		internal const int IGB钛矿粉 = 6255;

		internal const int IGB煤矿粉 = 6256;

		internal const int IGB天穹装配厂 = 6257;

		internal const int IGB物质裂解塔 = 6258;

		internal const int IGB埃克森美孚化工厂 = 6259;

		internal const int IGB工业先锋精密加工中心 = 6260;

		internal const int IGB人造恒星MKII = 6261;

		internal const int IGB氦闪约束器 = 6263;

		internal const int IGB物质分解设施 = 6264;

		internal const int IGB苍穹粒子加速器 = 6265;

		internal const int IGB聚束液体汲取设施 = 6266;

		internal const int IGB大气采集站 = 6267;

		internal const int IGB三元精金 = 6271;

		internal const int IGB铝矿粉 = 6273;

		internal const int IGB硫粉 = 6277;

		internal const int IGB通量矩阵 = 6278;

		internal const int IGB空间矩阵 = 6279;

		internal const int IGB宇宙矩阵粗坯 = 6280;

		internal const int IGB钨矿粉 = 6281;

		internal const int IGB基础机械组件 = 6501;

		internal const int IGB先进机械组件 = 6502;

		internal const int IGB尖端机械组件 = 6503;

		internal const int IGB超级机械组件 = 6504;

		internal const int IGB创世之书 = 6506;

		internal const int IGB虚空之书 = 6507;

		internal const int IGB起源之书 = 6508;

		internal const int IGB空燃料棒 = 6509;

		internal const int IGB开发者日志01 = 6511;

		internal const int IGB开发者日志02 = 6512;

		internal const int IGB开发者日志03 = 6513;

		internal const int IGB开发者日志04 = 6514;

		internal const int IGB开发者日志05 = 6515;

		internal const int IGB开发者日志06 = 6516;

		internal const int IGB开发者日志07 = 6517;

		internal const int IGB开发者日志08 = 6518;

		internal const int IGB开发者日志09 = 6519;

		internal const int IGB开发者日志10 = 6520;

		internal const int IGB开发者日志11 = 6521;

		internal const int IGB电力节约 = 6522;

		internal const int IGB上传扩容 = 6523;

		internal const int IGB燃料回收 = 6524;

		internal const int IGB风力扩容 = 6525;

		internal const int IGB光伏扩容 = 6526;

		internal const int IGB热聚增效 = 6527;

		internal const int IGB资源采掘 = 6528;

		internal const int IGB裂变增效 = 6529;

		internal const int IGB先进推进 = 6530;

		internal const int IGB特征向量模拟 = 6531;

		internal const int IGB中继信号干扰 = 6532;

		internal const int IGB神经元重编程 = 6533;

		internal const int IGB异常代码分析 = 6534;

		internal const int IGB = 7002;

		internal const int IGB = 7006;

		internal const int IGB丙烯 = 7009;

		internal const int IGB盐酸 = 7014;

		internal const int IGB三氯化铁 = 7015;

		internal const int IGB硝酸 = 7017;

		internal const int IGB海水 = 7018;

		internal const int IGB = 7019;

		internal const int IGB氢氧化钠 = 7020;

		internal const int IGB氯化钠 = 7101;

		internal const int IGB塑料基板 = 7501;

		internal const int IGB光学基板 = 7504;

		internal const int IGB钢芯弹箱 = 7607;

		internal const int IGB钨芯弹箱 = 7608;

		internal const int IGB三元弹箱 = 7609;

		internal const int IGB核子爆破单元 = 7610;

		internal const int IGB反物质湮灭单元 = 7611;

		internal const int IGB微型核弹组 = 7612;

		internal const int IGB反物质炮弹组 = 7613;

		internal const int IGB反物质导弹组 = 7615;

		internal const int IGB湮灭弹箱 = 7616;

		internal const int IGB聚爆加农炮MKII = 7617;

		internal const int IGB高频激光塔MKII = 7618;

		internal const int IGB钨块 = 7705;

		internal const int IGB钨强化玻璃 = 7706;

		internal const int IGB钨合金 = 7707;

		internal const int IGB聚苯硫醚PPS = 7708;

		internal const int IGB聚酰亚胺PI = 7709;

		internal const int IGB光学处理器 = 7803;

		internal const int IGB光学信息传输纤维 = 7804;

		internal const int IGB量子计算主机 = 7805;

		internal const int IGB超越X1型光学主机 = 7806;

		internal const int IFE自然资源分馏塔 = 2321;

		internal const int IFE升级分馏塔 = 2322;

		internal const int IFE降级分馏塔 = 2323;

		internal const int IFE垃圾回收分馏塔 = 2324;

		internal const int IFE点数聚集分馏塔 = 2325;

		internal const int IFE增产分馏塔 = 2326;

		internal const int M = 494;

		internal const int M燃烧单元 = 489;

		internal const int M爆破单元 = 490;

		internal const int M晶石爆破单元_GB反物质湮灭单元 = 491;

		internal const int M配送运输机 = 372;

		internal const int M物流运输机 = 47;

		internal const int M星际物流运输船 = 48;

		internal const int M小型运载火箭 = 75;

		internal const int M炮弹组 = 486;

		internal const int M高爆炮弹组 = 487;

		internal const int M晶石炮弹组_GB微型核弹组 = 488;

		internal const int M导弹组 = 432;

		internal const int M超音速导弹组 = 433;

		internal const int M引力导弹组 = 434;

		internal const int M干扰胶囊 = 492;

		internal const int M压制胶囊 = 493;

		internal const int M原型机 = 448;

		internal const int M精准无人机 = 449;

		internal const int M攻击无人机 = 450;

		internal const int M护卫舰 = 451;

		internal const int M驱逐舰 = 452;

		internal const int M传送带 = 35;

		internal const int M高速传送带 = 36;

		internal const int M极速传送带 = 37;

		internal const int M分拣器 = 41;

		internal const int M高速分拣器 = 42;

		internal const int M极速分拣器 = 43;

		internal const int M集装分拣器 = 483;

		internal const int M四向分流器 = 38;

		internal const int M自动集装机 = 257;

		internal const int M流速监测器 = 208;

		internal const int M喷涂机 = 120;

		internal const int M物流配送器 = 371;

		internal const int M小型储物仓 = 51;

		internal const int M大型储物仓 = 52;

		internal const int M储液罐 = 121;

		internal const int M制造台MkI_GB基础制造台 = 65;

		internal const int M制造台MkII_GB标准制造单元 = 66;

		internal const int M制造台MkIII_GB高精度装配线 = 67;

		internal const int M重组式制造台_GB物质重组工厂 = 456;

		internal const int M电力感应塔 = 44;

		internal const int M无线输电塔 = 71;

		internal const int M卫星配电站 = 68;

		internal const int M风力涡轮机 = 53;

		internal const int M火力发电厂 = 54;

		internal const int M微型聚变发电站_GB裂变能源发电站 = 118;

		internal const int M地热发电站 = 255;

		internal const int M采矿机 = 57;

		internal const int M大型采矿机 = 256;

		internal const int M抽水站 = 60;

		internal const int M电弧熔炉 = 62;

		internal const int M位面熔炉 = 194;

		internal const int M负熵熔炉 = 457;

		internal const int M原油萃取站 = 61;

		internal const int M原油精炼厂 = 63;

		internal const int M化工厂 = 64;

		internal const int M量子化工厂_GB先进化学反应釜 = 376;

		internal const int M分馏塔 = 119;

		internal const int M太阳能板 = 55;

		internal const int M蓄电器 = 46;

		internal const int M蓄电器满 = 46;

		internal const int M电磁轨道弹射器 = 72;

		internal const int M射线接收站 = 73;

		internal const int M垂直发射井 = 74;

		internal const int M能量枢纽 = 45;

		internal const int M微型粒子对撞机 = 69;

		internal const int M人造恒星_GB人造恒星MKI = 56;

		internal const int M行星内物流运输站 = 49;

		internal const int M星际物流运输站 = 50;

		internal const int M轨道采集器 = 117;

		internal const int M矩阵研究站 = 70;

		internal const int M自演化研究站 = 455;

		internal const int M高斯机枪塔 = 374;

		internal const int M高频激光塔_GB高频激光塔MKI = 373;

		internal const int M聚爆加农炮_GB聚爆加农炮MKI = 375;

		internal const int M磁化电浆炮 = 408;

		internal const int M导弹防御塔 = 407;

		internal const int M干扰塔 = 422;

		internal const int M信号塔 = 403;

		internal const int M行星护盾发生器 = 402;

		internal const int M战场分析基站 = 453;

		internal const int M近程电浆塔 = 482;

		internal const int MMS铁金属重构装置 = 73;

		internal const int MMS铜金属重构装置 = 73;

		internal const int MMS高纯硅重构装置 = 73;

		internal const int MMS钛金属重构装置 = 73;

		internal const int MMS单极磁石重构装置 = 73;

		internal const int MMS晶体接收器 = 73;

		internal const int MMS组件集成装置 = 73;

		internal const int MMS石墨提炼装置 = 73;

		internal const int MMS光栅晶体接收器 = 73;

		internal const int MMS物资交换物流站 = 50;

		internal const int MGB量子储液罐 = 801;

		internal const int MGB矿物处理厂 = 802;

		internal const int MGB天穹装配厂 = 803;

		internal const int MGB物质裂解塔 = 804;

		internal const int MGB埃克森美孚化工厂 = 805;

		internal const int MGB工业先锋精密加工中心 = 806;

		internal const int MGB人造恒星MKII = 807;

		internal const int MGB聚束液体汲取设施 = 808;

		internal const int MGB同位素温差发电机 = 809;

		internal const int MGB物质分解设施 = 810;

		internal const int MGB苍穹粒子加速器 = 811;

		internal const int MGB大气采集站 = 812;

		internal const int MGB反物质导弹组 = 813;

		internal const int MGB量子储物仓 = 814;

		internal const int MGB聚爆加农炮MKII = 815;

		internal const int MGB高频激光塔MKII = 816;

		internal const int MGB核子爆破单元 = 817;

		internal const int MGB反物质炮弹组 = 818;

		internal const int MFE自然资源分馏塔 = 531;

		internal const int MFE升级分馏塔 = 532;

		internal const int MFE降级分馏塔 = 533;

		internal const int MFE垃圾回收分馏塔 = 534;

		internal const int MFE点数聚集分馏塔 = 535;

		internal const int MFE增产分馏塔 = 536;

		internal const int R铁块 = 1;

		internal const int R磁铁_GB铜线圈 = 2;

		internal const int R铜块 = 3;

		internal const int R石材 = 4;

		internal const int R齿轮 = 5;

		internal const int R磁线圈_GB电路板 = 6;

		internal const int R风力涡轮机 = 7;

		internal const int R电力感应塔 = 8;

		internal const int R电磁矩阵 = 9;

		internal const int R矩阵研究站 = 10;

		internal const int R棱镜 = 11;

		internal const int R电浆激发器 = 12;

		internal const int R无线输电塔 = 13;

		internal const int R原油萃取站 = 14;

		internal const int R原油精炼厂 = 15;

		internal const int R等离子精炼 = 16;

		internal const int R高能石墨 = 17;

		internal const int R能量矩阵 = 18;

		internal const int R液氢燃料棒 = 19;

		internal const int R推进器 = 20;

		internal const int R加力推进器 = 21;

		internal const int R化工厂 = 22;

		internal const int R塑料_GB聚丙烯 = 23;

		internal const int R硫酸 = 24;

		internal const int R有机晶体_GB铝块 = 25;

		internal const int R钛晶石_GB铝合金 = 26;

		internal const int R结构矩阵 = 27;

		internal const int R卡西米尔晶体 = 28;

		internal const int R卡西米尔晶体高效 = 29;

		internal const int R钛化玻璃 = 30;

		internal const int R石墨烯 = 31;

		internal const int R石墨烯高效 = 32;

		internal const int R碳纳米管 = 33;

		internal const int R硅石_硅石筛选 = 34;

		internal const int R碳纳米管高效 = 35;

		internal const int R粒子宽带 = 36;

		internal const int R晶格硅 = 37;

		internal const int R位面过滤器 = 38;

		internal const int R微型粒子对撞机 = 39;

		internal const int R重氢 = 40;

		internal const int R氘核燃料棒 = 41;

		internal const int R湮灭约束球 = 42;

		internal const int R人造恒星_GB人造恒星MKI = 43;

		internal const int R反物质燃料棒 = 44;

		internal const int R制造台MkI_GB基础制造台 = 45;

		internal const int R制造台MkII_GB标准制造单元 = 46;

		internal const int R制造台MkIII_GB高精度装配线 = 47;

		internal const int R采矿机 = 48;

		internal const int R抽水站 = 49;

		internal const int R电路板_玻璃 = 50;

		internal const int R处理器 = 51;

		internal const int R量子芯片 = 52;

		internal const int R微晶元件 = 53;

		internal const int R有机晶体原始_GB埃克森美孚化工厂 = 54;

		internal const int R信息矩阵 = 55;

		internal const int R电弧熔炉 = 56;

		internal const int R玻璃_GB三元精金 = 57;

		internal const int RX射线裂解 = 58;

		internal const int R高纯硅块 = 59;

		internal const int R金刚石 = 60;

		internal const int R金刚石高效 = 61;

		internal const int R晶格硅高效 = 62;

		internal const int R钢材 = 63;

		internal const int R火力发电厂 = 64;

		internal const int R钛块 = 65;

		internal const int R钛合金 = 66;

		internal const int R太阳能板 = 67;

		internal const int R光子合并器 = 68;

		internal const int R光子合并器高效 = 69;

		internal const int R太阳帆 = 70;

		internal const int R电磁轨道弹射器 = 71;

		internal const int R射线接收站 = 72;

		internal const int R卫星配电站 = 73;

		internal const int R质能储存 = 74;

		internal const int R宇宙矩阵 = 75;

		internal const int R蓄电器 = 76;

		internal const int R能量枢纽 = 77;

		internal const int R空间翘曲器 = 78;

		internal const int R空间翘曲器高级 = 79;

		internal const int R框架材料 = 80;

		internal const int R戴森球组件 = 81;

		internal const int R垂直发射井 = 82;

		internal const int R小型运载火箭 = 83;

		internal const int R传送带 = 84;

		internal const int R分拣器 = 85;

		internal const int R小型储物仓 = 86;

		internal const int R四向分流器 = 87;

		internal const int R高速分拣器 = 88;

		internal const int R高速传送带 = 89;

		internal const int R极速分拣器 = 90;

		internal const int R大型储物仓 = 91;

		internal const int R极速传送带 = 92;

		internal const int R行星内物流运输站 = 93;

		internal const int R物流运输机 = 94;

		internal const int R星际物流运输站 = 95;

		internal const int R星际物流运输船 = 96;

		internal const int R电动机 = 97;

		internal const int R电磁涡轮 = 98;

		internal const int R粒子容器 = 99;

		internal const int R粒子容器高效 = 100;

		internal const int R引力透镜 = 101;

		internal const int R引力矩阵 = 102;

		internal const int R超级磁场环 = 103;

		internal const int R奇异物质 = 104;

		internal const int R增产剂MkI_GB氦三 = 106;

		internal const int R增产剂MkII_GB氦原子提取 = 107;

		internal const int R增产剂MkIII_GB增产剂 = 108;

		internal const int R喷涂机 = 109;

		internal const int R分馏塔_GB人造恒星MKII = 110;

		internal const int R轨道采集器 = 111;

		internal const int R地基 = 112;

		internal const int R微型聚变发电站_GB裂变能源发电站 = 113;

		internal const int R储液罐 = 114;

		internal const int R重氢分馏_GB氦闪约束器 = 115;

		internal const int R位面熔炉 = 116;

		internal const int R流速监测器 = 117;

		internal const int R地热发电站 = 118;

		internal const int R大型采矿机 = 119;

		internal const int R自动集装机 = 120;

		internal const int R重整精炼_GB铝矿粉 = 121;

		internal const int R物流配送器 = 122;

		internal const int R配送运输机 = 123;

		internal const int R量子化工厂_GB先进化学反应釜 = 124;

		internal const int R高斯机枪塔 = 125;

		internal const int R高频激光塔_GB高频激光塔MKI = 126;

		internal const int R聚爆加农炮_GB聚爆加农炮MKI = 127;

		internal const int R磁化电浆炮 = 128;

		internal const int R导弹防御塔 = 129;

		internal const int R干扰塔 = 130;

		internal const int R信号塔 = 131;

		internal const int R行星护盾发生器 = 132;

		internal const int R燃烧单元 = 133;

		internal const int R爆破单元 = 134;

		internal const int R晶石爆破单元_GB核子爆破单元 = 135;

		internal const int R机枪弹箱 = 136;

		internal const int R钛化弹箱 = 137;

		internal const int R超合金弹箱 = 138;

		internal const int R炮弹组 = 139;

		internal const int R高爆炮弹组 = 140;

		internal const int R晶石炮弹组_GB微型核弹组 = 141;

		internal const int R等离子胶囊 = 142;

		internal const int R反物质胶囊 = 143;

		internal const int R导弹组 = 144;

		internal const int R超音速导弹组 = 145;

		internal const int R引力导弹组 = 146;

		internal const int R原型机 = 147;

		internal const int R精准无人机 = 148;

		internal const int R攻击无人机 = 149;

		internal const int R护卫舰 = 150;

		internal const int R驱逐舰 = 151;

		internal const int R动力引擎 = 105;

		internal const int R战场分析基站 = 152;

		internal const int R自演化研究站 = 153;

		internal const int R重组式制造台_GB物质重组工厂 = 154;

		internal const int R负熵熔炉 = 155;

		internal const int R奇异湮灭燃料棒 = 156;

		internal const int R近程电浆塔 = 157;

		internal const int R干扰胶囊 = 158;

		internal const int R压制胶囊 = 159;

		internal const int R集装分拣器 = 160;

		internal const int RMS引力发生装置 = 530;

		internal const int RMS位面约束环 = 531;

		internal const int RMS引力钻头 = 532;

		internal const int RMS隧穿激发装置 = 533;

		internal const int RMS谐振盘 = 534;

		internal const int RMS光子探针 = 535;

		internal const int RMS量子计算机 = 536;

		internal const int RMS星际组装厂组件 = 537;

		internal const int RMS多功能集成组件 = 550;

		internal const int RMS物质解压器运载火箭 = 538;

		internal const int RMS科学枢纽运载火箭 = 539;

		internal const int RMS谐振发射器运载火箭 = 540;

		internal const int RMS星际组装厂运载火箭 = 541;

		internal const int RMS晶体重构器运载火箭 = 542;

		internal const int RMS力场发生器Recipe = 565;

		internal const int RMS复合态晶体Recipe = 566;

		internal const int RMS电磁力抑制器Recipe = 567;

		internal const int RMS胶子发生器Recipe = 568;

		internal const int RMS强力过载装置Recipe = 569;

		internal const int RMS导流框架Recipe = 570;

		internal const int RMS恒星炮组件Recipe = 571;

		internal const int RMS恒星炮运载火箭Recipe = 572;

		internal const int RMS水滴gmRecipe = 573;

		internal const int RMS制造台快速组装 = 554;

		internal const int RMS传送带快速组装 = 551;

		internal const int RMS化工厂快速组装 = 556;

		internal const int RMS对撞机快速组装 = 558;

		internal const int RMS星际物流快速组装 = 562;

		internal const int RMS研究站快速组装 = 559;

		internal const int RMS行星内物流快速组装 = 561;

		internal const int RMS配电站快速组装 = 553;

		internal const int RMS人造恒星快速组装 = 560;

		internal const int RMS精炼厂快速组装 = 557;

		internal const int RMS位面熔炉快速组装 = 555;

		internal const int RMS分拣器快速组装 = 552;

		internal const int RMS铁金属重构装置 = 543;

		internal const int RMS铜金属重构装置 = 544;

		internal const int RMS高纯硅重构装置 = 545;

		internal const int RMS钛金属重构装置 = 546;

		internal const int RMS单极磁石重构装置 = 547;

		internal const int RMS晶体接收器 = 548;

		internal const int RMS组件集成装置 = 549;

		internal const int RMS石墨提炼装置 = 563;

		internal const int RMS光栅晶体接收器 = 564;

		internal const int RMS物资交换物流站 = 575;

		internal const int RVD星河卫士奖章Recipe = 382;

		internal const int RGB放射性矿物处理 = 401;

		internal const int RGB铝矿精炼 = 402;

		internal const int RGB钨矿精炼 = 404;

		internal const int RGB钨矿粉 = 405;

		internal const int RGB含铀核燃料 = 406;

		internal const int RGB含钚核燃料 = 407;

		internal const int RGB铀燃料棒 = 408;

		internal const int RGB钚燃料棒 = 409;

		internal const int RGBMOX燃料棒 = 410;

		internal const int RGB铁矿精炼 = 411;

		internal const int RGB铜矿精炼 = 412;

		internal const int RGB硅矿精炼 = 413;

		internal const int RGB钛矿精炼 = 414;

		internal const int RGB混凝土 = 415;

		internal const int RGB天穹装配厂 = 416;

		internal const int RGB苍穹粒子加速器 = 417;

		internal const int RGB聚束液体汲取设施 = 418;

		internal const int RGB大气采集站 = 419;

		internal const int RGB石矿精炼 = 420;

		internal const int RGB煤矿精炼 = 421;

		internal const int RGB工业先锋精密加工中心 = 422;

		internal const int RGB物质分解设施 = 423;

		internal const int RGB物质回收 = 429;

		internal const int RGB焦油裂化 = 501;

		internal const int RGB二氧化碳 = 506;

		internal const int RGB催化重整 = 509;

		internal const int RGB四氢双环戊二烯JP10 = 512;

		internal const int RGB四氢双环戊二烯燃料棒 = 515;

		internal const int RGB煤油燃料棒 = 516;

		internal const int RGB处理器高效 = 519;

		internal const int RGB量子储液罐 = 522;

		internal const int RGB矿物处理厂 = 523;

		internal const int RGB量子储物仓 = 524;

		internal const int RGB铁矿粉 = 531;

		internal const int RGB铜矿粉 = 532;

		internal const int RGB硅矿粉 = 533;

		internal const int RGB钛矿粉 = 534;

		internal const int RGB石粉 = 535;

		internal const int RGB煤矿粉 = 536;

		internal const int RGB硫粉 = 537;

		internal const int RGB通量矩阵 = 539;

		internal const int RGB空间矩阵 = 540;

		internal const int RGB质能储存高效 = 541;

		internal const int RGB物质裂解塔 = 542;

		internal const int RGB宇宙矩阵粗坯 = 544;

		internal const int RGB活性纤维重组 = 550;

		internal const int RGB超越X1型光学主机 = 569;

		internal const int RGB氘氦混合燃料棒 = 624;

		internal const int RGB氦三燃料棒 = 625;

		internal const int RGB基础机械组件 = 641;

		internal const int RGB先进机械组件 = 642;

		internal const int RGB尖端机械组件 = 643;

		internal const int RGB空燃料棒 = 644;

		internal const int RGB水电解 = 702;

		internal const int RGB盐水电解 = 703;

		internal const int RGB钛晶石高效 = 709;

		internal const int RGB合成氨 = 710;

		internal const int RGB煤炭干馏 = 712;

		internal const int RGB焦油分馏 = 713;

		internal const int RGB钛晶石 = 714;

		internal const int RGB三氯化铁 = 716;

		internal const int RGB氨氧化 = 717;

		internal const int RGB羰基合成 = 720;

		internal const int RGB塑料基板 = 751;

		internal const int RGB同位素温差发电机 = 752;

		internal const int RGB光学基板 = 754;

		internal const int RGB聚苯硫醚PPS = 771;

		internal const int RGB聚酰亚胺PI = 772;

		internal const int RGB钨矿筛选 = 773;

		internal const int RGB钨块 = 774;

		internal const int RGB钨强化玻璃 = 775;

		internal const int RGB钨合金 = 776;

		internal const int RGB钢芯弹箱 = 781;

		internal const int RGB钨芯弹箱 = 782;

		internal const int RGB三元弹箱 = 783;

		internal const int RGB反物质湮灭单元 = 785;

		internal const int RGB反物质炮弹组 = 787;

		internal const int RGB反物质导弹组 = 789;

		internal const int RGB湮灭弹箱 = 790;

		internal const int RGB聚爆加农炮MKII = 791;

		internal const int RGB高频激光塔MKII = 792;

		internal const int RGB光学处理器 = 793;

		internal const int RGB光学信息传输纤维 = 794;

		internal const int RGB量子计算主机 = 795;

		internal const int RGB海水淡化 = 801;

		internal const int RFE自然资源分馏塔 = 1001;

		internal const int RFE升级分馏塔 = 1002;

		internal const int RFE降级分馏塔 = 1003;

		internal const int RFE垃圾回收分馏塔 = 1004;

		internal const int RFE点数聚集分馏塔 = 1005;

		internal const int RFE增产分馏塔 = 1006;

		internal const int T戴森球计划 = 1;

		internal const int T电磁学 = 1001;

		internal const int T电磁矩阵 = 1002;

		internal const int T高效电浆控制 = 1101;

		internal const int T等离子萃取精炼 = 1102;

		internal const int TX射线裂解 = 1103;

		internal const int T重整精炼_GB先进有机合成技术 = 1104;

		internal const int T能量矩阵 = 1111;

		internal const int T氢燃料棒_GB气体冷凝 = 1112;

		internal const int T推进器 = 1113;

		internal const int T加力推进器 = 1114;

		internal const int T流体储存封装 = 1120;

		internal const int T基础化工 = 1121;

		internal const int T高分子化工 = 1122;

		internal const int T高强度晶体 = 1123;

		internal const int T结构矩阵 = 1124;

		internal const int T卡西米尔晶体 = 1125;

		internal const int T高强度玻璃 = 1126;

		internal const int T应用型超导体 = 1131;

		internal const int T高强度材料 = 1132;

		internal const int T粒子可控 = 1133;

		internal const int T重氢分馏_GB强相互作用力材料 = 1134;

		internal const int T波函数干扰 = 1141;

		internal const int T微型粒子对撞机_GB粒子对撞机 = 1142;

		internal const int T奇异物质 = 1143;

		internal const int T人造恒星_质能转换利用 = 1144;

		internal const int T可控湮灭反应 = 1145;

		internal const int T增产剂MkI_GB物品增产 = 1151;

		internal const int T增产剂MkII_GB虫洞航行 = 1152;

		internal const int T增产剂MkIII_GB人造恒星MKI = 1153;

		internal const int T基础制造 = 1201;

		internal const int T高速制造_GB标准制造单元 = 1202;

		internal const int T量子打印_GB高精度加工 = 1203;

		internal const int T处理器 = 1302;

		internal const int T量子芯片 = 1303;

		internal const int T光子聚束采矿 = 1304;

		internal const int T亚微观量子纠缠_GB化学反应釜压力容器 = 1305;

		internal const int T半导体材料 = 1311;

		internal const int T信息矩阵 = 1312;

		internal const int T自动化冶金 = 1401;

		internal const int T冶炼提纯 = 1402;

		internal const int T晶体冶炼 = 1403;

		internal const int T钢材冶炼 = 1411;

		internal const int T火力发电 = 1412;

		internal const int T钛矿冶炼 = 1413;

		internal const int T高强度钛合金 = 1414;

		internal const int T移山填海工程_GB工业生产 = 1415;

		internal const int T微型核聚变发电_GB裂变发电站 = 1416;

		internal const int T位面冶金 = 1417;

		internal const int T太阳能收集 = 1501;

		internal const int T光子变频 = 1502;

		internal const int T太阳帆轨道系统 = 1503;

		internal const int T射线接收站 = 1504;

		internal const int T行星电离层利用 = 1505;

		internal const int T狄拉克逆变机制 = 1506;

		internal const int T宇宙矩阵 = 1507;

		internal const int T任务完成 = 1508;

		internal const int T能量储存 = 1511;

		internal const int T星际电力运输 = 1512;

		internal const int T地热开采 = 1513;

		internal const int T高强度轻质结构 = 1521;

		internal const int T垂直发射井 = 1522;

		internal const int T戴森球应力系统 = 1523;

		internal const int T基础物流系统 = 1601;

		internal const int T改良物流系统 = 1602;

		internal const int T高效物流系统 = 1603;

		internal const int T行星物流系统 = 1604;

		internal const int T星际物流系统 = 1605;

		internal const int T气态行星开采 = 1606;

		internal const int T集装物流系统_GB物品仓储 = 1607;

		internal const int T配送物流系统 = 1608;

		internal const int T电磁驱动 = 1701;

		internal const int T磁悬浮 = 1702;

		internal const int T粒子磁力阱 = 1703;

		internal const int T引力波折射 = 1704;

		internal const int T引力矩阵 = 1705;

		internal const int T超级磁场发生器 = 1711;

		internal const int T卫星配电系统 = 1712;

		internal const int T武器系统 = 1801;

		internal const int T燃烧单元 = 1802;

		internal const int T爆破单元 = 1803;

		internal const int T晶石爆破单元_GB核能爆破单元 = 1804;

		internal const int T动力引擎 = 1805;

		internal const int T导弹防御塔 = 1806;

		internal const int T聚爆加农炮 = 1807;

		internal const int T信号塔 = 1808;

		internal const int T行星防御系统 = 1809;

		internal const int T干扰塔 = 1810;

		internal const int T磁化电浆炮 = 1811;

		internal const int T钛化弹箱_GB钢芯穿甲弹 = 1812;

		internal const int T超合金弹箱_GB钛金强化弹壳 = 1813;

		internal const int T高爆炮弹组 = 1814;

		internal const int T超音速导弹组 = 1815;

		internal const int T晶石炮弹组_GB微型核弹 = 1816;

		internal const int T引力导弹组 = 1817;

		internal const int T反物质胶囊 = 1818;

		internal const int T原型机 = 1819;

		internal const int T精准无人机 = 1820;

		internal const int T攻击无人机 = 1821;

		internal const int T护卫舰 = 1822;

		internal const int T驱逐舰 = 1823;

		internal const int T压制胶囊 = 1824;

		internal const int T战场分析基站 = 1826;

		internal const int T数字模拟计算 = 1901;

		internal const int T物质重组 = 1902;

		internal const int T负熵递归 = 1903;

		internal const int T高密度可控湮灭 = 1904;

		internal const int T机甲核心 = 2101;

		internal const int T机械骨骼 = 2201;

		internal const int T机舱容量 = 2301;

		internal const int T通讯控制 = 2401;

		internal const int T能量回路 = 2501;

		internal const int T无人机引擎 = 2601;

		internal const int T批量建造 = 2701;

		internal const int T能量护盾 = 2801;

		internal const int T驱动引擎 = 2901;

		internal const int T自动标记重建 = 2951;

		internal const int T太阳帆寿命 = 3101;

		internal const int T射线传输效率 = 3201;

		internal const int T分拣器货物叠加 = 3301;

		internal const int T分拣器货物集装 = 3306;

		internal const int T集装分拣器改良 = 3311;

		internal const int T配送范围 = 4001;

		internal const int T运输船引擎 = 3401;

		internal const int T运输机舱扩容 = 3501;

		internal const int T运输站集装物流 = 3801;

		internal const int T矿物利用 = 3601;

		internal const int T垂直建造 = 3701;

		internal const int T研究速度 = 3901;

		internal const int T宇宙探索 = 4101;

		internal const int T动能武器伤害 = 5001;

		internal const int T能量武器伤害 = 5101;

		internal const int T爆破武器伤害 = 5201;

		internal const int T战斗无人机伤害 = 5301;

		internal const int T战斗无人机射速 = 5401;

		internal const int T战斗无人机耐久 = 5601;

		internal const int T行星护盾 = 5701;

		internal const int T地面编队扩容 = 5801;

		internal const int T太空编队扩容 = 5901;

		internal const int T结构强化 = 6001;

		internal const int TVD电磁武器效果 = 6101;

		internal const int TMS尼科尔戴森光束 = 1918;

		internal const int TVD玻色子操控 = 1999;

		internal const int TVD并入COSMO架构 = 1998;

		internal const int TGB科学理论 = 1900;

		internal const int TGB钨强化玻璃 = 1911;

		internal const int TGB焦油精炼 = 1915;

		internal const int TGB放射性矿物提炼 = 1916;

		internal const int TGB裂变能源燃料棒 = 1919;

		internal const int TGB同位素温差发电 = 1920;

		internal const int TGB聚变燃料提取 = 1921;

		internal const int TGB聚变能源燃料棒 = 1922;

		internal const int TGB巨型建筑天穹装配厂 = 1923;

		internal const int TGB巨型建筑物质裂解塔 = 1924;

		internal const int TGB巨型建筑行星级化学反应釜 = 1925;

		internal const int TGB巨型建筑精密结构组装厂 = 1926;

		internal const int TGB巨型建筑巨型粒子对撞机 = 1927;

		internal const int TGB化学能燃料棒 = 1928;

		internal const int TGB矿物处理 = 1929;

		internal const int TGB先进化工 = 1930;

		internal const int TGB巨型建筑物质分解设施 = 1931;

		internal const int TGB化工厂 = 1932;

		internal const int TGB巨型建筑工程学 = 1934;

		internal const int TGB行星协调中心 = 1936;

		internal const int TGB基础机械组件 = 1941;

		internal const int TGB先进机械组件 = 1942;

		internal const int TGB尖端机械组件 = 1943;

		internal const int TGB钨强化金属 = 1944;

		internal const int TGB家园世界虚拟技术革新 = 1947;

		internal const int TGB家园世界光学信息传输技术 = 1948;

		internal const int TGB超级量子计算机 = 1949;

		internal const int TGB家园世界光学计算机 = 1950;

		internal const int TGB反物质湮灭单元 = 1952;

		internal const int TGB湮灭战斗部 = 1954;

		internal const int TGB超重型穿甲弹 = 1955;

		internal const int TGB强互作用力弹药 = 1956;

		internal const int TGB小型化湮灭反应 = 1957;

		internal const int TGB反物质飞弹 = 1959;

		internal const int TGB行星协调中心黑雾数据库 = 1960;

		internal const int TGB虚数空间存储 = 1962;

		internal const int TGB集装物流系统 = 1963;

		internal const int TFE自然资源分馏 = 1621;

		internal const int TFE升降级分馏 = 1622;

		internal const int TFE垃圾回收 = 1623;

		internal const int TFE增产点数聚集 = 1159;

		internal const int TFE增产分馏 = 1908;

		internal const int TFE分馏流动输出集装 = 3807;

		internal const int TFE分馏产物输出集装 = 3804;

		internal const int TFE分馏永动 = 3808;
	}
	public static class TranslationUtils
	{
		private struct ModStr
		{
			public string key;

			public string enTrans;

			public string cnTrans;
		}

		private static readonly List<ModStr> modStringList = new List<ModStr>();

		public static string AddOrangeLabel(this string s)
		{
			return "<color=\"#FD965ECC\">" + s + "</color>";
		}

		public static string AddRedLabel(this string s)
		{
			return "<color=\"#FF5D4CB7\">" + s + "</color>";
		}

		public static string AddBlueLabel(this string s)
		{
			return "<color=\"#61D8FFB8\">" + s + "</color>";
		}

		public static void Register(string key, string enTrans, string cnTrans = null)
		{
			LocalizationModule.RegisterTranslation(key, enTrans, cnTrans ?? key, enTrans);
		}

		public static void Edit(string key, string enTrans, string cnTrans = null)
		{
			LocalizationModule.EditTranslation(key, enTrans, cnTrans ?? key, enTrans);
		}

		public static void RegisterOrEditAsync(string key, string enTrans, string cnTrans = null)
		{
			ModStr modStr = default(ModStr);
			modStr.key = key;
			modStr.enTrans = enTrans;
			modStr.cnTrans = cnTrans ?? key;
			ModStr item = modStr;
			foreach (ModStr modString in modStringList)
			{
				if (modString.key == key)
				{
					modStringList.Remove(modString);
					break;
				}
			}
			modStringList.Add(item);
		}

		public static void RegisterOrEditImmediately(string key, string enTrans, string cnTrans = null)
		{
			RegisterOrEditAsync(key, enTrans, cnTrans);
			LoadLanguagePostfixAfterCommonApi();
		}

		public static void LoadLanguagePostfixAfterCommonApi()
		{
			try
			{
				if (modStringList.Count == 0 || Localization.strings == null || Localization.CurrentLanguageIndex >= Localization.strings.Length || Localization.strings[Localization.CurrentLanguageIndex] == null || Localization.currentStrings == null || Localization.floats == null || Localization.CurrentLanguageIndex >= Localization.floats.Length || Localization.floats[Localization.CurrentLanguageIndex] == null || Localization.currentFloats == null)
				{
					return;
				}
				string[] array = Localization.strings[Localization.CurrentLanguageIndex];
				List<string> list = new List<string>(array.Length);
				list.AddRange(array);
				List<string> list2 = list;
				float[] array2 = Localization.floats[Localization.CurrentLanguageIndex];
				List<float> list3 = new List<float>(array2.Length);
				list3.AddRange(array2);
				List<float> list4 = list3;
				bool flag = Localization.CurrentLanguageLCID == 2052;
				foreach (ModStr modString in modStringList)
				{
					if (!Localization.namesIndexer.TryGetValue(modString.key, out var value))
					{
						value = Localization.namesIndexer.Count;
						Localization.namesIndexer.Add(modString.key, value);
					}
					while (list2.Count <= value)
					{
						list2.Add(Localization.namesIndexer.ElementAt(list2.Count).Key);
						list4.Add(0f);
					}
					list2[value] = (flag ? modString.cnTrans : modString.enTrans);
				}
				Localization.strings[Localization.CurrentLanguageIndex] = list2.ToArray();
				Localization.currentStrings = Localization.strings[Localization.CurrentLanguageIndex];
				Localization.floats[Localization.CurrentLanguageIndex] = list4.ToArray();
				Localization.currentFloats = Localization.floats[Localization.CurrentLanguageIndex];
				FractionateEverything.LogInfo($"Modify translations finish, currentStrings.len={Localization.currentStrings.Length}");
			}
			catch (Exception ex)
			{
				FractionateEverything.LogError("LoadLanguagePostfixAfterCommonApi Error: " + ex);
			}
		}
	}
}
namespace FractionateEverything.Main
{
	public static class FractionateRecipes
	{
		private static readonly Dictionary<int, float> defaultNumRatioCommonVein = new Dictionary<int, float> { { 2, 0.05f } };

		private static readonly Dictionary<int, float> defaultNumRatioRealVein = new Dictionary<int, float> { { 2, 0.025f } };

		private static readonly Dictionary<int, float> defaultNumRatioUpgrade = new Dictionary<int, float>
		{
			{ 1, 0.04f },
			{ -1, 0.01f }
		};

		private static readonly Dictionary<int, float> defaultNumRatioDowngrade = new Dictionary<int, float> { { 2, 0.02f } };

		private static readonly Dictionary<int, float> noResultDic = new Dictionary<int, float> { { 1, 0f } };

		private static readonly List<int> itemNaturalResourceList = new List<int>();

		private static readonly Dictionary<int, Dictionary<int, float>> numRatioNaturalResourceDic = new Dictionary<int, Dictionary<int, float>>();

		private static readonly Dictionary<int, int> itemUpgradeDic = new Dictionary<int, int>();

		private static readonly Dictionary<int, Dictionary<int, float>> numRatioUpgradeDic = new Dictionary<int, Dictionary<int, float>>();

		private static readonly Dictionary<int, int> itemDowngradeDic = new Dictionary<int, int>();

		private static readonly Dictionary<int, Dictionary<int, float>> numRatioDowngradeDic = new Dictionary<int, Dictionary<int, float>>();

		private static RecipeHelper helper;

		private static readonly List<RecipeProto> recipeList = new List<RecipeProto>();

		private static List<RecipeProto> fuelRodRecipeList = new List<RecipeProto>();

		private static List<RecipeProto> matrixRecipeList = new List<RecipeProto>();

		private static List<int> fuelRodGridIndexList = new List<int>();

		private static List<int> matrixGridIndexList = new List<int>();

		public static int GetItemNaturalResource(int itemID)
		{
			if (!itemNaturalResourceList.Contains(itemID))
			{
				return 0;
			}
			return itemID;
		}

		public static Dictionary<int, float> GetNumRatioNaturalResource(int itemID)
		{
			if (!numRatioNaturalResourceDic.TryGetValue(itemID, out var value))
			{
				return noResultDic;
			}
			return value;
		}

		public static int GetItemUpgrade(int itemID)
		{
			if (!itemUpgradeDic.TryGetValue(itemID, out var value))
			{
				return 0;
			}
			return value;
		}

		public static Dictionary<int, float> GetNumRatioUpgrade(int itemID)
		{
			if (!numRatioUpgradeDic.TryGetValue(itemID, out var value))
			{
				return noResultDic;
			}
			return value;
		}

		public static int GetItemDowngrade(int itemID)
		{
			if (!itemDowngradeDic.TryGetValue(itemID, out var value))
			{
				return 0;
			}
			return value;
		}

		public static Dictionary<int, float> GetNumRatioDowngrade(int itemID)
		{
			if (!numRatioDowngradeDic.TryGetValue(itemID, out var value))
			{
				return noResultDic;
			}
			return value;
		}

		public static void AddFracRecipes()
		{
			//IL_1272: Unknown result type (might be due to invalid IL or missing references)
			//IL_1278: Invalid comparison between Unknown and I4
			FractionateEverything.LogInfo("Begin to add fractionate recipes...");
			helper = new RecipeHelper(FractionateEverything.tab分馏1);
			if (!GenesisBook.Enable)
			{
				AddFracRecipe(1001, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 101);
				AddFracRecipe(1002, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 102);
				AddFracRecipe(1003, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 103, 1402);
				AddFracRecipe(1004, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 104, 1413);
				AddFracRecipe(1005, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 105);
				AddFracRecipe(1006, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 106);
				AddFracRecipe(1000, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 201, 1120);
				AddFracRecipe(1007, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 202, 1102);
				AddFracRecipe(1116, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 203);
				AddFracRecipe(1120, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 204);
				AddFracRecipe(1121, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 205);
				AddFracRecipe(1011, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 208, 1131);
				AddFracRecipe(1012, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 306, 1403);
				AddFracRecipe(1013, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 303, 1133);
				AddFracRecipe(1014, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 605, 1125);
				AddFracRecipe(1015, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 508, 1132);
				AddFracRecipe(1016, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 606, 1703);
				AddFracRecipe(1117, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 309, 1122);
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 5101, 5102, 5103 }));
				if (!TheyComeFromVoid.Enable)
				{
					AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 5111, 5112 }));
				}
				else
				{
					AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 5111, 5112, 9511 }))[1].Modify(MoreMegaStructure.tab巨构, 112);
				}
				List<RecipeProto> list = AddFracChain(new <>z__ReadOnlyArray<int>(new int[6] { 5206, 5201, 5203, 5202, 5204, 5205 }));
				list[0].Modify(FractionateEverything.tab分馏1, 807);
				list[1].Modify(FractionateEverything.tab分馏1, 808);
				list[2].Modify(FractionateEverything.tab分馏1, 809);
				list[3].Modify(FractionateEverything.tab分馏1, 810);
				list[4].Modify(FractionateEverything.tab分馏1, 811);
				matrixRecipeList = AddFracChain(new <>z__ReadOnlyArray<int>(new int[5] { 6001, 6002, 6003, 6004, 6005 }));
				matrixGridIndexList = matrixRecipeList.Select((RecipeProto r) => r.GridIndex).ToList();
				foreach (RecipeProto matrixRecipe in matrixRecipeList)
				{
					matrixRecipe.ModifyIconAndDesc();
				}
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 1141, 1142, 1143 }));
				if (!MoreMegaStructure.Enable)
				{
					AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 2107, 2103, 2104, 2105 }));
				}
				else
				{
					AddFracChain(new <>z__ReadOnlyArray<int>(new int[5] { 2107, 2103, 2104, 9512, 2105 }))[2].Modify(MoreMegaStructure.tab巨构, 410);
				}
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 5003, 5001, 5002 }));
				fuelRodRecipeList = AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 1801, 1802, 1803, 1804 }));
				fuelRodGridIndexList = fuelRodRecipeList.Select((RecipeProto r) => r.GridIndex).ToList();
				foreach (RecipeProto fuelRodRecipe in fuelRodRecipeList)
				{
					fuelRodRecipe.ModifyIconAndDesc();
				}
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 1601, 1602, 1603 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 1604, 1605, 1606 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 1609, 1610, 1611 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 1607, 1608 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 1612, 1613 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 2201, 2202, 2212 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[5] { 2203, 2205, 2206, 2207, 2209 }))[2].Modify(FractionateEverything.tab分馏2, 113);
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 2204, 2213, 2211, 2210 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 2001, 2002, 2003 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 2030, 2020, 2313, 2040 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 2101, 2106, 2102 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 2011, 2012, 2013, 2014 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 2301, 2316 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 2306, 2307, 2308 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 2309, 2317 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 2314, 2310 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 2302, 2315, 2319 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 2303, 2304, 2305, 2318 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 2901, 2902 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 2311, 2208, 2312 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 3001, 3005, 3003 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 3002, 3004, 3010 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 3009, 3007, 3006, 3008 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[6] { 2321, 2322, 2323, 2324, 2325, 2326 }));
			}
			else
			{
				TranslationUtils.RegisterOrEditAsync("左键点击:更换生产设备", "Left click: Change machine\nRight click: Assembler or Fractionator", "左键点击:更换生产设备\n右键点击:常规设备或分馏塔");
				AddFracRecipe(1001, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 101);
				AddFracRecipe(1002, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 102);
				AddFracRecipe(6202, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 103);
				AddFracRecipe(1003, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 104, 1402);
				AddFracRecipe(1004, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 105, 1413);
				AddFracRecipe(6201, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 106, 1413);
				AddFracRecipe(1006, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 107, 1402);
				AddFracRecipe(1005, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 108);
				AddFracRecipe(6207, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 109, 1929);
				AddFracRecipe(1000, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 201);
				AddFracRecipe(1007, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 202, 1915);
				AddFracRecipe(1116, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 203);
				AddFracRecipe(7002, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 204);
				AddFracRecipe(1120, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 205);
				AddFracRecipe(1121, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 206, 1142);
				AddFracRecipe(6234, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 207);
				AddFracRecipe(6220, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 208, 1112);
				AddFracRecipe(7019, defaultNumRatioCommonVein).Modify(FractionateEverything.tab分馏1, 209);
				AddFracRecipe(6222, defaultNumRatioCommonVein).Modify(GenesisBook.tab精炼, 302, 1916);
				AddFracRecipe(6225, defaultNumRatioCommonVein).Modify(GenesisBook.tab精炼, 305, 1916);
				AddFracRecipe(6226, defaultNumRatioCommonVein).Modify(GenesisBook.tab精炼, 306, 1916);
				AddFracRecipe(1012, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 504, 1403);
				AddFracRecipe(1013, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 505, 1133);
				AddFracRecipe(1011, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 506, 1131);
				AddFracRecipe(1015, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 507, 1132);
				AddFracRecipe(1117, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 508, 1122);
				AddFracRecipe(1014, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 510, 1125);
				AddFracRecipe(1016, defaultNumRatioRealVein).Modify(FractionateEverything.tab分馏1, 511, 1703);
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 5003, 5001, 5002 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[6] { 5206, 5201, 5203, 5202, 5204, 5205 })).Modify(GenesisBook.tab防御, 317, addColumn: false);
				matrixRecipeList = AddFracChain(new <>z__ReadOnlyArray<int>(new int[5] { 6001, 6002, 6003, 6004, 6005 }));
				matrixGridIndexList = matrixRecipeList.Select((RecipeProto r) => r.GridIndex).ToList();
				foreach (RecipeProto matrixRecipe2 in matrixRecipeList)
				{
					matrixRecipe2.ModifyIconAndDesc();
				}
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 2201, 2202, 2212 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[6] { 2203, 2205, 6221, 2206, 2207, 2209 }))[3].Modify(FractionateEverything.tab分馏2, 114);
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[5] { 2204, 2213, 2211, 2210, 6261 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 2001, 2002, 2003 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[5] { 2020, 2030, 6267, 2313, 2040 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 2101, 2102, 6231 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 2106, 6229 }));
				if (!MoreMegaStructure.Enable)
				{
					AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 2107, 2103, 2104, 2105 }));
				}
				else
				{
					AddFracChain(new <>z__ReadOnlyArray<int>(new int[5] { 2107, 2103, 2104, 9512, 2105 }))[2].Modify(MoreMegaStructure.tab巨构, 410);
				}
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 2011, 2012, 2013, 2014 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 2301, 2316 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 2306, 6266 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 2307, 2308 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 2309, 2317 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 2302, 6230, 2315, 2319 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 2303, 2304, 2305, 2318 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 2901, 2902 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 2311, 2208, 2312 }));
				AddFracChain(new <>z__ReadOnlySingleElementList<int>(2310));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[6] { 6258, 6257, 6259, 6264, 6260, 6265 }));
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[6] { 2321, 2322, 2323, 2324, 2325, 2326 }));
				fuelRodRecipeList = AddFracChain(new <>z__ReadOnlyArray<int>(new int[12]
				{
					6509, 1801, 6217, 6216, 6242, 6241, 6243, 1802, 6244, 6245,
					1803, 1804
				})).Modify(GenesisBook.tab精炼, 601);
				fuelRodGridIndexList = fuelRodRecipeList.Select((RecipeProto r) => r.GridIndex).ToList();
				foreach (RecipeProto fuelRodRecipe2 in fuelRodRecipeList)
				{
					fuelRodRecipe2.ModifyIconAndDesc();
				}
				AddFracChain(new <>z__ReadOnlySingleElementList<int>(1143)).Modify(GenesisBook.tab化工, 506);
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 5101, 5102, 5103 })).Modify(GenesisBook.tab防御, 202);
				if (!TheyComeFromVoid.Enable)
				{
					AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 5111, 5112 })).Modify(GenesisBook.tab防御, 205);
				}
				else
				{
					List<RecipeProto> list2 = AddFracChain(new <>z__ReadOnlyArray<int>(new int[3] { 5111, 5112, 9511 }));
					list2[0].Modify(GenesisBook.tab防御, 205);
					list2[1].Modify(MoreMegaStructure.tab巨构, 112);
				}
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 3002, 7618, 3010, 3004 })).Modify(GenesisBook.tab防御, 207);
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 3009, 3007, 3006, 3008 })).Modify(GenesisBook.tab防御, 211);
				AddFracChain(new <>z__ReadOnlySingleElementList<int>(3001)).Modify(GenesisBook.tab防御, 302);
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[6] { 1601, 7607, 1603, 7608, 7609, 7616 })).Modify(GenesisBook.tab防御, 309);
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 1128, 1129, 7610, 7611 })).Modify(GenesisBook.tab防御, 409);
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 3003, 7617 })).Modify(GenesisBook.tab防御, 502, addColumn: false);
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 1604, 1605, 7612, 7613 })).Modify(GenesisBook.tab防御, 509);
				AddFracChain(new <>z__ReadOnlySingleElementList<int>(3005)).Modify(GenesisBook.tab防御, 602);
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[4] { 1609, 1610, 1611, 7615 })).Modify(GenesisBook.tab防御, 609);
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 1612, 1613 })).Modify(GenesisBook.tab防御, 709);
				AddFracChain(new <>z__ReadOnlyArray<int>(new int[2] { 1607, 1608 })).Modify(GenesisBook.tab防御, 711);
			}
			TranslationUtils.LoadLanguagePostfixAfterCommonApi();
			AddProtoUtils.AddRecipe(recipeList);
			for (int i = 0; i < ((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray.Length; i++)
			{
				if ((int)((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray[i].Type == 8)
				{
					((ProtoSet<RecipeProto>)(object)LDB.recipes).dataArray[i].Preload(i);
				}
			}
			FractionateEverything.LogInfo("Finish to add fractionate recipes.");
		}

		private static RecipeProto AddFracRecipe(int itemID, Dictionary<int, float> fracNumRatioDic)
		{
			return AddFracRecipe(itemID, itemID, fracNumRatioDic, null);
		}

		private static List<RecipeProto> AddFracChain(IReadOnlyList<int> itemChain)
		{
			if (itemChain.Count == 1)
			{
				int stackSize = ((ProtoSet<ItemProto>)(object)LDB.items).Select(itemChain[0]).StackSize;
				Dictionary<int, float> dictionary = new Dictionary<int, float>(defaultNumRatioDowngrade);
				dictionary[2] *= 1f / 160f * (float)stackSize;
				Dictionary<int, float> dictionary2 = new Dictionary<int, float>(defaultNumRatioDowngrade);
				dictionary2[2] *= 1f / 160f * (float)stackSize;
				return new List<RecipeProto>(1) { AddFracRecipe(itemChain[0], itemChain[0], dictionary, dictionary2) };
			}
			List<RecipeProto> list = new List<RecipeProto>();
			for (int i = 0; i < itemChain.Count - 1; i++)
			{
				int stackSize2 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(itemChain[i + 1]).StackSize;
				Dictionary<int, float> dictionary3 = new Dictionary<int, float>(defaultNumRatioUpgrade);
				dictionary3[1] *= 0.0125f * (float)stackSize2;
				int stackSize3 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(itemChain[i]).StackSize;
				Dictionary<int, float> dictionary4 = new Dictionary<int, float>(defaultNumRatioDowngrade);
				dictionary4[2] *= 0.0125f * (float)stackSize3;
				list.Add(AddFracRecipe(itemChain[i], itemChain[i + 1], dictionary3, dictionary4));
			}
			return list;
		}

		private static RecipeProto AddFracRecipe(int inputItemID, int outputItemID, Dictionary<int, float> ratioUpgrade, Dictionary<int, float> ratioDowngrade)
		{
			//IL_07ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_07d5: Expected O, but got Unknown
			//IL_07d8: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				int unusedRecipeID = helper.GetUnusedRecipeID();
				ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(inputItemID);
				ItemProto val2 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(outputItemID);
				string text = ((Proto)val).Name + "-" + ((Proto)val2).Name + "分馏";
				string key = "R" + ((Proto)val).Name + "-" + ((Proto)val2).Name + "分馏";
				string key2 = "R" + ((Proto)val).Name + "-" + ((Proto)val2).Name + "损毁分馏";
				if (ratioDowngrade == null)
				{
					TranslationUtils.RegisterOrEditAsync(text, ((Proto)val2).name + " Fractionation", ((Proto)val2).name + "分馏");
					string text2 = "Fractionate " + ((Proto)val).name + " into multiple.";
					string text3 = "将" + ((Proto)val).name + "分馏为多个。";
					foreach (KeyValuePair<int, float> item in ratioUpgrade.Where((KeyValuePair<int, float> p) => p.Key > 0))
					{
						text2 = text2 + "\n" + item.Value.FormatP().AddOrangeLabel() + " fractionate " + item.Key.ToString().AddOrangeLabel() + " product" + ((item.Key > 1) ? "s" : "");
						text3 = text3 + "\n" + item.Value.FormatP().AddOrangeLabel() + "分馏出" + item.Key.ToString().AddOrangeLabel() + "个产物";
					}
					TranslationUtils.RegisterOrEditAsync(key, text2, text3);
					TranslationUtils.RegisterOrEditAsync(key2, text2, text3);
				}
				else
				{
					TranslationUtils.RegisterOrEditAsync(text, ((Proto)val).name + "-" + ((Proto)val2).name + " Fractionation", ((Proto)val).name + "-" + ((Proto)val2).name + "分馏");
					string text4 = "Fractionate " + ((Proto)val).name + " upgrade to " + ((Proto)val2).name + ".";
					string text5 = "将" + ((Proto)val).name + "升级分馏为" + ((Proto)val2).name + "。";
					foreach (KeyValuePair<int, float> item2 in ratioUpgrade.Where((KeyValuePair<int, float> p) => p.Key > 0))
					{
						text4 = text4 + "\n" + item2.Value.FormatP().AddOrangeLabel() + " fractionate " + item2.Key.ToString().AddOrangeLabel() + " product" + ((item2.Key > 1) ? "s" : "");
						text5 = text5 + "\n" + item2.Value.FormatP().AddOrangeLabel() + "分馏出" + item2.Key.ToString().AddOrangeLabel() + "个产物";
					}
					string text6 = text4;
					string text7 = text5;
					if (ratioUpgrade.TryGetValue(-1, out var value))
					{
						text6 = text6 + "\n" + "WARNING:".AddRedLabel() + " There is a probability of " + value.FormatP().AddRedLabel() + " that an input item will be destroyed at each fractionation!";
						text7 = text7 + "\n" + "警告:".AddOrangeLabel() + "每次分馏时,有" + value.FormatP().AddRedLabel() + "概率导致原料损毁!";
					}
					text4 = text4 + "\n————————————————\nFractionate " + ((Proto)val2).name + " downgrade to " + ((Proto)val).name + ".";
					text5 = text5 + "\n————————————————\n将" + ((Proto)val2).name + "降级分馏为" + ((Proto)val).name + "。";
					text6 = text6 + "\n————————————————\nFractionate " + ((Proto)val2).name + " downgrade to " + ((Proto)val).name + ".";
					text7 = text7 + "\n————————————————\n将" + ((Proto)val2).name + "降级分馏为" + ((Proto)val).name + "。";
					foreach (KeyValuePair<int, float> item3 in ratioDowngrade.Where((KeyValuePair<int, float> p) => p.Key > 0))
					{
						text4 = text4 + "\n" + item3.Value.FormatP().AddOrangeLabel() + " fractionate " + item3.Key.ToString().AddOrangeLabel() + " product" + ((item3.Key > 1) ? "s" : "");
						text5 = text5 + "\n" + item3.Value.FormatP().AddOrangeLabel() + "分馏出" + item3.Key.ToString().AddOrangeLabel() + "个产物";
						text6 = text6 + "\n" + item3.Value.FormatP().AddOrangeLabel() + " fractionate " + item3.Key.ToString().AddOrangeLabel() + " product" + ((item3.Key > 1) ? "s" : "");
						text7 = text7 + "\n" + item3.Value.FormatP().AddOrangeLabel() + "分馏出" + item3.Key.ToString().AddOrangeLabel() + "个产物";
					}
					TranslationUtils.RegisterOrEditAsync(key, text4, text5);
					TranslationUtils.RegisterOrEditAsync(key2, text6, text7);
				}
				int gridIndex = ((val2.recipes.Count != 0) ? (val2.recipes[0].GridIndex + (FractionateEverything.tab分馏1 - 1) * 1000) : 0);
				TechProto val3 = val2.preTech;
				if (val3 == null)
				{
					val3 = ((ProtoSet<TechProto>)(object)LDB.techs).Select(1);
				}
				RecipeProto val4 = new RecipeProto();
				val4.Type = (ERecipeType)8;
				((Proto)val4).ID = unusedRecipeID;
				((Proto)val4).SID = "";
				val4.Handcraft = false;
				val4.Explicit = true;
				val4.TimeSpend = 60;
				val4.Items = new int[1] { inputItemID };
				val4.ItemCounts = new int[1] { 100 };
				val4.Results = new int[1] { outputItemID };
				val4.ResultCounts = new int[1] { 1 };
				((Proto)val4).Name = text;
				val4.GridIndex = gridIndex;
				val4.preTech = val3;
				RecipeProto val5 = val4;
				val5.ModifyIconAndDesc();
				helper.ModifyGridIndex(val5, gridIndex);
				recipeList.Add(val5);
				val2.recipes.Add(val5);
				if (ratioDowngrade == null)
				{
					itemNaturalResourceList.Add(inputItemID);
					numRatioNaturalResourceDic.Add(inputItemID, ratioUpgrade);
				}
				else
				{
					itemUpgradeDic.Add(inputItemID, outputItemID);
					numRatioUpgradeDic.Add(inputItemID, ratioUpgrade);
					itemDowngradeDic.Add(outputItemID, inputItemID);
					numRatioDowngradeDic.Add(outputItemID, ratioDowngrade);
				}
				return val5;
			}
			catch (Exception ex)
			{
				FractionateEverything.LogError(ex.ToString());
				return null;
			}
		}

		private static List<RecipeProto> Modify(this List<RecipeProto> recipes, int tab, int rowColumn, bool addColumn = true)
		{
			List<ItemProto> list = recipes.Select((RecipeProto r) => ((ProtoSet<ItemProto>)(object)LDB.items).Select(r.Results[0])).ToList();
			list.Sort((ItemProto i1, ItemProto i2) => i1.GridIndex.CompareTo(i2.GridIndex));
			foreach (RecipeProto recipe in recipes)
			{
				int num = list.IndexOf(((ProtoSet<ItemProto>)(object)LDB.items).Select(recipe.Results[0]));
				helper.ModifyGridIndex(recipe, tab, rowColumn + (addColumn ? num : (num * 100)));
			}
			return recipes;
		}

		private static RecipeProto Modify(this RecipeProto r, int tab, int rowColumn, int techID = 0)
		{
			helper.ModifyGridIndex(r, tab, rowColumn);
			TechProto preTech;
			if ((preTech = ((ProtoSet<TechProto>)(object)LDB.techs).Select(techID)) != null)
			{
				r.preTech = preTech;
			}
			return r;
		}

		public static RecipeProto ModifyIconAndDesc(this RecipeProto r)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Invalid comparison between Unknown and I4
			try
			{
				if ((int)r.Type != 8)
				{
					return r;
				}
				ItemProto val = ((ProtoSet<ItemProto>)(object)LDB.items).Select(r.Items[0]);
				string text = null;
				if ((Object)(object)val.iconSprite != (Object)null)
				{
					text = ((Object)val.iconSprite).name;
				}
				else if (val.IconPath != null && val.IconPath.Contains("/"))
				{
					text = val.IconPath.Substring(val.IconPath.LastIndexOf("/") + 1);
				}
				ItemProto val2 = ((ProtoSet<ItemProto>)(object)LDB.items).Select(r.Results[0]);
				string text2 = null;
				if ((Object)(object)val2.iconSprite != (Object)null)
				{
					text2 = ((Object)val2.iconSprite).name;
				}
				else if (val2.IconPath != null && val2.IconPath.Contains("/"))
				{
					text2 = val2.IconPath.Substring(val2.IconPath.LastIndexOf("/") + 1);
				}
				r.Description = "R" + ((Proto)val).Name + "-" + ((Proto)val2).Name + (FractionateEverything.enableDestroy ? "损毁分馏" : "分馏");
				if (text != null && text2 != null)
				{
					string text3 = $"Assets/fracicons/{text}-{text2}-formula-v{FractionateEverything.iconVersion}";
					r.IconPath = (((Object)(object)Resources.Load<Sprite>(text3) != (Object)null) ? text3 : val2.IconPath);
				}
				else
				{
					r.IconPath = "";
				}
				if (fuelRodRecipeList.Contains(r))
				{
					if (FractionateEverything.enableFuelRodFrac)
					{
						r.GridIndex = fuelRodGridIndexList[fuelRodRecipeList.IndexOf(r)];
						if (!itemUpgradeDic.ContainsKey(r.Items[0]))
						{
							itemUpgradeDic.Add(r.Items[0], r.Results[0]);
						}
						if (!numRatioUpgradeDic.ContainsKey(r.Items[0]))
						{
							numRatioUpgradeDic.Add(r.Items[0], defaultNumRatioUpgrade);
						}
						if (!itemDowngradeDic.ContainsKey(r.Results[0]))
						{
							itemDowngradeDic.Add(r.Results[0], r.Items[0]);
						}
						if (!numRatioDowngradeDic.ContainsKey(r.Results[0]))
						{
							numRatioDowngradeDic.Add(r.Results[0], defaultNumRatioDowngrade);
						}
					}
					else
					{
						r.GridIndex = 0;
						if (itemUpgradeDic.ContainsKey(r.Items[0]))
						{
							itemUpgradeDic.Remove(r.Items[0]);
						}
						if (numRatioUpgradeDic.ContainsKey(r.Items[0]))
						{
							numRatioUpgradeDic.Remove(r.Items[0]);
						}
						if (itemDowngradeDic.ContainsKey(r.Results[0]))
						{
							itemDowngradeDic.Remove(r.Results[0]);
						}
						if (numRatioDowngradeDic.ContainsKey(r.Results[0]))
						{
							numRatioDowngradeDic.Remove(r.Results[0]);
						}
					}
				}
				if (matrixRecipeList.Contains(r))
				{
					if (FractionateEverything.enableMatrixFrac)
					{
						r.GridIndex = matrixGridIndexList[matrixRecipeList.IndexOf(r)];
						if (!itemUpgradeDic.ContainsKey(r.Items[0]))
						{
							itemUpgradeDic.Add(r.Items[0], r.Results[0]);
						}
						if (!numRatioUpgradeDic.ContainsKey(r.Items[0]))
						{
							numRatioUpgradeDic.Add(r.Items[0], defaultNumRatioUpgrade);
						}
						if (!itemDowngradeDic.ContainsKey(r.Results[0]))
						{
							itemDowngradeDic.Add(r.Results[0], r.Items[0]);
						}
						if (!numRatioDowngradeDic.ContainsKey(r.Results[0]))
						{
							numRatioDowngradeDic.Add(r.Results[0], defaultNumRatioDowngrade);
						}
					}
					else
					{
						r.GridIndex = 0;
						if (itemUpgradeDic.ContainsKey(r.Items[0]))
						{
							itemUpgradeDic.Remove(r.Items[0]);
						}
						if (numRatioUpgradeDic.ContainsKey(r.Items[0]))
						{
							numRatioUpgradeDic.Remove(r.Items[0]);
						}
						if (itemDowngradeDic.ContainsKey(r.Results[0]))
						{
							itemDowngradeDic.Remove(r.Results[0]);
						}
						if (numRatioDowngradeDic.ContainsKey(r.Results[0]))
						{
							numRatioDowngradeDic.Remove(r.Results[0]);
						}
					}
				}
				return r;
			}
			catch (Exception ex)
			{
				FractionateEverything.LogError("ModifyIconAndDesc " + ((Proto)r).Name + " error: " + ex);
				return r;
			}
		}
	}
	internal struct BuildingInfo
	{
		public int recipeID;

		public int itemID;
	}
	public static class FractionatorBuildings
	{
		private static readonly ModelProto FractionatorModel = ((ProtoSet<ModelProto>)(object)LDB.models).Select(119);

		public static readonly PrefabDesc FractionatorPrefabDesc = FractionatorModel.prefabDesc;

		private static readonly List<BuildingInfo> buildingInfoList = new List<BuildingInfo>();

		public static void CreateAndPreAddNewFractionators()
		{
			//IL_009a: 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_01d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
			//IL_039a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0422: Unknown result type (might be due to invalid IL or missing references)
			//IL_042e: Unknown result type (might be due to invalid IL or miss