Decompiled source of mysticemotes v1.0.7

plugins/mysticemotes/mysticemotes.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using CustomEmotesAPI_Template_Mod;
using EmotesAPI;
using LethalEmotesAPI.ImportV2;
using Lethal_Company_CustomEmotesAPI_Template_Mod;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("Lethal Company CustomEmotesAPI Template Mod")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lethal Company CustomEmotesAPI Template Mod")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("199912ba-43b6-4276-b420-7bfaa3eedbe5")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace Lethal_Company_CustomEmotesAPI_Template_Mod
{
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	[BepInPlugin("com.CCCM.mysticemotes", "mysticemotes", "1.0.7")]
	public class mysticEmotes : BaseUnityPlugin
	{
		public const string PluginGUID = "com.CCCM.mysticemotes";

		public const string PluginName = "mysticemotes";

		public const string PluginVersion = "1.0.7";

		public static mysticEmotes instance;

		public static PluginInfo PInfo { get; private set; }

		public void Awake()
		{
			//IL_0601: Unknown result type (might be due to invalid IL or missing references)
			//IL_060b: Expected O, but got Unknown
			instance = this;
			PInfo = ((BaseUnityPlugin)this).Info;
			Assets.LoadAssetBundlesFromFolder("mysticbundles");
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Other/ievanpolkka/ievanpolkka.anim") }, null, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Other/ievanpolkka/ievanpolkka.ogg") }, null, sync: true, "Ievan Polkka", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Other/idol/idol.anim") }, null, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Other/idol/idol.ogg") }, null, sync: true, "Idol", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Fortnite/runitdown/runitdown.anim") }, null, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Fortnite/runitdown/runitdown.ogg") }, null, sync: true, "Run it Down", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Fortnite/magnetic/illitintro.anim") }, (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Fortnite/magnetic/illitloop.anim") }, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Fortnite/magnetic/illitintro.ogg") }, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Fortnite/magnetic/illitloop.ogg") }, sync: true, "Magnetic", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Fortnite/apple/appleintro.anim") }, (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Fortnite/apple/appleloop.anim") }, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Fortnite/apple/appleintro.ogg") }, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Fortnite/apple/appleloop.ogg") }, sync: true, "Apple", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Fortnite/viper/viperintro.anim") }, (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Fortnite/viper/viperloop.anim") }, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Fortnite/viper/viperintro.ogg") }, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Fortnite/viper/viperloop.ogg") }, sync: true, "The Viper", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Fortnite/popularvibe/popularvibe.anim") }, null, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Fortnite/popularvibe/popularvibe.ogg") }, null, sync: true, "Popular Vibe", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Fortnite/groovejam/groovejam.anim") }, null, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Fortnite/groovejam/groovejam.ogg") }, null, sync: true, "Groove Jam", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Fortnite/dreamfeet/dreamfeet.anim") }, null, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Fortnite/dreamfeet/dreamfeet.ogg") }, null, sync: true, "Dream Feet", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Fortnite/laidbackshuffle/laidbackshuffle.anim") }, null, looping: true, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Fortnite/laidbackshuffle/laidbackshuffle.ogg") }, null, sync: true, "Laid Back Shuffle", dmca: false, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Fortnite/jaywalking/jaywalking.anim") }, null, looping: true, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Fortnite/jaywalking/jaywalking.ogg") }, null, sync: true, "Jaywalking", dmca: false, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Fortnite/bringitaround/bringitaround.anim") }, null, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Fortnite/bringitaround/bringitaround.ogg") }, null, sync: true, "Bring it Around", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/bombrushblush/aoriintro.anim") }, (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/bombrushblush/aorisong.anim") }, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/bombrushblush/aoriintro.ogg") }, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/bombrushblush/aorisong.ogg") }, sync: true, "Bomb Rush Blush", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/calamariinkantation/shiokaraintro.anim") }, (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/calamariinkantation/shiokara.anim") }, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/calamariinkantation/shiokaraintro.ogg") }, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/calamariinkantation/shiokara.ogg") }, sync: true, "Calamari Inkantation", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/cityofcolor/fesintro.anim") }, (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/cityofcolor/fes.anim") }, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/cityofcolor/fesintro.ogg") }, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/cityofcolor/fes.ogg") }, sync: true, "City of Color", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/maritimememory/maritime.anim") }, null, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/maritimememory/maritime.ogg") }, null, sync: true, "Maritime Memory", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/inkmeup/kimiirointro.anim") }, (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/inkmeup/kimiiro.anim") }, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/inkmeup/kimiirointro.ogg") }, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/inkmeup/kimiiro.ogg") }, sync: true, "Ink me Up", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/nowornever/imanuraintro.anim") }, (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/nowornever/imanura.anim") }, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/nowornever/imanuraintro.ogg") }, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/nowornever/imanura.ogg") }, sync: true, "Now or Never!", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/tidegoesout/hotaruintro.anim") }, (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/tidegoesout/hotarusong.anim") }, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/tidegoesout/hotaruintro.ogg") }, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/tidegoesout/hotarusong.ogg") }, sync: true, "Tide Goes Out", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/colorpulse/squarefesintro.anim") }, (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Custom Animation Folder/Splatoon/colorpulse/squarefesloop.anim") }, looping: false, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/colorpulse/squarefesintro.ogg") }, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Custom Animation Folder/Splatoon/colorpulse/squarefesloop.ogg") }, sync: true, "Color Pulse", dmca: true, cantMove: false, thirdPerson: false);
			CustomEmotesAPI.animChanged += new AnimationChanged(CustomEmotesAPI_animChanged);
		}

		private void CustomEmotesAPI_animChanged(string newAnimation, BoneMapper mapper)
		{
			if (newAnimation.StartsWith("com.CCCM.mysticemotes"))
			{
				newAnimation = newAnimation.Split("__")[1];
			}
		}

		public void ImportAnimation(AnimationClip[] primaryClips, AnimationClip[] secondaryClips, bool looping, AudioClip[] primaryAudioClips, AudioClip[] secondaryAudioClips, bool sync, string customName, bool dmca, bool cantMove, bool thirdPerson)
		{
			//IL_0001: Unknown result type (might be due to invalid IL or missing references)
			//IL_0007: Expected O, but got Unknown
			//IL_0073: Unknown result type (might be due to invalid IL or missing references)
			CustomEmoteParams val = new CustomEmoteParams();
			val.primaryAnimationClips = primaryClips;
			val.secondaryAnimationClips = secondaryClips;
			val.audioLoops = looping;
			val.primaryAudioClips = primaryAudioClips;
			val.secondaryAudioClips = secondaryAudioClips;
			val.primaryDMCAFreeAudioClips = null;
			val.secondaryDMCAFreeAudioClips = null;
			val.visible = true;
			val.syncAnim = sync;
			val.syncAudio = sync;
			val.startPref = -1;
			val.joinPref = -1;
			val.joinSpots = null;
			val.internalName = "";
			val.lockType = (LockType)3;
			val.willGetClaimedByDMCA = dmca;
			val.audioLevel = 0.3f;
			val.rootBonesToIgnore = null;
			val.soloBonesToIgnore = null;
			val.stopWhenMove = cantMove;
			val.thirdPerson = thirdPerson;
			val.displayName = customName;
			EmoteImporter.ImportEmote(val);
		}
	}
}
namespace CustomEmotesAPI_Template_Mod
{
	internal static class Assets
	{
		internal static readonly List<AssetBundle> AssetBundles = new List<AssetBundle>();

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

