Decompiled source of CrowdControl LethalCompany v1.1.13

BepInEx/plugins/CrowdControl.dll

Decompiled 2 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Net;
using System.Net.Sockets;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Text;
using System.Threading;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using ControlValley;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyTestMod;
using Newtonsoft.Json;
using TMPro;
using TerminalApi;
using TerminalApi.Classes;
using TerminalApi.Events;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.AI;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Lethal Company Crowd Control")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lethal Company Crowd Control")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("d4f6b961-e8ae-4e4b-950c-37644e42d4ca")]
[assembly: AssemblyFileVersion("1.1.11")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.1.11.0")]
namespace LethalCompanyTestMod
{
	[BepInPlugin("WarpWorld.CrowdControl", "Crowd Control", "1.1.12")]
	public class TestMod : BaseUnityPlugin
	{
		private const string modGUID = "WarpWorld.CrowdControl";

		private const string modName = "Crowd Control";

		private const string modVersion = "1.1.12";

		public static string tsVersion = "1.1.12";

		public static Dictionary<string, (string name, string conn)> version = new Dictionary<string, (string, string)>();

		private readonly Harmony harmony = new Harmony("WarpWorld.CrowdControl");

		public static Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>> levelEnemySpawns;

		public static Dictionary<SpawnableEnemyWithRarity, int> enemyRaritys;

		public static Dictionary<SpawnableEnemyWithRarity, AnimationCurve> enemyPropCurves;

		public static ManualLogSource mls;

		public static SelectableLevel currentLevel;

		public static EnemyVent[] currentLevelVents;

		public static RoundManager currentRound;

		public static StartOfRound currentStart;

		private static SpawnableEnemyWithRarity jesterRef;

		public static bool noClipEnabled;

		public static bool enableGod;

		public static bool nightVision;

		public static bool infSprint;

		public static PlayerControllerB playerRef;

		public static bool speedHack;

		public static float nightVisionIntensity;

		public static float nightVisionRange;

		public static Color nightVisionColor;

		private static bool hasGUISynced = false;

		internal static bool isHost = false;

		internal static TestMod Instance = null;

		private ControlClient client = null;

		public static bool test = false;

		public static uint msgid = 0u;

		public static uint msgid2 = 0u;

		public static uint msgid3 = 0u;

		public static uint verwait = 0u;

		public static uint floodtime = 0u;

		public static Queue<Action> ActionQueue = new Queue<Action>();

		private void Awake()
		{
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010f: Expected O, but got Unknown
			Instance = this;
			mls = Logger.CreateLogSource("Crowd Control");
			mls.LogInfo((object)"Loaded WarpWorld.CrowdControl. Patching.");
			harmony.PatchAll(typeof(TestMod));
			mls.LogInfo((object)"Initializing Crowd Control");
			try
			{
				client = new ControlClient();
				new Thread(client.NetworkLoop).Start();
				new Thread(client.RequestLoop).Start();
			}
			catch (Exception ex)
			{
				mls.LogInfo((object)("CC Init Error: " + ex.ToString()));
			}
			mls.LogInfo((object)"Crowd Control Initialized");
			mls = ((BaseUnityPlugin)this).Logger;
			enemyRaritys = new Dictionary<SpawnableEnemyWithRarity, int>();
			levelEnemySpawns = new Dictionary<SelectableLevel, List<SpawnableEnemyWithRarity>>();
			enemyPropCurves = new Dictionary<SpawnableEnemyWithRarity, AnimationCurve>();
			noClipEnabled = false;
			enableGod = false;
			infSprint = false;
			Events.TerminalBeginUsing += new TerminalEventHandler(OnBeginUsing);
		}

		private void OnBeginUsing(object sender, TerminalEventArgs e)
		{
			HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_vercheck</size>", -1);
		}

		private static string OnCCVersion()
		{
			string text = "Checking Crowd Control Versions...\n\n";
			foreach (KeyValuePair<string, (string, string)> item in version)
			{
				text = text + item.Key + ": version " + item.Value.Item1 + " Live: " + item.Value.Item2 + "\n";
			}
			return text;
		}

		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPrefix]
		private static void startRound()
		{
			currentStart = StartOfRound.Instance;
		}

		[HarmonyPatch(typeof(RoundManager), "Start")]
		[HarmonyPrefix]
		private static void setIsHost()
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Expected O, but got Unknown
			isHost = ((NetworkBehaviour)RoundManager.Instance).NetworkManager.IsHost;
			verwait = 30u;
			CommandInfo val = new CommandInfo();
			val.Category = "other";
			val.Description = "Checks crowd control version.";
			val.DisplayTextSupplier = OnCCVersion;
			TerminalApi.AddCommand("crowdcontrol", val, (string)null, true);
		}

		[HarmonyPatch(typeof(StartOfRound), "StartGame")]
		[HarmonyPostfix]
		private static void StartRound()
		{
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b5: Expected O, but got Unknown
			currentStart = StartOfRound.Instance;
			EnemyAI[] array = Resources.FindObjectsOfTypeAll<EnemyAI>().ToArray();
			EnemyAI[] array2 = array;
			foreach (EnemyAI val in array2)
			{
				SpawnableEnemyWithRarity val2 = new SpawnableEnemyWithRarity();
				val2.enemyType = val.enemyType;
				val2.rarity = 0;
				if (!currentStart.currentLevel.Enemies.Contains(val2) && !val2.enemyType.isOutsideEnemy)
				{
					currentStart.currentLevel.Enemies.Add(val2);
				}
			}
			EnemyAI[] array3 = array;
			foreach (EnemyAI val3 in array3)
			{
				SpawnableEnemyWithRarity val4 = new SpawnableEnemyWithRarity();
				val4.enemyType = val3.enemyType;
				val4.rarity = 0;
				if (!currentStart.currentLevel.OutsideEnemies.Contains(val4) && val4.enemyType.isOutsideEnemy)
				{
					currentStart.currentLevel.OutsideEnemies.Add(val4);
				}
			}
		}

		[HarmonyPatch(typeof(RoundManager), "LoadNewLevel")]
		[HarmonyPrefix]
		private static bool ModifyLevel(ref SelectableLevel newLevel)
		{
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d3: Expected O, but got Unknown
			currentRound = RoundManager.Instance;
			if (!levelEnemySpawns.ContainsKey(newLevel))
			{
				List<SpawnableEnemyWithRarity> list = new List<SpawnableEnemyWithRarity>();
				foreach (SpawnableEnemyWithRarity enemy in newLevel.Enemies)
				{
					list.Add(enemy);
				}
				levelEnemySpawns.Add(newLevel, list);
			}
			levelEnemySpawns.TryGetValue(newLevel, out var value);
			newLevel.Enemies = value;
			foreach (SpawnableEnemyWithRarity enemy2 in newLevel.Enemies)
			{
				if (!enemyRaritys.ContainsKey(enemy2))
				{
					enemyRaritys.Add(enemy2, enemy2.rarity);
				}
				int value2 = 0;
				enemyRaritys.TryGetValue(enemy2, out value2);
				enemy2.rarity = value2;
			}
			foreach (SpawnableEnemyWithRarity outsideEnemy in newLevel.OutsideEnemies)
			{
				if (!enemyRaritys.ContainsKey(outsideEnemy))
				{
					enemyRaritys.Add(outsideEnemy, outsideEnemy.rarity);
				}
				int value3 = 0;
				enemyRaritys.TryGetValue(outsideEnemy, out value3);
				outsideEnemy.rarity = value3;
			}
			foreach (SpawnableEnemyWithRarity enemy3 in newLevel.Enemies)
			{
				if (!enemyPropCurves.ContainsKey(enemy3))
				{
					enemyPropCurves.Add(enemy3, enemy3.enemyType.probabilityCurve);
				}
				AnimationCurve value4 = new AnimationCurve();
				enemyPropCurves.TryGetValue(enemy3, out value4);
				enemy3.enemyType.probabilityCurve = value4;
			}
			HUDManager.Instance.AddTextToChatOnServer("\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n", -1);
			return true;
		}

		[HarmonyPatch(typeof(RoundManager), "AdvanceHourAndSpawnNewBatchOfEnemies")]
		[HarmonyPrefix]
		private static void updateCurrentLevelInfo(ref EnemyVent[] ___allEnemyVents, ref SelectableLevel ___currentLevel)
		{
			currentLevel = ___currentLevel;
			currentLevelVents = ___allEnemyVents;
		}

		[HarmonyPatch(typeof(RoundManager), "Update")]
		[HarmonyPrefix]
		private static void roundUpdate()
		{
			if (CrowdDelegates.givedelay != 0)
			{
				CrowdDelegates.givedelay--;
			}
			if (verwait != 0)
			{
				verwait--;
			}
			if (ActionQueue.Count > 0)
			{
				Action action = ActionQueue.Dequeue();
				action();
			}
			lock (BuffThread.threads)
			{
				foreach (BuffThread thread in BuffThread.threads)
				{
					if (!thread.paused)
					{
						thread.buff.tick();
					}
				}
			}
		}

		private static IEnumerator getVersions()
		{
			version.Clear();
			HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_vercheck</size>", -1);
			yield return (object)new WaitForSeconds(0.5f);
			foreach (KeyValuePair<string, (string, string)> versionNum in version)
			{
				mls.LogError((object)$"{versionNum.Key} is running LC Crowd Control version {versionNum.Value}");
			}
		}

		private static IEnumerator getTermVersions()
		{
			version.Clear();
			HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_vercheck</size>", -1);
			yield return (object)new WaitForSeconds(0.5f);
		}

		[HarmonyPatch(typeof(HUDManager), "AddChatMessage")]
		[HarmonyPrefix]
		private static bool CrowdControlCommands(HUDManager __instance, string chatMessage)
		{
			//IL_198a: Unknown result type (might be due to invalid IL or missing references)
			//IL_1990: Invalid comparison between Unknown and I4
			//IL_1a20: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a2f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a35: Invalid comparison between Unknown and I4
			//IL_19b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_08f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_1919: Unknown result type (might be due to invalid IL or missing references)
			//IL_191e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1925: Unknown result type (might be due to invalid IL or missing references)
			//IL_1932: Unknown result type (might be due to invalid IL or missing references)
			//IL_1938: Unknown result type (might be due to invalid IL or missing references)
			//IL_193d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1942: Unknown result type (might be due to invalid IL or missing references)
			//IL_194e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1abd: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ac2: Unknown result type (might be due to invalid IL or missing references)
			//IL_1acc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ad2: Invalid comparison between Unknown and I4
			//IL_14d2: Unknown result type (might be due to invalid IL or missing references)
			//IL_14dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_14e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_14ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_1751: Unknown result type (might be due to invalid IL or missing references)
			//IL_175b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1767: Unknown result type (might be due to invalid IL or missing references)
			//IL_1771: Unknown result type (might be due to invalid IL or missing references)
			//IL_1776: Unknown result type (might be due to invalid IL or missing references)
			//IL_1782: Unknown result type (might be due to invalid IL or missing references)
			//IL_1788: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d61: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d66: Unknown result type (might be due to invalid IL or missing references)
			//IL_10d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_10fe: Expected O, but got Unknown
			//IL_1b0b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ab7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ac3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0acd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ad7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ade: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af0: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0af9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0afb: 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_1685: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b1c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b2d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b16: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b18: Unknown result type (might be due to invalid IL or missing references)
			//IL_13c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_13e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_13eb: Expected O, but got Unknown
			try
			{
				string text = chatMessage;
				if (chatMessage.ToLower() == "/ccversion" && isHost)
				{
					if (verwait == 0)
					{
						((MonoBehaviour)__instance).StartCoroutine(getVersions());
					}
					return false;
				}
				if (!text.StartsWith("<size=0>"))
				{
					return true;
				}
				text = text.Replace("<size=0>", "");
				text = text.Replace("</size>", "");
				if (!text.StartsWith("/cc_"))
				{
					return true;
				}
				text = text.Replace("/cc_", "");
				string[] values = text.Split(new char[1] { '_' });
				switch (values[0])
				{
				case "version":
					if (!version.ContainsKey(values[1]))
					{
						version.Add(values[1], (values[2], values[3]));
					}
					return false;
				case "vercheck":
					if (verwait != 0)
					{
						return false;
					}
					verwait = 30u;
					playerRef = StartOfRound.Instance.localPlayerController;
					HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_version_{playerRef.playerUsername}_{tsVersion}_{ControlClient.connect}</size>", -1);
					return false;
				case "spawn":
					if (!isHost)
					{
						return true;
					}
					ActionQueue.Enqueue(delegate
					{
						foreach (SpawnableEnemyWithRarity outsideEnemy in StartOfRound.Instance.currentLevel.OutsideEnemies)
						{
							if (outsideEnemy.enemyType.enemyName.ToLower().Contains(values[1]))
							{
								try
								{
									SpawnEnemy(outsideEnemy, 1, inside: false);
									return;
								}
								catch (Exception)
								{
									return;
								}
							}
						}
						foreach (SpawnableEnemyWithRarity enemy in StartOfRound.Instance.currentLevel.Enemies)
						{
							if (enemy.enemyType.enemyName.ToLower().Contains(values[1]))
							{
								try
								{
									SpawnEnemy(enemy, 1, inside: false);
									break;
								}
								catch (Exception)
								{
									break;
								}
							}
						}
					});
					break;
				case "cspawn":
				{
					if (!isHost)
					{
						return true;
					}
					int num6 = int.Parse(values[2]);
					PlayerControllerB player = null;
					PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
					foreach (PlayerControllerB val4 in allPlayerScripts)
					{
						if ((Object)(object)val4 != (Object)null && ((Behaviour)val4).isActiveAndEnabled && !val4.isPlayerDead && (int)val4.playerClientId == num6 && val4.isPlayerControlled)
						{
							player = val4;
						}
					}
					if ((Object)(object)player == (Object)null)
					{
						return true;
					}
					ActionQueue.Enqueue(delegate
					{
						//IL_0104: Unknown result type (might be due to invalid IL or missing references)
						//IL_0109: Unknown result type (might be due to invalid IL or missing references)
						//IL_013f: Unknown result type (might be due to invalid IL or missing references)
						//IL_014f: Unknown result type (might be due to invalid IL or missing references)
						//IL_0159: Unknown result type (might be due to invalid IL or missing references)
						//IL_015e: Unknown result type (might be due to invalid IL or missing references)
						//IL_0163: 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)
						foreach (SpawnableEnemyWithRarity outsideEnemy2 in StartOfRound.Instance.currentLevel.OutsideEnemies)
						{
							if (values[1] == "mimic")
							{
								GameObject val21 = null;
								SelectableLevel[] levels = StartOfRound.Instance.levels;
								foreach (SelectableLevel val22 in levels)
								{
									if ((Object)(object)val21 == (Object)null)
									{
										foreach (SpawnableItemWithRarity item in val22.spawnableScrap)
										{
											if (((Object)item.spawnableItem).name.ToLower() == "tragedymask")
											{
												val21 = item.spawnableItem.spawnPrefab;
											}
										}
									}
								}
								if (!((Object)(object)val21 == (Object)null))
								{
									GameObject val23 = Object.Instantiate<GameObject>(val21, ((Component)player).transform.position, Quaternion.identity, currentStart.propsContainer);
									HauntedMaskItem component4 = val23.GetComponent<HauntedMaskItem>();
									GameObject val24 = Object.Instantiate<GameObject>(component4.mimicEnemy.enemyPrefab, ((Component)player).transform.position + ((Component)player).transform.forward * 5f, Quaternion.Euler(Vector3.zero));
									val24.gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
									MaskedPlayerEnemy component5 = val24.GetComponent<MaskedPlayerEnemy>();
									component5.mimickingPlayer = player;
									component5.SetSuit(player.currentSuitID);
									((EnemyAI)component5).SetEnemyOutside(!player.isInsideFactory);
									component5.SetVisibilityOfMaskedEnemy();
									component5.SetMaskType(component4.maskTypeId);
									HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_mimic_{((NetworkBehaviour)component5).NetworkObject.NetworkObjectId}</size>", -1);
									val24.gameObject.GetComponentInChildren<EnemyAI>().stunNormalizedTimer = 6f;
									Object.Destroy((Object)(object)val23);
								}
								return;
							}
							if (outsideEnemy2.enemyType.enemyName.ToLower().Contains(values[1]))
							{
								try
								{
									SpawnCrewEnemy(player, outsideEnemy2, 1, inside: false);
									return;
								}
								catch (Exception)
								{
									return;
								}
							}
						}
						foreach (SpawnableEnemyWithRarity enemy2 in StartOfRound.Instance.currentLevel.Enemies)
						{
							if (enemy2.enemyType.enemyName.ToLower().Contains(values[1]))
							{
								try
								{
									SpawnCrewEnemy(player, enemy2, 1, inside: false);
									break;
								}
								catch (Exception)
								{
									break;
								}
							}
						}
					});
					break;
				}
				case "poweron":
					if (!isHost)
					{
						return true;
					}
					RoundManager.Instance.PowerSwitchOnClientRpc();
					break;
				case "poweroff":
					if (!isHost)
					{
						return true;
					}
					RoundManager.Instance.PowerSwitchOffClientRpc();
					break;
				case "addhour":
				{
					if (!isHost)
					{
						return true;
					}
					TimeOfDay instance3 = TimeOfDay.Instance;
					float lengthOfHours2 = instance3.lengthOfHours;
					instance3.globalTime += lengthOfHours2;
					instance3.timeUntilDeadline -= lengthOfHours2;
					CrowdDelegates.callFunc(instance3, "MoveTimeOfDay", null);
					break;
				}
				case "remhour":
				{
					if (!isHost)
					{
						return true;
					}
					TimeOfDay instance2 = TimeOfDay.Instance;
					float lengthOfHours = instance2.lengthOfHours;
					instance2.globalTime -= lengthOfHours;
					instance2.timeUntilDeadline += lengthOfHours;
					CrowdDelegates.callFunc(instance2, "MoveTimeOfDay", null);
					break;
				}
				case "take":
				{
					int num8 = int.Parse(values[1]);
					playerRef = StartOfRound.Instance.localPlayerController;
					if ((int)StartOfRound.Instance.localPlayerController.playerClientId != num8)
					{
						return true;
					}
					playerRef.DespawnHeldObject();
					break;
				}
				case "damage":
				{
					int num29 = int.Parse(values[1]);
					playerRef = StartOfRound.Instance.localPlayerController;
					if ((int)StartOfRound.Instance.localPlayerController.playerClientId != num29)
					{
						return true;
					}
					int num30 = 25;
					if (playerRef.health < 25)
					{
						num30 = playerRef.health - 1;
					}
					playerRef.DamagePlayer(num30, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
					break;
				}
				case "heal":
				{
					int num16 = int.Parse(values[1]);
					playerRef = StartOfRound.Instance.localPlayerController;
					if ((int)StartOfRound.Instance.localPlayerController.playerClientId != num16)
					{
						return true;
					}
					playerRef.health = Mathf.Clamp(playerRef.health + 25, 0, 100);
					if (playerRef.health >= 20)
					{
						playerRef.MakeCriticallyInjured(false);
					}
					HUDManager.Instance.UpdateHealthUI(playerRef.health, true);
					break;
				}
				case "landmine":
				{
					int num24 = int.Parse(values[1]);
					PlayerControllerB val14 = null;
					PlayerControllerB[] allPlayerScripts6 = StartOfRound.Instance.allPlayerScripts;
					foreach (PlayerControllerB val15 in allPlayerScripts6)
					{
						if ((Object)(object)val15 != (Object)null && ((Behaviour)val15).isActiveAndEnabled && !val15.isPlayerDead && (int)val15.playerClientId == num24 && val15.isPlayerControlled)
						{
							val14 = val15;
						}
					}
					if ((Object)(object)val14 == (Object)null)
					{
						return true;
					}
					GameObject val16 = null;
					GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
					GameObject[] array2 = array;
					GameObject[] array3 = array2;
					foreach (GameObject val17 in array3)
					{
						if (((Object)val17).name == "Landmine")
						{
							val16 = val17;
							break;
						}
					}
					if ((Object)(object)val16 == (Object)null)
					{
						return true;
					}
					Vector3 val18 = ((Component)val14).transform.position + ((Component)val14).transform.forward * 5f - ((Component)val14).transform.up * 0.5f;
					Vector3 navMeshPosition = RoundManager.Instance.GetNavMeshPosition(val18, default(NavMeshHit), 5f, -1);
					Vector3 val19 = navMeshPosition - val18;
					if (((Vector3)(ref val19)).magnitude < 6f)
					{
						val18 = navMeshPosition;
					}
					GameObject val20 = Object.Instantiate<GameObject>(val16, val18, Quaternion.Euler(-90f, 0f, 0f), currentStart.propsContainer);
					break;
				}
				case "credits":
				{
					if (!isHost)
					{
						return true;
					}
					int num2 = int.Parse(values[1]);
					Terminal val2 = Object.FindObjectOfType<Terminal>();
					val2.groupCredits += num2;
					val2.SyncGroupCreditsServerRpc(val2.groupCredits, val2.numberOfItemsInDropship);
					if (num2 > 0)
					{
						HUDManager.Instance.DisplayTip("Crowd Control", "Crowd Control gave " + num2 + " credits", false, false, "LC_Tip1");
					}
					else
					{
						HUDManager.Instance.DisplayTip("Crowd Control", "Crowd Control took " + -1 * num2 + " credits", false, false, "LC_Tip1");
					}
					break;
				}
				case "giver":
				{
					if (!isHost)
					{
						return true;
					}
					CrowdDelegates.givedelay = 20u;
					int num9 = int.Parse(values[1]);
					int num10 = int.Parse(values[2]);
					uint num11 = uint.Parse(values[3]);
					if (num11 == msgid2)
					{
						return true;
					}
					msgid2 = num11;
					PlayerControllerB val6 = null;
					if (num10 != -1)
					{
						PlayerControllerB[] allPlayerScripts3 = StartOfRound.Instance.allPlayerScripts;
						foreach (PlayerControllerB val7 in allPlayerScripts3)
						{
							if ((Object)(object)val7 != (Object)null && ((Behaviour)val7).isActiveAndEnabled && !val7.isPlayerDead && (int)val7.playerClientId == num10 && val7.isPlayerControlled)
							{
								val6 = val7;
							}
						}
						if ((Object)(object)val6 == (Object)(object)StartOfRound.Instance.localPlayerController)
						{
							num10 = -1;
						}
					}
					else
					{
						val6 = StartOfRound.Instance.localPlayerController;
					}
					if ((Object)(object)val6 == (Object)null)
					{
						val6 = StartOfRound.Instance.localPlayerController;
						num10 = -1;
					}
					Terminal val8 = Object.FindObjectOfType<Terminal>();
					GameObject val9 = Object.Instantiate<GameObject>(StartOfRound.Instance.allItemsList.itemsList[num9].spawnPrefab, ((Component)val6).transform.position, Quaternion.identity, currentStart.propsContainer);
					val9.GetComponent<GrabbableObject>().fallTime = 0f;
					val9.GetComponent<NetworkObject>().Spawn(false);
					CrowdDelegates.msgid++;
					HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_give_{num9}_{num10}_{val9.GetComponent<NetworkObject>().NetworkObjectId}_{CrowdDelegates.msgid}</size>", -1);
					break;
				}
				case "mimic":
				{
					ulong key3 = ulong.Parse(values[1]);
					GameObject gameObject3 = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[key3]).gameObject;
					MaskedPlayerEnemy component3 = gameObject3.GetComponent<MaskedPlayerEnemy>();
					CrowdDelegates.setProperty(component3, "enemyEnabled", true);
					break;
				}
				case "give":
				{
					int num12 = int.Parse(values[1]);
					int num13 = int.Parse(values[2]);
					ulong key2 = ulong.Parse(values[3]);
					uint num14 = uint.Parse(values[4]);
					if (num14 == msgid3)
					{
						return true;
					}
					msgid3 = num14;
					playerRef = StartOfRound.Instance.localPlayerController;
					if (num13 == -1)
					{
						if (!isHost)
						{
							return true;
						}
					}
					else
					{
						if (isHost)
						{
							return true;
						}
						if ((int)StartOfRound.Instance.localPlayerController.playerClientId != num13)
						{
							return true;
						}
					}
					GameObject gameObject2 = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[key2]).gameObject;
					GrabbableObject component2 = gameObject2.GetComponent<GrabbableObject>();
					CrowdDelegates.setProperty(playerRef, "currentlyGrabbingObject", component2);
					CrowdDelegates.setProperty(playerRef, "grabInvalidated", false);
					NetworkObject networkObject2 = ((NetworkBehaviour)component2).NetworkObject;
					if ((Object)(object)networkObject2 == (Object)null || !networkObject2.IsSpawned)
					{
						return true;
					}
					component2.InteractItem();
					playerRef.playerBodyAnimator.SetBool("GrabInvalidated", false);
					playerRef.playerBodyAnimator.SetBool("GrabValidated", false);
					playerRef.playerBodyAnimator.SetBool("cancelHolding", false);
					playerRef.playerBodyAnimator.ResetTrigger("Throw");
					CrowdDelegates.callFunc(playerRef, "SetSpecialGrabAnimationBool", new object[2] { true, null });
					playerRef.isGrabbingObjectAnimation = true;
					((Behaviour)playerRef.cursorIcon).enabled = false;
					((TMP_Text)playerRef.cursorTip).text = "";
					playerRef.twoHanded = component2.itemProperties.twoHanded;
					PlayerControllerB obj2 = playerRef;
					obj2.carryWeight += Mathf.Clamp(component2.itemProperties.weight - 1f, 0f, 10f);
					if (component2.itemProperties.grabAnimationTime > 0f)
					{
						playerRef.grabObjectAnimationTime = component2.itemProperties.grabAnimationTime;
					}
					else
					{
						playerRef.grabObjectAnimationTime = 0.4f;
					}
					CrowdDelegates.callFunc(playerRef, "GrabObjectServerRpc", (object)new NetworkObjectReference(networkObject2));
					Coroutine val10 = (Coroutine)CrowdDelegates.getProperty(playerRef, "grabObjectCoroutine");
					if (val10 != null)
					{
						((MonoBehaviour)playerRef).StopCoroutine(val10);
					}
					CrowdDelegates.setProperty(playerRef, "grabObjectCoroutine", ((MonoBehaviour)playerRef).StartCoroutine("GrabObject"));
					break;
				}
				case "mgive":
				{
					string text2 = values[1];
					int num4 = int.Parse(values[2]);
					ulong key = ulong.Parse(values[3]);
					uint num5 = uint.Parse(values[4]);
					if (num5 == msgid3)
					{
						return true;
					}
					msgid3 = num5;
					playerRef = StartOfRound.Instance.localPlayerController;
					if (num4 == -1)
					{
						if (!isHost)
						{
							return true;
						}
					}
					else
					{
						if (isHost)
						{
							return true;
						}
						if ((int)StartOfRound.Instance.localPlayerController.playerClientId != num4)
						{
							return true;
						}
					}
					GameObject gameObject = ((Component)NetworkManager.Singleton.SpawnManager.SpawnedObjects[key]).gameObject;
					GrabbableObject component = gameObject.GetComponent<GrabbableObject>();
					CrowdDelegates.setProperty(playerRef, "currentlyGrabbingObject", component);
					CrowdDelegates.setProperty(playerRef, "grabInvalidated", false);
					NetworkObject networkObject = ((NetworkBehaviour)component).NetworkObject;
					if ((Object)(object)networkObject == (Object)null || !networkObject.IsSpawned)
					{
						return true;
					}
					component.InteractItem();
					playerRef.playerBodyAnimator.SetBool("GrabInvalidated", false);
					playerRef.playerBodyAnimator.SetBool("GrabValidated", false);
					playerRef.playerBodyAnimator.SetBool("cancelHolding", false);
					playerRef.playerBodyAnimator.ResetTrigger("Throw");
					CrowdDelegates.callFunc(playerRef, "SetSpecialGrabAnimationBool", new object[2] { true, null });
					playerRef.isGrabbingObjectAnimation = true;
					((Behaviour)playerRef.cursorIcon).enabled = false;
					((TMP_Text)playerRef.cursorTip).text = "";
					playerRef.twoHanded = component.itemProperties.twoHanded;
					PlayerControllerB obj = playerRef;
					obj.carryWeight += Mathf.Clamp(component.itemProperties.weight - 1f, 0f, 10f);
					if (component.itemProperties.grabAnimationTime > 0f)
					{
						playerRef.grabObjectAnimationTime = component.itemProperties.grabAnimationTime;
					}
					else
					{
						playerRef.grabObjectAnimationTime = 0.4f;
					}
					CrowdDelegates.callFunc(playerRef, "GrabObjectServerRpc", (object)new NetworkObjectReference(networkObject));
					Coroutine val3 = (Coroutine)CrowdDelegates.getProperty(playerRef, "grabObjectCoroutine");
					if (val3 != null)
					{
						((MonoBehaviour)playerRef).StopCoroutine(val3);
					}
					CrowdDelegates.setProperty(playerRef, "grabObjectCoroutine", ((MonoBehaviour)playerRef).StartCoroutine("GrabObject"));
					break;
				}
				case "ship":
				{
					int num3 = int.Parse(values[1]);
					if ((int)StartOfRound.Instance.localPlayerController.playerClientId == num3)
					{
						StartOfRound.Instance.ForcePlayerIntoShip();
					}
					break;
				}
				case "kill":
				{
					int num7 = int.Parse(values[1]);
					PlayerControllerB[] allPlayerScripts2 = StartOfRound.Instance.allPlayerScripts;
					foreach (PlayerControllerB val5 in allPlayerScripts2)
					{
						if ((Object)(object)val5 != (Object)null && ((Behaviour)val5).isActiveAndEnabled && !val5.isPlayerDead && (int)val5.playerClientId == num7 && val5.isPlayerControlled)
						{
							val5.KillPlayer(((Component)val5).transform.up * 100f, true, (CauseOfDeath)16, 0, default(Vector3));
						}
					}
					break;
				}
				case "pitch":
				{
					float num27 = float.Parse(values[1]);
					for (int num28 = 0; num28 < StartOfRound.Instance.allPlayerScripts.Length; num28++)
					{
						try
						{
							SoundManager.Instance.playerVoicePitchTargets[num28] = num27;
							SoundManager.Instance.playerVoicePitches[num28] = num27;
							if ((Object)(object)StartOfRound.Instance.allPlayerScripts[num28] != (Object)null)
							{
								if ((Object)(object)StartOfRound.Instance.allPlayerScripts[num28].currentVoiceChatAudioSource != (Object)null)
								{
									StartOfRound.Instance.allPlayerScripts[num28].currentVoiceChatAudioSource.pitch = num27;
								}
								SoundManager.Instance.SetPlayerPitch(num27, num28);
							}
						}
						catch (Exception ex2)
						{
							mls.LogError((object)ex2.ToString());
						}
					}
					break;
				}
				case "tele":
				{
					int num22 = int.Parse(values[1]);
					int num23 = int.Parse(values[2]);
					if ((int)StartOfRound.Instance.localPlayerController.playerClientId != num22)
					{
						break;
					}
					PlayerControllerB[] allPlayerScripts5 = StartOfRound.Instance.allPlayerScripts;
					foreach (PlayerControllerB val13 in allPlayerScripts5)
					{
						if ((Object)(object)val13 != (Object)null && ((Behaviour)val13).isActiveAndEnabled && !val13.isPlayerDead && (int)val13.playerClientId == num23 && val13.isPlayerControlled)
						{
							StartOfRound.Instance.localPlayerController.TeleportPlayer(((Component)val13).transform.position, false, 0f, false, true);
						}
					}
					break;
				}
				case "body":
				{
					int num20 = int.Parse(values[1]);
					uint num21 = uint.Parse(values[2]);
					if (num21 == msgid)
					{
						return true;
					}
					msgid = num21;
					PlayerControllerB[] allPlayerScripts4 = StartOfRound.Instance.allPlayerScripts;
					foreach (PlayerControllerB val12 in allPlayerScripts4)
					{
						if ((Object)(object)val12 != (Object)null && ((Behaviour)val12).isActiveAndEnabled && !val12.isPlayerDead && (int)val12.playerClientId == num20 && val12.isPlayerControlled)
						{
							val12.SpawnDeadBody((int)val12.playerClientId, ((Component)val12).transform.up * 2f + ((Component)val12).transform.forward * 5f, 0, val12, 0, (Transform)null, default(Vector3));
						}
					}
					break;
				}
				case "deadline":
				{
					float timeUntilDeadline = float.Parse(values[1]);
					TimeOfDay.Instance.timeUntilDeadline = timeUntilDeadline;
					TimeOfDay.Instance.UpdateProfitQuotaCurrentTime();
					HUDManager.Instance.DisplayDaysLeft((int)Mathf.Floor(TimeOfDay.Instance.timeUntilDeadline / TimeOfDay.Instance.totalTime));
					Object.FindObjectOfType<Terminal>().SetItemSales();
					break;
				}
				case "revive":
					StartOfRound.Instance.ReviveDeadPlayers();
					HUDManager.Instance.HideHUD(false);
					break;
				case "doors":
				{
					int num19 = int.Parse(values[1]);
					HangarShipDoor val11 = Object.FindObjectOfType<HangarShipDoor>();
					val11.PlayDoorAnimation(num19 == 1);
					break;
				}
				case "quota":
				{
					int num17 = int.Parse(values[1]);
					int num18 = int.Parse(values[2]);
					TimeOfDay.Instance.quotaFulfilled = num17;
					TimeOfDay.Instance.profitQuota = num18;
					((TMP_Text)StartOfRound.Instance.profitQuotaMonitorText).text = $"PROFIT QUOTA:\n${num17} / ${num18}";
					break;
				}
				case "inverse":
				{
					int num15 = int.Parse(values[1]);
					if ((int)StartOfRound.Instance.localPlayerController.playerClientId == num15)
					{
						Random random = new Random(StartOfRound.Instance.timeSinceRoundStarted.GetHashCode());
						Vector3 position = RoundManager.Instance.insideAINodes[random.Next(0, RoundManager.Instance.insideAINodes.Length)].transform.position;
						RoundManager instance = RoundManager.Instance;
						Random random2 = random;
						Vector3 randomNavMeshPositionInBoxPredictable = instance.GetRandomNavMeshPositionInBoxPredictable(position, 10f, default(NavMeshHit), random2, -1);
						StartOfRound.Instance.localPlayerController.TeleportPlayer(randomNavMeshPositionInBoxPredictable, false, 0f, false, true);
					}
					break;
				}
				case "weather":
				{
					int num = int.Parse(values[1]);
					TimeOfDay.Instance.DisableAllWeather(true);
					if ((int)StartOfRound.Instance.currentLevel.currentWeather >= 0)
					{
						WeatherEffect val = TimeOfDay.Instance.effects[StartOfRound.Instance.currentLevel.currentWeather];
						if (val != null)
						{
							val.effectEnabled = false;
							if ((Object)(object)val.effectPermanentObject != (Object)null)
							{
								val.effectPermanentObject.SetActive(false);
							}
							if ((Object)(object)val.effectObject != (Object)null)
							{
								val.effectObject.SetActive(false);
							}
						}
					}
					StartOfRound.Instance.currentLevel.currentWeather = (LevelWeatherType)num;
					if ((int)StartOfRound.Instance.currentLevel.currentWeather >= 0)
					{
						WeatherEffect val = TimeOfDay.Instance.effects[num];
						if (val != null)
						{
							val.effectEnabled = true;
							if ((Object)(object)val.effectPermanentObject != (Object)null)
							{
								val.effectPermanentObject.SetActive(true);
							}
							if ((Object)(object)val.effectObject != (Object)null)
							{
								val.effectObject.SetActive(true);
							}
						}
					}
					try
					{
						TimeOfDay.Instance.currentLevelWeather = RoundManager.Instance.currentLevel.currentWeather;
						if ((int)TimeOfDay.Instance.currentLevelWeather == -1 || RoundManager.Instance.currentLevel.randomWeathers == null)
						{
							break;
						}
						for (int i = 0; i < RoundManager.Instance.currentLevel.randomWeathers.Length; i++)
						{
							if (RoundManager.Instance.currentLevel.randomWeathers[i].weatherType == RoundManager.Instance.currentLevel.currentWeather)
							{
								TimeOfDay.Instance.currentWeatherVariable = RoundManager.Instance.currentLevel.randomWeathers[i].weatherVariable;
								TimeOfDay.Instance.currentWeatherVariable2 = RoundManager.Instance.currentLevel.randomWeathers[i].weatherVariable2;
							}
						}
					}
					catch (Exception ex)
					{
						mls.LogError((object)ex.ToString());
					}
					break;
				}
				}
			}
			catch (Exception ex3)
			{
				mls.LogError((object)ex3.ToString());
			}
			return false;
		}

		public static void SpawnEnemyWithConfigManager(string enemyName)
		{
			if (!isHost)
			{
				return;
			}
			bool flag = false;
			string text = "";
			foreach (SpawnableEnemyWithRarity enemy in currentLevel.Enemies)
			{
				if (enemy.enemyType.enemyName.ToLower().Contains(enemyName.ToLower()))
				{
					try
					{
						flag = true;
						text = enemy.enemyType.enemyName;
						SpawnEnemy(enemy, 1, inside: true);
					}
					catch
					{
					}
					break;
				}
			}
			if (flag)
			{
				return;
			}
			foreach (SpawnableEnemyWithRarity outsideEnemy in currentLevel.OutsideEnemies)
			{
				mls.LogInfo((object)("outside enemy: " + outsideEnemy.enemyType.enemyName));
				if (outsideEnemy.enemyType.enemyName.ToLower().Contains(enemyName.ToLower()))
				{
					try
					{
						flag = true;
						text = outsideEnemy.enemyType.enemyName;
						SpawnEnemy(outsideEnemy, 1, inside: false);
						break;
					}
					catch (Exception ex)
					{
						mls.LogInfo((object)("The game tossed an error: " + ex.Message));
						break;
					}
				}
			}
		}

		public static void SpawnEnemy(SpawnableEnemyWithRarity enemy, int amount, bool inside)
		{
			//IL_001d: 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_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_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			GameObject val = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, ((Component)localPlayerController).transform.position + ((Component)localPlayerController).transform.forward * 5f, Quaternion.Euler(Vector3.zero));
			val.gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
			val.gameObject.GetComponentInChildren<EnemyAI>().stunNormalizedTimer = 6f;
		}

		public static void SpawnCrewEnemy(PlayerControllerB player, SpawnableEnemyWithRarity enemy, int amount, bool inside)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(enemy.enemyType.enemyPrefab, ((Component)player).transform.position + ((Component)player).transform.forward * 5f, Quaternion.Euler(Vector3.zero));
			val.gameObject.GetComponentInChildren<NetworkObject>().Spawn(true);
			val.gameObject.GetComponentInChildren<EnemyAI>().stunNormalizedTimer = 6f;
		}
	}
}
namespace LethalCompanyTestMod.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	public class PlayerControllerBPatch
	{
		[HarmonyPatch("Start")]
		[HarmonyPrefix]
		private static void getNightVision(ref PlayerControllerB __instance)
		{
			//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_0062: Unknown result type (might be due to invalid IL or missing references)
			TestMod.playerRef = __instance;
			TestMod.nightVision = ((Behaviour)TestMod.playerRef.nightVision).enabled;
			TestMod.nightVisionIntensity = TestMod.playerRef.nightVision.intensity;
			TestMod.nightVisionColor = TestMod.playerRef.nightVision.color;
			TestMod.nightVisionRange = TestMod.playerRef.nightVision.range;
			TestMod.playerRef.nightVision.color = Color.green;
			TestMod.playerRef.nightVision.intensity = 1000f;
			TestMod.playerRef.nightVision.range = 10000f;
		}

		[HarmonyPatch("SetNightVisionEnabled")]
		[HarmonyPostfix]
		private static void updateNightVision()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if (TestMod.nightVision)
			{
				TestMod.playerRef.nightVision.color = Color.green;
				TestMod.playerRef.nightVision.intensity = 1000f;
				TestMod.playerRef.nightVision.range = 10000f;
			}
			else
			{
				TestMod.playerRef.nightVision.color = TestMod.nightVisionColor;
				TestMod.playerRef.nightVision.intensity = TestMod.nightVisionIntensity;
				TestMod.playerRef.nightVision.range = TestMod.nightVisionRange;
			}
			((Behaviour)TestMod.playerRef.nightVision).enabled = true;
		}

		[HarmonyPatch("AllowPlayerDeath")]
		[HarmonyPrefix]
		private static bool OverrideDeath()
		{
			if (!TestMod.isHost)
			{
				return true;
			}
			return !TestMod.enableGod;
		}

		[HarmonyPatch("Update")]
		[HarmonyPostfix]
		private static void InfiniteSprint(ref float ___sprintMeter)
		{
			if (TestMod.infSprint && TestMod.isHost)
			{
				Mathf.Clamp(___sprintMeter += 0.02f, 0f, 1f);
			}
		}
	}
}
namespace LethalCompanyTestMod.Component
{
	internal class GUILoader : MonoBehaviour
	{
		private KeyboardShortcut openCloseMenu;

