Decompiled source of Traversal Emotes v0.0.1

Traversal Emotes.dll

Decompiled 11 months ago
using System;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using MelonLoader;
using Microsoft.CodeAnalysis;
using Traversal_Emotes;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: MelonInfo(typeof(Mod), "Traversal Emotes", "0.0.1", "Cyconi", null)]
[assembly: MelonGame(null, "Lethal Company")]
[assembly: MelonColor(ConsoleColor.DarkRed)]
[assembly: AssemblyTitle("Traversal Emotes")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("Traversal Emotes")]
[assembly: AssemblyCopyright("Copyright ©  2023")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("316fd481-3f3d-427c-a8e2-490435de4574")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[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 Traversal_Emotes
{
	internal class CLog
	{
		internal static bool Melon;

		internal static bool Bepin;

		internal static void L(string MessageToLog)
		{
			if (Melon)
			{
				MelonLogger.Msg(ConsoleColor.White, "[~>] " + MessageToLog);
			}
			if (Bepin)
			{
				Plugin.Log.Log((LogLevel)63, (object)("[~>] " + MessageToLog));
			}
		}
	}
	public class Mod : MelonMod
	{
		public override void OnApplicationStart()
		{
			CLog.Melon = true;
			CLog.L("Updated for Lethal Company v45");
			CLog.L("MelonLoader Detected! \n\n\t\t\t - Cyconi \n");
			EmotePatch.StartPatch();
		}
	}
	[BepInPlugin("cyconi.traversal_emotes", "Traversal Emotes", "0.0.1")]
	internal class Plugin : BaseUnityPlugin
	{
		internal static Plugin instance;

		internal static ManualLogSource Log;

		public void Awake()
		{
			CLog.Bepin = true;
			instance = this;
			Log = ((BaseUnityPlugin)this).Logger;
			CLog.L("Updated for Lethal Company v45");
			CLog.L("BepInEx Detected! \n\n\t\t\t - Cyconi \n");
			EmotePatch.StartPatch();
		}
	}
	internal class EmotePatch
	{
		public static Harmony instance = new Harmony("Cyconi");

		public static void StartPatch()
		{
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0044: Expected O, but got Unknown
			try
			{
				instance.Patch((MethodBase)typeof(PlayerControllerB).GetMethod("CheckConditionsForEmote", AccessTools.all), (HarmonyMethod)null, new HarmonyMethod(typeof(EmotePatch).GetMethod("Postfix", BindingFlags.Static | BindingFlags.NonPublic)), (HarmonyMethod)null, (HarmonyMethod)null, (HarmonyMethod)null);
				CLog.L("Emote Conditions Patched!");
			}
			catch
			{
				CLog.L("Emote Conditions Patched!");
			}
		}

		private static void Postfix(ref bool __result)
		{
			if (!GameNetworkManager.Instance.localPlayerController.isCrouching)
			{
				__result = true;
			}
		}
	}
}