Decompiled source of Isnt It Really Fun Huh v1.2.0

BepInEx/plugins/morluto.IsntItReallyFunHuh.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using IsntItReallyFunHuh.Config;
using IsntItReallyFunHuh.Core;
using IsntItReallyFunHuh.Director;
using IsntItReallyFunHuh.Localization;
using IsntItReallyFunHuh.Patches;
using IsntItReallyFunHuh.Pranks;
using IsntItReallyFunHuh.UI;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.SceneManagement;
using Zorro.Core;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AvSGames")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.2.0.0")]
[assembly: AssemblyInformationalVersion("1.2.0+44d3f625134aa40518c18889c9c20628fb2315ca")]
[assembly: AssemblyProduct("Isn't it really fun, huh?")]
[assembly: AssemblyTitle("Isn't it really fun, huh?")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.2.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[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 BepInEx
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Embedded]
	internal sealed class BepInAutoPluginAttribute : Attribute
	{
		public BepInAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace BepInEx.Preloader.Core.Patching
{
	[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
	[Conditional("CodeGeneration")]
	[Embedded]
	internal sealed class PatcherAutoPluginAttribute : Attribute
	{
		public PatcherAutoPluginAttribute(string? id = null, string? name = null, string? version = null)
		{
		}
	}
}
namespace Microsoft.CodeAnalysis
{
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace IsntItReallyFunHuh
{
	[BepInPlugin("morluto.IsntItReallyFunHuh", "Isn't it really fun, huh?", "1.2.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal const string Guid = "morluto.IsntItReallyFunHuh";

		private Harmony? _harmony;

		public const string Id = "morluto.IsntItReallyFunHuh";

		internal static ManualLogSource Log { get; private set; }

		internal static Plugin Instance { get; private set; }

		internal static ModConfig Settings { get; private set; }

		internal static PrankRunner Runner { get; private set; }

		internal static FunDirector Director { get; private set; }

		internal static FunWindow Window { get; private set; }

		public static string Name => "Isn't it really fun, huh?";

		public static string Version => "1.2.0";

		private void Awake()
		{
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0099: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			Log = ((BaseUnityPlugin)this).Logger;
			Instance = this;
			Settings = new ModConfig(((BaseUnityPlugin)this).Config);
			PrankCatalog.Validate();
			Runner = new PrankRunner();
			Director = new FunDirector();
			Window = new FunWindow();
			Runner.Applied += OnPrankApplied;
			SceneManager.sceneLoaded += OnSceneLoaded;
			_harmony = new Harmony("morluto.IsntItReallyFunHuh");
			_harmony.PatchAll(typeof(InputBlockPatch));
			_harmony.PatchAll(typeof(CursorPatch));
			_harmony.PatchAll(typeof(PauseBlockPatch));
			Log.LogInfo((object)$"Isn't it really fun, huh? loaded. Press {Settings.ToggleKey.Value} to open the menu.");
		}

		private static void OnPrankApplied(Prank prank, int count)
		{
			if (Settings.ShowCaptions.Value)
			{
				Captions.ShowRandom();
			}
		}

		private static void OnSceneLoaded(Scene scene, LoadSceneMode mode)
		{
			Window.Close();
			Director.ResetTimer();
			SpawnPranks.ForgetAll();
			ChickenPranks.Reset();
		}

		private void Update()
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			Keyboard current = Keyboard.current;
			if (current != null && ((ButtonControl)current[Settings.ToggleKey.Value]).wasPressedThisFrame)
			{
				Window.Toggle();
			}
			Window.Tick();
			Director.Tick(Runner);
			ChickenPranks.Tick();
			Captions.Tick();
		}

		private void OnGUI()
		{
			Window.OnGUI();
			Captions.Draw();
		}

		private void OnDestroy()
		{
			SceneManager.sceneLoaded -= OnSceneLoaded;
			Runner.Applied -= OnPrankApplied;
			Window.Close();
			Harmony? harmony = _harmony;
			if (harmony != null)
			{
				harmony.UnpatchSelf();
			}
		}
	}
}
namespace IsntItReallyFunHuh.UI
{
	internal static class Captions
	{
		private const float Duration = 3.6f;

		private const int CaptionCount = 12;

		private static string _text = string.Empty;

		private static float _shownAt;

		private static float _hideAt;

		private static GUIStyle? _style;

		private static GUIStyle? _shadow;

		public static void ShowRandom()
		{
			_text = Loc.Get("caption." + Random.Range(0, 12));
			_shownAt = Time.unscaledTime;
			_hideAt = Time.unscaledTime + 3.6f;
		}

		public static void Tick()
		{
			if (_text.Length > 0 && Time.unscaledTime > _hideAt)
			{
				_text = string.Empty;
			}
		}

		public static void Draw()
		{
			//IL_0066: 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_007d: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			if (_text.Length != 0)
			{
				EnsureStyles();
				float num = Time.unscaledTime - _shownAt;
				float num2 = _hideAt - Time.unscaledTime;
				float num3 = Mathf.Clamp01(Mathf.Min(num / 0.25f, num2 / 0.6f));
				Rect val = default(Rect);
				((Rect)(ref val))..ctor(0f, (float)Screen.height * 0.13f, (float)Screen.width, 64f);
				Color color = GUI.color;
				GUI.color = new Color(1f, 1f, 1f, num3);
				Rect val2 = default(Rect);
				((Rect)(ref val2))..ctor(((Rect)(ref val)).x + 2f, ((Rect)(ref val)).y + 2f, ((Rect)(ref val)).width, ((Rect)(ref val)).height);
				GUI.Label(val2, _text, _shadow);
				GUI.Label(val, _text, _style);
				GUI.color = color;
			}
		}

		private static void EnsureStyles()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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_0058: Expected O, but got Unknown
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			if (_style == null)
			{
				GUIStyle val = new GUIStyle(GUI.skin.label)
				{
					fontSize = 26,
					fontStyle = (FontStyle)1,
					alignment = (TextAnchor)4,
					richText = false
				};
				val.normal.textColor = new Color(0.98f, 0.94f, 0.88f);
				_style = val;
				if ((Object)(object)UiSkin.GameFont != (Object)null)
				{
					_style.font = UiSkin.GameFont;
				}
				GUIStyle val2 = new GUIStyle(_style);
				val2.normal.textColor = new Color(0f, 0f, 0f, 0.85f);
				_shadow = val2;
			}
		}
	}
	internal sealed class FunWindow
	{
		private const float Width = 760f;

		private const float Height = 720f;

		private const int WindowId = 4609358;

		private Rect _rect = new Rect(80f, 60f, 760f, 720f);

		private Vector2 _scroll;

		private PrankTab _tab;

		private TargetMode _mode = TargetMode.AllButMe;

		private readonly HashSet<int> _picked = new HashSet<int>();

		private float _amount = 0.45f;

		private float _restoreFraction = 1f;

		private string _hoverHint = string.Empty;

		private string _notice = string.Empty;

		private float _noticeUntil;

		private string? _confirmId;

		private float _confirmUntil;

		private int _closedFrame = -1;

		private float _screenScale = 1f;

		private string _itemFilter = string.Empty;

		private string? _itemSelected;

		private Vector2 _itemScroll;

		private SpawnSide _spawnSide;

		private float _spawnDistance = 6f;

		private bool _scoutmasterLive;

		private int _zombieCount = 2;

		private float _zombieRadius = 6f;

		private bool _zombieLive = true;

		private int _skeletonCount = 2;

		private float _skeletonRadius = 5f;

		public static bool IsOpen { get; private set; }

		public bool BlocksInput
		{
			get
			{
				if (!IsOpen)
				{
					return Time.frameCount == _closedFrame;
				}
				return true;
			}
		}

		public void Toggle()
		{
			if (IsOpen)
			{
				Close();
			}
			else
			{
				Open();
			}
		}

		public void Open()
		{
			IsOpen = true;
			_closedFrame = -1;
			StatusPranks.RestoreFraction = _restoreFraction;
			Cursor.visible = true;
			Cursor.lockState = (CursorLockMode)0;
			CenterIfOffscreen();
		}

		public void Close()
		{
			if (IsOpen)
			{
				_closedFrame = Time.frameCount;
			}
			IsOpen = false;
			_confirmId = null;
			_notice = string.Empty;
			Cursor.visible = false;
			Cursor.lockState = (CursorLockMode)1;
		}

		public void Tick()
		{
			if (!IsOpen)
			{
				return;
			}
			Keyboard current = Keyboard.current;
			if (current != null && ((ButtonControl)current.escapeKey).wasPressedThisFrame)
			{
				Close();
				return;
			}
			if (_notice.Length > 0 && Time.unscaledTime > _noticeUntil)
			{
				_notice = string.Empty;
			}
			if (_confirmId != null && Time.unscaledTime > _confirmUntil)
			{
				_confirmId = null;
			}
			Cursor.visible = true;
			Cursor.lockState = (CursorLockMode)0;
		}

		public void OnGUI()
		{
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0039: 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_004f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0080: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: Expected O, but got Unknown
			//IL_009b: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a0: 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)
			if (IsOpen)
			{
				UiSkin.Ensure();
				float num = (_screenScale = Mathf.Clamp(Plugin.Settings.UiScale.Value, 0.6f, 2f));
				Matrix4x4 matrix = GUI.matrix;
				GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, new Vector3(num, num, 1f));
				((Rect)(ref _rect)).width = 760f;
				((Rect)(ref _rect)).height = 720f;
				_rect = GUI.Window(4609358, _rect, new WindowFunction(DrawWindow), GUIContent.none, UiSkin.Window);
				GUI.matrix = matrix;
			}
		}

		private void DrawWindow(int id)
		{
			//IL_0014: 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_0065: 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)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			GUI.DrawTexture(new Rect(0f, 0f, 4f, 720f), (Texture)(object)UiSkin.AccentTexture);
			GUILayout.BeginArea(new Rect(20f, 14f, 722f, 692f));
			DrawHeader();
			Separator();
			DrawTargets();
			DrawPlayers();
			Separator();
			DrawTabs();
			_scroll = GUILayout.BeginScrollView(_scroll, false, false, GUIStyle.none, GUI.skin.verticalScrollbar, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.ExpandHeight(true) });
			switch (_tab)
			{
			case PrankTab.Director:
				DrawDirector();
				break;
			case PrankTab.Spawn:
				DrawSpawn();
				break;
			default:
				DrawPrankGrid();
				break;
			}
			GUILayout.EndScrollView();
			Separator();
			DrawFooter();
			GUILayout.EndArea();
			GUI.DragWindow(new Rect(0f, 0f, 760f, 76f));
		}

		private void DrawHeader()
		{
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.Label(Loc.Get("window.title"), UiSkin.Title, Array.Empty<GUILayoutOption>());
			GUILayout.Label(Loc.Get("window.subtitle"), UiSkin.Subtitle, Array.Empty<GUILayoutOption>());
			GUILayout.EndVertical();
			GUILayout.FlexibleSpace();
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			GUILayout.Space(4f);
			GUILayout.Label(Loc.Format("window.close_hint", Plugin.Settings.ToggleKey.Value), UiSkin.Small, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(240f) });
			GUILayout.EndVertical();
			GUILayout.EndHorizontal();
		}

		private void DrawTargets()
		{
			List<Character> players = PlayerRegistry.Players();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(Loc.Get("window.targets"), UiSkin.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(70f) });
			if (GUILayout.Button(Loc.Get("window.target.all_but_me"), (_mode.Id == TargetMode.AllButMe.Id) ? UiSkin.TabActive : UiSkin.Tab, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(32f),
				GUILayout.Width(118f)
			}))
			{
				_mode = TargetMode.AllButMe;
			}
			if (GUILayout.Button(Loc.Get("window.target.everyone"), (_mode.Id == TargetMode.Everyone.Id) ? UiSkin.TabActive : UiSkin.Tab, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(32f),
				GUILayout.Width(104f)
			}))
			{
				_mode = TargetMode.Everyone;
			}
			if (GUILayout.Button(Loc.Get("window.target.pick"), _mode.NeedsPick ? UiSkin.TabActive : UiSkin.Tab, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(32f),
				GUILayout.Width(84f)
			}))
			{
				_mode = TargetMode.Picked;
			}
			if (GUILayout.Button(Loc.Get("window.target.aim"), (_mode.Id == TargetMode.Aimed.Id) ? UiSkin.TabActive : UiSkin.Tab, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(32f),
				GUILayout.Width(104f)
			}))
			{
				_mode = TargetMode.Aimed;
			}
			GUILayout.FlexibleSpace();
			int count = ResolveTargets(players).Count;
			string text = ((_mode.Id == TargetMode.Aimed.Id && count == 0) ? Loc.Get("window.target.aim_none") : Loc.Format("window.target.count", count));
			GUILayout.Label(text, UiSkin.Small, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(130f) });
			GUILayout.EndHorizontal();
		}

		private void DrawPlayers()
		{
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			List<Character> list = PlayerRegistry.Players();
			if (list.Count == 0)
			{
				GUILayout.Label(Loc.Get("window.empty"), UiSkin.Small, Array.Empty<GUILayoutOption>());
				return;
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Space(70f);
			foreach (Character item in list)
			{
				if ((Object)(object)item == (Object)null || (Object)(object)((MonoBehaviourPun)item).photonView == (Object)null)
				{
					continue;
				}
				int viewID = ((MonoBehaviourPun)item).photonView.ViewID;
				bool flag = _mode.NeedsPick && _picked.Contains(viewID);
				bool flag2 = (Object)(object)item == (Object)(object)Character.localCharacter;
				string text = PlayerRegistry.NameOf(item);
				if (flag2)
				{
					text += Loc.Get("window.you");
				}
				if (PlayerRegistry.IsDown(item))
				{
					text += Loc.Get("window.dead");
				}
				string text2 = ColorUtility.ToHtmlStringRGB(PlayerRegistry.ColorOf(item));
				string text3 = "<color=#" + text2 + ">●</color> " + text;
				if (GUILayout.Button(text3, flag ? UiSkin.ChipOn : UiSkin.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Height(28f),
					GUILayout.Width(160f)
				}))
				{
					if (!_mode.NeedsPick)
					{
						_mode = TargetMode.Picked;
						_picked.Clear();
					}
					if (!_picked.Add(viewID))
					{
						_picked.Remove(viewID);
					}
				}
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
		}

		private void DrawTabs()
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			TabButton(PrankTab.Status, "tab.status");
			TabButton(PrankTab.Prank, "tab.prank");
			TabButton(PrankTab.Item, "tab.item");
			TabButton(PrankTab.Spawn, "tab.spawn");
			TabButton(PrankTab.Director, "tab.director");
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
		}

		private void TabButton(PrankTab tab, string key)
		{
			//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)
			if (GUILayout.Button(Loc.Get(key), (_tab == tab) ? UiSkin.TabActive : UiSkin.Tab, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(34f),
				GUILayout.Width(132f)
			}))
			{
				_tab = tab;
				_scroll = Vector2.zero;
				_confirmId = null;
			}
		}

		private void DrawPrankGrid()
		{
			if (_tab == PrankTab.Status)
			{
				DrawStatusControls();
			}
			if (_tab == PrankTab.Prank && ChickenPranks.IsActive)
			{
				GUILayout.Space(4f);
				GUILayout.Label(Loc.Format("chicken.active", ChickenPranks.TargetCount), UiSkin.Small, Array.Empty<GUILayoutOption>());
			}
			List<Prank> list = PrankCatalog.All.Where((Prank p) => p.Tab == _tab).ToList();
			for (int num = 0; num < list.Count; num += 2)
			{
				GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				DrawPrankButton(list[num]);
				if (num + 1 < list.Count)
				{
					DrawPrankButton(list[num + 1]);
				}
				else
				{
					GUILayout.Space(4f);
					GUILayout.Box(GUIContent.none, GUIStyle.none, (GUILayoutOption[])(object)new GUILayoutOption[2]
					{
						GUILayout.Height(62f),
						GUILayout.ExpandWidth(true)
					});
				}
				GUILayout.EndHorizontal();
			}
			if (_tab == PrankTab.Item)
			{
				DrawItemPicker();
			}
			GUILayout.Space(6f);
			GUILayout.Label(Loc.Get("window.hint_nasty"), UiSkin.Small, Array.Empty<GUILayoutOption>());
		}

		private void DrawStatusControls()
		{
			GUILayout.Space(4f);
			GUILayout.Label(Loc.Format("status.amount", Mathf.RoundToInt(_amount * 100f)), UiSkin.Label, Array.Empty<GUILayoutOption>());
			float num = GUILayout.HorizontalSlider(_amount, 0.05f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(22f) });
			_amount = Mathf.Clamp(Mathf.Round(num / 0.05f) * 0.05f, 0.05f, 1f);
			GUILayout.Label(Loc.Format("status.restore", Mathf.RoundToInt(_restoreFraction * 100f)), UiSkin.Label, Array.Empty<GUILayoutOption>());
			float num2 = GUILayout.HorizontalSlider(_restoreFraction, 0f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(22f) });
			_restoreFraction = Mathf.Clamp(Mathf.Round(num2 / 0.05f) * 0.05f, 0f, 1f);
			StatusPranks.RestoreFraction = _restoreFraction;
			GUILayout.Label(Loc.Get("status.hint"), UiSkin.Hint, Array.Empty<GUILayoutOption>());
			GUILayout.Space(2f);
		}

		private void DrawPrankButton(Prank prank)
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Expected O, but got Unknown
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			bool available = prank.Available;
			bool flag = _confirmId == prank.Id && Time.unscaledTime < _confirmUntil;
			string text = (flag ? Loc.Get("window.confirm") : prank.Label);
			GUIStyle val = ((!available) ? UiSkin.ButtonDisabled : (flag ? UiSkin.TabActive : (prank.Nasty ? UiSkin.Danger : UiSkin.Button)));
			if (GUILayout.Button(new GUIContent(text, prank.Hint), val, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(62f),
				GUILayout.ExpandWidth(true)
			}))
			{
				OnPrankClicked(prank);
			}
			Rect lastRect = GUILayoutUtility.GetLastRect();
			Vector2 val2 = Event.current.mousePosition / _screenScale;
			if (((Rect)(ref lastRect)).Contains(val2))
			{
				_hoverHint = (available ? prank.Hint : Loc.Get("window.host_only"));
			}
		}

		private void DrawDirector()
		{
			ModConfig settings = Plugin.Settings;
			GUILayout.Space(6f);
			GUILayout.Label(Loc.Get(settings.DirectorEnabled.Value ? "director.enabled" : "director.disabled"), UiSkin.Section, Array.Empty<GUILayoutOption>());
			GUILayout.Space(4f);
			string text = (settings.DirectorEnabled.Value ? Loc.Get("window.on") : Loc.Get("window.off"));
			if (GUILayout.Button(text, settings.DirectorEnabled.Value ? UiSkin.TabActive : UiSkin.Tab, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(36f),
				GUILayout.Width(200f)
			}))
			{
				settings.DirectorEnabled.Value = !settings.DirectorEnabled.Value;
				Plugin.Director.ResetTimer();
			}
			GUILayout.Space(8f);
			GUILayout.Label(Loc.Format("director.interval", settings.DirectorInterval.Value), UiSkin.Label, Array.Empty<GUILayoutOption>());
			float num = GUILayout.HorizontalSlider(settings.DirectorInterval.Value, 15f, 300f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(22f) });
			settings.DirectorInterval.Value = Mathf.Round(num / 5f) * 5f;
			GUILayout.Space(8f);
			bool value = GUILayout.Toggle(settings.DirectorTargetsMe.Value, Loc.Get("director.targets_me"), UiSkin.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(32f),
				GUILayout.Width(240f)
			});
			settings.DirectorTargetsMe.Value = value;
			bool value2 = GUILayout.Toggle(settings.DirectorUseNastyPranks.Value, Loc.Get("director.nasty"), UiSkin.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(32f),
				GUILayout.Width(260f)
			});
			settings.DirectorUseNastyPranks.Value = value2;
			GUILayout.Space(10f);
			GUILayout.Label(Loc.Format("director.hint", settings.DirectorInterval.Value), UiSkin.Hint, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			GUILayout.Label(Loc.Format("director.next", Plugin.Director.SecondsLeft), UiSkin.Small, Array.Empty<GUILayoutOption>());
			GUILayout.Space(10f);
			if (GUILayout.Button(Loc.Get("director.now"), UiSkin.Danger, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(46f),
				GUILayout.Width(240f)
			}))
			{
				Plugin.Director.FireNow();
			}
		}

		private void DrawSpawn()
		{
			GUILayout.Space(6f);
			GUILayout.Label(Loc.Get("spawn.title"), UiSkin.Section, Array.Empty<GUILayoutOption>());
			GUILayout.Label(Loc.Get("spawn.subtitle"), UiSkin.Hint, Array.Empty<GUILayoutOption>());
			GUILayout.Space(8f);
			GUILayout.Label(Loc.Get("spawn.scoutmaster"), UiSkin.Label, Array.Empty<GUILayoutOption>());
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(Loc.Get("spawn.side"), UiSkin.Small, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) });
			SideButton(SpawnSide.Front, "spawn.side.front");
			SideButton(SpawnSide.Behind, "spawn.side.behind");
			SideButton(SpawnSide.Left, "spawn.side.left");
			SideButton(SpawnSide.Right, "spawn.side.right");
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			DistanceSlider(ref _spawnDistance);
			BehaviourRow(ref _scoutmasterLive);
			if (GUILayout.Button(Loc.Get("spawn.scoutmaster.button"), UiSkin.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) }))
			{
				SpawnScoutmasters();
			}
			GUILayout.Space(10f);
			GUILayout.Label(Loc.Get("spawn.zombies"), UiSkin.Label, Array.Empty<GUILayoutOption>());
			CountSlider(ref _zombieCount);
			RadiusSlider(ref _zombieRadius);
			BehaviourRow(ref _zombieLive);
			if (GUILayout.Button(Loc.Get("spawn.zombies.button"), UiSkin.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) }))
			{
				SpawnZombies();
			}
			GUILayout.Space(10f);
			GUILayout.Label(Loc.Get("spawn.skeletons"), UiSkin.Label, Array.Empty<GUILayoutOption>());
			CountSlider(ref _skeletonCount);
			RadiusSlider(ref _skeletonRadius);
			if (GUILayout.Button(Loc.Get("spawn.skeletons.button"), UiSkin.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(36f) }))
			{
				SpawnSkeletons();
			}
			GUILayout.Space(12f);
			GUILayout.Label(Loc.Format("spawn.spawned", SpawnPranks.Count), UiSkin.Small, Array.Empty<GUILayoutOption>());
			if (GUILayout.Button(Loc.Get("spawn.cleanup.button"), UiSkin.Danger, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(34f),
				GUILayout.Width(270f)
			}))
			{
				int num = SpawnPranks.ClearAll();
				Notice(Loc.Format("spawn.cleared", num));
			}
			GUILayout.Label(Loc.Get("spawn.cleanup.hint"), UiSkin.Hint, Array.Empty<GUILayoutOption>());
		}

		private void DrawItemPicker()
		{
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Space(12f);
			GUILayout.Label(Loc.Get("items.title"), UiSkin.Section, Array.Empty<GUILayoutOption>());
			IReadOnlyList<string> readOnlyList = ItemPranks.ItemNames();
			if (readOnlyList.Count == 0)
			{
				GUILayout.Label(Loc.Get("items.not_ready"), UiSkin.Hint, Array.Empty<GUILayoutOption>());
				return;
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(Loc.Get("items.filter"), UiSkin.Small, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(108f) });
			_itemFilter = GUILayout.TextField(_itemFilter, UiSkin.Field, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(28f) });
			if (GUILayout.Button(Loc.Get("items.clear_filter"), UiSkin.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(28f),
				GUILayout.Width(72f)
			}))
			{
				_itemFilter = string.Empty;
			}
			GUILayout.EndHorizontal();
			List<string> list = FilterItems(readOnlyList);
			if (list.Count == 0)
			{
				GUILayout.Label(Loc.Get("items.none"), UiSkin.Small, Array.Empty<GUILayoutOption>());
			}
			else
			{
				_itemScroll = GUILayout.BeginScrollView(_itemScroll, false, true, GUIStyle.none, GUI.skin.verticalScrollbar, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(132f) });
				for (int i = 0; i < list.Count; i += 3)
				{
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
					for (int j = 0; j < 3; j++)
					{
						int num = i + j;
						if (num >= list.Count)
						{
							GUILayout.Space(4f);
							GUILayout.Box(GUIContent.none, GUIStyle.none, (GUILayoutOption[])(object)new GUILayoutOption[2]
							{
								GUILayout.Height(28f),
								GUILayout.ExpandWidth(true)
							});
							continue;
						}
						string text = list[num];
						bool flag = string.Equals(text, _itemSelected, StringComparison.Ordinal);
						if (GUILayout.Button(text, flag ? UiSkin.ChipOn : UiSkin.Chip, (GUILayoutOption[])(object)new GUILayoutOption[2]
						{
							GUILayout.Height(28f),
							GUILayout.ExpandWidth(true)
						}))
						{
							_itemSelected = text;
						}
					}
					GUILayout.EndHorizontal();
				}
				GUILayout.EndScrollView();
			}
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label((_itemSelected != null) ? Loc.Format("items.selected", _itemSelected) : Loc.Get("items.none"), UiSkin.Small, Array.Empty<GUILayoutOption>());
			GUILayout.FlexibleSpace();
			if (GUILayout.Button(Loc.Get("items.give"), (_itemSelected != null) ? UiSkin.Button : UiSkin.ButtonDisabled, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(32f),
				GUILayout.Width(190f)
			}))
			{
				GiveSelectedItem();
			}
			GUILayout.EndHorizontal();
		}

		private void SideButton(SpawnSide side, string key)
		{
			if (GUILayout.Button(Loc.Get(key), (_spawnSide == side) ? UiSkin.TabActive : UiSkin.Tab, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(30f),
				GUILayout.Width(88f)
			}))
			{
				_spawnSide = side;
			}
		}

		private static void BehaviourRow(ref bool live)
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(Loc.Get("spawn.mode"), UiSkin.Small, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(90f) });
			if (GUILayout.Button(Loc.Get("spawn.mode.stand"), (!live) ? UiSkin.TabActive : UiSkin.Tab, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(30f),
				GUILayout.Width(134f)
			}))
			{
				live = false;
			}
			if (GUILayout.Button(Loc.Get("spawn.mode.chase"), live ? UiSkin.TabActive : UiSkin.Tab, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.Height(30f),
				GUILayout.Width(134f)
			}))
			{
				live = true;
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
		}

		private static void CountSlider(ref int value)
		{
			GUILayout.Label(Loc.Format("spawn.count", value), UiSkin.Small, Array.Empty<GUILayoutOption>());
			float num = GUILayout.HorizontalSlider((float)value, 1f, 10f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) });
			value = Mathf.Clamp(Mathf.RoundToInt(num), 1, 10);
		}

		private static void RadiusSlider(ref float value)
		{
			GUILayout.Label(Loc.Format("spawn.radius", value), UiSkin.Small, Array.Empty<GUILayoutOption>());
			float num = GUILayout.HorizontalSlider(value, 2f, 20f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) });
			value = Mathf.Clamp(Mathf.Round(num), 2f, 20f);
		}

		private void DistanceSlider(ref float value)
		{
			GUILayout.Label(Loc.Format("spawn.distance", value), UiSkin.Small, Array.Empty<GUILayoutOption>());
			float num = GUILayout.HorizontalSlider(value, 3f, 20f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(24f) });
			value = Mathf.Clamp(Mathf.Round(num), 3f, 20f);
		}

		private void SpawnScoutmasters()
		{
			List<Character> list = ResolveTargets();
			if (list.Count == 0)
			{
				Notice(Loc.Get("spawn.no_target"));
				return;
			}
			int num = SpawnPranks.Scoutmaster(list, _spawnSide, _spawnDistance, _scoutmasterLive);
			Notice((num > 0) ? Loc.Format("spawn.done", num) : Loc.Get("spawn.failed"));
		}

		private void SpawnZombies()
		{
			List<Character> list = ResolveTargets();
			if (list.Count == 0)
			{
				Notice(Loc.Get("spawn.no_target"));
				return;
			}
			int num = SpawnPranks.Zombies(list, _zombieCount, _zombieRadius, _zombieLive);
			Notice((num > 0) ? Loc.Format("spawn.done", num) : Loc.Get("spawn.failed"));
		}

		private void SpawnSkeletons()
		{
			List<Character> list = ResolveTargets();
			if (list.Count == 0)
			{
				Notice(Loc.Get("spawn.no_target"));
				return;
			}
			int num = SpawnPranks.Skeletons(list, _skeletonCount, _skeletonRadius);
			Notice((num > 0) ? Loc.Format("spawn.done", num) : Loc.Get("spawn.failed"));
		}

		private List<string> FilterItems(IReadOnlyList<string> items)
		{
			string filter = _itemFilter.Trim();
			if (filter.Length == 0)
			{
				return items.ToList();
			}
			return items.Where((string name) => name.IndexOf(filter, StringComparison.OrdinalIgnoreCase) >= 0).ToList();
		}

		private void GiveSelectedItem()
		{
			if (_itemSelected == null)
			{
				return;
			}
			List<Character> list = ResolveTargets();
			if (list.Count == 0)
			{
				Notice(Loc.Get("window.target.none"));
				return;
			}
			int num = 0;
			foreach (Character item in list)
			{
				if (ItemPranks.Give(item, _itemSelected))
				{
					num++;
				}
			}
			Notice((num > 0) ? Loc.Format("items.given", _itemSelected, num) : Loc.Get("window.failed"));
		}

		private void DrawFooter()
		{
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			GUILayout.Label(Loc.Get("window.amount"), UiSkin.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(68f) });
			float num = GUILayout.HorizontalSlider(_amount, 0.05f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(22f) });
			_amount = Mathf.Clamp(num, 0.05f, 1f);
			GUILayout.Label($"{Mathf.RoundToInt(_amount * 100f)}%", UiSkin.Label, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(54f) });
			GUILayout.EndHorizontal();
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			if (GUILayout.Button(Loc.Get("window.random"), UiSkin.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }))
			{
				FireRandom();
			}
			if (GUILayout.Button(Loc.Get("window.unstick_all"), UiSkin.Button, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(34f) }))
			{
				UnstickAll();
			}
			GUILayout.FlexibleSpace();
			GUILayout.EndHorizontal();
			string text = ((_notice.Length > 0) ? _notice : _hoverHint);
			GUILayout.Label((text.Length > 0) ? text : Loc.Get("window.amount_hint"), UiSkin.Hint, (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Height(38f) });
			GUILayout.BeginVertical(Array.Empty<GUILayoutOption>());
			List<string> list = Plugin.Runner.Log.Reverse().Take(2).ToList();
			if (list.Count > 0)
			{
				GUILayout.Label(Loc.Get("window.log"), UiSkin.Small, Array.Empty<GUILayoutOption>());
			}
			foreach (string item in list)
			{
				GUILayout.Label(item, UiSkin.Small, Array.Empty<GUILayoutOption>());
			}
			GUILayout.EndVertical();
		}

		private void FireRandom()
		{
			List<Prank> list = PrankCatalog.All.Where((Prank p) => p.Tab == _tab && p.Available && !p.Nasty && !p.Global).ToList();
			if (list.Count == 0)
			{
				list = PrankCatalog.All.Where((Prank p) => p.Available && !p.Nasty && !p.Global).ToList();
			}
			if (list.Count == 0)
			{
				Notice(Loc.Get("window.failed"));
			}
			else
			{
				OnPrankClicked(list[Random.Range(0, list.Count)]);
			}
		}

		private void UnstickAll()
		{
			int num = 0;
			foreach (Character item in PlayerRegistry.Players())
			{
				StatusPranks.Unstick(item);
				num++;
			}
			Notice(Loc.Format("window.unstuck", num));
		}

		private List<Character> ResolveTargets()
		{
			return ResolveTargets(PlayerRegistry.Players());
		}

		private List<Character> ResolveTargets(List<Character> players)
		{
			if (_mode.NeedsPick)
			{
				return players.Where((Character p) => (Object)(object)p != (Object)null && (Object)(object)((MonoBehaviourPun)p).photonView != (Object)null && _picked.Contains(((MonoBehaviourPun)p).photonView.ViewID)).ToList();
			}
			if (_mode.Id == TargetMode.Aimed.Id)
			{
				Character val = PlayerRegistry.FindAimed();
				if (!((Object)(object)val != (Object)null))
				{
					return new List<Character>();
				}
				return new List<Character> { val };
			}
			if (_mode.Id == TargetMode.Everyone.Id)
			{
				return players.ToList();
			}
			Character local = Character.localCharacter;
			return players.Where((Character p) => (Object)(object)p != (Object)(object)local).ToList();
		}

		private void OnPrankClicked(Prank prank)
		{
			if (!prank.Available)
			{
				Notice(Loc.Get("window.host_only"));
				return;
			}
			if (prank.Global)
			{
				_confirmId = null;
				if (Plugin.Runner.RunGlobal(prank, _amount) == 0)
				{
					Notice(Loc.Get("window.failed"));
				}
				else if (prank.Id == "chicken_off" && !PhotonNetwork.IsMasterClient)
				{
					Notice(Loc.Get("chicken.guest_cancel"));
				}
				return;
			}
			if (prank.Nasty && _confirmId != prank.Id)
			{
				_confirmId = prank.Id;
				_confirmUntil = Time.unscaledTime + 4f;
				return;
			}
			_confirmId = null;
			List<Character> list = ResolveTargets();
			if (list.Count == 0)
			{
				Notice(Loc.Get("window.target.none"));
			}
			else if (Plugin.Runner.Run(prank, list, _amount) == 0)
			{
				Notice(Loc.Get("window.failed"));
			}
		}

		private void Notice(string text)
		{
			_notice = text;
			_noticeUntil = Time.unscaledTime + 4f;
		}

		private void CenterIfOffscreen()
		{
			float num = Mathf.Clamp(Plugin.Settings.UiScale.Value, 0.6f, 2f);
			float num2 = (float)Screen.width / num;
			float num3 = (float)Screen.height / num;
			((Rect)(ref _rect)).x = Mathf.Clamp(((Rect)(ref _rect)).x, 0f, Mathf.Max(0f, num2 - 760f));
			((Rect)(ref _rect)).y = Mathf.Clamp(((Rect)(ref _rect)).y, 0f, Mathf.Max(0f, num3 - 720f));
		}

		private static void Separator()
		{
			//IL_0030: 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_0036: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Space(5f);
			Rect rect = GUILayoutUtility.GetRect(1f, 1f, (GUILayoutOption[])(object)new GUILayoutOption[2]
			{
				GUILayout.ExpandWidth(true),
				GUILayout.Height(1f)
			});
			GUI.DrawTexture(rect, (Texture)(object)UiSkin.LineTexture);
			GUILayout.Space(5f);
		}
	}
	internal static class UiSkin
	{
		public static readonly Color Text = new Color(0.95f, 0.93f, 0.9f);

		public static readonly Color Muted = new Color(0.62f, 0.57f, 0.63f);

		public static readonly Color Accent = new Color(0.88f, 0.27f, 0.18f);

		private static bool _built;

		private static Font? _font;

		private static Texture2D _background = null;

		private static Texture2D _panel = null;

		private static Texture2D _panelHover = null;

		private static Texture2D _accent = null;

		private static Texture2D _accentDim = null;

		private static Texture2D _danger = null;

		private static Texture2D _line = null;

		private static Texture2D _chipOn = null;

		public static GUIStyle Window = null;

		public static GUIStyle Title = null;

		public static GUIStyle Subtitle = null;

		public static GUIStyle Section = null;

		public static GUIStyle Label = null;

		public static GUIStyle Small = null;

		public static GUIStyle Hint = null;

		public static GUIStyle Tab = null;

		public static GUIStyle TabActive = null;

		public static GUIStyle Button = null;

		public static GUIStyle ButtonHover = null;

		public static GUIStyle ButtonDisabled = null;

		public static GUIStyle Danger = null;

		public static GUIStyle Chip = null;

		public static GUIStyle ChipOn = null;

		public static GUIStyle Field = null;

		public static Texture2D AccentTexture => _accent;

		public static Texture2D LineTexture => _line;

		public static Font? GameFont => _font;

		public static void Ensure()
		{
			//IL_002c: 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_0072: 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_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: 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_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_012b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_013a: 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_0149: Expected O, but got Unknown
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Expected O, but got Unknown
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_0168: Unknown result type (might be due to invalid IL or missing references)
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0178: Unknown result type (might be due to invalid IL or missing references)
			//IL_0188: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0198: 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_01ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_01f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0208: Unknown result type (might be due to invalid IL or missing references)
			//IL_020e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0218: Unknown result type (might be due to invalid IL or missing references)
			//IL_0228: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: 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_024e: Unknown result type (might be due to invalid IL or missing references)
			//IL_025d: Expected O, but got Unknown
			//IL_0267: Unknown result type (might be due to invalid IL or missing references)
			//IL_026c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0274: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0282: Unknown result type (might be due to invalid IL or missing references)
			//IL_0288: Unknown result type (might be due to invalid IL or missing references)
			//IL_0297: Expected O, but got Unknown
			//IL_02a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ae: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: 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_02ca: Expected O, but got Unknown
			//IL_02d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_02f5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0304: Expected O, but got Unknown
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0313: Unknown result type (might be due to invalid IL or missing references)
			//IL_031b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0322: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_033e: Expected O, but got Unknown
			//IL_0348: Unknown result type (might be due to invalid IL or missing references)
			//IL_034d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0355: Unknown result type (might be due to invalid IL or missing references)
			//IL_035c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0363: Unknown result type (might be due to invalid IL or missing references)
			//IL_0369: Unknown result type (might be due to invalid IL or missing references)
			//IL_0378: Expected O, but got Unknown
			//IL_0382: 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_038f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_039d: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Expected O, but got Unknown
			//IL_03bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_03f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0410: Unknown result type (might be due to invalid IL or missing references)
			//IL_043b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0466: Unknown result type (might be due to invalid IL or missing references)
			//IL_0482: Unknown result type (might be due to invalid IL or missing references)
			//IL_049e: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_04bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_04d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_04dd: Expected O, but got Unknown
			//IL_04dd: 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_04ec: Expected O, but got Unknown
			//IL_04ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_04fb: Expected O, but got Unknown
			//IL_04fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_050b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0511: Unknown result type (might be due to invalid IL or missing references)
			//IL_051b: Unknown result type (might be due to invalid IL or missing references)
			//IL_052b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0531: Unknown result type (might be due to invalid IL or missing references)
			//IL_053b: Unknown result type (might be due to invalid IL or missing references)
			//IL_054b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0551: Unknown result type (might be due to invalid IL or missing references)
			//IL_055b: Unknown result type (might be due to invalid IL or missing references)
			//IL_056b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0571: Unknown result type (might be due to invalid IL or missing references)
			//IL_057b: Unknown result type (might be due to invalid IL or missing references)
			//IL_058b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0591: Unknown result type (might be due to invalid IL or missing references)
			//IL_059b: Unknown result type (might be due to invalid IL or missing references)
			//IL_05ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_05db: Unknown result type (might be due to invalid IL or missing references)
			//IL_05eb: Unknown result type (might be due to invalid IL or missing references)
			//IL_05f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0600: Expected O, but got Unknown
			if (_built)
			{
				return;
			}
			_built = true;
			_font = ResolveFont();
			_background = Solid(new Color(0.055f, 0.047f, 0.062f, 0.985f));
			_panel = Solid(new Color(0.115f, 0.095f, 0.125f, 1f));
			_panelHover = Solid(new Color(0.175f, 0.14f, 0.18f, 1f));
			_accent = Solid(Accent);
			_accentDim = Solid(new Color(0.36f, 0.12f, 0.09f, 1f));
			_danger = Solid(new Color(0.28f, 0.08f, 0.07f, 1f));
			_line = Solid(new Color(0.25f, 0.21f, 0.26f, 1f));
			_chipOn = Solid(new Color(0.42f, 0.15f, 0.1f, 1f));
			GUIStyle val = new GUIStyle(GUI.skin.window)
			{
				padding = new RectOffset(0, 0, 0, 0),
				border = new RectOffset(0, 0, 0, 0),
				margin = new RectOffset(0, 0, 0, 0)
			};
			val.normal.background = _background;
			val.normal.textColor = Text;
			val.hover.background = _background;
			val.hover.textColor = Text;
			val.active.background = _background;
			val.active.textColor = Text;
			val.focused.background = _background;
			val.focused.textColor = Text;
			val.onNormal.background = _background;
			val.onNormal.textColor = Text;
			val.onHover.background = _background;
			val.onHover.textColor = Text;
			val.onActive.background = _background;
			val.onActive.textColor = Text;
			val.onFocused.background = _background;
			val.onFocused.textColor = Text;
			Window = val;
			GUIStyle val2 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 26,
				fontStyle = (FontStyle)1,
				richText = true
			};
			val2.normal.textColor = Text;
			Title = val2;
			GUIStyle val3 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 13,
				richText = true
			};
			val3.normal.textColor = Muted;
			Subtitle = val3;
			GUIStyle val4 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 17,
				fontStyle = (FontStyle)1,
				richText = true
			};
			val4.normal.textColor = Text;
			Section = val4;
			GUIStyle val5 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 14,
				richText = true,
				alignment = (TextAnchor)3
			};
			val5.normal.textColor = Text;
			Label = val5;
			GUIStyle val6 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 12,
				richText = true,
				alignment = (TextAnchor)3
			};
			val6.normal.textColor = Muted;
			Small = val6;
			GUIStyle val7 = new GUIStyle(GUI.skin.label)
			{
				fontSize = 13,
				richText = true,
				wordWrap = true
			};
			val7.normal.textColor = Muted;
			Hint = val7;
			Tab = ButtonStyle(_panel, _panelHover, Muted, 14, (FontStyle)1);
			TabActive = ButtonStyle(_accentDim, _accentDim, Text, 14, (FontStyle)1);
			Button = ButtonStyle(_panel, _panelHover, Text, 14, (FontStyle)0);
			ButtonHover = ButtonStyle(_panelHover, _panelHover, Text, 14, (FontStyle)0);
			ButtonDisabled = ButtonStyle(_panel, _panel, new Color(0.4f, 0.36f, 0.41f), 14, (FontStyle)0);
			Danger = ButtonStyle(_danger, _accentDim, new Color(0.96f, 0.74f, 0.7f), 14, (FontStyle)0);
			Chip = ButtonStyle(_panel, _panelHover, Text, 13, (FontStyle)0);
			ChipOn = ButtonStyle(_chipOn, _chipOn, Text, 13, (FontStyle)1);
			GUIStyle val8 = new GUIStyle(GUI.skin.textField)
			{
				fontSize = 13,
				alignment = (TextAnchor)3,
				border = new RectOffset(0, 0, 0, 0),
				padding = new RectOffset(8, 8, 4, 4),
				margin = new RectOffset(2, 2, 2, 2)
			};
			val8.normal.background = _panel;
			val8.normal.textColor = Text;
			val8.hover.background = _panelHover;
			val8.hover.textColor = Text;
			val8.active.background = _panelHover;
			val8.active.textColor = Text;
			val8.focused.background = _panelHover;
			val8.focused.textColor = Text;
			val8.onNormal.background = _panel;
			val8.onNormal.textColor = Text;
			val8.onHover.background = _panelHover;
			val8.onHover.textColor = Text;
			val8.onActive.background = _panelHover;
			val8.onActive.textColor = Text;
			val8.onFocused.background = _panelHover;
			val8.onFocused.textColor = Text;
			Field = val8;
			if (!((Object)(object)_font != (Object)null))
			{
				return;
			}
			foreach (GUIStyle item in AllStyles())
			{
				item.font = _font;
			}
		}

		private static Font? ResolveFont()
		{
			try
			{
				return Font.CreateDynamicFontFromOSFont(new string[7] { "Segoe UI", "Arial", "Helvetica Neue", "Helvetica", "DejaVu Sans", "Noto Sans", "Liberation Sans" }, 16);
			}
			catch
			{
				return null;
			}
		}

		private static IEnumerable<GUIStyle> AllStyles()
		{
			yield return Title;
			yield return Subtitle;
			yield return Section;
			yield return Label;
			yield return Small;
			yield return Hint;
			yield return Tab;
			yield return TabActive;
			yield return Button;
			yield return ButtonHover;
			yield return ButtonDisabled;
			yield return Danger;
			yield return Chip;
			yield return ChipOn;
			yield return Field;
		}

		private static GUIStyle ButtonStyle(Texture2D normal, Texture2D hover, Color color, int size, FontStyle fontStyle)
		{
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003b: Expected O, but got Unknown
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Expected O, but got Unknown
			//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_0059: Expected O, but got Unknown
			//IL_0059: 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_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: 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_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: 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_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00de: Expected O, but got Unknown
			GUIStyle val = new GUIStyle(GUI.skin.button)
			{
				fontSize = size,
				fontStyle = fontStyle,
				richText = true,
				alignment = (TextAnchor)4,
				border = new RectOffset(0, 0, 0, 0),
				padding = new RectOffset(8, 8, 6, 6),
				margin = new RectOffset(2, 2, 2, 2)
			};
			val.normal.background = normal;
			val.normal.textColor = color;
			val.hover.background = hover;
			val.hover.textColor = Text;
			val.active.background = normal;
			val.active.textColor = Text;
			val.focused.background = normal;
			val.focused.textColor = color;
			val.onNormal.background = hover;
			val.onNormal.textColor = Text;
			return val;
		}

		private static Texture2D Solid(Color color)
		{
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Expected O, but got Unknown
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			Texture2D val = new Texture2D(1, 1, (TextureFormat)4, false)
			{
				hideFlags = (HideFlags)61
			};
			val.SetPixel(0, 0, color);
			val.Apply();
			return val;
		}
	}
}
namespace IsntItReallyFunHuh.Pranks
{
	internal static class BodyPranks
	{
		public static void Rest(Character target)
		{
			Rpc.Send(target, "RPCA_PassOut");
		}

