Decompiled source of MoreFunCompany v2.0.3

plugins/Gemumoddo-BadAssCompany/BadAssCompany.dll

Decompiled 11 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using EmotesAPI;
using Microsoft.CodeAnalysis;
using UnityEngine;

[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: AssemblyCompany("BadAssCompany")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+cdaeff70f23d8c605d693aa31cde850f03fe31c8")]
[assembly: AssemblyProduct("BadAssCompany")]
[assembly: AssemblyTitle("BadAssCompany")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[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;
		}
	}
}
public class LivingParticlesAudioModule : MonoBehaviour
{
	public Transform audioPosition;

	public LivingParticlesAudioSource LPaSourse;

	public bool useBuffer;

	public bool firstAndLastPixelBlack = false;

	private Texture2D t2d;

	private float[] finalSpectrum;

	private Color col = Color.black;

	private ParticleSystemRenderer psr;

	private void Start()
	{
		//IL_0046: Unknown result type (might be due to invalid IL or missing references)
		//IL_0050: Expected O, but got Unknown
		//IL_0035: Unknown result type (might be due to invalid IL or missing references)
		//IL_003f: Expected O, but got Unknown
		//IL_0074: Unknown result type (might be due to invalid IL or missing references)
		//IL_007e: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		psr = ((Component)this).GetComponent<ParticleSystemRenderer>();
		switch (LPaSourse.numberOfBands)
		{
		case LivingParticlesAudioSource._numberOfBands.Bands8:
			if (firstAndLastPixelBlack)
			{
				t2d = new Texture2D(10, 1);
			}
			else
			{
				t2d = new Texture2D(8, 1);
			}
			break;
		case LivingParticlesAudioSource._numberOfBands.Bands16:
			if (firstAndLastPixelBlack)
			{
				t2d = new Texture2D(18, 1);
			}
			else
			{
				t2d = new Texture2D(16, 1);
			}
			break;
		}
		((Texture)t2d).wrapMode = (TextureWrapMode)0;
	}

	private void Update()
	{
		//IL_00e1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
		//IL_011b: Unknown result type (might be due to invalid IL or missing references)
		//IL_014d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0163: Unknown result type (might be due to invalid IL or missing references)
		if (useBuffer)
		{
			switch (LPaSourse.numberOfBands)
			{
			case LivingParticlesAudioSource._numberOfBands.Bands8:
				finalSpectrum = LPaSourse.finalBands8Buffer;
				break;
			case LivingParticlesAudioSource._numberOfBands.Bands16:
				finalSpectrum = LPaSourse.finalBands16Buffer;
				break;
			}
		}
		else
		{
			switch (LPaSourse.numberOfBands)
			{
			case LivingParticlesAudioSource._numberOfBands.Bands8:
				finalSpectrum = LPaSourse.finalBands8;
				break;
			case LivingParticlesAudioSource._numberOfBands.Bands16:
				finalSpectrum = LPaSourse.finalBands16;
				break;
			}
		}
		for (int i = 0; i < finalSpectrum.Length; i++)
		{
			col.r = finalSpectrum[i];
			if (firstAndLastPixelBlack)
			{
				t2d.SetPixel(i + 1, 0, col);
			}
			else
			{
				t2d.SetPixel(i, 0, col);
			}
		}
		if (firstAndLastPixelBlack)
		{
			t2d.SetPixel(0, 0, Color.black);
			switch (LPaSourse.numberOfBands)
			{
			case LivingParticlesAudioSource._numberOfBands.Bands8:
				t2d.SetPixel(9, 0, Color.black);
				break;
			case LivingParticlesAudioSource._numberOfBands.Bands16:
				t2d.SetPixel(17, 0, Color.black);
				break;
			}
		}
		t2d.Apply();
		((Renderer)psr).material.SetTexture("_AudioSpectrum", (Texture)(object)t2d);
		((Renderer)psr).material.SetVector("_AudioPosition", Vector4.op_Implicit(audioPosition.position));
		switch (LPaSourse.numberOfBands)
		{
		case LivingParticlesAudioSource._numberOfBands.Bands8:
		{
			int num = 1;
			float amplitudeBuffer = (LPaSourse.amplitudeBuffer8 + 48f) / 48f;
			LPaSourse.amplitudeBuffer8 = amplitudeBuffer;
			((Renderer)psr).material.SetFloat("_AudioAverageAmplitude", LPaSourse.amplitudeBuffer8);
			break;
		}
		case LivingParticlesAudioSource._numberOfBands.Bands16:
			((Renderer)psr).material.SetFloat("_AudioAverageAmplitude", LPaSourse.amplitudeBuffer16);
			break;
		}
	}
}
public class LivingParticlesAudioSource : MonoBehaviour
{
	public enum _numberOfBands
	{
		Bands8,
		Bands16
	}

	public AudioClip audioClip;

	[Range(0.1f, 2f)]
	public float bufferInitialDecreaseSpeed = 1f;

	[Range(0f, 10f)]
	public float bufferDecreaseSpeedMultiply = 5f;

	public float freqBandsPower = 10f;

	public float audioProfileInitialValue = 5f;

	public bool audioProfileDecreasing = true;

	public float audioProfileDecreasingSpeed = 0.1f;

	public _numberOfBands numberOfBands = _numberOfBands.Bands8;

	private float[] initialSamplesL = new float[512];

	private float[] initialSamplesR = new float[512];

	private float[] freqBands8 = new float[8];

	private float[] freqBands8Buffer = new float[8];

	private float[] freqBands8BufferDecrease = new float[8];

	private float[] freqBands8Highest = new float[8];

	private float[] freqBands16 = new float[16];

	private float[] freqBands16Buffer = new float[16];

	private float[] freqBands16BufferDecrease = new float[16];

	private float[] freqBands16Highest = new float[16];

	private AudioSource audioSource;

	[HideInInspector]
	public float[] finalBands8 = new float[8];

	[HideInInspector]
	public float[] finalBands8Buffer = new float[8];

	[HideInInspector]
	public float[] finalBands16 = new float[16];

	[HideInInspector]
	public float[] finalBands16Buffer = new float[16];

	[HideInInspector]
	public float amplitude8;

	[HideInInspector]
	public float amplitudeBuffer8;

	[HideInInspector]
	public float amplitude16;

	[HideInInspector]
	public float amplitudeBuffer16;

	private float amplitudeHighest;

	private static bool speaking;

	private uint _length = 0u;

	private bool yote = false;

	private float[] left;

	private float[] right;

	private double[] _window;

	private void Start()
	{
		audioSource = ((Component)this).GetComponent<AudioSource>();
		AudioProfile(audioProfileInitialValue);
	}

	public void StartAudio()
	{
		Reset();
	}

	public void Reset()
	{
		_length = 0u;
	}

	private static bool readWav(string filename, out float[] L, out float[] R, out uint samplerate, out uint channels)
	{
		speaking = true;
		L = (R = null);
		samplerate = 0u;
		channels = 0u;
		try
		{
			using FileStream input = File.Open(filename, FileMode.Open);
			BinaryReader binaryReader = new BinaryReader(input);
			int num = binaryReader.ReadInt32();
			int num2 = binaryReader.ReadInt32();
			int num3 = binaryReader.ReadInt32();
			int num4 = binaryReader.ReadInt32();
			int num5 = binaryReader.ReadInt32();
			int num6 = binaryReader.ReadInt16();
			int num7 = binaryReader.ReadInt16();
			int num8 = binaryReader.ReadInt32();
			int num9 = binaryReader.ReadInt32();
			int num10 = binaryReader.ReadInt16();
			int num11 = binaryReader.ReadInt16();
			samplerate = (uint)num8;
			channels = (uint)num7;
			if (num5 == 18)
			{
				int count = binaryReader.ReadInt16();
				binaryReader.ReadBytes(count);
			}
			int num12 = binaryReader.ReadInt32();
			int num13 = binaryReader.ReadInt32();
			byte[] src = binaryReader.ReadBytes(num13);
			int num14 = num11 / 8;
			int num15 = num13 / num14;
			float[] array = null;
			switch (num11)
			{
			case 64:
			{
				double[] array3 = new double[num15];
				Buffer.BlockCopy(src, 0, array3, 0, num13);
				array = Array.ConvertAll(array3, (double e) => (float)e);
				break;
			}
			case 32:
				array = new float[num15];
				Buffer.BlockCopy(src, 0, array, 0, num13);
				break;
			case 16:
			{
				short[] array2 = new short[num15];
				Buffer.BlockCopy(src, 0, array2, 0, num13);
				array = Array.ConvertAll(array2, (short e) => (float)e / 32768f);
				break;
			}
			default:
				return false;
			}
			switch (channels)
			{
			case 1u:
				L = array;
				R = null;
				return true;
			case 2u:
			{
				int num16 = num15 / 2;
				L = new float[num16];
				R = new float[num16];
				int i = 0;
				int num17 = 0;
				for (; i < num16; i++)
				{
					L[i] = array[num17++];
					R[i] = array[num17++];
				}
				return true;
			}
			default:
				return false;
			}
		}
		catch
		{
			Debug.Log((object)("...Failed to load: " + filename));
			return false;
		}
	}

	private bool WavBufferToWwise(uint playingID, uint channelIndex, float[] samples)
	{
		if (left.Length == 0)
		{
			DebugClass.Log((object)"There was an error playing the audio file, The audio buffer is empty!");
		}
		if (_length >= (uint)left.Length)
		{
			_length = (uint)left.Length;
		}
		initialSamplesL = new float[samples.Length];
		initialSamplesR = new float[samples.Length];
		try
		{
			uint num = 0u;
			for (num = 0u; num < samples.Length; num++)
			{
				if (num + _length >= left.Length)
				{
					speaking = false;
					_length = 0u;
					break;
				}
				initialSamplesL[num] = left[num + _length];
				initialSamplesR[num] = right[num + _length];
				samples[num] = 0f;
			}
			_length += num;
		}
		catch (Exception)
		{
			Debug.Log((object)"--------end of audio???");
			throw;
		}
		if (_length >= (uint)left.Length)
		{
			_length = (uint)left.Length;
			speaking = false;
		}
		DoSpectrumDataStuff();
		return speaking;
	}

	private void ApplyWindow()
	{
		int num = initialSamplesL.Length;
		CreateWindow(num);
		for (int i = 0; i < num; i++)
		{
			initialSamplesL[i] = (float)((double)initialSamplesL[i] * _window[i]);
			initialSamplesR[i] = (float)((double)initialSamplesR[i] * _window[i]);
		}
	}

	private void DoSpectrumDataStuff()
	{
		ApplyWindow();
		switch (numberOfBands)
		{
		case _numberOfBands.Bands8:
			CreateFreqBands8();
			CreateBandBuffer8();
			CreateFinalBands8();
			CreateAmplitude8();
			break;
		case _numberOfBands.Bands16:
			CreateFreqBands16();
			CreateBandBuffer16();
			CreateFinalBands16();
			CreateAmplitude16();
			break;
		}
	}

	private void CreateWindow(int size, bool normalize = false)
	{
		_window = new double[size];
		for (int i = 0; i < size; i++)
		{
			double num = (double)i / (double)(size - 1);
			_window[i] = (double)(0.42f - 0.5f * Mathf.Cos((float)(i / size))) + 0.08 * (double)Mathf.Cos(2f * (float)i / (float)size);
		}
		if (normalize)
		{
			double num2 = 0.0;
			for (int j = 0; j < _window.Length; j++)
			{
				num2 += _window[j];
			}
			for (int k = 0; k < _window.Length; k++)
			{
				_window[k] /= num2;
			}
		}
	}

	private void AudioProfile(float audioProfileValue)
	{
		for (int i = 0; i < 8; i++)
		{
			freqBands8Highest[i] = audioProfileValue;
		}
		for (int j = 0; j < 16; j++)
		{
			freqBands16Highest[j] = audioProfileValue;
		}
	}

	private void CreateAmplitude8()
	{
		float num = 0f;
		float num2 = 0f;
		for (int i = 0; i < 8; i++)
		{
			num += finalBands8[i];
			num2 += finalBands8Buffer[i];
		}
		if (num > amplitudeHighest)
		{
			amplitudeHighest = num;
		}
		amplitude8 = num / amplitudeHighest;
		amplitudeBuffer8 = num2 / amplitudeHighest;
	}

	private void CreateAmplitude16()
	{
		float num = 0f;
		float num2 = 0f;
		for (int i = 0; i < 16; i++)
		{
			num += finalBands16[i];
			num2 += finalBands16Buffer[i];
		}
		if (num > amplitudeHighest)
		{
			amplitudeHighest = num;
		}
		amplitude16 = num / amplitudeHighest;
		amplitudeBuffer16 = num2 / amplitudeHighest;
	}

	private void CreateFinalBands8()
	{
		for (int i = 0; i < 8; i++)
		{
			if (audioProfileDecreasing)
			{
				freqBands8Highest[i] -= audioProfileDecreasingSpeed * Time.deltaTime;
			}
			if (freqBands8[i] > freqBands8Highest[i])
			{
				freqBands8Highest[i] = freqBands8[i];
			}
			finalBands8[i] = freqBands8[i] / freqBands8Highest[i];
			finalBands8Buffer[i] = freqBands8Buffer[i] / freqBands8Highest[i];
		}
	}

	private void CreateFinalBands16()
	{
		for (int i = 0; i < 16; i++)
		{
			if (audioProfileDecreasing)
			{
				freqBands16Highest[i] -= audioProfileDecreasingSpeed * Time.deltaTime;
			}
			if (freqBands16[i] > freqBands16Highest[i])
			{
				freqBands16Highest[i] = freqBands16[i];
			}
			finalBands16[i] = freqBands16[i] / freqBands16Highest[i];
			finalBands16Buffer[i] = freqBands16Buffer[i] / freqBands16Highest[i];
		}
	}

	private void CreateBandBuffer8()
	{
		for (int i = 0; i < 8; i++)
		{
			if (freqBands8[i] > freqBands8Buffer[i])
			{
				freqBands8Buffer[i] = freqBands8[i];
				freqBands8BufferDecrease[i] = bufferInitialDecreaseSpeed * freqBands8Highest[i] * Time.deltaTime;
			}
			if (freqBands8[i] < freqBands8Buffer[i])
			{
				freqBands8Buffer[i] -= freqBands8BufferDecrease[i];
				freqBands8BufferDecrease[i] *= 1f + bufferDecreaseSpeedMultiply * Time.deltaTime;
			}
		}
	}

	private void CreateBandBuffer16()
	{
		for (int i = 0; i < 16; i++)
		{
			if (freqBands16[i] > freqBands16Buffer[i])
			{
				freqBands16Buffer[i] = freqBands16[i];
				freqBands16BufferDecrease[i] = bufferInitialDecreaseSpeed * freqBands16Highest[i] * Time.deltaTime;
			}
			if (freqBands16[i] < freqBands16Buffer[i])
			{
				freqBands16Buffer[i] -= freqBands16BufferDecrease[i];
				freqBands16BufferDecrease[i] *= 1f + bufferDecreaseSpeedMultiply * Time.deltaTime;
			}
		}
	}

	private void CreateFreqBands8()
	{
		int num = 1;
	}

	private void CreateFreqBands16()
	{
		int num = 0;
		int num2 = 1;
		int num3 = 0;
		for (int i = 0; i < 16; i++)
		{
			float num4 = 0f;
			if (i == 2 || i == 4 || i == 6 || i == 8 || i == 10 || i == 12 || i == 14)
			{
				num3++;
				num2 = (int)Mathf.Pow(2f, (float)num3);
				if (num3 == 7)
				{
					num2++;
				}
			}
			for (int j = 0; j < num2; j++)
			{
				num4 += (initialSamplesL[num] + initialSamplesR[num]) * (float)(num + 1);
				num++;
			}
			num4 /= (float)num;
			freqBands16[i] = num4 * freqBandsPower * 2f;
		}
	}
}
namespace BadAssEmotes
{
	internal class CSS_Loader
	{
	}
}
namespace ExamplePlugin
{
	internal static class Assets
	{
		internal static readonly List<AssetBundle> AssetBundles = new List<AssetBundle>();

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

		internal static void LoadAssetBundlesFromFolder(string folderName)
		{
			folderName = Path.Combine(Path.GetDirectoryName(BadAssEmotesPlugin.PInfo.Location), folderName);
			string[] files = Directory.GetFiles(folderName);
			foreach (string text in files)
			{
				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/"))
					{
						text3 = text3.Remove(0, "assets/".Length);
					}
					AssetIndices[text3] = count;
				}
				DebugClass.Log((object)("Loaded AssetBundle: " + Path.GetFileName(text)));
			}
		}

