Decompiled source of GlizzyEmotes v1.0.2

plugins/GlizzyEmotes.dll

Decompiled a year 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 EmotesAPI;
using Microsoft.CodeAnalysis;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[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+d4464ddc78d4797b1d40b96e3a32edbb0d7bd338")]
[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 Glizzy
{
	public static class Assets
	{
		internal static readonly List<AssetBundle> AssetBundles = new List<AssetBundle>();

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

		public static void LoadAssetBundlesFromFolder(string folderName)
		{
			folderName = Path.Combine(Path.GetDirectoryName(GlizzyEmoteMod.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();
				for (int j = 0; j < allAssetNames.Length; j++)
				{
					string text2 = allAssetNames[j].ToLowerInvariant();
					if (text2.StartsWith("assets/"))
					{
						text2 = text2.Remove(0, "assets/".Length);
					}
					AssetIndices[text2] = count;
				}
				DebugClass.Log((object)("Loaded AssetBundle: " + Path.GetFileName(text)));
			}
		}

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

		public const string PluginName = "GlizzyEmotes";

		public const string PluginVersion = "1.0.1";

		public static GlizzyEmoteMod instance;

		public static PluginInfo PInfo { get; private set; }

		public void Awake()
		{
			instance = this;
			PInfo = ((BaseUnityPlugin)this).Info;
			Assets.LoadAssetBundlesFromFolder("assetbundles");
			AddAnimation("wormintro", "wormloop", "worm_music", "", looping: true, dimAudio: true, sync: false, (LockType)1, "Worm", "worm_music", "", DMCA: false, 0.5f);
			AddAnimation("FlairLoop", "Flair", "", looping: true, dimAudio: true, sync: false, (LockType)3, "Flair", "FlairDMCA", "", DMCA: true, 0.5f);
			AddAnimation("TPoseIntro", "TPoseLoop", "TPoseIntro", "TPoseLoop", looping: true, dimAudio: true, sync: false, (LockType)1, "TPose", "TPoseIntro", "TPoseLoop", DMCA: false, 0.5f);
			AddAnimation("SquatKickIntro", "SquatKickLoop", "SquatKickIntro", "SquatKickLoop", looping: true, dimAudio: true, sync: false, (LockType)1, "SquatKick", "SquatKickIntro", "SquatKickLoop", DMCA: false, 0.5f);
			AddAnimation("LivingLarge", "livinglarge_music", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Living Large", "livinglarge_music", "", DMCA: false, 0.5f);
			AddAnimation("LunarParty", "lunar_music", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Lunar Party", "lunar_music", "", DMCA: false, 0.5f);
			AddAnimation("JayWalking", "JayWalking", "", looping: true, dimAudio: true, sync: true, (LockType)1, "JayWalking", "JayWalking", "", DMCA: false, 0.5f);
			AddAnimation("Boneless", "Boneless", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Boneless", "Boneless", "", DMCA: false, 0.5f);
			AddAnimation("Breakin", "Breakin", "", looping: true, dimAudio: true, sync: true, (LockType)3, "Breakneck", "Breakin", "", DMCA: false, 0.5f);
			AddAnimation("BillyBounce", "BillyBounce", "", looping: true, dimAudio: true, sync: true, (LockType)1, "BillyBounce", "BillyBounce", "", DMCA: false, 0.5f);
			AddAnimation("Wiggle", "Wiggle", "", looping: true, dimAudio: true, sync: true, (LockType)1, "Wiggle", "Wiggle", "", DMCA: false, 0.5f);
			AddAnimation("Eagle", "Eagle", "", looping: true, dimAudio: true, sync: true, (LockType)3, "Eagle", "Eagle", "", DMCA: false, 0.5f);
			AddAnimation("StarPower", "StarPower", "", looping: true, dimAudio: true, sync: true, (LockType)3, "StarPower", "StarPower", "", DMCA: false, 0.5f);
			AddAnimation("RideThePony", (AudioClip[])(object)new AudioClip[2]
			{
				Assets.Load<AudioClip>("assets/glizzysound/Pony1.ogg"),
				Assets.Load<AudioClip>("assets/glizzysound/Pony2.ogg")
			}, null, looping: true, dimAudio: false, sync: false, (LockType)1, "Ride The Pony", (AudioClip[])(object)new AudioClip[2]
			{
				Assets.Load<AudioClip>("assets/glizzysound/Pony1.ogg"),
				Assets.Load<AudioClip>("assets/glizzysound/Pony2.ogg")
			}, null, DMCA: false, 0.5f);
			AddAnimation("Reanimated", (AudioClip[])(object)new AudioClip[4]
			{
				Assets.Load<AudioClip>("assets/glizzysound/Reanimated.ogg"),
				Assets.Load<AudioClip>("assets/glizzysound/Reanimated.ogg"),
				Assets.Load<AudioClip>("assets/glizzysound/Reanimated.ogg"),
				Assets.Load<AudioClip>("assets/glizzysound/OldReanimated.ogg")
			}, null, looping: true, dimAudio: true, sync: false, (LockType)1, "Reanimated", (AudioClip[])(object)new AudioClip[4]
			{
				Assets.Load<AudioClip>("assets/glizzysound/Reanimated.ogg"),
				Assets.Load<AudioClip>("assets/glizzysound/Reanimated.ogg"),
				Assets.Load<AudioClip>("assets/glizzysound/Reanimated.ogg"),
				Assets.Load<AudioClip>("assets/glizzysound/OldReanimated.ogg")
			}, null, DMCA: false, 0.5f);
		}

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

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

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