Decompiled source of TrollPack v1.0.3

TrollPack.dll

Decompiled 4 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using ExitGames.Client.Photon;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using Photon.Realtime;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("TrollPack")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("TrollPack")]
[assembly: AssemblyTitle("TrollPack")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace TrollPack
{
	internal enum Fx
	{
		CameraShake = 1,
		CameraSpin = 2,
		CameraGlitch = 3,
		SlowZoom = 4,
		LookDrift = 5,
		ScreenDark = 6,
		Flashbang = 7,
		InvertedControls = 8,
		InputStutter = 9,
		ForcedTumble = 10,
		FlashlightFlicker = 11,
		FlashlightBlackout = 12,
		VoiceChipmunk = 13,
		VoiceDemon = 14,
		FakeDamage = 17,
		GlowingEyes = 19,
		Heartbeat = 20,
		LeftBehind = 21,
		LowStamina = 22
	}
	internal class FxInfo
	{
		public Fx Id;

		public string Name;

		public bool Experimental;

		public bool UsesDuration;

		public FxInfo(Fx id, string name, bool experimental, bool usesDuration)
		{
			Id = id;
			Name = name;
			Experimental = experimental;
			UsesDuration = usesDuration;
		}
	}
	internal class Target
	{
		public string Name;

		public int Actor;

		public bool Everyone;

		public bool Self;

		public int Key
		{
			get
			{
				if (!Everyone)
				{
					if (!Self)
					{
						return Actor;
					}
					return -2;
				}
				return -1;
			}
		}
	}
	[DefaultExecutionOrder(-32000)]
	[BepInPlugin("operation.trollpack", "TrollPack", "1.0.3")]
	public class Plugin : BaseUnityPlugin, IOnEventCallback
	{
		private class Hal
		{
			public int Kind;

			public float Start;

			public float Life;

			public float Seed;

			public Rect Norm;
		}

		private const byte EventCode = 175;

		private const float FlashDuration = 4f;

		private static readonly FxInfo[] Infos = new FxInfo[19]
		{
			new FxInfo(Fx.CameraShake, "Camera shake", experimental: false, usesDuration: true),
			new FxInfo(Fx.CameraSpin, "Camera spin", experimental: true, usesDuration: true),
			new FxInfo(Fx.CameraGlitch, "Camera glitch", experimental: false, usesDuration: true),
			new FxInfo(Fx.SlowZoom, "Slow zoom", experimental: true, usesDuration: true),
			new FxInfo(Fx.LookDrift, "Look drift", experimental: true, usesDuration: true),
			new FxInfo(Fx.ScreenDark, "Screen goes dark", experimental: false, usesDuration: true),
			new FxInfo(Fx.Flashbang, "Fake flashbang", experimental: false, usesDuration: false),
			new FxInfo(Fx.InvertedControls, "Inverted controls", experimental: false, usesDuration: true),
			new FxInfo(Fx.InputStutter, "Input stutter", experimental: true, usesDuration: true),
			new FxInfo(Fx.ForcedTumble, "Forced tumble", experimental: true, usesDuration: true),
			new FxInfo(Fx.FlashlightFlicker, "Flashlight flicker", experimental: true, usesDuration: true),
			new FxInfo(Fx.FlashlightBlackout, "Flashlight blackout", experimental: true, usesDuration: true),
			new FxInfo(Fx.VoiceChipmunk, "Chipmunk voice", experimental: true, usesDuration: true),
			new FxInfo(Fx.VoiceDemon, "Demon voice", experimental: true, usesDuration: true),
			new FxInfo(Fx.FakeDamage, "Fake damage", experimental: false, usesDuration: false),
			new FxInfo(Fx.GlowingEyes, "Glowing eyes", experimental: false, usesDuration: true),
			new FxInfo(Fx.Heartbeat, "Heartbeat panic", experimental: false, usesDuration: true),
			new FxInfo(Fx.LeftBehind, "Left behind", experimental: true, usesDuration: true),
			new FxInfo(Fx.LowStamina, "Low stamina", experimental: true, usesDuration: true)
		};

		internal static ConfigEntry<KeyCode> MenuKey;

		internal static ConfigEntry<bool> AllowIncoming;

		internal static ConfigEntry<float> Cooldown;

		internal static ConfigEntry<float> MaxIncomingDuration;

		internal static ConfigEntry<float> SoundVolume;

		internal static ConfigEntry<float> DriftStrength;

		internal static ConfigEntry<bool> InvertLookToo;

		internal static float InvertUntil = -1000f;

		internal static float StutterUntil = -1000f;

		internal static float DriftUntil = -1000f;

		internal static float DriftBias;

		internal static bool StutterBlocked;

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

		private static Plugin instance;

		private float darkStart = -1000f;

		private float darkUntil = -1000f;

		private float flashStart = -1000f;

		private float spinStart = -1000f;

		private float spinEnd = -1000f;

		private float flickerUntil = -1000f;

		private float blackoutUntil = -1000f;

		private float nextStutterToggle;

		private float nextFlickerToggle;

		private bool flickerOn = true;

		private bool lightTouched;

		private bool lightOriginal;

		private readonly Dictionary<Fx, Coroutine> running = new Dictionary<Fx, Coroutine>();

		private readonly Dictionary<int, float> lastIncoming = new Dictionary<int, float>();

		private Transform rolledCam;

		private Quaternion rolledOriginal;

		private bool menuOpen;

		private float lastToggle = -1000f;

		private float nextSend;

		private bool legacyInputBroken;

		private Rect winRect = new Rect(40f, 40f, 590f, 10f);

		private float chosenDuration = 8f;

		private int selTarget;

		private int selKey = -1;

		private float nextTargetRefresh;

		private List<Target> targets = new List<Target>();

		private string[] targetNames = new string[0];

		private string status = "";

		private CursorLockMode prevLock;

		private bool prevVisible;

		private Object cachedShake;

		private float isolateUntil = -1000f;

		private float nextIsoScan;

		private bool isoActive;

		private float lowStaminaUntil = -1000f;

		private readonly Dictionary<Renderer, bool> isoRenderers = new Dictionary<Renderer, bool>();

		private readonly Dictionary<Light, bool> isoLights = new Dictionary<Light, bool>();

		private readonly List<Object> isoAvatars = new List<Object>();

		private readonly List<Hal> hals = new List<Hal>();

		private Texture2D eyesTex;

		private Texture2D vignetteTex;

		private float heartStart = -1000f;

		private float heartEnd = -1000f;

		private float heartBeat = -1000f;

		internal static float Now => Time.unscaledTime;

		internal static void LogOnce(string key, string message)
		{
			if (!((Object)(object)instance == (Object)null) && Logged.Add(key))
			{
				((BaseUnityPlugin)instance).Logger.LogWarning((object)message);
			}
		}

		private void Awake()
		{
			instance = this;
			((Object)((Component)this).gameObject).hideFlags = (HideFlags)61;
			MenuKey = ((BaseUnityPlugin)this).Config.Bind<KeyCode>("General", "MenuKey", (KeyCode)289, "Key that opens or closes the TrollPack menu.");
			AllowIncoming = ((BaseUnityPlugin)this).Config.Bind<bool>("General", "AllowOthersToTrollMe", true, "If false, effects sent by other players are ignored on your game.");
			Cooldown = ((BaseUnityPlugin)this).Config.Bind<float>("General", "SendCooldownSeconds", 1.5f, "Minimum time between effects you send.");
			MaxIncomingDuration = ((BaseUnityPlugin)this).Config.Bind<float>("General", "MaxIncomingDurationSeconds", 30f, "Longest an incoming effect is allowed to last.");
			SoundVolume = ((BaseUnityPlugin)this).Config.Bind<float>("General", "SoundVolume", 0.8f, "Volume of the generated sounds, 0 to 1.");
			DriftStrength = ((BaseUnityPlugin)this).Config.Bind<float>("Tuning", "LookDriftStrength", 0.35f, "How hard the look drift pulls the view sideways.");
			InvertLookToo = ((BaseUnityPlugin)this).Config.Bind<bool>("Tuning", "InvertedControlsAlsoInvertLook", true, "If true, inverted controls also invert mouse look.");
			PatchInput();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"TrollPack loaded.");
		}

		private void OnEnable()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			PhotonNetwork.AddCallbackTarget((object)this);
			Camera.onPreCull = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(OnCamPreCull));
			Camera.onPostRender = (CameraCallback)Delegate.Combine((Delegate?)(object)Camera.onPostRender, (Delegate?)new CameraCallback(OnCamPostRender));
		}

		private void OnDisable()
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Expected O, but got Unknown
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Expected O, but got Unknown
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Expected O, but got Unknown
			PhotonNetwork.RemoveCallbackTarget((object)this);
			Camera.onPreCull = (CameraCallback)Delegate.Remove((Delegate?)(object)Camera.onPreCull, (Delegate?)new CameraCallback(OnCamPreCull));
			Camera.onPostRender = (CameraCallback)Delegate.Remove((Delegate?)(object)Camera.onPostRender, (Delegate?)new CameraCallback(OnCamPostRender));
			RevertRoll();
		}

		private void PatchInput()
		{
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Expected O, but got Unknown
			try
			{
				Type type = Reflect.FindType("InputManager");
				if (type == null)
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)"InputManager not found, input effects disabled.");
					return;
				}
				Harmony h = new Harmony("operation.trollpack");
				PatchOne(h, type, "GetMovementX", "PostMove");
				PatchOne(h, type, "GetMovementY", "PostMove");
				PatchOne(h, type, "GetMouseX", "PostMouseX");
				PatchOne(h, type, "GetMouseY", "PostMouseY");
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Input patching failed: " + ex.Message));
			}
		}

		private void PatchOne(Harmony h, Type t, string target, string postfix)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0059: Expected O, but got Unknown
			try
			{
				MethodBase methodBase = AccessTools.Method(t, target, (Type[])null, (Type[])null);
				MethodInfo method = typeof(Plugin).GetMethod(postfix, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				if (methodBase == null || method == null)
				{
					((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not patch " + target));
				}
				else
				{
					h.Patch(methodBase, (HarmonyMethod)null, new HarmonyMethod(method), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				}
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Could not patch " + target + ": " + ex.Message));
			}
		}

		private static void PostMove(ref float __result)
		{
			float now = Now;
			if (now < InvertUntil)
			{
				__result = 0f - __result;
			}
			if (now < StutterUntil && StutterBlocked)
			{
				__result = 0f;
			}
		}

		private static void PostMouseX(ref float __result)
		{
			float now = Now;
			if (now < InvertUntil && InvertLookToo != null && InvertLookToo.Value)
			{
				__result = 0f - __result;
			}
			if (now < DriftUntil)
			{
				__result += DriftBias;
			}
		}

		private static void PostMouseY(ref float __result)
		{
			if (Now < InvertUntil && InvertLookToo != null && InvertLookToo.Value)
			{
				__result = 0f - __result;
			}
		}

		private float CurrentRoll()
		{
			float now = Now;
			if (now >= spinEnd)
			{
				return 0f;
			}
			return Mathf.Repeat(90f * (now - spinStart), 360f);
		}

		private void OnCamPreCull(Camera cam)
		{
			//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_0056: 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)
			if (!((Object)(object)cam == (Object)null) && !((Object)(object)cam != (Object)(object)Camera.main))
			{
				ApplyIsolationHide();
				float num = CurrentRoll();
				if (!(Mathf.Abs(num) < 0.01f))
				{
					rolledCam = ((Component)cam).transform;
					rolledOriginal = ((Component)cam).transform.rotation;
					((Component)cam).transform.rotation = rolledOriginal * Quaternion.Euler(0f, 0f, num);
				}
			}
		}

		private void OnCamPostRender(Camera cam)
		{
			if ((Object)(object)rolledCam != (Object)null && (Object)(object)cam != (Object)null && (Object)(object)((Component)cam).transform == (Object)(object)rolledCam)
			{
				RevertRoll();
			}
		}

		private void RevertRoll()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)rolledCam != (Object)null)
			{
				rolledCam.rotation = rolledOriginal;
			}
			rolledCam = null;
		}

		private void Update()
		{
			//IL_0013: Unknown result type (might be due to invalid IL or missing references)
			RevertRoll();
			if (!legacyInputBroken)
			{
				try
				{
					if (Input.GetKeyDown(MenuKey.Value))
					{
						ToggleMenu();
					}
					if (menuOpen && Input.GetKeyDown((KeyCode)27))
					{
						SetMenu(open: false);
					}
				}
				catch (Exception)
				{
					legacyInputBroken = true;
				}
			}
			if (menuOpen)
			{
				object target = Reflect.StaticField("InputManager", "instance");
				Reflect.Call(target, "DisableMovement", 0.15f);
				Reflect.Call(target, "DisableAiming", 0.15f);
			}
			float now = Now;
			if (now < StutterUntil)
			{
				if (now >= nextStutterToggle)
				{
					StutterBlocked = !StutterBlocked;
					nextStutterToggle = now + (StutterBlocked ? Random.Range(0.2f, 0.5f) : Random.Range(0.4f, 1f));
				}
			}
			else
			{
				StutterBlocked = false;
			}
			if (now < flickerUntil && now >= nextFlickerToggle)
			{
				flickerOn = !flickerOn;
				nextFlickerToggle = now + Random.Range(0.05f, 0.25f);
			}
		}

		private void LateUpdate()
		{
			if (menuOpen)
			{
				Cursor.lockState = (CursorLockMode)0;
				Cursor.visible = true;
			}
			float now = Now;
			IsolationTick(now);
			if (now < lowStaminaUntil)
			{
				object o = Reflect.StaticField("PlayerController", "instance");
				object obj = Reflect.Field(o, "EnergyCurrent");
				if (obj is float && (float)obj > 4f)
				{
					Reflect.SetField(o, "EnergyCurrent", 4f);
				}
			}
			bool flag = now < blackoutUntil;
			bool flag2 = now < flickerUntil;
			if (flag || flag2)
			{
				Light flashlight = GetFlashlight();
				if ((Object)(object)flashlight != (Object)null)
				{
					if (!lightTouched)
					{
						lightOriginal = ((Behaviour)flashlight).enabled;
						lightTouched = true;
					}
					((Behaviour)flashlight).enabled = !flag && flickerOn;
				}
			}
			else if (lightTouched)
			{
				Light flashlight2 = GetFlashlight();
				if ((Object)(object)flashlight2 != (Object)null)
				{
					((Behaviour)flashlight2).enabled = lightOriginal;
				}
				lightTouched = false;
			}
		}

		private Light GetFlashlight()
		{
			object obj = Reflect.Field(Reflect.Field(Reflect.StaticField("PlayerAvatar", "instance"), "flashlightController"), "spotlight");
			return (Light)((obj is Light) ? obj : null);
		}

		public void OnEvent(EventData photonEvent)
		{
			if (photonEvent == null || photonEvent.Code != 175 || !AllowIncoming.Value || !(photonEvent.CustomData is int[] array) || array.Length < 2)
			{
				return;
			}
			int num = array[0];
			if (Enum.IsDefined(typeof(Fx), num))
			{
				float now = Now;
				if (!lastIncoming.TryGetValue(num, out var value) || !(now < value + 0.4f))
				{
					lastIncoming[num] = now;
					float dur = Mathf.Clamp((float)array[1] / 1000f, 1f, Mathf.Max(1f, MaxIncomingDuration.Value));
					Apply((Fx)num, dur);
				}
			}
		}

		private void Send(FxInfo info, Target tgt)
		{
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a9: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			if (Now < nextSend)
			{
				return;
			}
			nextSend = Now + Mathf.Max(0.2f, Cooldown.Value);
			float num = (info.UsesDuration ? chosenDuration : 1f);
			if (tgt.Self)
			{
				Apply(info.Id, num);
				status = "Ran " + info.Name + " on yourself.";
				return;
			}
			if (!PhotonNetwork.InRoom)
			{
				status = "Not in a room. Pick 'Me (test)' to try effects solo.";
				return;
			}
			int[] array = new int[2]
			{
				(int)info.Id,
				(int)(num * 1000f)
			};
			RaiseEventOptions val = new RaiseEventOptions();
			if (tgt.Everyone)
			{
				val.Receivers = (ReceiverGroup)0;
			}
			else
			{
				val.TargetActors = new int[1] { tgt.Actor };
			}
			PhotonNetwork.RaiseEvent((byte)175, (object)array, val, SendOptions.SendReliable);
			status = "Sent " + info.Name + " to " + tgt.Name + ".";
		}

		private void Run(Fx fx, IEnumerator routine)
		{
			if (running.TryGetValue(fx, out var value) && value != null)
			{
				((MonoBehaviour)this).StopCoroutine(value);
			}
			running[fx] = ((MonoBehaviour)this).StartCoroutine(routine);
		}

		internal void Apply(Fx fx, float dur)
		{
			try
			{
				float now = Now;
				switch (fx)
				{
				case Fx.CameraShake:
					Run(fx, ShakeRoutine(dur));
					break;
				case Fx.CameraSpin:
					spinStart = now;
					spinEnd = now + Mathf.Ceil(dur / 4f) * 4f;
					break;
				case Fx.CameraGlitch:
					Run(fx, GlitchRoutine(dur));
					break;
				case Fx.SlowZoom:
					Reflect.Call(Reflect.StaticField("CameraZoom", "Instance"), "OverrideZoomSet", 35f, dur, 0.3f, 1.5f, ((Component)this).gameObject, 0);
					break;
				case Fx.LookDrift:
					DriftUntil = now + dur;
					DriftBias = ((Random.value < 0.5f) ? (-1f) : 1f) * DriftStrength.Value;
					break;
				case Fx.ScreenDark:
					darkStart = now;
					darkUntil = now + dur;
					break;
				case Fx.Flashbang:
					flashStart = now;
					Run(fx, FlashSoundRoutine());
					break;
				case Fx.InvertedControls:
					InvertUntil = now + dur;
					break;
				case Fx.InputStutter:
					StutterUntil = now + dur;
					break;
				case Fx.ForcedTumble:
					Run(fx, TumbleRoutine(Mathf.Min(dur, 4f)));
					break;
				case Fx.FlashlightFlicker:
					flickerUntil = now + dur;
					Reflect.Call(Reflect.StaticField("PlayerAvatar", "instance"), "FlashlightFlicker", 1f);
					break;
				case Fx.FlashlightBlackout:
					blackoutUntil = now + dur;
					break;
				case Fx.VoiceChipmunk:
					Reflect.Call(Reflect.StaticField("PlayerController", "instance"), "OverrideVoicePitch", 1.9f, 0.4f, 0.4f, dur);
					break;
				case Fx.VoiceDemon:
					Reflect.Call(Reflect.StaticField("PlayerController", "instance"), "OverrideVoicePitch", 0.55f, 0.4f, 0.4f, dur);
					break;
				case Fx.FakeDamage:
					Run(fx, DamageRoutine());
					break;
				case Fx.GlowingEyes:
					Run(fx, EyesRoutine(dur));
					break;
				case Fx.Heartbeat:
					Run(fx, HeartbeatRoutine(dur));
					break;
				case Fx.LeftBehind:
					Run(fx, LeftBehindRoutine(dur));
					break;
				case Fx.LowStamina:
					lowStaminaUntil = now + dur;
					break;
				case (Fx)15:
				case (Fx)16:
				case (Fx)18:
					break;
				}
			}
			catch (Exception ex)
			{
				((BaseUnityPlugin)this).Logger.LogWarning((object)("Effect " + fx.ToString() + " failed: " + ex.Message));
			}
		}

		private object GetShake()
		{
			if (Reflect.Alive(cachedShake))
			{
				return cachedShake;
			}
			Type type = Reflect.FindType("CameraShake");
			if (type == null)
			{
				return null;
			}
			cachedShake = Object.FindObjectOfType(type);
			return cachedShake;
		}

		private IEnumerator ShakeRoutine(float dur)
		{
			float end = Now + dur;
			while (Now < end)
			{
				Reflect.Call(GetShake(), "Shake", 4f, 0.35f);
				yield return (object)new WaitForSecondsRealtime(0.25f);
			}
		}

		private IEnumerator GlitchRoutine(float dur)
		{
			float end = Now + dur;
			while (Now < end)
			{
				Reflect.Call(Reflect.StaticField("CameraGlitch", "Instance"), "PlayShort");
				yield return (object)new WaitForSecondsRealtime(0.9f);
			}
		}

		private IEnumerator TumbleRoutine(float dur)
		{
			object o = Reflect.StaticField("PlayerAvatar", "instance");
			object tumble = Reflect.Field(o, "tumble");
			if (Reflect.Alive(tumble))
			{
				Reflect.Call(tumble, "TumbleRequest", true, false);
				yield return (object)new WaitForSecondsRealtime(dur);
				Reflect.Call(tumble, "TumbleRequest", false, false);
			}
		}

		private IEnumerator DamageRoutine()
		{
			Reflect.Call(Reflect.StaticField("CameraGlitch", "Instance"), "PlayShortHurt", false);
			Reflect.Call(GetShake(), "Shake", 9f, 0.6f);
			AudioClip c = SoundGen.Thud();
			Play2D(c, 1f);
			yield return (object)new WaitForSecondsRealtime(2f);
			Object.Destroy((Object)(object)c);
		}

		private IEnumerator FlashSoundRoutine()
		{
			AudioClip c = SoundGen.Ringing();
			Play2D(c, 0.6f);
			yield return (object)new WaitForSecondsRealtime(5f);
			Object.Destroy((Object)(object)c);
		}

		private IEnumerator LeftBehindRoutine(float dur)
		{
			float num = Mathf.Max(dur, 15f);
			isolateUntil = Now + num;
			nextIsoScan = 0f;
			yield return (object)new WaitForSecondsRealtime(3f);
			Reflect.Call(Reflect.StaticField("ChatManager", "instance"), "PossessLeftBehind");
		}

		private void ScanRemoteAvatars()
		{
			Type type = Reflect.FindType("PlayerAvatar");
			if (type == null)
			{
				return;
			}
			Object[] array = Object.FindObjectsOfType(type);
			isoAvatars.Clear();
			for (int i = 0; i < array.Length; i++)
			{
				object obj = Reflect.Field(array[i], "isLocal");
				if (obj is bool && (bool)obj)
				{
					continue;
				}
				isoAvatars.Add(array[i]);
				Object obj2 = array[i];
				Component val = (Component)(object)((obj2 is Component) ? obj2 : null);
				if ((Object)(object)val == (Object)null)
				{
					continue;
				}
				Renderer[] componentsInChildren = val.GetComponentsInChildren<Renderer>(true);
				for (int j = 0; j < componentsInChildren.Length; j++)
				{
					if (!isoRenderers.ContainsKey(componentsInChildren[j]))
					{
						isoRenderers[componentsInChildren[j]] = componentsInChildren[j].enabled;
					}
				}
				Light[] componentsInChildren2 = val.GetComponentsInChildren<Light>(true);
				for (int k = 0; k < componentsInChildren2.Length; k++)
				{
					if (!isoLights.ContainsKey(componentsInChildren2[k]))
					{
						isoLights[componentsInChildren2[k]] = ((Behaviour)componentsInChildren2[k]).enabled;
					}
				}
			}
		}

		private void ApplyIsolationHide()
		{
			if (!isoActive)
			{
				return;
			}
			foreach (KeyValuePair<Renderer, bool> isoRenderer in isoRenderers)
			{
				if ((Object)(object)isoRenderer.Key != (Object)null)
				{
					isoRenderer.Key.enabled = false;
				}
			}
			foreach (KeyValuePair<Light, bool> isoLight in isoLights)
			{
				if ((Object)(object)isoLight.Key != (Object)null)
				{
					((Behaviour)isoLight.Key).enabled = false;
				}
			}
		}

		private void IsolationTick(float n)
		{
			if (n < isolateUntil)
			{
				isoActive = true;
				if (n >= nextIsoScan)
				{
					nextIsoScan = n + 0.5f;
					ScanRemoteAvatars();
					for (int i = 0; i < isoAvatars.Count; i++)
					{
						Reflect.Call(Reflect.Field(isoAvatars[i], "voiceChat"), "OverrideVolumeMute", 1f);
					}
				}
				ApplyIsolationHide();
			}
			else
			{
				if (!isoActive)
				{
					return;
				}
				foreach (KeyValuePair<Renderer, bool> isoRenderer in isoRenderers)
				{
					if ((Object)(object)isoRenderer.Key != (Object)null)
					{
						isoRenderer.Key.enabled = isoRenderer.Value;
					}
				}
				foreach (KeyValuePair<Light, bool> isoLight in isoLights)
				{
					if ((Object)(object)isoLight.Key != (Object)null)
					{
						((Behaviour)isoLight.Key).enabled = isoLight.Value;
					}
				}
				isoRenderers.Clear();
				isoLights.Clear();
				isoAvatars.Clear();
				isoActive = false;
			}
		}

		private IEnumerator EyesRoutine(float dur)
		{
			EnsureTextures();
			int count = Mathf.Max(1, (int)(dur / 2.5f));
			for (int i = 0; i < count; i++)
			{
				yield return (object)new WaitForSecondsRealtime(Random.Range(0.4f, 1.5f));
				int num = Random.Range(1, 3);
				for (int j = 0; j < num; j++)
				{
					float num2 = Random.Range(0.035f, 0.06f);
					float num3 = num2 * 2.67f * (float)Screen.height / (float)Screen.width;
					Hal hal = new Hal();
					hal.Kind = 1;
					hal.Start = Now;
					hal.Life = Random.Range(0.8f, 2.2f);
					hal.Seed = Random.Range(0f, 100f);
					hal.Norm = new Rect(Random.Range(0.08f, 0.8f), Random.Range(0.22f, 0.6f), num3, num2);
					hals.Add(hal);
				}
				yield return (object)new WaitForSecondsRealtime(Mathf.Max(0.4f, dur / (float)count - 1f));
			}
		}

		private IEnumerator HeartbeatRoutine(float dur)
		{
			AudioClip clip = SoundGen.Heartbeat();
			float end = Now + dur;
			heartStart = Now;
			heartEnd = end;
			while (Now < end)
			{
				float num = 1f - (end - Now) / dur;
				float num2 = Mathf.Lerp(70f, 130f, num);
				heartBeat = Now;
				Play2D(clip, 0.9f);
				Reflect.Call(GetShake(), "Shake", 1.2f, 0.25f);
				yield return (object)new WaitForSecondsRealtime(60f / num2);
			}
			yield return (object)new WaitForSecondsRealtime(1f);
			Object.Destroy((Object)(object)clip);
		}

		private void EnsureTextures()
		{
			if (!((Object)(object)eyesTex != (Object)null))
			{
				eyesTex = MakeEyesTexture();
				vignetteTex = MakeVignetteTexture();
			}
		}

		private static Texture2D NewTex(int w, int h, Color32[] px)
		{
			//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_0010: 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_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002d: Expected O, but got Unknown
			Texture2D val = new Texture2D(w, h, (TextureFormat)4, false);
			val.SetPixels32(px);
			((Texture)val).wrapMode = (TextureWrapMode)1;
			((Texture)val).filterMode = (FilterMode)1;
			((Object)val).hideFlags = (HideFlags)61;
			val.Apply();
			return val;
		}

		private static Texture2D MakeEyesTexture()
		{
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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)
			int num = 128;
			int num2 = 48;
			Color32[] array = (Color32[])(object)new Color32[num * num2];
			Color val = default(Color);
			for (int i = 0; i < num2; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num3 = 10f;
					for (int k = 0; k < 2; k++)
					{
						float num4 = ((k == 0) ? 40f : 88f);
						float num5 = ((float)j - num4) / 16f;
						float num6 = ((float)i - 24f) / 10f;
						num3 = Mathf.Min(num3, Mathf.Sqrt(num5 * num5 + num6 * num6));
					}
					float num7 = Mathf.Clamp01(1.2f - num3);
					num7 *= num7;
					float num8 = Mathf.Clamp01(1f - num3 * 2f);
					((Color)(ref val))..ctor(1f, Mathf.Lerp(0.15f, 0.95f, num8), Mathf.Lerp(0.05f, 0.8f, num8), num7);
					array[i * num + j] = Color32.op_Implicit(val);
				}
			}
			return NewTex(num, num2, array);
		}

		private static Texture2D MakeVignetteTexture()
		{
			//IL_008d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			int num = 64;
			Color32[] array = (Color32[])(object)new Color32[num * num];
			for (int i = 0; i < num; i++)
			{
				for (int j = 0; j < num; j++)
				{
					float num2 = ((float)j - (float)num / 2f) / ((float)num / 2f);
					float num3 = ((float)i - (float)num / 2f) / ((float)num / 2f);
					float num4 = Mathf.Sqrt(num2 * num2 + num3 * num3);
					float num5 = Mathf.SmoothStep(0f, 1f, Mathf.Clamp01((num4 - 0.35f) / 0.75f));
					array[i * num + j] = new Color32((byte)150, (byte)0, (byte)0, (byte)(num5 * 255f));
				}
			}
			return NewTex(num, num, array);
		}

		private void Play2D(AudioClip clip, float volume)
		{
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Expected O, but got Unknown
			GameObject val = new GameObject("tp_snd")
			{
				hideFlags = (HideFlags)61
			};
			AudioSource obj = val.AddComponent<AudioSource>();
			obj.clip = clip;
			obj.spatialBlend = 0f;
			obj.volume = Mathf.Clamp01(volume * SoundVolume.Value);
			obj.Play();
			Object.Destroy((Object)val, clip.length + 0.5f);
		}

		private void ToggleMenu()
		{
			if (!(Now < lastToggle + 0.3f))
			{
				lastToggle = Now;
				SetMenu(!menuOpen);
			}
		}

		private void SetMenu(bool open)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			if (open != menuOpen)
			{
				menuOpen = open;
				if (open)
				{
					prevLock = Cursor.lockState;
					prevVisible = Cursor.visible;
					RefreshTargets();
				}
				else
				{
					Cursor.lockState = prevLock;
					Cursor.visible = prevVisible;
				}
			}
		}

		private Dictionary<int, string> AvatarNames()
		{
			Dictionary<int, string> dictionary = new Dictionary<int, string>();
			try
			{
				Type type = Reflect.FindType("PlayerAvatar");
				if (type == null)
				{
					return dictionary;
				}
				Object[] array = Object.FindObjectsOfType(type);
				for (int i = 0; i < array.Length; i++)
				{
					object obj = Reflect.Field(array[i], "photonView");
					PhotonView val = (PhotonView)((obj is PhotonView) ? obj : null);
					string value = Reflect.Field(array[i], "playerName") as string;
					if ((Object)(object)val != (Object)null && val.Owner != null)
					{
						dictionary[val.Owner.ActorNumber] = value;
					}
				}
			}
			catch (Exception)
			{
			}
			return dictionary;
		}

		private void RefreshTargets()
		{
			nextTargetRefresh = Now + 1f;
			List<Target> list = new List<Target>();
			Target target = new Target();
			target.Name = "Everyone else";
			target.Everyone = true;
			list.Add(target);
			if (PhotonNetwork.InRoom)
			{
				Dictionary<int, string> dictionary = AvatarNames();
				Player[] playerList = PhotonNetwork.PlayerList;
				foreach (Player val in playerList)
				{
					if (!val.IsLocal)
					{
						if (!dictionary.TryGetValue(val.ActorNumber, out var value) || string.IsNullOrEmpty(value))
						{
							value = (string.IsNullOrEmpty(val.NickName) ? ("Player " + val.ActorNumber) : val.NickName);
						}
						Target target2 = new Target();
						target2.Name = value;
						target2.Actor = val.ActorNumber;
						list.Add(target2);
					}
				}
			}
			Target target3 = new Target();
			target3.Name = "Me (test)";
			target3.Self = true;
			list.Add(target3);
			targets = list;
			targetNames = new string[list.Count];
			selTarget = 0;
			for (int j = 0; j < list.Count; j++)
			{
				targetNames[j] = list[j].Name;
				if (list[j].Key == selKey)
				{
					selTarget = j;
				}
			}
		}

		private void OnGUI()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: Invalid comparison between Unknown and I4
			//IL_0059: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Invalid comparison between Unknown and I4
			//IL_001a: 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_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0049: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00aa: 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_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Expected O, but got Unknown
			//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
			GUI.depth = -10000;
			Event current = Event.current;
			if ((int)current.type == 4)
			{
				if (current.keyCode == MenuKey.Value)
				{
					ToggleMenu();
					current.Use();
				}
				else if (menuOpen && (int)current.keyCode == 27)
				{
					SetMenu(open: false);
					current.Use();
				}
			}
			if ((int)current.type == 7)
			{
				DrawOverlays();
			}
			if (menuOpen)
			{
				if (Now >= nextTargetRefresh)
				{
					RefreshTargets();
				}
				float num = Mathf.Max(0.8f, (float)Screen.height / 1080f);
				Matrix4x4 matrix = GUI.matrix;
				GUI.matrix = Matrix4x4.Scale(new Vector3(num, num, 1f));
				winRect = GUILayout.Window(93170, winRect, new WindowFunction(DrawWindow), "TrollPack", (GUILayoutOption[])(object)new GUILayoutOption[1] { GUILayout.Width(590f) });
				GUI.matrix = matrix;
			}
		}

		private void DrawWindow(int id)
		{
			//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
			GUILayout.Label("Target", Array.Empty<GUILayoutOption>());
			if (targetNames.Length != 0)
			{
				selTarget = Mathf.Clamp(selTarget, 0, targetNames.Length - 1);
				selTarget = GUILayout.SelectionGrid(selTarget, targetNames, 2, Array.Empty<GUILayoutOption>());
				selKey = targets[selTarget].Key;
			}
			GUILayout.Space(6f);
			GUILayout.Label("Duration: " + chosenDuration.ToString("0") + "s", Array.Empty<GUILayoutOption>());
			chosenDuration = GUILayout.HorizontalSlider(chosenDuration, 2f, 30f, Array.Empty<GUILayoutOption>());
			GUILayout.Space(6f);
			GUI.enabled = Now >= nextSend;
			int num = 0;
			GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
			for (int i = 0; i < Infos.Length; i++)
			{
				FxInfo fxInfo = Infos[i];
				if (GUILayout.Button(fxInfo.Experimental ? (fxInfo.Name + " *") : fxInfo.Name, (GUILayoutOption[])(object)new GUILayoutOption[2]
				{
					GUILayout.Height(30f),
					GUILayout.Width(182f)
				}) && targets.Count > 0)
				{
					Send(fxInfo, targets[Mathf.Clamp(selTarget, 0, targets.Count - 1)]);
				}
				num++;
				if (num % 3 == 0)
				{
					GUILayout.EndHorizontal();
					GUILayout.BeginHorizontal(Array.Empty<GUILayoutOption>());
				}
			}
			GUILayout.EndHorizontal();
			GUI.enabled = true;
			GUILayout.Space(6f);
			GUILayout.Label(status, Array.Empty<GUILayoutOption>());
			GUILayout.Label("* experimental. Close with the menu key or Esc.", Array.Empty<GUILayoutOption>());
			GUI.DragWindow(new Rect(0f, 0f, 10000f, 24f));
		}

		private void DrawOverlays()
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_023b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_01da: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: 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)
			float now = Now;
			Rect val = default(Rect);
			((Rect)(ref val))..ctor(0f, 0f, (float)Screen.width, (float)Screen.height);
			Color color = GUI.color;
			for (int num = hals.Count - 1; num >= 0; num--)
			{
				Hal hal = hals[num];
				float num2 = now - hal.Start;
				if (num2 >= hal.Life)
				{
					hals.RemoveAt(num);
				}
				else
				{
					float num3 = Mathf.Min(Mathf.Clamp01(num2 / 0.15f), Mathf.Clamp01((hal.Life - num2) / 0.25f));
					if (!((Object)(object)eyesTex == (Object)null))
					{
						num3 *= ((Mathf.PerlinNoise(now * 6f, hal.Seed) > 0.2f) ? 1f : 0.2f);
						GUI.color = new Color(1f, 1f, 1f, num3);
						GUI.DrawTexture(new Rect(((Rect)(ref hal.Norm)).x * (float)Screen.width, ((Rect)(ref hal.Norm)).y * (float)Screen.height, ((Rect)(ref hal.Norm)).width * (float)Screen.width, ((Rect)(ref hal.Norm)).height * (float)Screen.height), (Texture)(object)eyesTex);
					}
				}
			}
			if ((Object)(object)vignetteTex != (Object)null && now < heartEnd)
			{
				float num4 = Mathf.Min(1f, Mathf.Min((now - heartStart) / 0.8f, (heartEnd - now) / 1f));
				float num5 = Mathf.Exp((0f - (now - heartBeat)) * 7f);
				GUI.color = new Color(1f, 1f, 1f, Mathf.Clamp01(num4 * (0.3f + 0.6f * num5)));
				GUI.DrawTexture(val, (Texture)(object)vignetteTex);
			}
			if (now < darkUntil)
			{
				float num6 = Mathf.Clamp01((now - darkStart) / 0.4f);
				float num7 = Mathf.Clamp01((darkUntil - now) / 0.8f);
				GUI.color = new Color(0f, 0f, 0f, Mathf.Min(num6, num7));
				GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture);
			}
			if (now < flashStart + 4f)
			{
				float num8 = (now - flashStart) / 4f;
				float num9 = ((num8 < 0.25f) ? 1f : Mathf.Clamp01(1f - (num8 - 0.25f) / 0.75f));
				GUI.color = new Color(1f, 1f, 1f, num9);
				GUI.DrawTexture(val, (Texture)(object)Texture2D.whiteTexture);
			}
			GUI.color = color;
		}
	}
	internal static class Reflect
	{
		private const BindingFlags All = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		public static Type FindType(string name)
		{
			try
			{
				return AccessTools.TypeByName(name);
			}
			catch (Exception)
			{
				return null;
			}
		}

		public static object StaticField(string typeName, string field)
		{
			try
			{
				Type type = FindType(typeName);
				if (type == null)
				{
					return null;
				}
				FieldInfo field2 = type.GetField(field, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				if (field2 != null)
				{
					return field2.GetValue(null);
				}
				PropertyInfo property = type.GetProperty(field, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				return (property == null) ? null : property.GetValue(null, null);
			}
			catch (Exception)
			{
				return null;
			}
		}

		public static object Field(object o, string name)
		{
			if (o == null)
			{
				return null;
			}
			try
			{
				Type type = o.GetType();
				FieldInfo field = type.GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				if (field != null)
				{
					return field.GetValue(o);
				}
				PropertyInfo property = type.GetProperty(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				return (property == null) ? null : property.GetValue(o, null);
			}
			catch (Exception)
			{
				return null;
			}
		}

		public static bool SetField(object o, string name, object value)
		{
			if (o == null)
			{
				return false;
			}
			try
			{
				FieldInfo field = o.GetType().GetField(name, BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				if (field == null)
				{
					return false;
				}
				field.SetValue(o, Coerce(value, field.FieldType));
				return true;
			}
			catch (Exception)
			{
				return false;
			}
		}

		public static bool Alive(object o)
		{
			if (o == null)
			{
				return false;
			}
			Object val = (Object)((o is Object) ? o : null);
			if (o is Object)
			{
				return val != (Object)null;
			}
			return true;
		}

		public static bool Call(object target, string method, params object[] args)
		{
			if (!Alive(target))
			{
				return false;
			}
			try
			{
				MethodInfo methodInfo = FindMethod(target.GetType(), method, args.Length);
				if (methodInfo == null)
				{
					Plugin.LogOnce("missing:" + method, "Method not found: " + method);
					return false;
				}
				ParameterInfo[] parameters = methodInfo.GetParameters();
				object[] array = new object[parameters.Length];
				for (int i = 0; i < parameters.Length; i++)
				{
					array[i] = Coerce(args[i], parameters[i].ParameterType);
				}
				methodInfo.Invoke(target, array);
				return true;
			}
			catch (Exception ex)
			{
				Plugin.LogOnce("fail:" + method, "Call failed: " + method + " -> " + ex.GetBaseException().Message);
				return false;
			}
		}

		private static MethodInfo FindMethod(Type type, string name, int paramCount)
		{
			Type type2 = type;
			while (type2 != null)
			{
				MethodInfo[] methods = type2.GetMethods(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				for (int i = 0; i < methods.Length; i++)
				{
					if (methods[i].Name == name && methods[i].GetParameters().Length == paramCount)
					{
						return methods[i];
					}
				}
				type2 = type2.BaseType;
			}
			return null;
		}

		private static object Coerce(object arg, Type pt)
		{
			if (arg == null)
			{
				return null;
			}
			if (pt.IsInstanceOfType(arg))
			{
				return arg;
			}
			if (pt.IsEnum)
			{
				return Enum.ToObject(pt, arg);
			}
			if (pt.IsPrimitive)
			{
				return Convert.ChangeType(arg, pt, CultureInfo.InvariantCulture);
			}
			return arg;
		}
	}
	internal static class SoundGen
	{
		private const int Rate = 44100;

		private static AudioClip Make(string name, float[] data)
		{
			float num = 0.0001f;
			for (int i = 0; i < data.Length; i++)
			{
				float num2 = Mathf.Abs(data[i]);
				if (num2 > num)
				{
					num = num2;
				}
			}
			float num3 = 0.9f / num;
			for (int j = 0; j < data.Length; j++)
			{
				data[j] *= num3;
			}
			AudioClip obj = AudioClip.Create(name, data.Length, 1, 44100, false);
			obj.SetData(data, 0);
			return obj;
		}

		public static AudioClip Heartbeat()
		{
			int num = 26460;
			float[] array = new float[num];
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)i / 44100f;
				float num3 = Mathf.Sin(MathF.PI * 110f * num2) * Mathf.Exp((0f - num2) * 25f);
				float num4 = num2 - 0.22f;
				float num5 = ((num4 > 0f) ? (Mathf.Sin(MathF.PI * 96f * num4) * Mathf.Exp((0f - num4) * 28f) * 0.7f) : 0f);
				array[i] = num3 + num5;
			}
			return Make("tp_heart", array);
		}

		public static AudioClip Thud()
		{
			int num = 22050;
			float[] array = new float[num];
			Random random = new Random(Random.Range(1, 100000));
			float num2 = 0f;
			for (int i = 0; i < num; i++)
			{
				float num3 = (float)i / 44100f;
				float num4 = (float)(random.NextDouble() * 2.0 - 1.0);
				num2 += 0.2f * (num4 - num2);
				array[i] = Mathf.Sin(MathF.PI * 110f * num3) * Mathf.Exp((0f - num3) * 9f) + num2 * Mathf.Exp((0f - num3) * 18f) * 0.6f;
			}
			return Make("tp_thud", array);
		}

		public static AudioClip Ringing()
		{
			int num = 176400;
			float[] array = new float[num];
			for (int i = 0; i < num; i++)
			{
				float num2 = (float)i / 44100f;
				float num3 = Mathf.Sin(MathF.PI * 6600f * num2) + 0.6f * Mathf.Sin(MathF.PI * 8200f * num2);
				array[i] = num3 * Mathf.Exp((0f - num2) * 0.9f);
			}
			return Make("tp_ring", array);
		}
	}
}