Decompiled source of MegaEmotes BadAssCompany v1.0.1

BepInEx/plugins/MegaEmotes_BadAssCompany/MegaEmotes_BadAssCompany.dll

Decompiled 2 hours ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using System.Text;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using MegaTooManyEmotes.Shared;
using Microsoft.CodeAnalysis;
using TMPro;
using TooManyEmotes;
using TooManyEmotes.Audio;
using TooManyEmotes.UI;
using UnityEngine;
using UnityEngine.Networking;
using UnityEngine.UI;

[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("exeryze")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyDescription("Adds BadAssCompany's anime, meme, and Fortnite dances natively to TooManyEmotes with audio, a dedicated BadAss wheel tab, and no LethalEmotesAPI.")]
[assembly: AssemblyFileVersion("1.0.1.0")]
[assembly: AssemblyInformationalVersion("1.0.1")]
[assembly: AssemblyProduct("MegaEmotes_BadAssCompany")]
[assembly: AssemblyTitle("MegaEmotes_BadAssCompany")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

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

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

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
	[CompilerGenerated]
	[Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace MegaTooManyEmotes.Shared
{
	internal static class MegaEmoteConfig
	{
		internal static ConfigEntry<bool> UnlockAllByDefault { get; private set; }

		internal static ConfigEntry<bool> PlayAudioWithoutBoombox { get; private set; }

		internal static ConfigEntry<bool> IncludeBaseTooManyEmotesOverlaps { get; private set; }

		internal static ConfigEntry<bool> EnableTraversalEmotes { get; private set; }

		internal static ConfigEntry<bool> AddCustomCategoryTab { get; private set; }

		internal static void Bind(ConfigFile config)
		{
			UnlockAllByDefault = config.Bind<bool>("General", "UnlockAllByDefault", true, "When true, all dances in this pack are placed in TooManyEmotes' Complementary category and unlocked immediately by default.");
			PlayAudioWithoutBoombox = config.Bind<bool>("Audio", "PlayAudioWithoutBoombox", true, "When true, dances in this pack play their audio directly without requiring a Boombox.");
			IncludeBaseTooManyEmotesOverlaps = config.Bind<bool>("Emotes", "IncludeBaseTooManyEmotesOverlaps", true, "When true, includes dances that overlap with base TooManyEmotes or ValikTooManyEmotes (labeled with their source pack name).");
			EnableTraversalEmotes = config.Bind<bool>("Emotes", "EnableTraversalEmotes", true, "When true, allows moving while performing traversal/walking emotes in this pack.");
			AddCustomCategoryTab = config.Bind<bool>("UI", "AddCustomCategoryTab", true, "When true, adds a dedicated category tab for this pack to TooManyEmotes' emote wheel.");
		}
	}
	internal static class MegaEmoteLoader
	{
		private readonly record struct RegisteredEmoteMeta(string Key, string DisplayName, bool CanMove, string EmoteKey, string? PrimaryAudioKey, string? LoopAudioKey);

		private static readonly Dictionary<string, AssetBundle> LoadedBundles = new Dictionary<string, AssetBundle>(StringComparer.OrdinalIgnoreCase);

		private static readonly Dictionary<string, Dictionary<string, string>> BundleLookups = new Dictionary<string, Dictionary<string, string>>(StringComparer.OrdinalIgnoreCase);

		private static readonly Dictionary<string, AudioClip> AudioByKey = new Dictionary<string, AudioClip>(StringComparer.Ordinal);

		private static readonly HashSet<string> PendingAudioKeys = new HashSet<string>(StringComparer.Ordinal);

		private static readonly List<RegisteredEmoteMeta> RegisteredEmotes = new List<RegisteredEmoteMeta>();

		private static readonly List<UnlockableEmote> PackTabEmotes = new List<UnlockableEmote>();

		private static FieldInfo? _loadedAudioClipsField;

		private static FieldInfo? _loadedAudioClipsDmcaFreeField;

		private static FieldInfo? _audioClipsDictDmcaField;

		private static FieldInfo? _audioClipsDictDmcaFreeField;

		private static FieldInfo? _complementaryEmotesDefaultField;

		private static bool _initialized;

		private static bool _isApplyingMetadata;

		private static string _tabDisplayName = string.Empty;

		private static ManualLogSource? _log;

		internal static void Initialize(string pluginDirectory, string tabDisplayName, IEnumerable<string> bundleFiles, IEnumerable<MegaEmoteDef> catalog, IEnumerable<VmdEmoteDef> vmdCatalog, MonoBehaviour coroutineHost, ManualLogSource log)
		{
			if (_initialized)
			{
				return;
			}
			_initialized = true;
			_tabDisplayName = tabDisplayName;
			_log = log;
			VmdEmotePlayer.SetLogger(log);
			ResolveReflectionFields();
			string path = Path.Combine(pluginDirectory, "assetbundles");
			foreach (string bundleFile in bundleFiles)
			{
				string text = Path.Combine(path, bundleFile);
				if (!File.Exists(text))
				{
					_log.LogError((object)("Missing AssetBundle '" + text + "'."));
					continue;
				}
				AssetBundle val = AssetBundle.LoadFromFile(text);
				if ((Object)(object)val == (Object)null)
				{
					_log.LogError((object)("Failed to load AssetBundle '" + text + "'."));
					continue;
				}
				LoadedBundles[bundleFile] = val;
				BundleLookups[bundleFile] = BuildBundleAssetLookup(val);
			}
			ICollection<VmdEmoteDef> collection = (vmdCatalog as ICollection<VmdEmoteDef>) ?? vmdCatalog.ToList();
			if (LoadedBundles.Count == 0 && collection.Count == 0)
			{
				_log.LogError((object)"No AssetBundles or VMD emotes could be loaded. Aborting emote registration.");
				return;
			}
			bool value = MegaEmoteConfig.UnlockAllByDefault.Value;
			bool value2 = MegaEmoteConfig.IncludeBaseTooManyEmotesOverlaps.Value;
			int num = 0;
			foreach (MegaEmoteDef item in catalog.OrderBy<MegaEmoteDef, string>((MegaEmoteDef d) => d.DisplayName, StringComparer.OrdinalIgnoreCase))
			{
				if ((!item.IsBaseOverlap || value2) && TryRegisterEmote(item, value))
				{
					num++;
				}
			}
			string vmdDir = Path.Combine(pluginDirectory, "vmd");
			foreach (VmdEmoteDef item2 in collection.OrderBy<VmdEmoteDef, string>((VmdEmoteDef d) => d.DisplayName, StringComparer.OrdinalIgnoreCase))
			{
				if ((!item2.IsBaseOverlap || value2) && TryRegisterVmdEmote(item2, vmdDir, value, coroutineHost))
				{
					num++;
				}
			}
			RegisterAllAudioInManager();
			_log.LogInfo((object)$"Registered {num} emotes across {LoadedBundles.Count} bundles and {collection.Count} VMD clips. Rebuilding TooManyEmotes list...");
			EmotesManager.BuildEmotesList();
			ApplyMetadataToEmotes();
			AdditionalEmoteData.SetAdditionalEmoteData();
			AdditionalEmoteData.SetAdditionalPropData();
			AdditionalEmoteData.SetAdditionalMusicData();
			_log.LogInfo((object)$"Initialization complete with {RegisteredEmotes.Count} active emotes.");
		}

		internal static void ApplyMetadataToEmotes()
		{
			if (_isApplyingMetadata || RegisteredEmotes.Count == 0)
			{
				return;
			}
			_isApplyingMetadata = true;
			try
			{
				bool value = MegaEmoteConfig.EnableTraversalEmotes.Value;
				bool value2 = MegaEmoteConfig.PlayAudioWithoutBoombox.Value;
				bool value3 = MegaEmoteConfig.UnlockAllByDefault.Value;
				List<UnlockableEmote> list = _complementaryEmotesDefaultField?.GetValue(null) as List<UnlockableEmote>;
				foreach (RegisteredEmoteMeta registeredEmote in RegisteredEmotes)
				{
					if (!EmotesManager.allUnlockableEmotesDict.TryGetValue(registeredEmote.EmoteKey, out var value4) || value4 == null)
					{
						continue;
					}
					value4.displayName = registeredEmote.DisplayName;
					value4.complementary = value3;
					value4.overrideAudioClipName = registeredEmote.PrimaryAudioKey ?? string.Empty;
					value4.overrideAudioLoopClipName = registeredEmote.LoopAudioKey ?? string.Empty;
					if (value3)
					{
						if (list != null && !list.Contains(value4))
						{
							list.Add(value4);
						}
						if (EmotesManager.complementaryEmotes != null && !EmotesManager.complementaryEmotes.Contains(value4))
						{
							EmotesManager.complementaryEmotes.Add(value4);
						}
						EmotesManager.allEmotesTier0?.Remove(value4);
						EmotesManager.allEmotesTier1?.Remove(value4);
						EmotesManager.allEmotesTier2?.Remove(value4);
						EmotesManager.allEmotesTier3?.Remove(value4);
					}
					if (registeredEmote.CanMove && value)
					{
						value4.canMoveWhileEmoting = true;
						AdditionalEmoteData.SetCanMoveWhileEmoting(registeredEmote.EmoteKey);
					}
					if (value2 && registeredEmote.PrimaryAudioKey != null)
					{
						value4.isBoomboxAudio = false;
						AdditionalEmoteData.SetEmoteDoesNotUseBoombox(registeredEmote.EmoteKey);
					}
				}
				RefreshPackTabEmotes();
			}
			catch (Exception arg)
			{
				ManualLogSource? log = _log;
				if (log != null)
				{
					log.LogError((object)$"Error applying emote metadata: {arg}");
				}
			}
			finally
			{
				_isApplyingMetadata = false;
			}
		}

		internal static void RefreshPackTabEmotes()
		{
			PackTabEmotes.Clear();
			if (EmotesManager.allUnlockableEmotesDict == null || RegisteredEmotes.Count == 0)
			{
				return;
			}
			bool value = MegaEmoteConfig.UnlockAllByDefault.Value;
			foreach (RegisteredEmoteMeta registeredEmote in RegisteredEmotes)
			{
				if (EmotesManager.allUnlockableEmotesDict.TryGetValue(registeredEmote.EmoteKey, out var value2) && value2 != null && (value || SessionManager.IsEmoteUnlocked(value2, "")))
				{
					PackTabEmotes.Add(value2);
				}
			}
			PackTabEmotes.Sort((UnlockableEmote a, UnlockableEmote b) => string.Compare(a.displayName, b.displayName, StringComparison.OrdinalIgnoreCase));
		}

		internal static void EnsureCustomLoadoutTabRegistered()
		{
			try
			{
				if (!MegaEmoteConfig.AddCustomCategoryTab.Value || string.IsNullOrEmpty(_tabDisplayName) || PackTabEmotes.Count == 0 || (Object)(object)EmoteMenu.menuGameObject == (Object)null || EmoteMenu.emoteLoadoutUIElementsList == null || EmoteMenu.emoteLoadoutUIElementsList.Count == 0 || EmoteMenu.emoteLoadouts == null)
				{
					return;
				}
				if (EmoteMenu.emoteLoadoutUIElementsList.Count != EmoteMenu.emoteLoadouts.Count)
				{
					ManualLogSource? log = _log;
					if (log != null)
					{
						log.LogWarning((object)$"Skipping custom tab '{_tabDisplayName}': EmoteMenu UI count ({EmoteMenu.emoteLoadoutUIElementsList.Count}) != loadout list count ({EmoteMenu.emoteLoadouts.Count}).");
					}
					return;
				}
				for (int i = 0; i < EmoteMenu.emoteLoadoutUIElementsList.Count; i++)
				{
					EmoteLoadoutUIElement val = EmoteMenu.emoteLoadoutUIElementsList[i];
					if ((Object)(object)val != (Object)null && string.Equals(val.loadoutName, _tabDisplayName, StringComparison.Ordinal))
					{
						return;
					}
				}
				EmoteLoadoutUIElement val2 = EmoteMenu.emoteLoadoutUIElementsList[0];
				if ((Object)(object)val2 == (Object)null || (Object)(object)((Component)val2).transform.parent == (Object)null)
				{
					return;
				}
				Transform parent = ((Component)val2).transform.parent;
				int count = EmoteMenu.emoteLoadoutUIElementsList.Count;
				bool activeSelf = EmoteMenu.menuGameObject.activeSelf;
				EmoteLoadoutUIElement val3 = null;
				try
				{
					if (!activeSelf)
					{
						EmoteMenu.menuGameObject.SetActive(true);
					}
					EmoteLoadoutUIElement.uiCount = count;
					val3 = Object.Instantiate<EmoteLoadoutUIElement>(val2, parent);
				}
				finally
				{
					if (!activeSelf && (Object)(object)EmoteMenu.menuGameObject != (Object)null)
					{
						EmoteMenu.menuGameObject.SetActive(false);
					}
				}
				if (!((Object)(object)val3 == (Object)null))
				{
					val3.id = count;
					((Object)val3).name = $"EmoteLoadout_{count}";
					val3.loadoutName = _tabDisplayName;
					EmoteLoadoutUIElement val4 = val3;
					if (val4.backgroundImage == null)
					{
						val4.backgroundImage = ((Component)val3).GetComponentInChildren<Image>(true);
					}
					val4 = val3;
					if (val4.textContainer == null)
					{
						val4.textContainer = ((Component)val3).GetComponentInChildren<TextMeshPro>(true);
					}
					if ((Object)(object)val3.textContainer != (Object)null)
					{
						((TMP_Text)val3.textContainer).text = _tabDisplayName;
					}
					EmoteLoadoutUIElement.uiCount = count + 1;
					EmoteMenu.emoteLoadoutUIElementsList.Add(val3);
					EmoteMenu.emoteLoadouts.Add(PackTabEmotes);
					if ((Object)(object)val3.backgroundImage != (Object)null)
					{
						val3.OnHover(false);
					}
					AdjustLoadoutListLayout(parent);
				}
			}
			catch (Exception arg)
			{
				ManualLogSource? log2 = _log;
				if (log2 != null)
				{
					log2.LogError((object)$"Error registering custom emote wheel tab '{_tabDisplayName}': {arg}");
				}
			}
		}

		private static void AdjustLoadoutListLayout(Transform loadoutsParent)
		{
			//IL_02fd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0319: Unknown result type (might be due to invalid IL or missing references)
			//IL_0121: 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_0139: Unknown result type (might be due to invalid IL or missing references)
			//IL_027b: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c8: Unknown result type (might be due to invalid IL or missing references)
			int count = EmoteMenu.emoteLoadoutUIElementsList.Count;
			if (count <= 7)
			{
				return;
			}
			float num = Mathf.Clamp(7.5f / (float)count, 0.58f, 1f);
			Transform val = (((Object)(object)Plugin.radialMenuPrefab != (Object)null) ? Plugin.radialMenuPrefab.transform.Find("MenuUI/EmoteLoadouts") : null);
			VerticalLayoutGroup component = ((Component)loadoutsParent).GetComponent<VerticalLayoutGroup>();
			VerticalLayoutGroup val2 = (((Object)(object)val != (Object)null) ? ((Component)val).GetComponent<VerticalLayoutGroup>() : null);
			if ((Object)(object)component != (Object)null && (Object)(object)val2 != (Object)null)
			{
				((HorizontalOrVerticalLayoutGroup)component).spacing = ((HorizontalOrVerticalLayoutGroup)val2).spacing * num;
			}
			RectTransform val3 = (((Object)(object)val != (Object)null && val.childCount > 0) ? ((Component)val.GetChild(0)).GetComponent<RectTransform>() : null);
			LayoutElement val4 = (((Object)(object)val3 != (Object)null) ? ((Component)val3).GetComponent<LayoutElement>() : null);
			TextMeshPro val5 = (((Object)(object)val3 != (Object)null) ? ((Component)val3).GetComponentInChildren<TextMeshPro>(true) : null);
			for (int i = 0; i < EmoteMenu.emoteLoadoutUIElementsList.Count; i++)
			{
				EmoteLoadoutUIElement val6 = EmoteMenu.emoteLoadoutUIElementsList[i];
				if ((Object)(object)val6 == (Object)null)
				{
					continue;
				}
				RectTransform component2 = ((Component)val6).GetComponent<RectTransform>();
				if ((Object)(object)component2 != (Object)null && (Object)(object)val3 != (Object)null)
				{
					component2.sizeDelta = new Vector2(val3.sizeDelta.x, val3.sizeDelta.y * num);
					LayoutElement component3 = ((Component)val6).GetComponent<LayoutElement>();
					if ((Object)(object)component3 != (Object)null && (Object)(object)val4 != (Object)null)
					{
						if (val4.preferredHeight > 0f)
						{
							component3.preferredHeight = val4.preferredHeight * num;
						}
						if (val4.minHeight > 0f)
						{
							component3.minHeight = val4.minHeight * num;
						}
					}
				}
				TextMeshPro textContainer = val6.textContainer;
				if ((Object)(object)textContainer != (Object)null)
				{
					float num2 = (((Object)(object)val5 != (Object)null && ((TMP_Text)val5).enableAutoSizing && ((TMP_Text)val5).fontSizeMax > 0f) ? ((TMP_Text)val5).fontSizeMax : ((!((Object)(object)val5 != (Object)null) || !(((TMP_Text)val5).fontSize > 0f)) ? ((((TMP_Text)textContainer).fontSize > 0f) ? ((TMP_Text)textContainer).fontSize : 16f) : ((TMP_Text)val5).fontSize));
					((TMP_Text)textContainer).enableWordWrapping = false;
					((TMP_Text)textContainer).overflowMode = (TextOverflowModes)1;
					((TMP_Text)textContainer).enableAutoSizing = true;
					((TMP_Text)textContainer).fontSizeMin = Mathf.Max(4f, num2 * 0.45f);
					((TMP_Text)textContainer).fontSizeMax = num2 * Mathf.Lerp(1f, num, 0.65f);
					if ((Object)(object)val5 != (Object)null && Mathf.Approximately(((TMP_Text)val5).rectTransform.anchorMin.y, ((TMP_Text)val5).rectTransform.anchorMax.y))
					{
						((TMP_Text)textContainer).rectTransform.sizeDelta = new Vector2(((TMP_Text)val5).rectTransform.sizeDelta.x, ((TMP_Text)val5).rectTransform.sizeDelta.y * num);
					}
				}
			}
			if ((Object)(object)component == (Object)null && (Object)(object)val != (Object)null)
			{
				loadoutsParent.localScale = val.localScale * Mathf.Clamp(7.5f / (float)count, 0.72f, 1f);
			}
			RectTransform val7 = (RectTransform)(object)((loadoutsParent is RectTransform) ? loadoutsParent : null);
			if (val7 != null)
			{
				LayoutRebuilder.ForceRebuildLayoutImmediate(val7);
			}
		}

		internal static void RegisterAllAudioInManager()
		{
			if (AudioByKey.Count == 0)
			{
				return;
			}
			HashSet<AudioClip> hashSet = _loadedAudioClipsField?.GetValue(null) as HashSet<AudioClip>;
			HashSet<AudioClip> hashSet2 = _loadedAudioClipsDmcaFreeField?.GetValue(null) as HashSet<AudioClip>;
			Dictionary<string, AudioClip> dictionary = _audioClipsDictDmcaField?.GetValue(null) as Dictionary<string, AudioClip>;
			Dictionary<string, AudioClip> dictionary2 = _audioClipsDictDmcaFreeField?.GetValue(null) as Dictionary<string, AudioClip>;
			foreach (var (key, val2) in AudioByKey)
			{
				if (!((Object)(object)val2 == (Object)null))
				{
					hashSet?.Add(val2);
					hashSet2?.Add(val2);
					if (dictionary != null)
					{
						dictionary[key] = val2;
					}
					if (dictionary2 != null)
					{
						dictionary2[key] = val2;
					}
				}
			}
		}

		internal static bool TryGetAudioClip(string? clipName, out AudioClip? clip)
		{
			if (!string.IsNullOrEmpty(clipName) && AudioByKey.TryGetValue(clipName, out AudioClip value) && (Object)(object)value != (Object)null)
			{
				clip = value;
				return true;
			}
			clip = null;
			return false;
		}

		internal static bool HasAudioClip(string? clipName)
		{
			if (!string.IsNullOrEmpty(clipName))
			{
				if (!AudioByKey.ContainsKey(clipName))
				{
					return PendingAudioKeys.Contains(clipName);
				}
				return true;
			}
			return false;
		}

		private static bool TryRegisterEmote(MegaEmoteDef def, bool unlockByDefault)
		{
			//IL_0252: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
			if (!LoadedBundles.TryGetValue(def.AnimBundle, out AssetBundle value) || !BundleLookups.TryGetValue(def.AnimBundle, out Dictionary<string, string> value2))
			{
				ManualLogSource? log = _log;
				if (log != null)
				{
					log.LogWarning((object)("Animation bundle '" + def.AnimBundle + "' not loaded for '" + def.DisplayName + "'."));
				}
				return false;
			}
			AnimationClip val = LoadAssetCaseInsensitive<AnimationClip>(value, value2, def.PrimaryAnimPath);
			if ((Object)(object)val == (Object)null)
			{
				ManualLogSource? log2 = _log;
				if (log2 != null)
				{
					log2.LogWarning((object)("Could not load primary animation '" + def.PrimaryAnimPath + "' from '" + def.AnimBundle + "' for '" + def.DisplayName + "'."));
				}
				return false;
			}
			bool flag = def.LoopAnimPath != null || def.LoopAudioPath != null;
			AnimationClip val2 = null;
			if (def.LoopAnimPath != null)
			{
				val2 = LoadAssetCaseInsensitive<AnimationClip>(value, value2, def.LoopAnimPath);
				if ((Object)(object)val2 == (Object)null)
				{
					ManualLogSource? log3 = _log;
					if (log3 != null)
					{
						log3.LogWarning((object)("Could not load loop animation '" + def.LoopAnimPath + "' from '" + def.AnimBundle + "' for '" + def.DisplayName + "'. Falling back to clone."));
					}
					val2 = Object.Instantiate<AnimationClip>(val);
				}
			}
			else if (def.LoopAudioPath != null)
			{
				val2 = Object.Instantiate<AnimationClip>(val);
			}
			AudioClip val3 = null;
			AudioClip val4 = null;
			if (def.PrimaryAudioPath != null)
			{
				if (LoadedBundles.TryGetValue(def.AudioBundle, out AssetBundle value3) && BundleLookups.TryGetValue(def.AudioBundle, out Dictionary<string, string> value4))
				{
					val3 = LoadAssetCaseInsensitive<AudioClip>(value3, value4, def.PrimaryAudioPath);
					if ((Object)(object)val3 == (Object)null)
					{
						ManualLogSource? log4 = _log;
						if (log4 != null)
						{
							log4.LogWarning((object)("Could not load primary audio '" + def.PrimaryAudioPath + "' from '" + def.AudioBundle + "' for '" + def.DisplayName + "'."));
						}
					}
					else if ((int)val3.loadState == 0)
					{
						val3.LoadAudioData();
					}
					if (def.LoopAudioPath != null)
					{
						val4 = LoadAssetCaseInsensitive<AudioClip>(value3, value4, def.LoopAudioPath);
						if ((Object)(object)val4 == (Object)null)
						{
							ManualLogSource? log5 = _log;
							if (log5 != null)
							{
								log5.LogWarning((object)("Could not load loop audio '" + def.LoopAudioPath + "' from '" + def.AudioBundle + "' for '" + def.DisplayName + "'."));
							}
						}
						else if ((int)val4.loadState == 0)
						{
							val4.LoadAudioData();
						}
					}
				}
				else
				{
					ManualLogSource? log6 = _log;
					if (log6 != null)
					{
						log6.LogWarning((object)("Audio bundle '" + def.AudioBundle + "' not loaded for '" + def.DisplayName + "'."));
					}
				}
			}
			string key = def.Key;
			string text = (((Object)val).name = (flag ? (key + "_start") : key));
			if (Plugin.customAnimationClips == null)
			{
				Plugin.customAnimationClips = new List<AnimationClip>();
			}
			if (Plugin.customAnimationClipsHash == null)
			{
				Plugin.customAnimationClipsHash = new HashSet<AnimationClip>();
			}
			if (Plugin.customAnimationClipsLoopDict == null)
			{
				Plugin.customAnimationClipsLoopDict = new Dictionary<string, AnimationClip>();
			}
			if (Plugin.complementaryAnimationClips == null)
			{
				Plugin.complementaryAnimationClips = new List<AnimationClip>();
			}
			if (!Plugin.customAnimationClipsHash.Contains(val))
			{
				Plugin.customAnimationClips.Add(val);
				Plugin.customAnimationClipsHash.Add(val);
			}
			if (unlockByDefault && !Plugin.complementaryAnimationClips.Contains(val))
			{
				Plugin.complementaryAnimationClips.Add(val);
			}
			if (flag && (Object)(object)val2 != (Object)null)
			{
				string key2 = (((Object)val2).name = key + "_loop");
				Plugin.customAnimationClipsLoopDict[key2] = val2;
			}
			string text4 = null;
			if ((Object)(object)val3 != (Object)null)
			{
				text4 = (((Object)val3).name = text);
				AudioByKey[text4] = val3;
			}
			string text6 = null;
			if ((Object)(object)val4 != (Object)null)
			{
				text6 = (((Object)val4).name = key + "_loop");
				AudioByKey[text6] = val4;
			}
			RegisteredEmotes.Add(new RegisteredEmoteMeta(def.Key, def.DisplayName, def.CanMove, key, text4, text6));
			return true;
		}

		private static AnimationClip? FindLoopingHumanoidTemplateClip()
		{
			return Search(Plugin.customAnimationClips, requireHumanoid: true, requireLooping: true) ?? Search(Plugin.complementaryAnimationClips, requireHumanoid: true, requireLooping: true) ?? Search(Plugin.customAnimationClips, requireHumanoid: true, requireLooping: false) ?? Search(Plugin.complementaryAnimationClips, requireHumanoid: true, requireLooping: false) ?? Search(Plugin.customAnimationClips, requireHumanoid: false, requireLooping: false) ?? Search(Plugin.complementaryAnimationClips, requireHumanoid: false, requireLooping: false);
			static AnimationClip? Search(IEnumerable<AnimationClip>? source, bool requireHumanoid, bool requireLooping)
			{
				if (source == null)
				{
					return null;
				}
				foreach (AnimationClip item in source)
				{
					if (!((Object)(object)item == (Object)null) && !(item.length <= 0.5f) && (!requireHumanoid || ((Motion)item).isHumanMotion) && (!requireLooping || ((Motion)item).isLooping))
					{
						return item;
					}
				}
				return null;
			}
		}

		private static bool TryRegisterVmdEmote(VmdEmoteDef def, string vmdDir, bool unlockByDefault, MonoBehaviour coroutineHost)
		{
			string text = Path.Combine(vmdDir, def.MotionFile);
			if (!File.Exists(text))
			{
				ManualLogSource? log = _log;
				if (log != null)
				{
					log.LogWarning((object)("Missing VMD motion file '" + text + "' for '" + def.DisplayName + "'."));
				}
				return false;
			}
			VmdClipData vmdClipData = VmdEmotePlayer.LoadVmdBinary(text);
			if (vmdClipData == null)
			{
				return false;
			}
			AnimationClip val = FindLoopingHumanoidTemplateClip();
			if ((Object)(object)val == (Object)null)
			{
				ManualLogSource? log2 = _log;
				if (log2 != null)
				{
					log2.LogError((object)("No template AnimationClip available for VMD emote '" + def.DisplayName + "'."));
				}
				return false;
			}
			string key = def.Key;
			AnimationClip val2 = Object.Instantiate<AnimationClip>(val);
			((Object)val2).name = key;
			if (Plugin.customAnimationClips == null)
			{
				Plugin.customAnimationClips = new List<AnimationClip>();
			}
			if (Plugin.customAnimationClipsHash == null)
			{
				Plugin.customAnimationClipsHash = new HashSet<AnimationClip>();
			}
			if (Plugin.complementaryAnimationClips == null)
			{
				Plugin.complementaryAnimationClips = new List<AnimationClip>();
			}
			if (!Plugin.customAnimationClipsHash.Contains(val2))
			{
				Plugin.customAnimationClips.Add(val2);
				Plugin.customAnimationClipsHash.Add(val2);
			}
			if (unlockByDefault && !Plugin.complementaryAnimationClips.Contains(val2))
			{
				Plugin.complementaryAnimationClips.Add(val2);
			}
			VmdEmotePlayer.RegisterClip(key, vmdClipData);
			string text2 = null;
			if (!string.IsNullOrEmpty(def.AudioFile))
			{
				string text3 = Path.Combine(vmdDir, def.AudioFile);
				if (File.Exists(text3))
				{
					text2 = key;
					PendingAudioKeys.Add(text2);
					coroutineHost.StartCoroutine(LoadOggAudioCoroutine(text3, text2));
				}
				else
				{
					ManualLogSource? log3 = _log;
					if (log3 != null)
					{
						log3.LogWarning((object)("Missing VMD audio file '" + text3 + "' for '" + def.DisplayName + "'."));
					}
				}
			}
			RegisteredEmotes.Add(new RegisteredEmoteMeta(def.Key, def.DisplayName, def.CanMove, key, text2, null));
			return true;
		}

		private static IEnumerator LoadOggAudioCoroutine(string oggPath, string audioKey)
		{
			UnityWebRequest request = UnityWebRequestMultimedia.GetAudioClip(new Uri(oggPath).AbsoluteUri, (AudioType)14);
			try
			{
				DownloadHandler downloadHandler = request.downloadHandler;
				DownloadHandlerAudioClip val = (DownloadHandlerAudioClip)(object)((downloadHandler is DownloadHandlerAudioClip) ? downloadHandler : null);
				if (val != null)
				{
					val.streamAudio = false;
				}
				yield return request.SendWebRequest();
				PendingAudioKeys.Remove(audioKey);
				if ((int)request.result != 1)
				{
					ManualLogSource? log = _log;
					if (log != null)
					{
						log.LogError((object)("Failed to load OGG audio '" + oggPath + "' for '" + audioKey + "': " + request.error));
					}
					yield break;
				}
				AudioClip content = DownloadHandlerAudioClip.GetContent(request);
				if ((Object)(object)content == (Object)null)
				{
					ManualLogSource? log2 = _log;
					if (log2 != null)
					{
						log2.LogError((object)("Decoded AudioClip was null for '" + oggPath + "'."));
					}
					yield break;
				}
				if ((int)content.loadState == 0)
				{
					content.LoadAudioData();
				}
				((Object)content).name = audioKey;
				AudioByKey[audioKey] = content;
				RegisterAllAudioInManager();
				ManualLogSource? log3 = _log;
				if (log3 != null)
				{
					log3.LogInfo((object)$"Loaded OGG audio '{audioKey}' ({content.length:F2}s).");
				}
			}
			finally
			{
				((IDisposable)request)?.Dispose();
			}
		}

		private static Dictionary<string, string> BuildBundleAssetLookup(AssetBundle bundle)
		{
			Dictionary<string, string> dictionary = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
			string[] allAssetNames = bundle.GetAllAssetNames();
			foreach (string text in allAssetNames)
			{
				dictionary[text] = text;
			}
			return dictionary;
		}

		private static T? LoadAssetCaseInsensitive<T>(AssetBundle bundle, Dictionary<string, string> lookup, string requestedPath) where T : Object
		{
			string value;
			string text = (lookup.TryGetValue(requestedPath, out value) ? value : requestedPath);
			return bundle.LoadAsset<T>(text);
		}

		private static void ResolveReflectionFields()
		{
			Type? typeFromHandle = typeof(AudioManager);
			_loadedAudioClipsField = AccessTools.Field(typeFromHandle, "loadedAudioClips");
			_loadedAudioClipsDmcaFreeField = AccessTools.Field(typeFromHandle, "loadedAudioClipsDmcaFree");
			_audioClipsDictDmcaField = AccessTools.Field(typeFromHandle, "audioClipsDictDmca");
			_audioClipsDictDmcaFreeField = AccessTools.Field(typeFromHandle, "audioClipsDictDmcaFree");
			_complementaryEmotesDefaultField = AccessTools.Field(typeof(EmotesManager), "complementaryEmotesDefault");
		}
	}
	[HarmonyPatch]
	internal static class MegaEmotePatches
	{
		[HarmonyPatch(typeof(EmotesManager), "BuildEmotesList")]
		[HarmonyPostfix]
		private static void AfterBuildEmotesList()
		{
			MegaEmoteLoader.ApplyMetadataToEmotes();
		}

		[HarmonyPatch(typeof(AudioManager), "ClearAudioClipCache")]
		[HarmonyPostfix]
		private static void AfterClearAudioClipCache()
		{
			MegaEmoteLoader.RegisterAllAudioInManager();
		}

		[HarmonyPatch(typeof(AudioManager), "LoadAudioClip")]
		[HarmonyPrefix]
		private static bool PrefixLoadAudioClip(string clipName, ref AudioClip? __result)
		{
			if (!MegaEmoteLoader.TryGetAudioClip(clipName, out AudioClip clip) || (Object)(object)clip == (Object)null)
			{
				return true;
			}
			__result = clip;
			return false;
		}

		[HarmonyPatch(typeof(AudioManager), "AudioExists")]
		[HarmonyPrefix]
		private static bool PrefixAudioExists(string audioName, ref bool __result)
		{
			if (!MegaEmoteLoader.HasAudioClip(audioName))
			{
				return true;
			}
			__result = true;
			return false;
		}

		[HarmonyPatch(typeof(EmoteMenu), "InitializeUI")]
		[HarmonyPostfix]
		private static void AfterInitializeUI()
		{
			MegaEmoteLoader.EnsureCustomLoadoutTabRegistered();
		}

		[HarmonyPatch(typeof(EmoteMenu), "OpenEmoteMenu")]
		[HarmonyPrefix]
		private static void BeforeOpenEmoteMenu()
		{
			MegaEmoteLoader.EnsureCustomLoadoutTabRegistered();
			MegaEmoteLoader.RefreshPackTabEmotes();
		}

		[HarmonyPatch(typeof(EmoteController), "TranslateAnimation")]
		[HarmonyPrefix]
		private static void BeforeTranslateAnimation(EmoteController __instance)
		{
			VmdEmotePlayer.OnBeforeTranslateAnimation(__instance);
		}

		[HarmonyPatch(typeof(EmoteController), "PerformEmote")]
		[HarmonyPrefix]
		private static void BeforePerformEmote(EmoteController __instance, UnlockableEmote emote)
		{
			VmdEmotePlayer.OnBeforePerformEmote(__instance, emote);
		}

		[HarmonyPatch(typeof(EmoteController), "SyncWithEmoteController")]
		[HarmonyPrefix]
		private static void BeforeSyncWithEmoteController(EmoteController __instance, EmoteController emoteController)
		{
			VmdEmotePlayer.OnBeforeSyncWithEmoteController(__instance, emoteController);
		}

		[HarmonyPatch(/*Could not decode attribute arguments.*/)]
		[HarmonyPrefix]
		private static bool BeforeGetCurrentAnimationTime(EmoteController __instance, ref float __result)
		{
			return VmdEmotePlayer.OnGetCurrentAnimationTime(__instance, ref __result);
		}
	}
	internal readonly record struct MegaEmoteDef(string Key, string DisplayName, string AnimBundle, string PrimaryAnimPath, string? LoopAnimPath, string AudioBundle, string? PrimaryAudioPath, string? LoopAudioPath, bool CanMove, bool IsBaseOverlap);
	internal readonly record struct VmdEmoteDef(string Key, string DisplayName, string MotionFile, string? AudioFile, bool CanMove, bool IsBaseOverlap);
	internal sealed class VmdClipData
	{
		internal readonly int BoneCount;

		internal readonly int FrameCount;

		internal readonly float Fps;

		internal readonly float Duration;

		internal readonly HumanBodyBones[] BoneIds;

		internal readonly float[] HipsPos;

		internal readonly short[] BoneQuats;

		internal VmdClipData(int boneCount, int frameCount, float fps, float duration, HumanBodyBones[] boneIds, float[] hipsPos, short[] boneQuats)
		{
			BoneCount = boneCount;
			FrameCount = frameCount;
			Fps = fps;
			Duration = duration;
			BoneIds = boneIds;
			HipsPos = hipsPos;
			BoneQuats = boneQuats;
		}
	}
	internal static class VmdEmotePlayer
	{
		private sealed class VmdPlaybackClock
		{
			internal float StartTime;
		}

		private sealed class SkeletonCalibration
		{
			internal bool[] HasBone = new bool[55];

			internal Quaternion[] RestWorldRot = (Quaternion[])(object)new Quaternion[55];

			internal Quaternion[] InvRestParentWorldRot = (Quaternion[])(object)new Quaternion[55];

			internal Vector3 HipsRestRootPos;

			internal Vector3 CharRightLocal = Vector3.right;

			internal Vector3 CharUpLocal = Vector3.up;

			internal Vector3 CharForwardLocal = Vector3.forward;

			internal float MmdToRootScale = 0.08f;
		}

		private const int BoneSlotCount = 55;

		private static readonly Dictionary<string, VmdClipData> ClipsByEmoteKey = new Dictionary<string, VmdClipData>(StringComparer.Ordinal);

		private static readonly ConditionalWeakTable<EmoteController, Transform?[]> ControllerBoneCache = new ConditionalWeakTable<EmoteController, Transform[]>();

		private static readonly ConditionalWeakTable<EmoteController, VmdPlaybackClock> ControllerClocks = new ConditionalWeakTable<EmoteController, VmdPlaybackClock>();

		private static readonly Quaternion[] FrameQuats = (Quaternion[])(object)new Quaternion[55];

		private static SkeletonCalibration? _calibration;

		private static bool _calibrationAttempted;

		private static ManualLogSource? _log;

		internal static void SetLogger(ManualLogSource log)
		{
			_log = log;
		}

		internal static void RegisterClip(string emoteKey, VmdClipData data)
		{
			ClipsByEmoteKey[emoteKey] = data;
		}

		internal static VmdClipData? LoadVmdBinary(string path)
		{
			try
			{
				using FileStream stream = File.OpenRead(path);
				using GZipStream input = new GZipStream(stream, CompressionMode.Decompress);
				using BinaryReader binaryReader = new BinaryReader(input, Encoding.ASCII, leaveOpen: false);
				byte[] array = binaryReader.ReadBytes(4);
				if (array.Length != 4 || array[0] != 86 || array[1] != 77 || array[2] != 68 || array[3] != 66)
				{
					ManualLogSource? log = _log;
					if (log != null)
					{
						log.LogError((object)("Invalid VMDB magic header in '" + path + "'."));
					}
					return null;
				}
				ushort num = binaryReader.ReadUInt16();
				if (num != 1)
				{
					ManualLogSource? log2 = _log;
					if (log2 != null)
					{
						log2.LogError((object)$"Unsupported VMDB version {num} in '{path}'.");
					}
					return null;
				}
				ushort num2 = binaryReader.ReadUInt16();
				int num3 = (int)binaryReader.ReadUInt32();
				float num4 = binaryReader.ReadSingle();
				if (num2 == 0 || num3 <= 0 || num4 <= 0f)
				{
					ManualLogSource? log3 = _log;
					if (log3 != null)
					{
						log3.LogError((object)$"Corrupt VMDB metadata in '{path}' (bones={num2}, frames={num3}, fps={num4}).");
					}
					return null;
				}
				HumanBodyBones[] array2 = (HumanBodyBones[])(object)new HumanBodyBones[num2];
				for (int i = 0; i < num2; i++)
				{
					array2[i] = (HumanBodyBones)binaryReader.ReadInt32();
				}
				float[] array3 = new float[num3 * 3];
				short[] array4 = new short[num3 * num2 * 4];
				int num5 = num2 * 4;
				for (int j = 0; j < num3; j++)
				{
					int num6 = j * 3;
					array3[num6] = binaryReader.ReadSingle();
					array3[num6 + 1] = binaryReader.ReadSingle();
					array3[num6 + 2] = binaryReader.ReadSingle();
					int num7 = j * num5;
					for (int k = 0; k < num5; k++)
					{
						array4[num7 + k] = binaryReader.ReadInt16();
					}
				}
				float duration = ((num3 > 1) ? ((float)(num3 - 1) / num4) : (1f / num4));
				return new VmdClipData(num2, num3, num4, duration, array2, array3, array4);
			}
			catch (Exception arg)
			{
				ManualLogSource? log4 = _log;
				if (log4 != null)
				{
					log4.LogError((object)$"Failed to read VMDB file '{path}': {arg}");
				}
				return null;
			}
		}

		private static VmdPlaybackClock GetOrCreateClock(EmoteController controller)
		{
			if (ControllerClocks.TryGetValue(controller, out VmdPlaybackClock value))
			{
				return value;
			}
			value = new VmdPlaybackClock
			{
				StartTime = Time.time
			};
			ControllerClocks.Add(controller, value);
			return value;
		}

		internal static void OnBeforePerformEmote(EmoteController? controller, UnlockableEmote? emote)
		{
			if (!((Object)(object)controller == (Object)null) && emote != null && !string.IsNullOrEmpty(emote.emoteName) && ClipsByEmoteKey.ContainsKey(emote.emoteName))
			{
				GetOrCreateClock(controller).StartTime = Time.time;
			}
		}

		internal static void OnBeforeSyncWithEmoteController(EmoteController? controller, EmoteController? target)
		{
			if (!((Object)(object)controller == (Object)null) && !((Object)(object)target == (Object)null) && target.performingEmote != null && !string.IsNullOrEmpty(target.performingEmote.emoteName) && ClipsByEmoteKey.ContainsKey(target.performingEmote.emoteName))
			{
				GetOrCreateClock(controller).StartTime = GetOrCreateClock(target).StartTime;
			}
		}

		internal static bool OnGetCurrentAnimationTime(EmoteController? controller, ref float result)
		{
			if ((Object)(object)controller == (Object)null || !controller.isPerformingEmote || controller.performingEmote == null || string.IsNullOrEmpty(controller.performingEmote.emoteName))
			{
				return true;
			}
			if (!ClipsByEmoteKey.TryGetValue(controller.performingEmote.emoteName, out VmdClipData value))
			{
				return true;
			}
			float num = Mathf.Max(0f, Time.time - GetOrCreateClock(controller).StartTime);
			result = ((value.Duration > 0f) ? (num % value.Duration) : 0f);
			return false;
		}

		internal static void OnBeforeTranslateAnimation(EmoteController? controller)
		{
			if (!((Object)(object)controller == (Object)null) && controller.initialized && controller.isPerformingEmote)
			{
				UnlockableEmote performingEmote = controller.performingEmote;
				if (performingEmote != null && !string.IsNullOrEmpty(performingEmote.emoteName) && ClipsByEmoteKey.TryGetValue(performingEmote.emoteName, out VmdClipData value))
				{
					ApplyFrameToController(controller, value);
				}
			}
		}

		private static void ApplyFrameToController(EmoteController controller, VmdClipData data)
		{
			//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
			//IL_0286: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0298: Unknown result type (might be due to invalid IL or missing references)
			//IL_029e: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a3: Unknown result type (might be due to invalid IL or missing references)
			//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
			//IL_02af: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ba: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_02db: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c1: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
			//IL_01bd: 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_032c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0338: Unknown result type (might be due to invalid IL or missing references)
			//IL_033d: 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_034f: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)controller.humanoidSkeleton == (Object)null || (Object)(object)controller.animator == (Object)null)
			{
				return;
			}
			SkeletonCalibration skeletonCalibration = EnsureCalibration();
			if (skeletonCalibration == null)
			{
				return;
			}
			Transform[] orCreateBoneArray = GetOrCreateBoneArray(controller, data);
			if (orCreateBoneArray == null)
			{
				return;
			}
			float num = Mathf.Max(0f, Time.time - GetOrCreateClock(controller).StartTime);
			float num2 = Mathf.Clamp(((data.Duration > 0f) ? (num % data.Duration) : 0f) * data.Fps, 0f, (float)(data.FrameCount - 1));
			int num3 = Mathf.Min((int)num2, data.FrameCount - 1);
			int num4 = Mathf.Min(num3 + 1, data.FrameCount - 1);
			float num5 = num2 - (float)num3;
			for (int i = 0; i < 55; i++)
			{
				FrameQuats[i] = Quaternion.identity;
			}
			int num6 = data.BoneCount * 4;
			int num7 = num3 * num6;
			int num8 = num4 * num6;
			Quaternion val = default(Quaternion);
			Quaternion val2 = default(Quaternion);
			for (int j = 0; j < data.BoneCount; j++)
			{
				int num9 = (int)data.BoneIds[j];
				if ((uint)num9 < 55u)
				{
					int num10 = num7 + j * 4;
					int num11 = num8 + j * 4;
					((Quaternion)(ref val))..ctor((float)data.BoneQuats[num10] * 3.051851E-05f, (float)data.BoneQuats[num10 + 1] * 3.051851E-05f, (float)data.BoneQuats[num10 + 2] * 3.051851E-05f, (float)data.BoneQuats[num10 + 3] * 3.051851E-05f);
					((Quaternion)(ref val2))..ctor((float)data.BoneQuats[num11] * 3.051851E-05f, (float)data.BoneQuats[num11 + 1] * 3.051851E-05f, (float)data.BoneQuats[num11 + 2] * 3.051851E-05f, (float)data.BoneQuats[num11 + 3] * 3.051851E-05f);
					FrameQuats[num9] = ((num5 > 0f) ? Quaternion.Slerp(val, val2, num5) : val);
				}
			}
			ComposeMissingBone(skeletonCalibration, (HumanBodyBones)54, (HumanBodyBones)8);
			ComposeMissingBone(skeletonCalibration, (HumanBodyBones)9, (HumanBodyBones)10);
			ComposeMissingBone(skeletonCalibration, (HumanBodyBones)11, (HumanBodyBones)13);
			ComposeMissingBone(skeletonCalibration, (HumanBodyBones)12, (HumanBodyBones)14);
			ComposeMissingDistalFingers(skeletonCalibration);
			int num12 = num3 * 3;
			int num13 = num4 * 3;
			Vector3 val3 = default(Vector3);
			((Vector3)(ref val3))..ctor(Mathf.Lerp(data.HipsPos[num12], data.HipsPos[num13], num5), Mathf.Lerp(data.HipsPos[num12 + 1], data.HipsPos[num13 + 1], num5), Mathf.Lerp(data.HipsPos[num12 + 2], data.HipsPos[num13 + 2], num5));
			Transform val4 = orCreateBoneArray[0];
			if ((Object)(object)val4 != (Object)null)
			{
				Vector3 val5 = skeletonCalibration.HipsRestRootPos + (skeletonCalibration.CharRightLocal * val3.x + skeletonCalibration.CharUpLocal * val3.y + skeletonCalibration.CharForwardLocal * val3.z) * skeletonCalibration.MmdToRootScale;
				val4.position = controller.humanoidSkeleton.TransformPoint(val5);
			}
			for (int k = 0; k < data.BoneCount; k++)
			{
				int num14 = (int)data.BoneIds[k];
				if ((uint)num14 < 55u && skeletonCalibration.HasBone[num14])
				{
					Transform val6 = orCreateBoneArray[num14];
					if (!((Object)(object)val6 == (Object)null))
					{
						val6.localRotation = skeletonCalibration.InvRestParentWorldRot[num14] * FrameQuats[num14] * skeletonCalibration.RestWorldRot[num14];
					}
				}
			}
		}

		private static void ComposeMissingBone(SkeletonCalibration cal, HumanBodyBones missing, HumanBodyBones parentOrChild)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Expected I4, but got Unknown
			//IL_0002: Unknown result type (might be due to invalid IL or missing references)
			//IL_0004: Expected I4, but got Unknown
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Invalid comparison between Unknown and I4
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: 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_005c: Unknown result type (might be due to invalid IL or missing references)
			int num = (int)missing;
			int num2 = (int)parentOrChild;
			if (!cal.HasBone[num] && cal.HasBone[num2])
			{
				FrameQuats[num2] = (((int)missing == 54) ? (FrameQuats[num2] * FrameQuats[num]) : (FrameQuats[num] * FrameQuats[num2]));
			}
		}

		private static void ComposeMissingDistalFingers(SkeletonCalibration cal)
		{
			//IL_0097: 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_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)
			ReadOnlySpan<int> readOnlySpan = stackalloc int[10] { 26, 29, 32, 35, 38, 41, 44, 47, 50, 53 };
			for (int i = 0; i < readOnlySpan.Length; i++)
			{
				int num = readOnlySpan[i];
				int num2 = num - 1;
				if (!cal.HasBone[num] && cal.HasBone[num2])
				{
					FrameQuats[num2] *= FrameQuats[num];
				}
			}
		}

		private static Transform?[]? GetOrCreateBoneArray(EmoteController controller, VmdClipData data)
		{
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			//IL_0045: Expected I4, but got Unknown
			//IL_004f: Unknown result type (might be due to invalid IL or missing references)
			if (ControllerBoneCache.TryGetValue(controller, out Transform[] value))
			{
				return value;
			}
			Animator animator = controller.animator;
			if ((Object)(object)animator == (Object)null || !animator.isHuman)
			{
				return null;
			}
			Transform[] array = (Transform[])(object)new Transform[55];
			for (int i = 0; i < data.BoneCount; i++)
			{
				HumanBodyBones val = data.BoneIds[i];
				int num = (int)val;
				if ((uint)num < 55u)
				{
					array[num] = animator.GetBoneTransform(val);
				}
			}
			ControllerBoneCache.Add(controller, array);
			return array;
		}

		private static SkeletonCalibration? EnsureCalibration()
		{
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: 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_0131: 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)
			//IL_013d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0142: 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_016a: Unknown result type (might be due to invalid IL or missing references)
			//IL_016f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0171: Unknown result type (might be due to invalid IL or missing references)
			//IL_0173: 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_017a: Unknown result type (might be due to invalid IL or missing references)
			//IL_017e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0183: 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_0187: Unknown result type (might be due to invalid IL or missing references)
			//IL_0189: Unknown result type (might be due to invalid IL or missing references)
			//IL_018e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0193: Unknown result type (might be due to invalid IL or missing references)
			//IL_019d: Unknown result type (might be due to invalid IL or missing references)
			//IL_019f: 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_01b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01c2: Unknown result type (might be due to invalid IL or missing references)
			//IL_01cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d1: 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_01e0: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
			//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
			//IL_0201: 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_021a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0224: Unknown result type (might be due to invalid IL or missing references)
			//IL_022e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_0245: Unknown result type (might be due to invalid IL or missing references)
			//IL_0255: Unknown result type (might be due to invalid IL or missing references)
			//IL_0265: Unknown result type (might be due to invalid IL or missing references)
			//IL_0275: Unknown result type (might be due to invalid IL or missing references)
			//IL_028c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0291: Unknown result type (might be due to invalid IL or missing references)
			//IL_0296: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02a4: 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_02ad: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_02be: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c0: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_02da: Unknown result type (might be due to invalid IL or missing references)
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e1: Unknown result type (might be due to invalid IL or missing references)
			//IL_02e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_02ea: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			//IL_030d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0312: Unknown result type (might be due to invalid IL or missing references)
			//IL_0324: Unknown result type (might be due to invalid IL or missing references)
			//IL_0329: Unknown result type (might be due to invalid IL or missing references)
			//IL_038d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0391: Unknown result type (might be due to invalid IL or missing references)
			//IL_0396: Unknown result type (might be due to invalid IL or missing references)
			//IL_039b: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03af: Unknown result type (might be due to invalid IL or missing references)
			//IL_03c9: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d4: Unknown result type (might be due to invalid IL or missing references)
			//IL_03d6: Unknown result type (might be due to invalid IL or missing references)
			//IL_03db: Unknown result type (might be due to invalid IL or missing references)
			if (_calibration != null)
			{
				return _calibration;
			}
			if (_calibrationAttempted)
			{
				return null;
			}
			_calibrationAttempted = true;
			if ((Object)(object)Plugin.humanoidSkeletonPrefab == (Object)null)
			{
				ManualLogSource? log = _log;
				if (log != null)
				{
					log.LogError((object)"TooManyEmotes.Plugin.humanoidSkeletonPrefab is null; cannot calibrate VMD skeleton.");
				}
				return null;
			}
			GameObject val = null;
			try
			{
				val = Object.Instantiate<GameObject>(Plugin.humanoidSkeletonPrefab);
				val.transform.SetPositionAndRotation(Vector3.zero, Quaternion.identity);
				val.transform.localScale = Vector3.one;
				Animator componentInChildren = val.GetComponentInChildren<Animator>(true);
				if ((Object)(object)componentInChildren == (Object)null || !componentInChildren.isHuman)
				{
					ManualLogSource? log2 = _log;
					if (log2 != null)
					{
						log2.LogError((object)"Cloned humanoidSkeletonPrefab lacks a Humanoid Animator.");
					}
					return null;
				}
				((Behaviour)componentInChildren).enabled = false;
				Transform[] array = (Transform[])(object)new Transform[55];
				for (int i = 0; i < 55; i++)
				{
					array[i] = componentInChildren.GetBoneTransform((HumanBodyBones)i);
				}
				Transform val2 = array[0];
				Transform val3 = array[13];
				Transform val4 = array[14];
				Transform val5 = array[5];
				Transform val6 = array[6];
				if ((Object)(object)val2 == (Object)null)
				{
					ManualLogSource? log3 = _log;
					if (log3 != null)
					{
						log3.LogError((object)"Humanoid skeleton prefab is missing Hips bone.");
					}
					return null;
				}
				Vector3 val7 = (((Object)(object)val3 != (Object)null && (Object)(object)val4 != (Object)null) ? Vector3.ProjectOnPlane(val4.position - val3.position, Vector3.up) : Vector3.right);
				if (((Vector3)(ref val7)).sqrMagnitude < 1E-06f)
				{
					val7 = Vector3.right;
				}
				((Vector3)(ref val7)).Normalize();
				Vector3 up = Vector3.up;
				Vector3 val8 = Vector3.Cross(val7, up);
				Vector3 normalized = ((Vector3)(ref val8)).normalized;
				Quaternion val9 = Quaternion.Inverse(Quaternion.LookRotation(normalized, up));
				AlignBone(array[13], array[15], -val7);
				AlignBone(array[15], array[17], -val7);
				AlignFingerChain(array, (HumanBodyBones)27, -val7);
				AlignFingerChain(array, (HumanBodyBones)30, -val7);
				AlignFingerChain(array, (HumanBodyBones)33, -val7);
				AlignFingerChain(array, (HumanBodyBones)36, -val7);
				AlignBone(array[14], array[16], val7);
				AlignBone(array[16], array[18], val7);
				AlignFingerChain(array, (HumanBodyBones)42, val7);
				AlignFingerChain(array, (HumanBodyBones)45, val7);
				AlignFingerChain(array, (HumanBodyBones)48, val7);
				AlignFingerChain(array, (HumanBodyBones)51, val7);
				AlignBone(array[1], array[3], Vector3.down);
				AlignBone(array[3], array[5], Vector3.down);
				AlignBone(array[2], array[4], Vector3.down);
				AlignBone(array[4], array[6], Vector3.down);
				SkeletonCalibration obj = new SkeletonCalibration
				{
					HipsRestRootPos = val.transform.InverseTransformPoint(val2.position)
				};
				val8 = val.transform.InverseTransformDirection(val7);
				obj.CharRightLocal = ((Vector3)(ref val8)).normalized;
				val8 = val.transform.InverseTransformDirection(up);
				obj.CharUpLocal = ((Vector3)(ref val8)).normalized;
				val8 = val.transform.InverseTransformDirection(normalized);
				obj.CharForwardLocal = ((Vector3)(ref val8)).normalized;
				SkeletonCalibration skeletonCalibration = obj;
				if ((Object)(object)val5 != (Object)null && (Object)(object)val6 != (Object)null)
				{
					float num = Mathf.Min(val.transform.InverseTransformPoint(val5.position).y, val.transform.InverseTransformPoint(val6.position).y);
					float num2 = Mathf.Max(0.1f, skeletonCalibration.HipsRestRootPos.y - num);
					skeletonCalibration.MmdToRootScale = num2 / 10.5f;
				}
				for (int j = 0; j < 55; j++)
				{
					Transform val10 = array[j];
					if (!((Object)(object)val10 == (Object)null))
					{
						skeletonCalibration.HasBone[j] = true;
						skeletonCalibration.RestWorldRot[j] = val9 * val10.rotation;
						Quaternion val11 = (((Object)(object)val10.parent != (Object)null) ? (val9 * val10.parent.rotation) : Quaternion.identity);
						skeletonCalibration.InvRestParentWorldRot[j] = Quaternion.Inverse(val11);
					}
				}
				_calibration = skeletonCalibration;
				return _calibration;
			}
			catch (Exception arg)
			{
				ManualLogSource? log4 = _log;
				if (log4 != null)
				{
					log4.LogError((object)$"Error calibrating humanoid skeleton for VMD playback: {arg}");
				}
				return null;
			}
			finally
			{
				if ((Object)(object)val != (Object)null)
				{
					val.SetActive(false);
					Object.Destroy((Object)(object)val);
				}
			}
		}

		private static void AlignBone(Transform? bone, Transform? child, Vector3 targetDir)
		{
			//IL_0014: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Unknown result type (might be due to invalid IL or missing references)
			//IL_001f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_003b: 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_003d: 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_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_004d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0053: Unknown result type (might be due to invalid IL or missing references)
			//IL_0058: Unknown result type (might be due to invalid IL or missing references)
			if ((Object)(object)bone == (Object)null || (Object)(object)child == (Object)null)
			{
				return;
			}
			Vector3 val = child.position - bone.position;
			if (!(((Vector3)(ref val)).sqrMagnitude < 1E-08f))
			{
				Vector3 normalized = ((Vector3)(ref val)).normalized;
				if (Vector3.Angle(normalized, targetDir) > 0.5f)
				{
					bone.rotation = Quaternion.FromToRotation(normalized, targetDir) * bone.rotation;
				}
			}
		}

		private static void AlignFingerChain(Transform?[] bones, HumanBodyBones proximal, Vector3 targetDir)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0002: Expected I4, but got Unknown
			//IL_000a: 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)
			int num = (int)proximal;
			AlignBone(bones[num], bones[num + 1], targetDir);
			AlignBone(bones[num + 1], bones[num + 2], targetDir);
		}
	}
}
namespace System.Runtime.CompilerServices
{
	internal static class IsExternalInit
	{
	}
}
namespace MegaEmotes_BadAssCompany
{
	internal static class GeneratedCatalog
	{
		internal const string TabDisplayName = "<color=#FF5555>BadAss</color>";