		private bool isMenuOpen;

		public bool noClipButton;

		internal bool wasKeyDown;

		private int toolbarInt = 0;

		private string[] toolbarStrings = new string[4] { "AI Modification/Spawning", "Host Settings", "Time Settings", "Scrap Settings" };

		private int MENUWIDTH = 600;

		private int MENUHEIGHT = 800;

		private int MENUX;

		private int MENUY;

		private int ITEMWIDTH = 300;

		private int CENTERX;

		public bool guiHideCommandMessage;

		public bool guiHideEnemySpawnMessages;

		public bool guiShouldEnemiesSpawnNaturally;

		public bool guiEnableAIModifiers;

		public bool guiEnableInfiniteSprint;

		public bool guiEnableInfiniteCredits;

		public bool guiEnableGod;

		public bool guiEnableNightVision;

		public bool guiEnableSpeedHack;

		public bool guiEnableScrapModifiers;

		public bool guiEnableCustomBuyRate;

		public bool guiUseRandomBuyRate;

		public bool guiUseCustomTimeScale;

		public bool guiUseRandomTimeScale;

		public bool guiEnableInfiniteDeadline;

		public bool guiEnableCustomDeadline;

		public bool guiUseRandomDeadline;

		public bool guiSpawnButtonPressed;

		public string guiServerName;

