Decompiled source of Recipe List Menu v1.0.9

RecipeListGui.dll

Decompiled 4 days 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.Versioning;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppScheduleOne.ItemFramework;
using Il2CppScheduleOne.Product;
using Il2CppScheduleOne.Properties;
using Il2CppScheduleOne.StationFramework;
using Il2CppSystem.Collections.Generic;
using MelonLoader;
using MelonLoader.Preferences;
using MelonLoader.Utils;
using Microsoft.CodeAnalysis;
using RecipeListGui;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: MelonInfo(typeof(RecipeListGuiClass), "Recipe List", "1.0.9", "Rezx, Community Updates By: ispa (Translation), pyst4r (effect colors)", null)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("RecipeListGui")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("RecipeListGui")]
[assembly: AssemblyTitle("RecipeListGui")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace RecipeListGui
{
	public class RecipeListGuiClass : MelonMod
	{
		private class DataForFullIngredentsList
		{
			public string Name;

			public int Qnt;
		}

		private class DetailedProduct
		{
			public ProductDefinition Product;

			public float CostToMake;

			public float IngredientsNeededForCraft;
		}

		private static Dictionary<string, string> effectColors = new Dictionary<string, string>
		{
			{ "Anti-gravity", "#235BCD" },
			{ "Athletic", "#75C8FD" },
			{ "Balding", "#C79232" },
			{ "Bright-Eyed", "#BEF7FD" },
			{ "Calming", "#FED09B" },
			{ "Calorie-Dense", "#FE84F4" },
			{ "Cyclopean", "#FEC174" },
			{ "Disorienting", "#D16546" },
			{ "Electrifying", "#55C8FD" },
			{ "Energizing", "#9AFE6D" },
			{ "Euphoric", "#FEEA74" },
			{ "Explosive", "#FE4B40" },
			{ "Focused", "#75F1FD" },
			{ "Foggy", "#B0B0AF" },
			{ "Gingeritis", "#FE8829" },
			{ "Glowing", "#85E459" },
			{ "Jennerising", "#FE8DF8" },
			{ "Laxative", "#763C25" },
			{ "Lethal", "#AB2232" },
			{ "Long faced", "#FED961" },
			{ "Munchies", "#C96E57" },
			{ "Paranoia", "#C46762" },
			{ "Refreshing", "#B2FE98" },
			{ "Schizophrenic", "#645AFD" },
			{ "Sedating", "#6B5FD8" },
			{ "Seizure-Inducing", "#FEE900" },
			{ "Shrinking", "#B6FEDA" },
			{ "Slippery", "#A2DFFD" },
			{ "Smelly", "#7DBC31" },
			{ "Sneaky", "#7B7B7B" },
			{ "Spicy", "#FE6B4C" },
			{ "Thought-Provoking", "#FEA0CB" },
			{ "Toxic", "#5F9A31" },
			{ "Tropic Thunder", "#FE9F47" },
			{ "Zombifying", "#71AB5D" }
		};

		private static Dictionary<string, string> _translationDictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);

		private static MelonPreferences_Category _melonCfgCategory;

		private static MelonPreferences_Entry<float> _guiScale;

		private static MelonPreferences_Entry<KeyCode> _toggleKeyCode;

		private static MelonPreferences_Entry<KeyCode> _resetKeyCode;

		private static MelonPreferences_Entry<float> _transparency;

		private static MelonPreferences_Entry<Color> _pageColor;

		private static bool _guiShowen;

		private static Rect _settingsPageRect = new Rect(1000f, 20f, 250f, 55f);

		private static bool _shouldMinimizeSettingsPage = true;

		private static float _costToMake;

		private static List<string> _ingredientListRecipePage;

		private static Vector2 _recipeResultPageScrollViewVector = Vector2.zero;

		private static Rect _recipeResultPageRect = new Rect(600f, 20f, 600f, 600f);

		private static bool _hasSelectedProductRecipe;

		private static int _selectedProductRecipeIndex;

		private static ProductDefinition _lastSelectedBud;

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

		private static Vector2 _productListPageScrollViewVector = Vector2.zero;

		private static Rect _productListPageRect = new Rect(100f, 20f, 295f, 55f);

		private static List<ProductDefinition>? _listOfCreatedProducts;

		private static bool _hasSelectedProductType;

		private static string _typeOfDrugToFilter = "";

		private static bool _hasSelectedBud;

		private static ProductDefinition _selectedBud;

		private static bool _shouldMinimizeProductListPage = true;

		private static bool _sortProductListPageByPrice = false;

		private static bool _sortProductListPageByIngredientCount = false;

		private static List<DetailedProduct> _detailedListOfCreatedProducts = new List<DetailedProduct>();

		private static bool _shouldShowDetailedView = false;

		private static int _ingredientsNeededForCraft;

		private static float _costToMakeDetailedProductList;

		private static Vector2 _favsListPageScrollViewVector = Vector2.zero;

		private static Rect _favsListPageRect = new Rect(100f, 325f, 300f, 55f);

		private static List<ProductDefinition>? _listOf_FavsProducts;

		private static bool _shouldMinimizeFavListPage = true;

		private static bool _sortFavListPageByPrice = false;

		private static bool _isResizing;

		private static Vector2 _initialMousePosition;

		private static Rect _initialWindowRect;

		private static Vector2 _minWindowSize = new Vector2(375f, 400f);

		private static string Translate(string englishText)
		{
			if (string.IsNullOrEmpty(englishText))
			{
				return englishText;
			}
			if (_translationDictionary.TryGetValue(englishText, out string value))
			{
				return value;
			}
			return englishText;
		}

		private static void LoadTranslations()
		{
			string text = Path.Combine(MelonEnvironment.GameRootDirectory, "Mods", "Translations", "RecipeListGUI_translations.txt");
			Melon<RecipeListGuiClass>.Logger.Msg("Trying to load translations from: " + text);
			if (File.Exists(text))
			{
				try
				{
					string[] array = File.ReadAllLines(text);
					Melon<RecipeListGuiClass>.Logger.Msg($"Read {array.Length} lines from translation file");
					string[] array2 = array;
					foreach (string text2 in array2)
					{
						if (!string.IsNullOrWhiteSpace(text2) && !text2.StartsWith("//"))
						{
							string[] array3 = text2.Split('=');
							if (array3.Length == 2)
							{
								string key = array3[0].Trim();
								string value = array3[1].Trim();
								_translationDictionary[key] = value;
							}
						}
					}
					Melon<RecipeListGuiClass>.Logger.Msg($"Loaded {_translationDictionary.Count} translations");
					return;
				}
				catch (Exception ex)
				{
					Melon<RecipeListGuiClass>.Logger.Error("Error loading translations: " + ex.Message);
					return;
				}
			}
			string path = Path.Combine(MelonEnvironment.GameRootDirectory, "Mods", "Translations");
			if (!Directory.Exists(path))
			{
				try
				{
					Directory.CreateDirectory(path);
					Melon<RecipeListGuiClass>.Logger.Msg("Translation directory created. Please add RecipeListGUI_translations.txt file to the folder Mods/Translations/");
					return;
				}
				catch (Exception ex2)
				{
					Melon<RecipeListGuiClass>.Logger.Error("Failed to create directory for translations: " + ex2.Message);
					return;
				}
			}
			Melon<RecipeListGuiClass>.Logger.Msg("Translation file not found. Please add RecipeListGUI_translations.txt Mods/Translations/");
		}

		public override void OnInitializeMelon()
		{
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			LoadTranslations();
			_melonCfgCategory = MelonPreferences.CreateCategory("RecipeListGUI");
			_guiScale = _melonCfgCategory.CreateEntry<float>("GUI_Scale", 1f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			_toggleKeyCode = _melonCfgCategory.CreateEntry<KeyCode>("Open_And_Close_Button", (KeyCode)286, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			_resetKeyCode = _melonCfgCategory.CreateEntry<KeyCode>("Reset_Button", (KeyCode)287, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			_transparency = _melonCfgCategory.CreateEntry<float>("Transparency", 0.56f, (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			_pageColor = _melonCfgCategory.CreateEntry<Color>("Page_Color", Color32.op_Implicit(new Color32((byte)51, (byte)51, (byte)51, byte.MaxValue)), (string)null, (string)null, false, false, (ValueValidator)null, (string)null);
			_melonCfgCategory.SetFilePath(Path.Combine(MelonEnvironment.GameRootDirectory, "Mods", "RecipeGUI.cfg"));
			_melonCfgCategory.SaveToFile(true);
			Melon<RecipeListGuiClass>.Logger.Msg($"{_toggleKeyCode.Value} to open");
			Melon<RecipeListGuiClass>.Logger.Msg($"{_resetKeyCode.Value} while gui is open to reset gui location");
		}

		public override void OnLateUpdate()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			if (Input.GetKeyDown(_toggleKeyCode.Value))
			{
				ToggleMenu();
			}
			if (Input.GetKeyDown(_resetKeyCode.Value) && _guiShowen)
			{
				MelonLogger.Msg("F6 pressed reset gui location");
				_productListPageRect = new Rect(100f, 20f, ((Rect)(ref _productListPageRect)).width, ((Rect)(ref _productListPageRect)).height);
				_shouldMinimizeProductListPage = false;
				_favsListPageRect = new Rect(100f, 325f, ((Rect)(ref _favsListPageRect)).width, ((Rect)(ref _favsListPageRect)).height);
				_shouldMinimizeFavListPage = false;
				_recipeResultPageRect = new Rect(600f, 20f, ((Rect)(ref _recipeResultPageRect)).width, ((Rect)(ref _recipeResultPageRect)).height);
				_settingsPageRect = new Rect(1000f, 20f, ((Rect)(ref _settingsPageRect)).width, ((Rect)(ref _settingsPageRect)).height);
			}
		}

		private static void ToggleMenu()
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			_guiShowen = !_guiShowen;
			if (_guiShowen)
			{
				((MelonEventBase<LemonAction>)(object)MelonEvents.OnGUI).Subscribe(new LemonAction(DrawPages), 50, false);
				return;
			}
			_listOfCreatedProducts = null;
			((MelonEventBase<LemonAction>)(object)MelonEvents.OnGUI).Unsubscribe(new LemonAction(DrawPages));
		}

		private static void DrawPages()
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: 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_002c: 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_003e: Expected O, but got Unknown
			//IL_0041: 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_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_007d: Expected O, but got Unknown
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0141: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: 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)
			Color value = _pageColor.Value;
			float value2 = _guiScale.Value;
			GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(value2, value2, 1f));
			Texture2D val = new Texture2D(1, 1);
			val.SetPixel(0, 0, new Color(value.r, value.g, value.b, _transparency.Value));
			val.Apply();
			GUIStyle val2 = new GUIStyle(GUI.skin.window);
			val2.normal.textColor = Color.white;
			val2.normal.background = val;
			val2.onNormal.background = val;
			_productListPageRect = GUI.Window(651, _productListPageRect, WindowFunction.op_Implicit((Action<int>)ProductListPage), Translate("Product List"), val2);
			_favsListPageRect = GUI.Window(652, _favsListPageRect, WindowFunction.op_Implicit((Action<int>)FavListPage), Translate("Favorite List"), val2);
			if (_hasSelectedBud)
			{
				_recipeResultPageRect = GUI.Window(653, _recipeResultPageRect, WindowFunction.op_Implicit((Action<int>)RecipePage), Translate("Recipe"), val2);
			}
			_settingsPageRect = GUI.Window(654, _settingsPageRect, WindowFunction.op_Implicit((Action<int>)SettingsPage), Translate("Settings"), val2);
		}

		private static void SettingsPage(int windowId)
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: 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_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_015f: 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_01aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022d: 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_027e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_031d: Unknown result type (might be due to invalid IL or missing references)
			//IL_031e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0341: Unknown result type (might be due to invalid IL or missing references)
			//IL_0364: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_039f: Unknown result type (might be due to invalid IL or missing references)
			//IL_03da: Unknown result type (might be due to invalid IL or missing references)
			//IL_040f: Unknown result type (might be due to invalid IL or missing references)
			//IL_045f: Unknown result type (might be due to invalid IL or missing references)
			if (_shouldMinimizeSettingsPage)
			{
				if (GUI.Button(new Rect(((Rect)(ref _settingsPageRect)).width - 25f, 2f, 17f, 17f), "+"))
				{
					_shouldMinimizeSettingsPage = false;
					_settingsPageRect = new Rect(((Rect)(ref _settingsPageRect)).x, ((Rect)(ref _settingsPageRect)).y, ((Rect)(ref _settingsPageRect)).width, 300f);
				}
				else
				{
					GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _settingsPageRect)).width, ((Rect)(ref _settingsPageRect)).height));
				}
				return;
			}
			if (GUI.Button(new Rect(((Rect)(ref _settingsPageRect)).width - 25f, 2f, 17f, 17f), "-"))
			{
				_shouldMinimizeSettingsPage = true;
				_settingsPageRect = new Rect(((Rect)(ref _settingsPageRect)).x, ((Rect)(ref _settingsPageRect)).y, ((Rect)(ref _settingsPageRect)).width, 55f);
			}
			Color32 val = Color32.op_Implicit(_pageColor.Value);
			_transparency.Value = GUI.HorizontalSlider(new Rect(25f, 35f, 200f, 30f), _transparency.Value, 0f, 1f);
			GUI.Label(new Rect(25f, 19f, ((Rect)(ref _settingsPageRect)).width, 20f), Translate("Transparency") + ":" + _transparency.Value);
			val.r = (byte)GUI.HorizontalSlider(new Rect(25f, 65f, 200f, 30f), (float)(int)val.r, 0f, 255f);
			GUI.Label(new Rect(25f, 45f, ((Rect)(ref _settingsPageRect)).width, 20f), $"R:{val.r}");
			val.g = (byte)GUI.HorizontalSlider(new Rect(25f, 95f, 200f, 30f), (float)(int)val.g, 0f, 255f);
			GUI.Label(new Rect(25f, 75f, ((Rect)(ref _settingsPageRect)).width, 20f), $"G:{val.g}");
			val.b = (byte)GUI.HorizontalSlider(new Rect(25f, 125f, 200f, 30f), (float)(int)val.b, 0f, 255f);
			GUI.Label(new Rect(25f, 105f, ((Rect)(ref _settingsPageRect)).width, 20f), $"B:{val.b}");
			_pageColor.Value = Color32.op_Implicit(val);
			GUI.Label(new Rect(25f, 135f, ((Rect)(ref _settingsPageRect)).width, 20f), "Scale");
			if (GUI.Button(new Rect(95f, 155f, 19f, 19f), "+"))
			{
				MelonPreferences_Entry<float> guiScale = _guiScale;
				guiScale.Value += 0.1f;
			}
			if (GUI.Button(new Rect(25f, 155f, 17f, 17f), "-"))
			{
				MelonPreferences_Entry<float> guiScale2 = _guiScale;
				guiScale2.Value -= 0.1f;
			}
			if (GUI.Button(new Rect(65f, 230f, 125f, 20f), "Save"))
			{
				_melonCfgCategory.SaveToFile(true);
			}
			GUI.Label(new Rect(65f, 153f, ((Rect)(ref _settingsPageRect)).width, 20f), $"{Math.Round(_guiScale.Value, 2)}");
			GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _settingsPageRect)).width, ((Rect)(ref _settingsPageRect)).height));
		}

		private static List<ProductDefinition> GetlistOfCreatedProducts()
		{
			GameObject val = GameObject.Find("@Product");
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			ProductManager component = val.GetComponent<ProductManager>();
			if ((Object)(object)component == (Object)null)
			{
				return null;
			}
			return component.AllProducts;
		}

		private static List<ProductDefinition> GetlistOf_FavProducts()
		{
			GameObject val = GameObject.Find("@Product");
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			if ((Object)(object)val.GetComponent<ProductManager>() == (Object)null)
			{
				return null;
			}
			return ProductManager.FavouritedProducts;
		}

		private static List<string> GetIngredientList(ProductDefinition product, int selectedProductRecipe)
		{
			List<string> val = new List<string>();
			List<DataForFullIngredentsList> list = new List<DataForFullIngredentsList>();
			_costToMake = 0f;
			ProcessProduct(product, val, selectedProductRecipe, isSelectedProductRecipe: true, list);
			val.Add("-----------------------------------------------------------------------------------");
			val.Add($"{Translate("Market Price")} <b><color=#3ebf05>{product.MarketValue}</color></b>, {Translate("Addictiv")}: {Math.Round(product.GetAddictiveness())}, {Translate("Cost")}: <b><color=#ff3737>{_costToMake}</color></b>, {Translate("After Cost")}: <b><color=#3ebf05>{product.MarketValue - _costToMake}</color></b> ({Translate("base ingredients not included")})");
			val.Add("-----------------------------------------------------------------------------------");
			foreach (DataForFullIngredentsList item in list)
			{
				val.Add($"{item.Qnt}x {Translate(item.Name)} ");
			}
			return val;
		}

		private static void ProcessProduct(ProductDefinition product, List<string> outputLines, int recipeToUse, bool isSelectedProductRecipe, List<DataForFullIngredentsList> ingredientListTemp)
		{
			//IL_01e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			if (!isSelectedProductRecipe && (Object)(object)product == (Object)(object)_selectedBud)
			{
				return;
			}
			GameObject val = GameObject.Find("@Product");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			ProductManager component = val.GetComponent<ProductManager>();
			if ((Object)(object)component == (Object)null || product.Recipes.Count < 1 || component.DefaultKnownProducts.Contains(product))
			{
				return;
			}
			StationRecipe val2 = ((IEnumerable<StationRecipe>)product.Recipes.ToArray()).ToList()[recipeToUse];
			if (isSelectedProductRecipe)
			{
				outputLines.Add(Translate("Recipe for") + " <b>" + Translate(val2.RecipeTitle) + "</b>");
				string text = "";
				Enumerator<Property> enumerator = ((PropertyItemDefinition)product).Properties.GetEnumerator();
				while (enumerator.MoveNext())
				{
					Property current = enumerator.Current;
					string value = (effectColors.ContainsKey(current.Name) ? effectColors[current.Name] : "#FFFFFF");
					string text2 = $"<b><color={value}>{Translate(current.Name)}</color></b>";
					text = ((!string.IsNullOrEmpty(text)) ? (text + ", " + text2) : text2);
				}
				outputLines.Add(text);
				outputLines.Add("-----------------------------------------------------------------------------------");
				isSelectedProductRecipe = false;
			}
			else
			{
				string text3 = Translate(val2.RecipeTitle);
				outputLines.Add("---------------------------------------------------");
				outputLines.Add(Translate("Recipe") + ": <b>" + text3 + "</b>");
			}
			List<ProductDefinition> val3 = new List<ProductDefinition>();
			Enumerator<IngredientQuantity> enumerator2 = val2.Ingredients.GetEnumerator();
			while (enumerator2.MoveNext())
			{
				IngredientQuantity current2 = enumerator2.Current;
				EItemCategory category = current2.Item.Category;
				string text4 = ((object)(EItemCategory)(ref category)).ToString();
				switch (text4)
				{
				case "Consumable":
				case "Ingredient":
				{
					StorableItemDefinition prop = ((Il2CppObjectBase)current2.Item).TryCast<StorableItemDefinition>();
					if ((Object)(object)prop != (Object)null)
					{
						outputLines.Add($"{current2.Quantity}x {Translate(((ItemDefinition)prop).Name)} {prop.BasePurchasePrice}$");
						DataForFullIngredentsList dataForFullIngredentsList = ingredientListTemp.ToArray().ToList().FirstOrDefault((DataForFullIngredentsList i) => i.Name == ((ItemDefinition)prop).Name);
						if (dataForFullIngredentsList != null)
						{
							dataForFullIngredentsList.Qnt += current2.Quantity;
						}
						else
						{
							ingredientListTemp.Add(new DataForFullIngredentsList
							{
								Name = ((ItemDefinition)prop).Name,
								Qnt = current2.Quantity
							});
						}
						_costToMake += prop.BasePurchasePrice * (float)current2.Quantity;
						if (!ingredientIcons.ContainsKey(((ItemDefinition)prop).Name))
						{
							ingredientIcons.Add(((ItemDefinition)prop).Name, ((ItemDefinition)prop).Icon);
						}
					}
					else
					{
						outputLines.Add($"{current2.Quantity} Ingredient: {current2.Item}");
						Melon<RecipeListGuiClass>.Logger.Msg("ERROR ProcessProduct: prop null " + text4);
					}
					break;
				}
				case "Product":
				{
					ProductDefinition val4 = ((Il2CppObjectBase)current2.Item).TryCast<ProductDefinition>();
					if ((Object)(object)val4 != (Object)null)
					{
						outputLines.Add($"{current2.Quantity}x {Translate(((ItemDefinition)val4).Name)}");
						if (val4.Recipes.Count >= 1)
						{
							val3.Add(val4);
						}
					}
					else
					{
						outputLines.Add($"{current2.Quantity}xIngredient: {current2.Item}");
						Melon<RecipeListGuiClass>.Logger.Msg("ERROR ProcessProduct: Drug null " + text4);
					}
					break;
				}
				default:
					outputLines.Add($"{current2.Quantity}xIngredient: {current2.Item}");
					Melon<RecipeListGuiClass>.Logger.Msg("ERROR ProcessProduct: Unknown Category " + text4);
					break;
				}
			}
			Enumerator<ProductDefinition> enumerator3 = val3.GetEnumerator();
			while (enumerator3.MoveNext())
			{
				ProcessProduct(enumerator3.Current, outputLines, 0, isSelectedProductRecipe: false, ingredientListTemp);
			}
		}

		private static void RecipePage(int windowId)
		{
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e5: 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_020d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_023f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0244: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: 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_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0359: Unknown result type (might be due to invalid IL or missing references)
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref _recipeResultPageRect)).width - 50f, ((Rect)(ref _recipeResultPageRect)).height - 50f, 25f, 25f);
			GUI.Box(val, "");
			if (GUI.Button(new Rect(((Rect)(ref _recipeResultPageRect)).width - 45f, 20f, 30f, 30f), "X"))
			{
				_selectedBud = null;
				_hasSelectedBud = false;
				return;
			}
			if (_selectedBud.Recipes.Count > 1)
			{
				if (_hasSelectedProductRecipe && GUI.Button(new Rect(((Rect)(ref _recipeResultPageRect)).width - 85f, 20f, 30f, 30f), Translate("B")))
				{
					_hasSelectedProductRecipe = false;
					_ingredientListRecipePage = null;
				}
				if (!_hasSelectedProductRecipe)
				{
					for (int i = 0; i < _selectedBud.Recipes.Count; i++)
					{
						if (GUI.Button(new Rect(((Rect)(ref _recipeResultPageRect)).width / 3f, (float)(50 + 20 * i), 200f, 20f), $"{Translate("Recipe")} {i + 1}"))
						{
							_hasSelectedProductRecipe = true;
							_selectedProductRecipeIndex = i;
						}
					}
					ProcessResize(val);
					GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _recipeResultPageRect)).width, ((Rect)(ref _recipeResultPageRect)).height - 30f));
					return;
				}
			}
			if ((Object)(object)_selectedBud != (Object)null)
			{
				if (_ingredientListRecipePage == null || (Object)(object)_selectedBud != (Object)(object)_lastSelectedBud)
				{
					_ingredientListRecipePage = GetIngredientList(_selectedBud, _selectedProductRecipeIndex);
					_lastSelectedBud = _selectedBud;
				}
				_recipeResultPageScrollViewVector = GUI.BeginScrollView(new Rect(55f, 20f, ((Rect)(ref _recipeResultPageRect)).width - 55f, ((Rect)(ref _recipeResultPageRect)).height), _recipeResultPageScrollViewVector, new Rect(0f, 0f, ((Rect)(ref _recipeResultPageRect)).width - 55f, (float)(_ingredientListRecipePage.Count * 30)));
				List<string> list = ((IEnumerable<string>)_ingredientListRecipePage.ToArray()).ToList();
				for (int j = 0; j < _ingredientListRecipePage.Count; j++)
				{
					string text = list[j];
					if (!text.StartsWith(" ") && !text.StartsWith("Price") && !text.StartsWith("Recipe") && !text.StartsWith("----"))
					{
						string[] array = text.Split(' ');
						string text2 = "";
						text2 = ((!array.Last().Contains("$")) ? string.Join(" ", array.Skip(1)) : string.Join(" ", array.Skip(1).Take(array.Length - 2)));
						text2 = text2.Trim();
						Sprite val2 = (ingredientIcons.ContainsKey(text2) ? ingredientIcons[text2] : null);
						if ((Object)(object)val2 != (Object)null)
						{
							GUI.DrawTexture(new Rect(8f, (float)(40 + 20 * j), 35f, 22f), (Texture)(object)val2.texture);
						}
					}
					GUI.Label(new Rect(50f, (float)(40 + 20 * j), ((Rect)(ref _recipeResultPageRect)).width - 75f, 20f), list[j]);
				}
				GUI.EndScrollView();
			}
			ProcessResize(val);
			GUI.DragWindow(new Rect(0f, 0f, ((Rect)(ref _recipeResultPageRect)).width, ((Rect)(ref _recipeResultPageRect)).height - 30f));
		}

		private static void ProductListPage(int windowID)
		{
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_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_0239: Unknown result type (might be due to invalid IL or missing references)
			//IL_0127: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0260: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_028d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_019b: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_030c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0205: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_035d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0796: Unknown result type (might be due to invalid IL or missing references)
			//IL_079b: Unknown result type (might be due to invalid IL or missing references)
			//IL_07bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_07f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_084d: Unknown result type (might be due to invalid IL or missing references)
			//IL_08c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0550: Unknown result type (might be due to invalid IL or missing references)
			//IL_0555: Unknown result type (might be due to invalid IL or missing references)
			//IL_0576: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0580: Unknown result type (might be due to invalid IL or missing references)
			//IL_05af: Unknown result type (might be due to invalid IL or missing references)
			//IL_0604: Unknown result type (might be due to invalid IL or missing references)
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			if (_shouldMinimizeProductListPage)
			{
				if (GUI.Button(new Rect(((Rect)(ref _productListPageRect)).width - 25f, 2f, 18f, 17f), "+"))
				{
					_shouldMinimizeProductListPage = false;
					_productListPageRect = new Rect(((Rect)(ref _productListPageRect)).x, ((Rect)(ref _productListPageRect)).y, ((Rect)(ref _productListPageRect)).width, 300f);
				}
				GUI.DragWindow(new Rect(20f, 10f, 500f, 500f));
				return;
			}
			if (GUI.Button(new Rect(((Rect)(ref _productListPageRect)).width - 25f, 2f, 17f, 17f), "-"))
			{
				_shouldMinimizeProductListPage = true;
				_productListPageRect = new Rect(((Rect)(ref _productListPageRect)).x, ((Rect)(ref _productListPageRect)).y, ((Rect)(ref _productListPageRect)).width, 55f);
				return;
			}
			if (_listOfCreatedProducts == null)
			{
				_listOfCreatedProducts = GetlistOfCreatedProducts();
			}
			if (_listOfCreatedProducts == null)
			{
				return;
			}
			if (!_hasSelectedProductType)
			{
				if (GUI.Button(new Rect(50f, 20f, 200f, 20f), Translate("Marijuana")))
				{
					_hasSelectedProductType = true;
					_typeOfDrugToFilter = "Marijuana";
				}
				if (GUI.Button(new Rect(50f, 40f, 200f, 20f), Translate("Methamphetamine")))
				{
					_hasSelectedProductType = true;
					_typeOfDrugToFilter = "Methamphetamine";
				}
				if (GUI.Button(new Rect(50f, 60f, 200f, 20f), Translate("Cocaine")))
				{
					_hasSelectedProductType = true;
					_typeOfDrugToFilter = "Cocaine";
				}
				if (GUI.Button(new Rect(50f, 80f, 200f, 20f), Translate("All Products")))
				{
					_hasSelectedProductType = true;
				}
				GUI.DragWindow(new Rect(40f, 10f, 500f, 500f));
				if (!_hasSelectedProductType)
				{
					return;
				}
			}
			else
			{
				if (GUI.Button(new Rect(((Rect)(ref _productListPageRect)).width - 37f, 20f, 29f, 27f), "B"))
				{
					_shouldShowDetailedView = false;
					_hasSelectedProductType = false;
					_typeOfDrugToFilter = "";
					_productListPageScrollViewVector = Vector2.zero;
					_productListPageRect = new Rect(((Rect)(ref _productListPageRect)).x, ((Rect)(ref _productListPageRect)).y, 295f, 300f);
				}
				if (GUI.Button(new Rect(((Rect)(ref _productListPageRect)).width - 37f, 50f, 29f, 27f), _sortProductListPageByPrice ? "<b><color=#3ebf05>$</color></b>" : "$"))
				{
					_sortProductListPageByIngredientCount = false;
					_sortProductListPageByPrice = !_sortProductListPageByPrice;
					_productListPageScrollViewVector = Vector2.zero;
				}
				if (GUI.Button(new Rect(((Rect)(ref _productListPageRect)).width - 37f, 80f, 29f, 27f), _shouldShowDetailedView ? "<b><color=#3ebf05>DV</color></b>" : "DV"))
				{
					_shouldShowDetailedView = !_shouldShowDetailedView;
					if (_shouldShowDetailedView)
					{
						_productListPageRect = new Rect(((Rect)(ref _productListPageRect)).x, ((Rect)(ref _productListPageRect)).y, 400f, 300f);
					}
					else
					{
						_productListPageRect = new Rect(((Rect)(ref _productListPageRect)).x, ((Rect)(ref _productListPageRect)).y, 295f, 300f);
					}
				}
			}
			int num = 0;
			if (_shouldShowDetailedView)
			{
				if (_detailedListOfCreatedProducts.Count < _listOfCreatedProducts.Count)
				{
					Enumerator<ProductDefinition> enumerator = _listOfCreatedProducts.GetEnumerator();
					while (enumerator.MoveNext())
					{
						ProductDefinition product2 = enumerator.Current;
						if (!_detailedListOfCreatedProducts.Any((DetailedProduct bs) => (Object)(object)bs.Product == (Object)(object)product2))
						{
							_costToMakeDetailedProductList = 0f;
							_ingredientsNeededForCraft = 0;
							ProcessProducts(product2, isSelectedProductRecipe: true);
							_detailedListOfCreatedProducts.Add(new DetailedProduct
							{
								Product = product2,
								CostToMake = _costToMakeDetailedProductList,
								IngredientsNeededForCraft = _ingredientsNeededForCraft
							});
						}
					}
				}
				List<DetailedProduct> list = _detailedListOfCreatedProducts;
				if (_typeOfDrugToFilter != "")
				{
					list = list.Where(delegate(DetailedProduct bs)
					{
						//IL_0006: Unknown result type (might be due to invalid IL or missing references)
						//IL_000b: Unknown result type (might be due to invalid IL or missing references)
						EDrugType drugType2 = bs.Product.DrugType;
						return ((object)(EDrugType)(ref drugType2)).ToString() == _typeOfDrugToFilter;
					}).ToList();
				}
				if (GUI.Button(new Rect(((Rect)(ref _productListPageRect)).width - 37f, 110f, 29f, 27f), _sortProductListPageByIngredientCount ? "<b><color=#3ebf05>I</color></b>" : "I"))
				{
					_sortProductListPageByPrice = false;
					_sortProductListPageByIngredientCount = !_sortProductListPageByIngredientCount;
				}
				if (_sortProductListPageByIngredientCount)
				{
					list = list.OrderBy((DetailedProduct bs) => bs.IngredientsNeededForCraft).ToList();
				}
				else if (_sortProductListPageByPrice)
				{
					list = list.OrderByDescending((DetailedProduct bs) => bs.Product.MarketValue - bs.CostToMake).ToList();
				}
				_productListPageScrollViewVector = GUI.BeginScrollView(new Rect(10f, 20f, 420f, 300f), _productListPageScrollViewVector, new Rect(0f, 0f, 300f, (float)(list.Count * 20 + 20)));
				foreach (DetailedProduct item in list)
				{
					if (GUI.Button(new Rect(20f, (float)(20 * num), 160f, 20f), Translate(((ItemDefinition)item.Product).Name)))
					{
						_selectedBud = item.Product;
						_hasSelectedBud = true;
						_ingredientListRecipePage = null;
						_hasSelectedProductRecipe = false;
						_selectedProductRecipeIndex = 0;
					}
					if (GUI.Button(new Rect(0f, (float)(20 * num), 22f, 20f), "F"))
					{
						SetProductFav(((ItemDefinition)item.Product).ID, doFavorite: true);
					}
					GUI.Label(new Rect(185f, (float)(20 * num), ((Rect)(ref _productListPageRect)).width - 10f, 20f), $"{Translate("Profit")}: <b><color=#3ebf05>{item.Product.MarketValue - item.CostToMake}</color></b>  {Translate("Ingredients")}: <b><color=#ff3737>{item.IngredientsNeededForCraft}</color></b> ");
					num++;
				}
			}
			else
			{
				List<ProductDefinition> list2 = ((IEnumerable<ProductDefinition>)_listOfCreatedProducts.ToArray()).ToList();
				if (_typeOfDrugToFilter != "")
				{
					list2 = list2.Where(delegate(ProductDefinition product)
					{
						//IL_0001: Unknown result type (might be due to invalid IL or missing references)
						//IL_0006: Unknown result type (might be due to invalid IL or missing references)
						EDrugType drugType = product.DrugType;
						return ((object)(EDrugType)(ref drugType)).ToString() == _typeOfDrugToFilter;
					}).ToList();
				}
				if (_sortProductListPageByPrice)
				{
					list2 = list2.OrderByDescending((ProductDefinition product) => product.MarketValue).ToList();
				}
				_productListPageScrollViewVector = GUI.BeginScrollView(new Rect(55f, 20f, 420f, 300f), _productListPageScrollViewVector, new Rect(0f, 0f, 300f, (float)(list2.Count * 20 + 20)));
				foreach (ProductDefinition item2 in list2)
				{
					if (GUI.Button(new Rect(0f, (float)(20 * num), 160f, 20f), Translate(((Object)item2).name)))
					{
						_selectedBud = item2;
						_hasSelectedBud = true;
						_ingredientListRecipePage = null;
						_hasSelectedProductRecipe = false;
						_selectedProductRecipeIndex = 0;
					}
					GUI.Label(new Rect(165f, (float)(20 * num), ((Rect)(ref _productListPageRect)).width - 10f, 20f), $"<b><color=#3ebf05>{item2.MarketValue}</color></b>$");
					num++;
				}
			}
			GUI.EndScrollView();
			GUI.DragWindow(new Rect(20f, 10f, 500f, 500f));
		}

		private static void ProcessProducts(ProductDefinition product, bool isSelectedProductRecipe)
		{
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			if (!isSelectedProductRecipe && (Object)(object)product == (Object)(object)_selectedBud)
			{
				return;
			}
			GameObject val = GameObject.Find("@Product");
			if ((Object)(object)val == (Object)null)
			{
				return;
			}
			ProductManager component = val.GetComponent<ProductManager>();
			if ((Object)(object)component == (Object)null || product.Recipes.Count < 1 || component.DefaultKnownProducts.Contains(product))
			{
				return;
			}
			StationRecipe obj = ((IEnumerable<StationRecipe>)product.Recipes.ToArray()).ToList()[0];
			List<ProductDefinition> val2 = new List<ProductDefinition>();
			Enumerator<IngredientQuantity> enumerator = obj.Ingredients.GetEnumerator();
			while (enumerator.MoveNext())
			{
				IngredientQuantity current = enumerator.Current;
				EItemCategory category = current.Item.Category;
				string text = ((object)(EItemCategory)(ref category)).ToString();
				switch (text)
				{
				case "Consumable":
				case "Ingredient":
				{
					StorableItemDefinition val4 = ((Il2CppObjectBase)current.Item).TryCast<StorableItemDefinition>();
					if ((Object)(object)val4 != (Object)null)
					{
						_ingredientsNeededForCraft++;
						_costToMakeDetailedProductList += val4.BasePurchasePrice * (float)current.Quantity;
					}
					else
					{
						Melon<RecipeListGuiClass>.Logger.Msg("ERROR ProcessProducts: prop null " + text);
					}
					break;
				}
				case "Product":
				{
					ProductDefinition val3 = ((Il2CppObjectBase)current.Item).TryCast<ProductDefinition>();
					if ((Object)(object)val3 != (Object)null)
					{
						if (val3.Recipes.Count >= 1)
						{
							val2.Add(val3);
						}
					}
					else
					{
						Melon<RecipeListGuiClass>.Logger.Msg("ERROR ProcessProducts: Drug null " + text);
					}
					break;
				}
				default:
					Melon<RecipeListGuiClass>.Logger.Msg("ERROR ProcessProducts: Unknown Category " + text);
					break;
				}
			}
			Enumerator<ProductDefinition> enumerator2 = val2.GetEnumerator();
			while (enumerator2.MoveNext())
			{
				ProcessProducts(enumerator2.Current, isSelectedProductRecipe: false);
			}
		}

		private static void FavListPage(int windowID)
		{
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0207: Unknown result type (might be due to invalid IL or missing references)
			//IL_0250: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0281: Unknown result type (might be due to invalid IL or missing references)
			if (_shouldMinimizeFavListPage)
			{
				if (GUI.Button(new Rect(((Rect)(ref _favsListPageRect)).width - 25f, 2f, 18f, 17f), "+"))
				{
					_shouldMinimizeFavListPage = false;
					_favsListPageRect = new Rect(((Rect)(ref _favsListPageRect)).x, ((Rect)(ref _favsListPageRect)).y, 295f, 300f);
				}
				else
				{
					GUI.DragWindow(new Rect(20f, 10f, 500f, 500f));
				}
				return;
			}
			if (GUI.Button(new Rect(((Rect)(ref _favsListPageRect)).width - 25f, 2f, 17f, 17f), "-"))
			{
				_shouldMinimizeFavListPage = true;
				_favsListPageRect = new Rect(((Rect)(ref _favsListPageRect)).x, ((Rect)(ref _favsListPageRect)).y, 295f, 55f);
				return;
			}
			if (GUI.Button(new Rect(((Rect)(ref _favsListPageRect)).width - 37f, 20f, 29f, 27f), _sortFavListPageByPrice ? "<b><color=#3ebf05>$</color></b>" : "$"))
			{
				_sortFavListPageByPrice = !_sortFavListPageByPrice;
				_favsListPageScrollViewVector = Vector2.zero;
			}
			if (_listOf_FavsProducts == null)
			{
				_listOf_FavsProducts = GetlistOf_FavProducts();
			}
			if (_listOf_FavsProducts == null)
			{
				return;
			}
			List<ProductDefinition> list = ((IEnumerable<ProductDefinition>)_listOf_FavsProducts.ToArray()).ToList();
			if (_sortFavListPageByPrice)
			{
				list = list.OrderByDescending((ProductDefinition product) => product.MarketValue).ToList();
			}
			_favsListPageScrollViewVector = GUI.BeginScrollView(new Rect(10f, 20f, 300f, 300f), _favsListPageScrollViewVector, new Rect(0f, 0f, 300f, (float)(list.Count * 20 + 10)));
			int num = 0;
			foreach (ProductDefinition item in list)
			{
				if (GUI.Button(new Rect(45f, (float)(20 * num), 160f, 20f), Translate(((Object)item).name)))
				{
					_selectedBud = item;
					_hasSelectedBud = true;
					_ingredientListRecipePage = null;
					_hasSelectedProductRecipe = false;
					_selectedProductRecipeIndex = 0;
				}
				if (GUI.Button(new Rect(25f, (float)(20 * num), 22f, 20f), "X"))
				{
					SetProductFav(((ItemDefinition)item).ID, doFavorite: false);
				}
				GUI.Label(new Rect(209f, (float)(20 * num), 50f, 20f), $"<b><color=#3ebf05>{item.MarketValue}</color></b>$");
				num++;
			}
			GUI.EndScrollView();
			GUI.DragWindow(new Rect(20f, 10f, 500f, 500f));
		}

		private static void SetProductFav(string id, bool doFavorite)
		{
			GameObject val = GameObject.Find("@Product");
			if (!((Object)(object)val == (Object)null))
			{
				ProductManager component = val.GetComponent<ProductManager>();
				if (!((Object)(object)component == (Object)null))
				{
					component.SetProductFavourited(id, doFavorite);
				}
			}
		}

		private static void ProcessResize(Rect handleRect)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: 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_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: Expected I4, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
			Event current = Event.current;
			Vector2 mousePosition = current.mousePosition;
			Vector2 val = GUIUtility.GUIToScreenPoint(Event.current.mousePosition);
			EventType type = current.type;
			switch ((int)type)
			{
			case 0:
				if (((Rect)(ref handleRect)).Contains(mousePosition))
				{
					_isResizing = true;
					_initialMousePosition = val;
					_initialWindowRect = _recipeResultPageRect;
					current.Use();
				}
				break;
			case 3:
				if (_isResizing)
				{
					Vector2 val2 = val;
					float width = Mathf.Max(_minWindowSize.x, ((Rect)(ref _initialWindowRect)).width + (val2.x - _initialMousePosition.x));
					float height = Mathf.Max(_minWindowSize.y, ((Rect)(ref _initialWindowRect)).height + (val2.y - _initialMousePosition.y));
					((Rect)(ref _recipeResultPageRect)).width = width;
					((Rect)(ref _recipeResultPageRect)).height = height;
					current.Use();
				}
				break;
			case 1:
				if (_isResizing)
				{
					_isResizing = false;
					current.Use();
				}
				break;
			case 2:
				break;
			}
		}
	}
}