		internal static readonly string[] BundleFiles = new string[3] { "badass_emotes", "badass_audio", "badass_update10and11" };

		internal static readonly MegaEmoteDef[] All = new MegaEmoteDef[153]
		{
			new MegaEmoteDef("mba_breakin_badass", "Breakin (BadAss)", "badass_emotes", "assets/badassemotes/breakin.anim", null, "badass_audio", "assets/compressedaudio/breakin'.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_breakneck", "Breakneck", "badass_emotes", "assets/badassemotes/breakneck.anim", null, "badass_audio", "assets/compressedaudio/breakneck.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_crabby_badass", "Crabby (BadAss)", "badass_emotes", "assets/badassemotes/crabby.anim", null, "badass_audio", "assets/compressedaudio/crabby.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_dabstand", "Dabstand", "badass_emotes", "assets/badassemotes/dabstand.anim", null, "badass_audio", "assets/compressedaudio/dabstand.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_default_dance_badass", "Default Dance (BadAss)", "badass_emotes", "assets/badassemotes/dancemoves.anim", null, "badass_audio", "assets/compressedaudio/fortnite default dance sound.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_dance_therapy_badass", "Dance Therapy (BadAss)", "badass_emotes", "assets/badassemotes/dancetherapyintro.anim", "assets/badassemotes/dancetherapyloop.anim", "badass_audio", "assets/compressedaudio/dance therapy intro.ogg", "assets/compressedaudio/dance therapy loop.ogg", CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_deep_dab", "Deep Dab", "badass_emotes", "assets/badassemotes/deepdab.anim", null, "badass_audio", "assets/compressedaudio/dabstand.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_droop_badass", "Droop (BadAss)", "badass_emotes", "assets/badassemotes/droop.anim", null, "badass_audio", "assets/compressedaudio/droop.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_electro_swing_badass", "Electro Swing (BadAss)", "badass_emotes", "assets/badassemotes/electroswing.anim", null, "badass_audio", "assets/compressedaudio/electroswing.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_extraterrestrial", "Extraterrestrial", "badass_emotes", "assets/badassemotes/extraterrestial.anim", null, "badass_audio", "assets/compressedaudio/extraterestrial.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_fancy_feet_badass", "Fancy Feet (BadAss)", "badass_emotes", "assets/badassemotes/fancyfeet.anim", null, "badass_audio", "assets/compressedaudio/fancyfeet.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_flamenco_badass", "Flamenco (BadAss)", "badass_emotes", "assets/badassemotes/flamencointro.anim", "assets/badassemotes/flamencoloop.anim", "badass_audio", "assets/compressedaudio/flamenco.ogg", "assets/compressedaudio/flamencoloop.ogg", CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_floss_badass", "Floss (BadAss)", "badass_emotes", "assets/badassemotes/floss.anim", null, "badass_audio", "assets/compressedaudio/floss.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_fresh_badass", "Fresh (BadAss)", "badass_emotes", "assets/badassemotes/fresh.anim", null, "badass_audio", "assets/compressedaudio/fresh.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_hype_badass", "Hype (BadAss)", "badass_emotes", "assets/badassemotes/hype.anim", null, "badass_audio", "assets/compressedaudio/hype.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_infectious_badass", "Infectious (BadAss)", "badass_emotes", "assets/badassemotes/infectious.anim", null, "badass_audio", "assets/compressedaudio/infectious.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_infinidab_badass", "Infinidab (BadAss)", "badass_emotes", "assets/badassemotes/infinidabintro.anim", "assets/badassemotes/infinidabloop.anim", "badass_audio", "assets/compressedaudio/infinidabintro.ogg", "assets/compressedaudio/infinidabloop.ogg", CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_never_gonna", "Never Gonna", "badass_emotes", "assets/badassemotes/nevergonna.anim", null, "badass_audio", "assets/compressedaudio/never gonna give you up.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_ninja_style_badass", "Ninja Style (BadAss)", "badass_emotes", "assets/badassemotes/ninjastyle.anim", null, "badass_audio", "assets/compressedaudio/ninjastyle.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_oldschool_badass", "Oldschool (BadAss)", "badass_emotes", "assets/badassemotes/oldschool.anim", null, "badass_audio", "assets/compressedaudio/old school.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_orange_justice_badass", "Orange Justice (BadAss)", "badass_emotes", "assets/badassemotes/orangejustice.anim", null, "badass_audio", "assets/compressedaudio/orange justice.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_overdrive", "Overdrive", "badass_emotes", "assets/badassemotes/overdrive.anim", null, "badass_audio", "assets/compressedaudio/overdrive.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_i_m_a_cat", "I'm a Cat", "badass_emotes", "assets/badassemotes/pawsandclaws.anim", null, "badass_audio", "assets/compressedaudio/im a cat.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_phone_it_in_badass", "Phone It In (BadAss)", "badass_emotes", "assets/badassemotes/phoneitin.anim", null, "badass_audio", "assets/compressedaudio/phone it in.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_pop_lock_badass", "Pop Lock (BadAss)", "badass_emotes", "assets/badassemotes/poplock.anim", null, "badass_audio", "assets/compressedaudio/poplock.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_scenario_badass", "Scenario (BadAss)", "badass_emotes", "assets/badassemotes/scenario.anim", null, "badass_audio", "assets/compressedaudio/scenario.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_spring_loaded_badass", "Spring Loaded (BadAss)", "badass_emotes", "assets/badassemotes/springloaded.anim", null, "badass_audio", "assets/compressedaudio/springloaded.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_springy_badass", "Springy (BadAss)", "badass_emotes", "assets/badassemotes/springy.anim", null, "badass_audio", "assets/compressedaudio/springy.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_ankha_zone", "Ankha Zone", "badass_emotes", "assets/badassemotes/ankhazone.anim", null, "badass_audio", "assets/compressedaudio/ankhazone.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_gangnam_style_badass", "Gangnam Style (BadAss)", "badass_emotes", "assets/badassemotes/gangnamstyle.anim", null, "badass_audio", "assets/compressedaudio/gangnamstyle.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_don_t_strt_badass", "Don't Start (BadAss)", "badass_emotes", "assets/badassemotes/dontstart.anim", null, "badass_audio", "assets/compressedaudio/dontstart.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_bunny_hop_badass", "Bunny Hop (BadAss)", "badass_emotes", "assets/badassemotes/bunnyhop.anim", null, "badass_audio", "assets/compressedaudio/bunnyhop.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_best_mates_badass", "Best Mates (BadAss)", "badass_emotes", "assets/badassemotes/bestmates.anim", null, "badass_audio", "assets/compressedaudio/bestmates.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_jack_o_crouch", "Jack-O Crouch", "badass_emotes", "assets/badassemotes/jackopose.anim", null, "badass_audio", null, null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_crackdown_badass", "Crackdown (BadAss)", "badass_emotes", "assets/badassemotes/crackdown.anim", null, "badass_audio", "assets/compressedaudio/crackdown.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_thicc", "Thicc", "badass_emotes", "assets/badassemotes/thicc.anim", null, "badass_audio", "assets/compressedaudio/thicc.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_take_the_l_badass", "Take The L (BadAss)", "badass_emotes", "assets/badassemotes/takethel.anim", null, "badass_audio", "assets/compressedaudio/takethel.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_let_s_dance_boys", "Let's Dance Boys", "badass_emotes", "assets/badassemotes/letsdanceboys.anim", null, "badass_audio", "assets/compressedaudio/letsdanceboys.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_blinding_lights_badass", "Blinding Lights (BadAss)", "badass_emotes", "assets/badassemotes/blindinglightsintro.anim", "assets/badassemotes/blindinglights.anim", "badass_audio", "assets/compressedaudio/blindinglightsintro.ogg", "assets/compressedaudio/blindinglightsloop.ogg", CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_i_m_diamond", "I'm Diamond", "badass_emotes", "assets/badassemotes/imdiamond.anim", null, "badass_audio", "assets/compressedaudio/imdiamond.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_it_s_dynamite", "It's Dynamite", "badass_emotes", "assets/badassemotes/itsdynamite.anim", null, "badass_audio", "assets/compressedaudio/itsdynamite.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_the_robot_badass", "The Robot (BadAss)", "badass_emotes", "assets/badassemotes/therobot.anim", null, "badass_audio", "assets/compressedaudio/therobot.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_cartwheelin_badass", "Cartwheelin (BadAss)", "badass_emotes", "assets/badassemotes/cartwheelin.anim", null, "badass_audio", "assets/compressedaudio/cartwheelin.ogg", null, CanMove: true, IsBaseOverlap: true),
			new MegaEmoteDef("mba_crazy_feet_badass", "Crazy Feet (BadAss)", "badass_emotes", "assets/badassemotes/crazyfeet.anim", null, "badass_audio", "assets/compressedaudio/crazyfeet.ogg", null, CanMove: true, IsBaseOverlap: true),
			new MegaEmoteDef("mba_full_tilt_badass", "Full Tilt (BadAss)", "badass_emotes", "assets/badassemotes/fulltilt.anim", null, "badass_audio", "assets/compressedaudio/fulltilt.ogg", null, CanMove: true, IsBaseOverlap: true),
			new MegaEmoteDef("mba_samus_crawl", "Samus Crawl", "badass_emotes", "assets/badassemotes/floorsamus.anim", null, "badass_audio", null, null, CanMove: true, IsBaseOverlap: false),
			new MegaEmoteDef("mba_the_specialist", "The Specialist", "badass_emotes", "assets/badassemotes/specialist.anim", null, "badass_audio", "assets/compressedaudio/specialist.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_penis_music", "Penis Music", "badass_emotes", "assets/badassemotes/ppmusic.anim", null, "badass_audio", "assets/compressedaudio/ppmusic.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_get_down_badass", "Get Down (BadAss)", "badass_emotes", "assets/badassemotes/getdown.anim", null, "badass_audio", "assets/compressedaudio/getdown.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_koi_no_disco_queen", "Koi no Disco Queen", "badass_emotes", "assets/badassemotes/yakuza.anim", null, "badass_audio", "assets/compressedaudio/yakuza.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_miku", "Miku", "badass_emotes", "assets/badassemotes/miku.anim", null, "badass_audio", "assets/compressedaudio/miku.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_horny", "Horny", "badass_emotes", "assets/badassemotes/horny.anim", null, "badass_audio", "assets/compressedaudio/horny.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_gang_torture", "Gang Torture", "badass_emotes", "assets/badassemotes/gangtorture.anim", null, "badass_audio", "assets/compressedaudio/gangtorture.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_burter_pose_ginyu_force", "Burter Pose (Ginyu Force)", "badass_emotes", "assets/badassemotes/poseburter.anim", null, "badass_audio", "assets/compressedaudio/ginyuforce.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_ginyu_pose_ginyu_force", "Ginyu Pose (Ginyu Force)", "badass_emotes", "assets/badassemotes/poseginyu.anim", null, "badass_audio", "assets/compressedaudio/ginyuforce.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_guldo_pose_ginyu_force", "Guldo Pose (Ginyu Force)", "badass_emotes", "assets/badassemotes/poseguldo.anim", null, "badass_audio", "assets/compressedaudio/ginyuforce.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_jeice_pose_ginyu_force", "Jeice Pose (Ginyu Force)", "badass_emotes", "assets/badassemotes/posejeice.anim", null, "badass_audio", "assets/compressedaudio/ginyuforce.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_recoome_pose_ginyu_force", "Recoome Pose (Ginyu Force)", "badass_emotes", "assets/badassemotes/poserecoome.anim", null, "badass_audio", "assets/compressedaudio/ginyuforce.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_carson", "Carson", "badass_emotes", "assets/badassemotes/carson.anim", null, "badass_audio", "assets/compressedaudio/carson.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_frolic", "Frolic", "badass_emotes", "assets/badassemotes/frolic.anim", null, "badass_audio", "assets/compressedaudio/frolic.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_move_it_badass", "Move It (BadAss)", "badass_emotes", "assets/badassemotes/moveit.anim", null, "badass_audio", "assets/compressedaudio/moveit.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_by_the_fire", "By The Fire", "badass_emotes", "assets/badassemotes/bythefirelead.anim", null, "badass_audio", "assets/compressedaudio/bythefire.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_sway_badass", "Sway (BadAss)", "badass_emotes", "assets/badassemotes/swaylead.anim", null, "badass_audio", "assets/compressedaudio/sway.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_macarena_badass", "Macarena (BadAss)", "badass_emotes", "assets/badassemotes/macarena.anim", null, "badass_audio", "assets/compressedaudio/macarena.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_thanos", "Thanos", "badass_emotes", "assets/badassemotes/thanos.anim", null, "badass_audio", "assets/compressedaudio/thanos.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_star_get", "Star Get", "badass_emotes", "assets/badassemotes/starget.anim", null, "badass_audio", "assets/compressedaudio/starget2.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_poyo", "Poyo", "badass_emotes", "assets/badassemotes/poyo.anim", null, "badass_audio", "assets/compressedaudio/poyo.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_chika", "Chika", "badass_emotes", "assets/badassemotes/chika.anim", null, "badass_audio", "assets/compressedaudio/chika.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_goopie", "Goopie", "badass_emotes", "assets/badassemotes/goopie.anim", null, "badass_audio", "assets/compressedaudio/goopie.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_crossbounce_badass", "Crossbounce (BadAss)", "badass_emotes", "assets/badassemotes/crossbounce.anim", null, "badass_audio", "assets/compressedaudio/crossbounce.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_butt", "Butt", "badass_emotes", "assets/badassemotes/butt.anim", null, "badass_audio", "assets/compressedaudio/butt.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_make_it_rain", "Make it Rain", "badass_emotes", "assets/badassemotes/makeitrainintro.anim", "assets/badassemotes/makeitrainloop.anim", "badass_audio", "assets/compressedaudio/makeitrainintro.ogg", "assets/compressedaudio/makeitrainloop.ogg", CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_club_penguin", "Club Penguin", "badass_emotes", "assets/badassemotes/penguin.anim", null, "badass_audio", "assets/compressedaudio/penguin.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_rivers_in_the_dessert", "Rivers in the Dessert", "badass_emotes", "assets/badassemotes/desertrivers.anim", null, "badass_audio", "assets/compressedaudio/desertrivers.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_step", "Step!", "badass_emotes", "assets/badassemotes/hondastep.anim", null, "badass_audio", "assets/compressedaudio/hondastep.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_u_got_that", "U Got That", "badass_emotes", "assets/badassemotes/ugotthat.anim", null, "badass_audio", "assets/compressedaudio/ugotthat.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_officer_earl", "Officer Earl", "badass_emotes", "assets/badassemotes/officerearl.anim", null, "badass_audio", null, null, CanMove: true, IsBaseOverlap: false),
			new MegaEmoteDef("mba_cirno", "Cirno", "badass_emotes", "assets/badassemotes/cirno.anim", null, "badass_audio", "assets/compressedaudio/cirno.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_hare_hare_yukai", "Hare Hare Yukai", "badass_emotes", "assets/badassemotes/haruhi.anim", null, "badass_audio", "assets/compressedaudio/haruhi.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_gggg", "GGGG", "badass_emotes", "assets/badassemotes/gggg.anim", null, "badass_audio", "assets/compressedaudio/gggg.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_shufflin", "Shufflin", "badass_emotes", "assets/badassemotes/shufflin.anim", null, "badass_audio", "assets/compressedaudio/shufflin.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_bim_bam_boom_badass", "Bim Bam Boom (BadAss)", "badass_update10and11", "assets/badassemotes/bimbambomtest.anim", null, "badass_audio", "assets/compressedaudio/bimbambom.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_savage_badass", "Savage (BadAss)", "badass_emotes", "assets/badassemotes/savage.anim", null, "badass_audio", "assets/compressedaudio/savage.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_stuck_badass", "Stuck (BadAss)", "badass_emotes", "assets/badassemotes/stuck.anim", null, "badass_audio", "assets/compressedaudio/stuck.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_roflcopter", "Roflcopter", "badass_emotes", "assets/badassemotes/roflcopter.anim", null, "badass_audio", "assets/compressedaudio/roflcopter.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_float", "Float", "badass_emotes", "assets/badassemotes/float.anim", null, "badass_audio", "assets/compressedaudio/float.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_rollie_badass", "Rollie (BadAss)", "badass_emotes", "assets/badassemotes/rollie.anim", null, "badass_audio", "assets/compressedaudio/rollie.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_galaxy_observatory", "Galaxy Observatory", "badass_emotes", "assets/badassemotes/galaxyobservatory.anim", null, "badass_audio", "assets/compressedaudio/galaxyobservatory1.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_markiplier", "Markiplier", "badass_emotes", "assets/badassemotes/markiplier.anim", null, "badass_audio", "assets/compressedaudio/markiplier.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_devilspawn", "DevilSpawn", "badass_emotes", "assets/badassemotes/devilspawn.anim", null, "badass_audio", "assets/compressedaudio/devilspawn.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_duck_this_one", "Duck This One", "badass_emotes", "assets/badassemotes/duckthisone.anim", null, "badass_audio", "assets/compressedaudio/duckthisone.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_griddy_badass", "Griddy (BadAss)", "badass_emotes", "assets/badassemotes/griddy.anim", null, "badass_audio", "assets/compressedaudio/griddy.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_tidy_badass", "Tidy (BadAss)", "badass_emotes", "assets/badassemotes/tidy.anim", null, "badass_audio", "assets/compressedaudio/tidy.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_toosie_badass", "Toosie (BadAss)", "badass_emotes", "assets/badassemotes/toosie.anim", null, "badass_audio", "assets/compressedaudio/toosie.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_i_need_a_medic_bag", "I NEED A MEDIC BAG", "badass_emotes", "assets/badassemotes/ineedamedicbag.anim", null, "badass_audio", "assets/compressedaudio/ineedamedicbag1.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_ralsei_dies", "Ralsei Dies", "badass_emotes", "assets/badassemotes/smoke.anim", null, "badass_audio", "assets/compressedaudio/smoke.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_family_guy_death_pose", "Family Guy Death Pose", "badass_emotes", "assets/badassemotes/familyguydeath.anim", null, "badass_audio", null, null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_yamcha_death_pose", "Yamcha Death Pose", "badass_emotes", "assets/badassemotes/yamcha.anim", null, "badass_audio", null, null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_thriller", "Thriller", "badass_emotes", "assets/badassemotes/thriller.anim", null, "badass_audio", "assets/compressedaudio/thriller.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_wess", "Wess", "badass_emotes", "assets/badassemotes/wess.anim", null, "badass_audio", "assets/compressedaudio/wess.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_distraction_dance_badass", "Distraction Dance (BadAss)", "badass_emotes", "assets/badassemotes/distraction.anim", null, "badass_audio", "assets/compressedaudio/distraction.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_kill_me_baby", "Kill Me Baby", "badass_emotes", "assets/badassemotes/killmebaby.anim", null, "badass_audio", "assets/compressedaudio/killmebaby.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_my_world", "My World", "badass_emotes", "assets/badassemotes/myworld.anim", null, "badass_audio", "assets/compressedaudio/myworld.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_vsworld", "VSWORLD", "badass_emotes", "assets/badassemotes/vsworld.anim", null, "badass_audio", "assets/compressedaudio/vsworld.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_chug_jug", "Chug Jug", "badass_emotes", "assets/badassemotes/chugjug.anim", null, "badass_audio", "assets/compressedaudio/chugjug.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_summertime", "Summertime", "badass_emotes", "assets/badassemotes/summertime.anim", null, "badass_audio", "assets/compressedaudio/summertime.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_dougie_badass", "Dougie (BadAss)", "badass_emotes", "assets/badassemotes/dougie.anim", null, "badass_audio", "assets/compressedaudio/dougie.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_california_gurls_badass", "California Gurls (BadAss)", "badass_emotes", "assets/badassemotes/californiagirls.anim", null, "badass_audio", "assets/compressedaudio/californiagirls.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_see_t_nh", "See Tình", "badass_emotes", "assets/badassemotes/seetinh.anim", null, "badass_audio", "assets/compressedaudio/seetinh.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_virtual_insanity", "Virtual Insanity", "badass_emotes", "assets/badassemotes/virtualinsanityintro.anim", "assets/badassemotes/virtualinsanityloop.anim", "badass_audio", "assets/compressedaudio/virtualinsanitystart.ogg", "assets/compressedaudio/virtualinsanityloop.ogg", CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_i_m_a_mystery", "I'm a Mystery", "badass_emotes", "assets/badassemotes/im a mystery.anim", "assets/badassemotes/im a mystery loop.anim", "badass_audio", "assets/compressedaudio/im a mystery.ogg", "assets/compressedaudio/im a mystery loop.ogg", CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_bird", "Bird", "badass_emotes", "assets/badassemotes/bird.anim", null, "badass_audio", "assets/compressedaudio/bird.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_real_slim_shady_badass", "Real Slim Shady (BadAss)", "badass_emotes", "assets/badassemotes/real slim shady.anim", "assets/badassemotes/real slim shady loop.anim", "badass_audio", "assets/compressedaudio/real slim shady.ogg", "assets/compressedaudio/real slim shady loop.ogg", CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_steady_badass", "Steady (BadAss)", "badass_emotes", "assets/badassemotes/steady.anim", null, "badass_audio", "assets/compressedaudio/steady.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_air_shredder_badass", "Air Shredder (BadAss)", "badass_update10and11", "assets/badassemotes/airshredder.anim", null, "badass_update10and11", "assets/compressedaudio/airshredder.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_army_bunny", "Army Bunny", "badass_update10and11", "assets/badassemotes/armybunny.anim", "assets/badassemotes/armybunnyloop.anim", "badass_update10and11", "assets/compressedaudio/armybunny.ogg", "assets/compressedaudio/armybunnyloop.ogg", CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_boney_bounce_badass", "Boney Bounce (BadAss)", "badass_update10and11", "assets/badassemotes/boneybounce.anim", "assets/badassemotes/boneybounceloop.anim", "badass_update10and11", "assets/compressedaudio/boneybounce.ogg", "assets/compressedaudio/boneybounceloop.ogg", CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_bold_stance_badass", "Bold Stance (BadAss)", "badass_update10and11", "assets/badassemotes/boldstance.anim", null, "badass_update10and11", "assets/compressedaudio/boldstance.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_bombastic_badass", "Bombastic (BadAss)", "badass_update10and11", "assets/badassemotes/bombastic.anim", null, "badass_update10and11", "assets/compressedaudio/bombastic.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_bounce_wit_it_badass", "Bounce Wit'It (BadAss)", "badass_update10and11", "assets/badassemotes/bouncewit'it.anim", "assets/badassemotes/bouncewit'itpoop.anim", "badass_update10and11", "assets/compressedaudio/bouncewit'it.ogg", "assets/compressedaudio/bouncewit'itpoop.ogg", CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_boy_s_a_liar", "Boy's A Liar", "badass_update10and11", "assets/badassemotes/boy'salier.anim", null, "badass_update10and11", "assets/compressedaudio/boy'salier.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_caffeinated_badass", "Caffeinated (BadAss)", "badass_update10and11", "assets/badassemotes/caffeinated.anim", "assets/badassemotes/caffeinatedloop.anim", "badass_update10and11", "assets/compressedaudio/caffeinated.ogg", "assets/compressedaudio/caffeinatedloop.ogg", CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_celebrate_me_badass", "Celebrate Me (BadAss)", "badass_update10and11", "assets/badassemotes/celebrateme.anim", null, "badass_update10and11", "assets/compressedaudio/celebrateme.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_cluck_strut_badass", "Cluck Strut (BadAss)", "badass_update10and11", "assets/badassemotes/cluckstrut.anim", null, "badass_update10and11", "assets/compressedaudio/cluckstrut.ogg", null, CanMove: true, IsBaseOverlap: true),
			new MegaEmoteDef("mba_conga_badass", "Conga (BadAss)", "badass_update10and11", "assets/badassemotes/congaft.anim", null, "badass_update10and11", "assets/compressedaudio/conga.ogg", null, CanMove: true, IsBaseOverlap: true),
			new MegaEmoteDef("mba_copines_badass", "Copines (BadAss)", "badass_update10and11", "assets/badassemotes/copines.anim", null, "badass_update10and11", "assets/compressedaudio/copines.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_cupid_s_arrow", "Cupid's Arrow", "badass_update10and11", "assets/badassemotes/cupid'sarrow.anim", "assets/badassemotes/cupid'sarrowloop.anim", "badass_update10and11", "assets/compressedaudio/cupid'sarrow.ogg", "assets/compressedaudio/cupid'sarrowloop.ogg", CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_fast_flex_badass", "Fast Flex (BadAss)", "badass_update10and11", "assets/badassemotes/fastflex.anim", "assets/badassemotes/fastflexloop.anim", "badass_update10and11", "assets/compressedaudio/fastflex.ogg", "assets/compressedaudio/fastflexloop.ogg", CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_feel_the_flow_badass", "Feel The Flow (BadAss)", "badass_update10and11", "assets/badassemotes/feeltheflow.anim", null, "badass_update10and11", "assets/compressedaudio/feeltheflow.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_get_gone", "Get Gone", "badass_update10and11", "assets/badassemotes/getgone.anim", null, "badass_update10and11", "assets/compressedaudio/getgone.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_get_loose_badass", "Get Loose (BadAss)", "badass_update10and11", "assets/badassemotes/getloose.anim", null, "badass_update10and11", "assets/compressedaudio/getloose.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_gloss", "Gloss", "badass_update10and11", "assets/badassemotes/gloss.anim", null, "badass_update10and11", "assets/compressedaudio/gloss.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_in_ha_mood_badass", "In Ha Mood (BadAss)", "badass_update10and11", "assets/badassemotes/inhamood.anim", "assets/badassemotes/inhamoodloop.anim", "badass_update10and11", "assets/compressedaudio/inhamood.ogg", "assets/compressedaudio/inhamoodloop.ogg", CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_make_some_waves_badass", "Make Some Waves (BadAss)", "badass_update10and11", "assets/badassemotes/makesomewaves.anim", null, "badass_update10and11", "assets/compressedaudio/makesomewaves.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_nana_nana_badass", "Nana Nana (BadAss)", "badass_update10and11", "assets/badassemotes/nananana.anim", null, "badass_update10and11", "assets/compressedaudio/nananana.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_night_out", "Night Out", "badass_update10and11", "assets/badassemotes/nightout.anim", null, "badass_update10and11", "assets/compressedaudio/nightout.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_point_and_strut", "Point And Strut", "badass_update10and11", "assets/badassemotes/pointandstrut.anim", "assets/badassemotes/pointandstrutloop.anim", "badass_update10and11", "assets/compressedaudio/pointandstrut.ogg", "assets/compressedaudio/pointandstrutloop.ogg", CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_primo_moves_badass", "Primo Moves (BadAss)", "badass_update10and11", "assets/badassemotes/primomoves.anim", null, "badass_update10and11", "assets/compressedaudio/primomoves.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_rap_monster", "Rap Monster", "badass_update10and11", "assets/badassemotes/rapmonster.anim", "assets/badassemotes/rapmonsterloop.anim", "badass_update10and11", "assets/compressedaudio/rapmonster.ogg", "assets/compressedaudio/rapmonsterloop.ogg", CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_rushin_around_badass", "Rushin' Around (BadAss)", "badass_update10and11", "assets/badassemotes/rushin'around.anim", null, "badass_update10and11", "assets/compressedaudio/rushin'around.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_show_ya", "Show Ya", "badass_update10and11", "assets/badassemotes/showya.anim", "assets/badassemotes/showyaloop.anim", "badass_update10and11", "assets/compressedaudio/showya.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_ska_stra_terrestrial", "Ska-stra-terrestrial", "badass_update10and11", "assets/badassemotes/ska-stra-terrestrial.anim", null, "badass_update10and11", "assets/compressedaudio/ska-stra-terrestrial.ogg", "assets/compressedaudio/ska-stra-terrestrialloop.ogg", CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_sugar_rush", "Sugar Rush", "badass_update10and11", "assets/badassemotes/sugarrush.anim", null, "badass_update10and11", "assets/compressedaudio/sugarrush.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_switchstep_badass", "Switchstep (BadAss)", "badass_update10and11", "assets/badassemotes/switchstep.anim", null, "badass_update10and11", "assets/compressedaudio/switchstep.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_you_should_see_me_in_a_crown", "You Should See Me In A Crown", "badass_update10and11", "assets/badassemotes/youshouldseemeinacrown.anim", "assets/badassemotes/youshouldseemeinacrowloop.anim", "badass_update10and11", "assets/compressedaudio/youshouldseemeinacrown.ogg", "assets/compressedaudio/youshouldseemeinacrownloop.ogg", CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_zany_badass", "Zany (BadAss)", "badass_update10and11", "assets/badassemotes/zany.anim", null, "badass_update10and11", "assets/compressedaudio/zany.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_cheer_up_badass", "Cheer Up (BadAss)", "badass_update10and11", "assets/badassemotes/cheerup.anim", null, "badass_update10and11", "assets/compressedaudio/cheerup.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_criss_cross", "Criss Cross", "badass_update10and11", "assets/badassemotes/crisscross.anim", null, "badass_update10and11", "assets/compressedaudio/crisscross.ogg", null, CanMove: false, IsBaseOverlap: false),
			new MegaEmoteDef("mba_nuthin_but_a_g_thang_badass", "Nuthin But A G Thang (BadAss)", "badass_update10and11", "assets/badassemotes/nuthinbutagthang.anim", "assets/badassemotes/nuthinbutagthangloop.anim", "badass_update10and11", "assets/compressedaudio/nuthinbutagthang.ogg", "assets/compressedaudio/nuthinbutagthangloop.ogg", CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_jabba_switchway_badass", "Jabba Switchway (BadAss)", "badass_update10and11", "assets/badassemotes/jabbaswitchway.anim", "assets/badassemotes/jabbaswitchwaloopy.anim", "badass_update10and11", "assets/compressedaudio/switchaway.ogg", null, CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_bye_bye_bye_badass", "Bye Bye Bye (BadAss)", "badass_update10and11", "assets/badassemotes/byebyebye.anim", "assets/badassemotes/byebyebyeloop.anim", "badass_update10and11", "assets/compressedaudio/byebyebye.ogg", "assets/compressedaudio/byebyebyeloop.ogg", CanMove: false, IsBaseOverlap: true),
			new MegaEmoteDef("mba_go_mufasa_badass", "Go Mufasa (BadAss)", "badass_update10and11", "assets/badassemotes/gomufasa.anim", null, "badass_update10and11", "assets/compressedaudio/gomufasa.ogg", null, CanMove: true, IsBaseOverlap: true),
			new MegaEmoteDef("mba_snoop_s_walk_badass", "Snoop's Walk (BadAss)", "badass_update10and11", "assets/badassemotes/snoop'swalk.anim", "assets/badassemotes/snoop'swalkloop.anim", "badass_update10and11", "assets/compressedaudio/snoop'swalk.ogg", "assets/compressedaudio/snoop'swalkloop.ogg", CanMove: true, IsBaseOverlap: true)
		};

		internal static readonly VmdEmoteDef[] VmdEmotes = Array.Empty<VmdEmoteDef>();
	}
	[BepInPlugin("MegaEmotes.BadAssCompany", "MegaEmotes_BadAssCompany", "1.0.1")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public sealed class Plugin : BaseUnityPlugin
	{
		public const string PluginGuid = "MegaEmotes.BadAssCompany";

		public const string PluginName = "MegaEmotes_BadAssCompany";

		public const string PluginVersion = "1.0.1";

		private Harmony? _harmony;

		private void Awake()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			MegaEmoteConfig.Bind(((BaseUnityPlugin)this).Config);
			_harmony = new Harmony("MegaEmotes.BadAssCompany");
			_harmony.PatchAll(typeof(MegaEmotePatches));
			MegaEmoteLoader.Initialize(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location) ?? Paths.PluginPath, "<color=#FF5555>BadAss</color>", GeneratedCatalog.BundleFiles, GeneratedCatalog.All, GeneratedCatalog.VmdEmotes, (MonoBehaviour)(object)this, ((BaseUnityPlugin)this).Logger);
		}
	}
}