		public string guiRoundPost;

		public string guiXPChange;

		public string guiSelectedEnemy;

		public string guiPrefix;

		public int guiMinScrap;

		public int guiMaxScrap;

		public int guiMinScrapValue;

		public int guiMaxScrapValue;

		public int guiMinimumDeadline;

		public int guiMaximumDeadline;

		public float guiSpringSpeed;

		public float guiPopupTimer;

		public float guiMaxJesterSpeed;

		public float guiCrankingTimer;

		public float guiJesterResetTimer;

		public float guiMinTimeScale;

		public float guiMaxTimeScale;

		public float guiMinBuyRate;

		public float guiMaxBuyRate;

		private GUIStyle menuStyle;

		private GUIStyle buttonStyle;

		private GUIStyle labelStyle;

		private GUIStyle toggleStyle;

		private GUIStyle hScrollStyle;

		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)
			TestMod.mls.LogInfo((object)"GUILoader loaded.");
			openCloseMenu = new KeyboardShortcut((KeyCode)277, Array.Empty<KeyCode>());
			isMenuOpen = 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 intitializeMenu()
		{
			//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_0086: 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_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: 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);
				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;
				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()
		{
			TestMod.mls.LogInfo((object)"The GUILoader was destroyed :(");
		}

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

		public void OnGUI()
		{
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_0174: 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_01f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0240: Unknown result type (might be due to invalid IL or missing references)
			//IL_027f: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0305: Unknown result type (might be due to invalid IL or missing references)
			//IL_034c: Unknown result type (might be due to invalid IL or missing references)
			//IL_038c: Unknown result type (might be due to invalid IL or missing references)
			//IL_03cd: 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_0443: Unknown result type (might be due to invalid IL or missing references)
			//IL_0475: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ac: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0523: 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_059a: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0606: Unknown result type (might be due to invalid IL or missing references)
			//IL_063c: Unknown result type (might be due to invalid IL or missing references)
			//IL_067d: Unknown result type (might be due to invalid IL or missing references)
			//IL_06be: Unknown result type (might be due to invalid IL or missing references)
			//IL_06ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0740: Unknown result type (might be due to invalid IL or missing references)
			//IL_0786: Unknown result type (might be due to invalid IL or missing references)
			//IL_07c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0802: Unknown result type (might be due to invalid IL or missing references)
			//IL_0842: Unknown result type (might be due to invalid IL or missing references)
			//IL_0889: Unknown result type (might be due to invalid IL or missing references)
			//IL_08ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_0911: Unknown result type (might be due to invalid IL or missing references)
			//IL_0953: Unknown result type (might be due to invalid IL or missing references)
			//IL_0994: Unknown result type (might be due to invalid IL or missing references)
			//IL_09d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a1b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a5a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aa1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ae3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b21: Unknown result type (might be due to invalid IL or missing references)
			//IL_0b5e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ba5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0be4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c2b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c6b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cab: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cf2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d33: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d7a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0dbb: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e02: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e43: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e8a: Unknown result type (might be due to invalid IL or missing references)
			if (!guiIsHost)
			{
				return;
			}
			if (menuStyle == null)
			{
				intitializeMenu();
			}
			if (isMenuOpen)
			{
				GUI.Box(new Rect((float)MENUX, (float)MENUY, (float)MENUWIDTH, (float)MENUHEIGHT), "GameMaster", menuStyle);
				toolbarInt = GUI.Toolbar(new Rect((float)MENUX, (float)(MENUY - 30), (float)MENUWIDTH, 30f), toolbarInt, toolbarStrings, buttonStyle);
				switch (toolbarInt)
				{
				case 0:
					guiSelectedEnemy = GUI.TextField(new Rect((float)(MENUX + (MENUWIDTH / 2 - ITEMWIDTH)), (float)(MENUY + 30), (float)ITEMWIDTH, 30f), guiSelectedEnemy);
					guiSpawnButtonPressed = GUI.Button(new Rect((float)(MENUX + MENUWIDTH / 2), (float)(MENUY + 30), (float)ITEMWIDTH, 30f), "Spawn Enemy", buttonStyle);
					guiSpringSpeed = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), guiSpringSpeed, 0.1f, 150f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "Speed of the CoilHead " + guiSpringSpeed, labelStyle);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 200), (float)ITEMWIDTH, 30f), "Jester Popup speed " + guiPopupTimer, labelStyle);
					guiPopupTimer = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 230), (float)ITEMWIDTH, 30f), guiPopupTimer, 0.1f, 100f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 270), (float)ITEMWIDTH, 30f), "Jester cranking speed " + guiCrankingTimer, labelStyle);
					guiCrankingTimer = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 300), (float)ITEMWIDTH, 30f), guiCrankingTimer, 0.1f, 10f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 340), (float)ITEMWIDTH, 30f), "Jester reset speed " + guiJesterResetTimer, labelStyle);
					guiJesterResetTimer = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 370), (float)ITEMWIDTH, 30f), guiJesterResetTimer, 5f, 5000f);
					guiEnableAIModifiers = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 410), (float)ITEMWIDTH, 30f), guiEnableAIModifiers, "Enable AI Modifications", toggleStyle);
					guiShouldEnemiesSpawnNaturally = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 440), (float)ITEMWIDTH, 30f), guiShouldEnemiesSpawnNaturally, "Should Enemies Spawn Naturally", toggleStyle);
					break;
				case 1:
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 30), (float)ITEMWIDTH, 30f), "Server Name", labelStyle);
					guiServerName = GUI.TextField(new Rect((float)CENTERX, (float)(MENUY + 60), (float)ITEMWIDTH, 30f), guiServerName);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 100), (float)ITEMWIDTH, 30f), "Server Message", labelStyle);
					guiRoundPost = GUI.TextField(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), guiRoundPost);
					guiHideCommandMessage = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 170), (float)ITEMWIDTH, 30f), guiHideCommandMessage, "Hide Command Messages", toggleStyle);
					guiHideEnemySpawnMessages = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 200), (float)ITEMWIDTH, 30f), guiHideEnemySpawnMessages, "Hide Enemy Spawn Messages", toggleStyle);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 230), (float)ITEMWIDTH, 30f), "Command Prefix", labelStyle);
					guiPrefix = GUI.TextField(new Rect((float)CENTERX, (float)(MENUY + 260), (float)ITEMWIDTH, 30f), guiPrefix);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 300), (float)ITEMWIDTH, 30f), "XP Change", labelStyle);
					guiXPChange = GUI.TextField(new Rect((float)CENTERX, (float)(MENUY + 330), (float)ITEMWIDTH, 30f), guiXPChange);
					guiEnableInfiniteSprint = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 360), (float)ITEMWIDTH, 30f), guiEnableInfiniteSprint, "Infinite Sprint", toggleStyle);
					guiEnableInfiniteCredits = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 390), (float)ITEMWIDTH, 30f), guiEnableInfiniteCredits, "Infinite Credits", toggleStyle);
					guiEnableGod = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 420), (float)ITEMWIDTH, 30f), guiEnableGod, "God Mode", toggleStyle);
					guiEnableNightVision = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 450), (float)ITEMWIDTH, 30f), guiEnableNightVision, "NightVision", toggleStyle);
					guiEnableSpeedHack = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 480), (float)ITEMWIDTH, 30f), guiEnableSpeedHack, "SpeedHack", toggleStyle);
					break;
				case 2:
					guiEnableInfiniteDeadline = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 30), (float)(ITEMWIDTH + 100), 30f), guiEnableInfiniteDeadline, "Infinite Deadline(overrides all deadline settings)", toggleStyle);
					guiEnableCustomDeadline = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 60), (float)ITEMWIDTH, 30f), guiEnableCustomDeadline, "Custom Deadline", toggleStyle);
					guiUseRandomDeadline = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 90), (float)ITEMWIDTH, 30f), guiUseRandomDeadline, "Random Deadline", toggleStyle);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 130), (float)ITEMWIDTH, 30f), "Minimum Deadline " + guiMinimumDeadline, labelStyle);
					guiMinimumDeadline = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 160), (float)ITEMWIDTH, 30f), (float)guiMinimumDeadline, 1f, 20f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 200), (float)ITEMWIDTH, 30f), "Maximum Deadline " + guiMaximumDeadline, labelStyle);
					guiMaximumDeadline = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 230), (float)ITEMWIDTH, 30f), (float)guiMaximumDeadline, 1f, 20f);
					guiUseCustomTimeScale = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 270), (float)ITEMWIDTH, 30f), guiUseCustomTimeScale, "Custom Timescale", toggleStyle);
					guiUseRandomTimeScale = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 300), (float)ITEMWIDTH, 30f), guiUseRandomTimeScale, "Random Timescale", toggleStyle);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 330), (float)ITEMWIDTH, 30f), "Minimum Timescale " + guiMinTimeScale, labelStyle);
					guiMinTimeScale = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 360), (float)ITEMWIDTH, 30f), guiMinTimeScale, 0.1f, 10f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 400), (float)ITEMWIDTH, 30f), "Maximum Timescale " + guiMaxTimeScale, labelStyle);
					guiMaxTimeScale = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 430), (float)ITEMWIDTH, 30f), guiMaxTimeScale, 0.1f, 10f);
					break;
				case 3:
					guiEnableCustomBuyRate = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 30), (float)ITEMWIDTH, 30f), guiEnableCustomBuyRate, "Custom Buyrate", toggleStyle);
					guiUseRandomBuyRate = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 60), (float)ITEMWIDTH, 30f), guiUseRandomBuyRate, "Random Buyrate", toggleStyle);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 110), (float)ITEMWIDTH, 30f), "Min Buy Rate " + guiMinBuyRate, labelStyle);
					guiMinBuyRate = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 140), (float)ITEMWIDTH, 30f), guiMinBuyRate, -1f, 10f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 180), (float)ITEMWIDTH, 30f), "Max Buy Rate " + guiMaxBuyRate, labelStyle);
					guiMaxBuyRate = GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 210), (float)ITEMWIDTH, 30f), guiMaxBuyRate, -1f, 10f);
					guiEnableScrapModifiers = GUI.Toggle(new Rect((float)CENTERX, (float)(MENUY + 260), (float)ITEMWIDTH, 30f), guiEnableScrapModifiers, "Enable Scrap Modifiers", toggleStyle);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 310), (float)ITEMWIDTH, 30f), "Minimum Amount of Scrap " + guiMinScrap, labelStyle);
					guiMinScrap = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 340), (float)ITEMWIDTH, 30f), (float)guiMinScrap, 0f, 500f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 380), (float)ITEMWIDTH, 30f), "Maximum Amount of Scrap " + guiMaxScrap, labelStyle);
					guiMaxScrap = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 410), (float)ITEMWIDTH, 30f), (float)guiMaxScrap, 0f, 500f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 450), (float)ITEMWIDTH, 30f), "Min Scrap Value " + guiMinScrapValue, labelStyle);
					guiMinScrapValue = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 480), (float)ITEMWIDTH, 30f), (float)guiMinScrapValue, 0f, 100000f);
					GUI.Label(new Rect((float)CENTERX, (float)(MENUY + 520), (float)ITEMWIDTH, 30f), "Max Scrap Value " + guiMaxScrapValue, labelStyle);
					guiMaxScrapValue = (int)GUI.HorizontalSlider(new Rect((float)CENTERX, (float)(MENUY + 550), (float)ITEMWIDTH, 30f), (float)guiMaxScrapValue, 0f, 100000f);
					break;
				}
			}
		}
	}
}
namespace ControlValley
{
	public enum BuffType
	{
		HYPER_MOVE,
		FAST_MOVE,
		SLOW_MOVE,
		FREEZE,
		ULTRA_JUMP,
		HIGH_JUMP,
		LOW_JUMP,
		OHKO,
		INVUL,
		NOSTAM,
		INFSTAM,
		NIGHT_VISION,
		HIGH_PITCH,
		LOW_PITCH,
		DRUNK
	}
	public class Buff
	{
		public BuffType type;

