Decompiled source of EasySpawner v1.6.1

EasySpawner.dll

Decompiled a year ago
using System;
using System.Collections;
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 System.Threading.Tasks;
using BepInEx;
using BepInEx.Configuration;
using EasySpawner.Config;
using EasySpawner.UI;
using HarmonyLib;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("EasySpawner")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("EasySpawner")]
[assembly: AssemblyCopyright("Copyright ©  2021")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d575372d-3e88-42f8-b234-bf555c7016d6")]
[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 EasySpawner
{
	[BepInPlugin("cooley.easyspawner", "Easy Spawner", "1.6.1")]
	[BepInProcess("valheim.exe")]
	public class EasySpawnerPlugin : BaseUnityPlugin
	{
		private static AssetBundle menuAssetBundle;

		public static GameObject menuPrefab;

		public static GameObject menuGameObject;

		public static EasySpawnerMenu menu = new EasySpawnerMenu();

		public static EasySpawnerConfig config = new EasySpawnerConfig();

		public static List<string> prefabNames = new List<string>();

		private static List<string> playerNames = new List<string>();

		public static Stack<List<GameObject>> spawnActions = new Stack<List<GameObject>>();

		public const string assetBundleName = "EasySpawnerAssetBundle";

		public const string favouritesFileName = "cooley.easyspawner.favouriteItems.txt";

		public Harmony harmony;

		private void Awake()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			Debug.Log((object)"Easy spawner: Easy spawner loaded plugin");
			harmony = new Harmony("cooley.easyspawner");
			harmony.PatchAll();
			config.ConfigFile = ((BaseUnityPlugin)this).Config;
			config.SetupConfig();
		}

		private void Update()
		{
			if (!Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				return;
			}
			if (config.IfMenuHotkeyPressed())
			{
				if (!Object.op_Implicit((Object)(object)menuGameObject))
				{
					CreateMenu();
				}
				else
				{
					menuGameObject.SetActive(!menuGameObject.activeSelf);
				}
			}
			else if (Object.op_Implicit((Object)(object)menuGameObject))
			{
				if (config.IfSpawnHotkeyPressed())
				{
					Debug.Log((object)"Spawn hotkey pressed");
					((UnityEvent)menu.SpawnButton.onClick).Invoke();
				}
				else if (config.IfUndoHotkeyPressed() && spawnActions.Count > 0)
				{
					UndoSpawn();
				}
			}
		}

		public static AssetBundle GetAssetBundleFromResources(string fileName)
		{
			Assembly executingAssembly = Assembly.GetExecutingAssembly();
			string name = executingAssembly.GetManifestResourceNames().Single((string str) => str.EndsWith(fileName));
			using Stream stream = executingAssembly.GetManifestResourceStream(name);
			return AssetBundle.LoadFromStream(stream);
		}

		public static void LoadAsset(string assetFileName)
		{
			if (Object.op_Implicit((Object)(object)menuAssetBundle))
			{
				Debug.Log((object)"Easy spawner: menu asset bundle already loaded");
				return;
			}
			menuAssetBundle = GetAssetBundleFromResources(assetFileName);
			if (Object.op_Implicit((Object)(object)menuAssetBundle))
			{
				Debug.Log((object)"Easy spawner: menu asset bundle loaded");
			}
			else
			{
				Debug.Log((object)"Easy spawner: menu asset bundle failed to load");
			}
		}

		public static string GetFavouritesFilePath()
		{
			return Path.Combine(Paths.ConfigPath, "cooley.easyspawner.favouriteItems.txt");
		}

		public static void LoadFavourites()
		{
			Debug.Log((object)("Easy spawner: load favourite Items from file: " + GetFavouritesFilePath()));
			if (!File.Exists(GetFavouritesFilePath()))
			{
				return;
			}
			using StreamReader streamReader = File.OpenText(GetFavouritesFilePath());
			while (!streamReader.EndOfStream)
			{
				string text = streamReader.ReadLine();
				if (text == null || !EasySpawnerMenu.PrefabStates.ContainsKey(text))
				{
					Debug.Log((object)("Easy spawner: favourite prefab '" + text + "' not found"));
				}
				else
				{
					EasySpawnerMenu.PrefabStates[text].isFavourite = true;
				}
			}
		}

		public static void SaveFavourites()
		{
			Debug.Log((object)("Easy spawner: save favourite Items to file: " + GetFavouritesFilePath()));
			using StreamWriter streamWriter = File.CreateText(GetFavouritesFilePath());
			foreach (KeyValuePair<string, PrefabState> prefabState in EasySpawnerMenu.PrefabStates)
			{
				if (prefabState.Value.isFavourite)
				{
					streamWriter.WriteLine(prefabState.Key);
				}
			}
		}

		private void CreateMenu()
		{
			//IL_010c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)"Easy spawner: Loading menu prefab");
			if (!Object.op_Implicit((Object)(object)menuAssetBundle))
			{
				Debug.Log((object)"EasySpawner: Asset bundle not loaded");
				return;
			}
			if (!Object.op_Implicit((Object)(object)menuPrefab))
			{
				menuPrefab = menuAssetBundle.LoadAsset<GameObject>("EasySpawnerMenu");
			}
			if (!Object.op_Implicit((Object)(object)menuPrefab))
			{
				Debug.Log((object)"Easy spawner: Loading menu prefab failed");
				return;
			}
			Debug.Log((object)"Easy spawner: Successfully loaded menu prefab");
			if (!Object.op_Implicit((Object)(object)menuPrefab.GetComponent<UIElementDragger>()))
			{
				menuPrefab.AddComponent<UIElementDragger>();
			}
			menuGameObject = Object.Instantiate<GameObject>(menuPrefab);
			GameObject val = GameObject.Find("IngameGui");
			if (!Object.op_Implicit((Object)(object)val))
			{
				Debug.Log((object)"Easy spawner: Couldnt find UI gameobject");
				return;
			}
			menuGameObject.transform.SetParent(val.transform);
			menuGameObject.transform.localScale = new Vector3(1f, 1f, 1f);
			menuGameObject.transform.localPosition = new Vector3(-650f, 0f, 0f);
			playerNames = GetPlayerNames();
			menu.CreateMenu(menuGameObject);
			Style.ApplyAll(menuGameObject, menu);
			((MonoBehaviour)menuGameObject.GetComponent<UIElementDragger>()).StartCoroutine(CheckForNewPlayersCoroutine());
		}

		public static void SpawnPrefab(string prefabName, Player player, int amount = 1, int level = 1, bool pickup = false, bool ignoreStackSize = false)
		{
			//IL_0088: 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_009d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: 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_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_0280: 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_028f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			Debug.Log((object)("Easy spawner: Trying to spawn " + prefabName));
			GameObject prefab = ZNetScene.instance.GetPrefab(prefabName);
			if (!Object.op_Implicit((Object)(object)prefab))
			{
				((Character)Player.m_localPlayer).Message((MessageType)1, prefabName + " does not exist", 0, (Sprite)null);
				Debug.Log((object)("Easy spawner: spawning " + prefabName + " failed"));
				return;
			}
			List<GameObject> list = new List<GameObject>();
			if (Object.op_Implicit((Object)(object)prefab.GetComponent<Character>()))
			{
				for (int i = 0; i < amount; i++)
				{
					GameObject val = Object.Instantiate<GameObject>(prefab, ((Component)player).transform.position + ((Component)player).transform.forward * 2f + Vector3.up, Quaternion.identity);
					Character component = val.GetComponent<Character>();
					if (level > 1)
					{
						component.SetLevel(level);
					}
					list.Add(val);
				}
			}
			else if (Object.op_Implicit((Object)(object)prefab.GetComponent<ItemDrop>()))
			{
				ItemDrop component2 = prefab.GetComponent<ItemDrop>();
				if (component2.m_itemData.IsEquipable())
				{
					if (ignoreStackSize)
					{
						component2.m_itemData.m_stack = amount;
						amount = 1;
					}
					component2.m_itemData.m_quality = level;
					component2.m_itemData.m_durability = component2.m_itemData.GetMaxDurability();
					for (int j = 0; j < amount; j++)
					{
						list.Add(SpawnItem(pickup, prefab, player));
					}
				}
				else
				{
					int num = 1;
					int num2 = 0;
					if (ignoreStackSize)
					{
						component2.m_itemData.m_stack = amount;
					}
					else
					{
						int num3 = component2.m_itemData.m_shared.m_maxStackSize;
						if (num3 < 1)
						{
							num3 = 1;
						}
						component2.m_itemData.m_stack = num3;
						num = amount / num3;
						num2 = amount % num3;
					}
					for (int k = 0; k < num; k++)
					{
						list.Add(SpawnItem(pickup, prefab, player));
					}
					if (num2 != 0)
					{
						component2.m_itemData.m_stack = num2;
						list.Add(SpawnItem(pickup, prefab, player));
					}
				}
				component2.m_itemData.m_stack = 1;
				component2.m_itemData.m_quality = 1;
			}
			else
			{
				for (int l = 0; l < amount; l++)
				{
					list.Add(Object.Instantiate<GameObject>(prefab, ((Component)player).transform.position + ((Component)player).transform.forward * 2f, Quaternion.identity));
				}
			}
			spawnActions.Push(list);
			((Character)Player.m_localPlayer).Message((MessageType)1, "Spawning object " + prefabName, 0, (Sprite)null);
			Debug.Log((object)("Easy spawner: Spawned " + amount + " " + prefabName));
		}

		private static GameObject SpawnItem(bool pickup, GameObject prefab, Player player)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: 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_003a: 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_0049: Unknown result type (might be due to invalid IL or missing references)
			if (pickup)
			{
				((Humanoid)Player.m_localPlayer).PickupPrefab(prefab, 0, true);
				return null;
			}
			return Object.Instantiate<GameObject>(prefab, ((Component)player).transform.position + ((Component)player).transform.forward * 2f + Vector3.up, Quaternion.identity);
		}

		private void UndoSpawn()
		{
			Debug.Log((object)"Easyspawner: Undo spawn action");
			if (spawnActions.Count <= 0)
			{
				return;
			}
			List<GameObject> list = spawnActions.Pop();
			Debug.Log((object)("Easyspawner: Destroying " + list.Count + " objects"));
			string text = "objects";
			foreach (GameObject item in list)
			{
				if ((Object)(object)item != (Object)null)
				{
					text = ((Object)item).name.Remove(((Object)item).name.Length - 7);
					ZNetView component = item.GetComponent<ZNetView>();
					if (Object.op_Implicit((Object)(object)component) && component.IsValid() && component.IsOwner())
					{
						component.Destroy();
					}
				}
			}
			((Character)Player.m_localPlayer).Message((MessageType)2, "Undo spawn of " + list.Count + " " + text, 0, (Sprite)null);
			Debug.Log((object)"Easyspawner: Spawn undone");
		}

		private List<string> GetPlayerNames()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			List<string> list = new List<string>();
			if (Object.op_Implicit((Object)(object)ZNet.instance))
			{
				foreach (PlayerInfo player in ZNet.instance.GetPlayerList())
				{
					list.Add(player.m_name);
				}
			}
			return list;
		}

		private void PlayerListChanged()
		{
			Debug.Log((object)"EasySpawner: Player list changed, updating player dropdown");
			playerNames = GetPlayerNames();
			menu.RebuildPlayerDropdown();
		}

		private IEnumerator CheckForNewPlayersCoroutine()
		{
			Debug.Log((object)"EasySpawner: Starting check for new players coroutine");
			while (Object.op_Implicit((Object)(object)menuGameObject))
			{
				yield return (object)new WaitForSeconds(3f);
				if (!menuGameObject.activeSelf || !Object.op_Implicit((Object)(object)ZNet.instance) || !Object.op_Implicit((Object)(object)Player.m_localPlayer))
				{
					continue;
				}
				List<string> newPlayerNames = GetPlayerNames();
				if (newPlayerNames.Count != playerNames.Count)
				{
					PlayerListChanged();
					continue;
				}
				foreach (string name in newPlayerNames)
				{
					if (!playerNames.Contains(name))
					{
						PlayerListChanged();
						break;
					}
				}
			}
			Debug.Log((object)"EasySpawner: Stopping check for new players coroutine");
		}

		public static void DestroyMenu()
		{
			Debug.Log((object)"Easy spawner: Easy spawner unloading assets");
			if (Object.op_Implicit((Object)(object)menuGameObject))
			{
				menu.Destroy();
				Object.Destroy((Object)(object)menuGameObject);
			}
			menuPrefab = null;
			if (Object.op_Implicit((Object)(object)menuAssetBundle))
			{
				menuAssetBundle.Unload(true);
			}
			Debug.Log((object)"Easy spawner: Easy spawner unloaded assets");
		}

		private void OnDestroy()
		{
			((MonoBehaviour)this).StopAllCoroutines();
			if ((Object)(object)menuGameObject != (Object)null)
			{
				DestroyMenu();
			}
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
}
namespace EasySpawner.UI
{
	public class EasySpawnerMenu
	{
		public Dropdown PlayerDropdown;

		public InputField SearchField;

		public InputField AmountField;

		public InputField LevelField;

		public Toggle PutInInventoryToggle;

		public Toggle IgnoreStackSizeToggle;

		public Toggle FavouritesOnlyToggle;

		public Button SpawnButton;

		public Text SpawnText;

		public Text UndoText;

		public Text CloseText;

		public ScrollRect PrefabScrollView;

		public PrefabItem[] PrefabItems;

		public Queue<PrefabItem> PrefabItemPool = new Queue<PrefabItem>();

		public string SelectedPrefabName;

		public static Dictionary<string, PrefabState> PrefabStates = new Dictionary<string, PrefabState>();

		public List<string> SearchItems = new List<string>();

		public void CreateMenu(GameObject menuGameObject)
		{
			//IL_0140: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Expected O, but got Unknown
			PlayerDropdown = ((Component)menuGameObject.transform.Find("PlayerDropdown")).GetComponent<Dropdown>();
			PrefabScrollView = ((Component)menuGameObject.transform.Find("PrefabScrollView")).GetComponent<ScrollRect>();
			SearchField = ((Component)menuGameObject.transform.Find("SearchInputField")).GetComponent<InputField>();
			((UnityEvent<string>)(object)SearchField.onValueChanged).AddListener((UnityAction<string>)delegate
			{
				RebuildPrefabDropdown();
			});
			AmountField = ((Component)menuGameObject.transform.Find("AmountInputField")).GetComponent<InputField>();
			LevelField = ((Component)menuGameObject.transform.Find("LevelInputField")).GetComponent<InputField>();
			PutInInventoryToggle = ((Component)menuGameObject.transform.Find("PutInInventoryToggle")).GetComponent<Toggle>();
			IgnoreStackSizeToggle = ((Component)menuGameObject.transform.Find("IgnoreStackSizeToggle")).GetComponent<Toggle>();
			FavouritesOnlyToggle = ((Component)menuGameObject.transform.Find("FavouritesOnlyToggle")).GetComponent<Toggle>();
			((UnityEvent<bool>)(object)FavouritesOnlyToggle.onValueChanged).AddListener((UnityAction<bool>)delegate
			{
				RebuildPrefabDropdown();
			});
			SpawnButton = ((Component)menuGameObject.transform.Find("SpawnButton")).GetComponent<Button>();
			((UnityEvent)SpawnButton.onClick).AddListener(new UnityAction(SpawnButtonPress));
			Transform val = menuGameObject.transform.Find("HotkeyText");
			SpawnText = ((Component)val.Find("SpawnText")).GetComponent<Text>();
			UndoText = ((Component)val.Find("UndoText")).GetComponent<Text>();
			CloseText = ((Component)val.Find("CloseText")).GetComponent<Text>();
			EasySpawnerConfig config = EasySpawnerPlugin.config;
			if (config.SpawnHotkeyModifierSet)
			{
				SpawnText.text = "Spawn: " + config.FirstSpawnHotkeyModifier.Value + " + " + config.FirstSpawnHotkey.Value;
			}
			else
			{
				SpawnText.text = "Spawn: " + config.FirstSpawnHotkey.Value;
			}
			if (config.UndoHotkeyModifierSet)
			{
				UndoText.text = "Undo: " + config.UndoHotkeyModifier.Value + " + " + config.UndoHotkey.Value;
			}
			else
			{
				UndoText.text = "Undo: " + config.UndoHotkey.Value;
			}
			if (config.OpenHotkeyModifierSet)
			{
				CloseText.text = "Open: " + config.FirstOpenHotkeyModifier.Value + " + " + config.FirstOpenHotkey.Value;
			}
			else
			{
				CloseText.text = "Open: " + config.FirstOpenHotkey.Value;
			}
			UpdateMenuSize(null, null);
			config.UIWidth.SettingChanged += UpdateMenuSize;
			PlayerDropdown.ClearOptions();
			RebuildPlayerDropdown();
			PrefabItems = new PrefabItem[20];
			PrefabItem prefabItem = ((Component)((Transform)PrefabScrollView.content).GetChild(0)).gameObject.AddComponent<PrefabItem>();
			((Component)prefabItem).gameObject.SetActive(false);
			for (int i = 0; i < 20; i++)
			{
				GameObject val2 = Object.Instantiate<GameObject>(((Component)prefabItem).gameObject, (Transform)(object)PrefabScrollView.content);
				PrefabItem component = val2.GetComponent<PrefabItem>();
				component.Init(SelectPrefab, FavouritePrefab);
				PoolPrefabItem(component);
				PrefabItems[i] = component;
			}
			((UnityEvent<Vector2>)(object)PrefabScrollView.onValueChanged).AddListener((UnityAction<Vector2>)UpdateItemPrefabPool);
			RebuildPrefabDropdown();
		}

		private void UpdateMenuSize(object sender, EventArgs e)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0022: 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)
			RectTransform val = (RectTransform)EasySpawnerPlugin.menuGameObject.transform;
			val.sizeDelta = new Vector2(EasySpawnerPlugin.config.UIWidth.Value, val.sizeDelta.y);
		}

		public void PoolPrefabItem(PrefabItem item)
		{
			item.Pool();
			PrefabItemPool.Enqueue(item);
		}

		public void PoolAllPrefabItems()
		{
			PrefabItem[] prefabItems = PrefabItems;
			foreach (PrefabItem item in prefabItems)
			{
				if (!PrefabItemPool.Contains(item))
				{
					PoolPrefabItem(item);
				}
			}
		}

		public void UpdateItemPrefabPool(Vector2 slider)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: 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_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0184: Unknown result type (might be due to invalid IL or missing references)
			PrefabScrollView.content.SetSizeWithCurrentAnchors((Axis)1, (float)(SearchItems.Count - 1) * 20f);
			Rect rect = ((Component)PrefabScrollView).GetComponent<RectTransform>().rect;
			Vector2 anchoredPosition = PrefabScrollView.content.anchoredPosition;
			PrefabItem[] prefabItems = PrefabItems;
			foreach (PrefabItem prefabItem in prefabItems)
			{
				if (!PrefabItemPool.Contains(prefabItem))
				{
					float y = prefabItem.rectTransform.anchoredPosition.y;
					if (y > 0f - anchoredPosition.y + 20f || y < 0f - anchoredPosition.y - ((Rect)(ref rect)).height - 20f)
					{
						PoolPrefabItem(prefabItem);
					}
				}
			}
			int num = Mathf.Max(0, Mathf.CeilToInt((anchoredPosition.y - 20f) / 20f));
			int num2 = Mathf.CeilToInt((((Rect)(ref rect)).height + 40f) / 20f);
			int i;
			for (i = num; i < Mathf.Min(num + num2, SearchItems.Count); i++)
			{
				if (!PrefabItems.Any((PrefabItem x) => x.posIndex == i) && PrefabItemPool.Count > 0)
				{
					PrefabItem prefabItem2 = PrefabItemPool.Dequeue();
					prefabItem2.rectTransform.anchoredPosition = new Vector2(0f, (float)(-i * 20) - 10f);
					prefabItem2.posIndex = i;
					prefabItem2.SetName(SearchItems[i]);
					prefabItem2.toggle.SetIsOnWithoutNotify(SelectedPrefabName == prefabItem2.GetName());
					prefabItem2.SetFavouriteOn(PrefabStates[prefabItem2.GetName()].isFavourite, silent: true);
					((Component)prefabItem2).gameObject.SetActive(true);
				}
			}
		}

		private void SelectPrefab(PrefabItem caller)
		{
			PrefabItem[] prefabItems = PrefabItems;
			foreach (PrefabItem prefabItem in prefabItems)
			{
				prefabItem.toggle.SetIsOnWithoutNotify((Object)(object)prefabItem == (Object)(object)caller);
			}
			SelectedPrefabName = (((Object)(object)caller != (Object)null) ? caller.GetName() : null);
		}

		private void FavouritePrefab(bool favourite, PrefabItem caller)
		{
			string name = caller.GetName();
			PrefabStates[name].isFavourite = favourite;
			EasySpawnerPlugin.SaveFavourites();
			RebuildPrefabDropdown();
		}

		public void RebuildPlayerDropdown()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Expected O, but got Unknown
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: 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_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)PlayerDropdown) && Object.op_Implicit((Object)(object)ZNet.instance) && Object.op_Implicit((Object)(object)Player.m_localPlayer))
			{
				PlayerDropdown.ClearOptions();
				PlayerDropdown.options.Add(new OptionData(Player.m_localPlayer.GetPlayerName()));
				{
					foreach (PlayerInfo player in ZNet.instance.GetPlayerList())
					{
						if (player.m_name != Player.m_localPlayer.GetPlayerName())
						{
							PlayerDropdown.options.Add(new OptionData(player.m_name));
						}
					}
					return;
				}
			}
			Debug.Log((object)"EasySpawner: Cannot rebuild player dropdown");
		}

		private void SpawnButtonPress()
		{
			if (SelectedPrefabName == null)
			{
				return;
			}
			string selectedPrefabName = SelectedPrefabName;
			bool pickup = PutInInventoryToggle.isOn;
			bool isOn = IgnoreStackSizeToggle.isOn;
			Player val = Player.m_localPlayer;
			if (!int.TryParse(AmountField.text, out var result) || result < 1)
			{
				result = 1;
			}
			if (!int.TryParse(LevelField.text, out var result2) || result2 < 1)
			{
				result2 = 1;
			}
			if (!PlayerDropdown.options[PlayerDropdown.value].text.Equals(val.GetPlayerName()))
			{
				pickup = false;
				foreach (Player allPlayer in Player.GetAllPlayers())
				{
					if (allPlayer.GetPlayerName().Equals(PlayerDropdown.options[PlayerDropdown.value].text))
					{
						val = allPlayer;
						break;
					}
				}
			}
			EasySpawnerPlugin.SpawnPrefab(selectedPrefabName, val, result, result2, pickup, isOn);
		}

		public void RebuildPrefabDropdown()
		{
			//IL_0136: Unknown result type (might be due to invalid IL or missing references)
			SelectPrefab(null);
			SearchItems.Clear();
			Parallel.ForEach(EasySpawnerPlugin.prefabNames, delegate(string name)
			{
				bool flag = name.IndexOf(SearchField.text, StringComparison.OrdinalIgnoreCase) >= 0;
				string localizedName = PrefabStates[name].localizedName;
				flag = flag || (localizedName.Length > 0 && localizedName.IndexOf(SearchField.text, StringComparison.OrdinalIgnoreCase) >= 0);
				PrefabStates[name].isSearched = flag;
			});
			foreach (string prefabName in EasySpawnerPlugin.prefabNames)
			{
				PrefabState prefabState = PrefabStates[prefabName];
				if (prefabState.isSearched && prefabState.isFavourite)
				{
					SearchItems.Add(prefabName);
				}
			}
			if (!FavouritesOnlyToggle.isOn)
			{
				foreach (string prefabName2 in EasySpawnerPlugin.prefabNames)
				{
					PrefabState prefabState2 = PrefabStates[prefabName2];
					if (prefabState2.isSearched && !prefabState2.isFavourite)
					{
						SearchItems.Add(prefabName2);
					}
				}
			}
			PoolAllPrefabItems();
			UpdateItemPrefabPool(new Vector2(PrefabScrollView.horizontalScrollbar.value, PrefabScrollView.verticalScrollbar.value));
		}

		public void Destroy()
		{
			((UnityEventBase)PrefabScrollView.onValueChanged).RemoveAllListeners();
			((UnityEventBase)SearchField.onValueChanged).RemoveAllListeners();
			((UnityEventBase)SpawnButton.onClick).RemoveAllListeners();
			PrefabItems = null;
			PrefabItemPool = new Queue<PrefabItem>();
			EasySpawnerPlugin.config.UIWidth.SettingChanged -= UpdateMenuSize;
		}
	}
	public class PrefabItem : MonoBehaviour
	{
		public RectTransform rectTransform;

		public Toggle toggle;

		public int posIndex = -1;

		private Text label;

		private Toggle favourite;

		private string itemName;

		private Color starOnColor = new Color(1f, 40f / 51f, 0.16078432f);

		private Color starOffColor = new Color(0.6039216f, 0.6039216f, 0.6039216f);

		public void Init(Action<PrefabItem> selectPrefabCall, Action<bool, PrefabItem> favouritePrefabCall)
		{
			rectTransform = ((Component)this).GetComponent<RectTransform>();
			toggle = ((Component)this).GetComponent<Toggle>();
			label = ((Component)((Component)this).transform.Find("ItemLabel")).GetComponent<Text>();
			favourite = ((Component)((Component)this).transform.Find("Star")).GetComponent<Toggle>();
			toggle.isOn = false;
			((UnityEvent<bool>)(object)toggle.onValueChanged).AddListener((UnityAction<bool>)delegate
			{
				selectPrefabCall(this);
			});
			SetFavouriteOn(on: false, silent: false);
			((UnityEvent<bool>)(object)favourite.onValueChanged).AddListener((UnityAction<bool>)delegate(bool on)
			{
				favouritePrefabCall(on, this);
			});
		}

		public void SetFavouriteOn(bool on, bool silent)
		{
			//IL_0039: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			if (silent)
			{
				favourite.SetIsOnWithoutNotify(on);
			}
			else
			{
				favourite.isOn = on;
			}
			((Selectable)favourite).targetGraphic.color = (on ? starOnColor : starOffColor);
		}

		public void Pool()
		{
			((Component)this).gameObject.SetActive(false);
			posIndex = -1;
			toggle.SetIsOnWithoutNotify(false);
			SetFavouriteOn(on: false, silent: true);
		}

		public void SetName(string itemName)
		{
			this.itemName = itemName;
			string localizedName = EasySpawnerMenu.PrefabStates[itemName].localizedName;
			label.text = ((localizedName.Length > 0) ? (localizedName + " (" + itemName + ")") : itemName);
		}

		public string GetName()
		{
			return itemName;
		}
	}
	public class PrefabState
	{
		public bool isSearched;

		public bool isFavourite;

		public string localizedName;
	}
	public static class Style
	{
		private static Font averiaSerif;

		private static Font averiaSerifBold;

		public static void ApplyAll(GameObject root, EasySpawnerMenu menu)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			FindFonds();
			ApplyPanel(root.GetComponent<Image>());
			Text[] componentsInChildren = root.GetComponentsInChildren<Text>(true);
			foreach (Text text in componentsInChildren)
			{
				ApplyText(text, new Color(73f / 85f, 73f / 85f, 73f / 85f));
			}
			InputField[] componentsInChildren2 = root.GetComponentsInChildren<InputField>(true);
			foreach (InputField inputField in componentsInChildren2)
			{
				ApplyInputField(inputField);
			}
			Button[] componentsInChildren3 = root.GetComponentsInChildren<Button>(true);
			foreach (Button button in componentsInChildren3)
			{
				ApplyButton(button);
			}
			Toggle[] componentsInChildren4 = root.GetComponentsInChildren<Toggle>(true);
			foreach (Toggle toggle in componentsInChildren4)
			{
				ApplyToogle(toggle);
			}
			ScrollRect[] componentsInChildren5 = root.GetComponentsInChildren<ScrollRect>(true);
			foreach (ScrollRect scrollRect in componentsInChildren5)
			{
				ApplyScrollRect(scrollRect);
			}
			Dropdown[] componentsInChildren6 = root.GetComponentsInChildren<Dropdown>(true);
			foreach (Dropdown dropdown in componentsInChildren6)
			{
				ApplyDropdown(dropdown);
			}
		}

		public static void ApplyPanel(Image image)
		{
			image.sprite = GetSprite("woodpanel_settings");
		}

		public static void ApplyText(Text text, Color color)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			if ((int)text.fontStyle == 1)
			{
				text.font = averiaSerifBold;
				text.fontStyle = (FontStyle)0;
			}
			else
			{
				text.font = averiaSerif;
			}
			((Graphic)text).color = color;
		}

		public static void ApplyInputField(InputField inputField)
		{
			((Component)inputField).GetComponent<Image>().sprite = GetSprite("text_field");
		}

		public static void ApplyButton(Button button)
		{
			((Component)button).GetComponent<Image>().sprite = GetSprite("button");
		}

		public static void ApplyToogle(Toggle toggle)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: 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_00bf: Unknown result type (might be due to invalid IL or missing references)
			switch (((Object)((Component)toggle).gameObject).name)
			{
			case "_Template":
			case "_Template(Clone)":
				((Image)((Selectable)toggle).targetGraphic).sprite = GetSprite("button");
				((Image)((Selectable)toggle).targetGraphic).type = (Type)1;
				((Image)((Selectable)toggle).targetGraphic).pixelsPerUnitMultiplier = 2f;
				break;
			default:
				((Image)((Selectable)toggle).targetGraphic).sprite = GetSprite("checkbox");
				((Image)((Selectable)toggle).targetGraphic).type = (Type)1;
				((Image)((Selectable)toggle).targetGraphic).pixelsPerUnitMultiplier = 2f;
				break;
			case "Star":
			case "Star(Clone)":
				break;
			}
			if ((Object)(object)toggle.graphic != (Object)null)
			{
				((Graphic)((Component)toggle.graphic).GetComponent<Image>()).color = new Color(1f, 0.678f, 0.103f, 1f);
				((Component)toggle.graphic).GetComponent<Image>().sprite = GetSprite("checkbox_marker");
				((MaskableGraphic)((Component)toggle.graphic).GetComponent<Image>()).maskable = true;
			}
		}

		public static void ApplyScrollRect(ScrollRect scrollRect)
		{
			//IL_0035: 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_005a: 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_0087: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010c: 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_0139: Unknown result type (might be due to invalid IL or missing references)
			((Component)scrollRect).GetComponent<Image>().sprite = GetSprite("item_background_sunken");
			if (Object.op_Implicit((Object)(object)scrollRect.horizontalScrollbar))
			{
				((Image)((Selectable)scrollRect.horizontalScrollbar).targetGraphic).sprite = GetSprite("text_field");
				((Graphic)(Image)((Selectable)scrollRect.horizontalScrollbar).targetGraphic).color = Color.grey;
				((Image)((Selectable)scrollRect.horizontalScrollbar).targetGraphic).type = (Type)1;
				((Image)((Selectable)scrollRect.horizontalScrollbar).targetGraphic).pixelsPerUnitMultiplier = 2f;
				((Component)scrollRect.horizontalScrollbar).GetComponent<Image>().sprite = GetSprite("text_field");
				((Component)scrollRect.horizontalScrollbar).GetComponent<Image>().pixelsPerUnitMultiplier = 3f;
			}
			if (Object.op_Implicit((Object)(object)scrollRect.verticalScrollbar))
			{
				((Image)((Selectable)scrollRect.verticalScrollbar).targetGraphic).sprite = GetSprite("text_field");
				((Graphic)(Image)((Selectable)scrollRect.verticalScrollbar).targetGraphic).color = Color.grey;
				((Image)((Selectable)scrollRect.verticalScrollbar).targetGraphic).type = (Type)1;
				((Image)((Selectable)scrollRect.verticalScrollbar).targetGraphic).pixelsPerUnitMultiplier = 2f;
				((Component)scrollRect.verticalScrollbar).GetComponent<Image>().sprite = GetSprite("text_field");
				((Component)scrollRect.verticalScrollbar).GetComponent<Image>().pixelsPerUnitMultiplier = 3f;
			}
		}

		public static void ApplyDropdown(Dropdown dropdown)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			((Image)((Selectable)dropdown).targetGraphic).sprite = GetSprite("button");
			ApplyScrollRect(((Component)dropdown.template).GetComponent<ScrollRect>());
		}

		public static Sprite GetSprite(string name)
		{
			return ((IEnumerable<Sprite>)Resources.FindObjectsOfTypeAll<Sprite>()).FirstOrDefault((Func<Sprite, bool>)((Sprite x) => ((Object)x).name == name));
		}

		private static void FindFonds()
		{
			Font[] source = Resources.FindObjectsOfTypeAll<Font>();
			averiaSerif = ((IEnumerable<Font>)source).FirstOrDefault((Func<Font, bool>)((Font x) => ((Object)x).name == "AveriaSerifLibre-Regular"));
			averiaSerifBold = ((IEnumerable<Font>)source).FirstOrDefault((Func<Font, bool>)((Font x) => ((Object)x).name == "AveriaSerifLibre-Bold"));
		}
	}
	public class UIElementDragger : MonoBehaviour, IDragHandler, IEventSystemHandler, IBeginDragHandler
	{
		private RectTransform window;

		private Vector2 delta;

		private void Awake()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			window = (RectTransform)((Component)this).transform;
		}

		public void OnBeginDrag(PointerEventData eventData)
		{
			//IL_0002: 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_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)
			delta = Vector2.op_Implicit(Input.mousePosition - ((Transform)window).position);
		}

		public void OnDrag(PointerEventData eventData)
		{
			//IL_0002: 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_000d: 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_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_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_003d: 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_0072: 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_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			Vector2 val = eventData.position - delta;
			Rect rect = window.rect;
			Vector2 val2 = Vector2.op_Implicit(((Transform)window).lossyScale);
			float num = ((Rect)(ref rect)).width / 2f * val2.x;
			float num2 = (float)Screen.width - num;
			float num3 = ((Rect)(ref rect)).height / 2f * val2.y;
			float num4 = (float)Screen.height - num3;
			val.x = Mathf.Clamp(val.x, num, num2);
			val.y = Mathf.Clamp(val.y, num3, num4);
			((Component)this).transform.position = Vector2.op_Implicit(val);
		}
	}
}
namespace EasySpawner.Patches
{
	[HarmonyPatch(typeof(DungeonDB), "Start")]
	internal class DungeonDB_Start_Patch
	{
		private static void Postfix()
		{
			Debug.Log((object)"Easy spawner: Easy spawner loading assets");
			EasySpawnerPlugin.LoadAsset("EasySpawnerAssetBundle");
			Debug.Log((object)"Easy spawner: Easy spawner loaded assets");
			if (EasySpawnerPlugin.prefabNames.Count != 0)
			{
				return;
			}
			if (!Object.op_Implicit((Object)(object)ZNetScene.instance))
			{
				Debug.LogError((object)"EasySpawner: Can't load prefab due to ZNetScene.instance is null");
				return;
			}
			ItemDrop val = default(ItemDrop);
			Piece val2 = default(Piece);
			foreach (GameObject prefab in ZNetScene.instance.m_prefabs)
			{
				string localizedName = "";
				if (prefab.TryGetComponent<ItemDrop>(ref val))
				{
					localizedName = Localization.instance.Localize(val.m_itemData.m_shared.m_name).Trim();
				}
				if (prefab.TryGetComponent<Piece>(ref val2))
				{
					localizedName = Localization.instance.Localize(val2.m_name).Trim();
				}
				EasySpawnerPlugin.prefabNames.Add(((Object)prefab).name);
				EasySpawnerMenu.PrefabStates.Add(((Object)prefab).name, new PrefabState
				{
					localizedName = localizedName
				});
			}
			EasySpawnerPlugin.prefabNames.Sort(NameComparator);
			EasySpawnerPlugin.LoadFavourites();
		}

