Decompiled source of ItemGiver v2.0.4

ItemGiver.dll

Decompiled a week ago
using System;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using Assets.Scripts.Inventory__Items__Pickups.Items;
using BepInEx;
using BepInEx.Core.Logging.Interpolation;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Il2CppInterop.Runtime.Injection;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace ItemGiverMod
{
	[BepInPlugin("anro_ItemGiver", "ItemGiver", "2.0.2")]
	public class Plugin : BasePlugin
	{
		public class ItemGiverUI : MonoBehaviour
		{
			public ItemGiverUI(IntPtr ptr)
				: base(ptr)
			{
			}

			private void Start()
			{
				Object.DontDestroyOnLoad((Object)(object)((Component)this).gameObject);
				log.LogInfo((object)"ItemGiver UI initialized!");
			}

			private void Update()
			{
				//IL_003d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0043: Expected O, but got Unknown
				if (Input.GetKeyDown((KeyCode)284))
				{
					showMenu = !showMenu;
					if (showMenu)
					{
						searchText = "";
					}
					ManualLogSource log = Plugin.log;
					bool flag = default(bool);
					BepInExInfoLogInterpolatedStringHandler val = new BepInExInfoLogInterpolatedStringHandler(10, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("Item menu ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(showMenu ? "opened" : "closed");
					}
					log.LogInfo(val);
				}
				if (showMenu)
				{
					HandleSearchInput();
				}
			}

			private void OnGUI()
			{
				//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
				//IL_00d0: Expected O, but got Unknown
				//IL_007e: Unknown result type (might be due to invalid IL or missing references)
				//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
				//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
				if (!showMenu)
				{
					return;
				}
				GameManager instance = GameManager.Instance;
				if ((Object)(object)instance == (Object)null)
				{
					return;
				}
				PlayerInventory playerInventory = instance.GetPlayerInventory();
				if (playerInventory == null)
				{
					return;
				}
				if (stylesInitialized && (Object)(object)backgroundTexture == (Object)null)
				{
					stylesInitialized = false;
				}
				if (!stylesInitialized)
				{
					InitializeStyles();
				}
				try
				{
					windowRect = GUI.Window(12345, windowRect, WindowFunction.op_Implicit((Action<int>)DrawWindow), "Item Giver v2.0 - Press F3 to close", windowStyle);
				}
				catch (Exception ex)
				{
					ManualLogSource log = Plugin.log;
					bool flag = default(bool);
					BepInExErrorLogInterpolatedStringHandler val = new BepInExErrorLogInterpolatedStringHandler(19, 1, ref flag);
					if (flag)
					{
						((BepInExLogInterpolatedStringHandler)val).AppendLiteral("GUI.Window failed: ");
						((BepInExLogInterpolatedStringHandler)val).AppendFormatted<string>(ex.Message);
					}
					log.LogError(val);
				}
			}
		}

		public const string MODNAME = "ItemGiver";

		public const string AUTHOR = "anro";

		public const string GUID = "anro_ItemGiver";

		public const string VERSION = "2.0.2";

		private static ManualLogSource log;

		private static bool showMenu = false;

		private static Vector2 scrollPosition = Vector2.zero;

		private static Rect windowRect = new Rect(50f, 50f, 750f, 700f);

		private static string searchText = "";

		private static Texture2D backgroundTexture;

		private static GUIStyle windowStyle;

		private static GUIStyle labelStyle;

		private static GUIStyle buttonStyle;

		private static GUIStyle searchBoxStyle;

		private static GUIStyle bigButtonStyle;

		private static bool stylesInitialized = false;

		private static EItem[] allItems;

		private static string[] itemNames;

		public Plugin()
		{
			log = ((BasePlugin)this).Log;
		}

		public override void Load()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_00aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Expected O, but got Unknown
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			ManualLogSource val = log;
			bool flag = default(bool);
			BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(14, 3, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Loading ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("ItemGiver");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" v");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("2.0.2");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" by ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("anro");
			}
			val.LogInfo(val2);
			allItems = (EItem[])Enum.GetValues(typeof(EItem));
			itemNames = Enum.GetNames(typeof(EItem));
			ClassInjector.RegisterTypeInIl2Cpp<ItemGiverUI>();
			((BasePlugin)this).AddComponent<ItemGiverUI>();
			ManualLogSource val3 = log;
			val2 = new BepInExInfoLogInterpolatedStringHandler(13, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Loaded ");
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(allItems.Length);
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" items");
			}
			val3.LogInfo(val2);
			ManualLogSource val4 = log;
			val2 = new BepInExInfoLogInterpolatedStringHandler(40, 1, ref flag);
			if (flag)
			{
				((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<string>("ItemGiver");
				((BepInExLogInterpolatedStringHandler)val2).AppendLiteral(" loaded! Press F3 to open the item menu.");
			}
			val4.LogInfo(val2);
		}

		private static void HandleSearchInput()
		{
			string inputString = Input.inputString;
			for (int i = 0; i < inputString.Length; i++)
			{
				char c = inputString[i];
				switch (c)
				{
				case '\b':
					if (searchText.Length > 0)
					{
						searchText = searchText.Substring(0, searchText.Length - 1);
					}
					break;
				default:
					if (c != '\r' && (char.IsLetterOrDigit(c) || c == ' '))
					{
						searchText += c;
					}
					break;
				case '\n':
					break;
				}
			}
		}

		private static void InitializeStyles()
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Expected O, but got Unknown
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Expected O, but got Unknown
			//IL_0086: 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_00b2: Expected O, but got Unknown
			//IL_00bc: 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_00e8: Expected O, but got Unknown
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0114: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Expected O, but got Unknown
			//IL_0128: 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_016c: Expected O, but got Unknown
			//IL_0176: Unknown result type (might be due to invalid IL or missing references)
			backgroundTexture = new Texture2D(1, 1);
			backgroundTexture.SetPixel(0, 0, new Color(0.15f, 0.15f, 0.15f, 0.95f));
			backgroundTexture.Apply();
			windowStyle = new GUIStyle(GUI.skin.window);
			windowStyle.normal.background = backgroundTexture;
			windowStyle.onNormal.background = backgroundTexture;
			windowStyle.normal.textColor = Color.white;
			windowStyle.fontSize = 14;
			labelStyle = new GUIStyle(GUI.skin.label);
			labelStyle.normal.textColor = Color.white;
			labelStyle.fontSize = 13;
			buttonStyle = new GUIStyle(GUI.skin.button);
			buttonStyle.normal.textColor = Color.white;
			buttonStyle.fontSize = 12;
			bigButtonStyle = new GUIStyle(GUI.skin.button);
			bigButtonStyle.normal.textColor = Color.white;
			bigButtonStyle.fontSize = 11;
			bigButtonStyle.fontStyle = (FontStyle)1;
			bigButtonStyle.alignment = (TextAnchor)4;
			searchBoxStyle = new GUIStyle(GUI.skin.box);
			searchBoxStyle.normal.textColor = Color.white;
			searchBoxStyle.fontSize = 13;
			stylesInitialized = true;
		}

		private static void DrawWindow(int windowID)
		{
			//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d3: Expected O, but got Unknown
			//IL_0016: 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_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_0093: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: 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_012f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0203: Unknown result type (might be due to invalid IL or missing references)
			//IL_0209: Unknown result type (might be due to invalid IL or missing references)
			//IL_020f: Expected O, but got Unknown
			//IL_0215: 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_0257: Unknown result type (might be due to invalid IL or missing references)
			//IL_029a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: 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_035f: 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_0368: Unknown result type (might be due to invalid IL or missing references)
			//IL_036d: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0563: Unknown result type (might be due to invalid IL or missing references)
			//IL_056a: Expected O, but got Unknown
			//IL_058a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_03e4: Expected O, but got Unknown
			//IL_03f0: 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_0432: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_046e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				GUI.DragWindow(new Rect(0f, 0f, 10000f, 20f));
				int num = 25;
				GUI.Label(new Rect(10f, (float)num, 730f, 20f), "\ud83c\udf81 Bulk Actions:", labelStyle);
				num += 22;
				if (GUI.Button(new Rect(10f, (float)num, 140f, 28f), "Give All Items x1", bigButtonStyle))
				{
					GiveAllItems();
				}
				if (GUI.Button(new Rect(160f, (float)num, 140f, 28f), "All Legendary x1", bigButtonStyle))
				{
					GiveItemsByRarity((EItemRarity)3);
				}
				if (GUI.Button(new Rect(310f, (float)num, 140f, 28f), "All Epic x1", bigButtonStyle))
				{
					GiveItemsByRarity((EItemRarity)2);
				}
				if (GUI.Button(new Rect(460f, (float)num, 140f, 28f), "All Rare x1", bigButtonStyle))
				{
					GiveItemsByRarity((EItemRarity)1);
				}
				if (GUI.Button(new Rect(610f, (float)num, 130f, 28f), "All Common x1", bigButtonStyle))
				{
					GiveItemsByRarity((EItemRarity)0);
				}
				num += 35;
				GUI.Box(new Rect(10f, (float)num, 730f, 2f), "");
				num += 7;
				GUI.Label(new Rect(10f, (float)num, 60f, 25f), "Search:", labelStyle);
				GUI.Box(new Rect(75f, (float)num, 540f, 25f), "");
				string text = (string.IsNullOrEmpty(searchText) ? "Type to search..." : searchText);
				Color textColor = (Color)(string.IsNullOrEmpty(searchText) ? new Color(0.6f, 0.6f, 0.6f) : Color.white);
				GUIStyle val = new GUIStyle(labelStyle);
				val.normal.textColor = textColor;
				GUI.Label(new Rect(80f, (float)(num + 1), 530f, 23f), text + "_", val);
				if (GUI.Button(new Rect(625f, (float)num, 80f, 25f), "Clear", buttonStyle))
				{
					searchText = "";
				}
				num += 30;
				EItem[] filteredItems = GetFilteredItems();
				GUI.Label(new Rect(10f, (float)num, 730f, 20f), $"Found {filteredItems.Length} of {allItems.Length} items - Type letters to filter", labelStyle);
				num += 22;
				GUI.Box(new Rect(10f, (float)num, 730f, 2f), "");
				num += 5;
				Rect val2 = default(Rect);
				((Rect)(ref val2))..ctor(10f, (float)num, 730f, 415f);
				Rect val3 = default(Rect);
				((Rect)(ref val3))..ctor(0f, 0f, 700f, (float)(filteredItems.Length * 30));
				scrollPosition = GUI.BeginScrollView(val2, scrollPosition, val3, false, true);
				int num2 = 0;
				for (int i = 0; i < filteredItems.Length; i++)
				{
					int itemIndex = Array.IndexOf(allItems, filteredItems[i]);
					if (i % 2 == 0)
					{
						GUI.Box(new Rect(0f, (float)num2, 700f, 28f), "", GUI.skin.box);
					}
					string itemNameWithRarity = GetItemNameWithRarity(filteredItems[i], itemIndex);
					GUIStyle val4 = new GUIStyle(labelStyle);
					val4.normal.textColor = GetRarityColor(filteredItems[i]);
					GUI.Label(new Rect(10f, (float)(num2 + 2), 300f, 25f), itemNameWithRarity, val4);
					if (GUI.Button(new Rect(320f, (float)(num2 + 2), 70f, 24f), "+1", buttonStyle))
					{
						GiveItem(filteredItems[i], 1);
					}
					if (GUI.Button(new Rect(400f, (float)(num2 + 2), 70f, 24f), "+5", buttonStyle))
					{
						GiveItem(filteredItems[i], 5);
					}
					if (GUI.Button(new Rect(480f, (float)(num2 + 2), 70f, 24f), "+10", buttonStyle))
					{
						GiveItem(filteredItems[i], 10);
					}
					if (GUI.Button(new Rect(560f, (float)(num2 + 2), 70f, 24f), "+50", buttonStyle))
					{
						GiveItem(filteredItems[i], 50);
					}
					num2 += 30;
				}
				GUI.EndScrollView();
				num += 420;
				GUI.Box(new Rect(10f, (float)num, 730f, 2f), "");
				GUIStyle val5 = new GUIStyle(labelStyle);
				val5.fontSize = 11;
				val5.normal.textColor = new Color(0.8f, 0.8f, 0.8f);
				GUI.Label(new Rect(10f, (float)(num + 5), 730f, 25f), "\ud83d\udca1 Type to search • Backspace to delete • Drag title bar • F3 to close", val5);
			}
			catch (Exception ex)
			{
				ManualLogSource val6 = log;
				bool flag = default(bool);
				BepInExErrorLogInterpolatedStringHandler val7 = new BepInExErrorLogInterpolatedStringHandler(18, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val7).AppendLiteral("DrawWindow error: ");
					((BepInExLogInterpolatedStringHandler)val7).AppendFormatted<string>(ex.Message);
				}
				val6.LogError(val7);
			}
		}

		private static string GetItemNameWithRarity(EItem item, int itemIndex)
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected I4, but got Unknown
			try
			{
				DataManager instance = DataManager.Instance;
				if ((Object)(object)instance == (Object)null)
				{
					return itemNames[itemIndex];
				}
				ItemData item2 = instance.GetItem(item);
				if ((Object)(object)item2 == (Object)null)
				{
					return itemNames[itemIndex];
				}
				string text = "";
				EItemRarity rarity = item2.rarity;
				EItemRarity val = rarity;
				switch ((int)val)
				{
				case 3:
					text = " [L]";
					break;
				case 2:
					text = " [E]";
					break;
				case 1:
					text = " [R]";
					break;
				case 0:
					text = " [C]";
					break;
				case 4:
					text = " [X]";
					break;
				case 5:
					text = " [Q]";
					break;
				}
				return itemNames[itemIndex] + text;
			}
			catch
			{
				return itemNames[itemIndex];
			}
		}

		private static Color GetRarityColor(EItem item)
		{
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Expected I4, but got Unknown
			//IL_0033: 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_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: 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_00f8: 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)
			try
			{
				DataManager instance = DataManager.Instance;
				if ((Object)(object)instance == (Object)null)
				{
					return Color.white;
				}
				ItemData item2 = instance.GetItem(item);
				if ((Object)(object)item2 == (Object)null)
				{
					return Color.white;
				}
				EItemRarity rarity = item2.rarity;
				EItemRarity val = rarity;
				return (Color)((int)val switch
				{
					3 => new Color(1f, 0.84f, 0f), 
					2 => new Color(0.64f, 0.21f, 0.93f), 
					1 => new Color(0.25f, 0.55f, 1f), 
					0 => new Color(0.8f, 0.8f, 0.8f), 
					4 => new Color(0.9f, 0.2f, 0.2f), 
					5 => new Color(0.2f, 1f, 0.5f), 
					_ => Color.white, 
				});
			}
			catch
			{
				return Color.white;
			}
		}

		private static void GiveAllItems()
		{
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0134: Expected O, but got Unknown
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			try
			{
				GameManager instance = GameManager.Instance;
				if ((Object)(object)instance == (Object)null)
				{
					log.LogWarning((object)"GameManager not found!");
					return;
				}
				PlayerInventory playerInventory = instance.GetPlayerInventory();
				if (playerInventory == null)
				{
					log.LogWarning((object)"Player inventory not found!");
					return;
				}
				DataManager instance2 = DataManager.Instance;
				if ((Object)(object)instance2 == (Object)null)
				{
					log.LogWarning((object)"DataManager not found!");
					return;
				}
				int num = 0;
				EItem[] array = allItems;
				foreach (EItem val in array)
				{
					try
					{
						ItemData item = instance2.GetItem(val);
						if ((Object)(object)item != (Object)null)
						{
							playerInventory.itemInventory.AddItem(val, 1);
							num++;
						}
					}
					catch
					{
					}
				}
				ManualLogSource val2 = log;
				BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(21, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Gave 1 of all ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(num);
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" items!");
				}
				val2.LogInfo(val3);
			}
			catch (Exception ex)
			{
				ManualLogSource val4 = log;
				BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(26, 1, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Failed to give all items: ");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message);
				}
				val4.LogError(val5);
			}
		}

		private static void GiveItemsByRarity(EItemRarity targetRarity)
		{
			//IL_0152: Unknown result type (might be due to invalid IL or missing references)
			//IL_0159: Expected O, but got Unknown
			//IL_016c: 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_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Expected O, but got Unknown
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			try
			{
				GameManager instance = GameManager.Instance;
				if ((Object)(object)instance == (Object)null)
				{
					log.LogWarning((object)"GameManager not found!");
					return;
				}
				PlayerInventory playerInventory = instance.GetPlayerInventory();
				if (playerInventory == null)
				{
					log.LogWarning((object)"Player inventory not found!");
					return;
				}
				DataManager instance2 = DataManager.Instance;
				if ((Object)(object)instance2 == (Object)null)
				{
					log.LogWarning((object)"DataManager not found!");
					return;
				}
				int num = 0;
				EItem[] array = allItems;
				foreach (EItem val in array)
				{
					try
					{
						ItemData item = instance2.GetItem(val);
						if ((Object)(object)item != (Object)null && item.rarity == targetRarity)
						{
							playerInventory.itemInventory.AddItem(val, 1);
							num++;
						}
					}
					catch
					{
					}
				}
				ManualLogSource val2 = log;
				BepInExInfoLogInterpolatedStringHandler val3 = new BepInExInfoLogInterpolatedStringHandler(13, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral("Gave ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<int>(num);
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" ");
					((BepInExLogInterpolatedStringHandler)val3).AppendFormatted<EItemRarity>(targetRarity);
					((BepInExLogInterpolatedStringHandler)val3).AppendLiteral(" items!");
				}
				val2.LogInfo(val3);
			}
			catch (Exception ex)
			{
				ManualLogSource val4 = log;
				BepInExErrorLogInterpolatedStringHandler val5 = new BepInExErrorLogInterpolatedStringHandler(23, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral("Failed to give ");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<EItemRarity>(targetRarity);
					((BepInExLogInterpolatedStringHandler)val5).AppendLiteral(" items: ");
					((BepInExLogInterpolatedStringHandler)val5).AppendFormatted<string>(ex.Message);
				}
				val4.LogError(val5);
			}
		}

		private static EItem[] GetFilteredItems()
		{
			if (string.IsNullOrEmpty(searchText))
			{
				return allItems;
			}
			return allItems.Where((EItem item, int index) => itemNames[index].ToLower().Contains(searchText.ToLower())).ToArray();
		}

		private static void GiveItem(EItem item, int count)
		{
			//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00d4: 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_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Expected O, but got Unknown
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			bool flag = default(bool);
			try
			{
				GameManager instance = GameManager.Instance;
				if ((Object)(object)instance == (Object)null)
				{
					log.LogWarning((object)"GameManager not found!");
					return;
				}
				PlayerInventory playerInventory = instance.GetPlayerInventory();
				if (playerInventory == null)
				{
					log.LogWarning((object)"Player inventory not found!");
					return;
				}
				playerInventory.itemInventory.AddItem(item, count);
				ManualLogSource val = log;
				BepInExInfoLogInterpolatedStringHandler val2 = new BepInExInfoLogInterpolatedStringHandler(7, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("Gave ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<int>(count);
					((BepInExLogInterpolatedStringHandler)val2).AppendLiteral("x ");
					((BepInExLogInterpolatedStringHandler)val2).AppendFormatted<EItem>(item);
				}
				val.LogInfo(val2);
			}
			catch (Exception ex)
			{
				ManualLogSource val3 = log;
				BepInExErrorLogInterpolatedStringHandler val4 = new BepInExErrorLogInterpolatedStringHandler(22, 2, ref flag);
				if (flag)
				{
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral("Failed to give item ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<EItem>(item);
					((BepInExLogInterpolatedStringHandler)val4).AppendLiteral(": ");
					((BepInExLogInterpolatedStringHandler)val4).AppendFormatted<string>(ex.Message);
				}
				val3.LogError(val4);
			}
		}
	}
}