Decompiled source of AllwaysCanDance v1.0.0

AllwaysCanEmote.dll

Decompiled a year ago
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using BepInEx.Configuration;
using GameNetcodeStuff;
using HarmonyLib;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("AllwaysCanEmote")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("AllwaysCanEmote")]
[assembly: AssemblyTitle("AllwaysCanEmote")]
[assembly: AssemblyVersion("1.0.0.0")]
namespace AllwaysCanEmote
{
	public class HarmonyPatches
	{
		private static Harmony instance;

		public const string InstanceId = "com.graze.gorillatag.allwayscanemote";

		public static bool IsPatched { get; private set; }

		internal static void ApplyHarmonyPatches()
		{
			//IL_0020: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Expected O, but got Unknown
			if (!IsPatched)
			{
				if (instance == null)
				{
					instance = new Harmony("com.graze.gorillatag.allwayscanemote");
				}
				instance.PatchAll(Assembly.GetExecutingAssembly());
				IsPatched = true;
			}
		}

		internal static void RemoveHarmonyPatches()
		{
			if (instance != null && IsPatched)
			{
				instance.UnpatchSelf();
				IsPatched = false;
			}
		}
	}
	[BepInPlugin("com.graze.gorillatag.allwayscanemote", "AllwaysCanEmote", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		public static ConfigEntry<float> DanceTime;

		private Plugin()
		{
			BEgin();
		}

		private void BEgin()
		{
			HarmonyPatches.ApplyHarmonyPatches();
			DanceTime = ((BaseUnityPlugin)this).Config.Bind<float>("Settings", "Dance Time", 10f, "How Long Untill the emote ends");
		}
	}
	internal class PluginInfo
	{
		public const string GUID = "com.graze.gorillatag.allwayscanemote";

		public const string Name = "AllwaysCanEmote";

		public const string Version = "1.0.0";
	}
}
namespace AllwaysCanEmote.Patches
{
	[HarmonyPatch(typeof(PlayerControllerB))]
	[HarmonyPatch("CheckConditionsForEmote")]
	internal class DancePatch
	{
		private static bool Prefix(ref bool __result, PlayerControllerB __instance)
		{
			__result = true;
			if (__instance.performingEmote && __instance.timeSinceStartingEmote > Plugin.DanceTime.Value)
			{
				__result = false;
			}
			return false;
		}
	}
}