		private static string GetPrimaryName(string key)
		{
			string localizedName = EasySpawnerMenu.PrefabStates[key].localizedName;
			return (localizedName.Length > 0) ? localizedName : key;
		}

		private static int NameComparator(string a, string b)
		{
			return string.Compare(GetPrimaryName(a), GetPrimaryName(b), StringComparison.InvariantCultureIgnoreCase);
		}
	}
	[HarmonyPatch]
	public static class ZInputPatcher
	{
		public static bool EasySpawnerIsFocused()
		{
			if ((Object)(object)EasySpawnerPlugin.menuGameObject == (Object)null || !EasySpawnerPlugin.menuGameObject.activeSelf)
			{
				return false;
			}
			return EasySpawnerPlugin.menu.SearchField.isFocused || EasySpawnerPlugin.menu.AmountField.isFocused || EasySpawnerPlugin.menu.LevelField.isFocused;
		}

		[HarmonyPatch(typeof(ZInput), "GetButtonDown")]
		[HarmonyPostfix]
		public static void GetButtonDownPatch(ref bool __result)
		{
			if (EasySpawnerIsFocused())
			{
				__result = false;
			}
		}

		[HarmonyPatch(typeof(ZInput), "GetButtonUp")]
		[HarmonyPostfix]
		public static void GetButtonUpPatch(ref bool __result)
		{
			if (EasySpawnerIsFocused())
			{
				__result = false;
			}
		}