		internal static T Load<T>(string assetName) where T : Object
		{
			try
			{
				assetName = assetName.ToLowerInvariant();
				if (assetName.Contains(":"))
				{
					string[] array = assetName.Split(':');
					assetName = array[1].ToLowerInvariant();
				}
				if (assetName.StartsWith("assets/"))
				{
					assetName = assetName.Remove(0, "assets/".Length);
				}
				int index = AssetIndices[assetName];
				return AssetBundles[index].LoadAsset<T>("assets/" + assetName);
			}
			catch (Exception arg)
			{
				DebugClass.Log((object)$"Couldn't load asset [{assetName}] reason: {arg}");
				return default(T);
			}
		}
	}
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.weliveinasociety.badasscompany", "BadAssCompany", "1.1.0")]
	public class BadAssEmotesPlugin : BaseUnityPlugin
	{
		public const string PluginGUID = "com.weliveinasociety.badasscompany";

		public const string PluginAuthor = "Nunchuk";

		public const string PluginName = "BadAssCompany";

		public const string PluginVersion = "1.1.0";

		private int stageInt = -1;

		private int pressInt = -1;

		internal static GameObject stage;

		internal static GameObject press;

		internal static GameObject pressMechanism;

		internal static LivingParticleArrayController LPAC;

		public static BadAssEmotesPlugin instance;

		private static List<string> HatKidDances = new List<string>();

		private int stand = -1;

		private List<BoneMapper> punchingMappers = new List<BoneMapper>();

		private int prop1 = -1;

		public static PluginInfo PInfo { get; private set; }

		public void Awake()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fe1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0fe7: Expected O, but got Unknown
			//IL_106d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1072: Unknown result type (might be due to invalid IL or missing references)
			//IL_1077: Unknown result type (might be due to invalid IL or missing references)
			//IL_1092: Unknown result type (might be due to invalid IL or missing references)
			//IL_1097: Unknown result type (might be due to invalid IL or missing references)
			//IL_109c: Unknown result type (might be due to invalid IL or missing references)
			//IL_10b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_10f7: Unknown result type (might be due to invalid IL or missing references)
			//IL_10fd: Expected O, but got Unknown
			//IL_112d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1144: Unknown result type (might be due to invalid IL or missing references)
			//IL_114a: Expected O, but got Unknown
			//IL_117a: Unknown result type (might be due to invalid IL or missing references)
			//IL_11bb: Unknown result type (might be due to invalid IL or missing references)
			//IL_11c1: Expected O, but got Unknown
			//IL_123b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1470: Unknown result type (might be due to invalid IL or missing references)
			//IL_1476: Expected O, but got Unknown
			//IL_14cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_14d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_14d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_14e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_152b: Unknown result type (might be due to invalid IL or missing references)
			//IL_1531: Expected O, but got Unknown
			//IL_157a: Unknown result type (might be due to invalid IL or missing references)
			//IL_159f: Unknown result type (might be due to invalid IL or missing references)
			//IL_15a5: Expected O, but got Unknown
			//IL_15d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_18b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_18b7: Expected O, but got Unknown
			//IL_1922: Unknown result type (might be due to invalid IL or missing references)
			//IL_1927: Unknown result type (might be due to invalid IL or missing references)
			//IL_192c: Unknown result type (might be due to invalid IL or missing references)
			//IL_1938: Unknown result type (might be due to invalid IL or missing references)
			//IL_196f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1975: Expected O, but got Unknown
			//IL_19cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a34: Unknown result type (might be due to invalid IL or missing references)
			//IL_1a3a: Expected O, but got Unknown
			//IL_1aa5: Unknown result type (might be due to invalid IL or missing references)
			//IL_1aaa: Unknown result type (might be due to invalid IL or missing references)
			//IL_1aaf: Unknown result type (might be due to invalid IL or missing references)
			//IL_1abb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1aeb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1af1: Expected O, but got Unknown
			//IL_1b48: Unknown result type (might be due to invalid IL or missing references)
			//IL_1b9e: Unknown result type (might be due to invalid IL or missing references)
			//IL_1ba4: Expected O, but got Unknown
			//IL_1c01: Unknown result type (might be due to invalid IL or missing references)
			//IL_1dfb: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e05: Expected O, but got Unknown
			//IL_1e0d: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e17: Expected O, but got Unknown
			//IL_1e1f: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e29: Expected O, but got Unknown
			//IL_1e31: Unknown result type (might be due to invalid IL or missing references)
			//IL_1e3b: Expected O, but got Unknown
			instance = this;
			PInfo = ((BaseUnityPlugin)this).Info;
			Assets.LoadAssetBundlesFromFolder("assetbundles");
			Settings.Setup();
			AnimationClipParams val = new AnimationClipParams();
			val.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/Breakin.anim") };
			val.looping = false;
			val._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/breakin'.ogg") };
			val.dimWhenClose = true;
			val.syncAnim = true;
			val.syncAudio = true;
			val.lockType = (LockType)1;
			val._primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/Breakin'_NNTranscription.ogg") };
			CustomEmotesAPI.AddCustomAnimation(val);
			AddAnimation("Breakneck", (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/Breakneck.ogg") }, null, looping: true, dimAudio: true, sync: true, (LockType)1, "", (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/Breakneck.ogg") }, null, DMCA: false, 0.7f);
			AddAnimation("Crabby", "Crabby", "", looping: true, dimAudio: true, sync: true, (LockType)3, "", "Crabby", "", DMCA: false, 0.7f);
			AddAnimation("Dabstand", "Dabstand", "", looping: false, dimAudio: false, sync: false, (LockType)1, "", "Dabstand", "", DMCA: false, 0.05f);
			AddAnimation("DanceMoves", "Fortnite default dance sound", "", looping: false, dimAudio: true, sync: true, (LockType)1, "Default Dance", "Fortnite default dance sound", "", DMCA: false, 0.7f);
			AddAnimation("DanceTherapyIntro", "DanceTherapyLoop", "Dance Therapy Intro", "Dance Therapy Loop", looping: true, dimAudio: true, sync: true, (LockType)1, "Dance Therapy", "Dance Therapy Intro", "Dance Therapy Loop", DMCA: false, 0.7f);
			AddAnimation("DeepDab", "Dabstand", "", looping: false, dimAudio: false, sync: false, (LockType)3, "Deep Dab", "Dabstand", "", DMCA: false, 0.05f);
			AddAnimation("Droop", "Droop", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Droop", "", DMCA: false, 0.7f);
			AddAnimation("ElectroSwing", "ElectroSwing", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Electro Swing", "ElectroSwing", "", DMCA: false, 0.7f);
			AddAnimation("Extraterrestial", "Extraterestrial", "", looping: true, dimAudio: true, sync: true, (LockType)3, "", "Extraterestrial", "", DMCA: false, 0.7f);
			AddAnimation("FancyFeet", "FancyFeet", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Fancy Feet", "FancyFeet", "", DMCA: false, 0.7f);
			AddAnimation("FlamencoIntro", "FlamencoLoop", "Flamenco", "FlamencoLoop", looping: true, dimAudio: true, sync: true, (LockType)1, "Flamenco", "FlamencoLoop", "", DMCA: false, 0.7f);
			AddAnimation("Floss", "Floss", "", looping: true, dimAudio: true, sync: false, (LockType)3, "", "Floss", "", DMCA: false, 0.5f);
			AddAnimation("Fresh", "Fresh", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Fresh", "", DMCA: false, 0.7f);
			AddAnimation("Hype", "Hype", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Hype", "", DMCA: false, 0.7f);
			AddAnimation("Infectious", "Infectious", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Infectious", "", DMCA: false, 0.7f);
			AddAnimation("InfinidabIntro", "InfinidabLoop", "InfinidabIntro", "InfinidabLoop", looping: true, dimAudio: true, sync: false, (LockType)1, "Infinidab", "InfinidabLoop", "", DMCA: false, 0.1f);
			AddAnimation("NeverGonna", "Never Gonna Give you Up", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Never Gonna", "Never Gonna Give you Up", "", DMCA: true, 0.7f);
			AddAnimation("NinjaStyle", "NinjaStyle", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Ninja Style", "NinjaStyle", "", DMCA: false, 0.7f);
			AddAnimation("OldSchool", "Old School", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Oldschool", "Old School", "", DMCA: false, 0.7f);
			AddAnimation("OrangeJustice", "Orange Justice", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Orange Justice", "Orange Justice", "", DMCA: false, 0.6f);
			AddAnimation("Overdrive", "Overdrive", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Overdrive", "", DMCA: false, 0.7f);
			AddAnimation("PawsAndClaws", "im a cat", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Paws and Claws", "im a cat", "", DMCA: false, 0.7f);
			AddAnimation("PhoneItIn", "Phone It In", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Phone It In", "Phone It In", "", DMCA: false, 0.7f);
			AddAnimation("PopLock", "PopLock", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Pop Lock", "PopLock", "", DMCA: false, 0.7f);
			AddAnimation("Scenario", "Scenario", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Scenario", "", DMCA: false, 0.7f);
			AddAnimation("SpringLoaded", "SpringLoaded", "", looping: true, dimAudio: false, sync: false, (LockType)1, "Spring Loaded", "SpringLoaded", "", DMCA: false, 0.1f);
			AddAnimation("Springy", "Springy", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Springy", "", DMCA: false, 0.7f);
			AddAnimation("AnkhaZone", "AnkhaZone", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "AnkhaZone", "", DMCA: true, 0.7f);
			AddAnimation("GangnamStyle", "GangnamStyle", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Gangnam Style", "GangnamStyle", "", DMCA: true, 0.7f);
			AddAnimation("DontStart", "DontStart", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Don't Start", "DontStart", "", DMCA: true, 0.7f);
			AddAnimation("BunnyHop", "BunnyHop", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Bunny Hop", "BunnyHop", "", DMCA: false, 0.4f);
			AddAnimation("BestMates", "BestMates", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Best Mates", "BestMates", "", DMCA: false, 0.7f);
			AddAnimation("JackOPose", "", "", looping: true, dimAudio: false, sync: false, (LockType)1, "Jack-O Crouch", "", "", DMCA: false, 0f);
			AddAnimation("Crackdown", "Crackdown", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Crackdown", "", DMCA: false, 0.7f);
			AddAnimation("Thicc", "Thicc", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Thicc", "", DMCA: false, 0.7f);
			AddAnimation("TakeTheL", "TakeTheL", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Take The L", "TakeTheL", "", DMCA: false, 0.8f);
			AddAnimation("LetsDanceBoys", "LetsDanceBoys", "", looping: true, dimAudio: true, sync: true, (LockType)3, "Let's Dance Boys", "LetsDanceBoys", "", DMCA: false, 0.7f);
			AddAnimation("BlindingLightsIntro", "BlindingLights", "BlindingLightsIntro", "BlindingLightsLoop", looping: true, dimAudio: true, sync: true, (LockType)1, "Blinding Lights", "BlindingLightsIntro", "BlindingLightsLoop", DMCA: true, 0.7f);
			AddAnimation("ImDiamond", "ImDiamond", "", looping: true, dimAudio: true, sync: true, (LockType)1, "I'm Diamond", "ImDiamond", "", DMCA: true, 0.7f);
			AddAnimation("ItsDynamite", "ItsDynamite", "", looping: true, dimAudio: true, sync: true, (LockType)1, "It's Dynamite", "ItsDynamite", "", DMCA: true, 0.7f);
			AddAnimation("TheRobot", "TheRobot", "", looping: true, dimAudio: true, sync: true, (LockType)1, "The Robot", "TheRobot", "", DMCA: false, 0.7f);
			AddAnimation("Cartwheelin", "Cartwheelin", "", looping: true, dimAudio: false, sync: false, (LockType)1, "", "Cartwheelin", "", DMCA: false, 0.1f);
			AddAnimation("CrazyFeet", "CrazyFeet", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Crazy Feet", "CrazyFeet", "", DMCA: false, 0.7f);
			AddAnimation("FullTilt", "FullTilt", "", looping: true, dimAudio: true, sync: true, (LockType)3, "Full Tilt", "FullTilt", "", DMCA: false, 0.1f);
			AddAnimation("FloorSamus", "", "", looping: true, dimAudio: false, sync: false, (LockType)3, "Samus Crawl", "", "", DMCA: false, 0f);
			AddAnimation("DEDEDE", "", "", looping: true, dimAudio: false, sync: false, (LockType)1, "", "", "", DMCA: false, 0f);
			AddAnimation("Specialist", "Specialist", "", looping: false, dimAudio: true, sync: true, (LockType)3, "The Specialist", "Specialist", "", DMCA: false, 0.7f);
			AddStartAndJoinAnim(new string[2] { "PPmusic", "PPmusicFollow" }, "PPmusic", looping: true, dimaudio: true, sync: true, (LockType)1, "Penis Music", "PPmusic", DMCA: false, 0.7f);
			AddAnimation("GetDown", "GetDown", "", looping: false, dimAudio: true, sync: true, (LockType)3, "Get Down", "GetDown", "", DMCA: true, 0.7f);
			AddAnimation("Yakuza", "Yakuza", "", looping: true, dimAudio: true, sync: true, (LockType)3, "Koi no Disco Queen", "Yakuza", "", DMCA: false, 0.7f);
			AddAnimation("Miku", "Miku", "", looping: true, dimAudio: true, sync: true, (LockType)3, "", "Miku", "", DMCA: false, 0.7f);
			AddAnimation("Horny", new string[2] { "Horny", "TeddyLoid - ME!ME!ME! feat. Daoko" }, looping: true, dimaudio: true, sync: true, (LockType)1, "", new string[2] { "Horny", "TeddyLoid - ME!ME!ME! feat. Daoko" }, DMCA: true, 0.7f);
			AddAnimation("GangTorture", "GangTorture", "", looping: false, dimAudio: true, sync: true, (LockType)3, "", "GangTorture", "", DMCA: true, 0.7f);
			AddAnimation("PoseBurter", "GinyuForce", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Burter Pose", "GinyuForce", "", DMCA: false, 0.7f);
			AddAnimation("PoseGinyu", "GinyuForce", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Ginyu Pose", "GinyuForce", "", DMCA: false, 0.7f);
			AddAnimation("PoseGuldo", "GinyuForce", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Guldo Pose", "GinyuForce", "", DMCA: false, 0.7f);
			AddAnimation("PoseJeice", "GinyuForce", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Jeice Pose", "GinyuForce", "", DMCA: false, 0.7f);
			AddAnimation("PoseRecoome", "GinyuForce", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Recoome Pose", "GinyuForce", "", DMCA: false, 0.7f);
			AddAnimation("Carson", "Carson", "", looping: false, dimAudio: true, sync: true, (LockType)1, "", "Carson", "", DMCA: true, 0.7f);
			AddAnimation("Frolic", "Frolic", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Frolic", "", DMCA: false, 0.7f);
			AddAnimation("MoveIt", "MoveIt", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Move It", "MoveIt", "", DMCA: true, 0.7f);
			AddStartAndJoinAnim(new string[2] { "ByTheFireLead", "ByTheFirePartner" }, "ByTheFire", looping: true, dimaudio: true, sync: true, (LockType)1, "By The Fire", "ByTheFire", DMCA: true, 0.7f);
			AddStartAndJoinAnim(new string[2] { "SwayLead", "SwayPartner" }, "Sway", looping: true, dimaudio: true, sync: true, (LockType)1, "Sway", "Sway", DMCA: true, 0.7f);
			AddAnimation("Macarena", "Macarena", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Macarena", "", DMCA: true, 0.7f);
			AddAnimation("Thanos", "Thanos", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Thanos", "", DMCA: true, 0.7f);
			AddAnimation("StarGet", (AudioClip[])(object)new AudioClip[6]
			{
				Assets.Load<AudioClip>("assets/compressedaudio/starget2.ogg"),
				Assets.Load<AudioClip>("assets/compressedaudio/starget3.ogg"),
				Assets.Load<AudioClip>("assets/compressedaudio/starget4.ogg"),
				Assets.Load<AudioClip>("assets/compressedaudio/starget5.ogg"),
				Assets.Load<AudioClip>("assets/compressedaudio/starget6.ogg"),
				Assets.Load<AudioClip>("assets/compressedaudio/starget7.ogg")
			}, null, looping: false, dimAudio: false, sync: false, (LockType)3, "Star Get", (AudioClip[])(object)new AudioClip[6]
			{
				Assets.Load<AudioClip>("assets/DMCAMusic/starget2_NNTranscription.ogg"),
				Assets.Load<AudioClip>("assets/DMCAMusic/starget3_NNTranscription.ogg"),
				Assets.Load<AudioClip>("assets/DMCAMusic/starget4_NNTranscription.ogg"),
				Assets.Load<AudioClip>("assets/DMCAMusic/starget5_NNTranscription.ogg"),
				Assets.Load<AudioClip>("assets/DMCAMusic/starget6_NNTranscription.ogg"),
				Assets.Load<AudioClip>("assets/DMCAMusic/starget7_NNTranscription.ogg")
			}, null, DMCA: false, 0.6f);
			AddAnimation("Poyo", "Poyo", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Poyo", "", DMCA: false, 0.7f);
			AddAnimation("Chika", "Chika", "", looping: false, dimAudio: true, sync: true, (LockType)3, "", "Chika", "", DMCA: true, 0.7f);
			AddAnimation("Goopie", "Goopie", "", looping: false, dimAudio: true, sync: true, (LockType)1, "", "Goopie", "", DMCA: true, 0.7f);
			AddAnimation("Crossbounce", "Crossbounce", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Crossbounce", "", DMCA: false, 0.7f);
			AddAnimation("Butt", "Butt", "", looping: false, dimAudio: false, sync: false, (LockType)2, "", "Butt", "", DMCA: false, 0.5f);
			AddAnimation("MakeItRainIntro", "MakeItRainLoop", "MakeItRainIntro", "MakeItRainLoop", looping: true, dimAudio: true, sync: true, (LockType)3, "Make it Rain", "MakeItRainLoop", "", DMCA: true, 0.7f);
			AddAnimation("Penguin", "Penguin", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Club Penguin", "Penguin", "", DMCA: false, 0.4f);
			AddAnimation("DesertRivers", "DesertRivers", "", looping: false, dimAudio: true, sync: true, (LockType)3, "Rivers in the Dessert", "DesertRivers", "", DMCA: false, 0.7f);
			AddAnimation("HondaStep", "HondaStep", "", looping: false, dimAudio: true, sync: true, (LockType)3, "Step!", "HondaStep", "", DMCA: true, 0.7f);
			AddAnimation("UGotThat", "UGotThat", "", looping: false, dimAudio: true, sync: true, (LockType)3, "U Got That", "UGotThat", "", DMCA: true, 0.7f);
			AddAnimation("OfficerEarl", "", "", looping: true, dimAudio: false, sync: false, (LockType)3, "Officer Earl", "", "", DMCA: false, 0f);
			AddAnimation("Cirno", "Cirno", "", looping: false, dimAudio: true, sync: true, (LockType)3, "", "Cirno", "", DMCA: false, 0.7f);
			AnimationClipParams val2 = new AnimationClipParams();
			val2.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/Haruhi.anim") };
			val2.looping = false;
			val2._primaryAudioClips = (AudioClip[])(object)new AudioClip[2]
			{
				Assets.Load<AudioClip>("assets/compressedaudio/Haruhi.ogg"),
				Assets.Load<AudioClip>("assets/compressedaudio/HaruhiYoung.ogg")
			};
			val2.dimWhenClose = true;
			val2.syncAnim = true;
			val2.syncAudio = true;
			val2.startPref = 0;
			val2.joinPref = 0;
			val2.joinSpots = (JoinSpot[])(object)new JoinSpot[2]
			{
				new JoinSpot("Yuki_Nagato", new Vector3(1.5f, 0f, -1.5f)),
				new JoinSpot("Mikuru_Asahina", new Vector3(-1.5f, 0f, -1.5f))
			};
			val2.customName = "Hare Hare Yukai";
			val2.lockType = (LockType)3;
			val2.willGetClaimedByDMCA = true;
			val2._primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[2]
			{
				Assets.Load<AudioClip>("assets/DMCAMusic/Haruhi_NNTranscription.ogg"),
				Assets.Load<AudioClip>("assets/DMCAMusic/HaruhiYoung_NNTranscription.ogg")
			};
			val2.audioLevel = 0.7f;
			CustomEmotesAPI.AddCustomAnimation(val2);
			val2 = new AnimationClipParams();
			val2.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/Yuki_Nagato.anim") };
			val2.looping = false;
			val2.syncAnim = true;
			val2.visible = false;
			val2.lockType = (LockType)2;
			val2.audioLevel = 0f;
			CustomEmotesAPI.AddCustomAnimation(val2);
			val2 = new AnimationClipParams();
			val2.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/Mikuru_Asahina.anim") };
			val2.looping = false;
			val2.syncAnim = true;
			val2.visible = false;
			val2.lockType = (LockType)2;
			val2.audioLevel = 0f;
			CustomEmotesAPI.AddCustomAnimation(val2);
			BoneMapper.animClips["Yuki_Nagato"].vulnerableEmote = true;
			BoneMapper.animClips["Mikuru_Asahina"].vulnerableEmote = true;
			val2 = new AnimationClipParams();
			val2.animationClip = (AnimationClip[])(object)new AnimationClip[3]
			{
				Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/GGGG.anim"),
				Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/GGGG2.anim"),
				Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/GGGG3.anim")
			};
			val2.looping = false;
			val2._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/GGGG.ogg") };
			val2.dimWhenClose = true;
			val2.syncAnim = true;
			val2.syncAudio = true;
			val2.startPref = -2;
			val2.joinPref = -2;
			val2.lockType = (LockType)3;
			val2.willGetClaimedByDMCA = true;
			val2._primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/GGGG_NNTranscription.ogg") };
			val2.audioLevel = 0.7f;
			CustomEmotesAPI.AddCustomAnimation(val2);
			AddAnimation("Shufflin", "Shufflin", "", looping: false, dimAudio: true, sync: true, (LockType)3, "", "Shufflin", "", DMCA: true, 0.7f);
			AddAnimation("BimBamBom", "BimBamBom", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Bim Bam Boom", "BimBamBom", "", DMCA: true, 0.7f);
			AddAnimation("Savage", "Savage", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Savage", "", DMCA: true, 0.7f);
			AddAnimation("Stuck", "Stuck", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Stuck", "", DMCA: true, 0.7f);
			AddAnimation("Roflcopter", "Roflcopter", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Roflcopter", "", DMCA: false, 0.7f);
			AddAnimation("Float", "Float", "", looping: false, dimAudio: true, sync: true, (LockType)1, "", "Float", "", DMCA: false, 0.4f);
			AddAnimation("Rollie", "Rollie", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Rollie", "", DMCA: true, 0.7f);
			AddAnimation("GalaxyObservatory", new string[3] { "GalaxyObservatory1", "GalaxyObservatory2", "GalaxyObservatory3" }, looping: true, dimaudio: true, sync: true, (LockType)3, "Galaxy Observatory", new string[3] { "GalaxyObservatory1", "GalaxyObservatory2", "GalaxyObservatory3" }, DMCA: false, 0.5f);
			AddAnimation("Markiplier", "Markiplier", "", looping: false, dimAudio: false, sync: false, (LockType)3, "", "Markiplier", "", DMCA: true, 0.6f);
			AddAnimation("DevilSpawn", "DevilSpawn", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "DevilSpawn", "", DMCA: true, 0.7f);
			val2 = new AnimationClipParams();
			val2.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/DuckThisOneIdle.anim") };
			val2.looping = true;
			val2._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/DuckThisOneIdle.ogg") };
			val2.joinSpots = (JoinSpot[])(object)new JoinSpot[1]
			{
				new JoinSpot("DuckThisJoinSpot", new Vector3(0f, 0f, 2f))
			};
			val2.dimWhenClose = true;
			val2.lockType = (LockType)2;
			val2.customName = "Duck This One";
			val2._primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/DuckThisOneIdle_NNTranscription.ogg") };
			val2.willGetClaimedByDMCA = false;
			val2.audioLevel = 0.7f;
			CustomEmotesAPI.AddCustomAnimation(val2);
			val2 = new AnimationClipParams();
			val2.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/DuckThisOne.anim") };
			val2.looping = false;
			val2._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/DuckThisOne.ogg") };
			val2.visible = false;
			val2.dimWhenClose = true;
			val2.lockType = (LockType)2;
			val2._primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/DuckThisOne.ogg") };
			CustomEmotesAPI.AddCustomAnimation(val2);
			val2 = new AnimationClipParams();
			val2.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/DuckThisOneJoin.anim") };
			val2.looping = false;
			val2.visible = false;
			val2.dimWhenClose = true;
			val2.lockType = (LockType)2;
			CustomEmotesAPI.AddCustomAnimation(val2);
			BoneMapper.animClips["DuckThisOneIdle"].vulnerableEmote = true;
			BoneMapper.animClips["DuckThisOne"].vulnerableEmote = true;
			BoneMapper.animClips["DuckThisOneJoin"].vulnerableEmote = true;
			AddAnimation("Griddy", "Griddy", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Griddy", "", DMCA: true, 0.7f);
			AddAnimation("Tidy", "Tidy", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Tidy", "", DMCA: true, 0.7f);
			AddAnimation("Toosie", "Toosie", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Toosie", "", DMCA: true, 0.7f);
			AddAnimation("INEEDAMEDICBAG", (AudioClip[])(object)new AudioClip[2]
			{
				Assets.Load<AudioClip>("assets/compressedaudio/INEEDAMEDICBAG1.ogg"),
				Assets.Load<AudioClip>("assets/compressedaudio/INEEDAMEDICBAG2.ogg")
			}, null, looping: false, dimAudio: false, sync: false, (LockType)3, "I NEED A MEDIC BAG", (AudioClip[])(object)new AudioClip[2]
			{
				Assets.Load<AudioClip>("assets/compressedaudio/INEEDAMEDICBAG1.ogg"),
				Assets.Load<AudioClip>("assets/compressedaudio/INEEDAMEDICBAG2.ogg")
			}, null, DMCA: false, 0.9f);
			AddAnimation("Smoke", "Smoke", "", looping: true, dimAudio: true, sync: true, (LockType)3, "Ralsei Dies", "Smoke", "", DMCA: false, 0.7f);
			AddAnimation("FamilyGuyDeath", "", "", looping: true, dimAudio: false, sync: false, (LockType)1, "Family Guy Death Pose", "", "", DMCA: false, 0f);
			AddAnimation("Panda", "", "", looping: false, dimAudio: false, sync: false, (LockType)3, "", "", "", DMCA: false, 0f);
			AddAnimation("Yamcha", "", "", looping: true, dimAudio: false, sync: false, (LockType)1, "Yamcha Death Pose", "", "", DMCA: false, 0f);
			AddAnimation("Thriller", "Thriller", "", looping: true, dimAudio: true, sync: true, (LockType)3, "", "Thriller", "", DMCA: true, 0.7f);
			AddAnimation("Wess", "Wess", "", looping: false, dimAudio: true, sync: true, (LockType)1, "", "Wess", "", DMCA: true, 0.7f);
			AddAnimation("Distraction", "Distraction", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Distraction Dance", "Distraction", "", DMCA: false, 1f);
			AddAnimation("Security", "Security", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Last Surprise", "Security", "", DMCA: false, 0.7f);
			AddAnimation("KillMeBaby", "KillMeBaby", "", looping: false, dimAudio: true, sync: true, (LockType)1, "Kill Me Baby", "KillMeBaby", "", DMCA: true, 0.7f);
			val2 = new AnimationClipParams();
			val2.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/MyWorld.anim") };
			val2.looping = true;
			val2._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/MyWorld.ogg") };
			val2.dimWhenClose = true;
			val2.syncAnim = true;
			val2.syncAudio = true;
			val2.joinSpots = (JoinSpot[])(object)new JoinSpot[1]
			{
				new JoinSpot("MyWorldJoinSpot", new Vector3(2f, 0f, 0f))
			};
			val2.lockType = (LockType)1;
			val2._primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/MyWorld_NNTranscription.ogg") };
			val2.audioLevel = 0.7f;
			val2.willGetClaimedByDMCA = true;
			CustomEmotesAPI.AddCustomAnimation(val2);
			val2 = new AnimationClipParams();
			val2.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/MyWorldJoin.anim") };
			val2.looping = true;
			val2._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/MyWorld.ogg") };
			val2.dimWhenClose = true;
			val2.syncAnim = true;
			val2.syncAudio = true;
			val2.visible = false;
			val2.lockType = (LockType)1;
			val2.audioLevel = 0f;
			val2._primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/MyWorld_NNTranscription.ogg") };
			val2.willGetClaimedByDMCA = true;
			CustomEmotesAPI.AddCustomAnimation(val2);
			CustomAnimationClip obj = BoneMapper.animClips["MyWorldJoin"];
			obj.syncPos--;
			BoneMapper.animClips["MyWorldJoin"].vulnerableEmote = true;
			val2 = new AnimationClipParams();
			val2.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/VSWORLD.anim") };
			val2.looping = true;
			val2._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/VSWORLD.ogg") };
			val2.dimWhenClose = true;
			val2.syncAnim = true;
			val2.syncAudio = true;
			val2.joinSpots = (JoinSpot[])(object)new JoinSpot[1]
			{
				new JoinSpot("VSWORLDJoinSpot", new Vector3(-2f, 0f, 0f))
			};
			val2.lockType = (LockType)1;
			val2._primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/VSWORLD_NNTranscription.ogg") };
			val2.audioLevel = 0.7f;
			CustomEmotesAPI.AddCustomAnimation(val2);
			val2 = new AnimationClipParams();
			val2.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/VSWORLDLEFT.anim") };
			val2.looping = true;
			val2._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/VSWORLD.ogg") };
			val2.dimWhenClose = true;
			val2.syncAnim = true;
			val2.syncAudio = true;
			val2.visible = false;
			val2.lockType = (LockType)1;
			val2._primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/VSWORLD_NNTranscription.ogg") };
			CustomEmotesAPI.AddCustomAnimation(val2);
			CustomAnimationClip obj2 = BoneMapper.animClips["VSWORLDLEFT"];
			obj2.syncPos--;
			BoneMapper.animClips["VSWORLDLEFT"].vulnerableEmote = true;
			val2 = new AnimationClipParams();
			val2.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/ChugJug.anim") };
			val2.looping = false;
			val2._primaryAudioClips = (AudioClip[])(object)new AudioClip[2]
			{
				Assets.Load<AudioClip>("assets/compressedaudio/ChugJug.ogg"),
				Assets.Load<AudioClip>("assets/compressedaudio/MikuJug.ogg")
			};
			val2.dimWhenClose = true;
			val2.syncAnim = true;
			val2.syncAudio = true;
			val2.lockType = (LockType)1;
			val2._primaryDMCAFreeAudioClips = (AudioClip[])(object)new AudioClip[2]
			{
				Assets.Load<AudioClip>("assets/DMCAMusic/ChugJug_NNTranscription.ogg"),
				Assets.Load<AudioClip>("assets/DMCAMusic/MikuJug_NNTranscription.ogg")
			};
			val2.audioLevel = 0.7f;
			CustomEmotesAPI.AddCustomAnimation(val2);
			AddAnimation("Summertime", "Summertime", "", looping: false, dimAudio: true, sync: true, (LockType)1, "", "Summertime", "", DMCA: true, 0.7f);
			AddAnimation("Dougie", "Dougie", "", looping: true, dimAudio: true, sync: true, (LockType)1, "", "Dougie", "", DMCA: true, 0.7f);
			AddAnimation("CaliforniaGirls", "CaliforniaGirls", "", looping: true, dimAudio: true, sync: true, (LockType)1, "California Gurls", "CaliforniaGirls", "", DMCA: true, 0.7f);
			AddAnimation("SeeTinh", "SeeTinh", "", looping: false, dimAudio: true, sync: true, (LockType)1, "See Tình", "SeeTinh", "", DMCA: true, 0.7f);
			AddAnimation("VirtualInsanityIntro", "VirtualInsanityLoop", "VirtualInsanityStart", "VirtualInsanityLoop", looping: false, dimAudio: true, sync: true, (LockType)1, "Virtual Insanity", "VirtualInsanityStart", "VirtualInsanityLoop", DMCA: true, 0.5f);
			AddAnimation("Im a Mystery", "Im a Mystery Loop", "Im a Mystery", "Im a Mystery Loop", looping: true, dimAudio: true, sync: true, (LockType)1, "Im a Mystery", "Im a Mystery", "Im a Mystery Loop", DMCA: true, 0.5f);
			AddAnimation("Bird", "Bird", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Bird", "Bird", "", DMCA: false, 0.7f);
			AddAnimation("Real Slim Shady", "Real Slim Shady Loop", "Real Slim Shady", "Real Slim Shady Loop", looping: true, dimAudio: true, sync: true, (LockType)1, "Real Slim Shady", "Real Slim Shady", "Real Slim Shady Loop", DMCA: true, 0.7f);
			AddAnimation("Steady", "Steady", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Steady", "Steady", "", DMCA: false, 0.7f);
			CustomEmotesAPI.animChanged += new AnimationChanged(CustomEmotesAPI_animChanged);
			CustomEmotesAPI.emoteSpotJoined_Body += new JoinedEmoteSpotBody(CustomEmotesAPI_emoteSpotJoined_Body);
			CustomEmotesAPI.emoteSpotJoined_Prop += new JoinedEmoteSpotProp(CustomEmotesAPI_emoteSpotJoined_Prop);
			CustomEmotesAPI.boneMapperCreated += new BoneMapperCreated(CustomEmotesAPI_boneMapperCreated);
		}

		private void CustomEmotesAPI_boneMapperCreated(BoneMapper mapper)
		{
		}

		private void CustomEmotesAPI_emoteSpotJoined_Prop(GameObject emoteSpot, BoneMapper joiner, BoneMapper host)
		{
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0071: Expected O, but got Unknown
			//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Expected O, but got Unknown
			switch (((Object)emoteSpot).name)
			{
			case "ifumiddle":
			{
				((Component)host).GetComponentsInChildren<Animator>()[1].SetTrigger("Start");
				joiner.PlayAnim("ifu", 0);
				GameObject val = new GameObject();
				((Object)val).name = "ifumiddle_JoinProp";
				IFU(joiner, host, emoteSpot, val);
				break;
			}
			case "ifeleft":
			{
				((Component)host).GetComponentsInChildren<Animator>()[1].SetTrigger("Start");
				joiner.PlayAnim("ifeleft", 0);
				GameObject val = new GameObject();
				((Object)val).name = "ifeleft_JoinProp";
				IFU(joiner, host, emoteSpot, val);
				break;
			}
			case "ifuright":
			{
				((Component)host).GetComponentsInChildren<Animator>()[1].SetTrigger("Start");
				joiner.PlayAnim("ifuright", 0);
				GameObject val = new GameObject();
				((Object)val).name = "ifuright_JoinProp";
				IFU(joiner, host, emoteSpot, val);
				break;
			}
			case "HydrolicPressJoinSpot":
			{
				GameObject val = new GameObject();
				((Object)val).name = "hydrolicpress_JoinProp";
				HydrolicPress(joiner, host, emoteSpot, val);
				break;
			}
			}
		}

		private void IFU(BoneMapper joiner, BoneMapper host, GameObject emoteSpot, GameObject g)
		{
		}

		private void HydrolicPress(BoneMapper joiner, BoneMapper host, GameObject emoteSpot, GameObject g)
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_004a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			joiner.props.Add(g);
			g.transform.SetParent(((Component)host).transform);
			g.transform.localPosition = new Vector3(0f, 0.03f, 0f);
			g.transform.localEulerAngles = Vector3.zero;
			g.transform.localScale = Vector3.one;
			g.AddComponent<HydrolicPressComponent>().boneMapper = joiner;
			joiner.AssignParentGameObject(g, true, false, true, false, false);
			emoteSpot.GetComponent<EmoteLocation>().SetEmoterAndHideLocation(joiner);
			((MonoBehaviour)this).StartCoroutine(WaitForSecondsThenEndEmote(joiner, 10f, g));
		}

		private IEnumerator WaitForSecondsThenEndEmote(BoneMapper mapper, float time, GameObject parent)
		{
			yield return (object)new WaitForSeconds(time);
			if (Object.op_Implicit((Object)(object)mapper) && (Object)(object)mapper.parentGameObject == (Object)(object)parent)
			{
				mapper.preserveProps = true;
				mapper.AssignParentGameObject(mapper.parentGameObject, false, false, true, false, false);
				mapper.preserveParent = true;
				mapper.preserveProps = true;
				mapper.PlayAnim("none", 0);
			}
		}

		internal IEnumerator WaitForSecondsThenDeleteGameObject(GameObject obj, float time)
		{
			yield return (object)new WaitForSeconds(time);
			if (Object.op_Implicit((Object)(object)obj))
			{
				Object.Destroy((Object)(object)obj);
			}
		}

		private void CustomEmotesAPI_emoteSpotJoined_Body(GameObject emoteSpot, BoneMapper joiner, BoneMapper host)
		{
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Expected O, but got Unknown
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: 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_0115: Unknown result type (might be due to invalid IL or missing references)
			//IL_011c: Expected O, but got Unknown
			//IL_0150: Unknown result type (might be due to invalid IL or missing references)
			//IL_0155: Unknown result type (might be due to invalid IL or missing references)
			//IL_016d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0175: Unknown result type (might be due to invalid IL or missing references)
			//IL_0196: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_01dc: Expected O, but got Unknown
			//IL_0204: Unknown result type (might be due to invalid IL or missing references)
			//IL_021c: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_030a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0311: Expected O, but got Unknown
			//IL_0345: Unknown result type (might be due to invalid IL or missing references)
			//IL_034a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0362: Unknown result type (might be due to invalid IL or missing references)
			//IL_0383: Unknown result type (might be due to invalid IL or missing references)
			//IL_0395: Unknown result type (might be due to invalid IL or missing references)
			//IL_046d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0474: Expected O, but got Unknown
			//IL_04a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_04ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_04c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_04e6: Unknown result type (might be due to invalid IL or missing references)
			//IL_04f8: Unknown result type (might be due to invalid IL or missing references)
			//IL_0548: Unknown result type (might be due to invalid IL or missing references)
			//IL_054f: Expected O, but got Unknown
			//IL_0593: Unknown result type (might be due to invalid IL or missing references)
			//IL_05a5: Unknown result type (might be due to invalid IL or missing references)
			//IL_05b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_0607: Unknown result type (might be due to invalid IL or missing references)
			//IL_060e: Expected O, but got Unknown
			//IL_0634: Unknown result type (might be due to invalid IL or missing references)
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_0646: Unknown result type (might be due to invalid IL or missing references)
			//IL_067f: Unknown result type (might be due to invalid IL or missing references)
			//IL_06a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_06b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_06c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_06da: Unknown result type (might be due to invalid IL or missing references)
			string name = ((Object)emoteSpot).name;
			if (name == "StandingHereJoinSpot")
			{
				joiner.PlayAnim("StandingHere", 0);
				GameObject val = new GameObject();
				((Object)val).name = "StandingHereProp";
				joiner.props.Add(val);
				val.transform.SetParent(((Component)host).transform);
				Vector3 lossyScale = ((Component)host).transform.lossyScale;
				val.transform.localPosition = new Vector3(0f, 0f, 0.75f / lossyScale.z);
				val.transform.localEulerAngles = new Vector3(0f, 130f, 0f);
				val.transform.localScale = new Vector3(0.8f, 0.8f, 0.8f);
				joiner.AssignParentGameObject(val, true, true, true, true, true);
				joiner.SetAnimationSpeed(2f);
				emoteSpot.GetComponent<EmoteLocation>().SetEmoterAndHideLocation(joiner);
			}
			if (name == "DuckThisJoinSpot")
			{
				joiner.PlayAnim("DuckThisOneJoin", 0);
				GameObject val2 = new GameObject();
				((Object)val2).name = "DuckThisOneJoinProp";
				joiner.props.Add(val2);
				val2.transform.SetParent(((Component)host).transform);
				Vector3 lossyScale2 = ((Component)host).transform.lossyScale;
				val2.transform.localPosition = new Vector3(0f, 0f, 1f / lossyScale2.z);
				val2.transform.localEulerAngles = new Vector3(0f, 180f, 0f);
				val2.transform.localScale = Vector3.one;
				joiner.AssignParentGameObject(val2, true, true, true, true, true);
				host.PlayAnim("DuckThisOne", 0);
				joiner.currentlyLockedBoneMapper = host;
				val2 = new GameObject();
				((Object)val2).name = "DuckThisOneHostProp";
				host.props.Add(val2);
				val2.transform.localPosition = ((Component)host).transform.position;
				val2.transform.localEulerAngles = ((Component)host).transform.eulerAngles;
				val2.transform.localScale = Vector3.one;
				val2.transform.SetParent(host.mapperBodyTransform.parent);
				host.AssignParentGameObject(val2, true, true, true, true, false);
			}
			if (name == "Yuki_Nagato")
			{
				joiner.PlayAnim("Yuki_Nagato", 0);
				CustomAnimationClip.syncTimer[joiner.currentClip.syncPos] = CustomAnimationClip.syncTimer[host.currentClip.syncPos];
				CustomAnimationClip.syncPlayerCount[joiner.currentClip.syncPos]++;
				joiner.PlayAnim("Yuki_Nagato", 0);
				CustomAnimationClip.syncPlayerCount[joiner.currentClip.syncPos]--;
				GameObject val3 = new GameObject();
				((Object)val3).name = "Yuki_NagatoProp";
				joiner.props.Add(val3);
				val3.transform.SetParent(((Component)host).transform);
				Vector3 lossyScale3 = ((Component)host).transform.lossyScale;
				val3.transform.localPosition = new Vector3(0f, 0f, 0f);
				val3.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
				val3.transform.localScale = Vector3.one;
				joiner.AssignParentGameObject(val3, true, true, true, true, true);
				joiner.currentlyLockedBoneMapper = host;
				emoteSpot.GetComponent<EmoteLocation>().SetEmoterAndHideLocation(joiner);
			}
			if (name == "Mikuru_Asahina")
			{
				joiner.PlayAnim("Mikuru_Asahina", 0);
				CustomAnimationClip.syncTimer[joiner.currentClip.syncPos] = CustomAnimationClip.syncTimer[host.currentClip.syncPos];
				CustomAnimationClip.syncPlayerCount[joiner.currentClip.syncPos]++;
				joiner.PlayAnim("Mikuru_Asahina", 0);
				CustomAnimationClip.syncPlayerCount[joiner.currentClip.syncPos]--;
				GameObject val4 = new GameObject();
				((Object)val4).name = "Mikuru_AsahinaProp";
				joiner.props.Add(val4);
				val4.transform.SetParent(((Component)host).transform);
				Vector3 lossyScale4 = ((Component)host).transform.lossyScale;
				val4.transform.localPosition = new Vector3(0f, 0f, 0f);
				val4.transform.localEulerAngles = new Vector3(0f, 0f, 0f);
				val4.transform.localScale = Vector3.one;
				joiner.AssignParentGameObject(val4, true, true, true, true, true);
				joiner.currentlyLockedBoneMapper = host;
				emoteSpot.GetComponent<EmoteLocation>().SetEmoterAndHideLocation(joiner);
			}
			if (name == "MyWorldJoinSpot")
			{
				joiner.PlayAnim("MyWorldJoin", 0);
				GameObject val5 = new GameObject();
				((Object)val5).name = "MyWorldJoinProp";
				joiner.props.Add(val5);
				val5.transform.SetParent(((Component)host).transform);
				val5.transform.localPosition = new Vector3(2f, 0f, 0f);
				val5.transform.localEulerAngles = Vector3.zero;
				val5.transform.localScale = Vector3.one;
				joiner.AssignParentGameObject(val5, true, true, true, true, true);
				joiner.currentlyLockedBoneMapper = host;
				emoteSpot.GetComponent<EmoteLocation>().SetEmoterAndHideLocation(joiner);
			}
			if (name == "VSWORLDJoinSpot")
			{
				joiner.PlayAnim("VSWORLDLEFT", 0);
				GameObject val6 = new GameObject();
				((Object)val6).name = "VSWORLDLEFTJoinProp";
				joiner.props.Add(val6);
				Vector3 localScale = ((Component)host).transform.parent.localScale;
				((Component)host).transform.parent.localScale = Vector3.one;
				val6.transform.SetParent(((Component)host).transform.parent);
				val6.transform.localPosition = new Vector3(-2f, 0f, 0f);
				val6.transform.localEulerAngles = new Vector3(90f, 0f, 0f);
				val6.transform.localScale = Vector3.one * (host.scale / joiner.scale);
				((Component)host).transform.parent.localScale = localScale;
				joiner.AssignParentGameObject(val6, true, true, false, false, true);
				joiner.currentlyLockedBoneMapper = host;
				emoteSpot.GetComponent<EmoteLocation>().SetEmoterAndHideLocation(joiner);
			}
		}

		private void CustomEmotesAPI_animChanged(string newAnimation, BoneMapper mapper)
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Expected O, but got Unknown
			//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00df: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0258: Unknown result type (might be due to invalid IL or missing references)
			//IL_0279: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
			//IL_032f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0350: Unknown result type (might be due to invalid IL or missing references)
			//IL_044e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0460: Unknown result type (might be due to invalid IL or missing references)
			//IL_052d: Unknown result type (might be due to invalid IL or missing references)
			//IL_054e: Unknown result type (might be due to invalid IL or missing references)
			//IL_081d: Unknown result type (might be due to invalid IL or missing references)
			//IL_083e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0639: Unknown result type (might be due to invalid IL or missing references)
			//IL_065a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0770: Unknown result type (might be due to invalid IL or missing references)
			//IL_0791: Unknown result type (might be due to invalid IL or missing references)
			//IL_0954: Unknown result type (might be due to invalid IL or missing references)
			//IL_0975: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a3d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a44: Expected O, but got Unknown
			//IL_0a6c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a84: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a98: Unknown result type (might be due to invalid IL or missing references)
			//IL_0a9d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0aaf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cd3: Unknown result type (might be due to invalid IL or missing references)
			//IL_0cda: Expected O, but got Unknown
			//IL_0d02: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d1a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0d2c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c24: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c45: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c8f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0c94: Unknown result type (might be due to invalid IL or missing references)
			//IL_0ddf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0e00: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f57: Unknown result type (might be due to invalid IL or missing references)
			//IL_0f78: Unknown result type (might be due to invalid IL or missing references)
			prop1 = -1;
			try
			{
				if (newAnimation != "none")
				{
					stand = mapper.currentClip.syncPos;
				}
			}
			catch (Exception)
			{
			}
			if (punchingMappers.Contains(mapper))
			{
				punchingMappers.Remove(mapper);
			}
			if (punchingMappers.Count == 0)
			{
			}
			if (newAnimation == "StandingHere")
			{
				punchingMappers.Add(mapper);
			}
			if (newAnimation == "StoodHere")
			{
				GameObject val = new GameObject();
				((Object)val).name = "StoodHereProp";
				mapper.props.Add(val);
				val.transform.localPosition = ((Component)mapper).transform.position;
				val.transform.localEulerAngles = ((Component)mapper).transform.eulerAngles;
				val.transform.localScale = Vector3.one;
				mapper.AssignParentGameObject(val, false, false, true, true, false);
			}
			if (newAnimation == "Chika")
			{
				prop1 = mapper.props.Count;
				GameObject val2 = ((Random.Range(0, 100) != 0) ? Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/prefabs/CSSDesker.prefab") : Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/models/desker.prefab"));
				mapper.props.Add(Object.Instantiate<GameObject>(val2));
				mapper.props[prop1].transform.SetParent(((Component)mapper).transform);
				mapper.props[prop1].transform.localEulerAngles = Vector3.zero;
				mapper.props[prop1].transform.localPosition = Vector3.zero;
				mapper.ScaleProps();
			}
			if (newAnimation == "MakeItRainIntro")
			{
				prop1 = mapper.props.Count;
				mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/money.prefab")));
				mapper.props[prop1].transform.SetParent(((Component)mapper).transform);
				mapper.props[prop1].transform.localEulerAngles = Vector3.zero;
				mapper.props[prop1].transform.localPosition = Vector3.zero;
				mapper.ScaleProps();
			}
			switch (newAnimation)
			{
			default:
				if (!(newAnimation == "GGGG"))
				{
					break;
				}
				goto case "DesertRivers";
			case "DesertRivers":
			case "Cirno":
			case "Haruhi":
				prop1 = mapper.props.Count;
				mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/desertlight.prefab")));
				mapper.props[prop1].transform.SetParent(((Component)mapper).transform);
				mapper.props[prop1].transform.localEulerAngles = Vector3.zero;
				mapper.props[prop1].transform.localPosition = Vector3.zero;
				break;
			}
			if (newAnimation == "HondaStep")
			{
				prop1 = mapper.props.Count;
				GameObject val3 = Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/hondastuff.prefab"));
				ParticleSystem[] componentsInChildren = val3.GetComponentsInChildren<ParticleSystem>();
				foreach (ParticleSystem val4 in componentsInChildren)
				{
					val4.time = CustomAnimationClip.syncTimer[mapper.currentClip.syncPos];
				}
				Animator componentInChildren = val3.GetComponentInChildren<Animator>();
				componentInChildren.Play("MusicSync", 0, CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] % ((AnimatorClipInfo)(ref componentInChildren.GetCurrentAnimatorClipInfo(0)[0])).clip.length / ((AnimatorClipInfo)(ref componentInChildren.GetCurrentAnimatorClipInfo(0)[0])).clip.length);
				val3.transform.SetParent(((Component)mapper).transform);
				val3.transform.localEulerAngles = Vector3.zero;
				val3.transform.localPosition = Vector3.zero;
				mapper.props.Add(val3);
			}
			if (newAnimation == "Train")
			{
				prop1 = mapper.props.Count;
				if (CustomAnimationClip.syncPlayerCount[stand] == 1)
				{
					mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/train.prefab")));
				}
				else
				{
					mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/passenger.prefab")));
				}
				mapper.props[prop1].transform.SetParent(((Component)mapper).transform);
				mapper.props[prop1].transform.localEulerAngles = Vector3.zero;
				mapper.props[prop1].transform.localPosition = Vector3.zero;
				mapper.SetAutoWalk(1f, false);
				mapper.ScaleProps();
			}
			if (newAnimation == "BimBamBom")
			{
				prop1 = mapper.props.Count;
				mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/BimBamBom.prefab")));
				ParticleSystem[] componentsInChildren2 = mapper.props[prop1].GetComponentsInChildren<ParticleSystem>();
				foreach (ParticleSystem val5 in componentsInChildren2)
				{
					val5.time = CustomAnimationClip.syncTimer[mapper.currentClip.syncPos];
				}
				mapper.props[prop1].transform.SetParent(((Component)mapper).transform);
				mapper.props[prop1].transform.localEulerAngles = Vector3.zero;
				mapper.props[prop1].transform.localPosition = Vector3.zero;
				mapper.ScaleProps();
			}
			if (newAnimation == "Summertime")
			{
				prop1 = mapper.props.Count;
				mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:Assets/Prefabs/Summermogus.prefab")));
				Animator[] componentsInChildren3 = mapper.props[prop1].GetComponentsInChildren<Animator>();
				foreach (Animator val6 in componentsInChildren3)
				{
					val6.Play("Summertime", 0, CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] % ((AnimatorClipInfo)(ref val6.GetCurrentAnimatorClipInfo(0)[0])).clip.length / ((AnimatorClipInfo)(ref val6.GetCurrentAnimatorClipInfo(0)[0])).clip.length);
				}
				mapper.props[prop1].transform.SetParent(((Component)mapper).transform);
				mapper.props[prop1].transform.localEulerAngles = Vector3.zero;
				mapper.props[prop1].transform.localPosition = Vector3.zero;
				mapper.ScaleProps();
			}
			if (newAnimation == "Float")
			{
				prop1 = mapper.props.Count;
				mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/FloatLight.prefab")));
				mapper.props[prop1].transform.SetParent(((Component)mapper).transform);
				mapper.props[prop1].transform.localEulerAngles = Vector3.zero;
				mapper.props[prop1].transform.localPosition = Vector3.zero;
				mapper.ScaleProps();
			}
			if (newAnimation == "Markiplier")
			{
				prop1 = mapper.props.Count;
				mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/Amogus.prefab")));
				Animator[] componentsInChildren4 = mapper.props[prop1].GetComponentsInChildren<Animator>();
				foreach (Animator val7 in componentsInChildren4)
				{
					val7.Play("Markimogus", 0, CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] % ((AnimatorClipInfo)(ref val7.GetCurrentAnimatorClipInfo(0)[0])).clip.length / ((AnimatorClipInfo)(ref val7.GetCurrentAnimatorClipInfo(0)[0])).clip.length);
				}
				mapper.props[prop1].transform.SetParent(((Component)mapper).transform);
				mapper.props[prop1].transform.localEulerAngles = Vector3.zero;
				mapper.props[prop1].transform.localPosition = Vector3.zero;
				mapper.ScaleProps();
			}
			if (newAnimation == "OfficerEarl")
			{
				mapper.SetAutoWalk(1f, false);
			}
			if (newAnimation == "VirtualInsanityIntro")
			{
				mapper.SetAutoWalk(0.2f, false);
			}
			if (newAnimation == "MoveIt")
			{
				mapper.SetAutoWalk(0.2f, false);
			}
			if (newAnimation == "SpringLoaded")
			{
				mapper.SetAutoWalk(-1f, false);
			}
			if (newAnimation == "FloorSamus")
			{
				mapper.SetAutoWalk(0.5f, false);
			}
			if (newAnimation == "DuckThisOneIdle")
			{
				GameObject val8 = new GameObject();
				((Object)val8).name = "DuckThisOneIdleProp";
				mapper.props.Add(val8);
				val8.transform.localPosition = ((Component)mapper).transform.position;
				val8.transform.localEulerAngles = ((Component)mapper).transform.eulerAngles + new Vector3(0f, 0f, 0f);
				val8.transform.localScale = Vector3.one;
				val8.transform.SetParent(mapper.mapperBodyTransform.parent);
				mapper.AssignParentGameObject(val8, true, true, true, true, false);
			}
			if (newAnimation == "FullTilt")
			{
				mapper.SetAutoWalk(1f, false);
			}
			if (newAnimation == "Cartwheelin")
			{
				mapper.SetAutoWalk(0.75f, false);
			}
			if (newAnimation == "Smoke")
			{
				prop1 = mapper.props.Count;
				mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/BluntAnimator.prefab")));
				Animator[] componentsInChildren5 = mapper.props[prop1].GetComponentsInChildren<Animator>();
				foreach (Animator val9 in componentsInChildren5)
				{
					val9.Play("Blunt", 0, CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] % ((AnimatorClipInfo)(ref val9.GetCurrentAnimatorClipInfo(0)[0])).clip.length / ((AnimatorClipInfo)(ref val9.GetCurrentAnimatorClipInfo(0)[0])).clip.length);
				}
				mapper.props[prop1].transform.SetParent(((Component)mapper).transform);
				mapper.props[prop1].transform.localEulerAngles = Vector3.zero;
				mapper.props[prop1].transform.localPosition = Vector3.zero;
				ParticleSystem componentInChildren2 = mapper.props[prop1].GetComponentInChildren<ParticleSystem>();
				componentInChildren2.gravityModifier *= mapper.scale;
				LimitVelocityOverLifetimeModule limitVelocityOverLifetime = mapper.props[prop1].GetComponentInChildren<ParticleSystem>().limitVelocityOverLifetime;
				((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen = ((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).dampen * mapper.scale;
				((LimitVelocityOverLifetimeModule)(ref limitVelocityOverLifetime)).limitMultiplier = mapper.scale;
				mapper.ScaleProps();
			}
			if (newAnimation == "Haruhi")
			{
				GameObject val10 = new GameObject();
				((Object)val10).name = "HaruhiProp";
				mapper.props.Add(val10);
				val10.transform.localPosition = ((Component)mapper).transform.position;
				val10.transform.localEulerAngles = ((Component)mapper).transform.eulerAngles;
				val10.transform.localScale = Vector3.one;
				mapper.AssignParentGameObject(val10, false, false, true, true, false);
			}
			if (newAnimation == "Security" && (Object)(object)mapper != (Object)(object)CustomEmotesAPI.localMapper)
			{
				prop1 = mapper.props.Count;
				mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/prefabs/neversee.prefab")));
				mapper.props[prop1].transform.SetParent(((Component)mapper).gameObject.GetComponent<Animator>().GetBoneTransform((HumanBodyBones)7));
				mapper.props[prop1].transform.localEulerAngles = Vector3.zero;
				mapper.props[prop1].transform.localPosition = Vector3.zero;
				mapper.ScaleProps();
			}
			if (newAnimation == "IFU Stage")
			{
			}
			if (newAnimation == "Hydraulic Press")
			{
			}
			if (newAnimation == "Im a Mystery")
			{
				prop1 = mapper.props.Count;
				mapper.props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/Im a Mystery.prefab")));
				Animator componentInChildren3 = mapper.props[prop1].GetComponentInChildren<Animator>();
				if (CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] < 0.4f)
				{
					componentInChildren3.Play("Mystery Model Intro", 0, CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] % 0.4f / 0.4f);
				}
				else
				{
					componentInChildren3.Play("Mstery Model", 0, (CustomAnimationClip.syncTimer[mapper.currentClip.syncPos] - 0.4f) % 7.333f / 7.333f);
				}
				mapper.props[prop1].transform.SetParent(((Component)mapper).transform);
				mapper.props[prop1].transform.localEulerAngles = Vector3.zero;
				mapper.props[prop1].transform.localPosition = Vector3.zero;
				mapper.ScaleProps();
			}
		}

		internal void AddAnimation(string AnimClip, AudioClip[] startClips, AudioClip[] loopClips, bool looping, bool dimAudio, bool sync, LockType lockType, string customName, AudioClip[] dmcaStartClips, AudioClip[] dmcaLoopClips, bool DMCA, float audio)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005c: Unknown result type (might be due to invalid IL or missing references)
			AnimationClipParams val = new AnimationClipParams();
			val.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip + ".anim") };
			val.looping = looping;
			val._primaryAudioClips = startClips;
			val._secondaryAudioClips = loopClips;
			val.dimWhenClose = dimAudio;
			val.syncAnim = sync;
			val.syncAudio = sync;
			val.lockType = lockType;
			val.customName = customName;
			val._primaryDMCAFreeAudioClips = dmcaStartClips;
			val._secondaryDMCAFreeAudioClips = dmcaLoopClips;
			val.willGetClaimedByDMCA = DMCA;
			val.audioLevel = audio;
			CustomEmotesAPI.AddCustomAnimation(val);
		}

		internal void AddAnimation(string AnimClip, string startClip, string loopClip, bool looping, bool dimAudio, bool sync, LockType lockType, string customName, string dmcaStartClip, string dmcaLoopClip, bool DMCA, float audio)
		{
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: Expected O, but got Unknown
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_0149: Unknown result type (might be due to invalid IL or missing references)
			AudioClip[] primaryAudioClips = (AudioClip[])(object)((!(startClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + startClip + ".ogg") } : null);
			AudioClip[] secondaryAudioClips = (AudioClip[])(object)((!(loopClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + loopClip + ".ogg") } : null);
			AudioClip[] primaryDMCAFreeAudioClips = (AudioClip[])(object)((!(dmcaStartClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/" + dmcaStartClip + "_NNTranscription.ogg") } : null);
			AudioClip[] secondaryDMCAFreeAudioClips = (AudioClip[])(object)((!(dmcaLoopClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/" + dmcaLoopClip + "_NNTranscription.ogg") } : null);
			AnimationClipParams val = new AnimationClipParams();
			val.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip + ".anim") };
			val.looping = looping;
			val._primaryAudioClips = primaryAudioClips;
			val._secondaryAudioClips = secondaryAudioClips;
			val.dimWhenClose = dimAudio;
			val.syncAnim = sync;
			val.syncAudio = sync;
			val.lockType = lockType;
			val.customName = customName;
			val._primaryDMCAFreeAudioClips = primaryDMCAFreeAudioClips;
			val._secondaryDMCAFreeAudioClips = secondaryDMCAFreeAudioClips;
			val.willGetClaimedByDMCA = DMCA;
			val.audioLevel = audio;
			CustomEmotesAPI.AddCustomAnimation(val);
		}

		internal void AddAnimation(string AnimClip, string AnimClip2, string startClip, string loopClip, bool looping, bool dimAudio, bool sync, LockType lockType, string customName, string dmcaStartClip, string dmcaLoopClip, bool DMCA, float audio)
		{
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ee: Expected O, but got Unknown
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			AudioClip[] primaryAudioClips = (AudioClip[])(object)((!(startClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + startClip + ".ogg") } : null);
			AudioClip[] secondaryAudioClips = (AudioClip[])(object)((!(loopClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + loopClip + ".ogg") } : null);
			AudioClip[] primaryDMCAFreeAudioClips = (AudioClip[])(object)((!(dmcaStartClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/" + dmcaStartClip + "_NNTranscription.ogg") } : null);
			AudioClip[] secondaryDMCAFreeAudioClips = (AudioClip[])(object)((!(dmcaLoopClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/" + dmcaLoopClip + "_NNTranscription.ogg") } : null);
			AnimationClipParams val = new AnimationClipParams();
			val.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip + ".anim") };
			val.secondaryAnimation = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip2 + ".anim") };
			val.looping = looping;
			val._primaryAudioClips = primaryAudioClips;
			val._secondaryAudioClips = secondaryAudioClips;
			val.dimWhenClose = dimAudio;
			val.syncAnim = sync;
			val.syncAudio = sync;
			val.lockType = lockType;
			val.customName = customName;
			val._primaryDMCAFreeAudioClips = primaryDMCAFreeAudioClips;
			val._secondaryDMCAFreeAudioClips = secondaryDMCAFreeAudioClips;
			val.willGetClaimedByDMCA = DMCA;
			val.audioLevel = audio;
			CustomEmotesAPI.AddCustomAnimation(val);
		}

		internal void AddAnimation(string AnimClip, string[] startClip, bool looping, bool dimaudio, bool sync, LockType lockType, string customName, string[] dmcaStartClips, bool DMCA, float audio)
		{
			//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a7: Expected O, but got Unknown
			//IL_0106: Unknown result type (might be due to invalid IL or missing references)
			//IL_0108: Unknown result type (might be due to invalid IL or missing references)
			List<AudioClip> list = new List<AudioClip>();
			foreach (string text in startClip)
			{
				list.Add(Assets.Load<AudioClip>("assets/compressedaudio/" + text + ".ogg"));
			}
			List<AudioClip> list2 = new List<AudioClip>();
			foreach (string text2 in dmcaStartClips)
			{
				if (text2 == "")
				{
					list2.Add(null);
				}
				else
				{
					list2.Add(Assets.Load<AudioClip>("assets/DMCAMusic/" + text2 + "_NNTranscription.ogg"));
				}
			}
			AnimationClipParams val = new AnimationClipParams();
			val.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + AnimClip + ".anim") };
			val.looping = looping;
			val._primaryAudioClips = list.ToArray();
			val._secondaryAudioClips = null;
			val.dimWhenClose = dimaudio;
			val.syncAnim = sync;
			val.syncAudio = sync;
			val.lockType = lockType;
			val.customName = customName;
			val._primaryDMCAFreeAudioClips = list2.ToArray();
			val.willGetClaimedByDMCA = DMCA;
			val.audioLevel = audio;
			CustomEmotesAPI.AddCustomAnimation(val);
		}

		internal void AddStartAndJoinAnim(string[] AnimClip, string startClip, bool looping, bool dimaudio, bool sync, LockType lockType, string customName, string dmcaStartClip, bool DMCA, float audio)
		{
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_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)
			//IL_00da: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_0100: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: 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_0108: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0117: Unknown result type (might be due to invalid IL or missing references)
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Expected O, but got Unknown
			AudioClip[] primaryAudioClips = (AudioClip[])(object)((!(startClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + startClip + ".ogg") } : null);
			AudioClip[] primaryDMCAFreeAudioClips = (AudioClip[])(object)((!(dmcaStartClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/DMCAMusic/" + dmcaStartClip + "_NNTranscription.ogg") } : null);
			List<AnimationClip> list = new List<AnimationClip>();
			foreach (string text in AnimClip)
			{
				list.Add(Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/badassemotes/" + text + ".anim"));
			}
			CustomEmotesAPI.AddCustomAnimation(new AnimationClipParams
			{
				animationClip = list.ToArray(),
				looping = looping,
				_primaryAudioClips = primaryAudioClips,
				_secondaryAudioClips = null,
				dimWhenClose = dimaudio,
				syncAnim = sync,
				syncAudio = sync,
				startPref = 0,
				joinPref = 1,
				lockType = lockType,
				customName = customName,
				_primaryDMCAFreeAudioClips = primaryDMCAFreeAudioClips,
				willGetClaimedByDMCA = DMCA,
				audioLevel = audio
			});
		}

		internal void AddStartAndJoinAnim(string[] AnimClip, string startClip, string[] AnimClip2, bool looping, bool dimaudio, bool sync, LockType lockType, string customName, string dmcaStartClip, bool DMCA, float audio)
		{
			//IL_00f9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fe: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_011e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0125: Unknown result type (might be due to invalid IL or missing references)
			//IL_012d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0135: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014b: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Unknown result type (might be due to invalid IL or missing references)
			//IL_015b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0177: Expected O, but got Unknown
			AudioClip[] primaryAudioClips = (AudioClip[])(object)((!(startClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + startClip + ".ogg") } : null);
			AudioClip[] primaryDMCAFreeAudioClips = (AudioClip[])(object)((!(dmcaStartClip == "")) ? new AudioClip[1] { Assets.Load<AudioClip>("assets/compressedaudio/" + dmcaStartClip + ".ogg") } : null);
			List<AnimationClip> list = new List<AnimationClip>();
			foreach (string text in AnimClip)
			{
				list.Add(Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/DMCAMusic/" + text + "_NNTranscription.anim"));
			}
			List<AnimationClip> list2 = new List<AnimationClip>();
			foreach (string text2 in AnimClip2)
			{
				list2.Add(Assets.Load<AnimationClip>("@ExampleEmotePlugin_badassemotes:assets/DMCAMusic/" + text2 + "_NNTranscription.anim"));
			}
			CustomEmotesAPI.AddCustomAnimation(new AnimationClipParams
			{
				animationClip = list.ToArray(),
				secondaryAnimation = list2.ToArray(),
				looping = looping,
				_primaryAudioClips = primaryAudioClips,
				dimWhenClose = dimaudio,
				syncAnim = sync,
				syncAudio = sync,
				startPref = 0,
				joinPref = 1,
				lockType = lockType,
				customName = customName,
				_primaryDMCAFreeAudioClips = primaryDMCAFreeAudioClips,
				willGetClaimedByDMCA = DMCA,
				audioLevel = audio
			});
		}
	}
	internal class HydrolicPressComponent : MonoBehaviour
	{
		private bool crushPlayer = false;

		private Transform pressTransform;

		internal BoneMapper boneMapper;

		private bool compressing = true;

		private Vector3 currentScale;

		private float doNotRevert;

		private bool spawnedFeathers = false;

		private void Start()
		{
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			((MonoBehaviour)this).StartCoroutine(CrushAfterSeconds(3.5f));
			pressTransform = BadAssEmotesPlugin.pressMechanism.transform.Find("press");
			BadAssEmotesPlugin.pressMechanism.transform.localScale = new Vector3(boneMapper.scale, boneMapper.scale, boneMapper.scale);
		}

		private void Update()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c4: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: 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_008d: 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_0266: Unknown result type (might be due to invalid IL or missing references)
			//IL_0190: Unknown result type (might be due to invalid IL or missing references)
			//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0210: Unknown result type (might be due to invalid IL or missing references)
			//IL_0294: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
			//IL_030e: Unknown result type (might be due to invalid IL or missing references)
			if (((Component)this).transform.localScale.y > 0.01f && compressing)
			{
				if (crushPlayer)
				{
					((Component)this).transform.localScale = new Vector3(((Component)this).transform.localScale.x + 0.16f * Time.deltaTime, ((Component)this).transform.localScale.y - 0.16f * Time.deltaTime, ((Component)this).transform.localScale.z + 0.16f * Time.deltaTime);
				}
				pressTransform.localScale = new Vector3(pressTransform.localScale.x, pressTransform.localScale.y, pressTransform.localScale.z + 0.154f * Time.deltaTime);
				if (!spawnedFeathers && ((Component)this).transform.localScale.y < 0.107f)
				{
					int count = boneMapper.props.Count;
					GameObject val = Assets.Load<GameObject>("@BadAssEmotes_badassemotes:assets/Prefabs/explosion press.prefab");
					boneMapper.props.Add(Object.Instantiate<GameObject>(val));
					boneMapper.props[count].transform.SetParent(((Component)boneMapper).transform);
					boneMapper.props[count].transform.localEulerAngles = new Vector3(270f, 0f, 0f);
					boneMapper.props[count].transform.localPosition = Vector3.zero;
					boneMapper.props[count].transform.SetParent((Transform)null);
					boneMapper.props[count].transform.localScale = new Vector3(boneMapper.scale, boneMapper.scale, boneMapper.scale);
					((MonoBehaviour)BadAssEmotesPlugin.instance).StartCoroutine(BadAssEmotesPlugin.instance.WaitForSecondsThenDeleteGameObject(boneMapper.props[count], 10f));
					boneMapper.props.RemoveAt(count);
					spawnedFeathers = true;
				}
				if (((Component)this).transform.localScale.y < 0.01f)
				{
					compressing = false;
					((Component)this).transform.localScale = new Vector3(((Component)this).transform.localScale.x, 0.01f, ((Component)this).transform.localScale.z);
					currentScale = ((Component)this).transform.localScale;
					doNotRevert = 0f;
					((Component)this).transform.parent = null;
					((Component)this).transform.localScale = currentScale;
					pressTransform.localScale = new Vector3(0.8631962f, 0.8631962f, 0.8631962f);
				}
			}
		}

		private void OnDestroy()
		{
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)((Component)this).transform.parent == (Object)(object)pressTransform.parent)
			{
				pressTransform.localScale = new Vector3(0.8631962f, 0.8631962f, 0.8631962f);
			}
		}

		private IEnumerator CrushAfterSeconds(float time)
		{
			yield return (object)new WaitForSeconds(time);
			crushPlayer = true;
		}
	}
	internal class HydrolicPressMechanism : MonoBehaviour
	{
		public bool lowes = false;

		private static Texture lowesTex = Assets.Load<Texture>("assets/hydrolic/textures/lowes.jpg");

		private static Texture homedepotTex = Assets.Load<Texture>("assets/hydrolic/textures/Home-Depot-Logo.jpg");

		private void Start()
		{
			//IL_006d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			BadAssEmotesPlugin.pressMechanism = ((Component)this).gameObject;
			((Renderer)((Component)this).GetComponentInChildren<MeshRenderer>()).sharedMaterials[0].mainTexture = (lowes ? lowesTex : homedepotTex);
			((Renderer)((Component)this).GetComponentInChildren<MeshRenderer>()).sharedMaterials[4].color = (lowes ? new Color(3f / 85f, 0.20392157f, 31f / 85f) : new Color(0.75686276f, 0.30980393f, 0f));
		}

		private void OnDestroy()
		{
			if ((Object)(object)BadAssEmotesPlugin.pressMechanism == (Object)(object)((Component)this).gameObject)
			{
				BadAssEmotesPlugin.pressMechanism = null;
			}
		}
	}
	public class LivingParticleArrayController : MonoBehaviour
	{
		public Transform[] affectors;

		private Vector4[] positions;

		private ParticleSystemRenderer psr;

		private void Start()
		{
			psr = ((Component)this).GetComponent<ParticleSystemRenderer>();
			Vector4[] array = (Vector4[])(object)new Vector4[120];
			((Renderer)psr).material.SetVectorArray("_Affectors", array);
		}

		private void Update()
		{
			//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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Unknown result type (might be due to invalid IL or missing references)
			positions = (Vector4[])(object)new Vector4[affectors.Length];
			for (int i = 0; i < positions.Length; i++)
			{
				if (Object.op_Implicit((Object)(object)affectors[i]))
				{
					positions[i] = Vector4.op_Implicit(affectors[i].position);
				}
				else
				{
					positions[i] = Vector4.op_Implicit(new Vector3(555f, 555f, 555f));
				}
			}
			((Renderer)psr).material.SetVectorArray("_Affectors", positions);
			((Renderer)psr).material.SetInt("_AffectorCount", affectors.Length);
		}
	}
	public class LivingParticleController : MonoBehaviour
	{
		public Transform affector;

		private ParticleSystemRenderer psr;

		private void Start()
		{
			psr = ((Component)this).GetComponent<ParticleSystemRenderer>();
		}

		private void Update()
		{
			//IL_0017: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			((Renderer)psr).material.SetVector("_Affector", Vector4.op_Implicit(affector.position));
		}
	}
	public class ParticleGridGenerator : MonoBehaviour
	{
		public bool rewriteVertexStreams = true;

		public bool GPU = false;

		public float particleSize = 1f;

		public Color particleColor = Color.white;

		public Vector3 particleRotation3D;

		public bool randomColorAlpha = true;

		public float xDistance = 0.25f;

		public float yDistance = 0.25f;

		public float zDistance = 0.25f;

		public int xSize = 10;

		public int ySize = 10;

		public int zSize = 10;

		public float OffsetEven = 0.125f;

		public bool updateEveryFrame = false;

		private float even;

		private Vector3[] positions;

		private ParticleSystem ps;

		private Particle[] particles;

		private List<Vector4> customData = new List<Vector4>();

		private List<Vector4> customData2 = new List<Vector4>();

		private void Start()
		{
			ps = ((Component)this).GetComponent<ParticleSystem>();
			UpdateGrid();
		}

		private void OnEnable()
		{
			ps = ((Component)this).GetComponent<ParticleSystem>();
			UpdateGrid();
		}

		public void UpdateGrid()
		{
			GenerateGrid();
			GenerateParticles();
			CreateOffsetVector();
			ParticleSystemRenderer component = ((Component)this).GetComponent<ParticleSystemRenderer>();
			if (rewriteVertexStreams)
			{
				ParticleSystemVertexStream[] array = new ParticleSystemVertexStream[7];
				RuntimeHelpers.InitializeArray(array, (RuntimeFieldHandle)/*OpCode not supported: LdMemberToken*/);
				component.SetActiveVertexStreams(new List<ParticleSystemVertexStream>((IEn

plugins/Gemumoddo-LethalEmotesAPI/LethalEmotesAPI.dll

Decompiled 11 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.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using AdvancedCompany.Game;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Configuration;
using BepInEx.Logging;
using EmotesAPI;
using GameNetcodeStuff;
using HarmonyLib;
using LethalCompanyInputUtils.Api;
using LethalConfig;
using LethalConfig.ConfigItems;
using LethalConfig.ConfigItems.Options;
using LethalEmotesAPI;
using LethalEmotesAPI.Core;
using LethalEmotesAPI.Data;
using LethalEmotesAPI.Patches;
using LethalEmotesAPI.Patches.ModCompat;
using LethalEmotesAPI.Utils;
using LethalEmotesApi.Ui;
using LethalEmotesApi.Ui.Data;
using LethalEmotesApi.Ui.Db;
using LethalVRM;
using Microsoft.CodeAnalysis;
using ModelReplacement;
using MonoMod.RuntimeDetour;
using MoreCompany.Cosmetics;
using Newtonsoft.Json;
using TMPro;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Rendering;
using UnityEngine.UI;

[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("AdvancedCompany")]
[assembly: IgnoresAccessChecksTo("AdvancedCompany.Preloader")]
[assembly: IgnoresAccessChecksTo("AdvancedCompany.Unity")]
[assembly: IgnoresAccessChecksTo("LethalVRM")]
[assembly: IgnoresAccessChecksTo("MToon")]
[assembly: IgnoresAccessChecksTo("UniGLTF")]
[assembly: IgnoresAccessChecksTo("UniGLTF.Utils")]
[assembly: IgnoresAccessChecksTo("UniHumanoid")]
[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("LethalEmotesAPI")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6824dbf199dd246b0a2833650efb755f5c661453")]
[assembly: AssemblyProduct("LethalEmotesAPI")]
[assembly: AssemblyTitle("LethalEmotesAPI")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
internal static class AnimationReplacements
{
	internal static GameObject g;

	internal static bool setup;

	internal static void RunAll()
	{
		ChangeAnims();
	}

	internal static BoneMapper Import(GameObject prefab, string skeleton, int[] pos, bool hidemesh = true)
	{
		GameObject val = Object.Instantiate<GameObject>(Assets.Load<GameObject>("@CustomEmotesAPI_customemotespackage:assets/animationreplacements/commando.prefab"));
		Assets.Load<GameObject>(skeleton).GetComponent<Animator>().runtimeAnimatorController = val.GetComponent<Animator>().runtimeAnimatorController;
		BoneMapper boneMapper = ApplyAnimationStuff(prefab, Object.Instantiate<GameObject>(Assets.Load<GameObject>(skeleton)), pos, hidemesh, jank: false, revertBonePositions: true);
		val.transform.SetParent(((Component)boneMapper).transform);
		return boneMapper;
	}

	public static void DebugBones(GameObject fab)
	{
		SkinnedMeshRenderer[] componentsInChildren = fab.GetComponentsInChildren<SkinnedMeshRenderer>();
		StringBuilder stringBuilder = new StringBuilder();
		stringBuilder.Append($"rendererererer: {componentsInChildren[0]}\n");
		stringBuilder.Append($"bone count: {componentsInChildren[0].bones.Length}\n");
		stringBuilder.Append($"mesh count: {componentsInChildren.Length}\n");
		stringBuilder.Append("root bone: " + ((Object)componentsInChildren[0].rootBone).name + "\n");
		stringBuilder.Append(((object)fab).ToString() + ":\n");
		SkinnedMeshRenderer[] array = componentsInChildren;
		foreach (SkinnedMeshRenderer val in array)
		{
			if (val.bones.Length == 0)
			{
				stringBuilder.Append("No bones");
			}
			else
			{
				stringBuilder.Append("[");
				Transform[] bones = val.bones;
				foreach (Transform val2 in bones)
				{
					stringBuilder.Append("'" + ((Object)val2).name + "', ");
				}
				stringBuilder.Remove(stringBuilder.Length - 2, 2);
				stringBuilder.Append("]");
			}
			stringBuilder.Append("\n\n");
			DebugClass.Log(stringBuilder.ToString());
		}
	}

	internal static void ChangeAnims()
	{
	}

	internal static void ApplyAnimationStuff(GameObject bodyPrefab, string resource, int[] pos)
	{
		GameObject animcontroller = Assets.Load<GameObject>(resource);
		ApplyAnimationStuff(bodyPrefab, animcontroller, pos);
	}

	internal static BoneMapper ApplyAnimationStuff(GameObject bodyPrefab, GameObject animcontroller, int[] pos, bool hidemeshes = true, bool jank = false, bool revertBonePositions = false)
	{
		//IL_00f0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0107: Unknown result type (might be due to invalid IL or missing references)
		//IL_0118: Unknown result type (might be due to invalid IL or missing references)
		//IL_0222: Unknown result type (might be due to invalid IL or missing references)
		//IL_0234: Unknown result type (might be due to invalid IL or missing references)
		//IL_024d: Unknown result type (might be due to invalid IL or missing references)
		//IL_025e: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (!animcontroller.GetComponentInChildren<Animator>().avatar.isHuman)
			{
				DebugClass.Log($"{animcontroller}'s avatar isn't humanoid, please fix it in unity!");
				return null;
			}
		}
		catch (Exception arg)
		{
			DebugClass.Log($"Had issue checking if avatar was humanoid: {arg}");
			throw;
		}
		try
		{
			if (hidemeshes)
			{
				SkinnedMeshRenderer[] componentsInChildren = animcontroller.GetComponentsInChildren<SkinnedMeshRenderer>();
				foreach (SkinnedMeshRenderer val in componentsInChildren)
				{
					val.sharedMesh = null;
				}
				MeshFilter[] componentsInChildren2 = animcontroller.GetComponentsInChildren<MeshFilter>();
				foreach (MeshFilter val2 in componentsInChildren2)
				{
					val2.sharedMesh = null;
				}
			}
		}
		catch (Exception arg2)
		{
			DebugClass.Log($"Had trouble while hiding meshes: {arg2}");
			throw;
		}
		Transform transform = ((Component)bodyPrefab.GetComponentInChildren<Animator>()).transform;
		try
		{
			animcontroller.transform.parent = transform;
			animcontroller.transform.localPosition = Vector3.zero;
			animcontroller.transform.eulerAngles = bodyPrefab.transform.eulerAngles;
			animcontroller.transform.localScale = Vector3.one;
		}
		catch (Exception arg3)
		{
			DebugClass.Log($"Had trouble setting emote skeletons parent: {arg3}");
			throw;
		}
		SkinnedMeshRenderer[] array = (SkinnedMeshRenderer[])(object)new SkinnedMeshRenderer[pos.Length];
		SkinnedMeshRenderer emoteSkeletonSMR;
		try
		{
			emoteSkeletonSMR = animcontroller.GetComponentsInChildren<SkinnedMeshRenderer>()[0];
		}
		catch (Exception arg4)
		{
			DebugClass.Log($"Had trouble setting emote skeletons SkinnedMeshRenderer: {arg4}");
			throw;
		}
		try
		{
			for (int k = 0; k < pos.Length; k++)
			{
				array[k] = bodyPrefab.GetComponentsInChildren<SkinnedMeshRenderer>()[pos[k]];
			}
		}
		catch (Exception arg5)
		{
			DebugClass.Log($"Had trouble setting the original skeleton's skinned mesh renderer: {arg5}");
			throw;
		}
		BoneMapper boneMapper = animcontroller.AddComponent<BoneMapper>();
		try
		{
			boneMapper.jank = jank;
			boneMapper.emoteSkeletonSMR = emoteSkeletonSMR;
			boneMapper.basePlayerModelSMR = array;
			boneMapper.bodyPrefab = bodyPrefab;
			boneMapper.basePlayerModelAnimator = ((Component)transform).GetComponentInChildren<Animator>();
			boneMapper.emoteSkeletonAnimator = animcontroller.GetComponentInChildren<Animator>();
		}
		catch (Exception arg6)
		{
			DebugClass.Log($"Had issue when setting up BoneMapper settings 1: {arg6}");
			throw;
		}
		try
		{
			GameObject val3 = Assets.Load<GameObject>("assets/customstuff/scavEmoteSkeleton.prefab");
			float num = Vector3.Distance(val3.GetComponentInChildren<Animator>().GetBoneTransform((HumanBodyBones)10).position, val3.GetComponentInChildren<Animator>().GetBoneTransform((HumanBodyBones)5).position);
			float num2 = Vector3.Distance(animcontroller.GetComponentInChildren<Animator>().GetBoneTransform((HumanBodyBones)10).position, animcontroller.GetComponentInChildren<Animator>().GetBoneTransform((HumanBodyBones)5).position);
			boneMapper.scale = num2 / num;
			boneMapper.model = ((Component)transform).gameObject;
		}
		catch (Exception arg7)
		{
			DebugClass.Log($"Had issue when setting up BoneMapper settings 2: {arg7}");
			throw;
		}
		boneMapper.revertTransform = revertBonePositions;
		return boneMapper;
	}
}
public struct WorldProp
{
	internal GameObject prop;

	internal JoinSpot[] joinSpots;

	public WorldProp(GameObject _prop, JoinSpot[] _joinSpots)
	{
		prop = _prop;
		joinSpots = _joinSpots;
	}
}
public enum TempThirdPerson
{
	none,
	on,
	off
}
public class BoneMapper : MonoBehaviour
{
	public static List<AudioClip[]> primaryAudioClips = new List<AudioClip[]>();

	public static List<AudioClip[]> secondaryAudioClips = new List<AudioClip[]>();

	public static List<AudioClip[]> primaryDMCAFreeAudioClips = new List<AudioClip[]>();

	public static List<AudioClip[]> secondaryDMCAFreeAudioClips = new List<AudioClip[]>();

	public GameObject audioObject;

	public SkinnedMeshRenderer emoteSkeletonSMR;

	public SkinnedMeshRenderer[] basePlayerModelSMR;

	public Animator basePlayerModelAnimator;

	public Animator emoteSkeletonAnimator;

	public int h;

	public List<BonePair> pairs = new List<BonePair>();

	public float timer = 0f;

	public GameObject model;

	private bool twopart = false;

	public static Dictionary<string, CustomAnimationClip> animClips = new Dictionary<string, CustomAnimationClip>();

	public CustomAnimationClip currentClip = null;

	public string currentClipName = "none";

	public string prevClipName = "none";

	public CustomAnimationClip prevClip = null;

	internal static float Current_MSX = 69f;

	internal static List<BoneMapper> allMappers = new List<BoneMapper>();

	internal static List<WorldProp> allWorldProps = new List<WorldProp>();

	public bool local = false;

	internal static bool moving = false;

	internal static bool attacking = false;

	public bool jank = false;

	public List<GameObject> props = new List<GameObject>();

	public float scale = 1f;

	internal int desiredEvent = 0;

	public int currEvent = 0;

	public float autoWalkSpeed = 0f;

	public bool overrideMoveSpeed = false;

	public bool autoWalk = false;

	public GameObject currentEmoteSpot = null;

	public GameObject reservedEmoteSpot = null;

	public bool worldProp = false;

	public bool ragdolling = false;

	public GameObject bodyPrefab;

	public int uniqueSpot = -1;

	public bool preserveProps = false;

	public bool preserveParent = false;

	internal bool useSafePositionReset = false;

	public List<EmoteLocation> emoteLocations = new List<EmoteLocation>();

	private List<string> dontAnimateUs = new List<string>();

	public bool enableAnimatorOnDeath = true;

	public bool revertTransform = false;

	public bool oneFrameAnimatorLeeWay = false;

	public GameObject mapperBody;

	public PlayerControllerB playerController;

	public EnemyAI enemyController;

	public Transform mapperBodyTransform;

	public static bool firstMapperSpawn = true;

	public static List<List<AudioSource>> listOfCurrentEmoteAudio = new List<List<AudioSource>>();

	public List<EmoteConstraint> cameraConstraints = new List<EmoteConstraint>();

	public List<EmoteConstraint> itemHolderConstraints = new List<EmoteConstraint>();

	public Transform itemHolderPosition;

	public List<EmoteConstraint> additionalConstraints = new List<EmoteConstraint>();

	public EmoteConstraint thirdPersonConstraint;

	public static Dictionary<string, string> customNamePairs = new Dictionary<string, string>();

	public Vector3 positionBeforeRootMotion = new Vector3(69f, 69f, 69f);

	public Quaternion rotationBeforeRootMotion = Quaternion.identity;

	public float currentAudioLevel = 0f;

	public TempThirdPerson temporarilyThirdPerson = TempThirdPerson.none;

	internal int originalCullingMask;

	internal bool needToTurnOffRenderingThing = false;

	public BoneMapper currentlyLockedBoneMapper;

	public static Dictionary<GameObject, BoneMapper> playersToMappers = new Dictionary<GameObject, BoneMapper>();

	public AudioSource personalAudioSource;

	public bool isServer = false;

	public int networkId;

	public bool canThirdPerson = true;

	internal bool canEmote = false;

	public GameObject parentGameObject;

	public bool positionLock;

	public bool rotationLock;

	public bool scaleLock;

	private Vector3 ogScale = new Vector3(-69f, -69f, -69f);

	private Vector3 scaleDiff = Vector3.one;

	public GameObject rotationPoint;

	public GameObject desiredCameraPos;

	public GameObject realCameraPos;

	private bool ranSinceLastAnim = false;

	public Vector3 deltaPos = new Vector3(0f, 0f, 0f);

	public Quaternion deltaRot = Quaternion.identity;

	public Vector3 prevPosition = Vector3.zero;

	public Quaternion prevRotation = Quaternion.identity;

	public Vector3 prevMapperPos = new Vector3(69f, 69f, 69f);

	public Vector3 prevMapperRot = default(Vector3);

	public bool justSwitched = false;

	public bool isEnemy = false;

	public bool isInThirdPerson = false;

	public int originalLayer = -1;

	internal bool needToTurnOffShadows = true;

	internal bool needToTurnOffCosmetics = true;

	public static string GetRealAnimationName(string animationName)
	{
		if (customNamePairs.ContainsKey(animationName))
		{
			return customNamePairs[animationName];
		}
		return animationName;
	}

	public void PlayAnim(string s, int pos, int eventNum)
	{
		desiredEvent = eventNum;
		s = GetRealAnimationName(s);
		PlayAnim(s, pos);
	}

	public void PlayAnim(string s, int pos)
	{
		//IL_0561: Unknown result type (might be due to invalid IL or missing references)
		//IL_0567: Expected O, but got Unknown
		ranSinceLastAnim = false;
		s = GetRealAnimationName(s);
		prevClipName = currentClipName;
		if (s != "none")
		{
			if (!animClips.ContainsKey(s))
			{
				DebugClass.Log("No emote bound to the name [" + s + "]");
				return;
			}
			if (animClips[s] == null)
			{
				CustomEmotesAPI.Changed(s, this);
				return;
			}
		}
		((Behaviour)emoteSkeletonAnimator).enabled = true;
		dontAnimateUs.Clear();
		try
		{
			((object)currentClip.clip[0]).ToString();
			try
			{
				if (currentClip.syncronizeAnimation || currentClip.syncronizeAudio)
				{
					CustomAnimationClip.syncPlayerCount[currentClip.syncPos]--;
				}
				audioObject.GetComponent<AudioManager>().Stop();
			}
			catch (Exception arg)
			{
				DebugClass.Log($"had issue turning off audio before new audio played step 1: {arg}");
			}
			try
			{
				if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null && currentClip.syncronizeAudio)
				{
					try
					{
						listOfCurrentEmoteAudio[currentClip.syncPos].Remove(audioObject.GetComponent<AudioSource>());
					}
					catch (Exception arg2)
					{
						DebugClass.Log($"had issue turning off audio before new audio played step 2: {arg2}");
						try
						{
							DebugClass.Log($"{prevClip.syncPos}");
							DebugClass.Log($"{currentClip.syncPos}");
							DebugClass.Log(listOfCurrentEmoteAudio[currentClip.syncPos]);
						}
						catch (Exception)
						{
						}
						try
						{
							DebugClass.Log("going to try a brute force method to avoid audio desync issues");
							foreach (List<AudioSource> item in listOfCurrentEmoteAudio)
							{
								if (item.Contains(audioObject.GetComponent<AudioSource>()))
								{
									item.Remove(audioObject.GetComponent<AudioSource>());
								}
							}
						}
						catch (Exception arg3)
						{
							DebugClass.Log($"wow {arg3}");
						}
					}
				}
			}
			catch (Exception ex2)
			{
				DebugClass.Log($"had issue turning off audio before new audio played step 3: {primaryAudioClips[currentClip.syncPos]} {currentClip.syncPos} {currEvent} {ex2}");
			}
			try
			{
				if (uniqueSpot != -1 && CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot])
				{
					CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot] = false;
					uniqueSpot = -1;
				}
			}
			catch (Exception arg4)
			{
				DebugClass.Log($"had issue turning off audio before new audio played step 4: {arg4}");
			}
		}
		catch (Exception)
		{
		}
		currEvent = 0;
		currentClipName = s;
		if (s != "none")
		{
			prevClip = currentClip;
			currentClip = animClips[s];
			try
			{
				((object)currentClip.clip[0]).ToString();
			}
			catch (Exception)
			{
				return;
			}
			if (pos == -2)
			{
				pos = ((CustomAnimationClip.syncPlayerCount[animClips[s].syncPos] != 0) ? animClips[s].joinPref : animClips[s].startPref);
			}
			if (pos == -2)
			{
				for (int i = 0; i < CustomAnimationClip.uniqueAnimations[currentClip.syncPos].Count; i++)
				{
					if (!CustomAnimationClip.uniqueAnimations[currentClip.syncPos][i])
					{
						pos = i;
						uniqueSpot = pos;
						CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot] = true;
						break;
					}
				}
				if (uniqueSpot == -1)
				{
					pos = -1;
				}
			}
			if (pos == -1)
			{
				pos = Random.Range(0, currentClip.clip.Length);
			}
			LockBones();
		}
		if (s == "none")
		{
			emoteSkeletonAnimator.Play("none", -1, 0f);
			twopart = false;
			prevClip = currentClip;
			currentClip = null;
			NewAnimation(null);
			CustomEmotesAPI.Changed(s, this);
			return;
		}
		AnimatorOverrideController animController = new AnimatorOverrideController(emoteSkeletonAnimator.runtimeAnimatorController);
		if (currentClip.syncronizeAnimation || currentClip.syncronizeAudio)
		{
			CustomAnimationClip.syncPlayerCount[currentClip.syncPos]++;
		}
		if (currentClip.syncronizeAnimation && CustomAnimationClip.syncPlayerCount[currentClip.syncPos] == 1)
		{
			CustomAnimationClip.syncTimer[currentClip.syncPos] = 0f;
		}
		if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null)
		{
			if (CustomAnimationClip.syncPlayerCount[currentClip.syncPos] == 1 && currentClip.syncronizeAudio)
			{
				if (desiredEvent != -1)
				{
					currEvent = desiredEvent;
				}
				else
				{
					currEvent = Random.Range(0, primaryAudioClips[currentClip.syncPos].Length);
				}
				foreach (BoneMapper allMapper in allMappers)
				{
					allMapper.currEvent = currEvent;
				}
				if (currentClip.customPostEventCodeSync != null)
				{
					currentClip.customPostEventCodeSync(this);
				}
			}
			else if (!currentClip.syncronizeAudio)
			{
				currEvent = Random.Range(0, primaryAudioClips[currentClip.syncPos].Length);
				if (currentClip.customPostEventCodeNoSync != null)
				{
					currentClip.customPostEventCodeNoSync(this);
				}
			}
			currentAudioLevel = currentClip.audioLevel;
			audioObject.GetComponent<AudioManager>().Play(currentClip.syncPos, currEvent, currentClip.looping, currentClip.syncronizeAudio, currentClip.willGetClaimed);
			if (currentClip.syncronizeAudio && (Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null)
			{
				listOfCurrentEmoteAudio[currentClip.syncPos].Add(audioObject.GetComponent<AudioSource>());
			}
		}
		SetAnimationSpeed(1f);
		StartAnimations(animController, pos, emoteSkeletonAnimator);
		if (local && CustomEmotesAPI.hudObject != null)
		{
			if (currentClip.displayName != "")
			{
				((TMP_Text)CustomEmotesAPI.currentEmoteText).text = currentClip.displayName;
			}
			else if (currentClip.customName != "")
			{
				((TMP_Text)CustomEmotesAPI.currentEmoteText).text = currentClip.customName;
			}
			else if (!currentClip.visibility)
			{
				((TMP_Text)CustomEmotesAPI.currentEmoteText).text = "";
			}
			else
			{
				((TMP_Text)CustomEmotesAPI.currentEmoteText).text = currentClipName;
			}
		}
		twopart = false;
		NewAnimation(currentClip.joinSpots);
		CustomEmotesAPI.Changed(s, this);
	}

	public void StartAnimations(AnimatorOverrideController animController, int pos, Animator animator)
	{
		if (currentClip.secondaryClip != null && currentClip.secondaryClip.Length != 0)
		{
			bool flag = true;
			if (CustomAnimationClip.syncTimer[currentClip.syncPos] > currentClip.clip[pos].length)
			{
				animController["Floss"] = currentClip.secondaryClip[pos];
				animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)animController;
				animator.Play("Loop", -1, (CustomAnimationClip.syncTimer[currentClip.syncPos] - currentClip.clip[pos].length) % currentClip.secondaryClip[pos].length / currentClip.secondaryClip[pos].length);
			}
			else
			{
				animController["Dab"] = currentClip.clip[pos];
				animController["nobones"] = currentClip.secondaryClip[pos];
				animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)animController;
				animator.Play("PoopToLoop", -1, CustomAnimationClip.syncTimer[currentClip.syncPos] % currentClip.clip[pos].length / currentClip.clip[pos].length);
			}
		}
		else if (((Motion)currentClip.clip[0]).isLooping)
		{
			animController["Floss"] = currentClip.clip[pos];
			animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)animController;
			if (currentClip.clip[pos].length != 0f)
			{
				animator.Play("Loop", -1, CustomAnimationClip.syncTimer[currentClip.syncPos] % currentClip.clip[pos].length / currentClip.clip[pos].length);
			}
			else
			{
				animator.Play("Loop", -1, 0f);
			}
		}
		else
		{
			animController["Default Dance"] = currentClip.clip[pos];
			animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)animController;
			animator.Play("Poop", -1, CustomAnimationClip.syncTimer[currentClip.syncPos] % currentClip.clip[pos].length / currentClip.clip[pos].length);
		}
	}

	public static void PreviewAnimations(Animator animator, string animation)
	{
		//IL_0007: Unknown result type (might be due to invalid IL or missing references)
		//IL_000d: Expected O, but got Unknown
		AnimatorOverrideController val = new AnimatorOverrideController(animator.runtimeAnimatorController);
		CustomAnimationClip customAnimationClip = animClips[GetRealAnimationName(animation)];
		if (customAnimationClip != null)
		{
			int num = 0;
			if (customAnimationClip.secondaryClip != null && customAnimationClip.secondaryClip.Length != 0)
			{
				val["Dab"] = customAnimationClip.clip[num];
				val["nobones"] = customAnimationClip.secondaryClip[num];
				animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)val;
				animator.Play("PoopToLoop", -1, 0f);
			}
			else if (((Motion)customAnimationClip.clip[0]).isLooping)
			{
				val["Floss"] = customAnimationClip.clip[num];
				animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)val;
				animator.Play("Loop", -1, 0f);
			}
			else
			{
				val["Default Dance"] = customAnimationClip.clip[num];
				animator.runtimeAnimatorController = (RuntimeAnimatorController)(object)val;
				animator.Play("Poop", -1, 0f);
			}
		}
	}

	public void SetAnimationSpeed(float speed)
	{
		emoteSkeletonAnimator.speed = speed;
	}

	internal void NewAnimation(JoinSpot[] locations)
	{
		//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_0102: Unknown result type (might be due to invalid IL or missing references)
		//IL_011d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			try
			{
				emoteLocations.Clear();
				autoWalkSpeed = 0f;
				autoWalk = false;
				overrideMoveSpeed = false;
				if (Object.op_Implicit((Object)(object)parentGameObject) && !preserveParent)
				{
					parentGameObject = null;
				}
			}
			catch (Exception)
			{
			}
			try
			{
				useSafePositionReset = currentClip.useSafePositionReset;
			}
			catch (Exception)
			{
				useSafePositionReset = true;
			}
			try
			{
				if (preserveParent)
				{
					preserveParent = false;
				}
				else
				{
					mapperBody.gameObject.transform.localEulerAngles = new Vector3(0f, mapperBody.gameObject.transform.localEulerAngles.y, 0f);
					if (ogScale != new Vector3(-69f, -69f, -69f))
					{
						mapperBody.transform.localScale = ogScale;
						ogScale = new Vector3(-69f, -69f, -69f);
					}
					Collider[] componentsInChildren = mapperBody.GetComponentsInChildren<Collider>();
					foreach (Collider val in componentsInChildren)
					{
						val.enabled = true;
					}
					if (Object.op_Implicit((Object)(object)mapperBody.GetComponent<CharacterController>()))
					{
						((Collider)mapperBody.GetComponent<CharacterController>()).enabled = true;
					}
				}
			}
			catch (Exception)
			{
			}
			if (preserveProps)
			{
				preserveProps = false;
			}
			else
			{
				foreach (GameObject prop in props)
				{
					if (Object.op_Implicit((Object)(object)prop))
					{
						Object.Destroy((Object)(object)prop);
					}
				}
				props.Clear();
			}
			if (locations != null)
			{
				for (int j = 0; j < locations.Length; j++)
				{
					SpawnJoinSpot(locations[j]);
				}
			}
		}
		catch (Exception arg)
		{
			DebugClass.Log($"error during new animation: {arg}");
		}
	}

	public void ScaleProps()
	{
		//IL_0067: Unknown result type (might be due to invalid IL or missing references)
		foreach (GameObject prop in props)
		{
			if (Object.op_Implicit((Object)(object)prop))
			{
				Transform parent = prop.transform.parent;
				prop.transform.SetParent((Transform)null);
				prop.transform.localScale = new Vector3(scale * 1.15f, scale * 1.15f, scale * 1.15f);
				prop.transform.SetParent(parent);
			}
		}
	}

	internal IEnumerator preventEmotesInSpawnAnimation()
	{
		yield return (object)new WaitForSeconds(3f);
		canEmote = true;
	}

	private void Start()
	{
		//IL_015a: Unknown result type (might be due to invalid IL or missing references)
		//IL_03e8: Unknown result type (might be due to invalid IL or missing references)
		if (worldProp)
		{
			return;
		}
		if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform).GetComponentInParent<PlayerControllerB>()))
		{
			mapperBody = ((Component)((Component)((Component)this).transform).GetComponentInParent<PlayerControllerB>()).gameObject;
			networkId = (int)((NetworkBehaviour)mapperBody.GetComponent<PlayerControllerB>()).NetworkObjectId;
		}
		else if (Object.op_Implicit((Object)(object)((Component)((Component)this).transform).GetComponentInParent<EnemyAI>()))
		{
			mapperBody = ((Component)((Component)((Component)this).transform).GetComponentInParent<EnemyAI>()).gameObject;
			networkId = -1;
			isEnemy = CustomEmotesAPI.localMapper.isServer;
		}
		else
		{
			networkId = -1;
			mapperBody = ((Component)this).gameObject;
		}
		playerController = mapperBody.GetComponent<PlayerControllerB>();
		if (playerController == null)
		{
			enemyController = mapperBody.GetComponent<EnemyAI>();
		}
		playersToMappers.Add(mapperBody, this);
		mapperBodyTransform = mapperBody.transform;
		allMappers.Add(this);
		GameObject val = Object.Instantiate<GameObject>(Assets.Load<GameObject>("assets/source1.prefab"));
		((Object)val).name = ((Object)this).name + "_AudioObject";
		val.transform.SetParent(mapperBody.transform);
		val.transform.localPosition = Vector3.zero;
		val.AddComponent<SphereCollider>().radius = 0.01f;
		val.layer = 6;
		personalAudioSource = val.GetComponent<AudioSource>();
		val.AddComponent<AudioManager>().Setup(personalAudioSource, this);
		personalAudioSource.playOnAwake = false;
		personalAudioSource.volume = Settings.EmotesVolume.Value / 100f;
		audioObject = val;
		int num = 0;
		if (true)
		{
			SkinnedMeshRenderer[] array = basePlayerModelSMR;
			foreach (SkinnedMeshRenderer val2 in array)
			{
				int num2 = 0;
				for (int j = 0; j < emoteSkeletonSMR.bones.Length; j++)
				{
					for (int k = num2; k < val2.bones.Length; k++)
					{
						if (((Object)emoteSkeletonSMR.bones[j]).name == ((Object)val2.bones[k]).name && !Object.op_Implicit((Object)(object)((Component)val2.bones[k]).gameObject.GetComponent<EmoteConstraint>()))
						{
							num2 = k;
							EmoteConstraint emoteConstraint = ((Component)val2.bones[k]).gameObject.AddComponent<EmoteConstraint>();
							emoteConstraint.AddSource(ref val2.bones[k], ref emoteSkeletonSMR.bones[j]);
							emoteConstraint.revertTransform = revertTransform;
							break;
						}
						if (k == num2 - 1)
						{
							break;
						}
						if (num2 > 0 && k == val2.bones.Length - 1)
						{
							k = -1;
						}
					}
				}
			}
		}
		if (jank)
		{
			SkinnedMeshRenderer[] array2 = basePlayerModelSMR;
			foreach (SkinnedMeshRenderer val3 in array2)
			{
				for (int m = 0; m < val3.bones.Length; m++)
				{
					try
					{
						if (Object.op_Implicit((Object)(object)((Component)val3.bones[m]).gameObject.GetComponent<EmoteConstraint>()))
						{
							((Component)val3.bones[m]).gameObject.GetComponent<EmoteConstraint>().ActivateConstraints();
						}
					}
					catch (Exception arg)
					{
						DebugClass.Log($"{arg}");
					}
				}
			}
		}
		((Component)this).transform.localPosition = Vector3.zero;
		CustomEmotesAPI.MapperCreated(this);
		if (playerController != null)
		{
			((MonoBehaviour)this).StartCoroutine(SetupHandConstraint());
		}
		((MonoBehaviour)this).StartCoroutine(preventEmotesInSpawnAnimation());
	}

	public IEnumerator SetupHandConstraint()
	{
		while (!Object.op_Implicit((Object)(object)CustomEmotesAPI.localMapper))
		{
			yield return (object)new WaitForEndOfFrame();
		}
		itemHolderPosition = ((Component)this).GetComponentInChildren<Animator>().GetBoneTransform((HumanBodyBones)18).Find("ServerItemHolder");
		itemHolderConstraints.Add(EmoteConstraint.AddConstraint(((Component)mapperBody.transform.Find("ScavengerModel/metarig/spine/spine.001/spine.002/spine.003/shoulder.R/arm.R_upper/arm.R_lower/hand.R/ServerItemHolder")).gameObject, this, itemHolderPosition));
		itemHolderConstraints.Add(EmoteConstraint.AddConstraint(((Component)mapperBody.transform.Find("ScavengerModel/metarig/ScavengerModelArmsOnly/metarig/spine.003/shoulder.R/arm.R_upper/arm.R_lower/hand.R/LocalItemHolder")).gameObject, this, itemHolderPosition));
	}

	public void AssignParentGameObject(GameObject youAreTheFather, bool lockPosition, bool lockRotation, bool lockScale, bool scaleAsScavenger = true, bool disableCollider = true)
	{
		//IL_0026: 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)
		//IL_0051: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_0038: Unknown result type (might be due to invalid IL or missing references)
		//IL_0043: Unknown result type (might be due to invalid IL or missing references)
		//IL_0048: Unknown result type (might be due to invalid IL or missing references)
		if (Object.op_Implicit((Object)(object)parentGameObject))
		{
			NewAnimation(null);
		}
		ogScale = mapperBody.transform.localScale;
		if (scaleAsScavenger)
		{
			scaleDiff = ogScale / scale;
		}
		else
		{
			scaleDiff = ogScale;
		}
		parentGameObject = youAreTheFather;
		positionLock = lockPosition;
		rotationLock = lockRotation;
		scaleLock = lockScale;
		Collider[] componentsInChildren = mapperBody.GetComponentsInChildren<Collider>();
		foreach (Collider val in componentsInChildren)
		{
			val.enabled = !disableCollider;
		}
		if (Object.op_Implicit((Object)(object)mapperBody.GetComponent<CharacterController>()))
		{
			((Collider)mapperBody.GetComponent<CharacterController>()).enabled = !disableCollider;
		}
		if (disableCollider && Object.op_Implicit((Object)(object)currentEmoteSpot))
		{
			if (currentEmoteSpot.GetComponent<EmoteLocation>().validPlayers != 0)
			{
				currentEmoteSpot.GetComponent<EmoteLocation>().validPlayers--;
			}
			currentEmoteSpot.GetComponent<EmoteLocation>().SetColor();
			currentEmoteSpot = null;
		}
	}

	private void LocalFunctions()
	{
		try
		{
			if (moving && currentClip.stopOnMove)
			{
				CustomEmotesAPI.PlayAnimation("none");
			}
		}
		catch (Exception)
		{
		}
	}

	private void GetLocal()
	{
		//IL_0082: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Expected O, but got Unknown
		//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
		//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Expected O, but got Unknown
		//IL_0133: Unknown result type (might be due to invalid IL or missing references)
		//IL_0149: Unknown result type (might be due to invalid IL or missing references)
		//IL_0155: Unknown result type (might be due to invalid IL or missing references)
		//IL_015f: Expected O, but got Unknown
		//IL_0186: Unknown result type (might be due to invalid IL or missing references)
		//IL_019c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0209: Unknown result type (might be due to invalid IL or missing references)
		//IL_0210: Expected O, but got Unknown
		//IL_0239: Unknown result type (might be due to invalid IL or missing references)
		//IL_025a: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			if (!Object.op_Implicit((Object)(object)CustomEmotesAPI.localMapper) && (Object)(object)playerController == (Object)(object)StartOfRound.Instance.localPlayerController)
			{
				CustomEmotesAPI.localMapper = this;
				local = true;
				isServer = ((NetworkBehaviour)playerController).IsServer && ((NetworkBehaviour)playerController).IsOwner;
				HealthbarAnimator.Setup(this);
				Camera gameplayCamera = playerController.gameplayCamera;
				if (gameplayCamera != null)
				{
					rotationPoint = new GameObject();
					rotationPoint.transform.SetParent(((Component)gameplayCamera).transform.parent.parent.parent.parent);
					rotationPoint.transform.localPosition = new Vector3(0f, 0.8f, 0f);
					rotationPoint.transform.localEulerAngles = Vector3.zero;
					desiredCameraPos = new GameObject();
					desiredCameraPos.transform.SetParent(rotationPoint.transform);
					desiredCameraPos.transform.localPosition = new Vector3(0.3f, 1f, -3f);
					desiredCameraPos.transform.localEulerAngles = Vector3.zero;
					realCameraPos = new GameObject();
					realCameraPos.transform.SetParent(desiredCameraPos.transform);
					realCameraPos.transform.localPosition = Vector3.zero;
					realCameraPos.transform.localEulerAngles = Vector3.zero;
					thirdPersonConstraint = EmoteConstraint.AddConstraint(((Component)((Component)gameplayCamera).transform.parent).gameObject, this, realCameraPos.transform);
					thirdPersonConstraint.debug = true;
					cameraConstraints.Add(EmoteConstraint.AddConstraint(((Component)((Component)gameplayCamera).transform.parent).gameObject, this, ((Component)this).GetComponentInChildren<Animator>().GetBoneTransform((HumanBodyBones)10)));
					GameObject val = new GameObject();
					val.transform.SetParent(((Component)gameplayCamera).transform);
					val.transform.localPosition = new Vector3(0.01f, -0.048f, -0.053f);
					val.transform.localEulerAngles = new Vector3(270f, 0f, 0f);
					cameraConstraints.Add(EmoteConstraint.AddConstraint(((Component)StartOfRound.Instance.localPlayerController.localVisor).gameObject, this, val.transform));
				}
			}
		}
		catch (Exception message)
		{
			DebugClass.Log(message);
		}
	}

	private void TwoPartThing()
	{
		//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)
		AnimatorStateInfo currentAnimatorStateInfo = emoteSkeletonAnimator.GetCurrentAnimatorStateInfo(0);
		if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("none"))
		{
			if (ranSinceLastAnim)
			{
				return;
			}
			if (twopart)
			{
				ranSinceLastAnim = true;
				if (((Behaviour)emoteSkeletonAnimator).enabled && !jank)
				{
					UnlockBones();
				}
				if (!ragdolling)
				{
					((Behaviour)basePlayerModelAnimator).enabled = true;
					oneFrameAnimatorLeeWay = true;
				}
				((Behaviour)emoteSkeletonAnimator).enabled = false;
				try
				{
					currentClip.clip.ToString();
					CustomEmotesAPI.Changed("none", this);
					NewAnimation(null);
					if (currentClip.syncronizeAnimation || currentClip.syncronizeAudio)
					{
						CustomAnimationClip.syncPlayerCount[currentClip.syncPos]--;
					}
					if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null)
					{
						audioObject.GetComponent<AudioManager>().Stop();
						if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null && currentClip.syncronizeAudio)
						{
							listOfCurrentEmoteAudio[currentClip.syncPos].Remove(audioObject.GetComponent<AudioSource>());
						}
					}
					prevClip = currentClip;
					currentClip = null;
					return;
				}
				catch (Exception)
				{
					return;
				}
			}
			twopart = true;
		}
		else
		{
			twopart = false;
		}
	}

	private void Health()
	{
	}

	private void WorldPropAndParent()
	{
		//IL_003a: 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_0074: 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_00e0: Unknown result type (might be due to invalid IL or missing references)
		//IL_0101: Unknown result type (might be due to invalid IL or missing references)
		//IL_0122: Unknown result type (might be due to invalid IL or missing references)
		//IL_0138: Unknown result type (might be due to invalid IL or missing references)
		if (!Object.op_Implicit((Object)(object)parentGameObject))
		{
			return;
		}
		if (positionLock)
		{
			mapperBody.gameObject.transform.position = parentGameObject.transform.position + new Vector3(0f, 1f, 0f);
			mapperBody.transform.position = parentGameObject.transform.position;
			PlayerControllerB obj = playerController;
			if (obj != null)
			{
				obj.ResetFallGravity();
			}
		}
		if (rotationLock)
		{
			mapperBody.transform.rotation = parentGameObject.transform.rotation;
		}
		if (scaleLock)
		{
			mapperBody.transform.localScale = new Vector3(parentGameObject.transform.localScale.x * scaleDiff.x, parentGameObject.transform.localScale.y * scaleDiff.y, parentGameObject.transform.localScale.z * scaleDiff.z);
		}
	}

	private void Update()
	{
		if (!worldProp)
		{
			WorldPropAndParent();
			if (local)
			{
				LocalFunctions();
			}
			else
			{
				GetLocal();
			}
			TwoPartThing();
			Health();
			SetDeltaPosition();
			RootMotion();
			CameraControls();
		}
	}

	internal bool ThirdPersonCheck()
	{
		return !CustomEmotesAPI.LCThirdPersonPresent && currentClip != null && (((currentClip.thirdPerson || Settings.thirdPersonType.Value == ThirdPersonType.All) && Settings.thirdPersonType.Value != ThirdPersonType.None) || temporarilyThirdPerson == TempThirdPerson.on) && canThirdPerson;
	}

	public void CameraControls()
	{
		//IL_0029: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_005a: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ad: Unknown result type (might be due to invalid IL or missing references)
		//IL_008c: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00eb: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
		//IL_0126: Unknown result type (might be due to invalid IL or missing references)
		if (local && isInThirdPerson)
		{
			Ray val = default(Ray);
			((Ray)(ref val))..ctor(emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10).position, desiredCameraPos.transform.position - emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10).position);
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(val, ref val2, 10f, 268437761, (QueryTriggerInteraction)1))
			{
				realCameraPos.transform.position = ((Ray)(ref val)).GetPoint(((RaycastHit)(ref val2)).distance - 0.25f);
			}
			else
			{
				realCameraPos.transform.position = ((Ray)(ref val)).GetPoint(10f);
			}
			if (Vector3.Distance(realCameraPos.transform.position, emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10).position) > Vector3.Distance(desiredCameraPos.transform.position, emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10).position))
			{
				realCameraPos.transform.position = desiredCameraPos.transform.position;
			}
		}
	}

	private void SetDeltaPosition()
	{
		//IL_0008: 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_0013: 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)
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002a: Unknown result type (might be due to invalid IL or missing references)
		//IL_002f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0039: Unknown result type (might be due to invalid IL or missing references)
		//IL_0045: Unknown result type (might be due to invalid IL or missing references)
		//IL_004a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0056: Unknown result type (might be due to invalid IL or missing references)
		//IL_005b: Unknown result type (might be due to invalid IL or missing references)
		deltaPos = ((Component)this).transform.position - prevPosition;
		deltaRot = ((Component)this).transform.rotation * Quaternion.Inverse(prevRotation);
		prevPosition = ((Component)this).transform.position;
		prevRotation = ((Component)this).transform.rotation;
	}

	public void RootMotion()
	{
		//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_029f: Unknown result type (might be due to invalid IL or missing references)
		//IL_02b1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01fe: Unknown result type (might be due to invalid IL or missing references)
		//IL_0203: Unknown result type (might be due to invalid IL or missing references)
		//IL_0093: Unknown result type (might be due to invalid IL or missing references)
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_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_00be: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e9: 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_0210: Unknown result type (might be due to invalid IL or missing references)
		//IL_0215: Unknown result type (might be due to invalid IL or missing references)
		//IL_0177: Unknown result type (might be due to invalid IL or missing references)
		//IL_0185: Unknown result type (might be due to invalid IL or missing references)
		//IL_018e: Unknown result type (might be due to invalid IL or missing references)
		//IL_01a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_012f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0146: Unknown result type (might be due to invalid IL or missing references)
		//IL_015b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0165: Unknown result type (might be due to invalid IL or missing references)
		//IL_027c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0287: Unknown result type (might be due to invalid IL or missing references)
		//IL_024c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0257: Unknown result type (might be due to invalid IL or missing references)
		//IL_01bf: Unknown result type (might be due to invalid IL or missing references)
		//IL_01d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
		try
		{
			AnimatorStateInfo currentAnimatorStateInfo = emoteSkeletonAnimator.GetCurrentAnimatorStateInfo(0);
			if (((AnimatorStateInfo)(ref currentAnimatorStateInfo)).IsName("none"))
			{
				return;
			}
			if (justSwitched)
			{
				justSwitched = false;
			}
			else
			{
				if (currentClip.lockType != AnimationClipParams.LockType.rootMotion)
				{
					return;
				}
				if (local || isEnemy)
				{
					if (Settings.rootMotionType.Value != RootMotionType.None || isEnemy)
					{
						Vector3 position = ((Component)this).transform.position;
						Quaternion rotation = ((Component)this).transform.rotation;
						mapperBody.transform.position = new Vector3(emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)7).position.x, mapperBody.transform.position.y, emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)7).position.z);
						if (isEnemy || !isInThirdPerson)
						{
							mapperBody.transform.eulerAngles = new Vector3(mapperBody.transform.eulerAngles.x, emoteSkeletonAnimator.GetBoneTransform((HumanBodyBones)10).eulerAngles.y, mapperBody.transform.eulerAngles.z);
						}
						((Component)this).transform.position = position;
						((Component)this).transform.rotation = rotation;
						if (positionBeforeRootMotion != new Vector3(69f, 69f, 69f))
						{
							mapperBody.transform.position = positionBeforeRootMotion;
							mapperBody.transform.rotation = rotationBeforeRootMotion;
							positionBeforeRootMotion = new Vector3(69f, 69f, 69f);
						}
					}
					if (deltaPos != Vector3.zero || deltaRot != Quaternion.identity)
					{
						if (isEnemy)
						{
							EmoteNetworker.instance.SyncBoneMapperPos(((NetworkBehaviour)enemyController).NetworkObjectId, ((Component)this).transform.position, ((Component)this).transform.eulerAngles);
						}
						else
						{
							EmoteNetworker.instance.SyncBoneMapperPos(((NetworkBehaviour)playerController).NetworkObjectId, ((Component)this).transform.position, ((Component)this).transform.eulerAngles);
						}
					}
				}
				else
				{
					((Component)this).transform.position = prevMapperPos;
					((Component)this).transform.eulerAngles = prevMapperRot;
				}
			}
		}
		catch (Exception)
		{
		}
	}

	public int SpawnJoinSpot(JoinSpot joinSpot)
	{
		DebugClass.Log("Spawning Join Spot");
		props.Add(Object.Instantiate<GameObject>(Assets.Load<GameObject>("@CustomEmotesAPI_customemotespackage:assets/emotejoiner/JoinVisual.prefab")));
		props[props.Count - 1].transform.SetParent(((Component)this).transform);
		((Object)props[props.Count - 1]).name = joinSpot.name;
		EmoteLocation emoteLocation = props[props.Count - 1].AddComponent<EmoteLocation>();
		emoteLocation.joinSpot = joinSpot;
		emoteLocation.owner = this;
		emoteLocations.Add(emoteLocation);
		return props.Count - 1;
	}

	public void JoinEmoteSpot()
	{
		if (Object.op_Implicit((Object)(object)reservedEmoteSpot))
		{
			if (Object.op_Implicit((Object)(object)currentEmoteSpot))
			{
				if (currentEmoteSpot.GetComponent<EmoteLocation>().validPlayers != 0)
				{
					currentEmoteSpot.GetComponent<EmoteLocation>().validPlayers--;
				}
				currentEmoteSpot.GetComponent<EmoteLocation>().SetColor();
			}
			currentEmoteSpot = reservedEmoteSpot;
			reservedEmoteSpot = null;
		}
		int i;
		for (i = 0; i < ((Component)currentEmoteSpot.transform.parent).GetComponentsInChildren<EmoteLocation>().Length && !((Object)(object)((Component)currentEmoteSpot.transform.parent).GetComponentsInChildren<EmoteLocation>()[i] == (Object)(object)currentEmoteSpot.GetComponent<EmoteLocation>()); i++)
		{
		}
		if (currentEmoteSpot.GetComponent<EmoteLocation>().owner.worldProp)
		{
			EmoteNetworker.instance.SyncJoinSpot(mapperBody.GetComponent<NetworkObject>().NetworkObjectId, currentEmoteSpot.GetComponentInParent<NetworkObject>().NetworkObjectId, worldProp: true, i);
		}
		else
		{
			EmoteNetworker.instance.SyncJoinSpot(mapperBody.GetComponent<NetworkObject>().NetworkObjectId, currentEmoteSpot.GetComponentInParent<NetworkObject>().NetworkObjectId, worldProp: false, i);
		}
	}

	public void RemoveProp(int propPos)
	{
		Object.Destroy((Object)(object)props[propPos]);
	}

	public void SetAutoWalk(float speed, bool overrideBaseMovement, bool autoWalk)
	{
		autoWalkSpeed = speed;
		overrideMoveSpeed = overrideBaseMovement;
		this.autoWalk = autoWalk;
	}

	public void SetAutoWalk(float speed, bool overrideBaseMovement)
	{
		autoWalkSpeed = speed;
		overrideMoveSpeed = overrideBaseMovement;
		autoWalk = true;
	}

	internal IEnumerator waitForTwoFramesThenDisableA1()
	{
		yield return (object)new WaitForEndOfFrame();
	}

	private void OnDestroy()
	{
		playersToMappers.Remove(mapperBody);
		try
		{
			((object)currentClip.clip[0]).ToString();
			NewAnimation(null);
			if ((currentClip.syncronizeAnimation || currentClip.syncronizeAudio) && CustomAnimationClip.syncPlayerCount[currentClip.syncPos] > 0)
			{
				CustomAnimationClip.syncPlayerCount[currentClip.syncPos]--;
			}
			if ((Object)(object)primaryAudioClips[currentClip.syncPos][currEvent] != (Object)null)
			{
				audioObject.GetComponent<AudioManager>().Stop();
				if (currentClip.syncronizeAudio)
				{
					listOfCurrentEmoteAudio[currentClip.syncPos].Remove(audioObject.GetComponent<AudioSource>());
				}
			}
			if (uniqueSpot != -1 && CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot])
			{
				CustomAnimationClip.uniqueAnimations[currentClip.syncPos][uniqueSpot] = false;
				uniqueSpot = -1;
			}
			allMappers.Remove(this);
			prevClip = currentClip;
			currentClip = null;
		}
		catch (Exception)
		{
			allMappers.Remove(this);
		}
	}

	public void UnlockBones(bool animatorEnabled = true)
	{
		//IL_0007: 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)
		((Component)this).transform.localPosition = Vector3.zero;
		((Component)this).transform.eulerAngles = bodyPrefab.transform.eulerAngles;
		SkinnedMeshRenderer[] array = basePlayerModelSMR;
		foreach (SkinnedMeshRenderer val in array)
		{
			for (int j = 0; j < val.bones.Length; j++)
			{
				try
				{
					if (Object.op_Implicit((Object)(object)((Component)val.bones[j]).gameObject.GetComponent<EmoteConstraint>()))
					{
						((Component)val.bones[j]).gameObject.GetComponent<EmoteConstraint>().DeactivateConstraints();
					}
				}
				catch (Exception)
				{
					break;
				}
			}
		}
		foreach (EmoteConstraint cameraConstraint in cameraConstraints)
		{
			cameraConstraint.DeactivateConstraints();
		}
		foreach (EmoteConstraint itemHolderConstraint in itemHolderConstraints)
		{
			itemHolderConstraint.DeactivateConstraints();
		}
		foreach (EmoteConstraint additionalConstraint in additionalConstraints)
		{
			additionalConstraint.DeactivateConstraints();
		}
		if (thirdPersonConstraint != null)
		{
			thirdPersonConstraint.DeactivateConstraints();
		}
		DeThirdPerson();
	}

	public void LockBones()
	{
		//IL_000f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0035: 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_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
		UnlockBones();
		((Component)this).transform.localPosition = Vector3.zero;
		foreach (HumanBodyBones soloIgnoredBone in currentClip.soloIgnoredBones)
		{
			if (Object.op_Implicit((Object)(object)emoteSkeletonAnimator.GetBoneTransform(soloIgnoredBone)))
			{
				dontAnimateUs.Add(((Object)emoteSkeletonAnimator.GetBoneTransform(soloIgnoredBone)).name);
			}
		}
		foreach (HumanBodyBones rootIgnoredBone in currentClip.rootIgnoredBones)
		{
			if (Object.op_Implicit((Object)(object)emoteSkeletonAnimator.GetBoneTransform(rootIgnoredBone)))
			{
				dontAnimateUs.Add(((Object)emoteSkeletonAnimator.GetBoneTransform(rootIgnoredBone)).name);
			}
			Transform[] componentsInChildren = ((Component)emoteSkeletonAnimator.GetBoneTransform(rootIgnoredBone)).GetComponentsInChildren<Transform>();
			foreach (Transform val in componentsInChildren)
			{
				dontAnimateUs.Add(((Object)val).name);
			}
		}
		if (!jank)
		{
			((Renderer)emoteSkeletonSMR).enabled = true;
			SkinnedMeshRenderer[] array = basePlayerModelSMR;
			foreach (SkinnedMeshRenderer val2 in array)
			{
				for (int k = 0; k < val2.bones.Length; k++)
				{
					try
					{
						if (Object.op_Implicit((Object)(object)((Component)val2.bones[k]).gameObject.GetComponent<EmoteConstraint>()) && !dontAnimateUs.Contains(((Object)val2.bones[k]).name))
						{
							((Component)val2.bones[k]).gameObject.GetComponent<EmoteConstraint>().ActivateConstraints();
						}
						else if (dontAnimateUs.Contains(((Object)val2.bones[k]).name))
						{
							((Component)val2.bones[k]).gameObject.GetComponent<EmoteConstraint>().DeactivateConstraints();
						}
					}
					catch (Exception arg)
					{
						DebugClass.Log($"{arg}");
					}
				}
			}
			foreach (EmoteConstraint itemHolderConstraint in itemHolderConstraints)
			{
				itemHolderConstraint.ActivateConstraints();
			}
			foreach (EmoteConstraint additionalConstraint in additionalConstraints)
			{
				additionalConstraint.ActivateConstraints();
			}
			LockCameraStuff(local && ThirdPersonCheck());
		}
		else
		{
			((MonoBehaviour)this).StartCoroutine(waitForTwoFramesThenDisableA1());
		}
	}

	public void LockCameraStuff(bool thirdPersonLock)
	{
		if (thirdPersonLock)
		{
			TurnOnThirdPerson();
			return;
		}
		if (Settings.rootMotionType.Value != RootMotionType.None && (currentClip.lockType == AnimationClipParams.LockType.rootMotion || Settings.rootMotionType.Value == RootMotionType.All || currentClip.lockType == AnimationClipParams.LockType.lockHead))
		{
			foreach (EmoteConstraint cameraConstraint in cameraConstraints)
			{
				cameraConstraint.ActivateConstraints();
			}
			return;
		}
		if (currentClip.lockType != AnimationClipParams.LockType.headBobbing)
		{
			return;
		}
		foreach (EmoteConstraint cameraConstraint2 in cameraConstraints)
		{
			cameraConstraint2.ActivateConstraints();
			if ((Object)(object)cameraConstraint2 != (Object)(object)cameraConstraints[cameraConstraints.Count - 1])
			{
				cameraConstraint2.onlyY = true;
			}
		}
	}

	public void UnlockCameraStuff()
	{
		foreach (EmoteConstraint cameraConstraint in cameraConstraints)
		{
			cameraConstraint.DeactivateConstraints();
		}
		thirdPersonConstraint.DeactivateConstraints();
		DeThirdPerson();
	}

	public void TurnOnThirdPerson()
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0029: Invalid comparison between Unknown and I4
		((Component)playerController.localVisor).gameObject.SetActive(false);
		if ((int)((Renderer)playerController.thisPlayerModel).shadowCastingMode == 1)
		{
			needToTurnOffShadows = false;
		}
		((Renderer)playerController.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)1;
		((Renderer)playerController.thisPlayerModelArms).shadowCastingMode = (ShadowCastingMode)3;
		if (originalLayer == -1)
		{
			originalLayer = ((Component)playerController.thisPlayerModel).gameObject.layer;
			originalCullingMask = playerController.gameplayCamera.cullingMask;
		}
		((Component)playerController.thisPlayerModel).gameObject.layer = 1;
		playerController.grabDistance = 5.65f;
		playerController.gameplayCamera.cullingMask = playerController.playersManager.spectateCamera.cullingMask;
		Camera gameplayCamera = playerController.gameplayCamera;
		gameplayCamera.cullingMask |= 0x800000;
		thirdPersonConstraint.ActivateConstraints();
		isInThirdPerson = true;
		if (CustomEmotesAPI.MoreCompanyPresent)
		{
			try
			{
				needToTurnOffCosmetics = true;
				MoreCompanyCompat.TurnOnCosmetics(this);
			}
			catch (Exception arg)
			{
				DebugClass.Log($"couldn't turn on cosmetics: {arg}");
			}
		}
	}

	public void DeThirdPerson()
	{
		if (!isInThirdPerson)
		{
			return;
		}
		playerController.gameplayCamera.cullingMask = originalCullingMask;
		if (needToTurnOffShadows)
		{
			((Renderer)playerController.thisPlayerModel).shadowCastingMode = (ShadowCastingMode)3;
		}
		needToTurnOffShadows = true;
		((Renderer)playerController.thisPlayerModelArms).shadowCastingMode = (ShadowCastingMode)1;
		((Component)playerController.localVisor).gameObject.SetActive(true);
		((Component)playerController.thisPlayerModel).gameObject.layer = originalLayer;
		playerController.grabDistance = 3f;
		isInThirdPerson = false;
		if (CustomEmotesAPI.MoreCompanyPresent && needToTurnOffCosmetics)
		{
			try
			{
				MoreCompanyCompat.TurnOffCosmetics(this);
			}
			catch (Exception arg)
			{
				DebugClass.Log($"couldn't clear cosmetics: {arg}");
			}
		}
	}
}
public class CustomAnimationClip : MonoBehaviour
{
	public AnimationClip[] clip;

	public AnimationClip[] secondaryClip;

	public bool looping;

	public string wwiseEvent;

	public bool syncronizeAudio;

	public List<HumanBodyBones> soloIgnoredBones;

	public List<HumanBodyBones> rootIgnoredBones;

	public bool dimAudioWhenClose;

	public bool stopOnAttack;

	public bool stopOnMove;

	public bool visibility;

	public int startPref;

	public int joinPref;

	public JoinSpot[] joinSpots;

	public bool useSafePositionReset;

	public string customName;

	public Action<BoneMapper> customPostEventCodeSync;

	public Action<BoneMapper> customPostEventCodeNoSync;

	public bool syncronizeAnimation;

	public int syncPos;

	public static List<float> syncTimer = new List<float>();

	public static List<int> syncPlayerCount = new List<int>();

	public static List<List<bool>> uniqueAnimations = new List<List<bool>>();

	public bool vulnerableEmote = false;

	public AnimationClipParams.LockType lockType = AnimationClipParams.LockType.none;

	public bool willGetClaimed = false;

	public float audioLevel = 0.5f;

	public bool thirdPerson = false;

	public string displayName = "";

	public BepInPlugin ownerPlugin;

	internal CustomAnimationClip(AnimationClip[] _clip, bool _loop, AudioClip[] primaryAudioClips = null, AudioClip[] secondaryAudioClips = null, HumanBodyBones[] rootBonesToIgnore = null, HumanBodyBones[] soloBonesToIgnore = null, AnimationClip[] _secondaryClip = null, bool dimWhenClose = false, bool stopWhenMove = false, bool stopWhenAttack = false, bool visible = true, bool syncAnim = false, bool syncAudio = false, int startPreference = -1, int joinPreference = -1, JoinSpot[] _joinSpots = null, bool safePositionReset = false, string customName = "", Action<BoneMapper> _customPostEventCodeSync = null, Action<BoneMapper> _customPostEventCodeNoSync = null, AnimationClipParams.LockType lockType = AnimationClipParams.LockType.none, AudioClip[] primaryDMCAFreeAudioClips = null, AudioClip[] secondaryDMCAFreeAudioClips = null, bool willGetClaimed = false, float audioLevel = 0.5f, bool thirdPerson = false, string displayName = "", BepInPlugin ownerPlugin = null)
	{
		if (rootBonesToIgnore == null)
		{
			rootBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[0];
		}
		if (soloBonesToIgnore == null)
		{
			soloBonesToIgnore = (HumanBodyBones[])(object)new HumanBodyBones[0];
		}
		clip = _clip;
		secondaryClip = _secondaryClip;
		looping = _loop;
		dimAudioWhenClose = dimWhenClose;
		stopOnAttack = stopWhenAttack;
		stopOnMove = stopWhenMove;
		visibility = visible;
		joinPref = joinPreference;
		startPref = startPreference;
		customPostEventCodeSync = _customPostEventCodeSync;
		customPostEventCodeNoSync = _customPostEventCodeNoSync;
		if (primaryAudioClips == null)
		{
			BoneMapper.primaryAudioClips.Add((AudioClip[])(object)new AudioClip[1]);
		}
		else
		{
			BoneMapper.primaryAudioClips.Add(primaryAudioClips);
		}
		if (secondaryAudioClips == null)
		{
			BoneMapper.secondaryAudioClips.Add((AudioClip[])(object)new AudioClip[1]);
		}
		else
		{
			BoneMapper.secondaryAudioClips.Add(secondaryAudioClips);
		}
		if (primaryDMCAFreeAudioClips == null)
		{
			BoneMapper.primaryDMCAFreeAudioClips.Add((AudioClip[])(object)new AudioClip[1]);
		}
		else
		{
			BoneMapper.primaryDMCAFreeAudioClips.Add(primaryDMCAFreeAudioClips);
		}
		if (secondaryDMCAFreeAudioClips == null)
		{
			BoneMapper.secondaryDMCAFreeAudioClips.Add((AudioClip[])(object)new AudioClip[1]);
		}
		else
		{
			BoneMapper.secondaryDMCAFreeAudioClips.Add(secondaryDMCAFreeAudioClips);
		}
		if (soloBonesToIgnore.Length != 0)
		{
			soloIgnoredBones = new List<HumanBodyBones>(soloBonesToIgnore);
		}
		else
		{
			soloIgnoredBones = new List<HumanBodyBones>();
		}
		if (rootBonesToIgnore.Length != 0)
		{
			rootIgnoredBones = new List<HumanBodyBones>(rootBonesToIgnore);
		}
		else
		{
			rootIgnoredBones = new List<HumanBodyBones>();
		}
		syncronizeAnimation = syncAnim;
		syncronizeAudio = syncAudio;
		syncPos = syncTimer.Count;
		syncTimer.Add(0f);
		syncPlayerCount.Add(0);
		List<bool> list = new List<bool>();
		for (int i = 0; i < _clip.Length; i++)
		{
			list.Add(item: false);
		}
		uniqueAnimations.Add(list);
		if (_joinSpots == null)
		{
			_joinSpots = new JoinSpot[0];
		}
		joinSpots = _joinSpots;
		useSafePositionReset = safePositionReset;
		this.customName = customName;
		if (customName != "")
		{
			BoneMapper.customNamePairs.Add(customName, ((Object)_clip[0]).name);
		}
		else
		{
			this.customName = ((Object)clip[0]).name;
		}
		BoneMapper.listOfCurrentEmoteAudio.Add(new List<AudioSource>());
		this.lockType = lockType;
		this.willGetClaimed = willGetClaimed;
		this.audioLevel = audioLevel;
		this.thirdPerson = thirdPerson;
		this.displayName = displayName;
		this.ownerPlugin = ownerPlugin;
	}
}
[DefaultExecutionOrder(-2)]
public class EmoteConstraint : MonoBehaviour
{
	public Transform originalBone;

	public Transform emoteBone;

	private Vector3 originalPosition;

	private Quaternion originalRotation;

	public bool constraintActive = false;

	public bool revertTransform;

	private bool firstTime = true;

	private bool firstTime2 = true;

	private bool hasEverActivatedConstraints = false;

	public bool onlyY = false;

	public bool debug = false;

	public bool localTransforms = false;

	private void LateUpdate()
	{
		ActUponConstraints();
	}

	public void ActUponConstraints()
	{
		//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
		//IL_0116: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
		//IL_00da: Unknown result type (might be due to invalid IL or missing references)
		//IL_00e4: 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_0090: Unknown result type (might be due to invalid IL or missing references)
		//IL_0034: Unknown result type (might be due to invalid IL or missing references)
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0054: Unknown result type (might be due to invalid IL or missing references)
		//IL_005e: Unknown result type (might be due to invalid IL or missing references)
		if (!constraintActive)
		{
			return;
		}
		if (localTransforms)
		{
			if (onlyY)
			{
				originalBone.localPosition = new Vector3(originalBone.localPosition.x, emoteBone.localPosition.y, originalBone.localPosition.z);
				return;
			}
			originalBone.localPosition = emoteBone.localPosition;
			originalBone.localRotation = emoteBone.localRotation;
		}
		else if (onlyY)
		{
			originalBone.position = new Vector3(originalBone.position.x, emoteBone.position.y, originalBone.position.z);
		}
		else
		{
			originalBone.position = emoteBone.position;
			originalBone.rotation = emoteBone.rotation;
		}
	}

	public void ActivateConstraints()
	{
		//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_0055: Unknown result type (might be due to invalid IL or missing references)
		//IL_005a: Unknown result type (might be due to invalid IL or missing references)
		if (!constraintActive)
		{
			if (firstTime2)
			{
				firstTime2 = false;
				((Component)this).gameObject.GetComponent<MonoBehaviour>().StartCoroutine(FirstTimeActiveFix(this));
				return;
			}
			originalPosition = originalBone.localPosition;
			originalRotation = originalBone.localRotation;
			hasEverActivatedConstraints = true;
			constraintActive = true;
			onlyY = false;
		}
	}

	internal IEnumerator FirstTimeActiveFix(EmoteConstraint e)
	{
		((Behaviour)e).enabled = false;
		yield return (object)new WaitForEndOfFrame();
		((Behaviour)e).enabled = true;
		if (e.onlyY)
		{
			e.ActivateConstraints();
			e.onlyY = true;
		}
		else
		{
			e.ActivateConstraints();
		}
	}

	public void DeactivateConstraints()
	{
		//IL_003b: 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)
		constraintActive = false;
		if (firstTime || !revertTransform || !hasEverActivatedConstraints)
		{
			firstTime = false;
			return;
		}
		originalBone.localPosition = originalPosition;
		originalBone.localRotation = originalRotation;
	}

	internal void AddSource(ref Transform originalBone, ref Transform emoteBone)
	{
		this.originalBone = originalBone;
		this.emoteBone = emoteBone;
	}

	internal void AddSource(Transform originalBone, Transform emoteBone)
	{
		this.originalBone = originalBone;
		this.emoteBone = emoteBone;
	}

	internal static EmoteConstraint AddConstraint(GameObject gameObject, BoneMapper mapper, Transform target)
	{
		EmoteConstraint emoteConstraint = gameObject.AddComponent<EmoteConstraint>();
		emoteConstraint.AddSource(gameObject.transform, target);
		emoteConstraint.revertTransform = mapper.revertTransform;
		return emoteConstraint;
	}
}
public struct JoinSpot
{
	public string name;

	public Vector3 position;

	public Vector3 rotation;

	public Vector3 scale;

	public JoinSpot(string _name, Vector3 _position, Vector3 _rotation, Vector3 _scale)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: 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_0019: Unknown result type (might be due to invalid IL or missing references)
		name = _name;
		position = _position;
		rotation = _rotation;
		scale = _scale;
	}

	public JoinSpot(string _name, Vector3 _position)
	{
		//IL_0009: Unknown result type (might be due to invalid IL or missing references)
		//IL_000a: Unknown result type (might be due to invalid IL or missing references)
		//IL_0010: Unknown result type (might be due to invalid IL or missing references)
		//IL_0015: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0020: Unknown result type (might be due to invalid IL or missing references)
		name = _name;
		position = _position;
		rotation = Vector3.zero;
		scale = Vector3.one;
	}
}
public class EmoteLocation : MonoBehaviour
{
	public static List<EmoteLocation> emoteLocations = new List<EmoteLocation>();

	public static bool visibile = true;

	public int spot;

	public int validPlayers = 0;

	public BoneMapper owner;

	public BoneMapper emoter;

	public JoinSpot joinSpot;

	public static void HideAllSpots()
	{
		visibile = false;
		foreach (EmoteLocation emoteLocation in emoteLocations)
		{
			try
			{
				Renderer[] componentsInChildren = ((Component)emoteLocation).GetComponentsInChildren<Renderer>();
				foreach (Renderer val in componentsInChildren)
				{
					val.enabled = false;
				}
				ParticleSystemRenderer[] componentsInChildren2 = ((Component)emoteLocation).GetComponentsInChildren<ParticleSystemRenderer>();
				foreach (ParticleSystemRenderer val2 in componentsInChildren2)
				{
					((Renderer)val2).enabled = false;
				}
			}
			catch (Exception)
			{
			}
		}
	}

	public static void ShowAllSpots()
	{
		visibile = true;
		foreach (EmoteLocation emoteLocation in emoteLocations)
		{
			try
			{
				Renderer[] componentsInChildren = ((Component)emoteLocation).GetComponentsInChildren<Renderer>();
				foreach (Renderer val in componentsInChildren)
				{
					val.enabled = true;
				}
				ParticleSystemRenderer[] componentsInChildren2 = ((Component)emoteLocation).GetComponentsInChildren<ParticleSystemRenderer>();
				foreach (ParticleSystemRenderer val2 in componentsInChildren2)
				{
					((Renderer)val2).enabled = true;
				}
			}
			catch (Exception)
			{
			}
		}
	}

	private void Start()
	{
		SetColor();
		emoteLocations.Add(this);
		((MonoBehaviour)this).StartCoroutine(setScale());
		if (!visibile)
		{
			Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				val.enabled = false;
			}
			ParticleSystemRenderer[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<ParticleSystemRenderer>();
			foreach (ParticleSystemRenderer val2 in componentsInChildren2)
			{
				((Renderer)val2).enabled = false;
			}
		}
	}

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

	public void SetEmoterAndHideLocation(BoneMapper boneMapper)
	{
		if (!Object.op_Implicit((Object)(object)emoter))
		{
			emoter = boneMapper;
			SetVisible(visibility: false);
		}
	}

	public IEnumerator setScale()
	{
		yield return (object)new WaitForSeconds(0.1f);
		_ = Vector3.one;
		Vector3 scal = ((!Object.op_Implicit((Object)(object)owner.emoteSkeletonSMR)) ? ((Component)owner).transform.lossyScale : ((Component)owner).transform.parent.lossyScale);
		((Component)this).transform.localPosition = new Vector3(joinSpot.position.x / scal.x, joinSpot.position.y / scal.y, joinSpot.position.z / scal.z);
		((Component)this).transform.localEulerAngles = joinSpot.rotation;
		((Component)this).transform.localScale = new Vector3(joinSpot.scale.x / scal.x, joinSpot.scale.y / scal.y, joinSpot.scale.z / scal.z);
	}

	internal void SetVisible(bool visibility)
	{
		//IL_0044: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_005d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0012: Unknown result type (might be due to invalid IL or missing references)
		//IL_0026: 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)
		if (visibility)
		{
			Transform transform = ((Component)this).gameObject.transform;
			transform.localPosition += new Vector3(5000f, 5000f, 5000f);
		}
		else
		{
			Transform transform2 = ((Component)this).gameObject.transform;
			transform2.localPosition -= new Vector3(5000f, 5000f, 5000f);
		}
	}

	private void OnTriggerEnter(Collider other)
	{
		if (Object.op_Implicit((Object)(object)((Component)other).GetComponentInChildren<BoneMapper>()) && (Object)(object)((Component)other).GetComponentInChildren<BoneMapper>() != (Object)(object)owner)
		{
			BoneMapper componentInChildren = ((Component)other).GetComponentInChildren<BoneMapper>();
			if (Object.op_Implicit((Object)(object)componentInChildren))
			{
				validPlayers++;
				SetColor();
				componentInChildren.currentEmoteSpot = ((Component)this).gameObject;
				CustomEmotesAPI.JoinSpotEntered(componentInChildren, owner);
			}
		}
	}

	private void OnTriggerExit(Collider other)
	{
		if (!Object.op_Implicit((Object)(object)((Component)other).GetComponentInChildren<BoneMapper>()) || !((Object)(object)((Component)other).GetComponentInChildren<BoneMapper>() != (Object)(object)owner))
		{
			return;
		}
		BoneMapper componentInChildren = ((Component)other).GetComponentInChildren<BoneMapper>();
		if (Object.op_Implicit((Object)(object)componentInChildren))
		{
			if (validPlayers != 0)
			{
				validPlayers--;
			}
			SetColor();
			if ((Object)(object)componentInChildren.currentEmoteSpot == (Object)(object)((Component)this).gameObject)
			{
				componentInChildren.currentEmoteSpot = null;
			}
		}
	}

	internal void SetColor()
	{
		//IL_010d: 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_0149: 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_0194: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Unknown result type (might be due to invalid IL or missing references)
		//IL_01c6: Unknown result type (might be due to invalid IL or missing references)
		//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
		//IL_01de: Unknown result type (might be due to invalid IL or missing references)
		//IL_01e3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00b9: 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_00c2: Unknown result type (might be due to invalid IL or missing references)
		//IL_00c7: Unknown result type (might be due to invalid IL or missing references)
		if (validPlayers > 0)
		{
			((Component)this).GetComponentsInChildren<Renderer>()[((Component)this).GetComponentsInChildren<Renderer>().Length - 1].material.color = Color.green;
			Renderer[] componentsInChildren = ((Component)this).GetComponentsInChildren<Renderer>();
			foreach (Renderer val in componentsInChildren)
			{
				val.material.SetColor("_EmissionColor", Color.green);
			}
			ParticleSystemRenderer[] componentsInChildren2 = ((Component)this).GetComponentsInChildren<ParticleSystemRenderer>();
			foreach (ParticleSystemRenderer val2 in componentsInChildren2)
			{
				((Renderer)val2).material.SetColor("_EmissionColor", Color.green);
			}
			ParticleSystem[] componentsInChildren3 = ((Component)this).GetComponentsInChildren<ParticleSystem>();
			foreach (ParticleSystem val3 in componentsInChildren3)
			{
				TrailModule trails = val3.trails;
				((TrailModule)(ref trails)).colorOverTrail = MinMaxGradient.op_Implicit(Color.green);
			}
		}
		else
		{
			((Component)this).GetComponentsInChildren<Renderer>()[((Component)this).GetComponentsInChildren<Renderer>().Length - 1].material.color = new Color(0.003921569f, 52f / 85f, 38f / 51f);
			Renderer[] componentsInChildren4 = ((Component)this).GetComponentsInChildren<Renderer>();
			foreach (Renderer val4 in componentsInChildren4)
			{
				val4.material.SetColor("_EmissionColor", new Color(0.003921569f, 52f / 85f, 38f / 51f));
			}
			ParticleSystemRenderer[] componentsInChildren5 = ((Component)this).GetComponentsInChildren<ParticleSystemRenderer>();
			foreach (ParticleSystemRenderer val5 in componentsInChildren5)
			{
				((Renderer)val5).material.SetColor("_EmissionColor", new Color(0.003921569f, 52f / 85f, 38f / 51f));
			}
			ParticleSystem[] componentsInChildren6 = ((Component)this).GetComponentsInChildren<ParticleSystem>();
			foreach (ParticleSystem val6 in componentsInChildren6)
			{
				TrailModule trails2 = val6.trails;
				((TrailModule)(ref trails2)).colorOverTrail = MinMaxGradient.op_Implicit(new Color(0.003921569f, 52f / 85f, 38f / 51f));
			}
		}
	}
}
public class AudioContainer : MonoBehaviour
{
	internal List<GameObject> playingObjects = new List<GameObject>();
}
public class AudioObject : MonoBehaviour
{
	internal int spot;

	internal int playerCount;

	internal GameObject audioObject;

	internal int activeObjectsSpot;
}
public class BonePair
{
	public Transform original;

	public Transform newiginal;

	public BonePair(Transform n, Transform o)
	{
		newiginal = n;
		original = o;
	}

	public void test()
	{
	}
}
public static class DebugClass
{
	private static ManualLogSource Logger;

	public static void SetLogger(ManualLogSource logSource)
	{
		Logger = logSource;
	}

	public static void Log(object message)
	{
		Logger.Log((LogLevel)16, (object)$"{message}");
	}
}
public class EmoteNetworker : NetworkBehaviour
{
	public static EmoteNetworker instance;

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

	public void SyncEmote(ulong playerId, string animation, int pos)
	{
		if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsServer)
		{
			SyncEmoteToClients(playerId, animation, pos);
		}
		else
		{
			SyncEmoteToServerRpc(playerId, animation, pos);
		}
	}

	public void SyncEmoteToClients(ulong playerId, string animation, int pos)
	{
		GameObject gameObject = ((Component)((NetworkBehaviour)this).GetNetworkObject(playerId)).gameObject;
		if (!Object.op_Implicit((Object)(object)gameObject))
		{
			DebugClass.Log("Body is null!!!");
		}
		int eventNum = -1;
		CustomAnimationClip customAnimationClip = BoneMapper.animClips[animation];
		try
		{
			((object)customAnimationClip.clip[0]).ToString();
			eventNum = Random.Range(0, BoneMapper.primaryAudioClips[customAnimationClip.syncPos].Length);
		}
		catch (Exception)
		{
		}
		SyncEmoteToClientRpc(playerId, animation, pos, eventNum);
	}

	[ClientRpc]
	public void SyncEmoteToClientRpc(ulong playerId, string animation, int pos, int eventNum)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
		//IL_00fb: 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_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: 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_00e1: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1218916340u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerId);
			bool flag = animation != null;
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			if (flag)
			{
				((FastBufferWriter)(ref val2)).WriteValueSafe(animation, false);
			}
			BytePacker.WriteValueBitPacked(val2, pos);
			BytePacker.WriteValueBitPacked(val2, eventNum);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1218916340u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			GameObject gameObject = ((Component)((NetworkBehaviour)this).GetNetworkObject(playerId)).gameObject;
			if (!Object.op_Implicit((Object)(object)gameObject))
			{
				DebugClass.Log("Body is null!!!");
			}
			BoneMapper componentInChildren = gameObject.GetComponentInChildren<BoneMapper>();
			DebugClass.Log($"Recieved message to play {animation} on client. Playing on {gameObject}");
			componentInChildren.PlayAnim(animation, pos, eventNum);
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void SyncEmoteToServerRpc(ulong playerId, string animation, int pos)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00e4: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ee: 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_0095: Unknown result type (might be due to invalid IL or missing references)
		//IL_009b: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bc: 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)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
		{
			ServerRpcParams val = default(ServerRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1304595851u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerId);
			bool flag = animation != null;
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref flag, default(ForPrimitives));
			if (flag)
			{
				((FastBufferWriter)(ref val2)).WriteValueSafe(animation, false);
			}
			BytePacker.WriteValueBitPacked(val2, pos);
			((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1304595851u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
		{
			SyncEmoteToClients(playerId, animation, pos);
		}
	}

	public void SyncJoinSpot(ulong playerId, ulong joinSpotId, bool worldProp, int posInArray)
	{
		if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsServer)
		{
			SyncJoinSpotToClientRpc(playerId, joinSpotId, worldProp, posInArray);
		}
		else
		{
			SyncJoinSpotToServerRpc(playerId, joinSpotId, worldProp, posInArray);
		}
	}

	[ClientRpc]
	public void SyncJoinSpotToClientRpc(ulong playerId, ulong joinSpotId, bool worldProp, int posInArray)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: 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_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(770217386u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerId);
			BytePacker.WriteValueBitPacked(val2, joinSpotId);
			((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref worldProp, default(ForPrimitives));
			BytePacker.WriteValueBitPacked(val2, posInArray);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 770217386u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			GameObject gameObject = ((Component)((NetworkBehaviour)this).GetNetworkObject(playerId)).gameObject;
			GameObject gameObject2 = ((Component)((NetworkBehaviour)this).GetNetworkObject(joinSpotId)).gameObject;
			if (!Object.op_Implicit((Object)(object)gameObject))
			{
				DebugClass.Log("Body is null!!!");
			}
			if (!Object.op_Implicit((Object)(object)gameObject2))
			{
				DebugClass.Log("spotObject is null!!!");
			}
			BoneMapper componentInChildren = gameObject.GetComponentInChildren<BoneMapper>();
			componentInChildren.PlayAnim("none", 0);
			componentInChildren.currentEmoteSpot = ((Component)gameObject2.GetComponentsInChildren<EmoteLocation>()[posInArray]).gameObject;
			if (worldProp)
			{
				CustomEmotesAPI.JoinedProp(componentInChildren.currentEmoteSpot, componentInChildren, componentInChildren.currentEmoteSpot.GetComponent<EmoteLocation>().owner);
			}
			else
			{
				CustomEmotesAPI.JoinedBody(componentInChildren.currentEmoteSpot, componentInChildren, componentInChildren.currentEmoteSpot.GetComponent<EmoteLocation>().owner);
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void SyncJoinSpotToServerRpc(ulong playerId, ulong joinSpotId, bool worldProp, int posInArray)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
		//IL_00d8: 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_0097: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00be: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(711293682u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				BytePacker.WriteValueBitPacked(val2, joinSpotId);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref worldProp, default(ForPrimitives));
				BytePacker.WriteValueBitPacked(val2, posInArray);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 711293682u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SyncJoinSpotToClientRpc(playerId, joinSpotId, worldProp, posInArray);
			}
		}
	}

	public void SyncBoneMapperPos(ulong playerId, Vector3 pos, Vector3 rot)
	{
		//IL_0027: 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_0019: Unknown result type (might be due to invalid IL or missing references)
		//IL_001a: Unknown result type (might be due to invalid IL or missing references)
		if (((NetworkBehaviour)this).IsOwner && ((NetworkBehaviour)this).IsServer)
		{
			SyncBoneMapperPosToClientRpc(playerId, pos, rot);
		}
		else
		{
			SyncBoneMapperPosToServerRpc(playerId, pos, rot);
		}
	}

	[ClientRpc]
	public void SyncBoneMapperPosToClientRpc(ulong playerId, Vector3 pos, Vector3 rot)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
		//IL_0124: Unknown result type (might be due to invalid IL or missing references)
		//IL_0125: Unknown result type (might be due to invalid IL or missing references)
		//IL_012b: Unknown result type (might be due to invalid IL or missing references)
		//IL_012c: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager == null || !networkManager.IsListening)
		{
			return;
		}
		if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
		{
			ClientRpcParams val = default(ClientRpcParams);
			FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1678486976u, val, (RpcDelivery)0);
			BytePacker.WriteValueBitPacked(val2, playerId);
			((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
			((FastBufferWriter)(ref val2)).WriteValueSafe(ref rot);
			((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1678486976u, val, (RpcDelivery)0);
		}
		if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
		{
			GameObject gameObject = ((Component)((NetworkBehaviour)this).GetNetworkObject(playerId)).gameObject;
			if (!Object.op_Implicit((Object)(object)gameObject))
			{
				DebugClass.Log("Body is null!!!");
			}
			BoneMapper componentInChildren = gameObject.GetComponentInChildren<BoneMapper>();
			if (!((Object)(object)componentInChildren == (Object)(object)CustomEmotesAPI.localMapper))
			{
				componentInChildren.prevMapperPos = pos;
				componentInChildren.prevMapperRot = rot;
			}
		}
	}

	[ServerRpc(RequireOwnership = false)]
	public void SyncBoneMapperPosToServerRpc(ulong playerId, Vector3 pos, Vector3 rot)
	{
		//IL_0024: Unknown result type (might be due to invalid IL or missing references)
		//IL_002e: Invalid comparison between Unknown and I4
		//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
		//IL_00bd: 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_00a3: 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_00e6: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2977327148u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, playerId);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref pos);
				((FastBufferWriter)(ref val2)).WriteValueSafe(ref rot);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2977327148u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				SyncBoneMapperPosToClientRpc(playerId, pos, rot);
			}
		}
	}

	protected override void __initializeVariables()
	{
		((NetworkBehaviour)this).__initializeVariables();
	}

	[RuntimeInitializeOnLoadMethod]
	internal static void InitializeRPCS_EmoteNetworker()
	{
		//IL_0011: Unknown result type (might be due to invalid IL or missing references)
		//IL_001b: Expected O, but got Unknown
		//IL_002c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0036: Expected O, but got Unknown
		//IL_0047: Unknown result type (might be due to invalid IL or missing references)
		//IL_0051: Expected O, but got Unknown
		//IL_0062: Unknown result type (might be due to invalid IL or missing references)
		//IL_006c: Expected O, but got Unknown
		//IL_007d: Unknown result type (might be due to invalid IL or missing references)
		//IL_0087: Expected O, but got Unknown
		//IL_0098: Unknown result type (might be due to invalid IL or missing references)
		//IL_00a2: Expected O, but got Unknown
		NetworkManager.__rpc_func_table.Add(1218916340u, new RpcReceiveHandler(__rpc_handler_1218916340));
		NetworkManager.__rpc_func_table.Add(1304595851u, new RpcReceiveHandler(__rpc_handler_1304595851));
		NetworkManager.__rpc_func_table.Add(770217386u, new RpcReceiveHandler(__rpc_handler_770217386));
		NetworkManager.__rpc_func_table.Add(711293682u, new RpcReceiveHandler(__rpc_handler_711293682));
		NetworkManager.__rpc_func_table.Add(1678486976u, new RpcReceiveHandler(__rpc_handler_1678486976));
		NetworkManager.__rpc_func_table.Add(2977327148u, new RpcReceiveHandler(__rpc_handler_2977327148));
	}

	private static void __rpc_handler_1218916340(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: 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_0075: Unknown result type (might be due to invalid IL or missing references)
		//IL_0088: Unknown result type (might be due to invalid IL or missing references)
		//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			ulong playerId = default(ulong);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
			bool flag = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
			string animation = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref animation, false);
			}
			int pos = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref pos);
			int eventNum = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref eventNum);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((EmoteNetworker)(object)target).SyncEmoteToClientRpc(playerId, animation, pos, eventNum);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_1304595851(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_003c: Unknown result type (might be due to invalid IL or missing references)
		//IL_0042: 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_007b: Unknown result type (might be due to invalid IL or missing references)
		//IL_009d: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			ulong playerId = default(ulong);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
			bool flag = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref flag, default(ForPrimitives));
			string animation = null;
			if (flag)
			{
				((FastBufferReader)(ref reader)).ReadValueSafe(ref animation, false);
			}
			int pos = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref pos);
			target.__rpc_exec_stage = (__RpcExecStage)1;
			((EmoteNetworker)(object)target).SyncEmoteToServerRpc(playerId, animation, pos);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_770217386(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be due to invalid IL or missing references)
		//IL_006b: Unknown result type (might be due to invalid IL or missing references)
		//IL_0091: Unknown result type (might be due to invalid IL or missing references)
		NetworkManager networkManager = target.NetworkManager;
		if (networkManager != null && networkManager.IsListening)
		{
			ulong playerId = default(ulong);
			ByteUnpacker.ReadValueBitPacked(reader, ref playerId);
			ulong joinSpotId = default(ulong);
			ByteUnpacker.ReadValueBitPacked(reader, ref joinSpotId);
			bool worldProp = default(bool);
			((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref worldProp, default(ForPrimitives));
			int posInArray = default(int);
			ByteUnpacker.ReadValueBitPacked(reader, ref posInArray);
			target.__rpc_exec_stage = (__RpcExecStage)2;
			((EmoteNetworker)(object)target).SyncJoinSpotToClientRpc(playerId, joinSpotId, worldProp, posInArray);
			target.__rpc_exec_stage = (__RpcExecStage)0;
		}
	}

	private static void __rpc_handler_711293682(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
	{
		//IL_0023: Unknown result type (might be due to invalid IL or missing references)
		//IL_0030: Unknown result type (might be due to invalid IL or missing references)
		//IL_0049: Unknown result type (might be due to invalid IL or missing references)
		//IL_004f: Unknown result type (might be due to invalid IL or missing references)
		//IL_0058: Unknown result type (might be du

plugins/Gemumoddo-LethalEmotesAPI/LethalEmotesApi.Ui.dll

Decompiled 11 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Text;
using LethalEmotesApi.Ui.Animation;
using LethalEmotesApi.Ui.Customize;
using LethalEmotesApi.Ui.Customize.DragDrop;
using LethalEmotesApi.Ui.Customize.Preview;
using LethalEmotesApi.Ui.Customize.Wheel;
using LethalEmotesApi.Ui.Data;
using LethalEmotesApi.Ui.Db;
using LethalEmotesApi.Ui.Elements;
using LethalEmotesApi.Ui.Wheel;
using Microsoft.CodeAnalysis;
using TMPro;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.Events;
using UnityEngine.UI;

[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: AssemblyCompany("LethalEmotesApi.Ui")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0+6824dbf199dd246b0a2833650efb755f5c661453")]
[assembly: AssemblyProduct("LethalEmotesApi.Ui")]
[assembly: AssemblyTitle("LethalEmotesApi.Ui")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: RefSafetyRules(11)]
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 LethalEmotesApi.Ui
{
	internal static class DebugUtils
	{
		public static string ToPrettyString<T>(this IEnumerable<T> enumerable)
		{
			StringBuilder stringBuilder = new StringBuilder();
			int num = 0;
			stringBuilder.AppendLine("{");
			num++;
			int num2 = 0;
			foreach (T item in enumerable)
			{
				if (item != null)
				{
					for (int i = 0; i < num; i++)
					{
						stringBuilder.Append("    ");
					}
					stringBuilder.AppendLine($"[{num2}]: {item.ToString()}");
					num2++;
				}
			}
			stringBuilder.AppendLine("}");
			return stringBuilder.ToString();
		}
	}
	public static class EmoteUiManager
	{
		internal static IEmoteUiStateController? _stateController;

		internal static EmoteUiPanel? EmoteUiInstance;

		internal static IReadOnlyCollection<string> EmoteKeys => _stateController.EmoteDb.EmoteKeys;

		internal static IReadOnlyCollection<string> RandomPoolBlacklist => _stateController.RandomPoolBlacklist;

		public static float EmoteVolume
		{
			get
			{
				return _stateController.EmoteVolume;
			}
			set
			{
				_stateController.EmoteVolume = value;
			}
		}

		public static bool HideJoinSpots
		{
			get
			{
				return _stateController.HideJoinSpots;
			}
			set
			{
				_stateController.HideJoinSpots = value;
			}
		}

		public static int RootMotionType
		{
			get
			{
				return _stateController.RootMotionType;
			}
			set
			{
				_stateController.RootMotionType = value;
			}
		}

		public static bool EmotesAlertEnemies
		{
			get
			{
				return _stateController.EmotesAlertEnemies;
			}
			set
			{
				_stateController.EmotesAlertEnemies = value;
			}
		}

		public static int DmcaFree
		{
			get
			{
				return _stateController.DmcaFree;
			}
			set
			{
				_stateController.DmcaFree = value;
			}
		}

		public static int ThirdPerson
		{
			get
			{
				return _stateController.ThirdPerson;
			}
			set
			{
				_stateController.ThirdPerson = value;
			}
		}

		public static void RegisterStateController(IEmoteUiStateController stateController)
		{
			_stateController = stateController;
		}

		public static IEmoteUiStateController? GetStateController()
		{
			return _stateController;
		}

		internal static void PlayEmote(string emoteKey)
		{
			try
			{
				_stateController?.PlayEmote(emoteKey);
			}
			catch
			{
				Debug.Log((object)"Emote selected might not exist");
			}
		}

		internal static void LockMouseInput()
		{
			_stateController?.LockMouseInput();
		}

		internal static void UnlockMouseInput()
		{
			_stateController?.UnlockMouseInput();
		}

		internal static void LockPlayerInput()
		{
			_stateController?.LockPlayerInput();
		}

		internal static void UnlockPlayerInput()
		{
			_stateController?.UnlockPlayerInput();
		}

		internal static void PlayAnimationOn(Animator animator, string emoteKey)
		{
			_stateController?.PlayAnimationOn(animator, emoteKey);
		}

		internal static string GetEmoteName(string emoteKey)
		{
			return _stateController.EmoteDb.GetEmoteName(emoteKey);
		}

		internal static string GetEmoteModName(string emoteKey)
		{
			return _stateController.EmoteDb.GetModName(emoteKey);
		}

		internal static void AddToRandomPoolBlacklist(string emoteKey)
		{
			_stateController?.AddToRandomPoolBlacklist(emoteKey);
		}

		internal static void RemoveFromRandomPoolBlacklist(string emoteKey)
		{
			_stateController?.RemoveFromRandomPoolBlacklist(emoteKey);
		}

		internal static EmoteWheelSetData LoadEmoteWheelSetData()
		{
			return _stateController.LoadEmoteWheelSetData();
		}

		internal static void SaveEmoteWheelSetData(EmoteWheelSetData dataToSave)
		{
			_stateController.SaveEmoteWheelSetData(dataToSave);
			if (EmoteUiInstance != null)
			{
				EmoteUiInstance.ReloadData();
			}
		}

		public static bool IsEmoteWheelsOpen()
		{
			EmoteUiPanel emoteUiInstance = EmoteUiInstance;
			return emoteUiInstance != null && emoteUiInstance.IsOpen && emoteUiInstance.CurrentView == EmoteUiPanel.UiView.EmoteWheels;
		}

		public static bool IsCustomizePanelOpen()
		{
			EmoteUiPanel emoteUiInstance = EmoteUiInstance;
			return emoteUiInstance != null && emoteUiInstance.IsOpen && emoteUiInstance.CurrentView == EmoteUiPanel.UiView.Customize;
		}

		public static bool CanOpenEmoteWheels()
		{
			if (_stateController == null)
			{
				return false;
			}
			return _stateController.CanOpenEmoteUi() && !IsCustomizePanelOpen();
		}

		public static void OnLeftWheel()
		{
			if (EmoteUiInstance != null && EmoteUiInstance.emoteWheelsController != null && IsEmoteWheelsOpen())
			{
				EmoteUiInstance.emoteWheelsController.PrevWheel();
			}
		}

		public static void OnRightWheel()
		{
			if (EmoteUiInstance != null && EmoteUiInstance.emoteWheelsController != null && IsEmoteWheelsOpen())
			{
				EmoteUiInstance.emoteWheelsController.NextWheel();
			}
		}

		public static void OpenEmoteWheels()
		{
			if (EmoteUiInstance != null && CanOpenEmoteWheels())
			{
				EmoteUiInstance.Show();
			}
		}

		public static void CloseEmoteWheels()
		{
			if (EmoteUiInstance != null && IsEmoteWheelsOpen())
			{
				EmoteUiInstance.Hide();
			}
		}

		public static void CloseCustomizationPanel()
		{
			if (EmoteUiInstance != null && IsCustomizePanelOpen())
			{
				EmoteUiInstance.Hide();
			}
		}

		public static void CloseUiGracefully()
		{
			CloseCustomizationPanel();
			if (EmoteUiInstance != null && IsEmoteWheelsOpen())
			{
				EmoteUiInstance.CloseGracefully();
			}
		}
	}
	public class EmoteUiPanel : MonoBehaviour
	{
		internal enum UiView
		{
			EmoteWheels,
			Customize
		}

		public EmoteWheelsController? emoteWheelsController;

		public CustomizePanel? customizePanel;

		public RectTransform? customizeButton;

		private TextMeshProUGUI? _customizeButtonLabel;

		public bool IsOpen { get; private set; }

		internal UiView CurrentView { get; private set; } = UiView.EmoteWheels;


		private void Awake()
		{
			EmoteUiManager.EmoteUiInstance = this;
			if (customizeButton != null && _customizeButtonLabel == null)
			{
				_customizeButtonLabel = ((Component)customizeButton).GetComponentInChildren<TextMeshProUGUI>();
			}
		}

		private void OnEnable()
		{
			if (customizeButton != null && _customizeButtonLabel == null)
			{
				_customizeButtonLabel = ((Component)customizeButton).GetComponentInChildren<TextMeshProUGUI>();
			}
		}

		public void ReloadData()
		{
			if (emoteWheelsController != null)
			{
				emoteWheelsController.ReloadWheels();
			}
		}

		public void Show()
		{
			CurrentView = UiView.EmoteWheels;
			UpdateCustomizeButton();
			ShowCustomizeButton();
			ShowEmoteWheels();
			EmoteUiManager.LockMouseInput();
			IsOpen = true;
		}

		public void Hide()
		{
			HideCustomizePanel();
			HideCustomizeButton();
			HideEmoteWheels();
			CurrentView = UiView.EmoteWheels;
			EmoteUiManager.UnlockMouseInput();
			EmoteUiManager.UnlockPlayerInput();
			IsOpen = false;
		}

		public void CloseGracefully()
		{
			HideCustomizePanel();
			HideCustomizeButton();
			CloseEmoteWheelsGracefully();
			CurrentView = UiView.EmoteWheels;
		}

		public void ToggleCustomizePanel()
		{
			if (emoteWheelsController != null)
			{
				if (CurrentView == UiView.EmoteWheels)
				{
					CloseEmoteWheelsGracefully();
					ShowCustomizePanel();
					CurrentView = UiView.Customize;
					EmoteUiManager.LockPlayerInput();
				}
				else if (CurrentView == UiView.Customize)
				{
					Hide();
				}
				UpdateCustomizeButton();
			}
		}

		public void ShowEmoteWheels()
		{
			if (emoteWheelsController != null)
			{
				emoteWheelsController.Show();
				((Component)emoteWheelsController.wheelLabel).gameObject.SetActive(true);
			}
		}

		public void HideEmoteWheels()
		{
			if (emoteWheelsController != null)
			{
				emoteWheelsController.Hide();
				((Component)emoteWheelsController.wheelLabel).gameObject.SetActive(false);
			}
		}

		public void CloseEmoteWheelsGracefully()
		{
			if (emoteWheelsController != null)
			{
				emoteWheelsController.CloseGracefully();
				((Component)emoteWheelsController.wheelLabel).gameObject.SetActive(false);
			}
		}

		public void ShowCustomizePanel()
		{
			if (customizePanel != null)
			{
				((Component)customizePanel).gameObject.SetActive(true);
			}
		}

		public void HideCustomizePanel()
		{
			if (customizePanel != null)
			{
				customizePanel.dragDropController.CancelDrag();
				((Component)customizePanel).gameObject.SetActive(false);
				EmoteUiManager.UnlockPlayerInput();
				EmoteUiManager.UnlockMouseInput();
			}
		}

		public void ShowCustomizeButton()
		{
			if (customizeButton != null)
			{
				((Component)customizeButton).gameObject.SetActive(true);
			}
		}

		public void HideCustomizeButton()
		{
			if (customizeButton != null)
			{
				((Component)customizeButton).gameObject.SetActive(false);
			}
		}

		private void UpdateCustomizeButton()
		{
			if (_customizeButtonLabel != null)
			{
				((TMP_Text)_customizeButtonLabel).SetText((CurrentView == UiView.EmoteWheels) ? "Customize" : "Close", true);
			}
		}

		private void OnDestroy()
		{
			EmoteUiManager.EmoteUiInstance = null;
		}
	}
	[ExecuteAlways]
	public class WheelSegmentGen : MonoBehaviour
	{
		public Material segmentMat;

		public ColorBlock colorBlock;

		[Range(1f, 20f)]
		public int segments = 8;

		[Range(-90f, 90f)]
		public float offset;

		[Range(0f, 700f)]
		public float maxRadius = 300f;

		[Range(0f, 699f)]
		public float minRadius = 100f;

		private void OnDrawGizmos()
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0082: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: 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_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f4: Unknown result type (might be due to invalid IL or missing references)
			//IL_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_0112: Unknown result type (might be due to invalid IL or missing references)
			if (minRadius >= maxRadius)
			{
				minRadius = maxRadius - 1f;
			}
			Vector3 position = ((Component)this).transform.position;
			float num = (float)(Math.PI * 2.0 / (double)segments);
			Vector3 val = default(Vector3);
			Vector3 val2 = default(Vector3);
			for (int i = 0; i < segments; i++)
			{
				float num2 = (float)i * num + MathF.PI / 180f * offset;
				float num3 = ((float)i * num + (float)(i + 1) * num) / 2f + MathF.PI / 180f * offset;
				float num4 = (float)((double)position.x + Math.Cos(num2) * (double)maxRadius);
				float num5 = (float)((double)position.y + Math.Sin(num2) * (double)maxRadius);
				float num6 = (float)((double)position.x + Math.Cos(num2) * (double)minRadius);
				float num7 = (float)((double)position.y + Math.Sin(num2) * (double)minRadius);
				((Vector3)(ref val))..ctor(num6, num7, position.z);
				((Vector3)(ref val2))..ctor(num4, num5, position.z);
				Gizmos.DrawLine(val, val2);
			}
		}
	}
}
namespace LethalEmotesApi.Ui.Wheel
{
	[RequireComponent(typeof(CanvasGroup))]
	public class EmoteWheel : MonoBehaviour, IPointerMoveHandler, IEventSystemHandler
	{
		private class EmoteSelectedCallback : UnityEvent<string>
		{
		}

		private readonly TweenRunner<AnimCurveTween<Vector3Tween>> _posTweenRunner = new TweenRunner<AnimCurveTween<Vector3Tween>>();

		private readonly TweenRunner<AnimCurveTween<FloatTween>> _alphaTweenRunner = new TweenRunner<AnimCurveTween<FloatTween>>();

		private readonly DelayedActionRunner<DelayedAction> _delayedActionRunner = new DelayedActionRunner<DelayedAction>();

		public CanvasGroup? canvasGroup;

		public WheelStopEmote? wheelStopEmote;

		public ColorBlock colors;

		[Range(1f, 2f)]
		public float scaleMultiplier;

		public int segmentCount = 8;

		public float segmentRotOffset = 22.5f;

		public float minRadius = 100f;

		public float maxRadius = 300f;

		public List<EmoteWheelSegment> wheelSegments = new List<EmoteWheelSegment>();

		public string[] emoteArray;

		private int _currentSegmentIndex = -1;

		private RectTransform? _rectTransform;

		private readonly EmoteSelectedCallback _emoteSelectedCallback = new EmoteSelectedCallback();

		private bool _focused;

		public bool Focused
		{
			get
			{
				return _focused;
			}
			set
			{
				_focused = value;
				foreach (EmoteWheelSegment wheelSegment in wheelSegments)
				{
					wheelSegment.focused = _focused;
				}
				if (!_focused)
				{
					((UnityEventBase)_emoteSelectedCallback).RemoveAllListeners();
				}
			}
		}

		protected EmoteWheel()
		{
			emoteArray = new string[segmentCount];
			_posTweenRunner.Init((MonoBehaviour)(object)this);
			_alphaTweenRunner.Init((MonoBehaviour)(object)this);
			_delayedActionRunner.Init((MonoBehaviour)(object)this);
		}

		private void Awake()
		{
			//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)
			_rectTransform = ((Component)this).GetComponent<RectTransform>();
			if (canvasGroup == null)
			{
				canvasGroup = ((Component)this).GetComponent<CanvasGroup>();
			}
			foreach (EmoteWheelSegment wheelSegment in wheelSegments)
			{
				wheelSegment.colors = colors;
				wheelSegment.scaleMultiplier = scaleMultiplier;
				wheelSegment.targetGraphic.segmentCount = segmentCount;
				wheelSegment.targetGraphic.segmentRotOffset = segmentRotOffset;
				wheelSegment.targetGraphic.minRadius = minRadius;
				wheelSegment.targetGraphic.maxRadius = maxRadius;
				wheelSegment.ResetState();
			}
		}

		private void OnEnable()
		{
			ResetState();
		}

		public void OnPointerMove(PointerEventData eventData)
		{
			//IL_001c: 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_003a: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: Unknown result type (might be due to invalid IL or missing references)
			//IL_0090: Unknown result type (might be due to invalid IL or missing references)
			//IL_009f: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
			if (!_focused)
			{
				return;
			}
			Vector2 val = default(Vector2);
			RectTransformUtility.ScreenPointToLocalPointInRectangle(_rectTransform, eventData.position, eventData.enterEventCamera, ref val);
			Rect rect = _rectTransform.rect;
			float num = Vector2.Distance(Vector2.zero, val);
			if (num < minRadius)
			{
				DeSelectAll();
				((UnityEvent<string>)(object)_emoteSelectedCallback).Invoke("none");
				wheelStopEmote.OnPointerEnter(eventData);
				return;
			}
			if (val.x > ((Rect)(ref rect)).xMax || val.x < ((Rect)(ref rect)).xMin || val.y > ((Rect)(ref rect)).yMax || val.y < ((Rect)(ref rect)).yMin)
			{
				DeSelectAll();
				((UnityEvent<string>)(object)_emoteSelectedCallback).Invoke("");
				return;
			}
			int closestSegmentIndex = GetClosestSegmentIndex(val);
			if (closestSegmentIndex != _currentSegmentIndex)
			{
				wheelStopEmote.OnPointerExit(eventData);
				if (_currentSegmentIndex > -1)
				{
					wheelSegments[_currentSegmentIndex].OnPointerExit(eventData);
				}
				_currentSegmentIndex = closestSegmentIndex;
				wheelSegments[closestSegmentIndex].OnPointerEnter(eventData);
				((UnityEvent<string>)(object)_emoteSelectedCallback).Invoke(emoteArray[_currentSegmentIndex]);
			}
		}

		public void DeSelectAll()
		{
			_currentSegmentIndex = -1;
			foreach (EmoteWheelSegment wheelSegment in wheelSegments)
			{
				wheelSegment.DeSelect();
			}
		}

		public void ResetState()
		{
			_currentSegmentIndex = -1;
			foreach (EmoteWheelSegment wheelSegment in wheelSegments)
			{
				wheelSegment.ResetState();
			}
			_posTweenRunner.StopTween();
			_alphaTweenRunner.StopTween();
			_delayedActionRunner.StopAction();
			canvasGroup.alpha = 1f;
		}

		public void LoadEmotes(string[] emotes)
		{
			emoteArray = emotes;
			for (int i = 0; i < emoteArray.Length; i++)
			{
				wheelSegments[i].targetLabel?.SetEmote(emoteArray[i]);
			}
		}

		private int GetClosestSegmentIndex(Vector2 mousePos)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			int result = -1;
			float num = float.MaxValue;
			for (int i = 0; i < wheelSegments.Count; i++)
			{
				EmoteWheelSegment emoteWheelSegment = wheelSegments[i];
				Vector2 val = Vector2.op_Implicit(((Transform)emoteWheelSegment.segmentRectTransform).position - ((Transform)_rectTransform).position);
				float num2 = Vector2.Distance(val, mousePos);
				if (num2 < num)
				{
					num = num2;
					result = i;
				}
			}
			return result;
		}

		public void AddOnEmoteSelectedCallback(UnityAction<string> callback)
		{
			((UnityEvent<string>)(object)_emoteSelectedCallback).AddListener(callback);
		}

		public void TweenPos(Vector3 targetPos, AnimationCurve curve, float duration, bool ignoreTimeScale)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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)
			if (((Component)this).transform.localPosition == targetPos)
			{
				_posTweenRunner.StopTween();
				return;
			}
			Vector3Tween vector3Tween = default(Vector3Tween);
			vector3Tween.Duration = duration;
			vector3Tween.StartValue = ((Component)this).transform.localPosition;
			vector3Tween.TargetValue = targetPos;
			vector3Tween.IgnoreTimeScale = ignoreTimeScale;
			Vector3Tween wrappedTweenValue = vector3Tween;
			wrappedTweenValue.AddOnChangedCallback(TweenPosChanged);
			AnimCurveTween<Vector3Tween> animCurveTween = default(AnimCurveTween<Vector3Tween>);
			animCurveTween.WrappedTweenValue = wrappedTweenValue;
			animCurveTween.Curve = curve;
			AnimCurveTween<Vector3Tween> tweenValue = animCurveTween;
			_posTweenRunner.StartTween(tweenValue);
		}

		private void TweenPosChanged(Vector3 pos)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.localPosition = pos;
		}

		public void TweenAlpha(float targetAlpha, AnimationCurve curve, float duration, bool ignoreTimeScale)
		{
			if (canvasGroup != null)
			{
				if (canvasGroup.alpha == targetAlpha)
				{
					_alphaTweenRunner.StopTween();
					return;
				}
				FloatTween floatTween = default(FloatTween);
				floatTween.Duration = duration;
				floatTween.StartValue = canvasGroup.alpha;
				floatTween.TargetValue = targetAlpha;
				floatTween.IgnoreTimeScale = ignoreTimeScale;
				FloatTween wrappedTweenValue = floatTween;
				wrappedTweenValue.AddOnChangedCallback(TweenAlphaChanged);
				AnimCurveTween<FloatTween> animCurveTween = default(AnimCurveTween<FloatTween>);
				animCurveTween.WrappedTweenValue = wrappedTweenValue;
				animCurveTween.Curve = curve;
				AnimCurveTween<FloatTween> tweenValue = animCurveTween;
				_alphaTweenRunner.StartTween(tweenValue);
			}
		}

		private void TweenAlphaChanged(float alpha)
		{
			canvasGroup.alpha = alpha;
		}

		public void DisableAfterDuration(float duration, bool ignoreTimeScale)
		{
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_004f: Expected O, but got Unknown
			if (!((Component)this).gameObject.activeInHierarchy)
			{
				_delayedActionRunner.StopAction();
				return;
			}
			DelayedAction delayedAction = default(DelayedAction);
			delayedAction.Duration = duration;
			delayedAction.IgnoreTimeScale = ignoreTimeScale;
			delayedAction.Action = new UnityAction(DelayedDisable);
			DelayedAction delayedAction2 = delayedAction;
			_delayedActionRunner.StartAction(delayedAction2);
		}

		private void DelayedDisable()
		{
			((Component)this).gameObject.SetActive(false);
		}
	}
	public class EmoteWheelsController : MonoBehaviour
	{
		public GameObject? wheelPrefab;

		public RectTransform? wheelContainer;

		public TextMeshProUGUI? wheelLabel;

		public float fadeDist = 500f;

		public float fadeDuration = 0.5f;

		public AnimationCurve? fadeCurve;

		private EmoteWheel[] _wheels = Array.Empty<EmoteWheel>();

		private int _currentWheelIndex;

		private string _selectedEmote = "";

		private bool _wheelLock;

		private EmoteWheelSetData WheelSetData => EmoteUiManager.LoadEmoteWheelSetData();

		public void Start()
		{
			InitWheels();
		}

		private void OnEnable()
		{
			ReloadWheels();
		}

		public void ReloadWheels()
		{
			if (WheelSetData.EmoteWheels.Length != _wheels.Length)
			{
				EmoteWheel[] wheels = _wheels;
				foreach (EmoteWheel emoteWheel in wheels)
				{
					Object.DestroyImmediate((Object)(object)((Component)emoteWheel).gameObject);
				}
				InitWheels();
			}
			else
			{
				for (int j = 0; j < _wheels.Length; j++)
				{
					EmoteWheel emoteWheel2 = _wheels[j];
					EmoteWheelData emoteWheelData = WheelSetData.EmoteWheels[j];
					((Component)emoteWheel2).gameObject.SetActive(true);
					emoteWheel2.LoadEmotes(emoteWheelData.Emotes);
				}
			}
		}

		public void LockWheels()
		{
			_wheelLock = true;
			if (_currentWheelIndex >= 0)
			{
				_wheels[_currentWheelIndex].DeSelectAll();
			}
		}

		public void UnlockWheels()
		{
			_wheelLock = false;
		}

		private void InitWheels()
		{
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			if (wheelPrefab == null || wheelContainer == null)
			{
				return;
			}
			int num = WheelSetData.EmoteWheels.Length;
			if (_wheels.Length != num)
			{
				_wheels = new EmoteWheel[num];
				for (int i = 0; i < _wheels.Length; i++)
				{
					GameObject val = Object.Instantiate<GameObject>(wheelPrefab, (Transform)(object)wheelContainer);
					val.transform.localPosition = Vector3.zero;
					EmoteWheel component = val.GetComponent<EmoteWheel>();
					EmoteWheelData emoteWheelData = WheelSetData.EmoteWheels[i];
					component.LoadEmotes(emoteWheelData.Emotes);
					component.Focused = false;
					((Component)component).gameObject.SetActive(false);
					_wheels[i] = component;
				}
				_currentWheelIndex = 0;
				int num2 = WheelSetData.IndexOfDefault();
				if (num2 >= 0)
				{
					_currentWheelIndex = num2;
				}
				UpdateWheelState();
			}
		}

		public void NextWheel()
		{
			if (!_wheelLock)
			{
				int currentWheelIndex = _currentWheelIndex;
				_currentWheelIndex++;
				if (_currentWheelIndex >= _wheels.Length)
				{
					_currentWheelIndex = 0;
				}
				EmoteWheel emoteWheel = _wheels[currentWheelIndex];
				emoteWheel.Focused = false;
				emoteWheel.DeSelectAll();
				FadeWheelLeft(currentWheelIndex);
				UpdateWheelState();
			}
		}

		public void PrevWheel()
		{
			if (!_wheelLock)
			{
				int currentWheelIndex = _currentWheelIndex;
				_currentWheelIndex--;
				if (_currentWheelIndex < 0)
				{
					_currentWheelIndex = _wheels.Length - 1;
				}
				EmoteWheel emoteWheel = _wheels[currentWheelIndex];
				emoteWheel.Focused = false;
				emoteWheel.DeSelectAll();
				FadeWheelRight(currentWheelIndex);
				UpdateWheelState();
			}
		}

		public void Show()
		{
			UnlockWheels();
			if (wheelContainer != null)
			{
				int num = WheelSetData.IndexOfDefault();
				if (num >= 0)
				{
					_currentWheelIndex = num;
				}
				EmoteWheel currentWheel = GetCurrentWheel();
				((Component)currentWheel).gameObject.SetActive(true);
				((Component)wheelContainer).gameObject.SetActive(true);
				if (wheelLabel != null)
				{
					((Component)wheelLabel).gameObject.SetActive(true);
					UpdateWheelState();
				}
			}
		}

		public void Hide()
		{
			UnlockWheels();
			if (wheelContainer == null)
			{
				return;
			}
			EmoteWheel[] wheels = _wheels;
			foreach (EmoteWheel emoteWheel in wheels)
			{
				((Component)emoteWheel).gameObject.SetActive(false);
			}
			((Component)wheelContainer).gameObject.SetActive(false);
			if (!string.IsNullOrEmpty(_selectedEmote))
			{
				EmoteUiManager.PlayEmote(_selectedEmote);
				_selectedEmote = "none";
				if (wheelLabel != null)
				{
					((Component)wheelLabel).gameObject.SetActive(false);
				}
			}
		}

		public void CloseGracefully()
		{
			if (wheelContainer != null)
			{
				EmoteWheel[] wheels = _wheels;
				foreach (EmoteWheel emoteWheel in wheels)
				{
					((Component)emoteWheel).gameObject.SetActive(false);
				}
				((Component)wheelContainer).gameObject.SetActive(false);
				_selectedEmote = "";
				if (wheelLabel != null)
				{
					((Component)wheelLabel).gameObject.SetActive(false);
				}
			}
		}

		private EmoteWheel GetCurrentWheel()
		{
			return _wheels[_currentWheelIndex];
		}

		private void UpdateWheelState()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			EmoteWheel currentWheel = GetCurrentWheel();
			((Component)currentWheel).gameObject.SetActive(true);
			Transform transform = ((Component)currentWheel).transform;
			transform.SetAsLastSibling();
			transform.localPosition = Vector3.zero;
			currentWheel.ResetState();
			currentWheel.Focused = true;
			currentWheel.AddOnEmoteSelectedCallback(UpdateSelectedEmote);
			EmoteWheelData emoteWheelData = WheelSetData.EmoteWheels[_currentWheelIndex];
			((TMP_Text)wheelLabel).SetText(emoteWheelData.Name, true);
		}

		private void UpdateSelectedEmote(string selectedEmote)
		{
			_selectedEmote = selectedEmote;
		}

		private void FadeWheelLeft(int wheelIndex, bool instant = false)
		{
			FadeWheel(wheelIndex, left: true, instant);
		}

		private void FadeWheelRight(int wheelIndex, bool instant = false)
		{
			FadeWheel(wheelIndex, left: false, instant);
		}

		private void FadeWheel(int wheelIndex, bool left, bool instant = false)
		{
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			if (fadeCurve != null)
			{
				EmoteWheel emoteWheel = _wheels[wheelIndex];
				Vector3 targetPos = default(Vector3);
				((Vector3)(ref targetPos))..ctor(left ? (0f - fadeDist) : fadeDist, 0f, 0f);
				emoteWheel.TweenPos(targetPos, fadeCurve, instant ? 0f : fadeDuration, ignoreTimeScale: true);
				emoteWheel.TweenAlpha(0f, fadeCurve, instant ? 0f : fadeDuration, ignoreTimeScale: true);
				emoteWheel.DisableAfterDuration(instant ? 0f : fadeDuration, ignoreTimeScale: true);
			}
		}
	}
	[DisallowMultipleComponent]
	[RequireComponent(typeof(RectTransform))]
	[ExecuteAlways]
	public class EmoteWheelSegment : UIBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		public WheelSegmentGraphic? targetGraphic;

		public SegmentLabel? targetLabel;

		public RectTransform? segmentRectTransform;

		public ColorBlock colors;

		[Range(1f, 2f)]
		public float scaleMultiplier;

		public bool selected;

		public bool focused;

		private bool IsSelected()
		{
			return selected && focused;
		}

		protected override void Awake()
		{
			((UIBehaviour)this).Awake();
			if (targetGraphic == null)
			{
				targetGraphic = ((Component)this).GetComponentInChildren<WheelSegmentGraphic>();
			}
			if (targetLabel == null)
			{
				targetLabel = ((Component)this).GetComponentInChildren<SegmentLabel>();
			}
		}

		protected override void OnEnable()
		{
			((UIBehaviour)this).OnEnable();
			UpdateState(requireFocus: false, instant: true);
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			selected = true;
			UpdateState();
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			selected = false;
			UpdateState();
		}

		public void DeSelect()
		{
			selected = false;
			UpdateState(requireFocus: false);
		}

		public void ResetState()
		{
			selected = false;
			UpdateState(requireFocus: false, instant: true);
		}

		private Color GetColor()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (IsSelected())
			{
				return ((ColorBlock)(ref colors)).selectedColor;
			}
			return ((ColorBlock)(ref colors)).normalColor;
		}

		private float GetScale()
		{
			if (IsSelected())
			{
				return scaleMultiplier;
			}
			return 1f;
		}

		private void UpdateState(bool requireFocus = true, bool instant = false)
		{
			//IL_0013: 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)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			if (!(!focused && requireFocus))
			{
				Color color = GetColor();
				StartColorTween(color * ((ColorBlock)(ref colors)).colorMultiplier, instant);
				StartScaleTween(GetScale(), instant);
			}
		}

		private void StartColorTween(Color targetColor, bool instant)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (targetGraphic != null)
			{
				((Graphic)targetGraphic).CrossFadeColor(targetColor, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, true, true);
			}
		}

		private void StartScaleTween(float targetScale, bool instant)
		{
			//IL_0024: 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)
			if (targetGraphic != null && targetLabel != null)
			{
				targetGraphic.TweenScale(new Vector3(targetScale, targetScale, targetScale), instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true);
				targetLabel.TweenScale(new Vector3(targetScale, targetScale, targetScale), instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true);
			}
		}
	}
	[DisallowMultipleComponent]
	[RequireComponent(typeof(RectTransform))]
	[ExecuteAlways]
	public class SegmentLabel : UIBehaviour
	{
		private readonly TweenRunner<Vector3Tween> _scaleTweenRunner = new TweenRunner<Vector3Tween>();

		public RectTransform? targetLabel;

		public TextMeshProUGUI? targetText;

		private RectTransform? _rectTransform;

		private string? _emoteKey;

		protected DrivenRectTransformTracker Tracker;

		public RectTransform RectTransform
		{
			get
			{
				if (_rectTransform == null)
				{
					_rectTransform = ((Component)this).GetComponent<RectTransform>();
				}
				return _rectTransform;
			}
		}

		protected SegmentLabel()
		{
			_scaleTweenRunner.Init((MonoBehaviour)(object)this);
		}

		protected override void OnEnable()
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			((UIBehaviour)this).OnEnable();
			if (targetLabel != null)
			{
				((DrivenRectTransformTracker)(ref Tracker)).Add((Object)(object)this, targetLabel, (DrivenTransformProperties)16);
				Vector3 eulerAngles = ((Transform)RectTransform).eulerAngles;
				((Transform)targetLabel).localEulerAngles = -eulerAngles;
				UpdateText();
			}
		}

		protected override void OnDisable()
		{
			((UIBehaviour)this).OnDisable();
			((DrivenRectTransformTracker)(ref Tracker)).Clear();
		}

		public void SetEmote(string? emoteKey)
		{
			_emoteKey = emoteKey;
			UpdateText();
		}

		private void UpdateText()
		{
			if (targetText != null && _emoteKey != null)
			{
				((TMP_Text)targetText).SetText(EmoteUiManager.GetEmoteName(_emoteKey), true);
			}
		}

		public void TweenScale(Vector3 targetScale, float duration, bool ignoreTimeScale)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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)
			if (((Component)this).transform.localScale == targetScale)
			{
				_scaleTweenRunner.StopTween();
				return;
			}
			Vector3Tween vector3Tween = default(Vector3Tween);
			vector3Tween.Duration = duration;
			vector3Tween.StartValue = ((Component)this).transform.localScale;
			vector3Tween.TargetValue = targetScale;
			vector3Tween.IgnoreTimeScale = ignoreTimeScale;
			Vector3Tween tweenValue = vector3Tween;
			tweenValue.AddOnChangedCallback(TweenScaleChanged);
			_scaleTweenRunner.StartTween(tweenValue);
		}

		private void TweenScaleChanged(Vector3 scale)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.localScale = scale;
		}
	}
	[DisallowMultipleComponent]
	[RequireComponent(typeof(CanvasRenderer))]
	[ExecuteAlways]
	public class WheelSegmentGraphic : Graphic
	{
		private readonly TweenRunner<Vector3Tween> _scaleTweenRunner = new TweenRunner<Vector3Tween>();

		public int segmentCount = 8;

		public float segmentRotOffset = 22.5f;

		public float minRadius = 100f;

		public float maxRadius = 300f;

		protected WheelSegmentGraphic()
		{
			_scaleTweenRunner.Init((MonoBehaviour)(object)this);
		}

		protected override void OnEnable()
		{
			((Graphic)this).OnEnable();
			((Graphic)this).raycastTarget = false;
		}

		protected override void OnPopulateMesh(VertexHelper vh)
		{
			//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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0056: Unknown result type (might be due to invalid IL or missing references)
			//IL_005b: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_006b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b2: 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)
			//IL_00b9: 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_00d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00dd: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ec: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_0109: Unknown result type (might be due to invalid IL or missing references)
			//IL_0111: Unknown result type (might be due to invalid IL or missing references)
			//IL_0116: Unknown result type (might be due to invalid IL or missing references)
			//IL_0122: Unknown result type (might be due to invalid IL or missing references)
			//IL_0124: Unknown result type (might be due to invalid IL or missing references)
			//IL_012c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0131: Unknown result type (might be due to invalid IL or missing references)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0147: Unknown result type (might be due to invalid IL or missing references)
			//IL_014c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0158: Unknown result type (might be due to invalid IL or missing references)
			//IL_015a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0162: Unknown result type (might be due to invalid IL or missing references)
			//IL_0167: Unknown result type (might be due to invalid IL or missing references)
			vh.Clear();
			Color32 val = Color32.op_Implicit(((Graphic)this).color);
			float num = (float)(Math.PI * 2.0 / (double)segmentCount);
			float num2 = num + MathF.PI / 180f * segmentRotOffset;
			int num3 = 0;
			float num4 = MathF.PI / 180f;
			Vector3 val2 = CosSin(num2, minRadius);
			Vector3 val3 = CosSin(num2 + num, minRadius);
			Vector3 val4 = -Vector3.Lerp(val2, val3, 0.5f);
			float num5 = num + num4 / 2f - num4;
			for (float num6 = 0f; num6 < num5; num6 += num4)
			{
				float rad = num2 + num6;
				Vector3 val5 = CosSin(rad, minRadius) + val4;
				Vector3 val6 = CosSin(rad, maxRadius) + val4;
				rad = num2 + num6 + num4;
				Vector3 val7 = CosSin(rad, minRadius) + val4;
				Vector3 val8 = CosSin(rad, maxRadius) + val4;
				float num7 = num6 / num5;
				float num8 = (num6 + num4) / num5;
				vh.AddVert(val5, val, Vector4.op_Implicit(new Vector2(num7, 0f)));
				vh.AddVert(val6, val, Vector4.op_Implicit(new Vector2(num7, 1f)));
				vh.AddVert(val7, val, Vector4.op_Implicit(new Vector2(num8, 0f)));
				vh.AddVert(val8, val, Vector4.op_Implicit(new Vector2(num8, 1f)));
				vh.AddTriangle(num3 + 2, num3 + 1, num3);
				vh.AddTriangle(num3 + 3, num3 + 1, num3 + 2);
				num3 += 4;
			}
		}

		private static Vector3 CosSin(float rad, float dist)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)(Math.Cos(rad) * (double)dist);
			float num2 = (float)(Math.Sin(rad) * (double)dist);
			return new Vector3(num, num2, 0f);
		}

		public void TweenScale(Vector3 targetScale, float duration, bool ignoreTimeScale)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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)
			if (((Component)this).transform.localScale == targetScale)
			{
				_scaleTweenRunner.StopTween();
				return;
			}
			Vector3Tween vector3Tween = default(Vector3Tween);
			vector3Tween.Duration = duration;
			vector3Tween.StartValue = ((Component)this).transform.localScale;
			vector3Tween.TargetValue = targetScale;
			vector3Tween.IgnoreTimeScale = ignoreTimeScale;
			Vector3Tween tweenValue = vector3Tween;
			tweenValue.AddOnChangedCallback(TweenScaleChanged);
			_scaleTweenRunner.StartTween(tweenValue);
		}

		private void TweenScaleChanged(Vector3 scale)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			((Component)this).transform.localScale = scale;
		}
	}
	[DisallowMultipleComponent]
	[RequireComponent(typeof(RectTransform))]
	[ExecuteAlways]
	public class WheelStopEmote : UIBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		public WheelStopEmoteGraphic? backgroundGraphic;

		public Graphic? foregroundGraphic;

		public LeUiScaleTweener? scaleTweener;

		public ColorBlock colors;

		[Range(1f, 2f)]
		public float scaleMultiplier;

		public bool selected;

		protected override void OnEnable()
		{
			((UIBehaviour)this).OnEnable();
			UpdateState(instant: true);
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			selected = true;
			UpdateState();
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			selected = false;
			UpdateState();
		}

		private Color GetBackgroundColor()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (selected)
			{
				return ((ColorBlock)(ref colors)).selectedColor;
			}
			return ((ColorBlock)(ref colors)).normalColor;
		}

		private Color GetForegroundColor()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (selected)
			{
				return ((ColorBlock)(ref colors)).highlightedColor;
			}
			return ((ColorBlock)(ref colors)).disabledColor;
		}

		private float GetScale()
		{
			if (selected)
			{
				return scaleMultiplier;
			}
			return 1f;
		}

		private void UpdateState(bool instant = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0021: 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)
			Color backgroundColor = GetBackgroundColor();
			Color foregroundColor = GetForegroundColor();
			StartColorTween(foregroundColor * ((ColorBlock)(ref colors)).colorMultiplier, backgroundColor * ((ColorBlock)(ref colors)).colorMultiplier, instant);
			float scale = GetScale();
			StartScaleTween(scale, instant);
		}

		private void StartColorTween(Color foregroundColor, Color backgroundColor, bool instant)
		{
			//IL_0007: 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)
			((Graphic)backgroundGraphic).CrossFadeColor(backgroundColor, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, true, true);
			foregroundGraphic.CrossFadeColor(foregroundColor, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, true, true);
		}

		private void StartScaleTween(float scale, bool instant)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (scaleTweener != null)
			{
				Vector3 targetScale = default(Vector3);
				((Vector3)(ref targetScale))..ctor(scale, scale, scale);
				scaleTweener.TweenScale(targetScale, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true);
			}
		}
	}
	[DisallowMultipleComponent]
	[RequireComponent(typeof(CanvasRenderer))]
	[ExecuteAlways]
	public class WheelStopEmoteGraphic : Graphic
	{
		public float radius = 95f;

		protected override void OnPopulateMesh(VertexHelper vh)
		{
			//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_0013: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: 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_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_005d: 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_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_0086: 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_0097: Unknown result type (might be due to invalid IL or missing references)
			//IL_009c: 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_00ac: 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_00ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
			vh.Clear();
			Color32 val = Color32.op_Implicit(((Graphic)this).color);
			float num = MathF.PI * 2f;
			int num2 = 0;
			float num3 = MathF.PI / 180f;
			for (float num4 = 0f; num4 + num3 < num; num4 += num3)
			{
				float rad = num4;
				Vector3 val2 = CosSin(rad, radius);
				rad = num4 + num3;
				Vector3 val3 = CosSin(rad, radius);
				vh.AddVert(Vector3.zero, val, Vector4.op_Implicit(new Vector2(0f, 0f)));
				vh.AddVert(val2, val, Vector4.op_Implicit(new Vector2(0f, 1f)));
				vh.AddVert(Vector3.zero, val, Vector4.op_Implicit(new Vector2(1f, 0f)));
				vh.AddVert(val3, val, Vector4.op_Implicit(new Vector2(1f, 1f)));
				vh.AddTriangle(num2 + 2, num2 + 1, num2);
				vh.AddTriangle(num2 + 3, num2 + 1, num2 + 2);
				num2 += 4;
			}
		}

		private static Vector3 CosSin(float rad, float dist)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_0025: Unknown result type (might be due to invalid IL or missing references)
			//IL_0028: Unknown result type (might be due to invalid IL or missing references)
			float num = (float)(Math.Cos(rad) * (double)dist);
			float num2 = (float)(Math.Sin(rad) * (double)dist);
			return new Vector3(num, num2, 0f);
		}
	}
}
namespace LethalEmotesApi.Ui.Options
{
	public class DmcaFreeDropdown : LeUiDropdown
	{
		protected override int GetCurrentValue()
		{
			return EmoteUiManager.DmcaFree;
		}

