Decompiled source of Emotes2 And Knuckles v1.3.5

plugins/LcEmotes2AndKnucklesFeaturingDante/LcEmotes2AndKnucklesFeaturingDante.dll

Decompiled 7 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
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.Bootstrap;
using BepInEx.Logging;
using EmotesAPI;
using GameNetcodeStuff;
using LcEmotes2AndKnucklesFeaturingDante.Common;
using LcEmotes2AndKnucklesFeaturingDante.Common.Rand;
using LcEmotes2AndKnucklesFeaturingDante.Emotes;
using LcEmotes2AndKnucklesFeaturingDante.Emotes.GoblinPain;
using LcEmotes2AndKnucklesFeaturingDante.Emotes.GoblinPain.Chat;
using LcEmotes2AndKnucklesFeaturingDante.Emotes.GoblinPain.Data;
using LcEmotes2AndKnucklesFeaturingDante.Emotes.JermaWindow;
using LcEmotes2AndKnucklesFeaturingDante.Emotes.LightsCameraAction;
using LcEmotes2AndKnucklesFeaturingDante.Emotes.Megaman;
using LcEmotes2AndKnucklesFeaturingDante.Emotes.xQcClap;
using LcEmotes2AndKnucklesFeaturingDante.JoinSpots;
using LcEmotes2AndKnucklesFeaturingDante.JoinSpots.JermaWindow;
using LcEmotes2AndKnucklesFeaturingDante.NetcodePatcher;
using LcEmotes2AndKnucklesFeaturingDante.Utils;
using LethalEmotesAPI;
using LethalEmotesAPI.Core;
using LethalEmotesAPI.ImportV2;
using LethalVRM;
using Microsoft.CodeAnalysis;
using ModelReplacement;
using MonoMod.RuntimeDetour;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Playables;
using UnityEngine.TextCore;
using UnityEngine.Timeline;
using UnityEngine.Video;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: IgnoresAccessChecksTo("Assembly-CSharp")]
[assembly: IgnoresAccessChecksTo("LethalVRM")]
[assembly: IgnoresAccessChecksTo("MToon")]
[assembly: IgnoresAccessChecksTo("UniGLTF")]
[assembly: IgnoresAccessChecksTo("UniGLTF.Utils")]
[assembly: IgnoresAccessChecksTo("UniHumanoid")]
[assembly: IgnoresAccessChecksTo("Unity.Netcode.Runtime")]
[assembly: IgnoresAccessChecksTo("Unity.TextMeshPro")]
[assembly: IgnoresAccessChecksTo("Unity.Timeline")]
[assembly: IgnoresAccessChecksTo("VRM10")]
[assembly: IgnoresAccessChecksTo("VrmLib")]
[assembly: IgnoresAccessChecksTo("VRMShaders.GLTF.IO.Runtime")]
[assembly: IgnoresAccessChecksTo("VRMShaders.VRM.IO.Runtime")]
[assembly: IgnoresAccessChecksTo("VRMShaders.VRM10.Format.Runtime")]
[assembly: IgnoresAccessChecksTo("VRMShaders.VRM10.MToon10.Runtime")]
[assembly: AssemblyCompany("LcEmotes2AndKnucklesFeaturingDante")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+fa54d9c19b0efabe58ea9b188347dc758d6be62f")]
[assembly: AssemblyProduct("LcEmotes2AndKnucklesFeaturingDante")]
[assembly: AssemblyTitle("LcEmotes2AndKnucklesFeaturingDante")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
[module: NetcodePatchedAssembly]
internal class <Module>
{
	static <Module>()
	{
	}
}
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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]
	[Microsoft.CodeAnalysis.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 LcEmotes2AndKnucklesFeaturingDante
{
	internal static class Assets
	{
		private static readonly List<AssetBundle> AssetBundles = new List<AssetBundle>();

		private static readonly Dictionary<string, int> AssetIndices = new Dictionary<string, int>();

		public static void LoadAllAssetBundles()
		{
			foreach (string item in Directory.EnumerateFiles(FsUtils.AssetBundlesDir, "*", SearchOption.AllDirectories))
			{
				string text = item;
				if (text.StartsWith(FsUtils.AssetBundlesDir))
				{
					string text2 = text;
					int length = FsUtils.AssetBundlesDir.Length;
					text = text2.Substring(length, text2.Length - length);
				}
				while (text.StartsWith("/") || text.StartsWith("\\"))
				{
					string text2 = text;
					text = text2.Substring(1, text2.Length - 1);
				}
				AddBundle(text);
			}
		}

		public static void AddBundle(string bundleName)
		{
			string text = Path.Combine(FsUtils.AssetBundlesDir, bundleName);
			AssetBundle val = AssetBundle.LoadFromFile(text);
			int count = AssetBundles.Count;
			AssetBundles.Add(val);
			string[] allAssetNames = val.GetAllAssetNames();
			foreach (string text2 in allAssetNames)
			{
				string text3 = text2.ToLowerInvariant();
				if (text3.StartsWith("assets/"))
				{
					string text4 = text3;
					int length = "assets/".Length;
					text3 = text4.Substring(length, text4.Length - length);
				}
				AssetIndices[text3] = count;
			}
		}

		public static T? Load<T>(string assetName) where T : Object
		{
			try
			{
				assetName = assetName.ToLowerInvariant();
				if (assetName.StartsWith("assets/"))
				{
					string text = assetName;
					int length = "assets/".Length;
					assetName = text.Substring(length, text.Length - length);
				}
				int index = AssetIndices[assetName];
				return AssetBundles[index].LoadAsset<T>("assets/" + assetName);
			}
			catch (Exception arg)
			{
				ManualLogSource? logger = LcEmotes2AndKnucklesFeaturingDantePlugin.Logger;
				if (logger != null)
				{
					logger.LogError((object)$"Couldn't load asset [{assetName}] exception: {arg}");
				}
				return default(T);
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante", "Emotes 2 And Knuckles Featuring Dante", "1.3.5")]
	public class LcEmotes2AndKnucklesFeaturingDantePlugin : BaseUnityPlugin
	{
		public const string ModGuid = "com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante";

		public const string ModName = "Emotes 2 And Knuckles Featuring Dante";

		public const string ModVersion = "1.3.5";

		public static bool watermarkRemoverPresent;

		public static PluginInfo? PluginInfo { get; private set; }

		public static ManualLogSource? Logger { get; private set; }

		private void Awake()
		{
			PluginInfo = ((BaseUnityPlugin)this).Info;
			Logger = ((BaseUnityPlugin)this).Logger;
			watermarkRemoverPresent = Chainloader.PluginInfos.ContainsKey("flowerwater.liquidStainRemover");
			Assets.LoadAllAssetBundles();
			RegisterAllEmotes();
			EmoteRegistry.FinalizeRegistry();
			GameEventBus.InitHooks();
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				try
				{
					MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
					MethodInfo[] array2 = methods;
					foreach (MethodInfo methodInfo in array2)
					{
						object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
						if (customAttributes.Length != 0)
						{
							methodInfo.Invoke(null, null);
						}
					}
				}
				catch (Exception)
				{
				}
			}
		}

		private void RegisterAllEmotes()
		{
			//IL_0078: 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_0082: Unknown result type (might be due to invalid IL or missing references)
			EmoteRegistry.RegisterEmote<GoblinPainEmote>();
			EmoteRegistry.RegisterEmote<xQcEmote>();
			EmoteRegistry.RegisterEmote<xQcEmote_yell>();
			EmoteRegistry.RegisterEmote<xQcEmote_clap>();
			EmoteRegistry.RegisterEmote<LightsCameraActionEmote>();
			EmoteRegistry.RegisterEmote<PhoneEmote>();
			EmoteRegistry.RegisterEmote<JermaWindow>();
			EmoteRegistry.RegisterEmote<JermaWindowJump>();
			EmoteRegistry.RegisterEmote<JermaWindowLand>();
			EmoteRegistry.RegisterEmote<JermaWindowFall>();
			Assets.Load<GameObject>("Emotes/JermaWindow/Window9.prefab").AddComponent<WindowHandler>();
			EmoteRegistry.RegiserProp(JermaWindow.props, Assets.Load<GameObject>("Emotes/JermaWindow/Window9.prefab"), (JoinSpot[])(object)new JoinSpot[1]
			{
				new JoinSpot("JermaWindowSpot", new Vector3(0f, 0f, 2.5f))
			}, new AbstractJoinSpot[1]
			{
				new JermaWindowJoinSpot()
			});
		}
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.Utils
{
	internal static class ArrayUtils
	{
		public static T[] Copy<T>(this T[] orig)
		{
			T[] array = new T[orig.Length];
			for (int i = 0; i < array.Length; i++)
			{
				array[i] = orig[i];
			}
			return array;
		}
	}
	internal static class FsUtils
	{
		private static string? _assetBundlesDir;

		public static string AssetBundlesDir
		{
			get
			{
				if (_assetBundlesDir == null)
				{
					_assetBundlesDir = GetAssetBundlesDir();
				}
				if (string.IsNullOrEmpty(_assetBundlesDir))
				{
					return "";
				}
				return _assetBundlesDir;
			}
		}

		private static string? GetAssetBundlesDir()
		{
			PluginInfo pluginInfo = LcEmotes2AndKnucklesFeaturingDantePlugin.PluginInfo;
			if (pluginInfo == null)
			{
				return null;
			}
			string location = pluginInfo.Location;
			DirectoryInfo parent = Directory.GetParent(location);
			if (parent == null)
			{
				throw new NotSupportedException(BadInstallError());
			}
			string text = Path.Combine(parent.FullName, "AssetBundles");
			if (!Directory.Exists(text))
			{
				throw new NotSupportedException(BadInstallError());
			}
			return text;
			static string BadInstallError()
			{
				string text2 = "Emotes 2 And Knuckles Featuring Dante";
				string text3 = "LcEmotes2AndKnucklesFeaturingDante.dll";
				string text4 = text2 + " can't find it's required AssetBundles!\n Make sure that the file `" + text3 + "` is in its own folder like `BepInEx/plugins/" + text2 + "/" + text3 + "` and that the folder `AssetBundles` is in the same folder as `" + text3 + "`!";
				ManualLogSource? logger = LcEmotes2AndKnucklesFeaturingDantePlugin.Logger;
				if (logger != null)
				{
					logger.LogError((object)text4);
				}
				return text4;
			}
		}
	}
	internal static class HookUtils
	{
		private const BindingFlags DefaultFlags = BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic;

		private const BindingFlags StaticFlags = BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;

		public static Hook NewHook<TTarget, TDest>(string targetMethodName, string destMethodName, TDest instance)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Expected O, but got Unknown
			MethodInfo method = typeof(TTarget).GetMethod(targetMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			MethodInfo method2 = typeof(TDest).GetMethod(destMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			return new Hook((MethodBase)method, method2, (object)instance);
		}

		public static Hook NewHook<TTarget>(string targetMethodName, MethodInfo destMethod)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			MethodInfo method = typeof(TTarget).GetMethod(targetMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			return new Hook((MethodBase)method, destMethod);
		}

		public static Hook NewHook<TTarget>(string targetMethodName, Type destType, string destMethodName, bool isStatic)
		{
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Expected O, but got Unknown
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Expected O, but got Unknown
			if (isStatic)
			{
				MethodInfo method = typeof(TTarget).GetMethod(targetMethodName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				MethodInfo method2 = destType.GetMethod(destMethodName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
				return new Hook((MethodBase)method, method2);
			}
			MethodInfo method3 = typeof(TTarget).GetMethod(targetMethodName, BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
			MethodInfo method4 = destType.GetMethod(destMethodName, BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic);
			return new Hook((MethodBase)method3, method4);
		}
	}
	public readonly struct Optional<T>
	{
		private readonly T? _value;

		public bool HasValue { get; }

		private Optional(T value)
		{
			HasValue = false;
			_value = value;
			HasValue = true;
		}

		public bool TryGetValue(out T? value)
		{
			value = _value;
			return HasValue;
		}

		public static Optional<T> Some(T value)
		{
			return new Optional<T>(value);
		}

		public static Optional<T> None()
		{
			return default(Optional<T>);
		}
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.JoinSpots
{
	public abstract class AbstractJoinSpot
	{
		public virtual void OnSpotJoined(GameObject emoteSpot, BoneMapper joiner, BoneMapper host)
		{
		}
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.JoinSpots.JermaWindow
{
	public class JermaWindowJoinSpot : AbstractJoinSpot
	{
		public override void OnSpotJoined(GameObject emoteSpot, BoneMapper joiner, BoneMapper host)
		{
			//IL_000d: 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_0036: 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_00da: 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)
			//IL_00f3: 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: Expected O, but got Unknown
			joiner.mapperBodyTransform.position = emoteSpot.transform.position;
			joiner.mapperBodyTransform.rotation = emoteSpot.transform.rotation;
			Transform mapperBodyTransform = joiner.mapperBodyTransform;
			mapperBodyTransform.localEulerAngles += new Vector3(0f, 180f, 0f);
			joiner.PlayAnim("com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__Window1", -1);
			if (joiner.playerController != null && joiner.local)
			{
				GameObject val = new GameObject();
				joiner.props.Add(val);
				val.AddComponent<CameraLocker>().cam = joiner.playerController.gameplayCamera;
			}
			((MonoBehaviour)joiner).StartCoroutine(SpawnBrokenGlass(0.6166f, ((Component)host).transform, joiner));
			EmoteLocation component = emoteSpot.GetComponent<EmoteLocation>();
			component.SetEmoterAndHideLocation(joiner);
			Transform transform = ((Component)component).gameObject.transform;
			transform.localPosition -= new Vector3(5000f, 5000f, 5000f);
			((Component)host).GetComponent<WindowHandler>().owner = null;
			if (!joiner.currentClipName.Equals("com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__Window1"))
			{
				AudioSource component2 = ((Component)((Component)host).transform.Find("Base")).GetComponent<AudioSource>();
				component2.clip = joiner.personalAudioSource.clip;
				((Component)joiner.personalAudioSource).GetComponent<AudioManager>().Stop();
				component2.Play();
			}
		}

		internal static IEnumerator SpawnBrokenGlass(float delay, Transform hostPosition, BoneMapper owner)
		{
			yield return (object)new WaitForSeconds(delay);
			if (owner?.currentClipName.Equals("com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__Window1") ?? false)
			{
				GameObject g = Object.Instantiate<GameObject>(Assets.Load<GameObject>("Emotes/JermaWindow/WindowShatter.prefab"));
				g.transform.SetParent(hostPosition);
				g.transform.localPosition = Vector3.zero;
				g.transform.localRotation = Quaternion.identity;
				g.transform.localScale = Vector3.one;
				((Component)hostPosition.Find("Glass")).gameObject.SetActive(false);
				((Component)hostPosition.Find("XBeam")).gameObject.SetActive(false);
				((Component)hostPosition.Find("ZBeam")).gameObject.SetActive(false);
			}
			GameObject g2 = Object.Instantiate<GameObject>(Assets.Load<GameObject>("Emotes/JermaWindow/Explosion.prefab"));
			g2.transform.SetParent(hostPosition);
			g2.transform.localPosition = new Vector3(0f, 1.33f, 0f);
			g2.transform.localScale = new Vector3(5f, 5f, 5f);
			g2.transform.SetParent(g2.transform.parent.parent);
			yield return (object)new WaitForSeconds(5f - delay);
			((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(CleanupExplosion(g2));
			g2.GetComponent<ParticleSystem>().Emit(1);
			g2.GetComponent<AudioSource>().Play();
			if (CustomEmotesAPI.localMapper.isServer)
			{
				Object.Destroy((Object)(object)((Component)hostPosition).gameObject);
			}
		}

		internal static IEnumerator CleanupExplosion(GameObject g)
		{
			yield return (object)new WaitForSeconds(3f);
			Object.Destroy((Object)(object)g);
		}
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.Emotes
{
	public abstract class AbstractEmote
	{
		public abstract string AnimationClipName { get; }

		public abstract CustomEmoteParams GetClipParams();

		public virtual void SpawnProps(BoneMapper mapper)
		{
		}
	}
	internal static class EmoteRegistry
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static AnimationChanged <0>__OnSpawnWorldProps;

			public static JoinedEmoteSpotProp <1>__OnJoinedWorldProp;
		}

		private static bool _finished;

		private static readonly Dictionary<string, AbstractEmote> Emotes = new Dictionary<string, AbstractEmote>();

		private static readonly Dictionary<string, AbstractJoinSpot> JoinSpots = new Dictionary<string, AbstractJoinSpot>();

		public static void RegisterEmote<T>() where T : AbstractEmote, new()
		{
			T val = new T();
			Emotes["com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__" + val.AnimationClipName] = val;
		}

		public static void RegisterEmote<T>(T emoteInstance) where T : AbstractEmote
		{
			Emotes["com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__" + emoteInstance.AnimationClipName] = emoteInstance;
		}

		public static void RegiserProp(List<int> props, GameObject prop, JoinSpot[] joinSpots, AbstractJoinSpot[] joinSpotClasses)
		{
			props.Add(CustomEmotesAPI.RegisterWorldProp(prop, joinSpots));
			for (int i = 0; i < joinSpots.Length; i++)
			{
				JoinSpots[joinSpots[i].name] = joinSpotClasses[i];
			}
		}

		public static void FinalizeRegistry()
		{
			//IL_006a: Unknown result type (might be due to invalid IL or missing references)
			//IL_006f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Expected O, but got Unknown
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Expected O, but got Unknown
			if (_finished)
			{
				return;
			}
			foreach (var (_, abstractEmote2) in Emotes)
			{
				EmoteImporter.ImportEmote(abstractEmote2.GetClipParams());
			}
			object obj = <>O.<0>__OnSpawnWorldProps;
			if (obj == null)
			{
				AnimationChanged val = OnSpawnWorldProps;
				<>O.<0>__OnSpawnWorldProps = val;
				obj = (object)val;
			}
			CustomEmotesAPI.animChanged += (AnimationChanged)obj;
			object obj2 = <>O.<1>__OnJoinedWorldProp;
			if (obj2 == null)
			{
				JoinedEmoteSpotProp val2 = OnJoinedWorldProp;
				<>O.<1>__OnJoinedWorldProp = val2;
				obj2 = (object)val2;
			}
			CustomEmotesAPI.emoteSpotJoined_Prop += (JoinedEmoteSpotProp)obj2;
			_finished = true;
		}

		private static void OnJoinedWorldProp(GameObject emoteSpot, BoneMapper joiner, BoneMapper host)
		{
			if (JoinSpots.TryGetValue(((Object)emoteSpot).name, out AbstractJoinSpot value))
			{
				value.OnSpotJoined(emoteSpot, joiner, host);
			}
		}

		private static void OnSpawnWorldProps(string animName, BoneMapper mapper)
		{
			GoblinPainEmote.mappersPlayingPain.Remove(mapper);
			if (GoblinPainEmote.mappersPlayingPain.ContainsKey(CustomEmotesAPI.localMapper))
			{
				((Component)GoblinPainEmote.mappersPlayingPain[CustomEmotesAPI.localMapper]).gameObject.SetActive(true);
			}
			else if (GoblinPainEmote.mappersPlayingPain.Count != 0)
			{
				((Component)GoblinPainEmote.mappersPlayingPain.First().Value).gameObject.SetActive(true);
			}
			if (Emotes.TryGetValue(animName, out AbstractEmote value))
			{
				value.SpawnProps(mapper);
			}
		}
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.Emotes.xQcClap
{
	public class TestEmote : AbstractEmote
	{
		public override string AnimationClipName => "avatartesting";

		public override CustomEmoteParams GetClipParams()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			CustomEmoteParams val = new CustomEmoteParams();
			val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/xQcClap/Testing/" + AnimationClipName + ".anim") };
			val.syncAnim = false;
			val.syncAudio = false;
			val.displayName = "Finger Touch";
			val.lockType = (LockType)0;
			val.willGetClaimedByDMCA = false;
			val.thirdPerson = true;
			return val;
		}

		public override void SpawnProps(BoneMapper mapper)
		{
		}
	}
	public class ClapHandler : MonoBehaviour
	{
		public BoneMapper mapper;

		public float time = 0f;

		public string animation;

		private void Start()
		{
			((MonoBehaviour)this).StartCoroutine(YellAfterTime());
		}

		private IEnumerator YellAfterTime()
		{
			yield return (object)new WaitForEndOfFrame();
			yield return (object)new WaitForSeconds(time);
			if (CustomEmotesAPI.localMapper.isServer)
			{
				CustomEmotesAPI.PlayAnimation(animation, mapper, -2);
			}
		}

		internal IEnumerator SpawnClapFXAfterTime(float time, BoneMapper mapper)
		{
			yield return (object)new WaitForSeconds(time);
			SpawnFX(mapper);
		}

		internal void SpawnFX(BoneMapper mapper)
		{
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e6: Unknown result type (might be due to invalid IL or missing references)
			int count = mapper.props.Count;
			mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("Emotes/xQcClap/VFX/ClapHandFX2.prefab")));
			mapper.props[count].transform.SetParent(mapper.basePlayerModelSMR[0].bones[3]);
			mapper.props[count].transform.localPosition = new Vector3(-0.02f, -0.125f, 0.58f);
			count = mapper.props.Count;
			mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("Emotes/xQcClap/VFX/WorbleCylinder.prefab")));
			mapper.props[count].transform.SetParent(mapper.basePlayerModelSMR[0].bones[3]);
			mapper.props[count].transform.localPosition = new Vector3(-0.02f, -0.125f, 0.58f);
		}

		public void Setup(BoneMapper mapper, float time, string animation)
		{
			this.mapper = mapper;
			this.time = time;
			this.animation = "com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__" + animation;
		}
	}
	public class xQcEmote : AbstractEmote
	{
		public override string AnimationClipName => "xqc_clap_start";

		public override CustomEmoteParams GetClipParams()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			CustomEmoteParams val = new CustomEmoteParams();
			val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/xQcClap/" + AnimationClipName + ".anim") };
			val.secondaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/xQcClap/xqc_clap_loop.anim") };
			val.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Emotes/xQcClap/Audio/xqc_wow.ogg") };
			val.secondaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Emotes/xQcClap/Audio/xqc_claploop.ogg") };
			val.audioLoops = true;
			val.syncAnim = false;
			val.syncAudio = false;
			val.displayName = "xQc Clap";
			val.lockType = (LockType)2;
			val.willGetClaimedByDMCA = false;
			val.thirdPerson = false;
			val.rootBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[2]
			{
				(HumanBodyBones)2,
				(HumanBodyBones)1
			};
			val.soloBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[2]
			{
				default(HumanBodyBones),
				(HumanBodyBones)7
			};
			val.useLocalTransforms = true;
			val.audioLevel = 1f;
			return val;
		}

		public override void SpawnProps(BoneMapper mapper)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			GameObject val = new GameObject();
			ClapHandler clapHandler = val.AddComponent<ClapHandler>();
			clapHandler.Setup(mapper, Random.Range(3f, 7f), "xQcYellAtSky");
			val.transform.SetParent(((Component)mapper).transform, false);
			mapper.props.Add(val);
			((MonoBehaviour)clapHandler).StartCoroutine(clapHandler.SpawnClapFXAfterTime(2f, mapper));
		}
	}
	public class xQcEmote_clap : AbstractEmote
	{
		public override string AnimationClipName => "xqc_clap_loop";

		public override CustomEmoteParams GetClipParams()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			CustomEmoteParams val = new CustomEmoteParams();
			val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/xQcClap/xqc_clap_loop.anim") };
			val.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Emotes/xQcClap/Audio/xqc_claploop.ogg") };
			val.audioLoops = true;
			val.syncAnim = false;
			val.syncAudio = false;
			val.displayName = "xQc Clap";
			val.visible = false;
			val.lockType = (LockType)1;
			val.willGetClaimedByDMCA = false;
			val.thirdPerson = false;
			val.rootBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[2]
			{
				(HumanBodyBones)2,
				(HumanBodyBones)1
			};
			val.soloBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[3]
			{
				default(HumanBodyBones),
				(HumanBodyBones)7,
				(HumanBodyBones)10
			};
			val.useLocalTransforms = true;
			val.audioLevel = 1f;
			val.emoteToPlayOnJoin = "com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__xqc_clap_start";
			return val;
		}

		public override void SpawnProps(BoneMapper mapper)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Expected O, but got Unknown
			if (mapper.prevClipName != "com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__xQcYellAtSky")
			{
				if (CustomEmotesAPI.localMapper.isServer)
				{
					CustomEmotesAPI.PlayAnimation("com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__xqc_clap_start", mapper, -2);
				}
				return;
			}
			GameObject val = new GameObject();
			ClapHandler clapHandler = val.AddComponent<ClapHandler>();
			float time = ((Random.Range(0, 10) >= 4) ? Random.Range(3f, 7f) : Random.Range(0.075f, 0.2f));
			clapHandler.Setup(mapper, time, "xQcYellAtSky");
			val.transform.SetParent(((Component)mapper).transform, false);
			mapper.props.Add(val);
			clapHandler.SpawnFX(mapper);
		}
	}
	public class xQcEmote_yell : AbstractEmote
	{
		public override string AnimationClipName => "xQcYellAtSky";

		public override CustomEmoteParams GetClipParams()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			CustomEmoteParams val = new CustomEmoteParams();
			val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/xQcClap/Animations/" + AnimationClipName + ".anim") };
			val.secondaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/xQcClap/xqc_clap_loop.anim") };
			val.primaryAudioClips = (AudioClip[])(object)new AudioClip[3]
			{
				Assets.Load<AudioClip>("Emotes/xQcClap/Audio/ahhhh2.ogg"),
				Assets.Load<AudioClip>("Emotes/xQcClap/Audio/ahhhh3.ogg"),
				Assets.Load<AudioClip>("Emotes/xQcClap/Audio/ahhhh4.ogg")
			};
			val.secondaryAudioClips = (AudioClip[])(object)new AudioClip[3]
			{
				Assets.Load<AudioClip>("Emotes/xQcClap/Audio/xqc_claploop.ogg"),
				Assets.Load<AudioClip>("Emotes/xQcClap/Audio/xqc_claploop.ogg"),
				Assets.Load<AudioClip>("Emotes/xQcClap/Audio/xqc_claploop.ogg")
			};
			val.audioLoops = false;
			val.syncAnim = false;
			val.syncAudio = false;
			val.displayName = "xQc Clap";
			val.visible = false;
			val.lockType = (LockType)1;
			val.willGetClaimedByDMCA = false;
			val.thirdPerson = false;
			val.rootBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[2]
			{
				(HumanBodyBones)2,
				(HumanBodyBones)1
			};
			val.soloBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[3]
			{
				default(HumanBodyBones),
				(HumanBodyBones)7,
				(HumanBodyBones)10
			};
			val.useLocalTransforms = true;
			val.audioLevel = 1f;
			val.emoteToPlayOnJoin = "com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__xqc_clap_start";
			return val;
		}

		public override void SpawnProps(BoneMapper mapper)
		{
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			if (mapper.prevClipName != "com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__xqc_clap_start" && mapper.prevClipName != "com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__xqc_clap_loop")
			{
				if (CustomEmotesAPI.localMapper.isServer)
				{
					CustomEmotesAPI.PlayAnimation("com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__xqc_clap_start", mapper, -2);
				}
			}
			else
			{
				GameObject val = new GameObject();
				ClapHandler clapHandler = val.AddComponent<ClapHandler>();
				clapHandler.Setup(mapper, Random.Range(0.15f, 0.2f), "xqc_clap_loop");
				val.transform.SetParent(((Component)mapper).transform, false);
				mapper.props.Add(val);
			}
		}
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.Emotes.Phone
{
	[DefaultExecutionOrder(3)]
	public class ArmFixer : MonoBehaviour
	{
		public Transform emoteArm;

		public Transform realArm;

		private Vector3 desiredPos;

		private Quaternion desiredRot;

		public void Setup(Transform emoteArm, Transform realArm)
		{
			this.emoteArm = emoteArm;
			this.realArm = realArm;
		}

		private void Update()
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: 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)
			desiredPos = realArm.position;
			desiredRot = realArm.rotation;
		}

		private void LateUpdate()
		{
			//IL_0008: 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)
			emoteArm.position = desiredPos;
			emoteArm.rotation = desiredRot;
		}
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.Emotes.Megaman
{
	public class LightsCameraActionEmote : AbstractEmote
	{
		internal static List<BoneMapper> flatMappers = new List<BoneMapper>();

		public override string AnimationClipName => "LightsCameraActionStart";

		public override CustomEmoteParams GetClipParams()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			CustomEmoteParams val = new CustomEmoteParams();
			val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/LightsCameraAction/" + AnimationClipName + ".anim") };
			val.secondaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/LightsCameraAction/LightsCameraActionLoop.anim") };
			val.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Emotes/LightsCameraAction/LightsCameraActionStart.ogg") };
			val.secondaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Emotes/LightsCameraAction/LightsCameraActionLoop.ogg") };
			val.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Emotes/LightsCameraAction/LightsCameraActionStart.ogg") };
			val.secondaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Emotes/LightsCameraAction/LightsCameraActionLoop.ogg") };
			val.audioLoops = true;
			val.syncAnim = true;
			val.syncAudio = true;
			val.displayName = "Lights Camera Action";
			val.lockType = (LockType)1;
			val.willGetClaimedByDMCA = false;
			val.thirdPerson = true;
			return val;
		}

		internal static IEnumerator FinishPropAfterFrame(BoneMapper mapper)
		{
			yield return (object)new WaitForEndOfFrame();
			((Component)mapper.basePlayerModelAnimator).gameObject.transform.localScale = new Vector3(((Component)mapper.basePlayerModelAnimator).gameObject.transform.localScale.x, 0.001f, ((Component)mapper.basePlayerModelAnimator).gameObject.transform.localScale.z);
			if (!mapper.isEnemy)
			{
				if (CustomEmotesAPI.ModelReplacementAPIPresent)
				{
					ModelReplacementAPICompat.ChangeModelScale(makeNormal: false, mapper.playerController);
				}
				if (CustomEmotesAPI.VRMPresent)
				{
					LethalVRMCompat.ChangeModelScale(makeNormal: false, mapper.playerController);
				}
			}
		}

		public override void SpawnProps(BoneMapper mapper)
		{
			((MonoBehaviour)mapper).StartCoroutine(FlattenAfterFrame(mapper));
		}

		private IEnumerator FlattenAfterFrame(BoneMapper mapper)
		{
			yield return (object)new WaitForEndOfFrame();
			GameObject g = new GameObject();
			mapper.props.Add(g);
			g.AddComponent<UnFlattener>().mapper = mapper;
			if (mapper.local && CustomEmotesAPI.hudAnimator != null)
			{
				((Component)CustomEmotesAPI.hudAnimator).transform.localScale = new Vector3(1f, 0.001f, 1f);
			}
			((Component)mapper).transform.localScale = new Vector3(((Component)mapper).transform.localScale.x, ((Component)mapper).transform.localScale.y, ((Component)mapper).transform.localScale.x * 0.001f);
			((MonoBehaviour)mapper).StartCoroutine(FinishPropAfterFrame(mapper));
			if (!LcEmotes2AndKnucklesFeaturingDantePlugin.watermarkRemoverPresent || !WatermarkCompaty.CantHaveWatermark())
			{
				int propIndex2 = mapper.props.Count;
				mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("Emotes/LightsCameraAction/Watermark.prefab")));
				mapper.props[propIndex2].transform.localScale = new Vector3(0.6f, 0.6f, 0.6f);
				WatermarkComponent rot2 = mapper.props[propIndex2].AddComponent<WatermarkComponent>();
				rot2.target = mapper.mapperBody.transform;
				rot2.trackedBone = mapper.emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)7);
				rot2.multiplier = 0.001f;
				rot2.player = mapper.playerController;
				propIndex2 = mapper.props.Count;
				mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("Emotes/LightsCameraAction/Watermark.prefab")));
				mapper.props[propIndex2].transform.localScale = new Vector3(0.6f, 0.6f, 0.6f);
				rot2 = mapper.props[propIndex2].AddComponent<WatermarkComponent>();
				rot2.target = mapper.mapperBody.transform;
				rot2.trackedBone = mapper.emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)7);
				rot2.multiplier = -0.005f;
				rot2.player = mapper.playerController;
			}
		}
	}
	public class MegamanEmote : AbstractEmote
	{
		public override string AnimationClipName => "Window1";

		public override CustomEmoteParams GetClipParams()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			CustomEmoteParams val = new CustomEmoteParams();
			val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/JermaWindow/" + AnimationClipName + ".anim") };
			val.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Emotes/Megaman/Megaman-mariogalaxy.ogg") };
			val.audioLoops = true;
			val.syncAnim = true;
			val.syncAudio = true;
			val.displayName = "Money Smart";
			val.lockType = (LockType)3;
			val.willGetClaimedByDMCA = false;
			val.thirdPerson = false;
			return val;
		}

		public override void SpawnProps(BoneMapper mapper)
		{
		}
	}
	public class PhoneEmote : AbstractEmote
	{
		internal static List<BoneMapper> flatMappers = new List<BoneMapper>();

		internal static List<VideoClip> videoClips = new List<VideoClip>(5)
		{
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/SubwaySurfers.mp4"),
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/MinecraftParkour.webm"),
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/FamilyGuy.mp4"),
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/Satisfying.mp4"),
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/SliceIt.webm")
		};

		internal static List<VideoClip> easterEggVideoClips = new List<VideoClip>(9)
		{
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/BadShrekle.webm"),
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/GreyLeno.webm"),
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/KoopaCape.mp4"),
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/Lifesaver.mp4"),
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/Megaman.mp4"),
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/True.mp4"),
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/oldspice.webm"),
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/octagon.webm"),
			Assets.Load<VideoClip>("Emotes/BoringAhhGame/kitchengun.webm")
		};

		public override string AnimationClipName => "phone_start";

		public override CustomEmoteParams GetClipParams()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			CustomEmoteParams val = new CustomEmoteParams();
			val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/BoringAhhGame/" + AnimationClipName + ".anim") };
			val.secondaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/BoringAhhGame/phone_loop.anim") };
			val.displayName = "Boring Ahh Game";
			val.lockType = (LockType)1;
			val.useLocalTransforms = true;
			HumanBodyBones[] array = new HumanBodyBones[4];
			RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			val.rootBonesToIgnore = (HumanBodyBones[])(object)array;
			HumanBodyBones[] array2 = new HumanBodyBones[4];
			RuntimeHelpers.InitializeArray(array2, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
			val.soloBonesToIgnore = (HumanBodyBones[])(object)array2;
			return val;
		}

		public override void SpawnProps(BoneMapper mapper)
		{
			//IL_00af: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ef: Unknown result type (might be due to invalid IL or missing references)
			int count = mapper.props.Count;
			mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("Emotes/BoringAhhGame/iphone4.prefab")));
			GameObject val = mapper.props[count];
			Transform val2 = mapper.mapperBody.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/shoulder.L/arm.L_upper/arm.L_lower/hand.L");
			if (val2 == null)
			{
				BoneRef component = ((Component)mapper.emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)17)).GetComponent<BoneRef>();
				if (component != null)
				{
					val.transform.parent = component.target;
				}
			}
			else
			{
				val.transform.parent = val2;
			}
			val.transform.localEulerAngles = new Vector3(1f, 90f, 255f);
			val.transform.localPosition = new Vector3(-0.0127f, 0.0964f, -0.0436f);
			val.transform.localScale = new Vector3(0.065f, 0.065f, 0.065f);
			val.GetComponentInChildren<VideoPlayer>().SetTargetAudioSource((ushort)0, mapper.personalAudioSource);
			((MonoBehaviour)mapper).StartCoroutine(stopDoingThat(mapper));
			if (CustomEmotesAPI.localMapper.isServer)
			{
				Emotes2Networking.instance.SyncRandomVideoToClientRpc(mapper.mapperBody.GetComponent<NetworkObject>().NetworkObjectId, Random.Range(0, videoClips.Count), Random.Range(0, easterEggVideoClips.Count), Random.Range(0, 100), Random.Range(0f, 1f));
			}
		}

		private IEnumerator stopDoingThat(BoneMapper mapper)
		{
			yield return (object)new WaitForEndOfFrame();
			yield return (object)new WaitForEndOfFrame();
			foreach (EmoteConstraint item in mapper.itemHolderConstraints)
			{
				item.DeactivateConstraints();
			}
		}
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.Emotes.LightsCameraAction
{
	internal class LethalVRMCompat
	{
		internal static Dictionary<PlayerControllerB, LethalVRMInstance> playersToVRMInstances = new Dictionary<PlayerControllerB, LethalVRMInstance>();

		internal static LethalVRMManager iWantToSeeYourManager;

		internal static void SetManager()
		{
			if (iWantToSeeYourManager == null)
			{
				LethalVRMManager[] array = Resources.FindObjectsOfTypeAll(typeof(LethalVRMManager)) as LethalVRMManager[];
				foreach (LethalVRMManager val in array)
				{
					iWantToSeeYourManager = val;
				}
			}
		}

		internal static void GetPlayerInDictionary(PlayerControllerB player)
		{
			if (iWantToSeeYourManager == null || playersToVRMInstances.ContainsKey(player))
			{
				return;
			}
			foreach (LethalVRMInstance instance in iWantToSeeYourManager.instances)
			{
				if ((Object)(object)instance.PlayerControllerB == (Object)(object)player)
				{
					playersToVRMInstances.Add(instance.PlayerControllerB, instance);
				}
			}
		}

		internal static LethalVRMInstance PerformAllChecks(PlayerControllerB player)
		{
			SetManager();
			GetPlayerInDictionary(player);
			if (playersToVRMInstances.ContainsKey(player))
			{
				return playersToVRMInstances[player];
			}
			return null;
		}

		internal static GameObject ChangeModelScale(bool makeNormal, PlayerControllerB player)
		{
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: 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_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			LethalVRMInstance val = PerformAllChecks(player);
			if (val != null)
			{
				if (makeNormal)
				{
					if (playersToVRMInstances.ContainsKey(player))
					{
						playersToVRMInstances.Remove(player);
					}
					((Component)val.Vrm10Instance).transform.localScale = new Vector3(((Component)val.Vrm10Instance).transform.localScale.z, ((Component)val.Vrm10Instance).transform.localScale.y, ((Component)val.Vrm10Instance).transform.localScale.z);
				}
				else
				{
					if (!playersToVRMInstances.ContainsKey(player))
					{
						playersToVRMInstances.Add(player, val);
					}
					((Component)val.Vrm10Instance).transform.localScale = new Vector3(0.001f, ((Component)val.Vrm10Instance).transform.localScale.y, ((Component)val.Vrm10Instance).transform.localScale.z);
				}
				return ((Component)val.Vrm10Instance).gameObject;
			}
			return null;
		}

		internal static void UpdateModelRotation(PlayerControllerB player)
		{
			//IL_0022: 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_003b: Unknown result type (might be due to invalid IL or missing references)
			LethalVRMInstance val = PerformAllChecks(player);
			if (val != null)
			{
				((Component)val.Vrm10Instance).transform.eulerAngles = ((Component)player).transform.eulerAngles + new Vector3(0f, 90f, 0f);
			}
		}

		internal static void RemovePlayerFromPool(PlayerControllerB player)
		{
			playersToVRMInstances.Remove(player);
		}
	}
	internal class ModelReplacementAPICompat
	{
		internal static Dictionary<PlayerControllerB, BodyReplacementBase> playersToBodies = new Dictionary<PlayerControllerB, BodyReplacementBase>();

		internal static GameObject ChangeModelScale(bool makeNormal, PlayerControllerB player)
		{
			//IL_00d0: 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_00ef: 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_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: 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)
			BodyReplacementBase val = default(BodyReplacementBase);
			ModelReplacementAPI.GetPlayerModelReplacement(player, ref val);
			if (val != null)
			{
				if (makeNormal)
				{
					if (playersToBodies.ContainsKey(player))
					{
						playersToBodies.Remove(player);
					}
					val.replacementModel.transform.localScale = new Vector3(val.replacementModel.transform.localScale.z, val.replacementModel.transform.localScale.y, val.replacementModel.transform.localScale.z);
				}
				else
				{
					if (!playersToBodies.ContainsKey(player))
					{
						playersToBodies.Add(player, val);
					}
					val.replacementModel.transform.localScale = new Vector3(0.001f, val.replacementModel.transform.localScale.y, val.replacementModel.transform.localScale.z);
				}
				return val.replacementModel;
			}
			return null;
		}

		internal static void UpdateModelRotation(PlayerControllerB player)
		{
			//IL_002c: 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)
			if (playersToBodies.ContainsKey(player))
			{
				playersToBodies[player].replacementModel.transform.eulerAngles = ((Component)player).transform.eulerAngles + new Vector3(0f, 90f, 0f);
			}
		}

		internal static void RemovePlayerFromPool(PlayerControllerB player)
		{
			playersToBodies.Remove(player);
		}
	}
	internal class UnFlattener : MonoBehaviour
	{
		public BoneMapper mapper;

		private void OnDestroy()
		{
			//IL_002b: 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_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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)
			//IL_0103: 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_00b7: Unknown result type (might be due to invalid IL or missing references)
			((Component)mapper.basePlayerModelAnimator).gameObject.transform.localScale = new Vector3(((Component)mapper.basePlayerModelAnimator).gameObject.transform.localScale.x, ((Component)mapper.basePlayerModelAnimator).gameObject.transform.localScale.x, ((Component)mapper.basePlayerModelAnimator).gameObject.transform.localScale.z);
			if (mapper.local && CustomEmotesAPI.hudAnimator != null)
			{
				((Component)CustomEmotesAPI.hudAnimator).transform.localScale = new Vector3(1f, 1f, 1f);
			}
			((Component)mapper).transform.localScale = new Vector3(((Component)mapper).transform.localScale.x, ((Component)mapper).transform.localScale.y, ((Component)mapper).transform.localScale.x);
			if (CustomEmotesAPI.ModelReplacementAPIPresent && !mapper.isEnemy)
			{
				ModelReplacementAPICompat.ChangeModelScale(makeNormal: true, mapper.playerController);
			}
			if (CustomEmotesAPI.VRMPresent && !mapper.isEnemy)
			{
				LethalVRMCompat.ChangeModelScale(makeNormal: true, mapper.playerController);
			}
		}
	}
	internal class WatermarkCompaty
	{
		internal static bool CantHaveWatermark()
		{
			return LiquidStainRemoverPlugin.disableMiscChanges.Value;
		}
	}
	internal class WatermarkComponent : MonoBehaviour
	{
		internal Transform target;

		internal Transform trackedBone;

		internal PlayerControllerB player;

		internal float multiplier;

		private void Update()
		{
			//IL_000d: 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_002d: 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_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cc: 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)
			((Component)this).transform.eulerAngles = new Vector3(target.eulerAngles.x, target.eulerAngles.y, trackedBone.eulerAngles.z) + new Vector3(0f, 180f, 0f);
			Transform transform = ((Component)this).transform;
			Transform obj = trackedBone;
			Vector3 position = (obj.position += new Vector3(((Component)target).transform.forward.x * multiplier, ((Component)target).transform.forward.y * multiplier, ((Component)target).transform.forward.z * multiplier));
			transform.position = position;
			if (player != null)
			{
				if (CustomEmotesAPI.ModelReplacementAPIPresent)
				{
					ModelReplacementAPICompat.UpdateModelRotation(player);
				}
				if (CustomEmotesAPI.VRMPresent)
				{
					LethalVRMCompat.UpdateModelRotation(player);
				}
			}
		}
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.Emotes.JermaWindow
{
	[DefaultExecutionOrder(-20)]
	internal class CameraLocker : MonoBehaviour
	{
		internal Camera cam;

		private void LateUpdate()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			((Component)cam).transform.localEulerAngles = Vector3.zero;
		}
	}
	public class JermaWindow : AbstractEmote
	{
		public static List<int> props = new List<int>();

		public override string AnimationClipName => "jermaWindow";

		public override CustomEmoteParams GetClipParams()
		{
			//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_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Expected O, but got Unknown
			return new CustomEmoteParams
			{
				internalName = "jermaWindow",
				displayName = "Jerma Window"
			};
		}

		public override void SpawnProps(BoneMapper mapper)
		{
			//IL_0087: 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_00a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
			if (!CustomEmotesAPI.localMapper.isServer)
			{
				return;
			}
			foreach (WindowHandler allInactiveWindow in WindowHandler.allInactiveWindows)
			{
				if ((Object)(object)allInactiveWindow.owner == (Object)(object)mapper)
				{
					Object.Destroy((Object)(object)((Component)allInactiveWindow).gameObject);
				}
			}
			GameObject val = CustomEmotesAPI.SpawnWorldProp(props[0]);
			val.transform.position = mapper.mapperBody.transform.position;
			Transform transform = val.transform;
			transform.position += mapper.mapperBody.transform.forward * 2f;
			val.transform.eulerAngles = mapper.mapperBody.transform.eulerAngles + new Vector3(0f, 180f, 0f);
			val.GetComponent<WindowHandler>().owner = mapper;
			val.GetComponent<NetworkObject>().Spawn(false);
			if (((Object)mapper.mapperBodyTransform.parent).name == "HangarShip")
			{
				val.transform.SetParent(mapper.mapperBodyTransform.parent);
			}
		}
	}
	public class JermaWindowFall : AbstractEmote
	{
		public static List<int> props = new List<int>();

		public override string AnimationClipName => "falling";

		public override CustomEmoteParams GetClipParams()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			CustomEmoteParams val = new CustomEmoteParams();
			val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/JermaWindow/" + AnimationClipName + ".anim") };
			val.displayName = "Jerma Window";
			val.lockType = (LockType)3;
			val.willGetClaimedByDMCA = false;
			val.preventMovement = true;
			val.allowJoining = false;
			val.visible = false;
			return val;
		}

		public override void SpawnProps(BoneMapper mapper)
		{
		}
	}
	public class JermaWindowJump : AbstractEmote
	{
		public static List<int> props = new List<int>();

		public override string AnimationClipName => "Window1";

		public override CustomEmoteParams GetClipParams()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			CustomEmoteParams val = new CustomEmoteParams();
			val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/JermaWindow/" + AnimationClipName + ".anim") };
			val.primaryAudioClips = (AudioClip[])(object)new AudioClip[5]
			{
				Assets.Load<AudioClip>("Emotes/JermaWindow/Shatter1.ogg"),
				Assets.Load<AudioClip>("Emotes/JermaWindow/Shatter2.ogg"),
				Assets.Load<AudioClip>("Emotes/JermaWindow/Shatter3.ogg"),
				Assets.Load<AudioClip>("Emotes/JermaWindow/Shatter4.ogg"),
				Assets.Load<AudioClip>("Emotes/JermaWindow/Shatter5.ogg")
			};
			val.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[5]
			{
				Assets.Load<AudioClip>("Emotes/JermaWindow/Shatter1.ogg"),
				Assets.Load<AudioClip>("Emotes/JermaWindow/Shatter2.ogg"),
				Assets.Load<AudioClip>("Emotes/JermaWindow/Shatter3.ogg"),
				Assets.Load<AudioClip>("Emotes/JermaWindow/Shatter4.ogg"),
				Assets.Load<AudioClip>("Emotes/JermaWindow/Shatter5.ogg")
			};
			val.displayName = "Jerma Window";
			val.lockType = (LockType)3;
			val.willGetClaimedByDMCA = false;
			val.preventMovement = true;
			val.allowJoining = false;
			val.visible = false;
			return val;
		}

		public override void SpawnProps(BoneMapper mapper)
		{
			((MonoBehaviour)mapper).StartCoroutine(AddFallCheckerAfterTime(mapper));
		}

		private IEnumerator AddFallCheckerAfterTime(BoneMapper mapper)
		{
			yield return (object)new WaitForSeconds(0.75f);
			GameObject g = new GameObject();
			WindowFallChecker fallChecker = g.AddComponent<WindowFallChecker>();
			fallChecker.bodyPosition = mapper.mapperBodyTransform;
			fallChecker.mapper = mapper;
			mapper.props.Add(g);
		}
	}
	public class JermaWindowLand : AbstractEmote
	{
		public static List<int> props = new List<int>();

		public override string AnimationClipName => "Window1Land";

		public override CustomEmoteParams GetClipParams()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_003d: Unknown result type (might be due to invalid IL or missing references)
			CustomEmoteParams val = new CustomEmoteParams();
			val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/JermaWindow/" + AnimationClipName + ".anim") };
			val.displayName = "Jerma Window";
			val.lockType = (LockType)3;
			val.willGetClaimedByDMCA = false;
			val.preventMovement = true;
			val.allowJoining = false;
			val.visible = false;
			return val;
		}

		public override void SpawnProps(BoneMapper mapper)
		{
		}
	}
	internal class WindowFallChecker : MonoBehaviour
	{
		internal BoneMapper mapper;

		internal Transform bodyPosition;

		private bool falling = false;

		private void Update()
		{
			//IL_0010: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			bool flag = falling;
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(bodyPosition.position, new Vector3(0f, -10f, 0f));
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, ref val2, 10f, 268437761, (QueryTriggerInteraction)1))
			{
				if (flag)
				{
					mapper.PlayAnim("com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__Window1Land", -1);
				}
				return;
			}
			if (!flag)
			{
				mapper.preserveProps = true;
				mapper.PlayAnim("com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__falling", -1);
			}
			falling = true;
		}
	}
	public class WindowHandler : MonoBehaviour, IHittable
	{
		public static List<WindowHandler> allInactiveWindows = new List<WindowHandler>();

		public BoneMapper owner;

		public bool destroying = false;

		private void Start()
		{
			allInactiveWindows.Add(this);
		}

		private void OnDestroy()
		{
			allInactiveWindows.Remove(this);
		}

		private void Update()
		{
			if (destroying)
			{
				owner = null;
			}
		}

		public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false)
		{
			OnHit();
			return true;
		}

		public bool Hit(int force, Vector3 hitDirection, PlayerControllerB playerWhoHit = null, bool playHitSFX = false, int hitID = -1)
		{
			OnHit();
			return true;
		}

		public void OnHit()
		{
			if (!destroying)
			{
				destroying = true;
				Emotes2Networking.instance.SyncGlassBreak(((Component)this).GetComponent<NetworkObject>().NetworkObjectId);
			}
		}

		public void BreakGlass()
		{
			//IL_0014: 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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: Unknown result type (might be due to invalid IL or missing references)
			EmoteLocation componentInChildren = ((Component)this).GetComponentInChildren<EmoteLocation>();
			Transform transform = ((Component)componentInChildren).gameObject.transform;
			transform.localPosition -= new Vector3(5000f, 5000f, 5000f);
			owner = null;
			GameObject val = Object.Instantiate<GameObject>(Assets.Load<GameObject>("Emotes/JermaWindow/WindowShatter.prefab"));
			val.transform.SetParent(((Component)this).transform);
			val.transform.localPosition = Vector3.zero;
			val.transform.localRotation = Quaternion.identity;
			val.transform.localScale = Vector3.one;
			((Component)((Component)this).transform.Find("Glass")).gameObject.SetActive(false);
			((Component)((Component)this).transform.Find("XBeam")).gameObject.SetActive(false);
			((Component)((Component)this).transform.Find("ZBeam")).gameObject.SetActive(false);
			AudioSource component = ((Component)((Component)this).transform.Find("Base")).GetComponent<AudioSource>();
			component.clip = Assets.Load<AudioClip>("Emotes/JermaWindow/Shatter6.ogg");
			component.Play();
			((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(CreateExplosion());
		}

		public IEnumerator CreateExplosion()
		{
			GameObject g2 = Object.Instantiate<GameObject>(Assets.Load<GameObject>("Emotes/JermaWindow/Explosion.prefab"));
			g2.transform.SetParent(((Component)this).transform);
			g2.transform.localPosition = new Vector3(0f, 1.33f, 0f);
			g2.transform.localScale = new Vector3(5f, 5f, 5f);
			g2.transform.SetParent(g2.transform.parent.parent);
			yield return (object)new WaitForSeconds(5f);
			g2.GetComponent<ParticleSystem>().Emit(1);
			g2.GetComponent<AudioSource>().Play();
			((MonoBehaviour)CustomEmotesAPI.localMapper).StartCoroutine(JermaWindowJoinSpot.CleanupExplosion(g2));
			if (CustomEmotesAPI.localMapper.isServer)
			{
				try
				{
					Object.Destroy((Object)(object)((Component)((Component)this).transform).gameObject);
				}
				catch (Exception)
				{
				}
			}
		}
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.Emotes.GoblinPain
{
	public class GoblinPainEmitter : MonoBehaviour
	{
		public ParticleSystem[] goblinParticleEmitter = Array.Empty<ParticleSystem>();

		public float timeBetweenPulse = 0.25f;

		private int _pulseIndex;

		private float _timer;

		private void Update()
		{
			_timer -= Time.unscaledDeltaTime;
			if (!(_timer > 0f))
			{
				_timer = timeBetweenPulse;
				goblinParticleEmitter[_pulseIndex].Play();
				_pulseIndex++;
				if (_pulseIndex >= goblinParticleEmitter.Length)
				{
					_pulseIndex = 0;
				}
			}
		}
	}
	public class GoblinPainEmote : AbstractEmote
	{
		internal static Dictionary<BoneMapper, Transform> mappersPlayingPain = new Dictionary<BoneMapper, Transform>();

		public override string AnimationClipName => "Goblin Pain Emote Scav";

		public override CustomEmoteParams GetClipParams()
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0084: Unknown result type (might be due to invalid IL or missing references)
			CustomEmoteParams val = new CustomEmoteParams();
			val.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Emotes/GoblinPain/" + AnimationClipName + ".anim") };
			val.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Emotes/GoblinPain/goblin-we-like-to-pain.ogg") };
			val.primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Emotes/GoblinPain/goblin-we-like-to-pain.ogg") };
			val.audioLoops = true;
			val.syncAnim = true;
			val.syncAudio = true;
			val.displayName = "Pain";
			val.lockType = (LockType)1;
			val.willGetClaimedByDMCA = false;
			val.thirdPerson = true;
			return val;
		}

		public override void SpawnProps(BoneMapper mapper)
		{
			//IL_00d7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0102: Unknown result type (might be due to invalid IL or missing references)
			int count = mapper.props.Count;
			mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("Emotes/GoblinPain/PainHolder.prefab")));
			mapper.props[count].GetComponentInChildren<PlayableDirector>().time = CustomAnimationClip.syncTimer[mapper.currentClip.syncPos];
			mapper.props[count].GetComponentInChildren<PlayableDirector>().Play();
			mapper.props[count].GetComponentInChildren<TwitchChatController>().ownerPlayer = mapper.playerController;
			mapper.props[count].GetComponentInChildren<TwitchChatDeath>().ownerPlayer = mapper.playerController;
			mapper.props[count].transform.SetParent(mapper.mapperBody.transform);
			mapper.props[count].transform.localEulerAngles = Vector3.zero;
			mapper.props[count].transform.localPosition = new Vector3(0f, 1f, 0f);
			mappersPlayingPain.Add(mapper, mapper.props[count].transform.Find("LyricsHolder"));
			foreach (KeyValuePair<BoneMapper, Transform> item in mappersPlayingPain)
			{
				((Component)item.Value).gameObject.SetActive(false);
			}
			if (mappersPlayingPain.ContainsKey(CustomEmotesAPI.localMapper))
			{
				((Component)mappersPlayingPain[CustomEmotesAPI.localMapper]).gameObject.SetActive(true);
			}
			else
			{
				((Component)mappersPlayingPain.First().Value).gameObject.SetActive(true);
			}
		}
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.Emotes.GoblinPain.Data
{
	public interface ITwitchUsernameProvider
	{
		TwitchUsername GetUsername();
	}
	[CreateAssetMenu(fileName = "RandomTwitchUsernameGenerator", menuName = "Emotes 2/Twitch/Random Username Generator")]
	public class RandomTwitchUsernameGenerator : ScriptableObject, ITwitchUsernameProvider
	{
		[Range(0f, 1f)]
		public float chanceOfNumber = 0.05f;

		public string[] adjectives = Array.Empty<string>();

		public string[] nouns = Array.Empty<string>();

		public string[] verbs = Array.Empty<string>();

		public TwitchUsername GetUsername()
		{
			//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_0037: Unknown result type (might be due to invalid IL or missing references)
			string username = GenerateRandomUsername();
			Color usernameColor = Random.ColorHSV(0f, 1f, 1f, 1f, 1f, 1f, 1f, 1f);
			return new TwitchUsername(username, usernameColor);
		}

		private string GenerateRandomUsername()
		{
			string text = "";
			if (Random.value >= 0.5f)
			{
				text += adjectives[Random.Range(0, adjectives.Length)];
			}
			text += nouns[Random.Range(0, nouns.Length)];
			text += verbs[Random.Range(0, verbs.Length)];
			float value = Random.value;
			if (value >= 0.5f)
			{
				text = text.ToUpper();
			}
			if (value >= 0.75f)
			{
				text = text.ToLower();
			}
			if (Random.value <= chanceOfNumber)
			{
				text += $"{Random.Range(1, 1000)}";
			}
			return text;
		}
	}
	[CreateAssetMenu(fileName = "RandomTwitchUsernameProvider", menuName = "Emotes 2/Twitch/Random Username Provider")]
	public class RandomTwitchUsernameProvider : WeightedRandomData<ScriptableObject>, ITwitchUsernameProvider
	{
		public TwitchUsername GetUsername()
		{
			if (!GetRandomEntry().TryGetValue(out ScriptableObject value))
			{
				return default(TwitchUsername);
			}
			if (!(value is ITwitchUsernameProvider twitchUsernameProvider))
			{
				return default(TwitchUsername);
			}
			return twitchUsernameProvider.GetUsername();
		}
	}
	public readonly struct TwitchUsername
	{
		public readonly string Username;

		public readonly Color UsernameColor;

		public readonly bool HasSpecialMessage;

		public readonly string? SpecialMessage;

		public readonly bool HasPrefabOverride;

		public readonly GameObject? PrefabOverride;

		public TwitchUsername(string username, Color usernameColor, string? specialMessage = null, GameObject? prefabOverride = null)
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			SpecialMessage = null;
			PrefabOverride = null;
			Username = username;
			UsernameColor = usernameColor;
			HasSpecialMessage = !string.IsNullOrWhiteSpace(specialMessage);
			SpecialMessage = specialMessage;
			HasPrefabOverride = prefabOverride != null;
			PrefabOverride = prefabOverride;
		}
	}
	[CreateAssetMenu(fileName = "TwitchUsername", menuName = "Emotes 2/Twitch/Username")]
	public class TwitchUsernameEntry : ScriptableObject, ITwitchUsernameProvider
	{
		public string username = "";

		public Color usernameColor;

		public string specialMessage = "";

		public GameObject? prefabOverride;

		public TwitchUsername GetUsername()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			return new TwitchUsername(username, usernameColor, specialMessage, prefabOverride);
		}
	}
	[CreateAssetMenu(fileName = "TwitchUsernameList", menuName = "Emotes 2/Twitch/Username List")]
	public class TwitchUsernameList : WeightedRandomData<TwitchUsernameEntry>, ITwitchUsernameProvider
	{
		public TwitchUsername GetUsername()
		{
			if (!GetRandomEntry().TryGetValue(out TwitchUsernameEntry value))
			{
				return default(TwitchUsername);
			}
			return value?.GetUsername() ?? default(TwitchUsername);
		}
	}
	[CreateAssetMenu(fileName = "WeightedTwitchUsernameEntry", menuName = "Emotes 2/Twitch/Weighted Username")]
	public class WeightedTwitchUsernameEntry : WeightedEntry<TwitchUsernameEntry>
	{
	}
	[CreateAssetMenu(fileName = "TwitchUsername", menuName = "Emotes 2/Twitch/Weighted Twitch Username Provider Entry")]
	public class WeightedTwitchUsernameProviderEntry : WeightedEntry<ScriptableObject>
	{
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.Emotes.GoblinPain.Chat
{
	public abstract class AbstractChatWidth : MonoBehaviour
	{
		public abstract float GetWidth();

		public abstract void SetXPos(float x);

		public virtual void UpdateState()
		{
		}
	}
	[CreateAssetMenu(fileName = "EmoteEntry", menuName = "Emotes 2/Twitch/Emote Entry")]
	public class ChatEmoteEntry : ScriptableObject
	{
		public string emoteName = "";

		public GameObject? prefab;
	}
	[CreateAssetMenu(fileName = "ChatEmoteList", menuName = "Emotes 2/Twitch/Chat Emote List")]
	public class ChatEmoteList : ScriptableObject
	{
		public ChatEmoteEntry[] emoteEntries = Array.Empty<ChatEmoteEntry>();

		private readonly Dictionary<string, GameObject?> _emoteLut = new Dictionary<string, GameObject>();

		private string[]? _emoteNames;

		private string[]? _emoteKeys;

		public string[] EmoteNames
		{
			get
			{
				if (_emoteNames != null)
				{
					return _emoteNames;
				}
				_emoteNames = new string[emoteEntries.Length];
				for (int i = 0; i < _emoteNames.Length; i++)
				{
					_emoteNames[i] = emoteEntries[i].emoteName;
				}
				return _emoteNames;
			}
		}

		public string[] EmoteKeys
		{
			get
			{
				if (_emoteKeys != null)
				{
					return _emoteKeys;
				}
				_emoteKeys = new string[emoteEntries.Length];
				for (int i = 0; i < _emoteKeys.Length; i++)
				{
					_emoteKeys[i] = ":" + emoteEntries[i].emoteName + ":";
				}
				return _emoteKeys;
			}
		}

		public GameObject? this[string emoteName] => CollectionExtensions.GetValueOrDefault(_emoteLut, emoteName);

		private void Awake()
		{
			_emoteLut.Clear();
			ChatEmoteEntry[] array = emoteEntries;
			foreach (ChatEmoteEntry chatEmoteEntry in array)
			{
				_emoteLut[chatEmoteEntry.emoteName] = chatEmoteEntry.prefab;
			}
		}
	}
	public class ChatEmoteWidth : AbstractChatWidth
	{
		public float width;

		public override float GetWidth()
		{
			return width;
		}

		public override void SetXPos(float x)
		{
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0017: 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)
			Transform transform = ((Component)this).transform;
			Vector3 localPosition = transform.localPosition;
			transform.localPosition = new Vector3(x, localPosition.y, localPosition.z);
		}
	}
	[ExecuteAlways]
	public class ChatMessageController : MonoBehaviour
	{
		public TextMeshPro? usernameLabel;

		public Transform? content;

		public GameObject? textPrefab;

		public ChatEmoteList? emoteList;

		public AbstractChatWidth[] chatComponents = Array.Empty<AbstractChatWidth>();

		public bool forceClear;

		private readonly List<AbstractChatWidth> _generatedChatComponents = new List<AbstractChatWidth>();

		public void SetChat(string username, Color usernameColor, string message)
		{
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			if (usernameLabel != null)
			{
				ClearGenerated();
				((TMP_Text)usernameLabel).color = usernameColor;
				((TMP_Text)usernameLabel).text = username;
				GenMessageComponents(message);
				UpdateLayout();
			}
		}

		private void OnDestroy()
		{
			ClearGenerated();
		}

		private void UpdateLayout()
		{
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			float num = 0f;
			AbstractChatWidth[] array = chatComponents;
			foreach (AbstractChatWidth abstractChatWidth in array)
			{
				abstractChatWidth.SetXPos(num);
				num += abstractChatWidth.GetWidth();
				abstractChatWidth.UpdateState();
			}
			foreach (AbstractChatWidth generatedChatComponent in _generatedChatComponents)
			{
				generatedChatComponent.SetXPos(num);
				num += generatedChatComponent.GetWidth();
				generatedChatComponent.UpdateState();
			}
			if (content != null)
			{
				content.localPosition = new Vector3((0f - num) / 2f, 0f, 0f);
			}
		}

		private void ClearGenerated()
		{
			if (forceClear)
			{
				_generatedChatComponents.Clear();
				forceClear = false;
				return;
			}
			foreach (AbstractChatWidth generatedChatComponent in _generatedChatComponents)
			{
				if (generatedChatComponent != null)
				{
					Object.DestroyImmediate((Object)(object)((Component)generatedChatComponent).gameObject, false);
				}
			}
			_generatedChatComponents.Clear();
		}

		private void GenMessageComponents(string message)
		{
			if (content == null || textPrefab == null || emoteList == null)
			{
				return;
			}
			message = ExpandMessageMacros(message);
			string[] array = message.Split(emoteList.EmoteKeys, StringSplitOptions.None);
			List<string> emoteComponents = GetEmoteComponents(message);
			int num = 0;
			string[] array2 = array;
			foreach (string text in array2)
			{
				if (!string.IsNullOrEmpty(text))
				{
					GameObject val = Object.Instantiate<GameObject>(textPrefab, content);
					val.transform.SetAsLastSibling();
					TextMeshProChatWidth component = val.GetComponent<TextMeshProChatWidth>();
					TextMeshPro label = component.label;
					if (label == null)
					{
						break;
					}
					((TMP_Text)label).text = text;
					_generatedChatComponents.Add(component);
				}
				if (num < emoteComponents.Count)
				{
					string emoteName = emoteComponents[num].Replace(":", "");
					num++;
					GameObject val2 = emoteList[emoteName];
					if (val2 != null)
					{
						GameObject val3 = Object.Instantiate<GameObject>(val2, content);
						val2.transform.SetAsLastSibling();
						ChatEmoteWidth component2 = val3.GetComponent<ChatEmoteWidth>();
						_generatedChatComponents.Add(component2);
					}
				}
			}
		}

		private static List<string> GetEmoteComponents(string message)
		{
			List<string> list = new List<string>();
			bool flag = false;
			string text = "";
			for (int i = 0; i < message.Length; i++)
			{
				char c = message[i];
				if (c == ':')
				{
					if (!flag)
					{
						flag = true;
						continue;
					}
					flag = false;
					list.Add(text);
					text = "";
				}
				if (flag)
				{
					text += c;
				}
			}
			return list;
		}

		private static string ExpandMessageMacros(string message)
		{
			if (!message.Contains("["))
			{
				return message;
			}
			string text = "";
			bool flag = false;
			bool flag2 = false;
			string text2 = "";
			int? num = null;
			int? num2 = null;
			string text3 = "";
			for (int i = 0; i < message.Length; i++)
			{
				char c = message[i];
				if (c == '[')
				{
					flag = true;
					num = null;
					num2 = null;
					text2 = "";
				}
				else if (flag)
				{
					switch (c)
					{
					case ',':
					{
						if (!int.TryParse(text2, out var result))
						{
							flag = false;
							continue;
						}
						text2 = "";
						num = result;
						continue;
					}
					case ']':
					{
						if (!int.TryParse(text2, out var result2))
						{
							flag = false;
							continue;
						}
						text2 = "";
						num2 = result2;
						continue;
					}
					case '(':
						if (!flag2 && num.HasValue && num2.HasValue)
						{
							flag2 = true;
							flag = false;
							text3 = "";
							continue;
						}
						break;
					}
					if (!flag2)
					{
						text2 += c;
					}
				}
				else if (flag2 && num.HasValue && num2.HasValue)
				{
					if (c != ')')
					{
						text3 += c;
						continue;
					}
					int num3 = Random.Range(num.Value, num2.Value);
					for (int j = 0; j < num3; j++)
					{
						text += text3;
					}
					flag2 = false;
				}
				else
				{
					text += c;
				}
			}
			return text;
		}
	}
	[ExecuteAlways]
	[RequireComponent(typeof(TextMeshPro))]
	public class TextMeshProChatWidth : AbstractChatWidth
	{
		public TextMeshPro? label;

		public RectTransform? rectTransform;

		public override float GetWidth()
		{
			return TextWidthApproximation() / 10f;
		}

		public override void SetXPos(float x)
		{
			//IL_0019: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			if (rectTransform != null)
			{
				Vector2 anchoredPosition = default(Vector2);
				((Vector2)(ref anchoredPosition))..ctor(x, rectTransform.anchoredPosition.y);
				rectTransform.anchoredPosition = anchoredPosition;
			}
		}

		public override void UpdateState()
		{
			UpdateWidth();
		}

		private void Awake()
		{
			if (rectTransform == null)
			{
				rectTransform = ((Component)this).GetComponent<RectTransform>();
			}
		}

		private void OnEnable()
		{
			if (rectTransform == null)
			{
				rectTransform = ((Component)this).GetComponent<RectTransform>();
			}
			UpdateWidth();
		}

		public void UpdateWidth()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if (rectTransform != null)
			{
				Vector2 sizeDelta = default(Vector2);
				((Vector2)(ref sizeDelta))..ctor(GetWidth(), rectTransform.sizeDelta.y);
				rectTransform.sizeDelta = sizeDelta;
			}
		}

		private float TextWidthApproximation()
		{
			//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)
			//IL_004e: 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_005e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0079: Unknown result type (might be due to invalid IL or missing references)
			//IL_007b: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Invalid comparison between Unknown and I4
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			if (label == null)
			{
				return 0f;
			}
			string text = ((TMP_Text)label).text;
			float fontSize = ((TMP_Text)label).fontSize;
			TMP_FontAsset font = ((TMP_Text)label).font;
			FontStyles fontStyle = ((TMP_Text)label).fontStyle;
			FaceInfo faceInfo = font.faceInfo;
			float num = ((FaceInfo)(ref faceInfo)).pointSize;
			faceInfo = font.faceInfo;
			float num2 = fontSize / (num * ((FaceInfo)(ref faceInfo)).scale);
			float num3 = fontSize * 0.01f;
			float num4 = (((fontStyle & 1) == 1) ? font.boldSpacing : 0f);
			float normalSpacingOffset = font.normalSpacingOffset;
			float num5 = 0f;
			string text2 = text;
			foreach (char key in text2)
			{
				if (font.characterLookupTable.TryGetValue(key, out var value))
				{
					float num6 = num5;
					GlyphMetrics metrics = ((TMP_TextElement)value).glyph.metrics;
					num5 = num6 + (((GlyphMetrics)(ref metrics)).horizontalAdvance * num2 + (num4 + normalSpacingOffset) * num3);
				}
			}
			return num5;
		}
	}
	public class TwitchAlertMonitor : MonoBehaviour
	{
		public TwitchChatController? chatController;

		private IEnumerator? _stopAlertCoroutine;

		private void Awake()
		{
			GameEventBus.OnRadiationWarningHUD += OnRadiationWarning;
		}

		private void OnDestroy()
		{
			GameEventBus.OnRadiationWarningHUD -= OnRadiationWarning;
		}

		private void OnRadiationWarning()
		{
			if (chatController != null)
			{
				chatController.alertActive = true;
				if (_stopAlertCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(_stopAlertCoroutine);
					_stopAlertCoroutine = null;
				}
				_stopAlertCoroutine = StopAlert();
				((MonoBehaviour)this).StartCoroutine(_stopAlertCoroutine);
			}
		}

		private IEnumerator StopAlert()
		{
			yield return (object)new WaitForSeconds(5f);
			if (chatController != null)
			{
				chatController.alertActive = false;
			}
		}
	}
	public class TwitchChatController : MonoBehaviour
	{
		public GameObject? chatPrefab;

		public PlayerControllerB? ownerPlayer;

		public float timeBetweenPulses = 0.25f;

		public RandomTwitchUsernameProvider? twitchUsernameProvider;

		public float[] weights = Array.Empty<float>();

		public string[] messages = Array.Empty<string>();

		[Range(0f, 1f)]
		public float fearFactor = 0f;

		public float fearWeight = 160f;

		public int[] fearIndices = Array.Empty<int>();

		public bool alertActive = false;

		public float alertWeight = 100f;

		public int[] alertIndices = Array.Empty<int>();

		private float _timer;

		private void Update()
		{
			_timer -= Time.unscaledDeltaTime;
			if (!(_timer > 0f))
			{
				_timer = timeBetweenPulses;
				if (ownerPlayer != null)
				{
					fearFactor = ownerPlayer.playersManager.fearLevel;
				}
				SpawnChatMessage();
			}
		}

		private void SpawnChatMessage()
		{
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: 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_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_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_003d: 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_00be: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: 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)
			//IL_011c: Unknown result type (might be due to invalid IL or missing references)
			if (twitchUsernameProvider != null)
			{
				Vector3 val = Vector3.zero;
				if (ownerPlayer != null)
				{
					val = ownerPlayer.thisController.velocity;
				}
				Vector3 val2 = ((Component)this).transform.position + val + Random.insideUnitSphere * Random.Range(2f, 6f);
				TwitchUsername username = twitchUsernameProvider.GetUsername();
				GameObject val3 = ((!username.HasPrefabOverride || username.PrefabOverride == null) ? Object.Instantiate<GameObject>(chatPrefab, val2, Quaternion.AngleAxis(0f, Vector3.up)) : Object.Instantiate<GameObject>(username.PrefabOverride, val2, Quaternion.AngleAxis(0f, Vector3.up)));
				if (val3 != null)
				{
					ChatMessageController component = val3.GetComponent<ChatMessageController>();
					component.SetChat(message: (!username.HasSpecialMessage || string.IsNullOrWhiteSpace(username.SpecialMessage)) ? GetRandomMessage() : username.SpecialMessage, username: username.Username, usernameColor: username.UsernameColor);
				}
			}
		}

		private string GetRandomMessage()
		{
			if (weights.Length != messages.Length)
			{
				return "";
			}
			if (weights.Length == 0)
			{
				return "";
			}
			float num = 0f;
			for (int i = 0; i < weights.Length; i++)
			{
				float num2 = weights[i];
				if (float.IsPositiveInfinity(num2))
				{
					return messages[i];
				}
				if (num2 >= 0f && !float.IsNaN(num2))
				{
					num += num2;
				}
			}
			float value = Random.value;
			float num3 = 0f;
			for (int j = 0; j < weights.Length; j++)
			{
				float num4 = weights[j];
				if (!float.IsNaN(num4) && !(num4 <= 0f))
				{
					num3 += num4 / num;
					if (num3 >= value)
					{
						return messages[j];
					}
				}
			}
			return "";
		}
	}
	public class TwitchChatDeath : MonoBehaviour
	{
		public PlayerControllerB? ownerPlayer;

		public GameObject? deadPrefab;

		private float timer = 0f;

		private Vector3 desiredPostion;

		private void Update()
		{
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			timer += Time.deltaTime;
			if (timer > 0.5f && ownerPlayer != null && !ownerPlayer.isPlayerDead)
			{
				timer = 0f;
				desiredPostion = ((Component)this).transform.position;
			}
		}

		private void OnDestroy()
		{
			//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)
			if (deadPrefab != null && ownerPlayer != null && ownerPlayer.isPlayerDead)
			{
				Object.Instantiate<GameObject>(deadPrefab, desiredPostion, Quaternion.AngleAxis(0f, Vector3.up));
			}
		}
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.Emotes.GoblinPain.Chat.Timeline
{
	public class TwitchChatControlAsset : PlayableAsset, ITimelineClipAsset
	{
		public float[] weights = Array.Empty<float>();

		public string[] messages = Array.Empty<string>();

		public ClipCaps clipCaps => (ClipCaps)16;

		public override Playable CreatePlayable(PlayableGraph graph, GameObject owner)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: 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_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Unknown result type (might be due to invalid IL or missing references)
			ScriptPlayable<TwitchChatControllerBehaviour> val = ScriptPlayable<TwitchChatControllerBehaviour>.Create(graph, 0);
			TwitchChatControllerBehaviour behaviour = val.GetBehaviour();
			behaviour.weights = weights.Copy();
			return ScriptPlayable<TwitchChatControllerBehaviour>.op_Implicit(val);
		}
	}
	public class TwitchChatControllerBehaviour : PlayableBehaviour
	{
		public float[] weights = Array.Empty<float>();
	}
	public class TwitchChatControllerMixerBehaviour : PlayableBehaviour
	{
		public override void ProcessFrame(Playable playable, FrameData info, object playerData)
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: 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)
			//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)
			if (!(playerData is TwitchChatController twitchChatController))
			{
				return;
			}
			int[] fearIndices = twitchChatController.fearIndices;
			int[] alertIndices = twitchChatController.alertIndices;
			float[] array = new float[twitchChatController.weights.Length];
			int inputCount = PlayableExtensions.GetInputCount<Playable>(playable);
			for (int i = 0; i < inputCount; i++)
			{
				float inputWeight = PlayableExtensions.GetInputWeight<Playable>(playable, i);
				TwitchChatControllerBehaviour behaviour = ((ScriptPlayable<TwitchChatControllerBehaviour>)PlayableExtensions.GetInput<Playable>(playable, i)).GetBehaviour();
				for (int j = 0; j < array.Length; j++)
				{
					if (!fearIndices.Contains(j) && !alertIndices.Contains(j))
					{
						array[j] += behaviour.weights[j] * inputWeight;
					}
				}
				int[] fearIndices2 = twitchChatController.fearIndices;
				foreach (int num in fearIndices2)
				{
					array[num] += twitchChatController.fearWeight * inputWeight * twitchChatController.fearFactor;
				}
				float num2 = (twitchChatController.alertActive ? 1f : 0f);
				int[] alertIndices2 = twitchChatController.alertIndices;
				foreach (int num3 in alertIndices2)
				{
					array[num3] += twitchChatController.alertWeight * inputWeight * num2;
				}
			}
			twitchChatController.weights = array;
		}
	}
	[TrackClipType(typeof(TwitchChatControlAsset))]
	[TrackBindingType(typeof(TwitchChatController))]
	public class TwitchChatControlTrack : TrackAsset
	{
		public override Playable CreateTrackMixer(PlayableGraph graph, GameObject go, int inputCount)
		{
			//IL_0022: 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_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			PlayableDirector component = go.GetComponent<PlayableDirector>();
			Object genericBinding = component.GetGenericBinding((Object)(object)this);
			if (!(genericBinding is TwitchChatController twitchChatController))
			{
				return ScriptPlayable<TwitchChatControllerMixerBehaviour>.op_Implicit(ScriptPlayable<TwitchChatControllerMixerBehaviour>.Create(graph, inputCount));
			}
			foreach (TimelineClip clip in ((TrackAsset)this).GetClips())
			{
				if (clip.asset is TwitchChatControlAsset twitchChatControlAsset)
				{
					twitchChatControlAsset.messages = twitchChatController.messages.Copy();
					if (twitchChatControlAsset.weights.Length != twitchChatController.weights.Length)
					{
						Array.Resize(ref twitchChatControlAsset.weights, twitchChatController.weights.Length);
					}
				}
			}
			return ScriptPlayable<TwitchChatControllerMixerBehaviour>.op_Implicit(ScriptPlayable<TwitchChatControllerMixerBehaviour>.Create(graph, inputCount));
		}
	}
}
namespace LcEmotes2AndKnucklesFeaturingDante.Common
{
	public class FaceCameraProxy : MonoBehaviour
	{
		private Camera? _targetCamera;