		private float old;

		private static int frames;

		public Buff(BuffType t)
		{
			type = t;
			BuffType buffType = type;
			BuffType buffType2 = buffType;
			if ((uint)(buffType2 - 7) <= 1u)
			{
				PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
				old = localPlayerController.health;
			}
		}

		public void addBuff(int duration)
		{
			switch (type)
			{
			case BuffType.DRUNK:
			{
				PlayerControllerB localPlayerController9 = StartOfRound.Instance.localPlayerController;
				float drunkness = Math.Min((float)duration * 10f, 1200f);
				localPlayerController9.drunkness = drunkness;
				localPlayerController9.drunknessSpeed = 1f;
				localPlayerController9.drunknessInertia = 20f;
				break;
			}
			case BuffType.LOW_PITCH:
				TestMod.ActionQueue.Enqueue(delegate
				{
					HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_pitch_0.65</size>", -1);
				});
				break;
			case BuffType.HIGH_PITCH:
				TestMod.ActionQueue.Enqueue(delegate
				{
					HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_pitch_1.5</size>", -1);
				});
				break;
			case BuffType.NIGHT_VISION:
			{
				PlayerControllerB localPlayerController8 = StartOfRound.Instance.localPlayerController;
				TestMod.nightVision = true;
				break;
			}
			case BuffType.FREEZE:
			{
				PlayerControllerB localPlayerController7 = StartOfRound.Instance.localPlayerController;
				localPlayerController7.movementSpeed = 0f;
				break;
			}
			case BuffType.HYPER_MOVE:
			{
				PlayerControllerB localPlayerController6 = StartOfRound.Instance.localPlayerController;
				localPlayerController6.movementSpeed = 18f;
				break;
			}
			case BuffType.FAST_MOVE:
			{
				PlayerControllerB localPlayerController5 = StartOfRound.Instance.localPlayerController;
				localPlayerController5.movementSpeed = 9f;
				break;
			}
			case BuffType.SLOW_MOVE:
			{
				PlayerControllerB localPlayerController4 = StartOfRound.Instance.localPlayerController;
				localPlayerController4.movementSpeed = 1.25f;
				break;
			}
			case BuffType.ULTRA_JUMP:
			{
				PlayerControllerB localPlayerController3 = StartOfRound.Instance.localPlayerController;
				localPlayerController3.jumpForce = 50f;
				break;
			}
			case BuffType.HIGH_JUMP:
			{
				PlayerControllerB localPlayerController2 = StartOfRound.Instance.localPlayerController;
				localPlayerController2.jumpForce = 35f;
				break;
			}
			case BuffType.LOW_JUMP:
			{
				PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
				localPlayerController.jumpForce = 5f;
				break;
			}
			case BuffType.OHKO:
			case BuffType.INVUL:
			case BuffType.NOSTAM:
			case BuffType.INFSTAM:
				break;
			}
		}