		protected override void SetCurrentValue(int value)
		{
			EmoteUiManager.DmcaFree = value;
		}
	}
	public class EmotesAlertEnemies : LeUiToggle
	{
		protected override bool GetCurrentValue()
		{
			return EmoteUiManager.EmotesAlertEnemies;
		}

		protected override void SetCurrentValue(bool value)
		{
			EmoteUiManager.EmotesAlertEnemies = value;
		}
	}
	public class EmoteVolumeSlider : MonoBehaviour
	{
		public Slider? volumeSlider;

		private bool _hasListener;

		private void Awake()
		{
			UpdateSliderValue();
			EnsureListener();
		}

		private void Start()
		{
			UpdateSliderValue();
			EnsureListener();
		}

		private void OnEnable()
		{
			UpdateSliderValue();
			EnsureListener();
		}

		private void UpdateSliderValue()
		{
			if (volumeSlider != null)
			{
				volumeSlider.value = EmoteUiManager.EmoteVolume;
			}
		}

		private void EnsureListener()
		{
			if (volumeSlider != null && !_hasListener)
			{
				((UnityEvent<float>)(object)volumeSlider.onValueChanged).AddListener((UnityAction<float>)SliderChanged);
				_hasListener = true;
			}
		}

		private void SliderChanged(float value)
		{
			EmoteUiManager.EmoteVolume = value;
			SetValueWithoutNotify(value);
		}