		public Transform? targetToRotate;

		public bool copyX;

		public bool copyY;

		public bool copyZ;

		private void Update()
		{
			if (targetToRotate != null)
			{
				if (_targetCamera == null)
				{
					_targetCamera = FindBestCamera();
				}
				if (_targetCamera != null)
				{
					((Component)this).transform.LookAt(((Component)_targetCamera).transform);
					((Component)this).transform.Rotate(0f, 180f, 0f, (Space)1);
				}
			}
		}

		private void LateUpdate()
		{
			//IL_0019: 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_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003a: 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_0046: 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_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: 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_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			if (targetToRotate != null)
			{
				Vector3 eulerAngles = ((Component)this).transform.eulerAngles;
				Vector3 eulerAngles2 = targetToRotate.eulerAngles;
				if (!copyX)
				{
					((Vector3)(ref eulerAngles))..ctor(eulerAngles2.x, eulerAngles.y, eulerAngles.z);
				}
				if (!copyY)
				{
					((Vector3)(ref eulerAngles))..ctor(eulerAngles.x, eulerAngles2.y, eulerAngles.z);
				}
				if (!copyZ)
				{
					((Vector3)(ref eulerAngles))..ctor(eulerAngles.x, eulerAngles.y, eulerAngles2.z);
				}
				targetToRotate.eulerAngles = eulerAngles;
			}
		}