		public void removeBuff()
		{
			switch (type)
			{
			case BuffType.DRUNK:
			{
				PlayerControllerB localPlayerController4 = StartOfRound.Instance.localPlayerController;
				localPlayerController4.drunkness = 0f;
				localPlayerController4.drunknessSpeed = 0f;
				localPlayerController4.drunknessInertia = 0f;
				break;
			}
			case BuffType.HIGH_PITCH:
			case BuffType.LOW_PITCH:
				TestMod.ActionQueue.Enqueue(delegate
				{
					HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_pitch_1.0</size>", -1);
				});
				break;
			case BuffType.NIGHT_VISION:
			{
				PlayerControllerB localPlayerController3 = StartOfRound.Instance.localPlayerController;
				TestMod.nightVision = false;
				break;
			}
			case BuffType.HYPER_MOVE:
			case BuffType.FAST_MOVE:
			case BuffType.SLOW_MOVE:
			case BuffType.FREEZE:
			{
				PlayerControllerB localPlayerController2 = StartOfRound.Instance.localPlayerController;
				localPlayerController2.movementSpeed = 4.6f;
				break;
			}
			case BuffType.ULTRA_JUMP:
			case BuffType.HIGH_JUMP:
			case BuffType.LOW_JUMP:
			{
				PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
				localPlayerController.jumpForce = 13f;
				break;
			}
			case BuffType.OHKO:
			case BuffType.INVUL:
				TestMod.ActionQueue.Enqueue(delegate
				{
					PlayerControllerB localPlayerController5 = StartOfRound.Instance.localPlayerController;
					localPlayerController5.health = (int)old;
					if (localPlayerController5.health >= 20)
					{
						localPlayerController5.MakeCriticallyInjured(false);
					}
					if (localPlayerController5.health < 10)
					{
						localPlayerController5.MakeCriticallyInjured(true);
					}
					HUDManager.Instance.UpdateHealthUI(localPlayerController5.health, true);
				});
				break;
			case BuffType.NOSTAM:
			case BuffType.INFSTAM:
				break;
			}
		}