		private void SetValueWithoutNotify(float value)
		{
			if (volumeSlider != null)
			{
				volumeSlider.SetValueWithoutNotify(value);
			}
		}
	}
	public class HideJoinSpots : LeUiToggle
	{
		protected override bool GetCurrentValue()
		{
			return EmoteUiManager.HideJoinSpots;
		}

		protected override void SetCurrentValue(bool value)
		{
			EmoteUiManager.HideJoinSpots = value;
		}
	}
	public abstract class LeUiDropdown : MonoBehaviour
	{
		public TMP_Dropdown? dropdown;

		private bool _hasListener;

		private void Awake()
		{
			UpdateDropdown();
			EnsureListener();
		}

		private void Start()
		{
			UpdateDropdown();
			EnsureListener();
		}

		private void OnEnable()
		{
			UpdateDropdown();
			EnsureListener();
		}

		private void UpdateDropdown()
		{
			if (dropdown != null)
			{
				dropdown.value = GetCurrentValue();
			}
		}

		private void EnsureListener()
		{
			if (dropdown != null && !_hasListener)
			{
				((UnityEvent<int>)(object)dropdown.onValueChanged).AddListener((UnityAction<int>)DropdownChanged);
				_hasListener = true;
			}
		}

		private void DropdownChanged(int value)
		{
			SetCurrentValue(value);
			SetValueWithoutNotify(value);
		}

