Decompiled source of RecipeBook v1.0.0

config/RecipeBook.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EquinoxsModUtils;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RecipeBook")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RecipeBook")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("98abb3c9-7deb-4c5f-ab01-516a5100cbed")]
[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 RecipeBook;

[BepInPlugin("com.equinox.RecipeBook", "RecipeBook", "1.0.0")]
public class RecipeBookPlugin : BaseUnityPlugin
{
	private const string MyGUID = "com.equinox.RecipeBook";

	private const string PluginName = "RecipeBook";

	private const string VersionString = "1.0.0";

	private static readonly Harmony Harmony = new Harmony("com.equinox.RecipeBook");

	public static ManualLogSource Log = new ManualLogSource("RecipeBook");

	public static ConfigEntry<bool> filterUnknown;

	private static Texture2D buttonBackground;

	private static Texture2D buttonHoverBackground;

	private static Texture2D textBoxNormal;

	private static Texture2D textBoxHover;

	private static Texture2D windowBackground;

	private static Texture2D checkboxUnticked;

	private static Texture2D checkboxTicked;

	private static Texture2D oneIngredient;

	private static Texture2D twoIngredients;

	private static Texture2D threeIngredients;

	private static Texture2D thresherRecipe;

	private Vector2 scrollPosition = Vector2.zero;

	private Vector2 recipesScrollPosition = Vector2.zero;

	private string searchTerm = "";

	private bool useMk2 = false;

	private float timeSinceOpen = 0f;

	private bool trackTime = false;

	private bool lastCheck = false;

	private bool showRecipesGUI = false;

	private bool showUsesGUI = false;

	private string targetItemForRecipes = "";

	private string targetItemForUses = "";

	public static float windowYOffset = 25f;

	public static float windowWidth = 380f;

	public static float windowHeight = 625f;

	public static float windowX => ((float)Screen.width - windowWidth) / 2f;

	public static float windowY => ((float)Screen.height - windowHeight) / 2f - windowYOffset;

	private void Awake()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: RecipeBook, VersionString: 1.0.0 is loading...");
		Harmony.PatchAll();
		filterUnknown = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Filter Unknown", true, new ConfigDescription("Whether to hide items and recipes you have not discovered yet.", (AcceptableValueBase)null, Array.Empty<object>()));
		LoadImages();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: RecipeBook, VersionString: 1.0.0 is loaded.");
		Log = ((BaseUnityPlugin)this).Logger;
	}

	private void OnGUI()
	{
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: 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_00c6: Expected O, but got Unknown
		//IL_0108: 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_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: 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_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_0273: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: Expected O, but got Unknown
		//IL_02df: Unknown result type (might be due to invalid IL or missing references)
		//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Expected O, but got Unknown
		//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0325: Unknown result type (might be due to invalid IL or missing references)
		//IL_0331: Unknown result type (might be due to invalid IL or missing references)
		//IL_0341: Expected O, but got Unknown
		//IL_033c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)UIManager.instance == (Object)null || !HandleShouldShowGUI())
		{
			return;
		}
		if (UnityInput.Current.GetKey((KeyCode)27))
		{
			((CarouselMenu)UIManager.instance.inventoryCraftingMenu).Close(true);
			return;
		}
		if (!showRecipesGUI && !showUsesGUI)
		{
			GUI.FocusControl("SearchBar");
		}
		InputHandler.instance.uiInputBlocked = true;
		HideHorizontalScrollBar();
		DrawSearchBar();
		GUIStyle val = new GUIStyle(GUI.skin.button);
		val.normal.background = buttonBackground;
		val.hover.background = buttonHoverBackground;
		GUIStyle val2 = val;
		int i;
		for (i = ResourceNames.SafeResources.Count; i % 5 != 0; i++)
		{
		}
		i *= 12;
		scrollPosition = GUI.BeginScrollView(new Rect((float)(Screen.width - 320), 40f, 320f, (float)(Screen.height - 70)), scrollPosition, new Rect((float)(Screen.width - 320), 20f, 300f, (float)i), false, false);
		List<string> list = ResourceNames.SafeResources.Where((string name) => name.ToLower().Contains(searchTerm.ToLower())).ToList();
		if (filterUnknown.Value)
		{
			list = list.Where((string name) => TechTreeState.instance.IsResourceKnown(ModUtils.GetResourceIDByName(name, false))).ToList();
		}
		for (int j = 0; j < list.Count; j++)
		{
			Rect buttonRect = GetButtonRect(j);
			if (GUI.Button(buttonRect, (Texture)(object)GetImageForResource(list[j]), val2))
			{
				HandleResourceButtonClicked(list[j]);
			}
		}
		GUI.EndScrollView();
		if (UnityInput.Current.GetKey((KeyCode)27) || InputHandler.instance.input.GetButtonDown(45))
		{
			showRecipesGUI = false;
		}
		GUIStyle val3 = new GUIStyle(GUI.skin.window);
		val3.normal.background = windowBackground;
		val3.hover.background = windowBackground;
		val3.focused.background = windowBackground;
		val3.active.background = windowBackground;
		val3.onNormal.background = windowBackground;
		val3.onHover.background = windowBackground;
		val3.onFocused.background = windowBackground;
		val3.onActive.background = windowBackground;
		GUIStyle val4 = val3;
		if (showRecipesGUI)
		{
			GUI.Window(0, new Rect(windowX, windowY - windowYOffset, windowWidth, windowHeight), new WindowFunction(DrawRecipesWindowContent), "", val4);
		}
		else if (showUsesGUI)
		{
			GUI.Window(1, new Rect(windowX, windowY - windowYOffset, windowWidth, windowHeight), new WindowFunction(DrawUsesWindowContent), "", val4);
		}
	}

	private void LoadImages()
	{
		LoadImage("RecipeBook.Images.ButtonBackground.png", ref buttonBackground);
		LoadImage("RecipeBook.Images.ButtonHoverBackground.png", ref buttonHoverBackground);
		LoadImage("RecipeBook.Images.TextBoxNormal.png", ref textBoxNormal);
		LoadImage("RecipeBook.Images.TextBoxHover.png", ref textBoxHover);
		LoadImage("RecipeBook.Images.WindowBackground.png", ref windowBackground);
		LoadImage("RecipeBook.Images.CheckboxUnTicked.png", ref checkboxUnticked);
		LoadImage("RecipeBook.Images.CheckboxTicked.png", ref checkboxTicked);
		LoadImage("RecipeBook.Images.OneIngredient.png", ref oneIngredient);
		LoadImage("RecipeBook.Images.TwoIngredients.png", ref twoIngredients);
		LoadImage("RecipeBook.Images.ThreeIngredients.png", ref threeIngredients);
		LoadImage("RecipeBook.Images.ThresherRecipe.png", ref thresherRecipe);
	}

	private void LoadImage(string path, ref Texture2D output)
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Expected O, but got Unknown
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		using Stream stream = executingAssembly.GetManifestResourceStream(path);
		if (stream == null)
		{
			Debug.LogError((object)"Could not find button background image");
			return;
		}
		using MemoryStream memoryStream = new MemoryStream();
		stream.CopyTo(memoryStream);
		byte[] array = memoryStream.ToArray();
		output = new Texture2D(2, 2);
		ImageConversion.LoadImage(output, array);
	}

	private bool HandleShouldShowGUI()
	{
		if (!lastCheck && UIManager.instance.inventoryCraftingMenuOpen)
		{
			timeSinceOpen = 0f;
			trackTime = true;
			searchTerm = "";
		}
		if (trackTime)
		{
			timeSinceOpen += Time.deltaTime;
		}
		if (timeSinceOpen > 0.5f && (InputHandler.instance.input.GetButtonDown(45) || UnityInput.Current.GetKey((KeyCode)27)))
		{
			InputHandler.instance.uiInputBlocked = false;
			((CarouselMenu)UIManager.instance.inventoryCraftingMenu).Close(true);
			trackTime = false;
			timeSinceOpen = 0f;
		}
		lastCheck = UIManager.instance.inventoryCraftingMenuOpen;
		if (!lastCheck)
		{
			showRecipesGUI = false;
			showUsesGUI = false;
		}
		return lastCheck;
	}

	private void HideHorizontalScrollBar()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		GUIStyle val = new GUIStyle(GUI.skin.horizontalScrollbar);
		float fixedHeight = (val.fixedWidth = 0f);
		val.fixedHeight = fixedHeight;
	}

	private void DrawSearchBar()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: 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_0099: Expected O, but got Unknown
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Expected O, but got Unknown
		//IL_0121: 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)
		GUIStyle val = new GUIStyle(GUI.skin.textField);
		val.normal.textColor = Color.yellow;
		val.normal.background = textBoxNormal;
		val.hover.textColor = Color.yellow;
		val.hover.background = textBoxHover;
		val.active.textColor = Color.yellow;
		val.active.background = textBoxNormal;
		val.focused.textColor = Color.yellow;
		val.focused.background = textBoxNormal;
		GUIStyle val2 = val;
		GUIStyle val3 = new GUIStyle(GUI.skin.label);
		val3.normal.textColor = Color.gray;
		GUIStyle val4 = val3;
		if (searchTerm == "")
		{
			GUI.Label(new Rect((float)(Screen.width - 300), 10f, 290f, 20f), "Search...", val4);
		}
		GUI.SetNextControlName("SearchBar");
		searchTerm = GUI.TextField(new Rect((float)(Screen.width - 310), 10f, 300f, 20f), searchTerm, val2);
	}

	private Rect GetButtonRect(int index)
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		float num = Screen.width - 310;
		float num2 = 20f;
		float num3 = index % 5 * 60;
		float num4 = Mathf.FloorToInt((float)index / 5f) * 60;
		return new Rect(num + num3, num2 + num4, 50f, 50f);
	}

	private Texture2D GetImageForResource(string name)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Expected O, but got Unknown
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		ResourceInfo resourceInfoByName = ModUtils.GetResourceInfoByName(name, false);
		Sprite sprite = resourceInfoByName.sprite;
		Rect val = sprite.rect;
		if (((Rect)(ref val)).width != (float)((Texture)sprite.texture).width)
		{
			val = sprite.rect;
			int num = (int)((Rect)(ref val)).width;
			val = sprite.rect;
			Texture2D val2 = new Texture2D(num, (int)((Rect)(ref val)).height);
			Texture2D texture = sprite.texture;
			val = sprite.textureRect;
			int num2 = (int)((Rect)(ref val)).x;
			val = sprite.textureRect;
			int num3 = (int)((Rect)(ref val)).y;
			val = sprite.textureRect;
			int num4 = (int)((Rect)(ref val)).width;
			val = sprite.textureRect;
			Color[] pixels = texture.GetPixels(num2, num3, num4, (int)((Rect)(ref val)).height);
			val2.SetPixels(pixels);
			val2.Apply();
			return val2;
		}
		return sprite.texture;
	}

	private void HandleResourceButtonClicked(string name)
	{
		GUI.FocusControl("WindowTitle");
		if (!UnityInput.Current.GetKey((KeyCode)304))
		{
			showRecipesGUI = true;
			showUsesGUI = false;
			targetItemForRecipes = name;
			targetItemForUses = "";
		}
		else
		{
			showRecipesGUI = false;
			showUsesGUI = true;
			targetItemForRecipes = "";
			targetItemForUses = name;
		}
	}

	private void DrawRecipesWindowContent(int windowID)
	{
		DrawWindow();
		ResourceInfo targetItem = ModUtils.GetResourceInfoByName(targetItemForRecipes, false);
		List<SchematicsRecipeData> list = GameDefines.instance.schematicsRecipeEntries.Where((SchematicsRecipeData recipe) => recipe.outputTypes.Contains(targetItem)).ToList();
		if (filterUnknown.Value)
		{
			list = list.Where((SchematicsRecipeData recipe) => TechTreeState.instance.IsRecipeKnown(recipe)).ToList();
		}
		DrawRecipes(list);
	}

	private void DrawUsesWindowContent(int windowID)
	{
		DrawWindow();
		ResourceInfo targetItem = ModUtils.GetResourceInfoByName(targetItemForUses, false);
		List<SchematicsRecipeData> list = GameDefines.instance.schematicsRecipeEntries.Where((SchematicsRecipeData recipe) => recipe.ingTypes.Contains(targetItem)).ToList();
		if (filterUnknown.Value)
		{
			list = list.Where((SchematicsRecipeData recipe) => TechTreeState.instance.IsRecipeKnown(recipe)).ToList();
		}
		DrawRecipes(list);
	}

	private void DrawWindow()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Expected O, but got Unknown
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		GUIStyle val = new GUIStyle(GUI.skin.box)
		{
			fontSize = 18,
			alignment = (TextAnchor)4
		};
		val.normal.textColor = Color.yellow;
		val.normal.background = null;
		GUIStyle val2 = val;
		string text = (string.IsNullOrEmpty(targetItemForRecipes) ? ("Uses For " + targetItemForUses) : ("Recipes For " + targetItemForRecipes));
		GUI.Label(new Rect(0f, 0f, windowWidth, 40f), text, val2);
	}

	private void DrawRecipes(List<SchematicsRecipeData> recipes)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Expected O, but got Unknown
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: 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_00de: 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_0106: 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_0146: 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_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Expected O, but got Unknown
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0235: Unknown result type (might be due to invalid IL or missing references)
		//IL_023a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0243: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_026e: Expected O, but got Unknown
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_028a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
		if (recipes.Count == 0)
		{
			GUIStyle val = new GUIStyle(GUI.skin.box)
			{
				fontSize = 18,
				alignment = (TextAnchor)4
			};
			val.normal.textColor = Color.yellow;
			val.normal.background = null;
			GUIStyle val2 = val;
			GUI.Label(new Rect(0f, 40f, windowWidth, 40f), "No recipes found...", val2);
			return;
		}
		int num = 50;
		int num2 = 0;
		foreach (SchematicsRecipeData recipe in recipes)
		{
			Texture2D panelForRecipe = GetPanelForRecipe(recipe);
			num2 += ((Texture)panelForRecipe).height + 10;
		}
		GUIStyle val3 = new GUIStyle(GUI.skin.toggle)
		{
			fontSize = 16,
			alignment = (TextAnchor)3
		};
		val3.normal.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.hover.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.active.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.focused.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.onNormal.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.onHover.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.onActive.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.onFocused.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		GUIStyle val4 = val3;
		useMk2 = GUI.Toggle(new Rect(10f, 45f, 40f, 40f), useMk2, "", val4);
		Rect val5 = new Rect(60f, 45f, 316f, 40f);
		GUIStyle val6 = new GUIStyle
		{
			fontSize = 16,
			alignment = (TextAnchor)3
		};
		val6.normal.background = null;
		val6.normal.textColor = Color.yellow;
		GUI.Label(val5, "Use MkII Machines", val6);
		recipesScrollPosition = GUI.BeginScrollView(new Rect(0f, 90f, 366f, 530f), recipesScrollPosition, new Rect(0f, 50f, 340f, (float)num2), false, true);
		foreach (SchematicsRecipeData recipe2 in recipes)
		{
			Texture2D panelForRecipe2 = GetPanelForRecipe(recipe2);
			int height = ((Texture)panelForRecipe2).height;
			DrawPanelForRecipe(panelForRecipe2, num, recipe2);
			num += height + 10;
		}
		GUI.EndScrollView();
	}

	private Texture2D GetPanelForRecipe(SchematicsRecipeData recipe)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: 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_0028: Expected I4, but got Unknown
		CraftingMethod craftingMethod = recipe.craftingMethod;
		CraftingMethod val = craftingMethod;
		switch ((int)val)
		{
		case 2:
			return oneIngredient;
		case 4:
			return oneIngredient;
		case 5:
			return oneIngredient;
		case 3:
			switch (recipe.outputTypes.Count())
			{
			case 1:
				return oneIngredient;
			case 2:
				return thresherRecipe;
			}
			break;
		case 0:
			switch (recipe.ingTypes.Count())
			{
			case 1:
				return oneIngredient;
			case 2:
				return twoIngredients;
			case 3:
				return threeIngredients;
			}
			break;
		}
		return null;
	}

	private void DrawPanelForRecipe(Texture2D panel, int height, SchematicsRecipeData recipe)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Expected O, but got Unknown
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Expected O, but got Unknown
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: 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_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Expected O, but got Unknown
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Expected O, but got Unknown
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_043b: Unknown result type (might be due to invalid IL or missing references)
		//IL_046c: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0502: Unknown result type (might be due to invalid IL or missing references)
		//IL_0533: Unknown result type (might be due to invalid IL or missing references)
		GUIStyle val = new GUIStyle(GUI.skin.box);
		val.normal.background = panel;
		GUIStyle val2 = val;
		GUI.Box(new Rect(7f, (float)height, 340f, (float)((Texture)panel).height), "", val2);
		GUIStyle val3 = new GUIStyle(GUI.skin.label)
		{
			fontSize = 18,
			alignment = (TextAnchor)4
		};
		val3.normal.textColor = Color.white;
		val3.normal.background = null;
		GUIStyle val4 = val3;
		GUI.Label(new Rect(7f, (float)height, 340f, 40f), "Made in: " + Enum.GetName(typeof(CraftingMethod), recipe.craftingMethod), val4);
		GUIStyle val5 = new GUIStyle(GUI.skin.button);
		val5.normal.background = buttonBackground;
		val5.hover.background = buttonHoverBackground;
		val5.focused.background = buttonHoverBackground;
		val5.active.background = buttonHoverBackground;
		GUIStyle val6 = val5;
		GUIStyle val7 = new GUIStyle(GUI.skin.label)
		{
			fontSize = 16,
			fontStyle = (FontStyle)1,
			alignment = (TextAnchor)8
		};
		val7.normal.background = null;
		val7.normal.textColor = Color.yellow;
		GUIStyle val8 = val7;
		GUIStyle val9 = new GUIStyle(GUI.skin.label)
		{
			fontSize = 15,
			alignment = (TextAnchor)7
		};
		val9.normal.background = null;
		val9.normal.textColor = Color.yellow;
		GUIStyle val10 = val9;
		if (GUI.Button(new Rect(12f, (float)(height + 70), 50f, 50f), (Texture)(object)GetImageForResource(recipe.ingTypes[0].displayName), val6))
		{
			HandleResourceButtonClicked(recipe.ingTypes[0].displayName);
		}
		GUI.Label(new Rect(10f, (float)(height + 72), 50f, 50f), recipe.ingQuantities[0].ToString(), val8);
		GUI.Label(new Rect(-15f, (float)(height + 20), 100f, 50f), GetRateStringForItem(recipe, 0, isIng: true), val10);
		if (recipe.ingTypes.Count() > 1)
		{
			if (GUI.Button(new Rect(12f, (float)(height + 140), 50f, 50f), (Texture)(object)GetImageForResource(recipe.ingTypes[1].displayName), val6))
			{
				HandleResourceButtonClicked(recipe.ingTypes[1].displayName);
			}
			GUI.Label(new Rect(10f, (float)(height + 142), 50f, 50f), recipe.ingQuantities[1].ToString(), val8);
			GUI.Label(new Rect(-15f, (float)(height + 90), 100f, 50f), GetRateStringForItem(recipe, 1, isIng: true), val10);
		}
		if (recipe.ingTypes.Count() > 2)
		{
			if (GUI.Button(new Rect(12f, (float)(height + 210), 50f, 50f), (Texture)(object)GetImageForResource(recipe.ingTypes[2].displayName), val6))
			{
				HandleResourceButtonClicked(recipe.ingTypes[2].displayName);
			}
			GUI.Label(new Rect(10f, (float)(height + 212), 50f, 50f), recipe.ingQuantities[2].ToString(), val8);
			GUI.Label(new Rect(-15f, (float)(height + 160), 100f, 50f), GetRateStringForItem(recipe, 2, isIng: true), val10);
		}
		if (GUI.Button(new Rect(292f, (float)(height + 70), 50f, 50f), (Texture)(object)GetImageForResource(recipe.outputTypes[0].displayName), val6))
		{
			HandleResourceButtonClicked(recipe.outputTypes[0].displayName);
		}
		GUI.Label(new Rect(290f, (float)(height + 72), 50f, 50f), recipe.outputQuantities[0].ToString(), val8);
		GUI.Label(new Rect(267f, (float)(height + 20), 100f, 50f), GetRateStringForItem(recipe, 0, isIng: false), val10);
		if (recipe.outputTypes.Count() > 1)
		{
			if (GUI.Button(new Rect(292f, (float)(height + 140), 50f, 50f), (Texture)(object)GetImageForResource(recipe.outputTypes[1].displayName), val6))
			{
				HandleResourceButtonClicked(recipe.outputTypes[1].displayName);
			}
			GUI.Label(new Rect(290f, (float)(height + 142), 50f, 50f), recipe.outputQuantities[1].ToString(), val8);
			GUI.Label(new Rect(267f, (float)(height + 90), 100f, 50f), GetRateStringForItem(recipe, 1, isIng: false), val10);
		}
	}

	private string GetRateStringForItem(SchematicsRecipeData recipe, int index, bool isIng)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Expected I4, but got Unknown
		float num = 1f;
		CraftingMethod craftingMethod = recipe.craftingMethod;
		CraftingMethod val = craftingMethod;
		switch ((int)val)
		{
		case 0:
			num = (useMk2 ? 0.5f : 0.25f);
			if (isIng)
			{
				return $"{(float)recipe.ingQuantities[index] * AssemblerInstance.assemblerSpeedMultiplier * num / recipe.duration * 60f}/m";
			}
			return $"{(float)recipe.outputQuantities[index] * AssemblerInstance.assemblerSpeedMultiplier * num / recipe.duration * 120f}/m";
		case 2:
			num = (useMk2 ? 8f : 1f);
			if (isIng)
			{
				return $"{(float)recipe.ingQuantities[index] * SmelterInstance.smelterSpeedMultiplier * num / recipe.duration * 60f}/m";
			}
			return $"{(float)recipe.outputQuantities[index] * SmelterInstance.smelterSpeedMultiplier * num / recipe.duration * 60f}/m";
		case 4:
		{
			float num2 = 1f;
			if (TechTreeState.instance.IsUnlockActive(((UniqueIdScriptableObject)ModUtils.GetUnlockByName("BSM-MultiBlast II", false)).uniqueId))
			{
				num2 = 4f;
			}
			if (TechTreeState.instance.IsUnlockActive(((UniqueIdScriptableObject)ModUtils.GetUnlockByName("BSM-MultiBlast III", false)).uniqueId))
			{
				num2 = 6f;
			}
			if (TechTreeState.instance.IsUnlockActive(((UniqueIdScriptableObject)ModUtils.GetUnlockByName("BSM-MultiBlast IV", false)).uniqueId))
			{
				num2 = 8f;
			}
			if (TechTreeState.instance.IsUnlockActive(((UniqueIdScriptableObject)ModUtils.GetUnlockByName("BSM-MultiBlast V", false)).uniqueId))
			{
				num2 = 10f;
			}
			if (isIng)
			{
				return $"<={num2 * (float)recipe.ingQuantities[index] * 5f}/m";
			}
			return $"<={num2 * (float)recipe.outputQuantities[index] * 5f}/m";
		}
		case 3:
			num = (useMk2 ? 2f : 1f);
			if (isIng)
			{
				return $"{(float)recipe.ingQuantities[index] * ThresherInstance.thresherSpeedMultiplier * num / recipe.duration * 60f}/m";
			}
			return $"{(float)recipe.outputQuantities[index] * ThresherInstance.thresherSpeedMultiplier * num / recipe.duration * 60f}/m";
		case 5:
			if (IsUsingPlanterCoreClusters())
			{
				return "2/m";
			}
			return "2/m";
		default:
			return "?/m";
		}
	}

	private bool IsUsingPlanterCoreClusters()
	{
		string text = AppDomain.CurrentDomain.BaseDirectory + "BepInEx/plugins";
		Debug.Log((object)text);
		string[] files = Directory.GetFiles(text);
		string[] array = files;
		foreach (string text2 in array)
		{
			if (text2.Contains("PlanterCoreClusters"))
			{
				return true;
			}
		}
		return false;
	}
}