		public void tick()
		{
			frames++;
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			switch (type)
			{
			case BuffType.HIGH_PITCH:
				if (frames % 16 == 0)
				{
					HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_pitch_1.5</size>", -1);
				}
				break;
			case BuffType.LOW_PITCH:
				if (frames % 16 == 0)
				{
					HUDManager.Instance.AddTextToChatOnServer("<size=0>/cc_pitch_0.65</size>", -1);
				}
				break;
			case BuffType.OHKO:
				if (localPlayerController.health > 1)
				{
					localPlayerController.health = 1;
				}
				if (localPlayerController.health >= 20)
				{
					localPlayerController.MakeCriticallyInjured(false);
				}
				if (localPlayerController.health < 10)
				{
					localPlayerController.MakeCriticallyInjured(true);
				}
				HUDManager.Instance.UpdateHealthUI(localPlayerController.health, true);
				break;
			case BuffType.INVUL:
				if (localPlayerController.health > 0)
				{
					localPlayerController.health = 100;
				}
				if (localPlayerController.health >= 20)
				{
					localPlayerController.MakeCriticallyInjured(false);
				}
				if (localPlayerController.health < 10)
				{
					localPlayerController.MakeCriticallyInjured(true);
				}
				HUDManager.Instance.UpdateHealthUI(localPlayerController.health, true);
				break;
			case BuffType.INFSTAM:
				localPlayerController.sprintMeter = 1f;
				localPlayerController.isExhausted = false;
				break;
			case BuffType.NOSTAM:
				localPlayerController.sprintMeter = 0f;
				localPlayerController.isExhausted = true;
				break;
			case BuffType.NIGHT_VISION:
				break;
			}
		}
	}
	public class BuffThread
	{
		public static List<BuffThread> threads = new List<BuffThread>();

		public readonly Buff buff;

		public int duration;

		public int remain;

		public int id;

		public bool paused;

		public static bool isRunning(BuffType t)
		{
			foreach (BuffThread thread in threads)
			{
				if (thread.buff.type == t)
				{
					return true;
				}
			}
			return false;
		}

		public static void tick()
		{
			foreach (BuffThread thread in threads)
			{
				if (!thread.paused)
				{
					thread.buff.tick();
				}
			}
		}

		public static void addTime(int duration)
		{
			try
			{
				lock (threads)
				{
					foreach (BuffThread thread in threads)
					{
						Interlocked.Add(ref thread.duration, duration + 5);
						if (!thread.paused)
						{
							int dur = Volatile.Read(ref thread.remain);
							new TimedResponse(thread.id, dur, CrowdResponse.Status.STATUS_PAUSE).Send(ControlClient.Socket);
							thread.paused = true;
						}
					}
				}
			}
			catch (Exception ex)
			{
				TestMod.mls.LogInfo((object)ex.ToString());
			}
		}

		public static void tickTime(int duration)
		{
			try
			{
				lock (threads)
				{
					foreach (BuffThread thread in threads)
					{
						int num = Volatile.Read(ref thread.remain);
						num -= duration;
						if (num < 0)
						{
							num = 0;
						}
						Volatile.Write(ref thread.remain, num);
					}
				}
			}
			catch (Exception ex)
			{
				TestMod.mls.LogInfo((object)ex.ToString());
			}
		}

		public static void unPause()
		{
			try
			{
				lock (threads)
				{
					foreach (BuffThread thread in threads)
					{
						if (thread.paused)
						{
							int dur = Volatile.Read(ref thread.remain);
							new TimedResponse(thread.id, dur, CrowdResponse.Status.STATUS_RESUME).Send(ControlClient.Socket);
							thread.paused = false;
						}
					}
				}
			}
			catch (Exception ex)
			{
				TestMod.mls.LogInfo((object)ex.ToString());
			}
		}

		public BuffThread(int id, BuffType buff, int duration)
		{
			this.buff = new Buff(buff);
			this.duration = duration;
			remain = duration;
			this.id = id;
			paused = false;
			try
			{
				lock (threads)
				{
					threads.Add(this);
				}
			}
			catch (Exception ex)
			{
				TestMod.mls.LogInfo((object)ex.ToString());
			}
		}

		public void Run()
		{
			Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
			buff.addBuff(duration);
			try
			{
				for (int num = Volatile.Read(ref duration); num > 0; num = Volatile.Read(ref duration))
				{
					Interlocked.Add(ref duration, -num);
					Thread.Sleep(num);
				}
				buff.removeBuff();
				lock (threads)
				{
					threads.Remove(this);
				}
				new TimedResponse(id, 0, CrowdResponse.Status.STATUS_STOP).Send(ControlClient.Socket);
			}
			catch (Exception ex)
			{
				TestMod.mls.LogInfo((object)ex.ToString());
			}
		}
	}
	public class ControlClient
	{
		public static readonly string CV_HOST = "127.0.0.1";

		public static readonly int CV_PORT = 51338;

		private bool paused = false;

		public bool inGame = true;

		public static bool connect = false;

		private Dictionary<string, CrowdDelegate> Delegate { get; set; }

		private IPEndPoint Endpoint { get; set; }

		private Queue<CrowdRequest> Requests { get; set; }

		private bool Running { get; set; }

		private bool Saving { get; set; }

		private bool Spawn { get; set; }

		public static Socket Socket { get; set; }

