Decompiled source of ChikuwaCompany v1.2.2

plugins/CustomEmotesAPITemplateMod.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 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.weliveinasociety.testmod", "testmod", "1.0.0")]
	public class ExampleEmoteMod : BaseUnityPlugin
	{
		public const string PluginGUID = "com.weliveinasociety.testmod";

		public const string PluginName = "testmod";

		public const string PluginVersion = "1.0.0";

		public static ExampleEmoteMod instance;

		public static PluginInfo PInfo { get; private set; }

		public void Awake()
		{
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0024: Expected O, but got Unknown
			//IL_00b7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00db: Expected O, but got Unknown
			//IL_016e: Unknown result type (might be due to invalid IL or missing references)
			//IL_018c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0192: Expected O, but got Unknown
			//IL_0225: Unknown result type (might be due to invalid IL or missing references)
			//IL_0243: Unknown result type (might be due to invalid IL or missing references)
			//IL_0249: Expected O, but got Unknown
			//IL_02dc: Unknown result type (might be due to invalid IL or missing references)
			//IL_02fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_0301: Expected O, but got Unknown
			//IL_0394: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b2: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b9: Expected O, but got Unknown
			//IL_044c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0471: Unknown result type (might be due to invalid IL or missing references)
			//IL_047b: Expected O, but got Unknown
			instance = this;
			PInfo = ((BaseUnityPlugin)this).Info;
			Assets.LoadAssetBundlesFromFolder("assetbundles");
			AnimationClipParams val = new AnimationClipParams();
			val.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Assets/MaftyDance.anim") };
			val.secondaryAnimation = null;
			val.looping = false;
			val._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Assets/MaftyAudio.mp3") };
			val._secondaryAudioClips = null;
			val._primaryDMCAFreeAudioClips = null;
			val._secondaryDMCAFreeAudioClips = null;
			val.visible = true;
			val.syncAnim = true;
			val.syncAudio = true;
			val.startPref = -1;
			val.joinPref = -1;
			val.joinSpots = null;
			val.joinSpots = null;
			val.customName = "Mafty";
			val.lockType = (LockType)1;
			val.willGetClaimedByDMCA = true;
			val.audioLevel = 1f;
			CustomEmotesAPI.AddCustomAnimation(val);
			AnimationClipParams val2 = new AnimationClipParams();
			val.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Assets/LoliKami.anim") };
			val.secondaryAnimation = null;
			val.looping = false;
			val._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Assets/LoliKamiAudio.mp3") };
			val._secondaryAudioClips = null;
			val._primaryDMCAFreeAudioClips = null;
			val._secondaryDMCAFreeAudioClips = null;
			val.visible = true;
			val.syncAnim = true;
			val.syncAudio = true;
			val.startPref = -1;
			val.joinPref = -1;
			val.joinSpots = null;
			val.joinSpots = null;
			val.customName = "Loli Kami";
			val.lockType = (LockType)1;
			val.willGetClaimedByDMCA = true;
			val.audioLevel = 0.7f;
			CustomEmotesAPI.AddCustomAnimation(val);
			AnimationClipParams val3 = new AnimationClipParams();
			val.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Assets/Paripi.anim") };
			val.secondaryAnimation = null;
			val.looping = false;
			val._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Assets/Paripi.mp3") };
			val._secondaryAudioClips = null;
			val._primaryDMCAFreeAudioClips = null;
			val._secondaryDMCAFreeAudioClips = null;
			val.visible = true;
			val.syncAnim = true;
			val.syncAudio = true;
			val.startPref = -1;
			val.joinPref = -1;
			val.joinSpots = null;
			val.joinSpots = null;
			val.customName = "Paripi";
			val.lockType = (LockType)1;
			val.willGetClaimedByDMCA = true;
			val.audioLevel = 0.7f;
			CustomEmotesAPI.AddCustomAnimation(val);
			AnimationClipParams val4 = new AnimationClipParams();
			val.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Assets/Internet Saikou.anim") };
			val.secondaryAnimation = null;
			val.looping = false;
			val._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Assets/Internet Saikou.mp3") };
			val._secondaryAudioClips = null;
			val._primaryDMCAFreeAudioClips = null;
			val._secondaryDMCAFreeAudioClips = null;
			val.visible = true;
			val.syncAnim = true;
			val.syncAudio = true;
			val.startPref = -1;
			val.joinPref = -1;
			val.joinSpots = null;
			val.joinSpots = null;
			val.customName = "Internet Saikou";
			val.lockType = (LockType)1;
			val.willGetClaimedByDMCA = true;
			val.audioLevel = 0.7f;
			CustomEmotesAPI.AddCustomAnimation(val);
			AnimationClipParams val5 = new AnimationClipParams();
			val.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Assets/OddLoop.anim") };
			val.secondaryAnimation = null;
			val.looping = false;
			val._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Assets/OddLoop.mp3") };
			val._secondaryAudioClips = null;
			val._primaryDMCAFreeAudioClips = null;
			val._secondaryDMCAFreeAudioClips = null;
			val.visible = true;
			val.syncAnim = true;
			val.syncAudio = true;
			val.startPref = -1;
			val.joinPref = -1;
			val.joinSpots = null;
			val.joinSpots = null;
			val.customName = "OddLoop";
			val.lockType = (LockType)1;
			val.willGetClaimedByDMCA = true;
			val.audioLevel = 0.7f;
			CustomEmotesAPI.AddCustomAnimation(val);
			AnimationClipParams val6 = new AnimationClipParams();
			val.animationClip = (AnimationClip[])(object)new AnimationClip[1] { Assets.Load<AnimationClip>("Assets/Idol.anim") };
			val.secondaryAnimation = null;
			val.looping = false;
			val._primaryAudioClips = (AudioClip[])(object)new AudioClip[1] { Assets.Load<AudioClip>("Assets/IdolAudio.mp3") };
			val._secondaryAudioClips = null;
			val._primaryDMCAFreeAudioClips = null;
			val._secondaryDMCAFreeAudioClips = null;
			val.visible = true;
			val.syncAnim = true;
			val.syncAudio = true;
			val.startPref = -1;
			val.joinPref = -1;
			val.joinSpots = null;
			val.joinSpots = null;
			val.customName = "Idol";
			val.lockType = (LockType)1;
			val.willGetClaimedByDMCA = true;
			val.audioLevel = 0.7f;
			CustomEmotesAPI.AddCustomAnimation(val);
			CustomEmotesAPI.animChanged += new AnimationChanged(CustomEmotesAPI_animChanged);
		}

		private void CustomEmotesAPI_animChanged(string newAnimation, BoneMapper mapper)
		{
			if (newAnimation == "MaftyDance")
			{
				DebugClass.Log((object)"Dancing Pumpkin");
			}
		}
	}
}
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);
			}
		}
	}
}