		private Camera? FindBestCamera()
		{
			if (StartOfRound.Instance != null && StartOfRound.Instance.localPlayerController != null)
			{
				return StartOfRound.Instance.localPlayerController.gameplayCamera;
			}
			if (Camera.current != null)
			{
				return Camera.current;
			}
			return null;
		}
	}
	internal static class GameEventBus
	{
		private static Hook? _radiationWarningHUDHook;

		private static Hook? _switchSuitForPlayerHook;

		private static Hook? networkManagerStartHook;

		private static Hook? playerControllerStartHook;

		private static Hook? shootGunHook;

		private static GameObject emotes2networker;

		public static event Action? OnRadiationWarningHUD;

		public static void InitHooks()
		{
			_radiationWarningHUDHook = HookUtils.NewHook<HUDManager>("RadiationWarningHUD", typeof(GameEventBus), "RadiationWarningHUD", isStatic: false);
			_switchSuitForPlayerHook = HookUtils.NewHook<UnlockableSuit>("SwitchSuitForPlayer", typeof(GameEventBus), "SwitchSuitForPlayer", isStatic: true);
			_radiationWarningHUDHook = HookUtils.NewHook<PlayerControllerB>("Start", typeof(GameEventBus), "PlayerControllerStart", isStatic: false);
			_switchSuitForPlayerHook = HookUtils.NewHook<GameNetworkManager>("Start", typeof(GameEventBus), "NetworkManagerStart", isStatic: false);
			shootGunHook = HookUtils.NewHook<ShotgunItem>("ShootGun", typeof(GameEventBus), "ShootGun", isStatic: false);
		}

