Decompiled source of MoreMonsters v1.2.1

MoreMonsters.dll

Decompiled 11 months ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using MoreMonsters.GuiMenuComponent;
using MoreMonsters.PlayerBControllerPatches;
using Unity.Netcode;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("MoreMonsters")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("MoreMonsters")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("aa6861f1-1ec5-446c-b28c-3f2b07cd05f8")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace MoreMonsters
{
	[BepInPlugin("Quokka.MoreMonsters", "MoreMonsters", "1.2.0")]
	public class MoreMonstersBase : BaseUnityPlugin
	{
		private const string modGUID = "Quokka.MoreMonsters";

		private const string modName = "MoreMonsters";

		private const string modVersion = "1.2.0";

		private readonly Harmony harmony = new Harmony("Quokka.MoreMonsters");

		internal static MoreMonstersBase Instance;

		private static ConfigEntry<int> nMobsLabel;

		private static ConfigEntry<float> timeBetweenMobSpawns;

		private static ConfigEntry<bool> enableSpawnMobsAsScrapIsFound;

		private static ConfigEntry<int> maxCentipedesLabel;

		private static ConfigEntry<int> maxSandSpiderLabel;

		private static ConfigEntry<int> maxHoarderBugLabel;

		private static ConfigEntry<int> maxFlowermanLabel;

		private static ConfigEntry<int> maxCrawlerLabel;

		private static ConfigEntry<int> maxBlobLabel;

		private static ConfigEntry<int> maxSpringManLabel;

		private static ConfigEntry<int> maxPufferLabel;

		private static ConfigEntry<int> maxNutcrackerLabel;

		private static ConfigEntry<int> maxDressGirlLabel;

		private static ConfigEntry<int> maxJesterLabel;

		private static ConfigEntry<int> maxMaskedPlayerEnemyLabel;

		private static ConfigEntry<int> maxLassoManLabel;

		private static bool hasGuiSynced = false;

		internal static bool isHost;

		public static ManualLogSource mls;

		private static RoundManager currentRound;

		public static bool firstTier = false;

		public static bool secondTier = false;

		public static bool thirdTier = false;

		public static float timeToSpawn = 120f;

		public static int ventIndex = 0;

		internal static GuiMenu myGUI;

		public static Dictionary<string, int> maxEnemyList = new Dictionary<string, int>();

		public static Dictionary<string, int> currentEnemyList = new Dictionary<string, int>();

		public static int[] pureEnemyList = new int[13];

		public static int[] pureMaxEnemyList = new int[13];

		public static int spawnedMonsterTotal = 0;

		private void Awake()
		{
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			Instance = this;
			mls = Logger.CreateLogSource("Quokka.MoreMonsters");
			harmony.PatchAll(typeof(MoreMonstersBase));
			harmony.PatchAll(typeof(PlayerControllerBPatch));
			GameObject val = new GameObject("GuiMenu");
			Object.DontDestroyOnLoad((Object)(object)val);
			((Object)val).hideFlags = (HideFlags)61;
			val.AddComponent<GuiMenu>();
			myGUI = (GuiMenu)(object)val.GetComponent("GuiMenu");
			SetBindings();
			setGuiVars();
			maxEnemyList.Add("Centipede", 0);
			maxEnemyList.Add("SandSpider", 0);
			maxEnemyList.Add("HoarderBug", 0);
			maxEnemyList.Add("Flowerman", 0);
			maxEnemyList.Add("Crawler", 0);
			maxEnemyList.Add("Blob", 0);
			maxEnemyList.Add("DressGirl", 0);
			maxEnemyList.Add("Puffer", 0);
			maxEnemyList.Add("SpringMan", 0);
			maxEnemyList.Add("Nutcracker", 0);
			maxEnemyList.Add("Jester", 0);
			maxEnemyList.Add("MaskedPlayerEnemy", 0);
			maxEnemyList.Add("LassoMan", 0);
			currentEnemyList.Add("Centipede", 0);
			currentEnemyList.Add("SandSpider", 0);
			currentEnemyList.Add("HoarderBug", 0);
			currentEnemyList.Add("Flowerman", 0);
			currentEnemyList.Add("Crawler", 0);
			currentEnemyList.Add("Blob", 0);
			currentEnemyList.Add("DressGirl", 0);
			currentEnemyList.Add("Puffer", 0);
			currentEnemyList.Add("SpringMan", 0);
			currentEnemyList.Add("Nutcracker", 0);
			currentEnemyList.Add("Jester", 0);
			currentEnemyList.Add("MaskedPlayerEnemy", 0);
			currentEnemyList.Add("LassoMan", 0);
		}

		private void setGuiVars()
		{
			myGUI.guiNMobs = nMobsLabel.Value;
			myGUI.guiTimeBetweenMobSpawns = timeBetweenMobSpawns.Value;
			myGUI.guiEnableSpawnMobsAsScrapIsFound = enableSpawnMobsAsScrapIsFound.Value;
			hasGuiSynced = true;
			myGUI.guiMaxCentipedes = maxCentipedesLabel.Value;
			myGUI.guiMaxSandSpiders = maxSandSpiderLabel.Value;
			myGUI.guiMaxHoarderBugs = maxHoarderBugLabel.Value;
			myGUI.guiMaxFlowerMen = maxFlowermanLabel.Value;
			myGUI.guiMaxCrawlers = maxCrawlerLabel.Value;
			myGUI.guiMaxBlobs = maxBlobLabel.Value;
			myGUI.guiMaxSpringMen = maxSpringManLabel.Value;
			myGUI.guiMaxPuffers = maxPufferLabel.Value;
			myGUI.guiMaxNutcrackers = maxNutcrackerLabel.Value;
			myGUI.guiMaxDressGirls = maxDressGirlLabel.Value;
			myGUI.guiMaxJesters = maxJesterLabel.Value;
			myGUI.guiMaxMaskedPlayerEnemies = maxMaskedPlayerEnemyLabel.Value;
			myGUI.guiMaxLassoMen = maxLassoManLabel.Value;
		}

		internal void updateCFGVarsViaGui()
		{
			if (!hasGuiSynced)
			{
				setGuiVars();
			}
			nMobsLabel.Value = myGUI.guiNMobs;
			timeBetweenMobSpawns.Value = myGUI.guiTimeBetweenMobSpawns;
			enableSpawnMobsAsScrapIsFound.Value = myGUI.guiEnableSpawnMobsAsScrapIsFound;
			maxCentipedesLabel.Value = myGUI.guiMaxCentipedes;
			maxSandSpiderLabel.Value = myGUI.guiMaxSandSpiders;
			maxHoarderBugLabel.Value = myGUI.guiMaxHoarderBugs;
			maxFlowermanLabel.Value = myGUI.guiMaxFlowerMen;
			maxCrawlerLabel.Value = myGUI.guiMaxCrawlers;
			maxBlobLabel.Value = myGUI.guiMaxBlobs;
			maxSpringManLabel.Value = myGUI.guiMaxSpringMen;
			maxPufferLabel.Value = myGUI.guiMaxPuffers;
			maxNutcrackerLabel.Value = myGUI.guiMaxNutcrackers;
			maxDressGirlLabel.Value = myGUI.guiMaxDressGirls;
			maxJesterLabel.Value = myGUI.guiMaxJesters;
			maxMaskedPlayerEnemyLabel.Value = myGUI.guiMaxMaskedPlayerEnemies;
			maxLassoManLabel.Value = myGUI.guiMaxLassoMen;
		}

		private void Update()
		{
		}

		private void SetBindings()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Expected O, but got Unknown
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			//IL_017b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Expected O, but got Unknown
			//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Expected O, but got Unknown
			//IL_01df: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e9: Expected O, but got Unknown
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_021b: Expected O, but got Unknown
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_024d: Expected O, but got Unknown
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Expected O, but got Unknown
			//IL_02a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b1: Expected O, but got Unknown
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e3: Expected O, but got Unknown
			//IL_030b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0315: Expected O, but got Unknown
			nMobsLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "TotalNumber of Mobs", 8, new ConfigDescription("Base number of mobs to spawn in total", (AcceptableValueBase)(object)new AcceptableValueRange<int>(1, 100), Array.Empty<object>()));
			timeBetweenMobSpawns = ((BaseUnityPlugin)this).Config.Bind<float>("Mob Settings", "Time between each Mob Spawn", 100f, new ConfigDescription("Time between each mob spawn where 0.1 = 1.5 hours", (AcceptableValueBase)(object)new AcceptableValueRange<float>(0f, 800f), Array.Empty<object>()));
			enableSpawnMobsAsScrapIsFound = ((BaseUnityPlugin)this).Config.Bind<bool>("Mob Settings", "Toggle whether more mobs spawn as scrap is found.", false, "If true, an additional mob will spawn at 25%, 50%, and 75% of scrap found in level");
			maxCentipedesLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "Max Centipedes", 0, new ConfigDescription("Max number of centipedes allowed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			maxSandSpiderLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "Max Sandspiders", 0, new ConfigDescription("Max number of SandSpiders allowed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			maxHoarderBugLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "Max Hoarderbugs", 0, new ConfigDescription("Max number of Hoarderbugs allowed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			maxFlowermanLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "Max Flowermen", 0, new ConfigDescription("Max number of Flowermen allowed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			maxCrawlerLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "Max Crawlers", 0, new ConfigDescription("Max number of Crawlers allowed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			maxBlobLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "Max Blobs", 0, new ConfigDescription("Max number of Blobs allowed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			maxSpringManLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "Max SpringMen", 0, new ConfigDescription("Max number of SpringMen allowed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			maxNutcrackerLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "Max Nutcrackers", 0, new ConfigDescription("Max number of Nutcrackers allowed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			maxPufferLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "Max Puffers", 0, new ConfigDescription("Max number of Puffers allowed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			maxDressGirlLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "Max DressGirls", 0, new ConfigDescription("Max number of DressGirls allowed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			maxJesterLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "Max Jesters", 0, new ConfigDescription("Max number of Jesters allowed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			maxMaskedPlayerEnemyLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "Max MaskedPlayerEnemies", 0, new ConfigDescription("Max number of MaskedPlayerEnemies allowed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
			maxLassoManLabel = ((BaseUnityPlugin)this).Config.Bind<int>("Mob Settings", "Max LassoMen", 0, new ConfigDescription("Max number of LassoMen allowed", (AcceptableValueBase)(object)new AcceptableValueRange<int>(0, 100), Array.Empty<object>()));
		}

		[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
		[HarmonyPostfix]
		private static void ModifyLevel(ref SelectableLevel newLevel)
		{
			currentRound = RoundManager.Instance;
		}

		[HarmonyPatch(typeof(StartOfRound), "ChangeLevel")]
		[HarmonyPostfix]
		private static void ChangeLevel(ref SelectableLevel ___currentLevel, ref SelectableLevel[] ___levels)
		{
			for (int i = 0; i < ___levels.Length; i++)
			{
				mls.LogInfo((object)___levels[i].PlanetName);
			}
			___currentLevel.Enemies = ___levels[8].Enemies;
			spawnedMonsterTotal = 0;
		}

		[HarmonyPatch(typeof(StartOfRound), "StartGame")]
		[HarmonyPostfix]
		private static void modifiedStart()
		{
			spawnedMonsterTotal = 0;
			Instance.updateCFGVarsViaGui();
		}

		[HarmonyPatch(typeof(RoundManager), "Start")]
		[HarmonyPostfix]
		private static void setIsHost()
		{
			mls.LogInfo((object)("Host Status: " + ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost));
			isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost;
			myGUI.guiIsHost = isHost;
			Instance.updateCFGVarsViaGui();
		}

		[HarmonyPatch(typeof(RoundManager), "SpawnInsideEnemiesFromVentsIfReady")]
		[HarmonyPostfix]
		private static void SpawnInsideEnemiesFromVentsIfReadyPatch()
		{
			//IL_0211: Unknown result type (might be due to invalid IL or missing references)
			//IL_0216: 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_0334: Unknown result type (might be due to invalid IL or missing references)
			//IL_048a: Unknown result type (might be due to invalid IL or missing references)
			//IL_052b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cc: Unknown result type (might be due to invalid IL or missing references)
			if (!isHost)
			{
				return;
			}
			currentRound = RoundManager.Instance;
			maxEnemyList["Centipede"] = maxCentipedesLabel.Value;
			maxEnemyList["SandSpider"] = maxSandSpiderLabel.Value;
			maxEnemyList["HoarderBug"] = maxHoarderBugLabel.Value;
			maxEnemyList["Flowerman"] = maxFlowermanLabel.Value;
			maxEnemyList["Crawler"] = maxCrawlerLabel.Value;
			maxEnemyList["Blob"] = maxBlobLabel.Value;
			maxEnemyList["SpringMan"] = maxSpringManLabel.Value;
			maxEnemyList["Puffer"] = maxPufferLabel.Value;
			maxEnemyList["Nutcracker"] = maxNutcrackerLabel.Value;
			maxEnemyList["DressGirl"] = maxDressGirlLabel.Value;
			maxEnemyList["Jester"] = maxJesterLabel.Value;
			maxEnemyList["MaskedPlayerEnemy"] = maxMaskedPlayerEnemyLabel.Value;
			maxEnemyList["LassoMan"] = maxLassoManLabel.Value;
			int num = 0;
			foreach (KeyValuePair<string, int> maxEnemy in maxEnemyList)
			{
				num += maxEnemy.Value;
			}
			int count = currentRound.currentLevel.Enemies.Count;
			if (spawnedMonsterTotal >= num || !(currentRound.timeScript.currentDayTime > timeToSpawn) || currentRound.allEnemyVents.Length == 0)
			{
				return;
			}
			Vector3 position = currentRound.allEnemyVents[ventIndex].floorNode.position;
			float y = currentRound.allEnemyVents[ventIndex].floorNode.eulerAngles.y;
			if (count <= 0)
			{
				return;
			}
			int num2 = Random.Range(0, 13);
			string name = ((Object)currentRound.currentLevel.Enemies[num2].enemyType).name;
			while (currentRound.currentLevel.Enemies[num2].enemyType.numberSpawned >= maxEnemyList[name])
			{
				num2 = Random.Range(0, 13);
				name = ((Object)currentRound.currentLevel.Enemies[num2].enemyType).name;
			}
			mls.LogInfo((object)("Spawning " + num2 + " name: " + name + " currentEnemyList: " + currentEnemyList[name]));
			currentRound.SpawnEnemyOnServer(position, y, num2);
			EnemyType enemyType = currentRound.currentLevel.Enemies[num2].enemyType;
			enemyType.numberSpawned++;
			RoundManager obj = currentRound;
			obj.currentEnemySpawnIndex++;
			spawnedMonsterTotal++;
			ventIndex++;
			ventIndex %= currentRound.allEnemyVents.Length;
			timeToSpawn = currentRound.timeScript.currentDayTime + timeBetweenMobSpawns.Value;
			mls.LogInfo((object)("currentEnemySpawnIndex: " + currentRound.currentEnemySpawnIndex));
			mls.LogInfo((object)("spawnedMonsterTotal: " + spawnedMonsterTotal));
			if (enableSpawnMobsAsScrapIsFound.Value)
			{
				if (currentRound.valueOfFoundScrapItems > (int)(0.25 * (double)currentRound.totalScrapValueInLevel) && !firstTier)
				{
					num2 = (ventIndex * (int)currentRound.timeScript.currentDayTime + (19 * (ventIndex + (int)currentRound.totalScrapValueInLevel) + 21)) % count;
					currentRound.SpawnEnemyOnServer(position, y, num2);
					ventIndex++;
					ventIndex %= currentRound.allEnemyVents.Length;
					firstTier = true;
				}
				if (currentRound.valueOfFoundScrapItems > (int)(0.5 * (double)currentRound.totalScrapValueInLevel) && !secondTier)
				{
					num2 = (ventIndex * (int)currentRound.timeScript.currentDayTime + (19 * (ventIndex + (int)currentRound.totalScrapValueInLevel) + 21)) % count;
					currentRound.SpawnEnemyOnServer(position, y, num2);
					ventIndex++;
					ventIndex %= currentRound.allEnemyVents.Length;
					secondTier = true;
				}
				if (currentRound.valueOfFoundScrapItems > (int)(0.75 * (double)currentRound.totalScrapValueInLevel) && !thirdTier)
				{
					num2 = (ventIndex * (int)currentRound.timeScript.currentDayTime + (19 * (ventIndex + (int)currentRound.totalScrapValueInLevel) + 21)) % count;
					currentRound.SpawnEnemyOnServer(position, y, num2);
					ventIndex++;
					ventIndex %= currentRound.allEnemyVents.Length;
					thirdTier = true;
				}
			}
		}
	}
}
namespace MoreMonsters.PlayerBControllerPatches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class PlayerControllerBPatch
	{
		[HarmonyPatch("Update")]
		[HarmonyPrefix]
		private static void patchControllerUpdate()
		{
			MoreMonstersBase.myGUI.guiIsHost = MoreMonstersBase.isHost;
			MoreMonstersBase.Instance.updateCFGVarsViaGui();
		}
	}
}
namespace MoreMonsters.GuiMenuComponent
{
	internal class GuiMenu : MonoBehaviour
	{
		private KeyboardShortcut toggleMenu;

		private bool b_menu;

		internal bool wasKeyDown;

		private int tabIndex = 0;

		private string[] tabNames = new string[1] { "Mob Settings" };

		private int MENUWIDTH = 600;

		private int MENUHEIGHT = 800;

		private int MENUX;

		private int MENUY;

		private int CENTERX;

		private int ITEMWIDTH = 300;

		public int guiNMobs;

		public float guiTimeBetweenMobSpawns;

		public bool guiEnableSpawnMobsAsScrapIsFound;

		public int guiMaxCentipedes;

		public int guiMaxSandSpiders;

		public int guiMaxHoarderBugs;

		public int guiMaxFlowerMen;

		public int guiMaxCrawlers;

		public int guiMaxBlobs;

		public int guiMaxSpringMen;

		public int guiMaxPuffers;

		public int guiMaxNutcrackers;

		public int guiMaxDressGirls;

		public int guiMaxJesters;

		public int guiMaxMaskedPlayerEnemies;

		public int guiMaxLassoMen;

		private GUIStyle menuStyle;

		private GUIStyle buttonStyle;

		private GUIStyle labelStyle;

		private GUIStyle toggleStyle;

		private GUIStyle hScrollStyle;

		private GUIStyle textStyle;

		public bool guiIsHost;

		private void Awake()
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			MoreMonstersBase.mls.LogInfo((object)" [+] GUI Loaded");
			toggleMenu = new KeyboardShortcut((KeyCode)277, Array.Empty<KeyCode>());
			b_menu = false;
			MENUX = Screen.width / 2;
			MENUY = Screen.height / 2;
			CENTERX = MENUX + (MENUWIDTH / 2 - ITEMWIDTH / 2);
		}

		private Texture2D MakeTex(int width, int height, Color col)
		{
			//IL_0011: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			Color[] array = (Color[])(object)new Color[width * height];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = col;
			}
			Texture2D val = new Texture2D(width, height);
			val.SetPixels(array);
			val.Apply();
			return val;
		}

		private void initMenu()
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Expected O, but got Unknown
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Expected O, but got Unknown
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Expected O, but got Unknown
			//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: 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)
			//IL_0154: Unknown result type (might be due to invalid IL or missing references)
			//IL_0181: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0200: 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)
			if (menuStyle == null)
			{
				menuStyle = new GUIStyle(GUI.skin.box);
				buttonStyle = new GUIStyle(GUI.skin.button);
				labelStyle = new GUIStyle(GUI.skin.label);
				toggleStyle = new GUIStyle(GUI.skin.toggle);
				hScrollStyle = new GUIStyle(GUI.skin.horizontalSlider);
				textStyle = new GUIStyle();
				textStyle.fontSize = 18;
				textStyle.alignment = (TextAnchor)4;
				textStyle.normal.textColor = Color.white;
				menuStyle.normal.textColor = Color.white;
				menuStyle.normal.background = MakeTex(2, 2, new Color(0.01f, 0.01f, 0.1f, 0.9f));
				menuStyle.fontSize = 18;
				((Object)menuStyle.normal.background).hideFlags = (HideFlags)61;
				buttonStyle.normal.textColor = Color.white;
				buttonStyle.fontSize = 18;
				labelStyle.normal.textColor = Color.white;
				labelStyle.normal.background = MakeTex(2, 2, new Color(0.01f, 0.01f, 0.1f, 0.9f));
				labelStyle.fontSize = 18;
				labelStyle.alignment = (TextAnchor)4;
				((Object)labelStyle.normal.background).hideFlags = (HideFlags)61;
				toggleStyle.normal.textColor = Color.white;
				toggleStyle.fontSize = 18;
				toggleStyle.wordWrap = true;
				hScrollStyle.normal.textColor = Color.white;
				hScrollStyle.normal.background = MakeTex(2, 2, new Color(0f, 0f, 0.2f, 0.9f));
				((Object)hScrollStyle.normal.background).hideFlags = (HideFlags)61;
			}
		}

		public void OnDestroy()
		{
			MoreMonstersBase.mls.LogInfo((object)"[-] The GUILoader was destroyed.");
		}

		public void Update()
		{
			if (((KeyboardShortcut)(ref toggleMenu)).IsDown() && !wasKeyDown)
			{
				wasKeyDown = true;
			}
			if (((KeyboardShortcut)(ref toggleMenu)).IsUp() && wasKeyDown)
			{
				wasKeyDown = false;
				b_menu = !b_menu;
				if (b_menu)
				{
					Cursor.visible = true;
					Cursor.lockState = (CursorLockMode)2;
				}
				else
				{
					Cursor.visible = false;
				}
			}
		}

		public void OnGUI()
		{
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_011d: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0215: Unknown result type (might be due to invalid IL or missing references)
			//IL_024e: 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)
			//IL_02d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Unknown result type (might be due to invalid IL or missing references)
			//IL_0357: Unknown result type (might be due to invalid IL or missing references)
			//IL_0398: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_041a: Unknown result type (might be due to invalid IL or missing references)
			//IL_045b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0497: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_051e: Unknown result type (might be due to invalid IL or missing references)
			//IL_055a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_05e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_061d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0663: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0726: Unknown result type (might be due to invalid IL or missing references)
			//IL_0767: Unknown result type (might be due to invalid IL or missing references)
			//IL_07a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_07e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_082a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0866: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_0929: Unknown result type (might be due to invalid IL or missing references)
			//IL_096f: Unknown result type (might be due to invalid IL or missing references)
			//IL_09b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_09ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a32: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a73: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aaf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b00: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b43: Unknown result type (might be due to invalid IL or missing references)
			if (!guiIsHost)
			{
				return;
			}
			if (menuStyle == null)
			{
				initMenu();
			}
			if (b_menu)
			{
				tabIndex = GUI.Toolbar(new Rect((float)MENUX, (float)(MENUY - 30), (float)MENUWIDTH, 30f), tabIndex, tabNames, buttonStyle);
				if (tabIndex == 0)
				{
					GUI.Label(new Rect((float)CENTERX, (float)MENUY, (float)ITEMWIDTH, 30f), "Max Number of Centipedes: ", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 165), (float)MENUY, (float)ITEMWIDTH, 30f), guiMaxCentipedes.ToString() ?? "", textStyle);
					guiMaxCentipedes = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 30), (float)ITEMWIDTH, 30f), (float)guiMaxCentipedes, 0f, 50f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 60), (float)ITEMWIDTH, 30f), "Max Number of SandSpiders: ", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 165), (float)(MENUY + 60), (float)ITEMWIDTH, 30f), guiMaxSandSpiders.ToString() ?? "", textStyle);
					guiMaxSandSpiders = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 90), (float)ITEMWIDTH, 30f), (float)guiMaxSandSpiders, 0f, 50f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 120), (float)ITEMWIDTH, 30f), "Max Number of HoarderBugs: ", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 165), (float)(MENUY + 120), (float)ITEMWIDTH, 30f), guiMaxHoarderBugs.ToString() ?? "", textStyle);
					guiMaxHoarderBugs = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 150), (float)ITEMWIDTH, 30f), (float)guiMaxHoarderBugs, 0f, 50f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 180), (float)ITEMWIDTH, 30f), "Max Number of Flowermen: ", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 165), (float)(MENUY + 180), (float)ITEMWIDTH, 30f), guiMaxFlowerMen.ToString() ?? "", textStyle);
					guiMaxFlowerMen = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 210), (float)ITEMWIDTH, 30f), (float)guiMaxFlowerMen, 0f, 50f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 240), (float)ITEMWIDTH, 30f), "Max Number of Crawlers: ", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 165), (float)(MENUY + 240), (float)ITEMWIDTH, 30f), guiMaxCrawlers.ToString() ?? "", textStyle);
					guiMaxCrawlers = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 270), (float)ITEMWIDTH, 30f), (float)guiMaxCrawlers, 0f, 50f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 300), (float)ITEMWIDTH, 30f), "Max Number of Blobs: ", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 165), (float)(MENUY + 300), (float)ITEMWIDTH, 30f), guiMaxBlobs.ToString() ?? "", textStyle);
					guiMaxBlobs = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 330), (float)ITEMWIDTH, 30f), (float)guiMaxBlobs, 0f, 50f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 360), (float)ITEMWIDTH, 30f), "Max Number of DressGirls: ", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 165), (float)(MENUY + 360), (float)ITEMWIDTH, 30f), guiMaxDressGirls.ToString() ?? "", textStyle);
					guiMaxDressGirls = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 390), (float)ITEMWIDTH, 30f), (float)guiMaxDressGirls, 0f, 50f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 420), (float)ITEMWIDTH, 30f), "Max Number of Puffers: ", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 165), (float)(MENUY + 420), (float)ITEMWIDTH, 30f), guiMaxPuffers.ToString() ?? "", textStyle);
					guiMaxPuffers = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 450), (float)ITEMWIDTH, 30f), (float)guiMaxPuffers, 0f, 50f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 480), (float)ITEMWIDTH, 30f), "Max Number of SpringMen: ", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 165), (float)(MENUY + 480), (float)ITEMWIDTH, 30f), guiMaxSpringMen.ToString() ?? "", textStyle);
					guiMaxSpringMen = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 510), (float)ITEMWIDTH, 30f), (float)guiMaxSpringMen, 0f, 50f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 540), (float)ITEMWIDTH, 30f), "Max Number of Nutcrackers: ", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 165), (float)(MENUY + 540), (float)ITEMWIDTH, 30f), guiMaxNutcrackers.ToString() ?? "", textStyle);
					guiMaxNutcrackers = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 570), (float)ITEMWIDTH, 30f), (float)guiMaxNutcrackers, 0f, 50f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 600), (float)ITEMWIDTH, 30f), "Max Number of Jesters: ", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 165), (float)(MENUY + 600), (float)ITEMWIDTH, 30f), guiMaxJesters.ToString() ?? "", textStyle);
					guiMaxJesters = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 630), (float)ITEMWIDTH, 30f), (float)guiMaxJesters, 0f, 50f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 660), (float)ITEMWIDTH, 45f), "Max Number of MaskedPlayerEnemies: ", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 165), (float)(MENUY + 660), (float)ITEMWIDTH, 45f), guiMaxMaskedPlayerEnemies.ToString() ?? "", textStyle);
					guiMaxMaskedPlayerEnemies = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 700), (float)ITEMWIDTH, 30f), (float)guiMaxMaskedPlayerEnemies, 0f, 50f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 720), (float)ITEMWIDTH, 30f), "Max Number of LassoMen: ", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 165), (float)(MENUY + 720), (float)ITEMWIDTH, 30f), guiMaxLassoMen.ToString() ?? "", textStyle);
					guiMaxLassoMen = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 750), (float)ITEMWIDTH, 30f), (float)guiMaxLassoMen, 0f, 50f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 780), (float)ITEMWIDTH, 40f), "Time Between Mob Spawns", labelStyle);
					GUI.Label(new Rect((float)(CENTERX + 240), (float)(MENUY + 780), (float)ITEMWIDTH, 40f), guiTimeBetweenMobSpawns / 100f + " hours in-game", textStyle);
					guiTimeBetweenMobSpawns = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 820), (float)ITEMWIDTH, 30f), (float)(int)guiTimeBetweenMobSpawns, 0f, 800f);
					guiEnableSpawnMobsAsScrapIsFound = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 850), (float)ITEMWIDTH, 45f), guiEnableSpawnMobsAsScrapIsFound, "Spawn an extra mob after finding 25%, 50%, and 75% of total scrap.", toggleStyle);
				}
			}
		}
	}
}