Decompiled source of Shari MyWayEmoteMod v1.0.1

MyWayEmoteMod.dll

Decompiled 2 months ago
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using LethalEmotesAPI.ImportV2;
using UnityEngine;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: TargetFramework(".NETFramework,Version=v4.7.2", FrameworkDisplayName = ".NET Framework 4.7.2")]
[assembly: AssemblyCompany("MyWayEmoteMod")]
[assembly: AssemblyConfiguration("Release")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("MyWayEmoteMod")]
[assembly: AssemblyTitle("MyWayEmoteMod")]
[assembly: AssemblyVersion("1.0.0.0")]
[BepInPlugin("com.shari.mywayemote", "My Way Emote", "1.0.0")]
[BepInDependency(/*Could not decode attribute arguments.*/)]
public class MyWayEmote : BaseUnityPlugin
{
	private void Awake()
	{
		//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
		//IL_00dd: Expected O, but got Unknown
		string text = Path.Combine(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "assetbundles"), "sinatraemote.bundle");
		((BaseUnityPlugin)this).Logger.LogInfo((object)("\ud83d\udce6 Looking for assetbundle at: " + text));
		if (!File.Exists(text))
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"❌ AssetBundle file does not exist at the specified path!");
			return;
		}
		AssetBundle val = AssetBundle.LoadFromFile(text);
		if ((Object)(object)val == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"❌ Failed to load AssetBundle. Returned null.");
			return;
		}
		AnimationClip val2 = val.LoadAsset<AnimationClip>("mixamo.com");
		AudioClip val3 = val.LoadAsset<AudioClip>("myway");
		GameObject micPrefab = val.LoadAsset<GameObject>("MicObject");
		if ((Object)(object)val2 == (Object)null || (Object)(object)val3 == (Object)null || (Object)(object)micPrefab == (Object)null)
		{
			((BaseUnityPlugin)this).Logger.LogError((object)"❌ Required assets (clip, song, or mic) are missing in the bundle.");
			return;
		}
		CustomEmoteParams val4 = new CustomEmoteParams();
		val4.primaryAnimationClips = (AnimationClip[])(object)new AnimationClip[1] { val2 };
		val4.primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { val3 };
		val4.displayName = "My Way \ud83c\udfa4";
		val4.internalName = "myway";
		val4.thirdPerson = true;
		val4.preventMovement = false;
		val4.stopWhenMove = false;
		val4.syncAnim = true;
		val4.syncAudio = true;
		val4.customPostEventCodeSync = delegate(BoneMapper mapper)
		{
			//IL_0055: Unknown result type (might be due to invalid IL or missing references)
			//IL_0065: Unknown result type (might be due to invalid IL or missing references)
			GameObject val5 = Object.Instantiate<GameObject>(micPrefab);
			Transform val6 = mapper.mapperBody.transform.Find("mixamorig:RightHand");
			if ((Object)(object)val6 != (Object)null)
			{
				val5.transform.SetParent(val6);
			}
			else
			{
				val5.transform.SetParent(mapper.mapperBody.transform);
			}
			val5.transform.localPosition = Vector3.zero;
			val5.transform.localRotation = Quaternion.identity;
			mapper.props.Add(val5);
		};
		EmoteImporter.ImportEmote(val4);
		((BaseUnityPlugin)this).Logger.LogInfo((object)"✅ Sinatra emote (WITH mic) successfully registered!");
	}
}