		[HarmonyPatch(typeof(ZInput), "GetButton")]
		[HarmonyPostfix]
		public static void GetButtonPatch(ref bool __result)
		{
			if (EasySpawnerIsFocused())
			{
				__result = false;
			}
		}
	}
	[HarmonyPatch(typeof(ZNetScene), "Shutdown")]
	internal class ZNetSceneShutdownPatch
	{
		private static void Prefix()
		{
			EasySpawnerPlugin.DestroyMenu();
		}
	}
}
namespace EasySpawner.Config
{
	public class EasySpawnerConfig
	{
		public ConfigEntry<string> FirstOpenHotkey;

		public ConfigEntry<string> FirstOpenHotkeyModifier;

		public ConfigEntry<string> SecondOpenHotkey;

		public ConfigEntry<string> FirstSpawnHotkey;

		public ConfigEntry<string> FirstSpawnHotkeyModifier;

		public ConfigEntry<string> SecondSpawnHotkey;

		public ConfigEntry<string> UndoHotkey;

		public ConfigEntry<string> UndoHotkeyModifier;

		public ConfigEntry<float> UIWidth;

		public bool OpenHotkeyModifierSet;

		public bool SpawnHotkeyModifierSet;

		public bool UndoHotkeyModifierSet;

		public ConfigFile ConfigFile { get; set; }