		private static void RadiationWarningHUD(Action<HUDManager> orig, HUDManager self)
		{
			orig(self);
			GameEventBus.OnRadiationWarningHUD?.Invoke();
		}

		private static void SwitchSuitForPlayer(Action<PlayerControllerB, int, bool> orig, PlayerControllerB player, int suitID, bool playAudio = true)
		{
			if (CustomEmotesAPI.ModelReplacementAPIPresent)
			{
				ModelReplacementAPICompat.RemovePlayerFromPool(player);
			}
			if (CustomEmotesAPI.VRMPresent)
			{
				LethalVRMCompat.RemovePlayerFromPool(player);
			}
			orig(player, suitID, playAudio);
			if (BoneMapper.playersToMappers.ContainsKey(((Component)player).gameObject) && BoneMapper.playersToMappers[((Component)player).gameObject].currentClipName == "com.gemumoddo.lc_emotes2_and_knuckles_featuring_dante__LightsCameraActionStart")
			{
				((MonoBehaviour)BoneMapper.playersToMappers[((Component)player).gameObject]).StartCoroutine(LightsCameraActionEmote.FinishPropAfterFrame(BoneMapper.playersToMappers[((Component)player).gameObject]));
			}
		}

		private static void PlayerControllerStart(Action<PlayerControllerB> orig, PlayerControllerB self)
		{
			orig(self);
			if (((NetworkBehaviour)self).IsServer && (Object)(object)Emotes2Networking.instance == (Object)null)
			{
				GameObject val = Object.Instantiate<GameObject>(emotes2networker);
				val.GetComponent<NetworkObject>().Spawn(true);
			}
		}