		public ControlClient()
		{
			Endpoint = new IPEndPoint(IPAddress.Parse(CV_HOST), CV_PORT);
			Requests = new Queue<CrowdRequest>();
			Running = true;
			Saving = false;
			Spawn = true;
			Socket = null;
			connect = false;
			Delegate = new Dictionary<string, CrowdDelegate>
			{
				{
					"heal_full",
					CrowdDelegates.HealFull
				},
				{
					"kill",
					CrowdDelegates.Kill
				},
				{
					"killcrew",
					CrowdDelegates.KillCrewmate
				},
				{
					"damage",
					CrowdDelegates.Damage
				},
				{
					"damagecrew",
					CrowdDelegates.DamageCrew
				},
				{
					"heal",
					CrowdDelegates.Heal
				},
				{
					"healcrew",
					CrowdDelegates.HealCrew
				},
				{
					"launch",
					CrowdDelegates.Launch
				},
				{
					"fast",
					CrowdDelegates.FastMove
				},
				{
					"slow",
					CrowdDelegates.SlowMove
				},
				{
					"hyper",
					CrowdDelegates.HyperMove
				},
				{
					"freeze",
					CrowdDelegates.Freeze
				},
				{
					"drunk",
					CrowdDelegates.Drunk
				},
				{
					"jumpultra",
					CrowdDelegates.UltraJump
				},
				{
					"jumphigh",
					CrowdDelegates.HighJump
				},
				{
					"jumplow",
					CrowdDelegates.LowJump
				},
				{
					"ohko",
					CrowdDelegates.OHKO
				},
				{
					"invul",
					CrowdDelegates.Invul
				},
				{
					"drain",
					CrowdDelegates.DrainStamins
				},
				{
					"restore",
					CrowdDelegates.RestoreStamins
				},
				{
					"infstam",
					CrowdDelegates.InfiniteStamina
				},
				{
					"nostam",
					CrowdDelegates.NoStamina
				},
				{
					"spawn_pede",
					CrowdDelegates.Spawn
				},
				{
					"spawn_spider",
					CrowdDelegates.Spawn
				},
				{
					"spawn_hoard",
					CrowdDelegates.Spawn
				},
				{
					"spawn_flower",
					CrowdDelegates.Spawn
				},
				{
					"spawn_crawl",
					CrowdDelegates.Spawn
				},
				{
					"spawn_blob",
					CrowdDelegates.Spawn
				},
				{
					"spawn_spring",
					CrowdDelegates.Spawn
				},
				{
					"spawn_puff",
					CrowdDelegates.Spawn
				},
				{
					"spawn_dog",
					CrowdDelegates.Spawn
				},
				{
					"spawn_giant",
					CrowdDelegates.Spawn
				},
				{
					"spawn_levi",
					CrowdDelegates.Spawn
				},
				{
					"spawn_hawk",
					CrowdDelegates.Spawn
				},
				{
					"spawn_girl",
					CrowdDelegates.Spawn
				},
				{
					"spawn_mimic",
					CrowdDelegates.Spawn
				},
				{
					"spawn_cracker",
					CrowdDelegates.Spawn
				},
				{
					"spawn_landmine",
					CrowdDelegates.Spawn
				},
				{
					"webs",
					CrowdDelegates.CreateWebs
				},
				{
					"killenemies",
					CrowdDelegates.KillEnemies
				},
				{
					"spawn_radmech",
					CrowdDelegates.Spawn
				},
				{
					"spawn_clay",
					CrowdDelegates.Spawn
				},
				{
					"spawn_butler",
					CrowdDelegates.Spawn
				},
				{
					"spawn_jester",
					CrowdDelegates.Spawn
				},
				{
					"spawn_eater",
					CrowdDelegates.Spawn
				},
				{
					"cspawn_pede",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_spider",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_hoard",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_flower",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_crawl",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_blob",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_spring",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_puff",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_dog",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_giant",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_levi",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_hawk",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_girl",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_cracker",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_mimic",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_landmine",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_radmech",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_butler",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_jester",
					CrowdDelegates.CrewSpawn
				},
				{
					"cspawn_eater",
					CrowdDelegates.CrewSpawn
				},
				{
					"give_binoculars",
					CrowdDelegates.GiveItem
				},
				{
					"give_boombox",
					CrowdDelegates.GiveItem
				},
				{
					"give_flashlight",
					CrowdDelegates.GiveItem
				},
				{
					"give_jetpack",
					CrowdDelegates.GiveItem
				},
				{
					"give_key",
					CrowdDelegates.GiveItem
				},
				{
					"give_lockpicker",
					CrowdDelegates.GiveItem
				},
				{
					"give_lungapparatus",
					CrowdDelegates.GiveItem
				},
				{
					"give_mapdevice",
					CrowdDelegates.GiveItem
				},
				{
					"give_proflashlight",
					CrowdDelegates.GiveItem
				},
				{
					"give_shovel",
					CrowdDelegates.GiveItem
				},
				{
					"give_stungrenade",
					CrowdDelegates.GiveItem
				},
				{
					"give_extensionladder",
					CrowdDelegates.GiveItem
				},
				{
					"give_tzpinhalant",
					CrowdDelegates.GiveItem
				},
				{
					"give_walkietalkie",
					CrowdDelegates.GiveItem
				},
				{
					"give_zapgun",
					CrowdDelegates.GiveItem
				},
				{
					"give_7ball",
					CrowdDelegates.GiveItem
				},
				{
					"give_airhorn",
					CrowdDelegates.GiveItem
				},
				{
					"give_bottlebin",
					CrowdDelegates.GiveItem
				},
				{
					"give_clownhorn",
					CrowdDelegates.GiveItem
				},
				{
					"give_goldbar",
					CrowdDelegates.GiveItem
				},
				{
					"give_stopsign",
					CrowdDelegates.GiveItem
				},
				{
					"give_radarbooster",
					CrowdDelegates.GiveItem
				},
				{
					"give_yieldsign",
					CrowdDelegates.GiveItem
				},
				{
					"give_shotgun",
					CrowdDelegates.GiveItem
				},
				{
					"give_gunAmmo",
					CrowdDelegates.GiveItem
				},
				{
					"give_spraypaint",
					CrowdDelegates.GiveItem
				},
				{
					"give_giftbox",
					CrowdDelegates.GiveItem
				},
				{
					"give_tragedymask",
					CrowdDelegates.GiveItem
				},
				{
					"give_comedymask",
					CrowdDelegates.GiveItem
				},
				{
					"give_knife",
					CrowdDelegates.GiveItem
				},
				{
					"give_easteregg",
					CrowdDelegates.GiveItem
				},
				{
					"give_weedkiller",
					CrowdDelegates.GiveItem
				},
				{
					"cgive_binoculars",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_boombox",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_flashlight",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_jetpack",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_key",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_lockpicker",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_lungapparatus",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_mapdevice",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_proflashlight",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_shovel",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_stungrenade",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_extensionladder",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_tzpinhalant",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_walkietalkie",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_zapgun",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_7ball",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_airhorn",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_bottlebin",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_clownhorn",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_goldbar",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_stopsign",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_radarbooster",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_yieldsign",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_shotgun",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_gunAmmo",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_spraypaint",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_giftbox",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_tragedymask",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_comedymask",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_knife",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_easteregg",
					CrowdDelegates.GiveCrewItem
				},
				{
					"cgive_weedkiller",
					CrowdDelegates.GiveCrewItem
				},
				{
					"weather_-1",
					CrowdDelegates.Weather
				},
				{
					"weather_1",
					CrowdDelegates.Weather
				},
				{
					"weather_2",
					CrowdDelegates.Weather
				},
				{
					"weather_3",
					CrowdDelegates.Weather
				},
				{
					"weather_4",
					CrowdDelegates.Weather
				},
				{
					"weather_5",
					CrowdDelegates.Weather
				},
				{
					"weather_6",
					CrowdDelegates.Weather
				},
				{
					"lightning",
					CrowdDelegates.Lightning
				},
				{
					"takeitem",
					CrowdDelegates.TakeItem
				},
				{
					"dropitem",
					CrowdDelegates.DropItem
				},
				{
					"takecrewitem",
					CrowdDelegates.TakeCrewItem
				},
				{
					"buy_walkie",
					CrowdDelegates.BuyItem
				},
				{
					"buy_flashlight",
					CrowdDelegates.BuyItem
				},
				{
					"buy_shovel",
					CrowdDelegates.BuyItem
				},
				{
					"buy_lockpicker",
					CrowdDelegates.BuyItem
				},
				{
					"buy_proflashlight",
					CrowdDelegates.BuyItem
				},
				{
					"buy_stungrenade",
					CrowdDelegates.BuyItem
				},
				{
					"buy_boombox",
					CrowdDelegates.BuyItem
				},
				{
					"buy_inhaler",
					CrowdDelegates.BuyItem
				},
				{
					"buy_stungun",
					CrowdDelegates.BuyItem
				},
				{
					"buy_jetpack",
					CrowdDelegates.BuyItem
				},
				{
					"buy_extensionladder",
					CrowdDelegates.BuyItem
				},
				{
					"buy_radarbooster",
					CrowdDelegates.BuyItem
				},
				{
					"buy_spraypaint",
					CrowdDelegates.BuyItem
				},
				{
					"buy_weedkiller",
					CrowdDelegates.BuyItem
				},
				{
					"buy_cruiser",
					CrowdDelegates.BuyCruiser
				},
				{
					"turn_off_engine",
					CrowdDelegates.TurnOffEngine
				},
				{
					"destroy_vehicle",
					CrowdDelegates.DestroyVehicle
				},
				{
					"start_vehicle",
					CrowdDelegates.TurnOnVehicle
				},
				{
					"spring_chair",
					CrowdDelegates.SpringChair
				},
				{
					"charge",
					CrowdDelegates.ChargeItem
				},
				{
					"uncharge",
					CrowdDelegates.UnchargeItem
				},
				{
					"breakerson",
					CrowdDelegates.BreakersOn
				},
				{
					"breakersoff",
					CrowdDelegates.BreakersOff
				},
				{
					"toship",
					CrowdDelegates.TeleportToShip
				},
				{
					"crewship",
					CrowdDelegates.TeleportCrewToShip
				},
				{
					"body",
					CrowdDelegates.SpawnBody
				},
				{
					"crewbody",
					CrowdDelegates.SpawnCrewBody
				},
				{
					"nightvision",
					CrowdDelegates.NightVision
				},
				{
					"revive",
					CrowdDelegates.Revive
				},
				{
					"tocrew",
					CrowdDelegates.TeleportToCrew
				},
				{
					"crewto",
					CrowdDelegates.TeleportCrewTo
				},
				{
					"screech",
					CrowdDelegates.Screech
				},
				{
					"footstep",
					CrowdDelegates.Footstep
				},
				{
					"breathing",
					CrowdDelegates.Breathing
				},
				{
					"ghost",
					CrowdDelegates.Ghost
				},
				{
					"horn",
					CrowdDelegates.PlayHorn
				},
				{
					"blob",
					CrowdDelegates.BlobSound
				},
				{
					"highpitch",
					CrowdDelegates.HighPitch
				},
				{
					"lowpitch",
					CrowdDelegates.LowPitch
				},
				{
					"addhour",
					CrowdDelegates.AddHour
				},
				{
					"remhour",
					CrowdDelegates.RemoveHour
				},
				{
					"addday",
					CrowdDelegates.AddDay
				},
				{
					"remday",
					CrowdDelegates.RemoveDay
				},
				{
					"givecred_5",
					CrowdDelegates.AddCredits
				},
				{
					"givecred_50",
					CrowdDelegates.AddCredits
				},
				{
					"givecred_500",
					CrowdDelegates.AddCredits
				},
				{
					"givecred_-5",
					CrowdDelegates.AddCredits
				},
				{
					"givecred_-50",
					CrowdDelegates.AddCredits
				},
				{
					"givecred_-500",
					CrowdDelegates.AddCredits
				},
				{
					"givequota_5",
					CrowdDelegates.AddQuota
				},
				{
					"givequota_50",
					CrowdDelegates.AddQuota
				},
				{
					"givequota_500",
					CrowdDelegates.AddQuota
				},
				{
					"givequota_-5",
					CrowdDelegates.AddQuota
				},
				{
					"givequota_-50",
					CrowdDelegates.AddQuota
				},
				{
					"givequota_-500",
					CrowdDelegates.AddQuota
				},
				{
					"giveprofit_25",
					CrowdDelegates.AddProfit
				},
				{
					"giveprofit_50",
					CrowdDelegates.AddProfit
				},
				{
					"giveprofit_100",
					CrowdDelegates.AddProfit
				},
				{
					"giveprofit_-25",
					CrowdDelegates.AddProfit
				},
				{
					"giveprofit_-50",
					CrowdDelegates.AddProfit
				},
				{
					"giveprofit_-100",
					CrowdDelegates.AddProfit
				},
				{
					"addscrap",
					CrowdDelegates.AddScrap
				},
				{
					"shipleave",
					CrowdDelegates.ShipLeave
				},
				{
					"opendoors",
					CrowdDelegates.OpenDoors
				},
				{
					"closedoors",
					CrowdDelegates.CloseDoors
				}
			};
		}

		public static void HideEffect(string code)
		{
			CrowdResponse crowdResponse = new CrowdResponse(0, CrowdResponse.Status.STATUS_NOTVISIBLE);
			crowdResponse.type = 1;
			crowdResponse.code = code;
			crowdResponse.Send(Socket);
		}

		public static void ShowEffect(string code)
		{
			CrowdResponse crowdResponse = new CrowdResponse(0, CrowdResponse.Status.STATUS_VISIBLE);
			crowdResponse.type = 1;
			crowdResponse.code = code;
			crowdResponse.Send(Socket);
		}

		public static void DisableEffect(string code)
		{
			CrowdResponse crowdResponse = new CrowdResponse(0, CrowdResponse.Status.STATUS_NOTSELECTABLE);
			crowdResponse.type = 1;
			crowdResponse.code = code;
			crowdResponse.Send(Socket);
		}

		public static void EnableEffect(string code)
		{
			CrowdResponse crowdResponse = new CrowdResponse(0, CrowdResponse.Status.STATUS_SELECTABLE);
			crowdResponse.type = 1;
			crowdResponse.code = code;
			crowdResponse.Send(Socket);
		}

		private void ClientLoop()
		{
			TestMod.mls.LogInfo((object)"Connected to Crowd Control");
			connect = true;
			Timer timer = new Timer(timeUpdate, null, 0, 200);
			try
			{
				while (Running)
				{
					CrowdRequest crowdRequest = CrowdRequest.Recieve(this, Socket);
					if (crowdRequest != null && !crowdRequest.IsKeepAlive())
					{
						lock (Requests)
						{
							Requests.Enqueue(crowdRequest);
						}
					}
				}
			}
			catch (Exception)
			{
				TestMod.mls.LogInfo((object)"Disconnected from Crowd Control");
				connect = false;
				Socket.Close();
			}
		}

		public void timeUpdate(object state)
		{
			inGame = true;
			if ((Object)(object)StartOfRound.Instance == (Object)null || StartOfRound.Instance.allPlayersDead || StartOfRound.Instance.livingPlayers < 1)
			{
				inGame = false;
			}
			if (Saving || !inGame)
			{
				BuffThread.addTime(200);
				paused = true;
			}
			else if (paused)
			{
				paused = false;
				BuffThread.unPause();
				BuffThread.tickTime(200);
			}
			else
			{
				BuffThread.tickTime(200);
			}
		}

		public bool CanSpawn()
		{
			return Spawn;
		}

		public bool IsRunning()
		{
			return Running;
		}