		public void SetupConfig()
		{
			FirstOpenHotkey = ConfigFile.Bind<string>("Hotkeys", "firstOpenHotkey", "/", "Main hotkey to show/hide the menu. To find appropriate hotkeys use https://answers.unity.com/questions/762073/c-list-of-string-name-for-inputgetkeystring-name.html");
			FirstOpenHotkeyModifier = ConfigFile.Bind<string>("Hotkeys", "firstOpenHotkeyModifier", "", "Optional Modifier to the firstOpenHotkey. Setting this will mean you have to press firstOpenHotkey + firstOpenHotkeyModifier to open/hide the menu. E.g. set this to left alt");
			SecondOpenHotkey = ConfigFile.Bind<string>("Hotkeys", "secondOpenHotkey", "[/]", "Secondary hotkey to show/hide the menu");
			FirstSpawnHotkey = ConfigFile.Bind<string>("Hotkeys", "firstSpawnHotkey", "=", "Main hotkey to spawn selected prefab");
			FirstSpawnHotkeyModifier = ConfigFile.Bind<string>("Hotkeys", "firstSpawnHotkeyModifier", "", "Optional Modifier to the firstSpawnHotkey. Setting this will mean you have to press firstSpawnHotkey + firstSpawnHotkeyModifier to spawn selected prefab. E.g. set this to left alt");
			SecondSpawnHotkey = ConfigFile.Bind<string>("Hotkeys", "secondSpawnHotkey", "[+]", "Secondary hotkey to spawn selected prefab");
			UndoHotkey = ConfigFile.Bind<string>("Hotkeys", "UndoHotkey", "z", "Hotkey to Undo last spawn");
			UndoHotkeyModifier = ConfigFile.Bind<string>("Hotkeys", "UndoHotkeyModifier", "left ctrl", "Modifier to Undo hotkey");
			UIWidth = ConfigFile.Bind<float>("UI", "MenuWidth", 450f, "Width of the menu");
			FirstOpenHotkey.Value = FirstOpenHotkey.Value.ToLower();
			FirstOpenHotkeyModifier.Value = FirstOpenHotkeyModifier.Value.ToLower();
			SecondOpenHotkey.Value = SecondOpenHotkey.Value.ToLower();
			FirstSpawnHotkey.Value = FirstSpawnHotkey.Value.ToLower();
			FirstSpawnHotkeyModifier.Value = FirstSpawnHotkeyModifier.Value.ToLower();
			SecondSpawnHotkey.Value = SecondSpawnHotkey.Value.ToLower();
			UndoHotkey.Value = UndoHotkey.Value.ToLower();
			UndoHotkeyModifier.Value = UndoHotkeyModifier.Value.ToLower();
			OpenHotkeyModifierSet = !string.IsNullOrWhiteSpace(FirstOpenHotkeyModifier.Value);
			SpawnHotkeyModifierSet = !string.IsNullOrWhiteSpace(FirstSpawnHotkeyModifier.Value);
			UndoHotkeyModifierSet = !string.IsNullOrWhiteSpace(UndoHotkeyModifier.Value);
		}

		public bool IfUndoHotkeyPressed()
		{
			if (!UndoHotkeyModifierSet)
			{
				return Input.GetKeyDown(UndoHotkey.Value);
			}
			return Input.GetKey(UndoHotkeyModifier.Value) && Input.GetKeyDown(UndoHotkey.Value);
		}

		public bool IfMenuHotkeyPressed()
		{
			if (!OpenHotkeyModifierSet)
			{
				return Input.GetKeyDown(FirstOpenHotkey.Value) || Input.GetKeyDown(SecondOpenHotkey.Value);
			}
			return (Input.GetKey(FirstOpenHotkeyModifier.Value) && Input.GetKeyDown(FirstOpenHotkey.Value)) || Input.GetKeyDown(SecondOpenHotkey.Value);
		}

		public bool IfSpawnHotkeyPressed()
		{
			if (!SpawnHotkeyModifierSet)
			{
				return Input.GetKeyDown(FirstSpawnHotkey.Value) || Input.GetKeyDown(SecondSpawnHotkey.Value);
			}
			return (Input.GetKey(FirstSpawnHotkeyModifier.Value) && Input.GetKeyDown(FirstSpawnHotkey.Value)) || Input.GetKeyDown(SecondSpawnHotkey.Value);
		}
	}
}