Decompiled source of RandomlyRippedEmotes v1.0.0

BepInEx/plugins/RandomlyRippedEmotes.dll

Decompiled 4 hours 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.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("Lethal Company Randomly Ripped Emotes")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Lethal Company Randomly Ripped Emotes")]
[assembly: AssemblyCopyright("Copyright ©  2025")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("C0A806FA-29D8-42C8-8A2A-28C907F35454")]
[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.filigrani.randomlyrippedemotes", "RandomlyRippedEmotes", "1.0.0")]
	public class RandomlyRippedEmotes : BaseUnityPlugin
	{
		public const string PluginGUID = "com.filigrani.randomlyrippedemotes";

		public const string PluginName = "RandomlyRippedEmotes";

		public const string PluginVersion = "1.0.0";

		public static RandomlyRippedEmotes instance;

		public static PluginInfo PInfo { get; private set; }

		public void Awake()
		{
			//IL_016c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0176: Expected O, but got Unknown
			instance = this;
			PInfo = ((BaseUnityPlugin)this).Info;
			Assets.LoadAssetBundlesFromFolder("assetbundles");
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("2Phut.anim") }, null, looping: true, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("horny.ogg") }, sync: true, "2Phut", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("SadCat.anim") }, null, looping: true, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("SadCat.ogg") }, sync: true, "SadCat", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Arona Dance.anim") }, null, looping: true, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("AronaHD.ogg") }, sync: true, "Arona Dance", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Caramella.anim") }, null, looping: true, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Caramella.ogg") }, sync: true, "Caramelldansen", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("GmodDefault.anim") }, null, looping: true, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("GmodDefault.ogg") }, sync: true, "Gmod Dance", dmca: true, cantMove: false, thirdPerson: false);
			ImportAnimation((AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Walky.anim") }, null, looping: true, (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Metallurgy.ogg") }, sync: true, "Robot Waifu Stroll", dmca: true, cantMove: false, thirdPerson: false);
			CustomEmotesAPI.animChanged += new AnimationChanged(CustomEmotesAPI_animChanged);
		}

		private void CustomEmotesAPI_animChanged(string newAnimation, BoneMapper mapper)
		{
			if (newAnimation.StartsWith("com.filigrani.randomlyrippedemotes"))
			{
				newAnimation = newAnimation.Split("__")[1];
				if (newAnimation == "Walky")
				{
					mapper.SetAutoWalk(0.3f, false);
				}
			}
		}

		public void ImportAnimation(AnimationClip[] primaryClips, AnimationClip[] secondaryClips, bool looping, AudioClip[] primaryAudioClips, bool sync, string customName, bool dmca, bool cantMove, bool thirdPerson)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0005: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0013: 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_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_004e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0055: 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)
			//IL_0063: Unknown result type (might be due to invalid IL or missing references)
			//IL_006e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			//IL_0075: Unknown result type (might be due to invalid IL or missing references)
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0088: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b3: Expected O, but got Unknown
			EmoteImporter.ImportEmote(new CustomEmoteParams
			{
				primaryAnimationClips = primaryClips,
				secondaryAnimationClips = secondaryClips,
				audioLoops = looping,
				primaryAudioClips = primaryAudioClips,
				secondaryAudioClips = null,
				primaryDMCAFreeAudioClips = null,
				secondaryDMCAFreeAudioClips = null,
				visible = true,
				syncAnim = sync,
				syncAudio = sync,
				startPref = -1,
				joinPref = -1,
				joinSpots = null,
				internalName = "",
				lockType = (LockType)1,
				willGetClaimedByDMCA = dmca,
				audioLevel = 0.3f,
				rootBonesToIgnore = null,
				soloBonesToIgnore = null,
				stopWhenMove = cantMove,
				thirdPerson = thirdPerson,
				displayName = customName
			});
		}
	}
}
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(RandomlyRippedEmotes.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)));
			}
		}

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