plugins/RecipeBook/RecipeBook.dll

Decompiled 2 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using EquinoxsModUtils;
using HarmonyLib;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("RecipeBook")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("RecipeBook")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("98abb3c9-7deb-4c5f-ab01-516a5100cbed")]
[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 RecipeBook;

[BepInPlugin("com.equinox.RecipeBook", "RecipeBook", "1.0.0")]
public class RecipeBookPlugin : BaseUnityPlugin
{
	private const string MyGUID = "com.equinox.RecipeBook";

	private const string PluginName = "RecipeBook";

	private const string VersionString = "1.0.0";

	private static readonly Harmony Harmony = new Harmony("com.equinox.RecipeBook");

	public static ManualLogSource Log = new ManualLogSource("RecipeBook");

	public static ConfigEntry<bool> filterUnknown;

	private static Texture2D buttonBackground;

	private static Texture2D buttonHoverBackground;

	private static Texture2D textBoxNormal;

	private static Texture2D textBoxHover;

	private static Texture2D windowBackground;

	private static Texture2D checkboxUnticked;

	private static Texture2D checkboxTicked;

	private static Texture2D oneIngredient;

	private static Texture2D twoIngredients;

	private static Texture2D threeIngredients;

	private static Texture2D thresherRecipe;

	private Vector2 scrollPosition = Vector2.zero;

	private Vector2 recipesScrollPosition = Vector2.zero;

	private string searchTerm = "";

	private bool useMk2 = false;

	private float timeSinceOpen = 0f;

	private bool trackTime = false;

	private bool lastCheck = false;

	private bool showRecipesGUI = false;

	private bool showUsesGUI = false;

	private string targetItemForRecipes = "";

	private string targetItemForUses = "";

	public static float windowYOffset = 25f;

	public static float windowWidth = 380f;

	public static float windowHeight = 625f;

	public static float windowX => ((float)Screen.width - windowWidth) / 2f;

	public static float windowY => ((float)Screen.height - windowHeight) / 2f - windowYOffset;

	private void Awake()
	{
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Expected O, but got Unknown
		((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: RecipeBook, VersionString: 1.0.0 is loading...");
		Harmony.PatchAll();
		filterUnknown = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "Filter Unknown", true, new ConfigDescription("Whether to hide items and recipes you have not discovered yet.", (AcceptableValueBase)null, Array.Empty<object>()));
		LoadImages();
		((BaseUnityPlugin)this).Logger.LogInfo((object)"PluginName: RecipeBook, VersionString: 1.0.0 is loaded.");
		Log = ((BaseUnityPlugin)this).Logger;
	}

	private void OnGUI()
	{
		//IL_009e: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a3: 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_00c6: Expected O, but got Unknown
		//IL_0108: 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_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0132: Unknown result type (might be due to invalid IL or missing references)
		//IL_0137: 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_01a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
		//IL_022a: Unknown result type (might be due to invalid IL or missing references)
		//IL_022f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0240: Unknown result type (might be due to invalid IL or missing references)
		//IL_0251: Unknown result type (might be due to invalid IL or missing references)
		//IL_0262: Unknown result type (might be due to invalid IL or missing references)
		//IL_0273: Unknown result type (might be due to invalid IL or missing references)
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_0295: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b8: Expected O, but got Unknown
		//IL_02df: Unknown result type (might be due to invalid IL or missing references)
		//IL_02eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_02fb: Expected O, but got Unknown
		//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
		//IL_0325: Unknown result type (might be due to invalid IL or missing references)
		//IL_0331: Unknown result type (might be due to invalid IL or missing references)
		//IL_0341: Expected O, but got Unknown
		//IL_033c: Unknown result type (might be due to invalid IL or missing references)
		if ((Object)(object)UIManager.instance == (Object)null || !HandleShouldShowGUI())
		{
			return;
		}
		if (UnityInput.Current.GetKey((KeyCode)27))
		{
			((CarouselMenu)UIManager.instance.inventoryCraftingMenu).Close(true);
			return;
		}
		if (!showRecipesGUI && !showUsesGUI)
		{
			GUI.FocusControl("SearchBar");
		}
		InputHandler.instance.uiInputBlocked = true;
		HideHorizontalScrollBar();
		DrawSearchBar();
		GUIStyle val = new GUIStyle(GUI.skin.button);
		val.normal.background = buttonBackground;
		val.hover.background = buttonHoverBackground;
		GUIStyle val2 = val;
		int i;
		for (i = ResourceNames.SafeResources.Count; i % 5 != 0; i++)
		{
		}
		i *= 12;
		scrollPosition = GUI.BeginScrollView(new Rect((float)(Screen.width - 320), 40f, 320f, (float)(Screen.height - 70)), scrollPosition, new Rect((float)(Screen.width - 320), 20f, 300f, (float)i), false, false);
		List<string> list = ResourceNames.SafeResources.Where((string name) => name.ToLower().Contains(searchTerm.ToLower())).ToList();
		if (filterUnknown.Value)
		{
			list = list.Where((string name) => TechTreeState.instance.IsResourceKnown(ModUtils.GetResourceIDByName(name, false))).ToList();
		}
		for (int j = 0; j < list.Count; j++)
		{
			Rect buttonRect = GetButtonRect(j);
			if (GUI.Button(buttonRect, (Texture)(object)GetImageForResource(list[j]), val2))
			{
				HandleResourceButtonClicked(list[j]);
			}
		}
		GUI.EndScrollView();
		if (UnityInput.Current.GetKey((KeyCode)27) || InputHandler.instance.input.GetButtonDown(45))
		{
			showRecipesGUI = false;
		}
		GUIStyle val3 = new GUIStyle(GUI.skin.window);
		val3.normal.background = windowBackground;
		val3.hover.background = windowBackground;
		val3.focused.background = windowBackground;
		val3.active.background = windowBackground;
		val3.onNormal.background = windowBackground;
		val3.onHover.background = windowBackground;
		val3.onFocused.background = windowBackground;
		val3.onActive.background = windowBackground;
		GUIStyle val4 = val3;
		if (showRecipesGUI)
		{
			GUI.Window(0, new Rect(windowX, windowY - windowYOffset, windowWidth, windowHeight), new WindowFunction(DrawRecipesWindowContent), "", val4);
		}
		else if (showUsesGUI)
		{
			GUI.Window(1, new Rect(windowX, windowY - windowYOffset, windowWidth, windowHeight), new WindowFunction(DrawUsesWindowContent), "", val4);
		}
	}

	private void LoadImages()
	{
		LoadImage("RecipeBook.Images.ButtonBackground.png", ref buttonBackground);
		LoadImage("RecipeBook.Images.ButtonHoverBackground.png", ref buttonHoverBackground);
		LoadImage("RecipeBook.Images.TextBoxNormal.png", ref textBoxNormal);
		LoadImage("RecipeBook.Images.TextBoxHover.png", ref textBoxHover);
		LoadImage("RecipeBook.Images.WindowBackground.png", ref windowBackground);
		LoadImage("RecipeBook.Images.CheckboxUnTicked.png", ref checkboxUnticked);
		LoadImage("RecipeBook.Images.CheckboxTicked.png", ref checkboxTicked);
		LoadImage("RecipeBook.Images.OneIngredient.png", ref oneIngredient);
		LoadImage("RecipeBook.Images.TwoIngredients.png", ref twoIngredients);
		LoadImage("RecipeBook.Images.ThreeIngredients.png", ref threeIngredients);
		LoadImage("RecipeBook.Images.ThresherRecipe.png", ref thresherRecipe);
	}

	private void LoadImage(string path, ref Texture2D output)
	{
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_0046: Expected O, but got Unknown
		Assembly executingAssembly = Assembly.GetExecutingAssembly();
		using Stream stream = executingAssembly.GetManifestResourceStream(path);
		if (stream == null)
		{
			Debug.LogError((object)"Could not find button background image");
			return;
		}
		using MemoryStream memoryStream = new MemoryStream();
		stream.CopyTo(memoryStream);
		byte[] array = memoryStream.ToArray();
		output = new Texture2D(2, 2);
		ImageConversion.LoadImage(output, array);
	}

	private bool HandleShouldShowGUI()
	{
		if (!lastCheck && UIManager.instance.inventoryCraftingMenuOpen)
		{
			timeSinceOpen = 0f;
			trackTime = true;
			searchTerm = "";
		}
		if (trackTime)
		{
			timeSinceOpen += Time.deltaTime;
		}
		if (timeSinceOpen > 0.5f && (InputHandler.instance.input.GetButtonDown(45) || UnityInput.Current.GetKey((KeyCode)27)))
		{
			InputHandler.instance.uiInputBlocked = false;
			((CarouselMenu)UIManager.instance.inventoryCraftingMenu).Close(true);
			trackTime = false;
			timeSinceOpen = 0f;
		}
		lastCheck = UIManager.instance.inventoryCraftingMenuOpen;
		if (!lastCheck)
		{
			showRecipesGUI = false;
			showUsesGUI = false;
		}
		return lastCheck;
	}

	private void HideHorizontalScrollBar()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0011: Expected O, but got Unknown
		GUIStyle val = new GUIStyle(GUI.skin.horizontalScrollbar);
		float fixedHeight = (val.fixedWidth = 0f);
		val.fixedHeight = fixedHeight;
	}

	private void DrawSearchBar()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0065: Unknown result type (might be due to invalid IL or missing references)
		//IL_0076: Unknown result type (might be due to invalid IL or missing references)
		//IL_007c: 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_0099: Expected O, but got Unknown
		//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Expected O, but got Unknown
		//IL_0121: 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)
		GUIStyle val = new GUIStyle(GUI.skin.textField);
		val.normal.textColor = Color.yellow;
		val.normal.background = textBoxNormal;
		val.hover.textColor = Color.yellow;
		val.hover.background = textBoxHover;
		val.active.textColor = Color.yellow;
		val.active.background = textBoxNormal;
		val.focused.textColor = Color.yellow;
		val.focused.background = textBoxNormal;
		GUIStyle val2 = val;
		GUIStyle val3 = new GUIStyle(GUI.skin.label);
		val3.normal.textColor = Color.gray;
		GUIStyle val4 = val3;
		if (searchTerm == "")
		{
			GUI.Label(new Rect((float)(Screen.width - 300), 10f, 290f, 20f), "Search...", val4);
		}
		GUI.SetNextControlName("SearchBar");
		searchTerm = GUI.TextField(new Rect((float)(Screen.width - 310), 10f, 300f, 20f), searchTerm, val2);
	}

	private Rect GetButtonRect(int index)
	{
		//IL_003e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		float num = Screen.width - 310;
		float num2 = 20f;
		float num3 = index % 5 * 60;
		float num4 = Mathf.FloorToInt((float)index / 5f) * 60;
		return new Rect(num + num3, num2 + num4, 50f, 50f);
	}

	private Texture2D GetImageForResource(string name)
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_0016: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_003d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005c: Expected O, but got Unknown
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0072: Unknown result type (might be due to invalid IL or missing references)
		//IL_0077: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Unknown result type (might be due to invalid IL or missing references)
		//IL_0086: Unknown result type (might be due to invalid IL or missing references)
		//IL_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0095: Unknown result type (might be due to invalid IL or missing references)
		ResourceInfo resourceInfoByName = ModUtils.GetResourceInfoByName(name, false);
		Sprite sprite = resourceInfoByName.sprite;
		Rect val = sprite.rect;
		if (((Rect)(ref val)).width != (float)((Texture)sprite.texture).width)
		{
			val = sprite.rect;
			int num = (int)((Rect)(ref val)).width;
			val = sprite.rect;
			Texture2D val2 = new Texture2D(num, (int)((Rect)(ref val)).height);
			Texture2D texture = sprite.texture;
			val = sprite.textureRect;
			int num2 = (int)((Rect)(ref val)).x;
			val = sprite.textureRect;
			int num3 = (int)((Rect)(ref val)).y;
			val = sprite.textureRect;
			int num4 = (int)((Rect)(ref val)).width;
			val = sprite.textureRect;
			Color[] pixels = texture.GetPixels(num2, num3, num4, (int)((Rect)(ref val)).height);
			val2.SetPixels(pixels);
			val2.Apply();
			return val2;
		}
		return sprite.texture;
	}

	private void HandleResourceButtonClicked(string name)
	{
		GUI.FocusControl("WindowTitle");
		if (!UnityInput.Current.GetKey((KeyCode)304))
		{
			showRecipesGUI = true;
			showUsesGUI = false;
			targetItemForRecipes = name;
			targetItemForUses = "";
		}
		else
		{
			showRecipesGUI = false;
			showUsesGUI = true;
			targetItemForRecipes = "";
			targetItemForUses = name;
		}
	}

	private void DrawRecipesWindowContent(int windowID)
	{
		DrawWindow();
		ResourceInfo targetItem = ModUtils.GetResourceInfoByName(targetItemForRecipes, false);
		List<SchematicsRecipeData> list = GameDefines.instance.schematicsRecipeEntries.Where((SchematicsRecipeData recipe) => recipe.outputTypes.Contains(targetItem)).ToList();
		if (filterUnknown.Value)
		{
			list = list.Where((SchematicsRecipeData recipe) => TechTreeState.instance.IsRecipeKnown(recipe)).ToList();
		}
		DrawRecipes(list);
	}

	private void DrawUsesWindowContent(int windowID)
	{
		DrawWindow();
		ResourceInfo targetItem = ModUtils.GetResourceInfoByName(targetItemForUses, false);
		List<SchematicsRecipeData> list = GameDefines.instance.schematicsRecipeEntries.Where((SchematicsRecipeData recipe) => recipe.ingTypes.Contains(targetItem)).ToList();
		if (filterUnknown.Value)
		{
			list = list.Where((SchematicsRecipeData recipe) => TechTreeState.instance.IsRecipeKnown(recipe)).ToList();
		}
		DrawRecipes(list);
	}

	private void DrawWindow()
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_0021: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_0032: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Expected O, but got Unknown
		//IL_0084: Unknown result type (might be due to invalid IL or missing references)
		GUIStyle val = new GUIStyle(GUI.skin.box)
		{
			fontSize = 18,
			alignment = (TextAnchor)4
		};
		val.normal.textColor = Color.yellow;
		val.normal.background = null;
		GUIStyle val2 = val;
		string text = (string.IsNullOrEmpty(targetItemForRecipes) ? ("Uses For " + targetItemForUses) : ("Recipes For " + targetItemForRecipes));
		GUI.Label(new Rect(0f, 0f, windowWidth, 40f), text, val2);
	}

	private void DrawRecipes(List<SchematicsRecipeData> recipes)
	{
		//IL_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Unknown result type (might be due to invalid IL or missing references)
		//IL_0027: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_0040: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Expected O, but got Unknown
		//IL_0063: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d0: 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_00de: 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_0106: 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_0146: 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_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e7: Expected O, but got Unknown
		//IL_01fc: Unknown result type (might be due to invalid IL or missing references)
		//IL_022b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0235: Unknown result type (might be due to invalid IL or missing references)
		//IL_023a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0243: Unknown result type (might be due to invalid IL or missing references)
		//IL_024b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0258: Unknown result type (might be due to invalid IL or missing references)
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		//IL_026e: Expected O, but got Unknown
		//IL_0284: Unknown result type (might be due to invalid IL or missing references)
		//IL_028a: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a0: Unknown result type (might be due to invalid IL or missing references)
		//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_02ac: Unknown result type (might be due to invalid IL or missing references)
		if (recipes.Count == 0)
		{
			GUIStyle val = new GUIStyle(GUI.skin.box)
			{
				fontSize = 18,
				alignment = (TextAnchor)4
			};
			val.normal.textColor = Color.yellow;
			val.normal.background = null;
			GUIStyle val2 = val;
			GUI.Label(new Rect(0f, 40f, windowWidth, 40f), "No recipes found...", val2);
			return;
		}
		int num = 50;
		int num2 = 0;
		foreach (SchematicsRecipeData recipe in recipes)
		{
			Texture2D panelForRecipe = GetPanelForRecipe(recipe);
			num2 += ((Texture)panelForRecipe).height + 10;
		}
		GUIStyle val3 = new GUIStyle(GUI.skin.toggle)
		{
			fontSize = 16,
			alignment = (TextAnchor)3
		};
		val3.normal.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.hover.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.active.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.focused.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.onNormal.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.onHover.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.onActive.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		val3.onFocused.background = (useMk2 ? checkboxTicked : checkboxUnticked);
		GUIStyle val4 = val3;
		useMk2 = GUI.Toggle(new Rect(10f, 45f, 40f, 40f), useMk2, "", val4);
		Rect val5 = new Rect(60f, 45f, 316f, 40f);
		GUIStyle val6 = new GUIStyle
		{
			fontSize = 16,
			alignment = (TextAnchor)3
		};
		val6.normal.background = null;
		val6.normal.textColor = Color.yellow;
		GUI.Label(val5, "Use MkII Machines", val6);
		recipesScrollPosition = GUI.BeginScrollView(new Rect(0f, 90f, 366f, 530f), recipesScrollPosition, new Rect(0f, 50f, 340f, (float)num2), false, true);
		foreach (SchematicsRecipeData recipe2 in recipes)
		{
			Texture2D panelForRecipe2 = GetPanelForRecipe(recipe2);
			int height = ((Texture)panelForRecipe2).height;
			DrawPanelForRecipe(panelForRecipe2, num, recipe2);
			num += height + 10;
		}
		GUI.EndScrollView();
	}

	private Texture2D GetPanelForRecipe(SchematicsRecipeData recipe)
	{
		//IL_0002: Unknown result type (might be due to invalid IL or missing references)
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_0008: 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_0028: Expected I4, but got Unknown
		CraftingMethod craftingMethod = recipe.craftingMethod;
		CraftingMethod val = craftingMethod;
		switch ((int)val)
		{
		case 2:
			return oneIngredient;
		case 4:
			return oneIngredient;
		case 5:
			return oneIngredient;
		case 3:
			switch (recipe.outputTypes.Count())
			{
			case 1:
				return oneIngredient;
			case 2:
				return thresherRecipe;
			}
			break;
		case 0:
			switch (recipe.ingTypes.Count())
			{
			case 1:
				return oneIngredient;
			case 2:
				return twoIngredients;
			case 3:
				return threeIngredients;
			}
			break;
		}
		return null;
	}

	private void DrawPanelForRecipe(Texture2D panel, int height, SchematicsRecipeData recipe)
	{
		//IL_000b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_001e: Expected O, but got Unknown
		//IL_0031: Unknown result type (might be due to invalid IL or missing references)
		//IL_004c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_0068: Unknown result type (might be due to invalid IL or missing references)
		//IL_0073: Unknown result type (might be due to invalid IL or missing references)
		//IL_0081: Expected O, but got Unknown
		//IL_0092: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00cc: 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_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0104: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Expected O, but got Unknown
		//IL_0120: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012e: 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_013e: Unknown result type (might be due to invalid IL or missing references)
		//IL_014b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0151: Unknown result type (might be due to invalid IL or missing references)
		//IL_015d: Expected O, but got Unknown
		//IL_0167: Unknown result type (might be due to invalid IL or missing references)
		//IL_016c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0175: Unknown result type (might be due to invalid IL or missing references)
		//IL_017d: Unknown result type (might be due to invalid IL or missing references)
		//IL_018a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0190: Unknown result type (might be due to invalid IL or missing references)
		//IL_019d: Expected O, but got Unknown
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0230: Unknown result type (might be due to invalid IL or missing references)
		//IL_0275: Unknown result type (might be due to invalid IL or missing references)
		//IL_03ed: Unknown result type (might be due to invalid IL or missing references)
		//IL_033d: Unknown result type (might be due to invalid IL or missing references)
		//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_02f7: Unknown result type (might be due to invalid IL or missing references)
		//IL_043b: Unknown result type (might be due to invalid IL or missing references)
		//IL_046c: Unknown result type (might be due to invalid IL or missing references)
		//IL_038e: Unknown result type (might be due to invalid IL or missing references)
		//IL_03c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_04b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_0502: Unknown result type (might be due to invalid IL or missing references)
		//IL_0533: Unknown result type (might be due to invalid IL or missing references)
		GUIStyle val = new GUIStyle(GUI.skin.box);
		val.normal.background = panel;
		GUIStyle val2 = val;
		GUI.Box(new Rect(7f, (float)height, 340f, (float)((Texture)panel).height), "", val2);
		GUIStyle val3 = new GUIStyle(GUI.skin.label)
		{
			fontSize = 18,
			alignment = (TextAnchor)4
		};
		val3.normal.textColor = Color.white;
		val3.normal.background = null;
		GUIStyle val4 = val3;
		GUI.Label(new Rect(7f, (float)height, 340f, 40f), "Made in: " + Enum.GetName(typeof(CraftingMethod), recipe.craftingMethod), val4);
		GUIStyle val5 = new GUIStyle(GUI.skin.button);
		val5.normal.background = buttonBackground;
		val5.hover.background = buttonHoverBackground;
		val5.focused.background = buttonHoverBackground;
		val5.active.background = buttonHoverBackground;
		GUIStyle val6 = val5;
		GUIStyle val7 = new GUIStyle(GUI.skin.label)
		{
			fontSize = 16,
			fontStyle = (FontStyle)1,
			alignment = (TextAnchor)8
		};
		val7.normal.background = null;
		val7.normal.textColor = Color.yellow;
		GUIStyle val8 = val7;
		GUIStyle val9 = new GUIStyle(GUI.skin.label)
		{
			fontSize = 15,
			alignment = (TextAnchor)7
		};
		val9.normal.background = null;
		val9.normal.textColor = Color.yellow;
		GUIStyle val10 = val9;
		if (GUI.Button(new Rect(12f, (float)(height + 70), 50f, 50f), (Texture)(object)GetImageForResource(recipe.ingTypes[0].displayName), val6))
		{
			HandleResourceButtonClicked(recipe.ingTypes[0].displayName);
		}
		GUI.Label(new Rect(10f, (float)(height + 72), 50f, 50f), recipe.ingQuantities[0].ToString(), val8);
		GUI.Label(new Rect(-15f, (float)(height + 20), 100f, 50f), GetRateStringForItem(recipe, 0, isIng: true), val10);
		if (recipe.ingTypes.Count() > 1)
		{
			if (GUI.Button(new Rect(12f, (float)(height + 140), 50f, 50f), (Texture)(object)GetImageForResource(recipe.ingTypes[1].displayName), val6))
			{
				HandleResourceButtonClicked(recipe.ingTypes[1].displayName);
			}
			GUI.Label(new Rect(10f, (float)(height + 142), 50f, 50f), recipe.ingQuantities[1].ToString(), val8);
			GUI.Label(new Rect(-15f, (float)(height + 90), 100f, 50f), GetRateStringForItem(recipe, 1, isIng: true), val10);
		}
		if (recipe.ingTypes.Count() > 2)
		{
			if (GUI.Button(new Rect(12f, (float)(height + 210), 50f, 50f), (Texture)(object)GetImageForResource(recipe.ingTypes[2].displayName), val6))
			{
				HandleResourceButtonClicked(recipe.ingTypes[2].displayName);
			}
			GUI.Label(new Rect(10f, (float)(height + 212), 50f, 50f), recipe.ingQuantities[2].ToString(), val8);
			GUI.Label(new Rect(-15f, (float)(height + 160), 100f, 50f), GetRateStringForItem(recipe, 2, isIng: true), val10);
		}
		if (GUI.Button(new Rect(292f, (float)(height + 70), 50f, 50f), (Texture)(object)GetImageForResource(recipe.outputTypes[0].displayName), val6))
		{
			HandleResourceButtonClicked(recipe.outputTypes[0].displayName);
		}
		GUI.Label(new Rect(290f, (float)(height + 72), 50f, 50f), recipe.outputQuantities[0].ToString(), val8);
		GUI.Label(new Rect(267f, (float)(height + 20), 100f, 50f), GetRateStringForItem(recipe, 0, isIng: false), val10);
		if (recipe.outputTypes.Count() > 1)
		{
			if (GUI.Button(new Rect(292f, (float)(height + 140), 50f, 50f), (Texture)(object)GetImageForResource(recipe.outputTypes[1].displayName), val6))
			{
				HandleResourceButtonClicked(recipe.outputTypes[1].displayName);
			}
			GUI.Label(new Rect(290f, (float)(height + 142), 50f, 50f), recipe.outputQuantities[1].ToString(), val8);
			GUI.Label(new Rect(267f, (float)(height + 90), 100f, 50f), GetRateStringForItem(recipe, 1, isIng: false), val10);
		}
	}

	private string GetRateStringForItem(SchematicsRecipeData recipe, int index, bool isIng)
	{
		//IL_0008: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Unknown result type (might be due to invalid IL or missing references)
		//IL_000e: Unknown result type (might be due to invalid IL or missing references)
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Expected I4, but got Unknown
		float num = 1f;
		CraftingMethod craftingMethod = recipe.craftingMethod;
		CraftingMethod val = craftingMethod;
		switch ((int)val)
		{
		case 0:
			num = (useMk2 ? 0.5f : 0.25f);
			if (isIng)
			{
				return $"{(float)recipe.ingQuantities[index] * AssemblerInstance.assemblerSpeedMultiplier * num / recipe.duration * 60f}/m";
			}
			return $"{(float)recipe.outputQuantities[index] * AssemblerInstance.assemblerSpeedMultiplier * num / recipe.duration * 120f}/m";
		case 2:
			num = (useMk2 ? 8f : 1f);
			if (isIng)
			{
				return $"{(float)recipe.ingQuantities[index] * SmelterInstance.smelterSpeedMultiplier * num / recipe.duration * 60f}/m";
			}
			return $"{(float)recipe.outputQuantities[index] * SmelterInstance.smelterSpeedMultiplier * num / recipe.duration * 60f}/m";
		case 4:
		{
			float num2 = 1f;
			if (TechTreeState.instance.IsUnlockActive(((UniqueIdScriptableObject)ModUtils.GetUnlockByName("BSM-MultiBlast II", false)).uniqueId))
			{
				num2 = 4f;
			}
			if (TechTreeState.instance.IsUnlockActive(((UniqueIdScriptableObject)ModUtils.GetUnlockByName("BSM-MultiBlast III", false)).uniqueId))
			{
				num2 = 6f;
			}
			if (TechTreeState.instance.IsUnlockActive(((UniqueIdScriptableObject)ModUtils.GetUnlockByName("BSM-MultiBlast IV", false)).uniqueId))
			{
				num2 = 8f;
			}
			if (TechTreeState.instance.IsUnlockActive(((UniqueIdScriptableObject)ModUtils.GetUnlockByName("BSM-MultiBlast V", false)).uniqueId))
			{
				num2 = 10f;
			}
			if (isIng)
			{
				return $"<={num2 * (float)recipe.ingQuantities[index] * 5f}/m";
			}
			return $"<={num2 * (float)recipe.outputQuantities[index] * 5f}/m";
		}
		case 3:
			num = (useMk2 ? 2f : 1f);
			if (isIng)
			{
				return $"{(float)recipe.ingQuantities[index] * ThresherInstance.thresherSpeedMultiplier * num / recipe.duration * 60f}/m";
			}
			return $"{(float)recipe.outputQuantities[index] * ThresherInstance.thresherSpeedMultiplier * num / recipe.duration * 60f}/m";
		case 5:
			if (IsUsingPlanterCoreClusters())
			{
				return "2/m";
			}
			return "2/m";
		default:
			return "?/m";
		}
	}

	private bool IsUsingPlanterCoreClusters()
	{
		string text = AppDomain.CurrentDomain.BaseDirectory + "BepInEx/plugins";
		Debug.Log((object)text);
		string[] files = Directory.GetFiles(text);
		string[] array = files;
		foreach (string text2 in array)
		{
			if (text2.Contains("PlanterCoreClusters"))
			{
				return true;
			}
		}
		return false;
	}
}