		public void NetworkLoop()
		{
			Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
			while (Running)
			{
				TestMod.mls.LogInfo((object)"Attempting to connect to Crowd Control");
				try
				{
					Socket = new Socket(Endpoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
					Socket.SetSocketOption(SocketOptionLevel.Socket, SocketOptionName.KeepAlive, optionValue: true);
					if (Socket.BeginConnect(Endpoint, null, null).AsyncWaitHandle.WaitOne(10000, exitContext: true) && Socket.Connected)
					{
						ClientLoop();
					}
					else
					{
						TestMod.mls.LogInfo((object)"Failed to connect to Crowd Control");
					}
					Socket.Close();
				}
				catch (Exception)
				{
					TestMod.mls.LogInfo((object)"Failed to connect to Crowd Control");
				}
				Thread.Sleep(10000);
			}
		}

		public void RequestLoop()
		{
			Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
			while (Running)
			{
				try
				{
					while (Saving || !inGame)
					{
						Thread.Yield();
					}
					CrowdRequest crowdRequest = null;
					lock (Requests)
					{
						if (Requests.Count == 0)
						{
							continue;
						}
						crowdRequest = Requests.Dequeue();
						goto IL_0082;
					}
					IL_0082:
					string reqCode = crowdRequest.GetReqCode();
					try
					{
						CrowdResponse crowdResponse = (isReady() ? Delegate[reqCode](this, crowdRequest) : new CrowdResponse(crowdRequest.GetReqID(), CrowdResponse.Status.STATUS_RETRY));
						if (crowdResponse == null)
						{
							new CrowdResponse(crowdRequest.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Request error for '" + reqCode + "'").Send(Socket);
						}
						crowdResponse.Send(Socket);
					}
					catch (KeyNotFoundException)
					{
						new CrowdResponse(crowdRequest.GetReqID(), CrowdResponse.Status.STATUS_FAILURE, "Request error for '" + reqCode + "'").Send(Socket);
					}
				}
				catch (Exception)
				{
					TestMod.mls.LogInfo((object)"Disconnected from Crowd Control");
					Socket.Close();
				}
			}
		}

		public bool isReady()
		{
			try
			{
				if (!StartOfRound.Instance.shipHasLanded)
				{
					return false;
				}
				if (RoundManager.Instance.currentLevel.PlanetName.ToLower().Contains("gordion"))
				{
					return false;
				}
				if (RoundManager.Instance.currentLevel.PlanetName.ToLower().Contains("company"))
				{
					return false;
				}
			}
			catch (Exception ex)
			{
				TestMod.mls.LogError((object)ex.ToString());
				return false;
			}
			return true;
		}

		public void Stop()
		{
			Running = false;
		}
	}
	public delegate CrowdResponse CrowdDelegate(ControlClient client, CrowdRequest req);
	public class CrowdDelegates
	{
		public enum BuyableItemList
		{
			walkie,
			flashlight,
			shovel,
			lockpicker,
			proflashlight,
			stungrenade,
			boombox,
			inhaler,
			stungun,
			jetpack,
			extensionladder,
			radarbooster,
			spraypaint,
			weedkiller
		}

		public enum buyableVehiclesList
		{
			Cruiser
		}

		public static uint msgid;

		public static uint givedelay;

		public static CrowdResponse HealFull(ControlClient client, CrowdRequest req)
		{
			CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS;
			string message = "";
			try
			{
				NetworkManager networkManager = ((NetworkBehaviour)StartOfRound.Instance).NetworkManager;
				if ((Object)(object)networkManager == (Object)null || !networkManager.IsListening)
				{
					status = CrowdResponse.Status.STATUS_RETRY;
				}
				else
				{
					TestMod.test = true;
				}
			}
			catch (Exception ex)
			{
				status = CrowdResponse.Status.STATUS_RETRY;
				TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString()));
			}
			return new CrowdResponse(req.GetReqID(), status, message);
		}

		public static CrowdResponse Kill(ControlClient client, CrowdRequest req)
		{
			CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS;
			string message = "";
			try
			{
				PlayerControllerB playerRef = StartOfRound.Instance.localPlayerController;
				if (playerRef.health <= 0 || StartOfRound.Instance.timeSinceRoundStarted < 2f || !playerRef.playersManager.shipDoorsEnabled)
				{
					status = CrowdResponse.Status.STATUS_RETRY;
				}
				else
				{
					TestMod.ActionQueue.Enqueue(delegate
					{
						//IL_001c: Unknown result type (might be due to invalid IL or missing references)
						//IL_0026: Unknown result type (might be due to invalid IL or missing references)
						//IL_0031: 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)
						if (TestMod.isHost)
						{
							playerRef.KillPlayer(((Component)playerRef).transform.up * 100f, true, (CauseOfDeath)16, 0, default(Vector3));
						}
						else
						{
							HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_kill_{(int)playerRef.playerClientId}</size>", -1);
						}
					});
				}
			}
			catch (Exception ex)
			{
				status = CrowdResponse.Status.STATUS_RETRY;
				TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString()));
			}
			return new CrowdResponse(req.GetReqID(), status, message);
		}

		public static CrowdResponse KillCrewmate(ControlClient client, CrowdRequest req)
		{
			CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS;
			string message = "";
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			List<PlayerControllerB> list = new List<PlayerControllerB>();
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if ((Object)(object)val != (Object)null && !val.isPlayerDead && (Object)(object)val != (Object)(object)localPlayerController && ((Behaviour)val).isActiveAndEnabled && val.isPlayerControlled)
				{
					list.Add(val);
				}
			}
			if (list.Count <= 0)
			{
				return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY);
			}
			try
			{
				PlayerControllerB player = list[Random.Range(0, list.Count)];
				if (StartOfRound.Instance.timeSinceRoundStarted < 2f || !localPlayerController.playersManager.shipDoorsEnabled)
				{
					status = CrowdResponse.Status.STATUS_RETRY;
				}
				else
				{
					TestMod.ActionQueue.Enqueue(delegate
					{
						HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_kill_{(int)player.playerClientId}</size>", -1);
					});
				}
			}
			catch (Exception ex)
			{
				status = CrowdResponse.Status.STATUS_RETRY;
				TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString()));
			}
			return new CrowdResponse(req.GetReqID(), status, message);
		}

		public static CrowdResponse Damage(ControlClient client, CrowdRequest req)
		{
			CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS;
			string message = "";
			if (BuffThread.isRunning(BuffType.OHKO))
			{
				return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY);
			}
			if (BuffThread.isRunning(BuffType.INVUL))
			{
				return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY);
			}
			try
			{
				PlayerControllerB playerRef = StartOfRound.Instance.localPlayerController;
				if (playerRef.health <= 20 || StartOfRound.Instance.timeSinceRoundStarted < 2f || !playerRef.playersManager.shipDoorsEnabled)
				{
					status = CrowdResponse.Status.STATUS_RETRY;
				}
				else
				{
					TestMod.ActionQueue.Enqueue(delegate
					{
						//IL_0033: Unknown result type (might be due to invalid IL or missing references)
						//IL_0039: Unknown result type (might be due to invalid IL or missing references)
						int num = 25;
						if (playerRef.health < 25)
						{
							num = playerRef.health - 1;
						}
						playerRef.DamagePlayer(num, true, true, (CauseOfDeath)0, 0, false, default(Vector3));
					});
				}
			}
			catch (Exception ex)
			{
				status = CrowdResponse.Status.STATUS_RETRY;
				TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString()));
			}
			return new CrowdResponse(req.GetReqID(), status, message);
		}

		public static CrowdResponse DamageCrew(ControlClient client, CrowdRequest req)
		{
			CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS;
			string message = "";
			List<PlayerControllerB> list = new List<PlayerControllerB>();
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if ((Object)(object)val != (Object)null && val.health >= 20 && !val.isPlayerDead && (Object)(object)val != (Object)(object)localPlayerController && ((Behaviour)val).isActiveAndEnabled && val.isPlayerControlled)
				{
					list.Add(val);
				}
			}
			if (list.Count <= 0)
			{
				return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY);
			}
			try
			{
				PlayerControllerB player = list[Random.Range(0, list.Count)];
				if (StartOfRound.Instance.timeSinceRoundStarted < 2f || !player.playersManager.shipDoorsEnabled)
				{
					status = CrowdResponse.Status.STATUS_RETRY;
				}
				else
				{
					TestMod.ActionQueue.Enqueue(delegate
					{
						HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_damage_{(int)player.playerClientId}</size>", -1);
					});
				}
			}
			catch (Exception ex)
			{
				status = CrowdResponse.Status.STATUS_RETRY;
				TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString()));
			}
			return new CrowdResponse(req.GetReqID(), status, message);
		}

		public static CrowdResponse Heal(ControlClient client, CrowdRequest req)
		{
			CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS;
			string message = "";
			if (BuffThread.isRunning(BuffType.OHKO))
			{
				return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY);
			}
			if (BuffThread.isRunning(BuffType.INVUL))
			{
				return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY);
			}
			try
			{
				PlayerControllerB playerRef = StartOfRound.Instance.localPlayerController;
				if (playerRef.health >= 100 || StartOfRound.Instance.timeSinceRoundStarted < 2f || !playerRef.playersManager.shipDoorsEnabled)
				{
					status = CrowdResponse.Status.STATUS_RETRY;
				}
				else
				{
					TestMod.ActionQueue.Enqueue(delegate
					{
						playerRef.health = Mathf.Clamp(playerRef.health + 25, 0, 100);
						if (playerRef.health >= 20)
						{
							playerRef.MakeCriticallyInjured(false);
						}
						HUDManager.Instance.UpdateHealthUI(playerRef.health, true);
					});
				}
			}
			catch (Exception ex)
			{
				status = CrowdResponse.Status.STATUS_RETRY;
				TestMod.mls.LogInfo((object)("Crowd Control Error: " + ex.ToString()));
			}
			return new CrowdResponse(req.GetReqID(), status, message);
		}

		public static CrowdResponse HealCrew(ControlClient client, CrowdRequest req)
		{
			CrowdResponse.Status status = CrowdResponse.Status.STATUS_SUCCESS;
			string message = "";
			List<PlayerControllerB> list = new List<PlayerControllerB>();
			PlayerControllerB localPlayerController = StartOfRound.Instance.localPlayerController;
			PlayerControllerB[] allPlayerScripts = StartOfRound.Instance.allPlayerScripts;
			foreach (PlayerControllerB val in allPlayerScripts)
			{
				if ((Object)(object)val != (Object)null && val.health < 100 && !val.isPlayerDead && (Object)(object)val != (Object)(object)localPlayerController && ((Behaviour)val).isActiveAndEnabled && val.isPlayerControlled)
				{
					list.Add(val);
				}
			}
			if (list.Count <= 0)
			{
				return new CrowdResponse(req.GetReqID(), CrowdResponse.Status.STATUS_RETRY);
			}
			try
			{
				PlayerControllerB player = list[Random.Range(0, list.Count)];
				if (StartOfRound.Instance.timeSinceRoundStarted < 2f || !player.playersManager.shipDoorsEnabled)
				{
					status = CrowdResponse.Status.STATUS_RETRY;
				}
				else
				{
					TestMod.ActionQueue.Enqueue(delegate
					{
						HUDManager.Instance.AddTextToChatOnServer($"<size=0>/cc_heal_{(int)player.playerClientId}</size>", -1);
					});
				}
			}
			catch (Exception ex)
			{
				status = CrowdResponse.Status.STATUS_RETRY;
				TestMod.ml