		private static void NetworkManagerStart(Action<GameNetworkManager> orig, GameNetworkManager self)
		{
			try
			{
				emotes2networker = Assets.Load<GameObject>("assets/emotes/networkerlmao.prefab");
				emotes2networker.AddComponent<Emotes2Networking>();
				((Component)GameNetworkManager.Instance).GetComponent<NetworkManager>().PrefabHandler.AddNetworkPrefab(emotes2networker);
			}
			catch (Exception)
			{
				DebugClass.Log((object)"couldn't setup emotes2 networker");
			}
			orig(self);
		}

		private static void ShootGun(Action<ShotgunItem, Vector3, Vector3> orig, ShotgunItem self, Vector3 shotgunPosition, Vector3 shotgunForward)
		{
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			orig(self, shotgunPosition, shotgunForward);
			try
			{
				RaycastHit[] enemyColliders = self.enemyColliders;
				for (int i = 0; i < enemyColliders.Length; i++)
				{
					RaycastHit val = enemyColliders[i];
					if (((RaycastHit)(ref val)).transform != null && ((Object)((RaycastHit)(ref val)).transform).name == "Window9(Clone)")
					{
						((Component)((RaycastHit)(ref val)).transform).GetComponent<WindowHandler>().OnHit();
					}
				}
			}
			catch (Exception)
			{
			}
		}
	}
	public class Emotes2Networking : NetworkBehaviour
	{
		public static Emotes2Networking instance;

		private void Awake()
		{
			((Object)this).name = "Emotes2_Networker";
			instance = this;
		}

		[ClientRpc]
		public void SyncRandomVideoToClientRpc(ulong netId, int randomNumber, int randomEasterEgg, int useEasterEgg, float randomPercentage)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00db: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_006d: 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_007e: Unknown result type (might be due to invalid IL or missing references)
			//IL_008b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0098: Unknown result type (mig