Decompiled source of push to cry v1.0.5

push to cry.dll

Decompiled 2 weeks ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using Dissonance;
using HarmonyLib;
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: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: AssemblyCompany("murderminemurder, murderminer")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("final singularity")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("push to cry")]
[assembly: AssemblyTitle("final singularity")]
[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 retardcrusher
{
	[BepInPlugin("murderminemurderer.pushtocry", "pushtocry", "1.0.0")]
	[BepInProcess("MageArena.exe")]
	public class blood : BaseUnityPlugin
	{
		public static ManualLogSource Logger;

		public const string guid = "murderminemurderer.pushtocry";

		public static string modsync = "client";

		public static Func<IEnumerator, Coroutine> bootloop;

		internal void Awake()
		{
			//IL_002d: Unknown result type (might be due to invalid IL or missing references)
			Logger = ((BaseUnityPlugin)this).Logger;
			Logger.LogInfo((object)"push to cry loaded");
			configman.dotheconfig(((BaseUnityPlugin)this).Config);
			new Harmony("murderminemurderer.pushtocry").PatchAll();
			bootloop = ((MonoBehaviour)this).StartCoroutine;
		}
	}
	public static class configman
	{
		public static ConfigEntry<float> sadsatan;

		public static ConfigEntry<float> releaseperiod;

		public static ConfigEntry<string> keycode;

		public static ConfigEntry<bool> debug;

		public static void dotheconfig(ConfigFile config)
		{
			string text = "pushtocry";
			sadsatan = config.Bind<float>(text, "checkrate", 0.05f, (ConfigDescription)null);
			releaseperiod = config.Bind<float>(text, "releaseperiod", 0.6f, (ConfigDescription)null);
			keycode = config.Bind<string>(text, "keycode", "v", (ConfigDescription)null);
			debug = config.Bind<bool>(text, "debug", false, (ConfigDescription)null);
		}
	}
	[HarmonyPatch(typeof(PushtoTalk))]
	public class tryingtomanipulateme
	{
		[CompilerGenerated]
		private sealed class <sovietloop>d__5 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <sovietloop>d__5(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0166: Unknown result type (might be due to invalid IL or missing references)
				//IL_0170: Expected O, but got Unknown
				//IL_005a: Unknown result type (might be due to invalid IL or missing references)
				//IL_00bd: Unknown result type (might be due to invalid IL or missing references)
				//IL_00c7: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					goto IL_0181;
				case 1:
					<>1__state = -1;
					if (configman.debug.Value)
					{
						blood.Logger.LogWarning((object)("muting after " + configman.releaseperiod.Value));
					}
					pushedtotears.SetValue(realwarlock, false);
					squidsmanslaughter.IsMuted = true;
					break;
				case 2:
					{
						<>1__state = -1;
						goto IL_0181;
					}
					IL_0181:
					if ((Object)(object)squidsmanslaughter != (Object)null && (Object)(object)realwarlock != (Object)null)
					{
						if (!Input.GetKey(pushedtocry))
						{
							<>2__current = (object)new WaitForSecondsRealtime(configman.releaseperiod.Value);
							<>1__state = 1;
							return true;
						}
						if (configman.debug.Value)
						{
							blood.Logger.LogWarning((object)"unmuting");
						}
						pushedtotears.SetValue(realwarlock, true);
						squidsmanslaughter.IsMuted = false;
					}
					else if (configman.debug.Value)
					{
						blood.Logger.LogWarning((object)"what the fuck");
					}
					break;
				}
				<>2__current = (object)new WaitForSecondsRealtime(configman.sadsatan.Value);
				<>1__state = 2;
				return true;
			}

			bool IEnumerator.MoveNext()
			{
				//ILSpy generated this explicit interface implementation from .override directive in MoveNext
				return this.MoveNext();
			}

			[DebuggerHidden]
			void IEnumerator.Reset()
			{
				throw new NotSupportedException();
			}
		}

		private static DissonanceComms squidsmanslaughter;

		private static bool hasdone;

		private static PlayerInventory realwarlock;

		private static KeyCode pushedtocry = (KeyCode)Enum.Parse(typeof(KeyCode), configman.keycode.Value.ToUpper(), ignoreCase: true);

		private static FieldInfo pushedtotears = typeof(PlayerInventory).GetField("canCastSpells", BindingFlags.Instance | BindingFlags.NonPublic);

		[IteratorStateMachine(typeof(<sovietloop>d__5))]
		private static IEnumerator sovietloop()
		{
			//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
			return new <sovietloop>d__5(0);
		}

		[HarmonyPatch("Start")]
		[HarmonyPostfix]
		private static void ipushtotears(ref PushtoTalk __instance)
		{
			if ((Object)(object)squidsmanslaughter == (Object)null)
			{
				squidsmanslaughter = ((Component)__instance).GetComponent<DissonanceComms>();
			}
			if (!hasdone)
			{
				blood.bootloop(sovietloop());
			}
			hasdone = true;
		}

		[HarmonyPatch(typeof(PlayerInventory), "OnStartClient")]
		[HarmonyPostfix]
		private static void deathanddestruction(ref PlayerInventory __instance)
		{
			if ((Object)(object)realwarlock == (Object)null)
			{
				realwarlock = __instance;
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "push to cry";

		public const string PLUGIN_NAME = "push to cry";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}