		protected abstract int GetCurrentValue();

		protected abstract void SetCurrentValue(int value);

		private void SetValueWithoutNotify(int value)
		{
			if (dropdown != null)
			{
				dropdown.SetValueWithoutNotify(value);
			}
		}
	}
	public abstract class LeUiToggle : MonoBehaviour
	{
		public Image? checkboxImage;

		private void Awake()
		{
			UpdateCheckbox();
		}

		private void Start()
		{
			UpdateCheckbox();
		}

		private void OnEnable()
		{
			UpdateCheckbox();
		}

		public void Toggle()
		{
			SetCurrentValue(!GetCurrentValue());
			UpdateCheckbox();
		}

		private void UpdateCheckbox()
		{
			if (checkboxImage != null)
			{
				((Behaviour)checkboxImage).enabled = GetCurrentValue();
			}
		}

		protected abstract bool GetCurrentValue();

		protected abstract void SetCurrentValue(bool value);
	}
	public class RootMotionTypeDropdown : LeUiDropdown
	{
		protected override int GetCurrentValue()
		{
			return EmoteUiManager.RootMotionType;
		}

		protected override void SetCurrentValue(int value)
		{
			EmoteUiManager.RootMotionType = value;
		}
	}
	public class ThirdPersonDropdown : LeUiDropdown
	{
		protected override int GetCurrentValue()
		{
			return EmoteUiManager.ThirdPerson;
		}

