Decompiled source of BadTrainer v1.0.0

Mods/GangBeastsMod.dll

Decompiled 2 days ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using BepInEx.Unity.IL2CPP;
using Femur;
using GB.Game;
using GB.Game.Critters;
using GB.Game.Data;
using GB.Gamemodes;
using GB.Networking.Components.Server;
using GB.Networking.Utils;
using HarmonyLib;
using Il2CppInterop.Runtime.Injection;
using Il2CppInterop.Runtime.InteropTypes;
using Il2CppInterop.Runtime.InteropTypes.Arrays;
using Il2CppSystem.Collections.Generic;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETCoreApp,Version=v6.0", FrameworkDisplayName = ".NET 6.0")]
[assembly: AssemblyCompany("GangBeastsMod")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("GangBeastsMod")]
[assembly: AssemblyTitle("GangBeastsMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace NeverLetGo
{
	[BepInPlugin("com.yourname.neverletgo", "Never Let Go", "0.8.0")]
	public class NeverLetGoPlugin : BasePlugin
	{
		public override void Load()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			Cfg.Logger = ((BasePlugin)this).Log;
			ClassInjector.RegisterTypeInIl2Cpp<NeverLetGoBehaviour>();
			((BasePlugin)this).AddComponent<NeverLetGoBehaviour>();
			Harmony val = new Harmony("com.yourname.neverletgo");
			Type[] array = new Type[21]
			{
				typeof(LeftGrabPatch),
				typeof(RightGrabPatch),
				typeof(StaminaPatch),
				typeof(DamagePatch),
				typeof(TryKillPatch),
				typeof(KillPatch),
				typeof(KillBeastPatch),
				typeof(CanKillPatch),
				typeof(WavesGameOverPatch),
				typeof(WavesUpdatePatch),
				typeof(TimerExpiredPatch),
				typeof(FootballTimerPatch),
				typeof(SkipRoundBasePatch),
				typeof(SkipRoundGangPatch),
				typeof(SkipRoundWavesPatch),
				typeof(SkipRoundKothPatch),
				typeof(SkipRoundSurvivalPatch),
				typeof(SkipRoundCtfPatch),
				typeof(SkipRoundFootballPatch),
				typeof(SkipRoundRumblePatch),
				typeof(SkipRoundBigFightPatch)
			};
			Type[] array2 = array;
			foreach (Type type in array2)
			{
				try
				{
					val.PatchAll(type);
				}
				catch (Exception ex)
				{
					((BasePlugin)this).Log.LogError((object)("Patch failed: " + type.Name + " - " + ex));
				}
			}
			((BasePlugin)this).Log.LogInfo((object)"Never Let Go loaded. F6 opens the menu.");
		}
	}
	internal sealed class UiStyles
	{
		public GUIStyle Panel;

		public GUIStyle TabBar;

		public GUIStyle Card;

		public GUIStyle Status;

		public GUIStyle HudPill;

		public GUIStyle HudHint;

		public GUIStyle Close;

		public GUIStyle Title;

		public GUIStyle Subtitle;

		public GUIStyle CardTitle;

		public GUIStyle Label;

		public GUIStyle Muted;

		public GUIStyle Value;

		public GUIStyle Button;

		public GUIStyle Tab;

		public GUIStyle TabOn;

		public GUIStyle Item;

		public GUIStyle PillOn;

		public GUIStyle PillOff;

		public GUIStyle Field;

		private static readonly Color cBg = new Color(0.055f, 0.05f, 0.085f, 1f);

		private static readonly Color cBgStroke = new Color(0.2f, 0.17f, 0.3f, 1f);

		private static readonly Color cSurface = new Color(0.095f, 0.088f, 0.135f, 1f);

		private static readonly Color cSurfaceStroke = new Color(0.18f, 0.165f, 0.25f, 1f);

		private static readonly Color cSurface2 = new Color(0.14f, 0.13f, 0.2f, 1f);

		private static readonly Color cSurface2Stroke = new Color(0.22f, 0.2f, 0.31f, 1f);

		private static readonly Color cSurface3 = new Color(0.19f, 0.17f, 0.27f, 1f);

		private static readonly Color cSurface3Stroke = new Color(0.28f, 0.25f, 0.38f, 1f);

		private static readonly Color cAccent = new Color(0.55f, 0.41f, 0.98f, 1f);

		private static readonly Color cAccentHi = new Color(0.64f, 0.52f, 1f, 1f);

		private static readonly Color cAccentStroke = new Color(0.72f, 0.62f, 1f, 1f);

		private static readonly Color cField = new Color(0.07f, 0.065f, 0.11f, 1f);

		private static readonly Color cFieldStroke = new Color(0.22f, 0.2f, 0.3f, 1f);

		private static readonly Color cText = new Color(0.94f, 0.93f, 0.98f, 1f);

		private static readonly Color cMuted = new Color(0.56f, 0.54f, 0.68f, 1f);

		private static readonly Color cAccentText = new Color(0.74f, 0.66f, 1f, 1f);

		private static Texture2D Rounded(Color fill, Color stroke, int r, bool ring = true)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_0103: Unknown result type (might be due to invalid IL or missing references)
			int num = r * 2 + 3;
			Texture2D val = new Texture2D(num, num, (TextureFormat)4, false);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			float num2 = (float)num * 0.5f;
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num3 = (float)j + 0.5f - num2;
					float num4 = (float)i + 0.5f - num2;
					float num5 = Mathf.Abs(num3) - (num2 - (float)r);
					float num6 = Mathf.Abs(num4) - (num2 - (float)r);
					float num7 = Mathf.Max(num5, 0f);
					float num8 = Mathf.Max(num6, 0f);
					float num9 = Mathf.Sqrt(num7 * num7 + num8 * num8) + Mathf.Min(Mathf.Max(num5, num6), 0f) - (float)r;
					float num10 = Mathf.Clamp01(0.5f - num9);
					float num11 = (ring ? Mathf.Clamp01(num9 + 1f) : 0f);
					Color val2 = Color.Lerp(fill, stroke, num11);
					val2.a = Mathf.Max(fill.a, num11) * num10;
					val.SetPixel(j, i, val2);
				}
			}
			val.Apply();
			((Object)val).hideFlags = (HideFlags)61;
			return val;
		}

		private static GUIStyle Lbl(int size, Color c, FontStyle fs = (FontStyle)0)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_001a: 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_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(GUI.skin.label);
			val.fontSize = size;
			val.fontStyle = fs;
			val.normal.textColor = c;
			val.padding = new RectOffset(0, 0, 0, 0);
			val.margin = new RectOffset(0, 0, 0, 0);
			return val;
		}

		private static GUIStyle BoxStyle(Texture2D tex, int r, RectOffset pad)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected O, but got Unknown
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			GUIStyle val = new GUIStyle(GUI.skin.box);
			val.normal.background = tex;
			val.border = new RectOffset(r, r, r, r);
			val.padding = pad;
			val.margin = new RectOffset(0, 0, 0, 0);
			val.normal.textColor = cText;
			return val;
		}

		private static GUIStyle Btn(Texture2D normal, Texture2D hover, Texture2D active, Color text, int size, int r)
		{
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00af: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d1: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(GUI.skin.button);
			val.normal.background = normal;
			val.hover.background = hover;
			val.active.background = active;
			val.focused.background = normal;
			GUIStyleState[] array = (GUIStyleState[])(object)new GUIStyleState[4] { val.normal, val.hover, val.active, val.focused };
			foreach (GUIStyleState val2 in array)
			{
				val2.textColor = text;
			}
			val.fontSize = size;
			val.fontStyle = (FontStyle)0;
			val.border = new RectOffset(r, r, r, r);
			val.padding = new RectOffset(12, 12, 7, 7);
			val.margin = new RectOffset(2, 2, 2, 2);
			val.alignment = (TextAnchor)4;
			return val;
		}

		public static UiStyles Build()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00eb: Expected O, but got Unknown
			//IL_00f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Expected O, but got Unknown
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Expected O, but got Unknown
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Expected O, but got Unknown
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Expected O, but got Unknown
			//IL_0157: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Expected O, but got Unknown
			//IL_0191: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01fb: Expected O, but got Unknown
			//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_0212: Unknown result type (might be due to invalid IL or missing references)
			//IL_0232: Unknown result type (might be due to invalid IL or missing references)
			//IL_0248: Unknown result type (might be due to invalid IL or missing references)
			//IL_025f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0278: Unknown result type (might be due to invalid IL or missing references)
			//IL_0290: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Expected O, but got Unknown
			//IL_02d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Expected O, but got Unknown
			//IL_02e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Unknown result type (might be due to invalid IL or missing references)
			//IL_030b: Expected O, but got Unknown
			//IL_0316: Unknown result type (might be due to invalid IL or missing references)
			//IL_0320: Expected O, but got Unknown
			//IL_0327: Unknown result type (might be due to invalid IL or missing references)
			//IL_0346: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Expected O, but got Unknown
			//IL_035b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0365: Expected O, but got Unknown
			//IL_036b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Expected O, but got Unknown
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Expected O, but got Unknown
			//IL_042f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0452: Unknown result type (might be due to invalid IL or missing references)
			//IL_045c: Expected O, but got Unknown
			//IL_0467: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Expected O, but got Unknown
			//IL_047c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0486: Expected O, but got Unknown
			UiStyles uiStyles = new UiStyles();
			Texture2D tex = Rounded(cBg, cBgStroke, 12);
			Texture2D tex2 = Rounded(cSurface, cSurfaceStroke, 8);
			Texture2D val = Rounded(cSurface2, cSurface2Stroke, 7);
			Texture2D val2 = Rounded(cSurface3, cSurface3Stroke, 7);
			Texture2D val3 = Rounded(cAccent, cAccentStroke, 7);
			Texture2D val4 = Rounded(cAccentHi, cAccentStroke, 7);
			Texture2D background = Rounded(cField, cFieldStroke, 6);
			Texture2D normal = Rounded(new Color(0f, 0f, 0f, 0f), Color.clear, 7, ring: false);
			Texture2D val5 = Rounded(cAccent, cAccentStroke, 9);
			Texture2D val6 = Rounded(cSurface2, cSurface2Stroke, 9);
			uiStyles.Panel = BoxStyle(tex, 12, new RectOffset(0, 0, 0, 0));
			uiStyles.TabBar = BoxStyle(tex2, 8, new RectOffset(4, 4, 4, 4));
			uiStyles.Card = BoxStyle(tex2, 8, new RectOffset(14, 14, 12, 12));
			uiStyles.Card.margin = new RectOffset(0, 0, 0, 10);
			uiStyles.Status = BoxStyle(tex2, 8, new RectOffset(12, 12, 7, 7));
			uiStyles.HudPill = BoxStyle(tex2, 8, new RectOffset(12, 12, 5, 5));
			uiStyles.HudPill.alignment = (TextAnchor)4;
			uiStyles.HudPill.fontSize = 11;
			uiStyles.HudPill.fontStyle = (FontStyle)1;
			uiStyles.HudHint = Lbl(11, cMuted, (FontStyle)0);
			uiStyles.HudHint.alignment = (TextAnchor)5;
			uiStyles.Title = Lbl(18, cText, (FontStyle)1);
			uiStyles.Subtitle = Lbl(11, cMuted, (FontStyle)0);
			uiStyles.CardTitle = Lbl(10, cAccentText, (FontStyle)1);
			uiStyles.CardTitle.margin = new RectOffset(0, 0, 0, 8);
			uiStyles.Label = Lbl(12, cText, (FontStyle)0);
			uiStyles.Muted = Lbl(11, cMuted, (FontStyle)0);
			uiStyles.Muted.wordWrap = true;
			uiStyles.Value = Lbl(22, cText, (FontStyle)1);
			uiStyles.Button = Btn(val, val2, val2, cText, 12, 7);
			uiStyles.Tab = Btn(normal, val, val, cMuted, 12, 7);
			uiStyles.TabOn = Btn(val3, val4, val3, Color.white, 12, 7);
			uiStyles.Item = Btn(val, val2, val2, cText, 11, 6);
			uiStyles.Item.alignment = (TextAnchor)3;
			uiStyles.Item.padding = new RectOffset(12, 10, 6, 6);
			uiStyles.Item.margin = new RectOffset(0, 0, 2, 2);
			uiStyles.PillOn = Btn(val3, val4, val4, Color.white, 11, 9);
			uiStyles.PillOn.padding = new RectOffset(10, 10, 3, 3);
			uiStyles.PillOn.margin = new RectOffset(0, 0, 0, 0);
			uiStyles.PillOff = Btn(val, val2, val2, cMuted, 11, 9);
			uiStyles.PillOff.padding = new RectOffset(10, 10, 3, 3);
			uiStyles.PillOff.margin = new RectOffset(0, 0, 0, 0);
			uiStyles.Close = Btn(normal, val, val, cMuted, 13, 7);
			uiStyles.Close.padding = new RectOffset(8, 8, 2, 2);
			uiStyles.Field = new GUIStyle(GUI.skin.textField);
			uiStyles.Field.fontSize = 12;
			uiStyles.Field.normal.background = background;
			uiStyles.Field.hover.background = background;
			uiStyles.Field.focused.background = background;
			GUIStyleState[] array = (GUIStyleState[])(object)new GUIStyleState[3]
			{
				uiStyles.Field.normal,
				uiStyles.Field.hover,
				uiStyles.Field.focused
			};
			foreach (GUIStyleState val7 in array)
			{
				val7.textColor = cText;
			}
			uiStyles.Field.border = new RectOffset(6, 6, 6, 6);
			uiStyles.Field.padding = new RectOffset(8, 8, 5, 5);
			uiStyles.Field.margin = new RectOffset(0, 0, 0, 0);
			return uiStyles;
		}

		public static UiStyles Fallback()
		{
			UiStyles uiStyles = new UiStyles();
			GUISkin skin = GUI.skin;
			uiStyles.Panel = skin.box;
			uiStyles.TabBar = skin.box;
			uiStyles.Card = skin.box;
			uiStyles.Status = skin.box;
			uiStyles.HudPill = skin.box;
			uiStyles.HudHint = skin.label;
			uiStyles.Close = skin.button;
			uiStyles.Title = skin.label;
			uiStyles.Subtitle = skin.label;
			uiStyles.CardTitle = skin.label;
			uiStyles.Label = skin.label;
			uiStyles.Muted = skin.label;
			uiStyles.Value = skin.label;
			uiStyles.Button = skin.button;
			uiStyles.Tab = skin.button;
			uiStyles.TabOn = skin.button;
			uiStyles.Item = skin.button;
			uiStyles.PillOn = skin.button;
			uiStyles.PillOff = skin.button;
			uiStyles.Field = skin.textField;
			return uiStyles;
		}
	}
	internal static class Cfg
	{
		private sealed class PendingSpawn
		{
			public HashSet<int> Before;

			public Actor Player;

			public string Label;

			public float Start;

			public float LastCheck;
		}

		internal static bool KnockoutHeld;

		internal static ManualLogSource Logger;

		internal static UiStyles S;

		internal static bool Open;

		internal static Rect Win = new Rect(40f, 40f, 460f, 640f);

		internal static bool Dragging;

		internal static Vector2 DragOff;

		internal static int Tab;

		internal static Vector2 TabScroll;

		internal static Vector2 ItemScroll;

		internal static string ItemFilter = "";

		internal static CursorLockMode PrevLock;

		internal static bool PrevVisible;

		internal static bool GodMode;

		internal static bool UnbreakableGrip = true;

		internal static bool InfiniteStamina = true;

		internal static bool InfiniteWaves;

		internal static bool FreezeTimer;

		internal static bool GravityGun;

		internal static bool PunchOverride;

		internal static bool KnockoutOverride;

		internal static string PunchText = "100";

		internal static float PunchMult = 100f;

		internal static string KnockoutText = "10";

		internal static float KnockoutSeconds = 10f;

		internal static Key KnockoutKey = (Key)23;

		internal static bool Capturing;

		internal static bool Bypass;

		internal static GameMode_Waves Waves;

		internal static float WavesSeen = -100f;

		internal static GameMode_Waves NpcSource;

		internal static readonly List<string> NpcNames = new List<string>();

		private static GameMode frozenMode;

		private static float frozenTimer;

		private static float skipUntil = -100f;

		private static DebugManager spawner;

		private static float spawnerScan = -100f;

		private static DebugManager itemSource;

		internal static readonly List<string> ItemNames = new List<string>();

		private static int aiIdCounter = 0;

		private static bool loggedAiStart;

		private static readonly List<PendingSpawn> pending = new List<PendingSpawn>();

		private static Actor localCache;

		private static float localScan = -100f;

		internal static IntPtr LastActorPtr = IntPtr.Zero;

		internal static float ActorSeen;

		internal static bool SpawnRecorded;

		internal static bool HasSpawn;

		internal static Vector3 SpawnPos;

		internal static float BaseForce;

		internal static float BaseDamage;

		internal static bool HaveBasePunch;

		internal static bool PunchApplied;

		internal static float LastTeleport = -100f;

		internal static float NextKnockout;

		internal static Rigidbody Held;

		internal static float HoldDist;

		internal static readonly List<Rigidbody> FrozenByMe = new List<Rigidbody>();

		internal static string Msg = "";

		internal static float MsgTime = -100f;

		private static readonly HashSet<string> reported = new HashSet<string>();

		internal static bool SkipActive => Time.unscaledTime < skipUntil;

		internal static void Say(string m)
		{
			Msg = m;
			MsgTime = Time.unscaledTime;
		}

		internal static void Report(string where, Exception e)
		{
			string item = where + ": " + e.Message;
			if (reported.Add(item))
			{
				if (Logger != null)
				{
					Logger.LogError((object)(where + " failed: " + e));
				}
				Say("Error in " + where + ": " + e.Message);
			}
		}

		internal static void SetMenu(bool open)
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			if (open == Open)
			{
				return;
			}
			if (open)
			{
				PrevLock = Cursor.lockState;
				PrevVisible = Cursor.visible;
			}
			else
			{
				Capturing = false;
				Dragging = false;
				if (!GravityGun)
				{
					Cursor.lockState = PrevLock;
					Cursor.visible = PrevVisible;
				}
			}
			Open = open;
		}

		internal static bool IsLocal(Actor a)
		{
			try
			{
				return (Object)(object)a != (Object)null && a.IsLocal;
			}
			catch
			{
				return false;
			}
		}

		internal static bool IsLocal(StatusHandeler s)
		{
			try
			{
				return (Object)(object)s != (Object)null && IsLocal(s.actor);
			}
			catch
			{
				return false;
			}
		}

		internal static Actor LocalActor()
		{
			try
			{
				if ((Object)(object)localCache != (Object)null && localCache.IsLocal)
				{
					return localCache;
				}
			}
			catch
			{
			}
			localCache = null;
			if (Time.unscaledTime - localScan < 0.5f)
			{
				return null;
			}
			localScan = Time.unscaledTime;
			try
			{
				Il2CppArrayBase<Actor> val = Object.FindObjectsOfType<Actor>();
				if (val != null)
				{
					for (int i = 0; i < val.Length; i++)
					{
						Actor val2 = val[i];
						if ((Object)(object)val2 != (Object)null && IsLocal(val2))
						{
							localCache = val2;
							return val2;
						}
					}
				}
			}
			catch (Exception e)
			{
				Report("LocalActor", e);
			}
			return null;
		}

		internal static bool NotLobby()
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000b: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Invalid comparison between Unknown and I4
			try
			{
				GameModeEnum currentMode = GBNetUtils.GetCurrentMode();
				return (currentMode & 0x20) == 0;
			}
			catch
			{
				return true;
			}
		}

		internal static bool InGame()
		{
			return (Object)(object)LocalActor() != (Object)null && NotLobby();
		}

		internal static bool WavesActive()
		{
			return Waves != null && Time.unscaledTime - WavesSeen < 3f;
		}

		internal static Vector3 TrackPos(Actor a)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			try
			{
				Transform trackingTransform = a.GetTrackingTransform();
				if ((Object)(object)trackingTransform != (Object)null)
				{
					return trackingTransform.position;
				}
			}
			catch
			{
			}
			return ((Component)a).transform.position;
		}

		internal static void MoveBody(Component root, Vector3 refPos, Vector3 target)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = target - refPos;
			Il2CppArrayBase<Rigidbody> componentsInChildren = root.GetComponentsInChildren<Rigidbody>(true);
			foreach (Rigidbody item in componentsInChildren)
			{
				Vector3 position = item.position + val;
				item.velocity = Vector3.zero;
				item.angularVelocity = Vector3.zero;
				item.position = position;
				((Component)item).transform.position = position;
			}
		}

		internal static bool TeleportToSpawn(Actor a)
		{
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)a == (Object)null || !HasSpawn)
			{
				return false;
			}
			if (Time.unscaledTime - LastTeleport < 0.5f)
			{
				return true;
			}
			LastTeleport = Time.unscaledTime;
			MoveBody((Component)(object)a, TrackPos(a), SpawnPos + Vector3.up * 0.5f);
			return true;
		}

		internal static void TeleportNow()
		{
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			if (!InGame())
			{
				Say("Only works while in a game.");
				return;
			}
			Actor val = LocalActor();
			if (!((Object)(object)val == (Object)null))
			{
				if (!HasSpawn)
				{
					Say("No spawn point recorded yet.");
					return;
				}
				MoveBody((Component)(object)val, TrackPos(val), SpawnPos + Vector3.up * 0.5f);
				LastTeleport = Time.unscaledTime;
				Say("Teleported to spawn.");
			}
		}

		internal static bool BlockDeath(StatusHandeler s)
		{
			if (!GodMode || !IsLocal(s))
			{
				return false;
			}
			TeleportToSpawn(s.actor);
			return true;
		}

		internal static Vector3 FrontOfPlayer(Actor a, float dist, float up)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			Vector3 forward = Vector3.forward;
			Camera main = Camera.main;
			if ((Object)(object)main != (Object)null)
			{
				forward = ((Component)main).transform.forward;
				forward.y = 0f;
				if (((Vector3)(ref forward)).sqrMagnitude < 0.01f)
				{
					forward = Vector3.forward;
				}
				((Vector3)(ref forward)).Normalize();
			}
			return TrackPos(a) + forward * dist + Vector3.up * up;
		}

		internal static void ResetKnockoutTimer()
		{
			Actor val = LocalActor();
			StatusHandeler val2 = (((Object)(object)val != (Object)null) ? val.statusHandeler : null);
			if ((Object)(object)val2 == (Object)null)
			{
				Say("Not in a game.");
				return;
			}
			val2.unconsciousTime = 0f;
			Say("Knockout timer reset.");
		}

		internal static void ApplyKnockoutLength(Actor actor)
		{
			if (KnockoutOverride && !KnockoutHeld)
			{
				StatusHandeler statusHandeler = actor.statusHandeler;
				if (!((Object)(object)statusHandeler == (Object)null))
				{
					statusHandeler.SetMaxUnconsciousTime(KnockoutSeconds);
					statusHandeler.minUnconsciousTime = KnockoutSeconds;
				}
			}
		}

		internal static GameMode ActiveMode()
		{
			try
			{
				GameManagerNew instance = GameManagerNew.Instance;
				return ((Object)(object)instance != (Object)null) ? instance.ActiveGameMode : null;
			}
			catch
			{
				return null;
			}
		}

		internal static void HoldTimer()
		{
			GameMode val = ActiveMode();
			if (val == null)
			{
				frozenMode = null;
			}
			else if (val != frozenMode || val.timer > frozenTimer + 0.01f)
			{
				frozenMode = val;
				frozenTimer = val.timer;
			}
			else if (val.timer != frozenTimer)
			{
				val.timer = frozenTimer;
			}
		}

		internal static void ReleaseTimer()
		{
			frozenMode = null;
		}

		internal static string TimerText()
		{
			GameMode val = ActiveMode();
			if (val == null)
			{
				return "--:--";
			}
			int num = Mathf.Max(0, Mathf.CeilToInt(val.timer));
			return (num / 60).ToString("00") + ":" + (num % 60).ToString("00");
		}

		internal static void SkipRound()
		{
			if (!InGame())
			{
				Say("Only works while in a game.");
				return;
			}
			if (ActiveMode() == null)
			{
				Say("No round is running.");
				return;
			}
			skipUntil = Time.unscaledTime + 5f;
			Say("Round skipped.");
		}

		internal static string ModeName()
		{
			GameMode val = ActiveMode();
			if (val == null)
			{
				return "No round running";
			}
			try
			{
				return val.GetID();
			}
			catch
			{
				return "Unknown mode";
			}
		}

		internal static DebugManager Spawner()
		{
			try
			{
				GlobalManager i = GlobalManager.I;
				if ((Object)(object)i != (Object)null)
				{
					DebugManager debugManager = i.DebugManager;
					if ((Object)(object)debugManager != (Object)null)
					{
						return debugManager;
					}
				}
			}
			catch (Exception e)
			{
				Report("GlobalManager lookup", e);
			}
			if (Time.unscaledTime - spawnerScan < 0.25f)
			{
				return null;
			}
			spawnerScan = Time.unscaledTime;
			try
			{
				return Object.FindObjectOfType<DebugManager>(true);
			}
			catch (Exception e2)
			{
				Report("Spawner lookup", e2);
				return null;
			}
		}

		internal static void RefreshItemNames()
		{
			DebugManager val = Spawner();
			if ((Object)(object)val == (Object)null)
			{
				ItemNames.Clear();
				itemSource = null;
			}
			else
			{
				if (itemSource == val && ItemNames.Count > 0)
				{
					return;
				}
				itemSource = val;
				ItemNames.Clear();
				try
				{
					Il2CppReferenceArray<GameObject> prefabObject = val.prefabObject;
					if (prefabObject != null)
					{
						for (int i = 0; i < ((Il2CppArrayBase<GameObject>)(object)prefabObject).Length; i++)
						{
							GameObject val2 = ((Il2CppArrayBase<GameObject>)(object)prefabObject)[i];
							string text = (((Object)(object)val2 != (Object)null) ? ((Object)val2).name : ("Item " + i));
							ItemNames.Add(text.Replace("(Clone)", "").Trim());
						}
					}
				}
				catch (Exception e)
				{
					Report("Item list", e);
				}
			}
		}

		private static HashSet<int> SnapshotTransforms()
		{
			HashSet<int> hashSet = new HashSet<int>();
			Il2CppArrayBase<Transform> val = Object.FindObjectsOfType<Transform>();
			int num = 0;
			while (val != null && num < val.Length)
			{
				if ((Object)(object)val[num] != (Object)null)
				{
					hashSet.Add(((Object)val[num]).GetInstanceID());
				}
				num++;
			}
			return hashSet;
		}

		private static List<Transform> NewTopLevel(HashSet<int> before)
		{
			List<Transform> list = new List<Transform>();
			HashSet<int> hashSet = new HashSet<int>();
			Il2CppArrayBase<Transform> val = Object.FindObjectsOfType<Transform>();
			int num = 0;
			while (val != null && num < val.Length)
			{
				Transform val2 = val[num];
				if (!((Object)(object)val2 == (Object)null))
				{
					int instanceID = ((Object)val2).GetInstanceID();
					if (!before.Contains(instanceID))
					{
						list.Add(val2);
						hashSet.Add(instanceID);
					}
				}
				num++;
			}
			List<Transform> list2 = new List<Transform>();
			foreach (Transform item in list)
			{
				if ((Object)(object)item.parent == (Object)null || !hashSet.Contains(((Object)item.parent).GetInstanceID()))
				{
					list2.Add(item);
				}
			}
			return list2;
		}

		private static void PlaceTop(Transform t, Vector3 target)
		{
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)t).GetComponentsInChildren<Rigidbody>(true).Length > 0)
			{
				MoveBody((Component)(object)t, t.position, target);
			}
			else
			{
				t.position = target;
			}
		}

		private static void BeginSpawn(string label, Action spawn)
		{
			if (!InGame())
			{
				Say("Only spawns while in a game.");
				return;
			}
			if (pending.Count > 0)
			{
				Say("Still placing the last spawn, try again.");
				return;
			}
			Actor val = LocalActor();
			if ((Object)(object)val == (Object)null)
			{
				Say("No local player found.");
				return;
			}
			try
			{
				HashSet<int> before = SnapshotTransforms();
				spawn();
				pending.Add(new PendingSpawn
				{
					Before = before,
					Player = val,
					Label = label,
					Start = Time.unscaledTime,
					LastCheck = Time.unscaledTime
				});
				Say("Spawning " + label + "...");
			}
			catch (Exception e)
			{
				Report("Spawn " + label, e);
			}
		}

		internal static void ProcessPending()
		{
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			for (int num = pending.Count - 1; num >= 0; num--)
			{
				PendingSpawn pendingSpawn = pending[num];
				if ((Object)(object)pendingSpawn.Player == (Object)null || Time.unscaledTime - pendingSpawn.Start > 3f)
				{
					pending.RemoveAt(num);
					if ((Object)(object)pendingSpawn.Player != (Object)null)
					{
						Say("Couldn't place " + pendingSpawn.Label + " in front of you.");
					}
				}
				else if (!(Time.unscaledTime - pendingSpawn.LastCheck < 0.15f))
				{
					pendingSpawn.LastCheck = Time.unscaledTime;
					List<Transform> list = NewTopLevel(pendingSpawn.Before);
					if (list.Count != 0)
					{
						Vector3 val = FrontOfPlayer(pendingSpawn.Player, 4f, 1.5f);
						for (int i = 0; i < list.Count; i++)
						{
							PlaceTop(list[i], val + Vector3.right * (float)i * 1.5f);
						}
						pending.RemoveAt(num);
						Say("Spawned " + pendingSpawn.Label + " in front of you.");
					}
				}
			}
		}

		internal static void SpawnItem(int objectId, string label)
		{
			if (!InGame())
			{
				Say("Only spawns while in a game.");
				return;
			}
			DebugManager d = Spawner();
			if ((Object)(object)d == (Object)null)
			{
				Say("Spawner not loaded. Wait a moment and try again.");
				return;
			}
			BeginSpawn(label, delegate
			{
				//IL_000c: Unknown result type (might be due to invalid IL or missing references)
				d.SpawnObject(objectId, Vector3.zero, false);
			});
		}

		internal static void SpawnItemByName(string keyword, string label)
		{
			for (int i = 0; i < ItemNames.Count; i++)
			{
				if (ItemNames[i].ToLowerInvariant().IndexOf(keyword, StringComparison.Ordinal) >= 0)
				{
					SpawnItem(i, label);
					return;
				}
			}
			Say("No " + label + " in this game's item list.");
		}

		internal static void SpawnShark()
		{
			if (!InGame())
			{
				Say("Only spawns while in a game.");
				return;
			}
			for (int i = 0; i < ItemNames.Count; i++)
			{
				if (ItemNames[i].ToLowerInvariant().IndexOf("shark", StringComparison.Ordinal) >= 0)
				{
					SpawnItem(i, "a shark");
					return;
				}
			}
			GameObject val = null;
			try
			{
				Il2CppArrayBase<SharkActor> val2 = Resources.FindObjectsOfTypeAll<SharkActor>();
				int num = 0;
				while (val2 != null && num < val2.Length && (Object)(object)val == (Object)null)
				{
					if ((Object)(object)val2[num] != (Object)null)
					{
						val = ((Component)val2[num]).gameObject;
					}
					num++;
				}
			}
			catch (Exception e)
			{
				Report("Shark search", e);
			}
			if ((Object)(object)val == (Object)null)
			{
				Say("No shark is loaded on this map.");
				return;
			}
			GameObject t = val;
			BeginSpawn("a shark", delegate
			{
				GameObject val3 = Object.Instantiate<GameObject>(t);
				val3.SetActive(true);
			});
		}

		private static GameObject[] NpcPrefabs()
		{
			List<GameObject> list = new List<GameObject>();
			try
			{
				WavesData val = ((Waves != null) ? Waves._waveInfomation : null);
				if ((Object)(object)val == (Object)null)
				{
					Il2CppArrayBase<WavesData> val2 = Resources.FindObjectsOfTypeAll<WavesData>();
					int num = 0;
					while (val2 != null && num < val2.Length && (Object)(object)val == (Object)null)
					{
						if ((Object)(object)val2[num] != (Object)null)
						{
							val = val2[num];
						}
						num++;
					}
				}
				if ((Object)(object)val != (Object)null)
				{
					List<GameObject> beastTypePref = val.beastTypePref;
					for (int i = 0; i < beastTypePref.Count; i++)
					{
						if ((Object)(object)beastTypePref[i] != (Object)null)
						{
							list.Add(beastTypePref[i]);
						}
					}
				}
			}
			catch (Exception e)
			{
				Report("NPC prefab lookup", e);
			}
			return list.ToArray();
		}

		private static void AssignNpcPrefab(DebugManager d, Scale scale)
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Invalid comparison between Unknown and I4
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Invalid comparison between Unknown and I4
			GameObject[] array = NpcPrefabs();
			if (array.Length == 0)
			{
				throw new InvalidOperationException("No NPC prefabs loaded yet. Start a Waves match once.");
			}
			int num = (((int)scale != 0) ? (((int)scale == 1) ? (array.Length / 2) : (array.Length - 1)) : 0);
			GameObject val = array[Mathf.Clamp(num, 0, array.Length - 1)];
			if ((int)scale != 0)
			{
				if ((int)scale == 1)
				{
					d.mediumActorPrefab = val;
				}
				else
				{
					d.largeActorPrefab = val;
				}
			}
			else
			{
				d.smallActorPrefab = val;
			}
		}

		private static int NextAiId()
		{
			int num = 0;
			try
			{
				num = GBServerItemSpawner.AI_CONTROLLER_STARTIDEX;
				if (!loggedAiStart)
				{
					loggedAiStart = true;
					if (Logger != null)
					{
						Logger.LogInfo((object)("AI controller start index: " + num));
					}
				}
			}
			catch (Exception e)
			{
				Report("AI id start", e);
			}
			return num + aiIdCounter++ % 4;
		}

		internal static void SpawnNpcAnywhere(Scale scale, string label)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			if (!InGame())
			{
				Say("Only spawns while in a game.");
				return;
			}
			DebugManager d = Spawner();
			if ((Object)(object)d == (Object)null)
			{
				Say("Spawner not loaded. Wait a moment and try again.");
				return;
			}
			int id = NextAiId();
			BeginSpawn(label, delegate
			{
				//IL_0008: Unknown result type (might be due to invalid IL or missing references)
				//IL_0020: Unknown result type (might be due to invalid IL or missing references)
				AssignNpcPrefab(d, scale);
				d.SpawnActor(id, scale, false);
			});
		}

		internal static void SpawnNpc(int index)
		{
			if (!InGame())
			{
				Say("Only spawns while in a game.");
				return;
			}
			if (!WavesActive())
			{
				Say("NPC types need a Waves match running.");
				return;
			}
			try
			{
				Waves.SpawnAdditionalDebugAI(index);
				string text = ((index < NpcNames.Count) ? NpcNames[index] : "NPC");
				Say("Spawned " + text + ".");
			}
			catch (Exception e)
			{
				Report("Waves NPC spawn", e);
			}
		}

		internal static void RefreshNpcNames()
		{
			if (!WavesActive() || (NpcSource == Waves && NpcNames.Count > 0))
			{
				return;
			}
			NpcSource = Waves;
			NpcNames.Clear();
			try
			{
				WavesData waveInfomation = Waves._waveInfomation;
				List<GameObject> val = (((Object)(object)waveInfomation != (Object)null) ? waveInfomation.beastTypePref : null);
				if (val != null)
				{
					for (int i = 0; i < val.Count; i++)
					{
						GameObject val2 = val[i];
						string text = (((Object)(object)val2 != (Object)null) ? ((Object)val2).name : ("NPC " + i));
						NpcNames.Add(text.Replace("(Clone)", "").Trim());
					}
				}
			}
			catch (Exception e)
			{
				Report("Waves NPC list", e);
			}
		}

		internal static void SummonBird()
		{
			//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			if (!InGame())
			{
				Say("Only spawns while in a game.");
				return;
			}
			Actor val = LocalActor();
			if ((Object)(object)val == (Object)null)
			{
				Say("No local player found.");
				return;
			}
			try
			{
				CritterEscalationManager val2 = Object.FindObjectOfType<CritterEscalationManager>();
				if ((Object)(object)val2 != (Object)null)
				{
					val2.SpawnBird();
				}
			}
			catch (Exception e)
			{
				Report("SpawnBird", e);
			}
			Il2CppArrayBase<BirdActor> val3 = Object.FindObjectsOfType<BirdActor>();
			if (val3 == null || val3.Length == 0)
			{
				Say("No bird could be spawned on this map.");
				return;
			}
			BirdActor val4 = val3[val3.Length - 1];
			MoveBody((Component)(object)val4, ((Component)val4).transform.position, FrontOfPlayer(val, 4f, 2f));
			Say("Summoned a bird in front of you.");
		}

		internal static void UnfreezeAll()
		{
			int num = 0;
			foreach (Rigidbody item in FrozenByMe)
			{
				if ((Object)(object)item != (Object)null && item.isKinematic)
				{
					item.isKinematic = false;
					num++;
				}
			}
			FrozenByMe.Clear();
			Say("Unfroze " + num + " item(s).");
		}

		internal static void ExtendWaves(GameMode_Waves w)
		{
			WavesData waveInfomation = w._waveInfomation;
			if ((Object)(object)waveInfomation == (Object)null)
			{
				return;
			}
			List<Wave> levelWaves = waveInfomation.levelWaves;
			if (levelWaves != null && levelWaves.Count != 0)
			{
				int num = w._roundCounter + 3;
				while (levelWaves.Count < num)
				{
					levelWaves.Add(MakeNextWave(levelWaves[levelWaves.Count - 1], levelWaves.Count));
				}
			}
		}

		private static Wave MakeNextWave(Wave prev, int index)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Expected O, but got Unknown
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Expected O, but got Unknown
			Wave val = new Wave();
			val.beginCode = prev.beginCode;
			val.endCode = prev.endCode;
			val.beginColour = prev.beginColour;
			val.endColour = prev.endColour;
			val.beasts = new List<BeastSetup>();
			for (int i = 0; i < prev.beasts.Count; i++)
			{
				val.beasts.Add(new BeastSetup(prev.beasts[i]));
			}
			if (prev.beasts.Count > 0)
			{
				val.beasts.Add(new BeastSetup(prev.beasts[index % prev.beasts.Count]));
			}
			return val;
		}
	}
	public class NeverLetGoBehaviour : MonoBehaviour
	{
		private sealed class Flow
		{
			public float X;

			public float Y;

			public float W;

			public bool Draw;

			public Flow(float x, float y, float w, bool draw)
			{
				X = x;
				Y = y;
				W = w;
				Draw = draw;
			}
		}

		private const int ItemsTabIndex = 3;

		private const float PadX = 14f;

		private const float PadY = 12f;

		private const float CardGap = 10f;

		private const float RowH = 30f;

		private const float LineH = 16f;

		private const float CharW = 6.2f;

		private static readonly string[] TabNames = new string[5] { "Player", "Round", "Spawn", "Items", "Tools" };

		public NeverLetGoBehaviour(IntPtr ptr)
			: base(ptr)
		{
		}

		private void Update()
		{
			try
			{
				Tick();
			}
			catch (Exception e)
			{
				Cfg.Report("Input", e);
			}
		}

		private void LateUpdate()
		{
			if (Cfg.Open || Cfg.GravityGun)
			{
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
			}
		}

		private static void Tick()
		{
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Invalid comparison between Unknown and I4
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0091: Invalid comparison between Unknown and I4
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			Keyboard current = Keyboard.current;
			if (current == null)
			{
				return;
			}
			if (((ButtonControl)current.f6Key).wasPressedThisFrame)
			{
				Cfg.SetMenu(!Cfg.Open);
			}
			if (Cfg.Capturing)
			{
				foreach (object value in Enum.GetValues(typeof(Key)))
				{
					Key val = (Key)value;
					if ((int)val != 0)
					{
						try
						{
							if (((ButtonControl)current[val]).wasPressedThisFrame)
							{
								if ((int)val != 60)
								{
									Cfg.KnockoutKey = val;
								}
								Cfg.Capturing = false;
								break;
							}
						}
						catch
						{
						}
					}
				}
				return;
			}
			LocalActorTick();
			Cfg.ProcessPending();
			if (Cfg.FreezeTimer)
			{
				Cfg.HoldTimer();
			}
			else
			{
				Cfg.ReleaseTimer();
			}
			if (Cfg.GravityGun)
			{
				GravityGunTick(current);
			}
			else
			{
				Cfg.Held = null;
			}
		}

		private static void LocalActorTick()
		{
			//IL_0083: 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)
			Actor val = Cfg.LocalActor();
			if ((Object)(object)val == (Object)null)
			{
				Cfg.LastActorPtr = IntPtr.Zero;
				return;
			}
			if (((Il2CppObjectBase)val).Pointer != Cfg.LastActorPtr)
			{
				Cfg.LastActorPtr = ((Il2CppObjectBase)val).Pointer;
				Cfg.ActorSeen = Time.unscaledTime;
				Cfg.SpawnRecorded = false;
				Cfg.HaveBasePunch = false;
				Cfg.PunchApplied = false;
			}
			else if (!Cfg.SpawnRecorded && Time.unscaledTime - Cfg.ActorSeen > 0.4f)
			{
				Cfg.SpawnPos = Cfg.TrackPos(val);
				Cfg.HasSpawn = true;
				Cfg.SpawnRecorded = true;
			}
			if (!Cfg.HaveBasePunch)
			{
				Cfg.BaseForce = val._punchForceModifer;
				Cfg.BaseDamage = val._punchDamageModifer;
				Cfg.HaveBasePunch = true;
			}
			if (Cfg.PunchOverride)
			{
				val._punchForceModifer = Cfg.BaseForce * Cfg.PunchMult;
				val._punchDamageModifer = Cfg.BaseDamage * Cfg.PunchMult;
				Cfg.PunchApplied = true;
			}
			else if (Cfg.PunchApplied)
			{
				val._punchForceModifer = Cfg.BaseForce;
				val._punchDamageModifer = Cfg.BaseDamage;
				Cfg.PunchApplied = false;
			}
			Cfg.ApplyKnockoutLength(val);
		}

		private static void GravityGunTick(Keyboard kb)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0186: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0194: Unknown result type (might be due to invalid IL or missing references)
			//IL_0199: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_020c: Unknown result type (might be due to invalid IL or missing references)
			//IL_024f: Unknown result type (might be due to invalid IL or missing references)
			//IL_025c: Unknown result type (might be due to invalid IL or missing references)
			Mouse current = Mouse.current;
			Camera main = Camera.main;
			if (current == null || (Object)(object)main == (Object)null)
			{
				return;
			}
			Vector2 val = ((InputControl<Vector2>)(object)((Pointer)current).position).ReadValue();
			bool flag = Cfg.Open && ((Rect)(ref Cfg.Win)).Contains(new Vector2(val.x, (float)Screen.height - val.y));
			Ray val2 = main.ScreenPointToRay(new Vector3(val.x, val.y, 0f));
			RaycastHit val3 = default(RaycastHit);
			if (current.leftButton.wasPressedThisFrame && !flag && Physics.Raycast(val2, ref val3, 300f) && (Object)(object)((RaycastHit)(ref val3)).rigidbody != (Object)null)
			{
				Cfg.Held = ((RaycastHit)(ref val3)).rigidbody;
				Cfg.HoldDist = ((RaycastHit)(ref val3)).distance;
			}
			if (!current.leftButton.isPressed)
			{
				Cfg.Held = null;
			}
			if ((Object)(object)Cfg.Held != (Object)null && !flag)
			{
				float y = ((InputControl<Vector2>)(object)current.scroll).ReadValue().y;
				if (Mathf.Abs(y) > 0.01f)
				{
					Cfg.HoldDist = Mathf.Clamp(Cfg.HoldDist + Mathf.Sign(y) * 1f, 1f, 150f);
				}
			}
			if ((Object)(object)Cfg.Held != (Object)null && !Cfg.Held.isKinematic)
			{
				Vector3 point = ((Ray)(ref val2)).GetPoint(Cfg.HoldDist);
				Vector3 val4 = (point - Cfg.Held.position) * 12f;
				Cfg.Held.velocity = Vector3.ClampMagnitude(val4, 40f);
				Cfg.Held.angularVelocity = Cfg.Held.angularVelocity * 0.9f;
			}
			if (!((ButtonControl)kb.mKey).wasPressedThisFrame)
			{
				return;
			}
			Rigidbody val5 = Cfg.Held;
			RaycastHit val6 = default(RaycastHit);
			if ((Object)(object)val5 == (Object)null && Physics.Raycast(val2, ref val6, 300f))
			{
				val5 = ((RaycastHit)(ref val6)).rigidbody;
			}
			if (!((Object)(object)val5 != (Object)null))
			{
				return;
			}
			if (!val5.isKinematic)
			{
				val5.velocity = Vector3.zero;
				val5.angularVelocity = Vector3.zero;
				val5.isKinematic = true;
				if (!Cfg.FrozenByMe.Contains(val5))
				{
					Cfg.FrozenByMe.Add(val5);
				}
				Cfg.Say("Frozen.");
			}
			else
			{
				val5.isKinematic = false;
				Cfg.FrozenByMe.Remove(val5);
				Cfg.Say("Unfrozen.");
			}
			Cfg.Held = null;
		}

		private void OnGUI()
		{
			if (Cfg.S == null)
			{
				try
				{
					Cfg.S = UiStyles.Build();
				}
				catch (Exception e)
				{
					Cfg.Report("Menu styles", e);
					Cfg.S = UiStyles.Fallback();
				}
			}
			try
			{
				Draw(Cfg.S);
			}
			catch (Exception e2)
			{
				Cfg.Report("Menu", e2);
			}
		}

		private static void Draw(UiStyles S)
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			DrawHud(S);
			if (Cfg.Open)
			{
				Cfg.RefreshNpcNames();
				Cfg.RefreshItemNames();
				HandleDrag();
				GUI.Box(Cfg.Win, "", S.Panel);
				Rect inner = default(Rect);
				((Rect)(ref inner))..ctor(((Rect)(ref Cfg.Win)).x + 18f, ((Rect)(ref Cfg.Win)).y + 14f, ((Rect)(ref Cfg.Win)).width - 36f, ((Rect)(ref Cfg.Win)).height - 28f);
				try
				{
					DrawBody(S, inner);
				}
				catch (Exception e)
				{
					Cfg.Report("Menu body", e);
				}
				((Rect)(ref Cfg.Win)).x = Mathf.Clamp(((Rect)(ref Cfg.Win)).x, 0f, (float)Screen.width - ((Rect)(ref Cfg.Win)).width);
				((Rect)(ref Cfg.Win)).y = Mathf.Clamp(((Rect)(ref Cfg.Win)).y, 0f, (float)Screen.height - 40f);
			}
		}

		private static void DrawHud(UiStyles S)
		{
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)Screen.width - 252f;
			float num2 = 14f;
			if (Cfg.GodMode)
			{
				GUI.Label(new Rect(num, num2, 238f, 24f), "GOD MODE", S.HudPill);
				num2 += 30f;
			}
			if (Cfg.FreezeTimer)
			{
				GUI.Label(new Rect(num, num2, 238f, 24f), "TIMER FROZEN  " + Cfg.TimerText(), S.HudPill);
				num2 += 30f;
			}
			if (!Cfg.Open)
			{
				GUI.Label(new Rect(num, num2, 238f, 20f), "F6 to open", S.HudHint);
			}
		}

		private static void HandleDrag()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Invalid comparison between Unknown and I4
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0086: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Invalid comparison between Unknown and I4
			//IL_00b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
			Event current = Event.current;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(((Rect)(ref Cfg.Win)).x, ((Rect)(ref Cfg.Win)).y, ((Rect)(ref Cfg.Win)).width - 56f, 52f);
			if ((int)current.type == 0 && current.button == 0 && ((Rect)(ref val)).Contains(current.mousePosition))
			{
				Cfg.Dragging = true;
				Cfg.DragOff = current.mousePosition - new Vector2(((Rect)(ref Cfg.Win)).x, ((Rect)(ref Cfg.Win)).y);
				current.Use();
			}
			else if ((int)current.type == 3 && Cfg.Dragging)
			{
				((Rect)(ref Cfg.Win)).x = current.mousePosition.x - Cfg.DragOff.x;
				((Rect)(ref Cfg.Win)).y = current.mousePosition.y - Cfg.DragOff.y;
				current.Use();
			}
			else if ((int)current.type == 1)
			{
				Cfg.Dragging = false;
			}
		}

		private static void DrawBody(UiStyles S, Rect inner)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_01af: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a4: 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_020a: Unknown result type (might be due to invalid IL or missing references)
			float x = ((Rect)(ref inner)).x;
			float width = ((Rect)(ref inner)).width;
			float y = ((Rect)(ref inner)).y;
			GUI.Label(new Rect(x, y, width - 40f, 26f), "Never Let Go", S.Title);
			GUI.Label(new Rect(x, y + 26f, width - 40f, 16f), "Gang Beasts trainer  -  F6 to hide", S.Subtitle);
			if (GUI.Button(new Rect(x + width - 28f, y + 4f, 28f, 26f), "X", S.Close))
			{
				Cfg.SetMenu(open: false);
			}
			y += 50f;
			GUI.Box(new Rect(x, y, width, 40f), "", S.TabBar);
			float num = (width - 8f - 16f) / (float)TabNames.Length;
			Rect val = default(Rect);
			for (int i = 0; i < TabNames.Length; i++)
			{
				((Rect)(ref val))..ctor(x + 4f + (float)i * (num + 4f), y + 4f, num, 32f);
				if (GUI.Button(val, TabNames[i], (i == Cfg.Tab) ? S.TabOn : S.Tab))
				{
					Cfg.Tab = i;
				}
			}
			y += 52f;
			float num2 = 34f;
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(x, ((Rect)(ref inner)).yMax - num2, width, num2);
			Rect body = default(Rect);
			((Rect)(ref body))..ctor(x, y, width, ((Rect)(ref val2)).y - 10f - y);
			if (Cfg.Tab == 3)
			{
				DrawItems(S, body);
			}
			else
			{
				DrawScrollTab(S, body);
			}
			GUI.Box(val2, "", S.Status);
			bool flag = Time.unscaledTime - Cfg.MsgTime < 6f;
			GUI.Label(new Rect(((Rect)(ref val2)).x + 12f, ((Rect)(ref val2)).y + 8f, ((Rect)(ref val2)).width - 24f, 20f), flag ? Cfg.Msg : "Ready", S.Muted);
		}

		private static void DrawScrollTab(UiStyles S, Rect body)
		{
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			float num = ((Rect)(ref body)).width - 16f;
			float num2 = Measure(num, delegate(Flow f)
			{
				TabBody(f, S);
			}, "Tab measure");
			Cfg.TabScroll = GUI.BeginScrollView(body, Cfg.TabScroll, new Rect(0f, 0f, num, Mathf.Max(num2, ((Rect)(ref body)).height)));
			try
			{
				Run(new Flow(0f, 0f, num, draw: true), delegate(Flow f)
				{
					TabBody(f, S);
				}, "Tab body");
			}
			finally
			{
				GUI.EndScrollView();
			}
		}

		private static void TabBody(Flow f, UiStyles S)
		{
			switch (Cfg.Tab)
			{
			case 0:
				PlayerTab(f, S);
				break;
			case 1:
				RoundTab(f, S);
				break;
			case 2:
				SpawnTab(f, S);
				break;
			case 4:
				ToolsTab(f, S);
				break;
			case 3:
				break;
			}
		}

		private static void DrawItems(UiStyles S, Rect body)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Unknown result type (might be due to invalid IL or missing references)
			//IL_0197: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
			GUI.Box(body, "", S.Card);
			float num = ((Rect)(ref body)).x + 14f;
			float num2 = ((Rect)(ref body)).width - 28f;
			float num3 = ((Rect)(ref body)).y + 12f;
			GUI.Label(new Rect(num, num3, num2, 16f), "ITEMS", S.CardTitle);
			num3 += 22f;
			Cfg.ItemFilter = GUI.TextField(new Rect(num, num3, num2, 28f), Cfg.ItemFilter, S.Field);
			num3 += 34f;
			if (Cfg.ItemNames.Count == 0)
			{
				GUI.Label(new Rect(num, num3, num2, 16f), "Item list not loaded (spawner missing).", S.Muted);
				return;
			}
			string filter = Cfg.ItemFilter.ToLowerInvariant();
			int num4 = 0;
			for (int i = 0; i < Cfg.ItemNames.Count; i++)
			{
				if (Matches(Cfg.ItemNames[i], filter))
				{
					num4++;
				}
			}
			GUI.Label(new Rect(num, num3, num2, 16f), num4 + " items. Click one to spawn it in front of you.", S.Muted);
			num3 += 22f;
			float num5 = Mathf.Max(60f, ((Rect)(ref body)).yMax - 12f - num3);
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(num, num3, num2, num5);
			Rect val2 = default(Rect);
			((Rect)(ref val2))..ctor(0f, 0f, num2 - 16f, (float)num4 * 26f);
			Cfg.ItemScroll = GUI.BeginScrollView(val, Cfg.ItemScroll, val2);
			try
			{
				int num6 = 0;
				for (int j = 0; j < Cfg.ItemNames.Count; j++)
				{
					string text = Cfg.ItemNames[j];
					if (Matches(text, filter))
					{
						if (GUI.Button(new Rect(0f, (float)num6 * 26f, ((Rect)(ref val2)).width, 22f), text, S.Item))
						{
							Cfg.SpawnItem(j, text);
						}
						num6++;
					}
				}
			}
			finally
			{
				GUI.EndScrollView();
			}
		}

		private static float Measure(float width, Action<Flow> body, string name)
		{
			Flow flow = new Flow(0f, 0f, width, draw: false);
			try
			{
				body(flow);
			}
			catch (Exception e)
			{
				Cfg.Report(name, e);
			}
			return flow.Y;
		}

		private static void Run(Flow f, Action<Flow> body, string name)
		{
			try
			{
				body(f);
			}
			catch (Exception e)
			{
				Cfg.Report(name, e);
			}
		}

		private static Rect Next(Flow f, float h, float gap = 0f)
		{
			//IL_002b: 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_002f: Unknown result type (might be due to invalid IL or missing references)
			Rect result = default(Rect);
			((Rect)(ref result))..ctor(f.X, f.Y, f.W, h);
			f.Y += h + gap;
			return result;
		}

		private static void Gap(Flow f, float h)
		{
			f.Y += h;
		}

		private static int EstimateLines(string text, float width)
		{
			if (string.IsNullOrEmpty(text))
			{
				return 0;
			}
			int num = Mathf.Max(10, (int)(width / 6.2f));
			return Mathf.Max(1, Mathf.CeilToInt((float)text.Length / (float)num));
		}

		private static void Card(Flow f, UiStyles S, string title, Action<Flow> body)
		{
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
			float num = (string.IsNullOrEmpty(title) ? 0f : 22f);
			float num2 = f.W - 28f;
			string name = "Section " + title;
			float num3 = num + Measure(num2, body, name) + 24f;
			if (f.Draw)
			{
				GUI.Box(new Rect(f.X, f.Y, f.W, num3), "", S.Card);
				if (num > 0f)
				{
					GUI.Label(new Rect(f.X + 14f, f.Y + 12f, num2, 16f), title.ToUpperInvariant(), S.CardTitle);
				}
			}
			Run(new Flow(f.X + 14f, f.Y + 12f + num, num2, f.Draw), body, name);
			f.Y += num3 + 10f;
		}

		private static void Label(Flow f, string text, GUIStyle st, float h = 16f, float gap = 0f)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			Rect val = Next(f, h, gap);
			if (f.Draw)
			{
				GUI.Label(val, text, st);
			}
		}

		private static void Wrapped(Flow f, string text, GUIStyle st, float gap = 4f)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			Rect val = Next(f, (float)EstimateLines(text, f.W) * 16f, gap);
			if (f.Draw)
			{
				GUI.Label(val, text, st);
			}
		}

		private static bool Button(Flow f, string text, GUIStyle st, float h = 30f, float gap = 0f)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			Rect val = Next(f, h, gap);
			return f.Draw && GUI.Button(val, text, st);
		}

		private static int ButtonRow(Flow f, IList<string> labels, GUIStyle st, float h = 30f)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			Rect val = Next(f, h);
			int count = labels.Count;
			if (count == 0)
			{
				return -1;
			}
			int result = -1;
			float num = (((Rect)(ref val)).width - 6f * (float)(count - 1)) / (float)count;
			Rect val2 = default(Rect);
			for (int i = 0; i < count; i++)
			{
				((Rect)(ref val2))..ctor(((Rect)(ref val)).x + (float)i * (num + 6f), ((Rect)(ref val)).y, num, h);
				if (f.Draw && GUI.Button(val2, labels[i], st))
				{
					result = i;
				}
			}
			return result;
		}

		private static bool ToggleRow(Flow f, UiStyles S, string title, string hint, bool value)
		{
			//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_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			float num = (string.IsNullOrEmpty(hint) ? 0f : ((float)EstimateLines(hint, f.W - 80f) * 16f));
			Rect val = Next(f, 16f + num, 10f);
			bool result = value;
			if (f.Draw)
			{
				GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y, ((Rect)(ref val)).width - 76f, 16f), title, S.Label);
				if (num > 0f)
				{
					GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 16f, ((Rect)(ref val)).width - 76f, num), hint, S.Muted);
				}
				if (GUI.Button(new Rect(((Rect)(ref val)).xMax - 62f, ((Rect)(ref val)).y - 2f, 62f, 24f), value ? "ON" : "OFF", value ? S.PillOn : S.PillOff))
				{
					result = !value;
				}
			}
			return result;
		}

		private static string NumberRow(Flow f, UiStyles S, string label, string text, string suffix)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0048: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			Rect val = Next(f, 26f, 8f);
			string result = text;
			if (f.Draw)
			{
				GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 4f, ((Rect)(ref val)).width - 150f, 20f), label, S.Label);
				result = GUI.TextField(new Rect(((Rect)(ref val)).xMax - 118f, ((Rect)(ref val)).y, 84f, 26f), text, S.Field);
				GUI.Label(new Rect(((Rect)(ref val)).xMax - 30f, ((Rect)(ref val)).y + 4f, 30f, 20f), suffix, S.Muted);
			}
			return result;
		}

		private static void KeyRow(Flow f, UiStyles S, string label)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			Rect val = Next(f, 28f);
			if (f.Draw)
			{
				GUI.Label(new Rect(((Rect)(ref val)).x, ((Rect)(ref val)).y + 4f, ((Rect)(ref val)).width - 130f, 20f), label, S.Label);
				string text = (Cfg.Capturing ? "Press a key" : ((object)Unsafe.As<Key, Key>(ref Cfg.KnockoutKey)/*cast due to .constrained prefix*/).ToString());
				if (GUI.Button(new Rect(((Rect)(ref val)).xMax - 120f, ((Rect)(ref val)).y, 120f, 28f), text, S.Button))
				{
					Cfg.Capturing = true;
				}
			}
		}

		private static void PlayerTab(Flow f, UiStyles S)
		{
			Card(f, S, "Survival", delegate(Flow c)
			{
				Cfg.GodMode = ToggleRow(c, S, "God mode", "No knockout or death. Falls and kill zones send you to spawn.", Cfg.GodMode);
				Cfg.UnbreakableGrip = ToggleRow(c, S, "Unbreakable grip", "Your grabs never break.", Cfg.UnbreakableGrip);
				Cfg.InfiniteStamina = ToggleRow(c, S, "Infinite stamina", "", Cfg.InfiniteStamina);
			});
			Card(f, S, "Movement", delegate(Flow c)
			{
				if (Button(c, "Teleport to spawn", S.Button))
				{
					Cfg.TeleportNow();
				}
			});
			Card(f, S, "Combat", delegate(Flow c)
			{
				Cfg.PunchOverride = ToggleRow(c, S, "Punch power", "Multiplies punch damage and force.", Cfg.PunchOverride);
				string text = NumberRow(c, S, "Multiplier", Cfg.PunchText, "x");
				if (text != Cfg.PunchText)
				{
					Cfg.PunchText = text;
					if (float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
					{
						Cfg.PunchMult = Mathf.Clamp(result, 0f, 1000f);
					}
				}
				Gap(c, 6f);
				KeyRow(c, S, "Knockout key (hold)");
			});
			Card(f, S, "Knockout timer", delegate(Flow c)
			{
				Cfg.KnockoutOverride = ToggleRow(c, S, "Knockout length", "How long you stay down each time you're knocked out.", Cfg.KnockoutOverride);
				string text = NumberRow(c, S, "Seconds", Cfg.KnockoutText, "sec");
				if (text != Cfg.KnockoutText)
				{
					Cfg.KnockoutText = text;
					if (float.TryParse(text, NumberStyles.Float, CultureInfo.InvariantCulture, out var result))
					{
						Cfg.KnockoutSeconds = Mathf.Clamp(result, 0.5f, 600f);
					}
				}
				Gap(c, 6f);
				if (Button(c, "Reset knockout timer", S.Button))
				{
					Cfg.ResetKnockoutTimer();
				}
			});
		}

		private static void RoundTab(Flow f, UiStyles S)
		{
			Card(f, S, "Current round", delegate(Flow c)
			{
				Label(c, "Mode: " + Cfg.ModeName(), S.Label);
				Label(c, "Time left: " + Cfg.TimerText(), S.Muted);
				Gap(c, 6f);
				if (Button(c, Cfg.SkipActive ? "Skipping..." : "Skip current round", S.Button))
				{
					Cfg.SkipRound();
				}
			});
			Card(f, S, "Round timer", delegate(Flow c)
			{
				Cfg.FreezeTimer = ToggleRow(c, S, "Freeze timer", "The round can't reach its last seconds or end while this is on.", Cfg.FreezeTimer);
				Label(c, Cfg.TimerText(), S.Value, 30f);
			});
			Card(f, S, "Waves", delegate(Flow c)
			{
				Cfg.InfiniteWaves = ToggleRow(c, S, "Infinite waves", "Each round adds one more NPC, forever. Waves mode only.", Cfg.InfiniteWaves);
			});
			Card(f, S, "Waves NPC types", delegate(Flow c)
			{
				if (!Cfg.WavesActive())
				{
					Wrapped(c, "Start a Waves match to use these.", S.Muted);
				}
				else
				{
					for (int i = 0; i < Cfg.NpcNames.Count; i += 2)
					{
						List<string> list = new List<string> { Cfg.NpcNames[i] };
						if (i + 1 < Cfg.NpcNames.Count)
						{
							list.Add(Cfg.NpcNames[i + 1]);
						}
						switch (ButtonRow(c, list, S.Button))
						{
						case 0:
							Cfg.SpawnNpc(i);
							break;
						case 1:
							Cfg.SpawnNpc(i + 1);
							break;
						}
						Gap(c, 6f);
					}
				}
			});
		}

		private static void SpawnTab(Flow f, UiStyles S)
		{
			Card(f, S, "Quick spawns", delegate(Flow c)
			{
				switch (ButtonRow(c, new List<string> { "Shark", "Bird" }, S.Button))
				{
				case 0:
					Cfg.SpawnShark();
					break;
				case 1:
					Cfg.SummonBird();
					break;
				}
			});
			Card(f, S, "NPCs (any mode)", delegate(Flow c)
			{
				switch (ButtonRow(c, new List<string> { "Small", "Medium", "Large" }, S.Button))
				{
				case 0:
					Cfg.SpawnNpcAnywhere((Scale)0, "a small NPC");
					break;
				case 1:
					Cfg.SpawnNpcAnywhere((Scale)1, "a medium NPC");
					break;
				case 2:
					Cfg.SpawnNpcAnywhere((Scale)2, "a large NPC");
					break;
				}
				Gap(c, 6f);
				Wrapped(c, "Spawns need you in a match, not the lobby.", S.Muted);
			});
		}

		private static void ToolsTab(Flow f, UiStyles S)
		{
			Card(f, S, "Gravity gun", delegate(Flow c)
			{
				Cfg.GravityGun = ToggleRow(c, S, "Mouse drag items", "Left-drag to grab. Scroll pushes or pulls. M freezes or unfreezes.", Cfg.GravityGun);
			});
			Card(f, S, "Frozen items", delegate(Flow c)
			{
				if (Button(c, "Unfreeze all my frozen items (" + Cfg.FrozenByMe.Count + ")", S.Button))
				{
					Cfg.UnfreezeAll();
				}
			});
		}

		private static bool Matches(string name, string filter)
		{
			return filter.Length == 0 || name.ToLowerInvariant().IndexOf(filter, StringComparison.Ordinal) >= 0;
		}
	}
	[HarmonyPatch(typeof(CollisionHandeler), "LeftGrab")]
	internal static class LeftGrabPatch
	{
		private static void Prefix(Actor actor, ref float breakForce)
		{
			if (Cfg.UnbreakableGrip && Cfg.IsLocal(actor))
			{
				breakForce = float.MaxValue;
			}
		}
	}
	[HarmonyPatch(typeof(CollisionHandeler), "RightGrab")]
	internal static class RightGrabPatch
	{
		private static void Prefix(Actor actor, ref float breakForce)
		{
			if (Cfg.UnbreakableGrip && Cfg.IsLocal(actor))
			{
				breakForce = float.MaxValue;
			}
		}
	}
	[HarmonyPatch(typeof(StatusHandeler), "UpdateStamina")]
	internal static class StaminaPatch
	{
		private static void Postfix(StatusHandeler __instance)
		{
			if (Cfg.IsLocal(__instance))
			{
				if (Cfg.InfiniteStamina)
				{
					__instance.stamina = __instance.maxStamina;
				}
				if (Cfg.GodMode)
				{
					__instance.immortal = true;
				}
			}
		}
	}
	[HarmonyPatch(typeof(StatusHandeler), "AddDamage")]
	internal static class DamagePatch
	{
		private static void Prefix(StatusHandeler __instance, ref float damage)
		{
			if (Cfg.GodMode && !Cfg.Bypass && Cfg.IsLocal(__instance))
			{
				damage = 0f;
			}
		}
	}
	[HarmonyPatch(typeof(StatusHandeler), "TryKill")]
	internal static class TryKillPatch
	{
		private static bool Prefix(StatusHandeler __instance, ref bool __result)
		{
			if (!Cfg.BlockDeath(__instance))
			{
				return true;
			}
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(StatusHandeler), "Kill")]
	internal static class KillPatch
	{
		private static bool Prefix(StatusHandeler __instance)
		{
			return !Cfg.BlockDeath(__instance);
		}
	}
	[HarmonyPatch(typeof(StatusHandeler), "KillBeast")]
	internal static class KillBeastPatch
	{
		private static bool Prefix(StatusHandeler __instance)
		{
			return !Cfg.BlockDeath(__instance);
		}
	}
	[HarmonyPatch(typeof(KillVolume), "CanKill")]
	internal static class CanKillPatch
	{
		private static bool Prefix(KillVolume __instance, Actor checking, ref bool __result)
		{
			if (!Cfg.IsLocal(checking) || !Cfg.GodMode)
			{
				return true;
			}
			Cfg.TeleportToSpawn(checking);
			__result = false;
			return false;
		}
	}
	[HarmonyPatch(typeof(GameMode_Waves), "IsGameOver")]
	internal static class WavesGameOverPatch
	{
		private static void Postfix(ref bool __result)
		{
			if (Cfg.InfiniteWaves)
			{
				__result = false;
			}
		}
	}
	[HarmonyPatch(typeof(GameMode_Waves), "GameModeUpdate")]
	internal static class WavesUpdatePatch
	{
		private static void Postfix(GameMode_Waves __instance)
		{
			Cfg.Waves = __instance;
			Cfg.WavesSeen = Time.unscaledTime;
			if (Cfg.InfiniteWaves)
			{
				try
				{
					Cfg.ExtendWaves(__instance);
				}
				catch (Exception e)
				{
					Cfg.Report("Infinite waves", e);
				}
			}
		}
	}
	[HarmonyPatch(typeof(GameMode), "IsTimerExpired")]
	internal static class TimerExpiredPatch
	{
		private static void Postfix(ref bool __result)
		{
			if (Cfg.FreezeTimer)
			{
				__result = false;
			}
		}
	}
	[HarmonyPatch(typeof(GameMode_Football), "IsTimerExpired")]
	internal static class FootballTimerPatch
	{
		private static void Postfix(ref bool __result)
		{
			if (Cfg.FreezeTimer)
			{
				__result = false;
			}
		}
	}
	[HarmonyPatch(typeof(GameMode), "IsRoundOver")]
	internal static class SkipRoundBasePatch
	{
		private static void Postfix(ref bool __result)
		{
			if (Cfg.SkipActive)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(GameMode_Gang), "IsRoundOver")]
	internal static class SkipRoundGangPatch
	{
		private static void Postfix(ref bool __result)
		{
			if (Cfg.SkipActive)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(GameMode_Waves), "IsRoundOver")]
	internal static class SkipRoundWavesPatch
	{
		private static void Postfix(ref bool __result)
		{
			if (Cfg.SkipActive)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(GameMode_Koth), "IsRoundOver")]
	internal static class SkipRoundKothPatch
	{
		private static void Postfix(ref bool __result)
		{
			if (Cfg.SkipActive)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(GameMode_Survival), "IsRoundOver")]
	internal static class SkipRoundSurvivalPatch
	{
		private static void Postfix(ref bool __result)
		{
			if (Cfg.SkipActive)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(GameMode_CTF), "IsRoundOver")]
	internal static class SkipRoundCtfPatch
	{
		private static void Postfix(ref bool __result)
		{
			if (Cfg.SkipActive)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(GameMode_Football), "IsRoundOver")]
	internal static class SkipRoundFootballPatch
	{
		private static void Postfix(ref bool __result)
		{
			if (Cfg.SkipActive)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(GameMode_Rumble), "IsRoundOver")]
	internal static class SkipRoundRumblePatch
	{
		private static void Postfix(ref bool __result)
		{
			if (Cfg.SkipActive)
			{
				__result = true;
			}
		}
	}
	[HarmonyPatch(typeof(GameMode_BigFight), "IsRoundOver")]
	internal static class SkipRoundBigFightPatch
	{
		private static void Postfix(ref bool __result)
		{
			if (Cfg.SkipActive)
			{
				__result = true;
			}
		}
	}
}