Decompiled source of BBing Emotes v1.1.1

plugins/BBing_Emotes/BBingEmotes.dll

Decompiled 10 months 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 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.dev-foxi.bbing_emotes", "bbing_emotes", "1.1.0")]
	public class ExampleEmoteMod : BaseUnityPlugin
	{
		public const string PluginGUID = "com.dev-foxi.bbing_emotes";

		public const string PluginName = "bbing_emotes";

		public const string PluginVersion = "1.1.0";

		public static ExampleEmoteMod instance;

		public static PluginInfo PInfo { get; private set; }

		public void Awake()
		{
			instance = this;
			PInfo = ((BaseUnityPlugin)this).Info;
			Assets.LoadAssetBundlesFromFolder("assetbundles");
			AddCustomEmote("assets/D-001.anim", "assets/M-001.mp3", "BTS - MIC Drop", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-002.anim", "assets/M-002.mp3", "(G)Idle - Oh My Gods", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-003.anim", "assets/M-003.mp3", "KDA - The Baddest", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-004.anim", "assets/M-004.mp3", "Blackpink - HowYouLikeThat", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-005.anim", "assets/M-005.wav", "Meme - TokaToka", check: false, emoteDMCA: true);
			AddCustomEmote("assets/D-006.anim", "assets/M-006.wav", "Meme - KnockKnock", check: false, emoteDMCA: true);
			AddCustomEmote("assets/D-007.anim", "assets/M-007.wav", "PUBG - Roll n Rock", check: false, emoteDMCA: true);
			AddCustomEmote("assets/D-008.anim", "assets/M-008.wav", "Meme - Dreams Come True", check: false, emoteDMCA: true);
			AddCustomEmote("assets/D-009.anim", "assets/M-009.wav", "PUBG - The Magic Bomb", check: false, emoteDMCA: true);
			AddCustomEmote("assets/D-010.anim", "assets/M-010.wav", "Meme - Sad Cat Dance", check: false, emoteDMCA: true);
			AddCustomEmote("assets/D-011.anim", "assets/M-011.wav", "LESSERAFIM - Fearless", check: false, emoteDMCA: true);
			AddCustomEmote("assets/D-012.anim", "assets/M-012.mp3", "BTS - DNA", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-013.anim", "assets/M-013.mp3", "ITZY - Wannabe", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-014.anim", "assets/M-014.mp3", "TWICE - LIKEY", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-015.anim", "assets/M-015.wav", "Blackpink - LoveSickGirls", check: false, emoteDMCA: true);
			AddCustomEmote("assets/D-016.anim", "assets/M-016.mp3", "KDA - POP Star", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-017.anim", "assets/M-017.wav", "Everglow - Ladida", check: false, emoteDMCA: true);
			AddCustomEmote("assets/D-018.anim", "assets/M-018.mp3", "Everglow - Adios", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-019.anim", "assets/M-019.mp3", "Blackpink - Playing with Fire", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-020.anim", "assets/M-020.wav", "Blankpink - AIIYL", check: false, emoteDMCA: true);
			AddCustomEmote("assets/D-021.anim", "assets/M-021.mp3", "MAMAMOO - HIP", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-022.anim", "assets/M-022.mp3", "SOMI - Birthday", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-023.anim", "assets/M-023.mp3", "Miku - Alien Alien", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-024.anim", "assets/M-024.mp3", "Miku - Hibana", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-025.anim", "assets/M-025.mp3", "Momoland - BAAM", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-026.anim", "assets/M-026.mp3", "T.ARA - No9", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-027.anim", "assets/M-027.mp3", "TWICE - FANCY", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-028.anim", "assets/M-028.mp3", "BTS - ON", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-029.anim", "assets/M-029.mp3", "BTS - Not Today", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-030.anim", "assets/M-030.mp3", "TWICE - More & More", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-031.anim", "assets/M-031.mp3", "ChungHa - Stay Tonight", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-032.anim", "assets/M-032.mp3", "Everglow - Dun Dun", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-033.anim", "assets/M-033.mp3", "BTS - BloodSweat & Tears", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-034.anim", "assets/M-034.mp3", "SOMI - WhatYouWaiting", check: true, emoteDMCA: true);
			AddCustomEmote("assets/D-035.anim", "assets/M-035.mp3", "KARA - Step", check: true, emoteDMCA: true);
			void AddCustomEmote(string animationPath, string audioPath, string emoteName, bool check, bool emoteDMCA)
			{
				//IL_0001: Unknown result type (might be due to invalid IL or missing references)
				//IL_0007: Expected O, but got Unknown
				//IL_007a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00a0: Unknown result type (might be due to invalid IL or missing references)
				//IL_00aa: Expected O, but got Unknown
				AnimationClipParams val = new AnimationClipParams();
				val.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>(animationPath) };
				val.secondaryAnimation = null;
				val.looping = check;
				val._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>(audioPath) };
				val._secondaryAudioClips = null;
				val.visible = true;
				val.syncAnim = true;
				val.syncAudio = true;
				val.startPref = -1;
				val.joinPref = -1;
				val.joinSpots = null;
				val.customName = emoteName;
				val.lockType = (LockType)1;
				val.willGetClaimedByDMCA = emoteDMCA;
				val.audioLevel = 0f;
				CustomEmotesAPI.AddCustomAnimation(val);
				CustomEmotesAPI.animChanged += new AnimationChanged(CustomEmotesAPI_animChanged);
			}
		}

		private void CustomEmotesAPI_animChanged(string newAnimation, BoneMapper mapper)
		{
			if (newAnimation == "EvesDanceMotionOhMyGod")
			{
				DebugClass.Log((object)"EvesDanceMotonOhMyGod");
			}
		}
	}
}
namespace CustomEmotesAPI_Template_Mod
{
	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(ExampleEmoteMod.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)));
			}
		}

		public 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);
			}
		}
	}
}