		protected override void SetCurrentValue(int value)
		{
			EmoteUiManager.ThirdPerson = value;
		}
	}
}
namespace LethalEmotesApi.Ui.Elements
{
	[DisallowMultipleComponent]
	public class LeUiButton : UIBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerDownHandler, IPointerUpHandler, IPointerClickHandler
	{
		public Graphic? targetGraphic;

		public LeUiScaleTweener? scaleTweener;

		public ColorBlock colors;

		[Range(0f, 2f)]
		public float scaleSelected;

		[Range(0f, 2f)]
		public float scalePressed;

		public UnityEvent onClick = new UnityEvent();

		public UnityEvent onEnter = new UnityEvent();

		public UnityEvent onExit = new UnityEvent();

		private bool _selected;

		private bool _pressed;

		protected override void OnEnable()
		{
			((UIBehaviour)this).OnEnable();
			UpdateState(instant: true);
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			_selected = true;
			onEnter.Invoke();
			UpdateState();
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			_selected = false;
			onExit.Invoke();
			UpdateState();
		}

		public void OnPointerDown(PointerEventData eventData)
		{
			_pressed = _selected;
			UpdateState();
		}

		public void OnPointerUp(PointerEventData eventData)
		{
			_pressed = false;
			UpdateState();
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			onClick.Invoke();
		}

