Decompiled source of ThumpingReactor v1.0.2

ThumpingReactor.dll

Decompiled 4 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
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 FishNet;
using FishNet.Connection;
using FishNet.Managing.Server;
using FishNet.Object;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
using UnityEngine.SceneManagement;

[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("ThumpingReactor")]
[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.ThumpingReactor", "ThumpingReactor", "1.0.0")]
	[BepInProcess("MageArena.exe")]
	public class blood : BaseUnityPlugin
	{
		public static ManualLogSource Logger;

		public const string guid = "murderminemurderer.ThumpingReactor";

		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)"ThumpingReactor loaded");
			configman.dotheconfig(((BaseUnityPlugin)this).Config);
			new Harmony("murderminemurderer.ThumpingReactor").PatchAll();
			bootloop = ((MonoBehaviour)this).StartCoroutine;
		}
	}
	public static class configman
	{
		public static ConfigEntry<float> livefastdie;

		public static ConfigEntry<float> liveslowdie;

		public static ConfigEntry<bool> soupapply;

		public static ConfigEntry<float> soupcd;

		public static void dotheconfig(ConfigFile config)
		{
			string text = "thumpingreactor";
			livefastdie = config.Bind<float>(text, "livefastdie", 7f, "thrumming loop cd");
			liveslowdie = config.Bind<float>(text, "liveslowdie", 3f, "thrumming lifetime before despawning");
			soupapply = config.Bind<bool>(text, "soupapply", true, "give crystal soup automatically to cryreact user?");
			soupcd = config.Bind<float>(text, "soupcd", 180f, "crystal soup cd");
		}
	}
	[HarmonyPatch(typeof(PlayerInventory))]
	public class tryingtomanipulateme
	{
		[CompilerGenerated]
		private sealed class <thump>d__12 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public GameObject obj;

			private float <last_soup>5__1;

			private GameObject <bigfoot>5__2;

			private PlayerInventory <hascomponent>5__3;

			private PlayerMovement <pm>5__4;

			private GameObject <playerparent>5__5;

			private ThrummingStoneController <irongiant>5__6;

			private GameObject <tokillamockingbird>5__7;

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

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

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

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<bigfoot>5__2 = null;
				<hascomponent>5__3 = null;
				<pm>5__4 = null;
				<playerparent>5__5 = null;
				<irongiant>5__6 = null;
				<tokillamockingbird>5__7 = null;
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_005c: Unknown result type (might be due to invalid IL or missing references)
				//IL_0061: Unknown result type (might be due to invalid IL or missing references)
				//IL_0066: Unknown result type (might be due to invalid IL or missing references)
				//IL_006d: Unknown result type (might be due to invalid IL or missing references)
				//IL_0073: Unknown result type (might be due to invalid IL or missing references)
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					<last_soup>5__1 = -999f;
					goto IL_02a6;
				case 1:
					<>1__state = -1;
					try
					{
						makelifefunagain.Invoke(<irongiant>5__6, Array.Empty<object>());
					}
					catch (Exception)
					{
					}
					goto IL_022c;
				case 2:
					<>1__state = -1;
					try
					{
						servman.Despawn(<bigfoot>5__2, (DespawnType?)(DespawnType)0);
					}
					catch (Exception)
					{
					}
					<>2__current = livefastdie;
					<>1__state = 3;
					return true;
				case 3:
					{
						<>1__state = -1;
						<bigfoot>5__2 = null;
						<hascomponent>5__3 = null;
						<pm>5__4 = null;
						<playerparent>5__5 = null;
						<irongiant>5__6 = null;
						goto IL_02a6;
					}
					IL_02a6:
					if (!((Object)(object)thumper != (Object)null) || !((Object)(object)obj != (Object)null) || !((Object)(object)obj != (Object)null))
					{
						break;
					}
					<bigfoot>5__2 = spawnat(thumper, obj.transform.position + downvect);
					try
					{
						<playerparent>5__5 = ((Component)obj.transform.parent.parent).gameObject;
					}
					catch (Exception)
					{
						break;
					}
					<playerparent>5__5.TryGetComponent<PlayerInventory>(ref <hascomponent>5__3);
					<playerparent>5__5.TryGetComponent<PlayerMovement>(ref <pm>5__4);
					<bigfoot>5__2.transform.parent = <playerparent>5__5.transform;
					if (<bigfoot>5__2.TryGetComponent<ThrummingStoneController>(ref <irongiant>5__6))
					{
						if ((Object)(object)<hascomponent>5__3 != (Object)null && (Object)(object)<pm>5__4 != (Object)null)
						{
							littlebylittle.SetValue(<irongiant>5__6, <hascomponent>5__3);
							<tokillamockingbird>5__7 = findthechild(<playerparent>5__5, "cryreaction");
							if (configman.soupapply.Value && Time.time - <last_soup>5__1 > configman.soupcd.Value && (!Object.op_Implicit((Object)(object)<tokillamockingbird>5__7) || (Object)(object)<tokillamockingbird>5__7 == (Object)(object)obj))
							{
								((Object)obj).name = "cryreaction";
								try
								{
									bitbybit.Invoke(<pm>5__4, new object[1] { 0 });
								}
								catch (Exception)
								{
								}
								<last_soup>5__1 = Time.time;
							}
							<tokillamockingbird>5__7 = null;
						}
						<>2__current = livelifelessly;
						<>1__state = 1;
						return true;
					}
					goto IL_022c;
					IL_022c:
					<>2__current = liveslowdie;
					<>1__state = 2;
					return true;
				}
				return false;
			}

			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 GameObject thumper;

		private static ServerManager servman;

		private static MethodInfo makelifefunagain = typeof(ThrummingStoneController).GetMethod("ServerMakeSphere", BindingFlags.Instance | BindingFlags.NonPublic);

		private static FieldInfo littlebylittle = typeof(ThrummingStoneController).GetField("pinv", BindingFlags.Instance | BindingFlags.NonPublic);

		private static MethodInfo bitbybit = typeof(PlayerMovement).GetMethod("ObsDrinkSoup", BindingFlags.Instance | BindingFlags.NonPublic);

		private static WaitForSeconds livefastdie = new WaitForSeconds(configman.livefastdie.Value);

		private static WaitForSeconds liveslowdie = new WaitForSeconds(configman.liveslowdie.Value);

		private static WaitForSecondsRealtime livelifelessly = new WaitForSecondsRealtime(0.1f);

		private static Vector3 downvect = new Vector3(0f, -4f, 0f);

		private static GameObject spawnat(GameObject orig, Vector3 pos, Vector3 scale = default(Vector3))
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0018: Unknown result type (might be due to invalid IL or missing references)
			//IL_001e: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			GameObject val = Object.Instantiate<GameObject>(orig);
			val.transform.position = pos;
			if (scale != default(Vector3))
			{
				val.transform.localScale = scale;
			}
			servman.Spawn(val, (NetworkConnection)null, default(Scene));
			return val;
		}

		private static void findthumper()
		{
			GameObject[] array = Resources.FindObjectsOfTypeAll<GameObject>();
			GameObject[] array2 = array;
			foreach (GameObject val in array2)
			{
				if (((Object)val).name.Contains("Thrumming") && !Object.op_Implicit((Object)(object)thumper))
				{
					thumper = val;
				}
			}
		}

		public static GameObject findthechild(GameObject fromGameObject, string withName)
		{
			Transform[] componentsInChildren = fromGameObject.GetComponentsInChildren<Transform>();
			Transform val = ((IEnumerable<Transform>)componentsInChildren).FirstOrDefault((Func<Transform, bool>)((Transform k) => ((Object)((Component)k).gameObject).name == withName));
			if ((Object)(object)val == (Object)null)
			{
				return null;
			}
			return ((Component)val).gameObject;
		}

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

		[HarmonyPatch("RpcLogic___GiveDuendeServer_1289298000")]
		[HarmonyPostfix]
		public static void crystalizedtears(GameObject obj)
		{
			if (((Object)obj).name.ToLower().Contains("crystalre") && obj.layer != 7 && ((Object)((Component)obj.transform.parent).gameObject).name == "pikupact")
			{
				if ((Object)(object)servman == (Object)null)
				{
					servman = InstanceFinder.ServerManager;
				}
				if (!Object.op_Implicit((Object)(object)thumper) || (Object)(object)thumper == (Object)null)
				{
					findthumper();
				}
				blood.bootloop(thump(obj));
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ThumpingReactor";

		public const string PLUGIN_NAME = "ThumpingReactor";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}