		public static void Wake(Character target)
		{
			Rpc.Send(target, "RPCA_UnPassOut");
		}

		public static void Trip(Character target, float amount)
		{
			Rpc.Send(target, "RPCA_Fall", PrankMath.Scale(amount, 1.5f, 5f), 0.35f);
		}

		public static void Launch(Character target, float amount)
		{
			//IL_0033: 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)
			float num = PrankMath.Scale(amount, 120f, 420f);
			Rpc.Send(target, "RPCA_AddForceToBodyPart", (object)(BodypartType)2, (object)new Vector3(0f, num, 0f), (object)new Vector3(0f, num * 0.6f, 0f));
		}

		public static void WarpToMe(Character target)
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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)
			//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_005c: Unknown result type (might be due to invalid IL or missing references)
			Character localCharacter = Character.localCharacter;
			if (!((Object)(object)localCharacter == (Object)null) && !((Object)(object)localCharacter == (Object)(object)target))
			{
				Vector3 val = localCharacter.Center + ((Component)localCharacter).transform.forward * 1.4f + Vector3.up * 0.2f;
				Rpc.Send(target, "WarpPlayerRPC", val, true);
			}
		}

		public static void WarpToRandom(Character target)
		{
			//IL_002b: 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)
			//IL_0040: 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_004a: 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_0059: 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_006d: Unknown result type (might be due to invalid IL or missing references)
			List<Character> list = PlayerRegistry.Players();
			list.Remove(target);
			if (list.Count != 0)
			{
				Character val = list[Random.Range(0, list.Count)];
				Vector3 val2 = val.Center + ((Component)val).transform.forward * 1.2f + Vector3.up * 0.2f;
				Rpc.Send(target, "WarpPlayerRPC", val2, true);
			}
		}

		public static void WarpSkyReal(Character target, float amount)
		{
			//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_001b: 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)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = target.Center + Vector3.up * PrankMath.Scale(amount, 250f, 700f);
			Rpc.Send(target, "WarpPlayerRPC", val, true);
		}

		public static void WarpSkyFake(Character target, float amount)
		{
			//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_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_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0036: 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)
			Vector3 center = target.Center;
			Vector3 val = center + Vector3.up * PrankMath.Scale(amount, 200f, 550f);
			Rpc.Send(target, "WarpPlayerRPC", val, true);
			((MonoBehaviour)Plugin.Instance).StartCoroutine(ReturnTo(target, center, 1.4f));
		}

		private static IEnumerator ReturnTo(Character target, Vector3 origin, float delay)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			yield return (object)new WaitForSeconds(delay);
			if ((Object)(object)target != (Object)null)
			{
				Rpc.Send(target, "WarpPlayerRPC", origin, true);
			}
		}

		public static void DropHeld(Character target)
		{
			Rpc.Send(target, "DestroyHeldItemRpc");
		}

		public static void Kill(Character target)
		{
			Rpc.Send(target, "RPCA_Die");
		}

		public static void Petrify(Character target)
		{
			Rpc.Send(target, "RPC_PetrifyInstantly", false);
		}

		public static void Zombify(Character target)
		{
			Rpc.Send(target, "RPCA_Zombify");
		}
	}
	internal static class ChickenPranks
	{
		private sealed class Snapshot
		{
			public int ViewID;

			public bool Permitted;

			public float Hunger;
		}

		private const float HungerThreshold = 0.7f;

		private const float HungerTarget = 0.78f;

		private const float ReapplyInterval = 2f;

		private static readonly Dictionary<int, Snapshot> Snapshots = new Dictionary<int, Snapshot>();

		private static readonly HashSet<int> Targets = new HashSet<int>();

		private static bool _active;

		private static bool _suppressed;

		private static float _nextApply;

		public static bool IsActive => _active;

		public static int TargetCount => Targets.Count;

		public static void Activate(Character target)
		{
			if (!((Object)(object)target == (Object)null) && !((Object)(object)((MonoBehaviourPun)target).photonView == (Object)null))
			{
				if (_suppressed)
				{
					RestorePermissions(Snapshots.Values);
					Snapshots.Clear();
					_suppressed = false;
				}
				EnsureSnapshot(target);
				Targets.Add(((MonoBehaviourPun)target).photonView.ViewID);
				_active = true;
				Apply();
				_nextApply = Time.unscaledTime + 2f;
			}
		}

		public static void Cancel()
		{
			if (_active || _suppressed)
			{
				if (PhotonNetwork.IsMasterClient)
				{
					RestoreHunger();
					List<Snapshot> snapshots = new List<Snapshot>(Snapshots.Values);
					((MonoBehaviour)Plugin.Instance).StartCoroutine(RestorePermissionsLater(snapshots, 0.35f));
					Snapshots.Clear();
					Targets.Clear();
					_active = false;
					_suppressed = false;
				}
				else
				{
					SetAllPermissions(value: false);
					Targets.Clear();
					_active = false;
					_suppressed = true;
					_nextApply = Time.unscaledTime + 2f;
				}
			}
		}

		public static void Tick()
		{
			if (!PhotonNetwork.InRoom || LoadingScreenHandler.loading || Time.unscaledTime < _nextApply)
			{
				return;
			}
			if (_active)
			{
				_nextApply = Time.unscaledTime + 2f;
				Apply();
			}
			else
			{
				if (!_suppressed)
				{
					return;
				}
				_nextApply = Time.unscaledTime + 2f;
				foreach (Snapshot value in Snapshots.Values)
				{
					Character val = FindCharacter(value.ViewID);
					if (!((Object)(object)val?.refs?.afflictions == (Object)null) && val.refs.afflictions.GetCurrentStatus((STATUSTYPE)1) >= 0.7f)
					{
						return;
					}
				}
				RestorePermissions(Snapshots.Values);
				Snapshots.Clear();
				_suppressed = false;
			}
		}

		public static void Reset()
		{
			if (Snapshots.Count > 0)
			{
				RestorePermissions(Snapshots.Values);
			}
			Snapshots.Clear();
			Targets.Clear();
			_active = false;
			_suppressed = false;
			_nextApply = 0f;
		}

		private static void Apply()
		{
			foreach (Character item in PlayerRegistry.Players())
			{
				if (!((Object)(object)((MonoBehaviourPun)item).photonView == (Object)null) && !((Object)(object)item.refs?.afflictions == (Object)null))
				{
					EnsureSnapshot(item);
					bool value = Targets.Contains(((MonoBehaviourPun)item).photonView.ViewID);
					SetPermission(item, value);
					float currentStatus = item.refs.afflictions.GetCurrentStatus((STATUSTYPE)1);
					if (currentStatus < 0.7f)
					{
						StatusPranks.Apply(item, (STATUSTYPE)1, 0.78f - currentStatus);
					}
				}
			}
		}

		private static void EnsureSnapshot(Character player)
		{
			if ((Object)(object)((player != null) ? ((MonoBehaviourPun)player).photonView : null) == (Object)null)
			{
				return;
			}
			int viewID = ((MonoBehaviourPun)player).photonView.ViewID;
			if (!Snapshots.ContainsKey(viewID))
			{
				Dictionary<int, Snapshot> snapshots = Snapshots;
				Snapshot obj = new Snapshot
				{
					ViewID = viewID,
					Permitted = ((Object)(object)player.data != (Object)null && player.data.cannibalismPermitted)
				};
				CharacterRefs refs = player.refs;
				float? obj2;
				if (refs == null)
				{
					obj2 = null;
				}
				else
				{
					CharacterAfflictions afflictions = refs.afflictions;
					obj2 = ((afflictions != null) ? new float?(afflictions.GetCurrentStatus((STATUSTYPE)1)) : ((float?)null));
				}
				float? num = obj2;
				obj.Hunger = num.GetValueOrDefault();
				snapshots[viewID] = obj;
			}
		}

		private static void SetPermission(Character player, bool value)
		{
			PhotonView photonView = ((MonoBehaviourPun)player).photonView;
			if (photonView != null)
			{
				photonView.RPC("RPCA_SyncCanBeCannibalized", (RpcTarget)0, new object[1] { value });
			}
		}

		private static void SetAllPermissions(bool value)
		{
			foreach (Character item in PlayerRegistry.Players())
			{
				SetPermission(item, value);
			}
		}

		private static void RestoreHunger()
		{
			foreach (Snapshot value in Snapshots.Values)
			{
				Character val = FindCharacter(value.ViewID);
				if (!((Object)(object)((val != null) ? ((MonoBehaviourPun)val).photonView : null) == (Object)null) && !((Object)(object)val.refs?.afflictions == (Object)null))
				{
					float currentStatus = val.refs.afflictions.GetCurrentStatus((STATUSTYPE)1);
					float num = value.Hunger - currentStatus;
					if (!(Mathf.Abs(num) < 0.01f))
					{
						float[] array = new float[CharacterAfflictions.NumStatusTypes];
						array[1] = num;
						((MonoBehaviourPun)val).photonView.RPC("RPC_ApplyStatusesFromFloatArray", (RpcTarget)0, new object[1] { array });
					}
				}
			}
		}

		private static void RestorePermissions(IEnumerable<Snapshot> snapshots)
		{
			foreach (Snapshot snapshot in snapshots)
			{
				Character val = FindCharacter(snapshot.ViewID);
				if ((Object)(object)((val != null) ? ((MonoBehaviourPun)val).photonView : null) != (Object)null)
				{
					SetPermission(val, snapshot.Permitted);
				}
			}
		}

		private static IEnumerator RestorePermissionsLater(List<Snapshot> snapshots, float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			RestorePermissions(snapshots);
		}

		private static Character? FindCharacter(int viewID)
		{
			foreach (Character allCharacter in Character.AllCharacters)
			{
				if ((Object)(object)allCharacter != (Object)null && (Object)(object)((MonoBehaviourPun)allCharacter).photonView != (Object)null && ((MonoBehaviourPun)allCharacter).photonView.ViewID == viewID)
				{
					return allCharacter;
				}
			}
			return null;
		}
	}
	internal static class ItemPranks
	{
		private static readonly string[] FoodKeywords = new string[19]
		{
			"Banana", "Marshmallow", "Apple", "Coconut", "Mushroom", "Gorp", "Honey", "Berry", "Fish", "Cooked",
			"Egg", "Cactus", "Food", "Soup", "Tea", "EnergyDrink", "Chocolate", "Granola", "TrailMix"
		};

		private static readonly string[] BalloonKeywords = new string[1] { "Balloon" };

		private static readonly string[] ExplosiveKeywords = new string[7] { "Bomb", "Dynamite", "TNT", "Grenade", "Cannonball", "Explosive", "Barrel" };

		private static readonly string[] JetpackKeywords = new string[1] { "Jetpack" };

		private static List<string>? _itemNames;

		public static void RandomGift(Character target)
		{
			Spawn(target, null);
		}

		public static void Food(Character target)
		{
			Spawn(target, FoodKeywords);
		}

		public static void Balloon(Character target)
		{
			Spawn(target, BalloonKeywords);
		}

		public static void Explosive(Character target)
		{
			Spawn(target, ExplosiveKeywords);
		}

		public static void Jetpack(Character target)
		{
			Spawn(target, JetpackKeywords);
		}

		public static bool Give(Character target, string prefabName)
		{
			if (string.IsNullOrWhiteSpace(prefabName) || (Object)(object)target == (Object)null || (Object)(object)((MonoBehaviourPun)target).photonView == (Object)null)
			{
				return false;
			}
			if (!PhotonNetwork.InRoom)
			{
				Plugin.Log.LogInfo((object)"Cannot spawn an item outside of a Photon room.");
				return false;
			}
			try
			{
				((MonoBehaviourPun)target).photonView.RPC("RPC_SpawnItemInHandMaster", (RpcTarget)2, new object[1] { prefabName });
				return true;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Item spawn request failed for '" + prefabName + "': " + ex.Message));
				return false;
			}
		}

		public static bool ClearInventory(Character target)
		{
			if ((Object)(object)target == (Object)null || (Object)(object)((MonoBehaviourPun)target).photonView == (Object)null)
			{
				return false;
			}
			if (!PhotonNetwork.InRoom)
			{
				Plugin.Log.LogInfo((object)"Cannot clear an inventory outside of a Photon room.");
				return false;
			}
			Rpc.Send(target, "DestroyHeldItemRpc");
			Player player = target.player;
			PhotonView val = (((Object)(object)player != (Object)null) ? ((MonoBehaviourPun)player).photonView : ((MonoBehaviourPun)target).photonView);
			if ((Object)(object)val == (Object)null)
			{
				return false;
			}
			byte[] array = new byte[5] { 0, 1, 2, 3, 250 };
			foreach (byte b in array)
			{
				try
				{
					val.RPC("RPCRemoveItemFromSlot", (RpcTarget)2, new object[1] { b });
				}
				catch (Exception ex)
				{
					Plugin.Log.LogWarning((object)$"Could not clear inventory slot {b}: {ex.Message}");
				}
			}
			return true;
		}

		public static IReadOnlyList<string> ItemNames()
		{
			if (_itemNames != null)
			{
				return _itemNames;
			}
			List<string> names = new List<string>();
			HashSet<string> seen = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
			ItemDatabase instance;
			try
			{
				instance = SingletonAsset<ItemDatabase>.Instance;
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Item database is not available yet: " + ex.Message));
				return names;
			}
			if (instance?.itemLookup != null)
			{
				foreach (KeyValuePair<ushort, Item> item in instance.itemLookup)
				{
					AddName(item.Value);
				}
			}
			if (names.Count == 0 && ((DatabaseAsset<ItemDatabase, Item>)(object)instance)?.Objects != null)
			{
				foreach (Item @object in ((DatabaseAsset<ItemDatabase, Item>)(object)instance).Objects)
				{
					AddName(@object);
				}
			}
			names.Sort(StringComparer.OrdinalIgnoreCase);
			if (names.Count == 0)
			{
				return names;
			}
			_itemNames = names;
			return _itemNames;
			void AddName(Item? item)
			{
				if (!((Object)(object)item == (Object)null))
				{
					GameObject gameObject;
					try
					{
						gameObject = ((Component)item).gameObject;
					}
					catch
					{
						return;
					}
					string text = (((Object)(object)gameObject != (Object)null) ? ((Object)gameObject).name : string.Empty);
					if (!string.IsNullOrWhiteSpace(text) && seen.Add(text))
					{
						names.Add(text);
					}
				}
			}
		}

		private static void Spawn(Character target, string[]? keywords)
		{
			Item val = PickPrefab(keywords);
			if ((Object)(object)val == (Object)null)
			{
				Plugin.Log.LogInfo((object)((keywords == null) ? "No item prefabs found in the database." : "No item matched the requested category."));
				return;
			}
			if (!PhotonNetwork.InRoom || (Object)(object)((MonoBehaviourPun)target).photonView == (Object)null)
			{
				Plugin.Log.LogInfo((object)"Cannot spawn an item outside of a Photon room.");
				return;
			}
			string name = ((Object)((Component)val).gameObject).name;
			try
			{
				((MonoBehaviourPun)target).photonView.RPC("RPC_SpawnItemInHandMaster", (RpcTarget)2, new object[1] { name });
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Item spawn request failed for '" + name + "': " + ex.Message));
			}
		}

		private static Item? PickPrefab(string[]? keywords)
		{
			ItemDatabase instance = SingletonAsset<ItemDatabase>.Instance;
			if ((Object)(object)instance == (Object)null || instance.itemLookup == null)
			{
				return null;
			}
			List<Item> list = new List<Item>();
			List<Item> list2 = new List<Item>();
			foreach (KeyValuePair<ushort, Item> item in instance.itemLookup)
			{
				Item value = item.Value;
				if ((Object)(object)value == (Object)null || (Object)(object)((Component)value).gameObject == (Object)null)
				{
					continue;
				}
				list2.Add(value);
				if (keywords == null || keywords.Length == 0)
				{
					continue;
				}
				string name = ((Object)((Component)value).gameObject).name;
				foreach (string value2 in keywords)
				{
					if (name.IndexOf(value2, StringComparison.OrdinalIgnoreCase) >= 0)
					{
						list.Add(value);
						break;
					}
				}
			}
			if (keywords != null && keywords.Length != 0)
			{
				if (list.Count != 0)
				{
					return list[Random.Range(0, list.Count)];
				}
				return null;
			}
			if (list2.Count != 0)
			{
				return list2[Random.Range(0, list2.Count)];
			}
			return null;
		}
	}
	internal static class Rpc
	{
		public static bool Send(Character target, string method, params object[] args)
		{
			if ((Object)(object)target == (Object)null)
			{
				return false;
			}
			PhotonView photonView = ((MonoBehaviourPun)target).photonView;
			if ((Object)(object)photonView == (Object)null)
			{
				return false;
			}
			photonView.RPC(method, (RpcTarget)0, args);
			return true;
		}
	}
	internal static class PrankMath
	{
		public static float Scale(float amount, float min, float max)
		{
			return Mathf.Lerp(min, max, Mathf.Clamp01(amount));
		}

		public static Vector3 StandingPoint(Character character)
		{
			//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_0010: 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)
			return character.Center + Vector3.up * 0.9f;
		}
	}
	internal static class ScoutmasterPranks
	{
		public static void Hunt(Character target, float amount)
		{
			Scoutmaster val = default(Scoutmaster);
			if (Scoutmaster.GetPrimaryScoutmaster(ref val) && !((Object)(object)val == (Object)null))
			{
				PhotonView component = ((Component)val).GetComponent<PhotonView>();
				if (!((Object)(object)component == (Object)null))
				{
					float num = PrankMath.Scale(amount, 30f, 180f);
					component.RPC("RPCA_SetCurrentTarget", (RpcTarget)0, new object[2]
					{
						((MonoBehaviourPun)target).photonView.ViewID,
						num
					});
				}
			}
		}

		public static void CallOff(Character target, float amount)
		{
			Scoutmaster val = default(Scoutmaster);
			if (Scoutmaster.GetPrimaryScoutmaster(ref val) && !((Object)(object)val == (Object)null))
			{
				PhotonView component = ((Component)val).GetComponent<PhotonView>();
				if (component != null)
				{
					component.RPC("RPCA_SetCurrentTarget", (RpcTarget)0, new object[2] { -1, 0f });
				}
			}
		}
	}
	internal enum SpawnSide
	{
		Front,
		Behind,
		Left,
		Right
	}
	internal static class SpawnPranks
	{
		private const string ScoutmasterPrefab = "Character_Scoutmaster";

		private const string ZombiePrefab = "MushroomZombie";

		private static readonly List<PhotonView> Spawned = new List<PhotonView>();

		public static int Count
		{
			get
			{
				Spawned.RemoveAll((PhotonView view) => (Object)(object)view == (Object)null);
				return Spawned.Count;
			}
		}

		public static int Scoutmaster(IReadOnlyList<Character> targets, SpawnSide side, float distance, bool live)
		{
			//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_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_0039: 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_0048: 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_0051: 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)
			int num = 0;
			foreach (Character target in targets)
			{
				if ((Object)(object)((target != null) ? ((MonoBehaviourPun)target).photonView : null) == (Object)null)
				{
					continue;
				}
				Vector3 val = SideDirection(target, side);
				Vector3 val2 = GroundPoint(target.Center + val * distance);
				PhotonView val3 = Spawn("Character_Scoutmaster", val2, Facing(val2, target));
				if (!((Object)(object)val3 == (Object)null))
				{
					if (live)
					{
						((MonoBehaviour)Plugin.Instance).StartCoroutine(ScoutmasterChase(val3, target, 0.25f));
					}
					else
					{
						((MonoBehaviour)Plugin.Instance).StartCoroutine(ScoutmasterFreeze(val3, 0.25f));
					}
					num++;
				}
			}
			return num;
		}

		public static int Zombies(IReadOnlyList<Character> targets, int count, float radius, bool live)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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)
			//IL_0040: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			foreach (Character target in targets)
			{
				if ((Object)(object)((target != null) ? ((MonoBehaviourPun)target).photonView : null) == (Object)null)
				{
					continue;
				}
				for (int i = 0; i < Mathf.Max(1, count); i++)
				{
					Vector3 val = GroundPoint(RandomAround(target, radius));
					PhotonView val2 = Spawn("MushroomZombie", val, Facing(val, target));
					if (!((Object)(object)val2 == (Object)null))
					{
						if (live)
						{
							((MonoBehaviour)Plugin.Instance).StartCoroutine(ZombieChase(val2, target, 0.35f));
						}
						else
						{
							((MonoBehaviour)Plugin.Instance).StartCoroutine(ZombieFreeze(val2, 0.35f));
						}
						num++;
					}
				}
			}
			return num;
		}

		public static int Skeletons(IReadOnlyList<Character> targets, int count, float radius)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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)
			//IL_0040: 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_0045: Unknown result type (might be due to invalid IL or missing references)
			int num = 0;
			foreach (Character target in targets)
			{
				if ((Object)(object)((target != null) ? ((MonoBehaviourPun)target).photonView : null) == (Object)null)
				{
					continue;
				}
				for (int i = 0; i < Mathf.Max(1, count); i++)
				{
					Vector3 val = GroundPoint(RandomAround(target, radius));
					PhotonView val2 = Spawn("MushroomZombie", val, Facing(val, target));
					if (!((Object)(object)val2 == (Object)null))
					{
						MushroomZombie component = ((Component)val2).GetComponent<MushroomZombie>();
						if (component != null)
						{
							component.HideAllRenderers();
						}
						((MonoBehaviour)Plugin.Instance).StartCoroutine(SkeletonFromZombie(val2, 0.2f));
						num++;
					}
				}
			}
			return num;
		}

		public static int ClearAll()
		{
			int num = 0;
			foreach (PhotonView item in Spawned)
			{
				if (!((Object)(object)item == (Object)null) && item.IsMine)
				{
					PhotonNetwork.Destroy(((Component)item).gameObject);
					num++;
				}
			}
			Spawned.Clear();
			return num;
		}

		public static void ForgetAll()
		{
			Spawned.Clear();
		}

		private static PhotonView? Spawn(string prefabName, Vector3 position, Quaternion rotation)
		{
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (!PhotonNetwork.InRoom)
			{
				Plugin.Log.LogInfo((object)("Cannot spawn '" + prefabName + "' outside of a Photon room."));
				return null;
			}
			try
			{
				GameObject val = PhotonNetwork.Instantiate(prefabName, position, rotation, (byte)0, (object[])null);
				PhotonView val2 = (((Object)(object)val != (Object)null) ? val.GetComponent<PhotonView>() : null);
				if ((Object)(object)val2 != (Object)null)
				{
					Spawned.Add(val2);
				}
				else
				{
					Plugin.Log.LogWarning((object)("Spawned '" + prefabName + "' without a PhotonView."));
				}
				return val2;
			}
			catch (Exception arg)
			{
				Plugin.Log.LogWarning((object)$"Could not spawn '{prefabName}' at {position}: {arg}");
				return null;
			}
		}

		private static IEnumerator ScoutmasterChase(PhotonView view, Character target, float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			if (!((Object)(object)view == (Object)null))
			{
				if (!((Object)(object)((target != null) ? ((MonoBehaviourPun)target).photonView : null) == (Object)null))
				{
					view.RPC("RPCA_SetCurrentTarget", (RpcTarget)0, new object[2]
					{
						((MonoBehaviourPun)target).photonView.ViewID,
						3600f
					});
				}
			}
		}

		private static IEnumerator ScoutmasterFreeze(PhotonView view, float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			if ((Object)(object)view == (Object)null)
			{
				yield break;
			}
			Scoutmaster component = ((Component)view).GetComponent<Scoutmaster>();
			if ((Object)(object)component == (Object)null)
			{
				yield break;
			}
			((Behaviour)component).enabled = false;
			Character component2 = ((Component)view).GetComponent<Character>();
			if (component2 != null)
			{
				CharacterInput input = component2.input;
				if (input != null)
				{
					input.ResetInput();
				}
			}
		}

		private static IEnumerator ZombieChase(PhotonView view, Character target, float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			if ((Object)(object)view == (Object)null)
			{
				yield break;
			}
			if (!((Object)(object)((target != null) ? ((MonoBehaviourPun)target).photonView : null) == (Object)null))
			{
				MushroomZombie component = ((Component)view).GetComponent<MushroomZombie>();
				if (!((Object)(object)component == (Object)null))
				{
					Wake(component);
					view.RPC("RPCA_SetCurrentTarget", (RpcTarget)0, new object[2]
					{
						((MonoBehaviourPun)target).photonView.ViewID,
						3600f
					});
					component.currentState = (State)3;
					view.RPC("RPC_SyncState", (RpcTarget)0, new object[4] { 3, false, 0f, false });
				}
			}
		}

		private static IEnumerator ZombieFreeze(PhotonView view, float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			if ((Object)(object)view == (Object)null)
			{
				yield break;
			}
			MushroomZombie component = ((Component)view).GetComponent<MushroomZombie>();
			if (!((Object)(object)component == (Object)null))
			{
				Wake(component);
				component.currentState = (State)2;
				view.RPC("RPC_SyncState", (RpcTarget)0, new object[4] { 2, false, 0f, false });
				((Behaviour)component).enabled = false;
				CharacterInput input = component.character.input;
				if (input != null)
				{
					input.ResetInput();
				}
			}
		}

		private static IEnumerator SkeletonFromZombie(PhotonView view, float delay)
		{
			yield return (object)new WaitForSeconds(delay);
			if ((Object)(object)view != (Object)null)
			{
				view.RPC("RPC_SpawnSkelly", (RpcTarget)0, Array.Empty<object>());
			}
			yield return (object)new WaitForSeconds(0.2f);
			if ((Object)(object)view != (Object)null && view.IsMine)
			{
				PhotonNetwork.Destroy(((Component)view).gameObject);
			}
		}

		private static void Wake(MushroomZombie zombie)
		{
			zombie.WakeUpFromSleep();
			Character character = zombie.character;
			character.data.passedOut = false;
			character.data.fullyPassedOut = false;
			character.data.fallSeconds = 0f;
			character.data.currentRagdollControll = 1f;
		}

		private static Vector3 SideDirection(Character target, SpawnSide side)
		{
			//IL_0006: 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_0010: 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_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)
			//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_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_0053: 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_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: 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_006a: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = Vector3.ProjectOnPlane(((Component)target).transform.forward, Vector3.up);
			if (((Vector3)(ref val)).sqrMagnitude < 0.01f)
			{
				val = Vector3.forward;
			}
			((Vector3)(ref val)).Normalize();
			Vector3 val2 = Vector3.Cross(Vector3.up, val);
			return (Vector3)(side switch
			{
				SpawnSide.Behind => -val, 
				SpawnSide.Left => -val2, 
				SpawnSide.Right => val2, 
				_ => val, 
			});
		}

		private static Vector3 RandomAround(Character target, float radius)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0010: 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_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: 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)
			Vector2 val = Random.insideUnitCircle * Mathf.Max(0.5f, radius);
			return target.Center + new Vector3(val.x, 0f, val.y);
		}

		private static Vector3 GroundPoint(Vector3 near)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0001: 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_0010: 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_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0023: 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_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_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			Vector3 val = near + Vector3.up * 25f;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, Vector3.down, ref val2, 60f, LayerMask.op_Implicit(HelperFunctions.terrainMapMask), (QueryTriggerInteraction)1))
			{
				return ((RaycastHit)(ref val2)).point + Vector3.up * 0.15f;
			}
			return near;
		}

		private static Quaternion Facing(Vector3 from, Character target)
		{
			//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_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_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: 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)
			Vector3 val = target.Center - from;
			val.y = 0f;
			if (!(((Vector3)(ref val)).sqrMagnitude > 0.001f))
			{
				return Quaternion.identity;
			}
			return Quaternion.LookRotation(((Vector3)(ref val)).normalized);
		}
	}
	internal static class StatusPranks
	{
		private static readonly STATUSTYPE[] ChaosPool;

		public static float RestoreFraction { get; set; }

		public static void Apply(Character target, STATUSTYPE type, float amount)
		{
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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)
			if (!(amount <= 0f))
			{
				if (target.IsLocal)
				{
					target.refs.afflictions.AddStatus(type, amount, false, true, true, false, false);
					return;
				}
				if (PhotonNetwork.IsMasterClient)
				{
					ApplyFromMaster(target, type, amount);
					return;
				}
				Pin(target, type, amount);
				Rpc.Send(target, "RPCA_Unstick");
			}
		}

		private static void ApplyFromMaster(Character target, STATUSTYPE type, float amount)
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			float[] array = new float[CharacterAfflictions.NumStatusTypes];
			array[type] = amount;
			((MonoBehaviourPun)target).photonView.RPC("RPC_ApplyStatusesFromFloatArray", (RpcTarget)0, new object[1] { array });
		}

		private static void Pin(Character target, STATUSTYPE type, float amount)
		{
			//IL_0020: 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_004f: 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_0061: 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)
			Bodypart bodypart = target.GetBodypart((BodypartType)2);
			Vector3 val = (((Object)(object)bodypart != (Object)null && (Object)(object)bodypart.Rig != (Object)null) ? ((Component)bodypart.Rig).transform.position : target.Center);
			Rpc.Send(target, "RPCA_Stick", (object)(BodypartType)2, val, val, type, amount);
		}

		public static void Chaos(Character target, float amount)
		{
			//IL_0025: 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_0030: 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)
			int num = Random.Range(2, 5);
			List<STATUSTYPE> list = new List<STATUSTYPE>();
			for (int i = 0; i < num; i++)
			{
				STATUSTYPE val = ChaosPool[Random.Range(0, ChaosPool.Length)];
				if (!list.Contains(val))
				{
					list.Add(val);
					Apply(target, val, Mathf.Clamp(amount * Random.Range(0.5f, 1f), 0.05f, 1f));
				}
			}
		}

		public static void Mercy(Character target, float amount)
		{
			//IL_0049: 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_0051: Invalid comparison between Unknown and I4
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			Rpc.Send(target, "RPCA_UnPassOut");
			if (!PhotonNetwork.IsMasterClient)
			{
				return;
			}
			float num = Mathf.Clamp01(RestoreFraction);
			if (num <= 0f)
			{
				return;
			}
			CharacterAfflictions afflictions = target.refs.afflictions;
			float[] array = new float[CharacterAfflictions.NumStatusTypes];
			for (int i = 0; i < array.Length; i++)
			{
				STATUSTYPE val = (STATUSTYPE)i;
				array[i] = (((int)val == 13) ? 0f : ((0f - afflictions.GetCurrentStatus(val)) * num));
			}
			try
			{
				((MonoBehaviourPun)target).photonView.RPC("RPC_ApplyStatusesFromFloatArray", (RpcTarget)0, new object[1] { array });
			}
			catch (Exception ex)
			{
				Plugin.Log.LogWarning((object)("Could not clear statuses: " + ex.Message));
			}
		}

		public static void Glue(Character target)
		{
			Pin(target, (STATUSTYPE)11, 0f);
		}

		public static void Unstick(Character target)
		{
			Rpc.Send(target, "RPCA_Unstick");
		}

		static StatusPranks()
		{
			STATUSTYPE[] array = new STATUSTYPE[7];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			ChaosPool = (STATUSTYPE[])(object)array;
			RestoreFraction = 1f;
		}
	}
}
namespace IsntItReallyFunHuh.Patches
{
	[HarmonyPatch(typeof(CharacterInput), "Sample")]
	internal static class InputBlockPatch
	{
		[HarmonyPostfix]
		private static void Postfix(CharacterInput __instance)
		{
			if (Plugin.Window.BlocksInput && Plugin.Settings.BlockGameplayInput.Value)
			{
				Character localCharacter = Character.localCharacter;
				if (!((Object)(object)localCharacter == (Object)null) && !((Object)(object)localCharacter.input != (Object)(object)__instance))
				{
					__instance.ResetInput();
					__instance.pauseWasPressed = false;
				}
			}
		}
	}
	[HarmonyPatch(typeof(CursorHandler), "Update")]
	internal static class CursorPatch
	{
		[HarmonyPrefix]
		private static bool Prefix()
		{
			if (FunWindow.IsOpen)
			{
				Cursor.visible = true;
				Cursor.lockState = (CursorLockMode)0;
				return false;
			}
			return true;
		}
	}
	[HarmonyPatch(typeof(GUIManager), "UpdatePaused")]
	internal static class PauseBlockPatch
	{
		[HarmonyPrefix]
		private static bool Prefix()
		{
			return !Plugin.Window.BlocksInput;
		}
	}
}
namespace IsntItReallyFunHuh.Localization
{
	internal static class Loc
	{
		private static readonly Dictionary<string, string> English = new Dictionary<string, string>
		{
			["window.title"] = "Isn't it really fun, huh?",
			["window.subtitle"] = "A completely fair and balanced team experience",
			["window.targets"] = "Targets",
			["window.target.all_but_me"] = "All but me",
			["window.target.everyone"] = "Everyone",
			["window.target.pick"] = "Pick",
			["window.target.aim"] = "In front",
			["window.target.none"] = "No targets selected",
			["window.target.aim_none"] = "Look at a scout first",
			["window.target.count"] = "{0} selected",
			["window.amount"] = "Amount",
			["window.close_hint"] = "{0} closes the menu",
			["window.log"] = "Recent mischief",
			["window.empty"] = "No scouts in the lobby yet.",
			["window.you"] = " (you)",
			["window.dead"] = " (down)",
			["tab.status"] = "Statuses",
			["tab.prank"] = "Pranks",
			["tab.item"] = "Items",
			["tab.spawn"] = "Spawns",
			["tab.director"] = "Director",
			["prank.poison"] = "Poison",
			["prank.poison.hint"] = "A classic. Slowly d