		private Color GetColor()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_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_003f: Unknown result type (might be due to invalid IL or missing references)
			if (_pressed)
			{
				return ((ColorBlock)(ref colors)).pressedColor;
			}
			if (_selected)
			{
				return ((ColorBlock)(ref colors)).selectedColor;
			}
			return ((ColorBlock)(ref colors)).normalColor;
		}

		private float GetScale()
		{
			if (_pressed)
			{
				return scalePressed;
			}
			if (_selected)
			{
				return scaleSelected;
			}
			return 1f;
		}

		private void UpdateState(bool instant = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			Color color = GetColor();
			targetGraphic.CrossFadeColor(color, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, true, true);
			float scale = GetScale();
			Vector3 targetScale = default(Vector3);
			((Vector3)(ref targetScale))..ctor(scale, scale, scale);
			scaleTweener.TweenScale(targetScale, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true);
		}
	}
	[DisallowMultipleComponent]
	[ExecuteAlways]
	public class LeUiScaleTweener : MonoBehaviour
	{
		private readonly TweenRunner<Vector3Tween> _scaleTweenRunner = new TweenRunner<Vector3Tween>();

		private Vector3 _internalScale = Vector3.one;

		public List<RectTransform> targets = new List<RectTransform>();

		protected LeUiScaleTweener()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			_scaleTweenRunner.Init((MonoBehaviour)(object)this);
		}

		public void TweenScale(Vector3 targetScale, float duration, bool ignoreTimeScale)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: 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)
			if (_internalScale == targetScale)
			{
				_scaleTweenRunner.StopTween();
				return;
			}
			Vector3Tween vector3Tween = default(Vector3Tween);
			vector3Tween.Duration = duration;
			vector3Tween.IgnoreTimeScale = ignoreTimeScale;
			vector3Tween.StartValue = _internalScale;
			vector3Tween.TargetValue = targetScale;
			Vector3Tween tweenValue = vector3Tween;
			tweenValue.AddOnChangedCallback(TweenScaleChanged);
			_scaleTweenRunner.StartTween(tweenValue);
		}

		private void TweenScaleChanged(Vector3 scale)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0003: Unknown result type (might be due to invalid IL or missing references)
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			_internalScale = scale;
			foreach (RectTransform target in targets)
			{
				((Transform)target).localScale = scale;
			}
		}
	}
	public class LeUiSelectOutline : UIBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler
	{
		public Image? selectImage;

		public void OnPointerEnter(PointerEventData eventData)
		{
			if (selectImage != null)
			{
				((Behaviour)selectImage).enabled = true;
			}
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			if (selectImage != null)
			{
				((Behaviour)selectImage).enabled = false;
			}
		}
	}
}
namespace LethalEmotesApi.Ui.Db
{
	public interface IEmoteDb
	{
		IReadOnlyCollection<string> EmoteKeys { get; }

		IReadOnlyCollection<string> EmoteModNames { get; }

		string GetEmoteName(string emoteKey);

		void AssociateEmoteKeyWithMod(string emoteKey, string modName);

		string GetModName(string emoteKey);
	}
}
namespace LethalEmotesApi.Ui.Data
{
	[Serializable]
	public class EmoteWheelData
	{
		public string Name { get; set; }

		public bool? IsDefault { get; set; }

		public string[] Emotes { get; set; }

		public EmoteWheelData(string name)
		{
			Name = name;
			IsDefault = false;
			Emotes = new string[8];
			base..ctor();
		}

		public bool IsDefaultWheel()
		{
			return IsDefault.HasValue && IsDefault.Value;
		}

		public static EmoteWheelData CreateDefault(int wheelIndex = 0)
		{
			EmoteWheelData emoteWheelData = new EmoteWheelData($"Wheel {wheelIndex + 1}");
			Array.Fill(emoteWheelData.Emotes, "none");
			return emoteWheelData;
		}
	}
	[Serializable]
	public class EmoteWheelSetData
	{
		public EmoteWheelData[] EmoteWheels { get; set; } = Array.Empty<EmoteWheelData>();


		public int IndexOfDefault()
		{
			int result = -1;
			for (int i = 0; i < EmoteWheels.Length; i++)
			{
				if (EmoteWheels[i].IsDefaultWheel())
				{
					result = i;
					break;
				}
			}
			return result;
		}

		public static EmoteWheelSetData Default()
		{
			EmoteWheelSetData emoteWheelSetData = new EmoteWheelSetData();
			emoteWheelSetData.EmoteWheels = new EmoteWheelData[1] { EmoteWheelData.CreateDefault() };
			return emoteWheelSetData;
		}
	}
	public interface IEmoteUiStateController
	{
		IEmoteDb EmoteDb { get; }

		IReadOnlyCollection<string> RandomPoolBlacklist { get; }

		float EmoteVolume { get; set; }

		bool HideJoinSpots { get; set; }

		int RootMotionType { get; set; }

		bool EmotesAlertEnemies { get; set; }

		int DmcaFree { get; set; }

		int ThirdPerson { get; set; }

		void PlayEmote(string emoteKey);

		void LockMouseInput();

		void UnlockMouseInput();

		void LockPlayerInput();

		void UnlockPlayerInput();

		bool CanOpenEmoteUi();

		void PlayAnimationOn(Animator animator, string emoteKey);

		void AddToRandomPoolBlacklist(string emoteKey);

		void RemoveFromRandomPoolBlacklist(string emoteKey);

		EmoteWheelSetData LoadEmoteWheelSetData();

		void SaveEmoteWheelSetData(EmoteWheelSetData dataToSave);
	}
	public class SearchableEmoteArray : IReadOnlyList<string>, IEnumerable<string>, IEnumerable, IReadOnlyCollection<string>
	{
		public enum SortOrder
		{
			Descending,
			Ascending
		}

		private readonly struct CacheState : IEquatable<CacheState>
		{
			public readonly SortOrder Order;

			public readonly string Filter;

			public CacheState(SortOrder order, string filter)
			{
				Order = order;
				Filter = filter;
			}

			public bool Equals(CacheState other)
			{
				return Order == other.Order && Filter == other.Filter;
			}

			public override bool Equals(object? obj)
			{
				return obj is CacheState other && Equals(other);
			}

			public override int GetHashCode()
			{
				return HashCode.Combine((int)Order, Filter);
			}

			public static bool operator ==(CacheState left, CacheState right)
			{
				return left.Equals(right);
			}

			public static bool operator !=(CacheState left, CacheState right)
			{
				return !(left == right);
			}
		}

		private readonly string[] _emoteKeys;

		private CacheState _state;

		private int[] _lut = null;

		private string[] _cachedKeys = Array.Empty<string>();

		public int Count => _cachedKeys.Length;

		public string this[int index] => _cachedKeys[index];

		public SortOrder Order
		{
			get
			{
				return _state.Order;
			}
			set
			{
				CacheState state = _state;
				_state = new CacheState(value, _state.Filter);
				if (_state != state)
				{
					UpdateCachedKeys();
				}
			}
		}

		public string Filter
		{
			get
			{
				return _state.Filter;
			}
			set
			{
				CacheState state = _state;
				_state = new CacheState(_state.Order, value);
				if (_state != state)
				{
					UpdateCachedKeys();
				}
			}
		}

		public SearchableEmoteArray(string[] emoteKeys)
		{
			_emoteKeys = emoteKeys;
			_state = new CacheState(SortOrder.Descending, "");
			UpdateCachedKeys();
		}

		private int[] CreateLut(IEnumerable<string> emoteKeys)
		{
			return (from kvp in emoteKeys.Select((string key, int index) => new KeyValuePair<string, int>(key, index))
				orderby EmoteUiManager.GetEmoteName(kvp.Key)
				where MatchesFilter(kvp.Key, Filter)
				select kvp.Value).ToArray();
		}

		private void UpdateCachedKeys()
		{
			_lut = CreateLut(_emoteKeys);
			_cachedKeys = new string[_lut.Length];
			for (int i = 0; i < _lut.Length; i++)
			{
				_cachedKeys[i] = _emoteKeys[_lut[i]];
			}
		}

		public IEnumerator<string> GetEnumerator()
		{
			return ((IEnumerable<string>)_cachedKeys).GetEnumerator();
		}

		IEnumerator IEnumerable.GetEnumerator()
		{
			return GetEnumerator();
		}

		private static bool MatchesFilter(string emoteKey, string filter)
		{
			if (string.IsNullOrEmpty(filter))
			{
				return true;
			}
			if (filter.StartsWith('@'))
			{
				string emoteModName = EmoteUiManager.GetEmoteModName(emoteKey);
				string value = filter.Substring(1, filter.Length - 1);
				return emoteModName.Contains(value, StringComparison.InvariantCultureIgnoreCase);
			}
			string emoteName = EmoteUiManager.GetEmoteName(emoteKey);
			return emoteKey.Contains(filter, StringComparison.InvariantCultureIgnoreCase) || emoteName.Contains(filter, StringComparison.InvariantCultureIgnoreCase);
		}
	}
}
namespace LethalEmotesApi.Ui.Customize
{
	[DisallowMultipleComponent]
	[RequireComponent(typeof(EmoteDragDropController))]
	public class CustomizePanel : MonoBehaviour
	{
		public EmoteDragDropController? dragDropController;

		public PreviewController? previewController;

		private void Awake()
		{
			if (dragDropController == null)
			{
				dragDropController = ((Component)this).GetComponent<EmoteDragDropController>();
			}
			if (previewController == null)
			{
				previewController = ((Component)this).GetComponentInChildren<PreviewController>();
			}
		}
	}
	public class DeleteWheelPopup : UIBehaviour
	{
		public CustomizeWheelController? customizeWheelController;

		public void Cancel()
		{
			Object.Destroy((Object)(object)((Component)this).gameObject);
		}

		public void Confirm()
		{
			if (customizeWheelController == null)
			{
				Cancel();
			}
			else
			{
				customizeWheelController.DeleteWheel();
			}
		}
	}
}
namespace LethalEmotesApi.Ui.Customize.Wheel
{
	[DisallowMultipleComponent]
	[RequireComponent(typeof(RectTransform))]
	public class CustomizeWheel : UIBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IPointerEnterHandler, IPointerMoveHandler
	{
		public class EmoteChangedCallback : UnityEvent<int, string>
		{
		}

		public class EmotesSwappedCallback : UnityEvent<int, int>
		{
		}

		public PreviewController? previewController;

		public EmoteDragDropController? dragDropController;

		public ColorBlock colors;

		[Range(1f, 2f)]
		public float scaleMultiplier;

		public Material? segmentMaterial;

		public WheelDefaultButton? defaultButton;

		public float minDist = 100f;

		public List<CustomizeWheelSegment> wheelSegments = new List<CustomizeWheelSegment>();

		public EmoteChangedCallback OnEmoteChanged = new EmoteChangedCallback();

		public EmotesSwappedCallback OnEmotesSwapped = new EmotesSwappedCallback();

		private string[] _emoteArray = Array.Empty<string>();

		private int _currentSegmentIndex = -1;

		private RectTransform? _rectTransform;

		public RectTransform RectTransform
		{
			get
			{
				if (_rectTransform == null)
				{
					_rectTransform = ((Component)this).GetComponent<RectTransform>();
				}
				return _rectTransform;
			}
		}

		protected override void Awake()
		{
			//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)
			((UIBehaviour)this).Awake();
			if (dragDropController == null)
			{
				dragDropController = ((Component)this).GetComponentInParent<EmoteDragDropController>();
			}
			if (previewController == null)
			{
				previewController = ((Component)this).GetComponentInParent<CustomizePanel>().previewController;
			}
			foreach (CustomizeWheelSegment wheelSegment in wheelSegments)
			{
				wheelSegment.colors = colors;
				wheelSegment.scaleMultiplier = scaleMultiplier;
				if (segmentMaterial != null)
				{
					((Graphic)wheelSegment.targetGraphic).material = segmentMaterial;
				}
				wheelSegment.ResetState();
			}
		}

		protected override void Start()
		{
			((UIBehaviour)this).Start();
			ResetState();
		}

		protected override void OnEnable()
		{
			((UIBehaviour)this).OnEnable();
			ResetState();
		}

		public void OnBeginDrag(PointerEventData eventData)
		{
			StartDrag(eventData);
		}

		public void OnDrag(PointerEventData eventData)
		{
			StartDrag(eventData);
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			OnPointerMove(eventData);
		}

		public void OnPointerMove(PointerEventData eventData)
		{
			//IL_001a: 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)
			if (dragDropController == null)
			{
				return;
			}
			Vector2 mousePos = default(Vector2);
			RectTransformUtility.ScreenPointToLocalPointInRectangle(RectTransform, eventData.position, eventData.enterEventCamera, ref mousePos);
			int currentSegmentIndex = _currentSegmentIndex;
			DetectSegmentFromMouse(mousePos);
			if (_currentSegmentIndex < 0)
			{
				dragDropController.OnNotGrab();
				return;
			}
			dragDropController.OnCanGrab();
			if (dragDropController.DragState == EmoteDragDropController.DragDropState.Ready && previewController != null && currentSegmentIndex != _currentSegmentIndex)
			{
				previewController.PlayEmote(_emoteArray[_currentSegmentIndex]);
			}
		}

		private void StartDrag(PointerEventData eventData)
		{
			if (dragDropController != null)
			{
				if (_currentSegmentIndex < 0)
				{
					dragDropController.OnNotGrab();
					return;
				}
				dragDropController.StartWheelGrab(_currentSegmentIndex, _emoteArray[_currentSegmentIndex], eventData);
				GameObject val = (eventData.pointerDrag = ((Component)dragDropController).gameObject);
				ExecuteEvents.Execute<IDragHandler>(val, (BaseEventData)(object)eventData, ExecuteEvents.dragHandler);
			}
		}

		public void LoadEmoteData(EmoteWheelData emoteData)
		{
			if (defaultButton != null)
			{
				defaultButton.SetDefault(emoteData.IsDefaultWheel());
				_emoteArray = emoteData.Emotes;
				ResetState();
			}
		}

		public void DetectSegmentFromMouse(Vector2 mousePos)
		{
			//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_002d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_0060: Unknown result type (might be due to invalid IL or missing references)
			float num = Vector2.Distance(Vector2.zero, mousePos);
			if (num < minDist)
			{
				DeSelectAll();
				return;
			}
			Rect rect = RectTransform.rect;
			if (mousePos.x > ((Rect)(ref rect)).xMax || mousePos.x < ((Rect)(ref rect)).xMin || mousePos.y > ((Rect)(ref rect)).yMax || mousePos.y < ((Rect)(ref rect)).yMin)
			{
				DeSelectAll();
				return;
			}
			int closestSegmentIndex = GetClosestSegmentIndex(mousePos);
			if (closestSegmentIndex != _currentSegmentIndex && _currentSegmentIndex >= 0)
			{
				wheelSegments[_currentSegmentIndex].DeSelect();
			}
			_currentSegmentIndex = closestSegmentIndex;
			SelectSegment();
		}

		public void DropEmote(string emoteKey)
		{
			if (_currentSegmentIndex >= 0)
			{
				wheelSegments[_currentSegmentIndex].DeSelect();
				((UnityEvent<int, string>)(object)OnEmoteChanged).Invoke(_currentSegmentIndex, emoteKey);
			}
		}

		public void SwapSegmentEmotes(int fromIndex)
		{
			if (fromIndex >= 0)
			{
				if (_currentSegmentIndex < 0)
				{
					((UnityEvent<int, string>)(object)OnEmoteChanged).Invoke(fromIndex, "none");
					return;
				}
				ref string reference = ref _emoteArray[_currentSegmentIndex];
				ref string reference2 = ref _emoteArray[fromIndex];
				string text = _emoteArray[fromIndex];
				string text2 = _emoteArray[_currentSegmentIndex];
				reference = text;
				reference2 = text2;
				((UnityEvent<int, int>)OnEmotesSwapped).Invoke(fromIndex, _currentSegmentIndex);
			}
		}

		private void SelectSegment()
		{
			if (_currentSegmentIndex >= 0)
			{
				wheelSegments[_currentSegmentIndex].Select();
			}
		}

		public void DeSelectAll()
		{
			_currentSegmentIndex = -1;
			foreach (CustomizeWheelSegment wheelSegment in wheelSegments)
			{
				wheelSegment.DeSelect();
			}
		}

		public void ResetState()
		{
			_currentSegmentIndex = -1;
			foreach (CustomizeWheelSegment wheelSegment in wheelSegments)
			{
				wheelSegment.ResetState();
			}
			UpdateLabels();
		}

		private int GetClosestSegmentIndex(Vector2 mousePos)
		{
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			int result = -1;
			float num = float.MaxValue;
			for (int i = 0; i < wheelSegments.Count; i++)
			{
				CustomizeWheelSegment customizeWheelSegment = wheelSegments[i];
				Vector2 val = Vector2.op_Implicit(((Transform)customizeWheelSegment.segmentRectTransform).position - ((Transform)RectTransform).position);
				float num2 = Vector2.Distance(val, mousePos);
				if (num2 < num)
				{
					num = num2;
					result = i;
				}
			}
			return result;
		}

		private void UpdateLabels()
		{
			if (_emoteArray.Length == wheelSegments.Count)
			{
				for (int i = 0; i < wheelSegments.Count; i++)
				{
					wheelSegments[i].SetLabel(_emoteArray[i]);
				}
			}
		}
	}
	public class CustomizeWheelController : UIBehaviour, IScrollHandler, IEventSystemHandler
	{
		public CustomizeWheel? customizeWheel;

		public TMP_InputField? wheelLabel;

		public GameObject? deleteConfirmationPrefab;

		private DeleteWheelPopup? _deleteWheelPopupInstance;

		private EmoteUiPanel? _emoteUiPanel;

		private int _wheelIndex = -1;

		private EmoteWheelSetData WheelSetData => EmoteUiManager.LoadEmoteWheelSetData();

		private int WheelCount => WheelSetData.EmoteWheels.Length;

		private bool HasWheels => WheelCount > 0;