		internal static void LoadAssetBundlesFromFolder(string folderName)
		{
			folderName = Path.Combine(Path.GetDirectoryName(mysticEmotes.PInfo.Location), folderName);
			string[] files = Directory.GetFiles(folderName);
			foreach (string text in files)
			{
				AssetBundle val = AssetBundle.LoadFromFile(text);
				int count = AssetBundles.Count;
				AssetBundles.Add(val);
				string[] allAssetNames = val.GetAllAssetNames();
				foreach (string text2 in allAssetNames)
				{
					string text3 = text2.ToLowerInvariant();
					if (text3.StartsWith("assets/"))
					{
						text3 = text3.Remove(0, "assets/".Length);
					}
					AssetIndices[text3] = count;
				}
				DebugClass.Log((object)("Loaded AssetBundle: " + Path.GetFileName(text)));
			}
		}

		internal static T Load<T>(string assetName) where T : Object
		{
			try
			{
				assetName = assetName.ToLowerInvariant();
				if (assetName.Contains(":"))
				{
					string[] array = assetName.Split(':');
					assetName = array[1].ToLowerInvariant();
				}
				if (assetName.StartsWith("assets/"))
				{
					assetName = assetName.Remove(0, "assets/".Length);
				}
				int index = AssetIndices[assetName];
				return AssetBundles[index].LoadAsset<T>("assets/" + assetName);
			}
			catch (Exception arg)
			{
				DebugClass.Log((object)$"Couldn't load asset [{assetName}] reason: {arg}");
				return default(T);
			}
		}
	}
}