		protected override void Awake()
		{
			((UIBehaviour)this).Awake();
			if (_emoteUiPanel == null)
			{
				_emoteUiPanel = ((Component)this).GetComponentInParent<EmoteUiPanel>();
			}
			if (customizeWheel != null && wheelLabel != null)
			{
				((UnityEvent<int, string>)(object)customizeWheel.OnEmoteChanged).AddListener((UnityAction<int, string>)EmoteAtIndexChanged);
				((UnityEvent<int, int>)customizeWheel.OnEmotesSwapped).AddListener((UnityAction<int, int>)EmotesSwapped);
				((UnityEvent<string>)(object)wheelLabel.onValueChanged).AddListener((UnityAction<string>)WheelLabelChanged);
				if (HasWheels)
				{
					_wheelIndex = 0;
					UpdateState();
				}
			}
		}

		protected override void OnDisable()
		{
			((UIBehaviour)this).OnDisable();
			if (_deleteWheelPopupInstance != null)
			{
				Object.DestroyImmediate((Object)(object)((Component)_deleteWheelPopupInstance).gameObject);
				_deleteWheelPopupInstance = null;
			}
		}

		public void NextWheel()
		{
			if (customizeWheel != null)
			{
				_wheelIndex++;
				if (_wheelIndex >= WheelCount)
				{
					_wheelIndex = 0;
				}
				UpdateState();
			}
		}

		public void PrevWheel()
		{
			if (customizeWheel != null)
			{
				_wheelIndex--;
				if (_wheelIndex < 0)
				{
					_wheelIndex = WheelCount - 1;
				}
				UpdateState();
			}
		}

		public void NewWheel()
		{
			if (customizeWheel != null)
			{
				int num = _wheelIndex + 1;
				EmoteWheelData[] emoteWheels = WheelSetData.EmoteWheels;
				EmoteWheelData emoteWheelData = EmoteWheelData.CreateDefault(emoteWheels.Length);
				IEnumerable<EmoteWheelData> enumerable = emoteWheels[..num].Concat(new <>z__ReadOnlyArray<EmoteWheelData>(new EmoteWheelData[1] { emoteWheelData }));
				if (num < emoteWheels.Length)
				{
					enumerable = enumerable.Concat(emoteWheels[num..]);
				}
				EmoteWheelSetData dataToSave = new EmoteWheelSetData
				{
					EmoteWheels = enumerable.ToArray()
				};
				EmoteUiManager.SaveEmoteWheelSetData(dataToSave);
				_wheelIndex = num;
				UpdateState();
			}
		}

		public void TryDelete()
		{
			if (deleteConfirmationPrefab != null)
			{
				GameObject val = Object.Instantiate<GameObject>(deleteConfirmationPrefab, ((Component)_emoteUiPanel).transform);
				_deleteWheelPopupInstance = val.GetComponent<DeleteWheelPopup>();
				_deleteWheelPopupInstance.customizeWheelController = this;
			}
		}

		public void DeleteWheel()
		{
			if (_deleteWheelPopupInstance == null)
			{
				return;
			}
			Object.DestroyImmediate((Object)(object)((Component)_deleteWheelPopupInstance).gameObject);
			_deleteWheelPopupInstance = null;
			if (customizeWheel == null || _wheelIndex < 0)
			{
				return;
			}
			EmoteWheelData[] emoteWheels = WheelSetData.EmoteWheels;
			if (emoteWheels.Length == 0)
			{
				return;
			}
			if (emoteWheels.Length == 1)
			{
				emoteWheels[0] = EmoteWheelData.CreateDefault();
				EmoteWheelSetData dataToSave = new EmoteWheelSetData
				{
					EmoteWheels = emoteWheels
				};
				EmoteUiManager.SaveEmoteWheelSetData(dataToSave);
				_wheelIndex = 0;
				UpdateState();
				return;
			}
			EmoteWheelData[] array = new EmoteWheelData[emoteWheels.Length - 1];
			int num = 0;
			int num2 = 0;
			do
			{
				if (num == _wheelIndex)
				{
					num2 = 1;
					num++;
				}
				else
				{
					array[num - num2] = emoteWheels[num];
					num++;
				}
			}
			while (num < emoteWheels.Length);
			EmoteWheelSetData dataToSave2 = new EmoteWheelSetData
			{
				EmoteWheels = array
			};
			EmoteUiManager.SaveEmoteWheelSetData(dataToSave2);
			PrevWheel();
		}

		public void ToggleDefault()
		{
			if (_wheelIndex < 0 || customizeWheel == null)
			{
				return;
			}
			EmoteWheelData[] emoteWheels = WheelSetData.EmoteWheels;
			int num = WheelSetData.IndexOfDefault();
			if (num < 0)
			{
				emoteWheels[_wheelIndex].IsDefault = true;
				EmoteWheelSetData dataToSave = new EmoteWheelSetData
				{
					EmoteWheels = emoteWheels
				};
				EmoteUiManager.SaveEmoteWheelSetData(dataToSave);
				UpdateState();
				return;
			}
			emoteWheels[num].IsDefault = false;
			if (num != _wheelIndex)
			{
				emoteWheels[_wheelIndex].IsDefault = true;
			}
			EmoteWheelSetData dataToSave2 = new EmoteWheelSetData
			{
				EmoteWheels = emoteWheels
			};
			EmoteUiManager.SaveEmoteWheelSetData(dataToSave2);
			UpdateState();
		}

		public void LoadWheelIndex(int wheelIndex)
		{
			if (customizeWheel != null)
			{
				EmoteWheelData emoteWheelData = WheelSetData.EmoteWheels[wheelIndex];
				customizeWheel.LoadEmoteData(emoteWheelData);
				if (wheelLabel != null)
				{
					wheelLabel.SetTextWithoutNotify(emoteWheelData.Name);
					_wheelIndex = wheelIndex;
				}
			}
		}

		private void WheelLabelChanged(string wheelName)
		{
			EmoteWheelSetData wheelSetData = WheelSetData;
			wheelSetData.EmoteWheels[_wheelIndex].Name = wheelName;
			EmoteUiManager.SaveEmoteWheelSetData(wheelSetData);
			UpdateState();
		}

		private void EmoteAtIndexChanged(int segmentIndex, string emoteKey)
		{
			EmoteWheelSetData wheelSetData = WheelSetData;
			wheelSetData.EmoteWheels[_wheelIndex].Emotes[segmentIndex] = emoteKey;
			EmoteUiManager.SaveEmoteWheelSetData(wheelSetData);
			UpdateState();
		}

		private void EmotesSwapped(int fromIndex, int toIndex)
		{
			EmoteWheelData[] emoteWheels = WheelSetData.EmoteWheels;
			string[] emotes = emoteWheels[_wheelIndex].Emotes;
			ref string reference = ref emotes[fromIndex];
			ref string reference2 = ref emotes[toIndex];
			string text = emotes[toIndex];
			string text2 = emotes[fromIndex];
			reference = text;
			reference2 = text2;
			emoteWheels[_wheelIndex].Emotes = emotes;
			EmoteWheelSetData dataToSave = new EmoteWheelSetData
			{
				EmoteWheels = emoteWheels
			};
			EmoteUiManager.SaveEmoteWheelSetData(dataToSave);
			UpdateState();
		}

		private void UpdateState()
		{
			LoadWheelIndex(_wheelIndex);
		}

		public void OnScroll(PointerEventData eventData)
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (!((Behaviour)this).isActiveAndEnabled)
			{
				return;
			}
			float y = eventData.scrollDelta.y;
			float num = y;
			float num2 = num;
			if (!(num2 > 0f))
			{
				if (num2 < 0f)
				{
					NextWheel();
				}
			}
			else
			{
				PrevWheel();
			}
		}
	}
	[DisallowMultipleComponent]
	[RequireComponent(typeof(RectTransform))]
	public class CustomizeWheelSegment : UIBehaviour
	{
		public WheelSegmentGraphic? targetGraphic;

		public SegmentLabel? targetLabel;

		public RectTransform? segmentRectTransform;

		public ColorBlock colors;

		[Range(1f, 2f)]
		public float scaleMultiplier;

		public bool selected;

		protected override void Awake()
		{
			((UIBehaviour)this).Awake();
			if (targetGraphic == null)
			{
				targetGraphic = ((Component)this).GetComponentInChildren<WheelSegmentGraphic>();
			}
			if (targetLabel == null)
			{
				targetLabel = ((Component)this).GetComponentInChildren<SegmentLabel>();
			}
		}

		protected override void Start()
		{
			((UIBehaviour)this).Start();
			UpdateState(instant: true);
		}

		protected override void OnEnable()
		{
			((UIBehaviour)this).OnEnable();
			UpdateState(instant: true);
		}

		public void SetLabel(string text)
		{
			if (targetLabel != null)
			{
				targetLabel.SetEmote(text);
			}
		}

		public void Select()
		{
			selected = true;
			UpdateState();
		}

		public void DeSelect()
		{
			selected = false;
			UpdateState();
		}

		public void ResetState()
		{
			selected = false;
			UpdateState(instant: true);
		}

		private Color GetColor()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			if (selected)
			{
				return ((ColorBlock)(ref colors)).selectedColor;
			}
			return ((ColorBlock)(ref colors)).normalColor;
		}

		private float GetScale()
		{
			if (selected)
			{
				return scaleMultiplier;
			}
			return 1f;
		}

		private void UpdateState(bool instant = false)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0009: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			Color color = GetColor();
			StartColorTween(color * ((ColorBlock)(ref colors)).colorMultiplier, instant);
			StartScaleTween(GetScale(), instant);
		}

		private void StartColorTween(Color targetColor, bool instant)
		{
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			if (targetGraphic != null)
			{
				((Graphic)targetGraphic).CrossFadeColor(targetColor, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, true, true);
			}
		}

		private void StartScaleTween(float targetScale, bool instant)
		{
			//IL_0024: 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)
			if (targetGraphic != null && targetLabel != null)
			{
				targetGraphic.TweenScale(new Vector3(targetScale, targetScale, targetScale), instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true);
				targetLabel.TweenScale(new Vector3(targetScale, targetScale, targetScale), instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true);
			}
		}
	}
	[DisallowMultipleComponent]
	[RequireComponent(typeof(RectTransform))]
	[ExecuteAlways]
	public class WheelDefaultButton : UIBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerClickHandler
	{
		public WheelStopEmoteGraphic? targetGraphic;

		public LeUiScaleTweener? scaleTweener;

		public TextMeshProUGUI? targetLabel;

		public ColorBlock colors;

		[Range(1f, 2f)]
		public float scaleMultiplier = 1f;

		public UnityEvent onClick = new UnityEvent();

		private bool _isDefault;

		public bool selected;

		protected override void OnEnable()
		{
			((UIBehaviour)this).OnEnable();
			UpdateState(instant: true);
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			selected = true;
			UpdateState();
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			selected = false;
			UpdateState();
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			onClick.Invoke();
		}

		public void SetDefault(bool isDefault, bool instant = false)
		{
			_isDefault = isDefault;
			UpdateState(instant);
		}

		private Color GetColor()
		{
			//IL_0049: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0026: 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_004e: 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)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			if (selected)
			{
				return _isDefault ? ((ColorBlock)(ref colors)).selectedColor : ((ColorBlock)(ref colors)).disabledColor;
			}
			return _isDefault ? ((ColorBlock)(ref colors)).highlightedColor : ((ColorBlock)(ref colors)).normalColor;
		}

		private float GetScale()
		{
			if (selected)
			{
				return scaleMultiplier;
			}
			return 1f;
		}

		private void UpdateLabel()
		{
			if (targetLabel != null)
			{
				((TMP_Text)targetLabel).text = (_isDefault ? "Unset as Default Wheel" : "Set as Default Wheel");
			}
		}

		private void UpdateState(bool instant = false)
		{
			//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_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Unknown result type (might be due to invalid IL or missing references)
			UpdateLabel();
			Color color = GetColor();
			StartColorTween(color * ((ColorBlock)(ref colors)).colorMultiplier, instant);
			float scale = GetScale();
			StartScaleTween(scale, instant);
		}

		private void StartColorTween(Color color, bool instant)
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			((Graphic)targetGraphic).CrossFadeColor(color, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, true, true);
		}

		private void StartScaleTween(float scale, bool instant)
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			if (scaleTweener != null)
			{
				Vector3 targetScale = default(Vector3);
				((Vector3)(ref targetScale))..ctor(scale, scale, scale);
				scaleTweener.TweenScale(targetScale, instant ? 0f : ((ColorBlock)(ref colors)).fadeDuration, ignoreTimeScale: true);
			}
		}
	}
}
namespace LethalEmotesApi.Ui.Customize.Preview
{
	public class PreviewController : UIBehaviour, IDragHandler, IEventSystemHandler, IScrollHandler
	{
		public GameObject? previewPrefab;

		private GameObject? _previewObjectInstance;

		private Animator? _previewAnimator;

		private PreviewRig? _previewRig;

		private float rotSpeed = 25f;

		protected override void Start()
		{
			((UIBehaviour)this).Start();
			ResetPreviewInstance();
		}

		protected override void OnEnable()
		{
			((UIBehaviour)this).OnEnable();
			ResetPreviewInstance();
		}

		protected override void OnDisable()
		{
			((UIBehaviour)this).OnDisable();
			DestroyPreviewInstance();
		}

		protected override void OnDestroy()
		{
			((UIBehaviour)this).OnDestroy();
			DestroyPreviewInstance();
		}

		public void PlayEmote(string emoteKey)
		{
			if (_previewAnimator != null)
			{
				EmoteUiManager.PlayAnimationOn(_previewAnimator, emoteKey);
			}
		}

		private void ResetPreviewInstance()
		{
			//IL_0024: 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_0051: Unknown result type (might be due to invalid IL or missing references)
			if (previewPrefab != null)
			{
				DestroyPreviewInstance();
				_previewObjectInstance = Object.Instantiate<GameObject>(previewPrefab, ((Component)this).transform.position + new Vector3(0f, -10000f, 0f), Quaternion.Euler(0f, 0f, 0f));
				_previewObjectInstance.SetActive(true);
				_previewAnimator = _previewObjectInstance.GetComponentInChildren<Animator>();
				_previewRig = _previewObjectInstance.GetComponentInChildren<PreviewRig>();
			}
		}

		private void DestroyPreviewInstance()
		{
			if (_previewObjectInstance != null)
			{
				_previewObjectInstance.SetActive(false);
				Object.DestroyImmediate((Object)(object)_previewObjectInstance);
				_previewObjectInstance = null;
				_previewAnimator = null;
				_previewRig = null;
			}
		}

		public void OnDrag(PointerEventData data)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			float vInput = data.delta.y * Time.deltaTime * rotSpeed;
			float hInput = data.delta.x * Time.deltaTime * rotSpeed;
			_previewRig.Orbit(vInput, hInput);
		}

		public void OnScroll(PointerEventData eventData)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			float dir = eventData.scrollDelta.y * 4f;
			_previewRig.Zoom(dir);
		}
	}
	public class PreviewRig : MonoBehaviour
	{
		private readonly TweenRunner<FloatTween> _zoomTweenRunner = new TweenRunner<FloatTween>();

		public Camera? cam;

		protected PreviewRig()
		{
			_zoomTweenRunner.Init((MonoBehaviour)(object)this);
		}

		public void Orbit(float vInput, float hInput)
		{
			//IL_0007: 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_002c: 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_0063: 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)
			((Component)this).transform.Rotate(Vector3.right, vInput);
			((Component)this).transform.Rotate(Vector3.up, hInput, (Space)0);
			float num = ClampAngle(((Component)this).transform.localEulerAngles.x, -60f, 60f);
			((Component)this).transform.localEulerAngles = new Vector3(num, ((Component)this).transform.localEulerAngles.y, ((Component)this).transform.localEulerAngles.z);
		}

		private static float ClampAngle(float angle, float min, float max)
		{
			if (min < 0f && max > 0f && (angle > max || angle < min))
			{
				angle -= 360f;
				if (angle > max || angle < min)
				{
					if (Mathf.Abs(Mathf.DeltaAngle(angle, min)) < Mathf.Abs(Mathf.DeltaAngle(angle, max)))
					{
						return min;
					}
					return max;
				}
			}
			else if (min > 0f && (angle > max || angle < min))
			{
				angle += 360f;
				if (angle > max || angle < min)
				{
					if (Mathf.Abs(Mathf.DeltaAngle(angle, min)) < Mathf.Abs(Mathf.DeltaAngle(angle, max)))
					{
						return min;
					}
					return max;
				}
			}
			if (angle < min)
			{
				return min;
			}
			if (angle > max)
			{
				return max;
			}
			return angle;
		}

		public void Zoom(float dir)
		{
			float fieldOfView = cam.fieldOfView;
			fieldOfView -= dir;
			fieldOfView = Mathf.Clamp(fieldOfView, 2f, 154f);
			FloatTween floatTween = default(FloatTween);
			floatTween.Duration = 0.2f;
			floatTween.StartValue = cam.fieldOfView;
			floatTween.TargetValue = fieldOfView;
			floatTween.IgnoreTimeScale = true;
			FloatTween tweenValue = floatTween;
			tweenValue.AddOnChangedCallback(CameraFovTween);
			_zoomTweenRunner.StartTween(tweenValue);
		}

		private void CameraFovTween(float fov)
		{
			cam.fieldOfView = fov;
		}
	}
}
namespace LethalEmotesApi.Ui.Customize.List
{
	[DisallowMultipleComponent]
	public class EmoteBlacklistToggle : UIBehaviour, IPointerEnterHandler, IEventSystemHandler, IPointerExitHandler, IPointerClickHandler
	{
		public EmoteListItem? emoteListItem;

		public Image? toggleImage;

		private string? _emoteKey;

		private bool InBlacklist => EmoteUiManager.RandomPoolBlacklist.Contains<string>(_emoteKey);

		protected override void Start()
		{
			((UIBehaviour)this).Awake();
			UpdateState();
		}

		protected override void OnEnable()
		{
			((UIBehaviour)this).OnEnable();
			UpdateState();
		}

		public void SetEmoteKey(string emoteKey)
		{
			_emoteKey = emoteKey;
			UpdateState();
		}

		public void Toggle()
		{
			if (!string.IsNullOrEmpty(_emoteKey))
			{
				if (InBlacklist)
				{
					EmoteUiManager.RemoveFromRandomPoolBlacklist(_emoteKey);
				}
				else
				{
					EmoteUiManager.AddToRandomPoolBlacklist(_emoteKey);
				}
				UpdateState();
			}
		}

		private void UpdateState()
		{
			if (!string.IsNullOrEmpty(_emoteKey) && toggleImage != null)
			{
				((Behaviour)toggleImage).enabled = InBlacklist;
			}
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			emoteListItem.OnPointerExit(eventData);
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			emoteListItem.OnPointerEnter(eventData);
		}

		public void OnPointerClick(PointerEventData eventData)
		{
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0008: Invalid comparison between Unknown and I4
			if ((int)eventData.button <= 0)
			{
				Toggle();
			}
		}
	}
	[DisallowMultipleComponent]
	public class EmoteList : UIBehaviour
	{
		public RectTransform? listContentContainer;

		public TMP_InputField? searchInputField;

		public GameObject? entryPrefab;

		private CustomizePanel? _customizePanel;

		private readonly List<GameObject> _listObjects = new List<GameObject>();

		private SearchableEmoteArray? _searchableEmoteArray;

		protected override void Awake()
		{
			((UIBehaviour)this).Awake();
			if (searchInputField != null)
			{
				((UnityEvent<string>)(object)searchInputField.onValueChanged).AddListener((UnityAction<string>)SearchFieldUpdated);
			}
		}

		protected override void Start()
		{
			((UIBehaviour)this).Start();
			_searchableEmoteArray = new SearchableEmoteArray(EmoteUiManager.EmoteKeys.ToArray());
			if (_customizePanel == null)
			{
				_customizePanel = ((Component)this).GetComponentInParent<CustomizePanel>();
			}
			InitList();
		}

		protected override void OnEnable()
		{
			((UIBehaviour)this).OnEnable();
			_searchableEmoteArray = new SearchableEmoteArray(EmoteUiManager.EmoteKeys.ToArray());
			if (_customizePanel == null)
			{
				_customizePanel = ((Component)this).GetComponentInParent<CustomizePanel>();
			}
			InitList();
		}

		protected override void OnDisable()
		{
			((UIBehaviour)this).OnDisable();
			if (searchInputField != null)
			{
				searchInputField.text = "";
				if (_searchableEmoteArray != null)
				{
					_searchableEmoteArray.Filter = "";
				}
			}
		}

		private void InitList()
		{
			if (listContentContainer == null || entryPrefab == null || _listObjects.Count > 0)
			{
				return;
			}
			SearchableEmoteArray searchableEmoteArray = _searchableEmoteArray;
			foreach (string item in searchableEmoteArray)
			{
				GameObject val = Object.Instantiate<GameObject>(entryPrefab, (Transform)(object)listContentContainer);
				EmoteListItem component = val.GetComponent<EmoteListItem>();
				component.dragDropController = _customizePanel.dragDropController;
				component.previewController = _customizePanel.previewController;
				component.SetEmoteKey(item);
				_listObjects.Add(val);
			}
		}

		private void ClearList()
		{
			foreach (GameObject listObject in _listObjects)
			{
				Object.DestroyImmediate((Object)(object)listObject);
			}
			_listObjects.Clear();
		}

		private void SearchFieldUpdated(string filter)
		{
			if (_searchableEmoteArray != null)
			{
				_searchableEmoteArray.Filter = filter;
				ClearList();
				InitList();
			}
		}
	}
	public class EmoteListItem : UIBehaviour, IBeginDragHandler, IEventSystemHandler, IDragHandler, IPointerEnterHandler, IPointerExitHandler
	{
		public TextMeshProUGUI? label;

		public EmoteBlacklistToggle? blacklistToggle;

		public Image? selectImage;

		public TextMeshProUGUI? modLabel;

		public EmoteDragDropController? dragDropController;

		public PreviewController? previewController;

		public string? EmoteKey { get; private set; }

		protected override void Start()
		{
			((UIBehaviour)this).Start();
			UpdateState();
		}

		protected override void OnEnable()
		{
			((UIBehaviour)this).OnEnable();
			UpdateState();
		}

		public void OnBeginDrag(PointerEventData eventData)
		{
			StartDrag(eventData);
		}

		public void OnDrag(PointerEventData eventData)
		{
			StartDrag(eventData);
		}

		private void StartDrag(PointerEventData eventData)
		{
			if (EmoteKey == null)
			{
				EmoteKey = ((TMP_Text)label).text;
			}
			dragDropController.StartDrag(EmoteKey, eventData);
			GameObject val = (eventData.pointerDrag = ((Component)dragDropController).gameObject);
			ExecuteEvents.Execute<IDragHandler>(val, (BaseEventData)(object)eventData, ExecuteEvents.dragHandler);
		}

		public void SetEmoteKey(string emoteKey)
		{
			EmoteKey = emoteKey;
			UpdateState();
		}

		private void UpdateState()
		{
			if (EmoteKey == null || label == null)
			{
				return;
			}
			((TMP_Text)label).SetText(EmoteUiManager.GetEmoteName(EmoteKey), true);
			if (modLabel != null)
			{
				((TMP_Text)modLabel).SetText(EmoteUiManager.GetEmoteModName(EmoteKey), true);
				if (blacklistToggle != null)
				{
					blacklistToggle.SetEmoteKey(EmoteKey);
				}
			}
		}

		public void OnPointerEnter(PointerEventData eventData)
		{
			if (selectImage == null)
			{
				return;
			}
			((Behaviour)selectImage).enabled = true;
			if (EmoteKey != null)
			{
				dragDropController.OnCanGrab();
				if (dragDropController.DragState == EmoteDragDropController.DragDropState.Ready)
				{
					previewController.PlayEmote(EmoteKey);
				}
			}
		}

		public void OnPointerExit(PointerEventData eventData)
		{
			if (selectImage != null)
			{
				((Behaviour)selectImage).enabled = false;
				dragDropController.OnNotGrab();
			}
		}
	}
	public class EmoteListScrollRect : ScrollRect
	{
		public override void OnBeginDrag(PointerEventData eventData)
		{
		}

		public override void OnDrag(PointerEventData eventData)
		{
		}

		public override void OnEndDrag(PointerEventData eventData)
		{
		}
	}
}
namespace LethalEmotesApi.Ui.Customize.DragDrop
{
	public class DragDropItem : UIBehaviour
	{
		public TextMeshProUGUI? label;

		public string? EmoteKey { get; private set; }

		protected override void Start()
		{
			((UIBehaviour)this).Start();
			UpdateState();
		}

		protected override void OnEnable()
		{
			((UIBehaviour)this).OnEnable();
			UpdateState();
		}

		public void SetEmoteKey(string emoteKey)
		{
			EmoteKey = emoteKey;
			UpdateState();
		}

		private void UpdateState()
		{
			if (EmoteKey == null || label == null)
			{
				return;
			}
			try
			{
				((TMP_Text)label).SetText(EmoteUiManager.GetEmoteName(EmoteKey), true);
			}
			catch
			{
				((TMP_Text)label).SetText(EmoteKey, true);
			}
		}
	}
	[DisallowMultipleComponent]
	[RequireComponent(typeof(RectTransform))]
	public class EmoteDragDropController : UIBehaviour, IPointerMoveHandler, IEventSystemHandler, IPointerClickHandler, IDragHandler, IEndDragHandler
	{
		public e

plugins/Steven-Custom_Boombox_Music/CustomBoomboxTracks.dll

Decompiled 11 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.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using CustomBoomboxTracks.Configuration;
using CustomBoomboxTracks.Managers;
using CustomBoomboxTracks.Utilities;
using HarmonyLib;
using UnityEngine;
using UnityEngine.Networking;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("CustomBoomboxTracks")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.4.0.0")]
[assembly: AssemblyInformationalVersion("1.4.0")]
[assembly: AssemblyProduct("CustomBoomboxTracks")]
[assembly: AssemblyTitle("CustomBoomboxTracks")]
[assembly: AssemblyVersion("1.4.0.0")]
namespace CustomBoomboxTracks
{
	[BepInPlugin("com.steven.lethalcompany.boomboxmusic", "Custom Boombox Music", "1.4.0")]
	public class BoomboxPlugin : BaseUnityPlugin
	{
		private const string GUID = "com.steven.lethalcompany.boomboxmusic";

		private const string NAME = "Custom Boombox Music";

		private const string VERSION = "1.4.0";

		private static BoomboxPlugin Instance;

		private void Awake()
		{
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			Instance = this;
			LogInfo("Loading...");
			AudioManager.GenerateFolders();
			Config.Init();
			new Harmony("com.steven.lethalcompany.boomboxmusic").PatchAll();
			LogInfo("Loading Complete!");
		}

		internal static void LogDebug(string message)
		{
			Instance.Log(message, (LogLevel)32);
		}

		internal static void LogInfo(string message)
		{
			Instance.Log(message, (LogLevel)16);
		}

		internal static void LogWarning(string message)
		{
			Instance.Log(message, (LogLevel)4);
		}

		internal static void LogError(string message)
		{
			Instance.Log(message, (LogLevel)2);
		}

		internal static void LogError(Exception ex)
		{
			Instance.Log(ex.Message + "\n" + ex.StackTrace, (LogLevel)2);
		}

		private void Log(string message, LogLevel logLevel)
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			((BaseUnityPlugin)this).Logger.Log(logLevel, (object)message);
		}
	}
}
namespace CustomBoomboxTracks.Utilities
{
	public class SharedCoroutineStarter : MonoBehaviour
	{
		private static SharedCoroutineStarter _instance;

		public static Coroutine StartCoroutine(IEnumerator routine)
		{
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)_instance == (Object)null)
			{
				_instance = new GameObject("Shared Coroutine Starter").AddComponent<SharedCoroutineStarter>();
				Object.DontDestroyOnLoad((Object)(object)_instance);
			}
			return ((MonoBehaviour)_instance).StartCoroutine(routine);
		}
	}
}
namespace CustomBoomboxTracks.Patches
{
	[HarmonyPatch(typeof(BoomboxItem), "PocketItem")]
	internal class BoomboxItem_PocketItem
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			List<CodeInstruction> list = instructions.ToList();
			bool flag = false;
			for (int i = 0; i < list.Count; i++)
			{
				if (!flag)
				{
					if (list[i].opcode == OpCodes.Call)
					{
						flag = true;
					}
					continue;
				}
				if (list[i].opcode == OpCodes.Ret)
				{
					break;
				}
				list[i].opcode = OpCodes.Nop;
			}
			return list;
		}
	}
	[HarmonyPatch(typeof(BoomboxItem), "Start")]
	internal class BoomboxItem_Start
	{
		private static void Postfix(BoomboxItem __instance)
		{
			if (AudioManager.FinishedLoading)
			{
				AudioManager.ApplyClips(__instance);
				return;
			}
			AudioManager.OnAllSongsLoaded += delegate
			{
				AudioManager.ApplyClips(__instance);
			};
		}
	}
	[HarmonyPatch(typeof(BoomboxItem), "StartMusic")]
	internal class BoomboxItem_StartMusic
	{
		private static void Postfix(BoomboxItem __instance, bool startMusic)
		{
			if (startMusic)
			{
				BoomboxPlugin.LogInfo("Playing " + ((Object)__instance.boomboxAudio.clip).name);
			}
		}
	}
	[HarmonyPatch(typeof(StartOfRound), "Awake")]
	internal class StartOfRound_Awake
	{
		private static void Prefix()
		{
			AudioManager.Load();
		}
	}
}
namespace CustomBoomboxTracks.Managers
{
	internal static class AudioManager
	{
		private static string[] allSongPaths;

		private static List<AudioClip> clips = new List<AudioClip>();

		private static bool firstRun = true;

		private static bool finishedLoading = false;

		private static readonly string directory = Path.Combine(Paths.BepInExRootPath, "Custom Songs", "Boombox Music");

		public static bool FinishedLoading => finishedLoading;

		public static bool HasNoSongs => allSongPaths.Length == 0;

		public static event Action OnAllSongsLoaded;

		public static void GenerateFolders()
		{
			Directory.CreateDirectory(directory);
			BoomboxPlugin.LogInfo("Created directory at " + directory);
		}

		public static void Load()
		{
			if (!firstRun)
			{
				return;
			}
			firstRun = false;
			allSongPaths = Directory.GetFiles(directory);
			if (allSongPaths.Length == 0)
			{
				BoomboxPlugin.LogWarning("No songs found!");
				return;
			}
			BoomboxPlugin.LogInfo("Preparing to load AudioClips...");
			List<Coroutine> list = new List<Coroutine>();
			string[] array = allSongPaths;
			for (int i = 0; i < array.Length; i++)
			{
				Coroutine item = SharedCoroutineStarter.StartCoroutine(LoadAudioClip(array[i]));
				list.Add(item);
			}
			SharedCoroutineStarter.StartCoroutine(WaitForAllClips(list));
		}

		private static IEnumerator LoadAudioClip(string filePath)
		{
			BoomboxPlugin.LogInfo("Loading " + filePath + "!");
			if ((int)GetAudioType(filePath) == 0)
			{
				BoomboxPlugin.LogError("Failed to load AudioClip from " + filePath + "\nUnsupported file extension!");
				yield break;
			}
			UnityWebRequest loader = UnityWebRequestMultimedia.GetAudioClip(filePath, GetAudioType(filePath));
			if (Config.StreamFromDisk)
			{
				DownloadHandler downloadHandler = loader.downloadHandler;
				((DownloadHandlerAudioClip)((downloadHandler is DownloadHandlerAudioClip) ? downloadHandler : null)).streamAudio = true;
			}
			loader.SendWebRequest();
			while (!loader.isDone)
			{
				yield return null;
			}
			if (loader.error != null)
			{
				BoomboxPlugin.LogError("Error loading clip from path: " + filePath + "\n" + loader.error);
				BoomboxPlugin.LogError(loader.error);
				yield break;
			}
			AudioClip content = DownloadHandlerAudioClip.GetContent(loader);
			if (Object.op_Implicit((Object)(object)content) && (int)content.loadState == 2)
			{
				BoomboxPlugin.LogInfo("Loaded " + filePath);
				((Object)content).name = Path.GetFileName(filePath);
				clips.Add(content);
			}
			else
			{
				BoomboxPlugin.LogError("Failed to load clip at: " + filePath + "\nThis might be due to an mismatch between the audio codec and the file extension!");
			}
		}

		private static IEnumerator WaitForAllClips(List<Coroutine> coroutines)
		{
			foreach (Coroutine coroutine in coroutines)
			{
				yield return coroutine;
			}
			clips.Sort((AudioClip first, AudioClip second) => ((Object)first).name.CompareTo(((Object)second).name));
			finishedLoading = true;
			AudioManager.OnAllSongsLoaded?.Invoke();
			AudioManager.OnAllSongsLoaded = null;
		}

		public static void ApplyClips(BoomboxItem __instance)
		{
			BoomboxPlugin.LogInfo("Applying clips!");
			if (Config.UseDefaultSongs)
			{
				__instance.musicAudios = __instance.musicAudios.Concat(clips).ToArray();
			}
			else
			{
				__instance.musicAudios = clips.ToArray();
			}
			BoomboxPlugin.LogInfo($"Total Clip Count: {__instance.musicAudios.Length}");
		}

		private static AudioType GetAudioType(string path)
		{
			string text = Path.GetExtension(path).ToLower();
			switch (text)
			{
			case ".wav":
				return (AudioType)20;
			case ".ogg":
				return (AudioType)14;
			case ".mp3":
				return (AudioType)13;
			default:
				BoomboxPlugin.LogError("Unsupported extension type: " + text);
				return (AudioType)0;
			}
		}
	}
}
namespace CustomBoomboxTracks.Configuration
{
	internal static class Config
	{
		private const string CONFIG_FILE_NAME = "boombox.cfg";

		private static ConfigFile _config;

		private static ConfigEntry<bool> _useDefaultSongs;

		private static ConfigEntry<bool> _streamAudioFromDisk;

		public static bool UseDefaultSongs
		{
			get
			{
				if (!_useDefaultSongs.Value)
				{
					return AudioManager.HasNoSongs;
				}
				return true;
			}
		}

		public static bool StreamFromDisk => _streamAudioFromDisk.Value;

		public static void Init()
		{
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			BoomboxPlugin.LogInfo("Initializing config...");
			_config = new ConfigFile(Path.Combine(Paths.ConfigPath, "boombox.cfg"), true);
			_useDefaultSongs = _config.Bind<bool>("Config", "Use Default Songs", false, "Include the default songs in the rotation.");
			_streamAudioFromDisk = _config.Bind<bool>("Config", "Stream Audio From Disk", false, "Requires less memory and takes less time to load, but prevents playing the same song twice at once.");
			BoomboxPlugin.LogInfo("Config initialized!");
		}

		private static void PrintConfig()
		{
			BoomboxPlugin.LogInfo($"Use Default Songs: {_useDefaultSongs.Value}");
			BoomboxPlugin.LogInfo($"Stream From Disk: {_streamAudioFromDisk}");
		}
	}
}