Decompiled source of ManuLib v1.1.3

ManuLib.dll

Decompiled 3 weeks ago
using System;
using System.Collections;
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 ManuLib.NetcodePatcher;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyTitle("ManuLib")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("ManuLib")]
[assembly: AssemblyCopyright("Copyright ©  2026")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("8127ca6d-dea7-4f68-b515-c15a3c1b11da")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")]
[assembly: AssemblyVersion("1.0.0.0")]
[module: NetcodePatchedAssembly]
namespace ManuLib
{
	public class MLCheckOnShip : MonoBehaviour
	{
		public GrabbableObject targetItem;

		public bool checkOnStart = false;

		public UnityEvent onTrue;

		public UnityEvent onFalse;

		public void CheckOnShip()
		{
			if (targetItem.isInShipRoom)
			{
				if (onTrue != null)
				{
					onTrue.Invoke();
				}
			}
			else if (onFalse != null)
			{
				onFalse.Invoke();
			}
		}

		public void Start()
		{
			if (checkOnStart)
			{
				CheckOnShip();
			}
		}
	}
	public class MLItemValueModifier : MonoBehaviour
	{
		public GrabbableObject targetItem;

		public int amountToChange = 0;

		public bool isPercentage = false;

		private double amountToChangeInternal = 0.0;

		private double amountToCheck = 0.0;

		private int originalValue = 0;

		public void AddCalculatedValue()
		{
			ResetInternalVariables();
			CalculatePercentage();
			amountToCheck += amountToChangeInternal;
			SetToValue();
		}

		public void MultiplyCalculatedValue()
		{
			ResetInternalVariables();
			CalculatePercentage();
			amountToCheck *= amountToChangeInternal;
			SetToValue();
		}

		public void SetToInputValue()
		{
			targetItem.SetScrapValue(amountToChange);
		}

		public void ResetToOriginalValue()
		{
			targetItem.SetScrapValue(originalValue);
		}

		private void CalculatePercentage()
		{
			if (isPercentage)
			{
				if (amountToChange > 0)
				{
					amountToChangeInternal *= 0.01;
				}
				else
				{
					Plugin.ManuLogger.LogWarning((object)"Rejected devision of a value equal to or lower than 0.");
				}
			}
		}

		private void SetToValue()
		{
			if (amountToCheck >= 0.0)
			{
				targetItem.SetScrapValue((int)amountToCheck);
				return;
			}
			targetItem.SetScrapValue(0);
			Plugin.ManuLogger.LogInfo((object)"Rejected a price change that would result in a negative value. Setting to 0");
		}

		private void ResetInternalVariables()
		{
			amountToCheck = targetItem.scrapValue;
			amountToChangeInternal = amountToChange;
		}

		private void Awake()
		{
			originalValue = targetItem.scrapValue;
		}
	}
	internal class MLLadderItem : GrabbableObject
	{
		private bool ladderActivated;

		private bool ladderAnimationBegun;

		private Coroutine ladderAnimationCoroutine;

		public Animator ladderAnimator;

		public Animator ladderRotateAnimator;

		public Transform baseNode;

		public Transform topNode;

		public Transform moveableNode;

		private RaycastHit hit;

		private int layerMask = 268437761;

		public AudioClip hitRoof;

		public AudioClip fullExtend;

		public AudioClip hitWall;

		public AudioClip ladderExtendSFX;

		public AudioClip ladderFallSFX;

		public AudioClip ladderShrinkSFX;

		public AudioClip blinkWarningSFX;

		public AudioClip lidOpenSFX;

		public AudioSource ladderAudio;

		public InteractTrigger ladderScript;

		private float rotateAmount;

		private float extendAmount;

		private float ladderTimer;

		private bool ladderBlinkWarning;

		public Collider interactCollider;

		public Collider bridgeCollider;

		public Collider killTrigger;

		private PlayerControllerB previousPlayerHeldBy;

		[Header("Extra stuff")]
		public float timerUntilFold = 20f;

		public bool hasUnlimitedTimer = false;

		public override void Update()
		{
			//IL_01ca: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).Update();
			if ((Object)(object)base.playerHeldBy == (Object)null && !base.isHeld && !base.isHeldByEnemy && base.reachedFloorTarget && ladderActivated)
			{
				if (!ladderAnimationBegun)
				{
					ladderTimer = 0f;
					StartLadderAnimation();
				}
				else if (ladderAnimationBegun)
				{
					if (!hasUnlimitedTimer)
					{
						ladderTimer += Time.deltaTime;
					}
					if (!ladderBlinkWarning && ladderTimer > timerUntilFold - 5f)
					{
						ladderBlinkWarning = true;
						ladderAnimator.SetBool("blinkWarning", true);
						ladderAudio.clip = blinkWarningSFX;
						ladderAudio.Play();
					}
					else if (ladderTimer >= timerUntilFold)
					{
						ladderActivated = false;
						ladderBlinkWarning = false;
						ladderAudio.Stop();
						ladderAnimator.SetBool("blinkWarning", false);
					}
				}
				return;
			}
			if (ladderAnimationBegun)
			{
				ladderAnimationBegun = false;
				ladderAudio.Stop();
				killTrigger.enabled = false;
				bridgeCollider.enabled = false;
				interactCollider.enabled = false;
				if (ladderAnimationCoroutine != null)
				{
					((MonoBehaviour)this).StopCoroutine(ladderAnimationCoroutine);
				}
				ladderAnimator.SetBool("blinkWarning", false);
				((Component)ladderAudio).transform.position = ((Component)this).transform.position;
				ladderAudio.PlayOneShot(ladderShrinkSFX);
				ladderActivated = false;
			}
			killTrigger.enabled = false;
			ladderScript.interactable = false;
			if ((Object)(object)GameNetworkManager.Instance.localPlayerController != (Object)null && (Object)(object)GameNetworkManager.Instance.localPlayerController.currentTriggerInAnimationWith == (Object)(object)ladderScript)
			{
				ladderScript.CancelAnimationExternally();
			}
			if (rotateAmount > 0f)
			{
				rotateAmount = Mathf.Max(rotateAmount - Time.deltaTime * 2f, 0f);
				ladderRotateAnimator.SetFloat("rotationAmount", rotateAmount);
			}
			else
			{
				ladderRotateAnimator.SetFloat("rotationAmount", 0f);
			}
			if (extendAmount > 0f)
			{
				extendAmount = Mathf.Max(extendAmount - Time.deltaTime * 2f, 0f);
				ladderAnimator.SetFloat("extensionAmount", extendAmount);
			}
			else
			{
				ladderAnimator.SetBool("openLid", false);
				ladderAnimator.SetBool("extend", false);
				ladderAnimator.SetFloat("extensionAmount", 0f);
			}
		}

		private void StartLadderAnimation()
		{
			ladderAnimationBegun = true;
			ladderScript.interactable = false;
			if (ladderAnimationCoroutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(ladderAnimationCoroutine);
			}
			ladderAnimationCoroutine = ((MonoBehaviour)this).StartCoroutine(LadderAnimation());
		}

		private IEnumerator LadderAnimation()
		{
			ladderAudio.volume = 1f;
			ladderScript.interactable = false;
			interactCollider.enabled = false;
			bridgeCollider.enabled = false;
			killTrigger.enabled = false;
			ladderAnimator.SetBool("openLid", false);
			ladderAnimator.SetBool("extend", false);
			yield return null;
			ladderAnimator.SetBool("openLid", true);
			((Component)ladderAudio).transform.position = ((Component)this).transform.position;
			ladderAudio.PlayOneShot(lidOpenSFX, 1f);
			RoundManager.Instance.PlayAudibleNoise(((Component)ladderAudio).transform.position, 18f, 0.8f, 0, base.isInShipRoom, 0);
			yield return (object)new WaitForSeconds(1f);
			ladderAnimator.SetBool("extend", true);
			float ladderExtendAmountNormalized = GetLadderExtensionDistance() / 9.72f;
			float ladderRotateAmountNormalized = Mathf.Clamp(GetLadderRotationDegrees(ladderExtendAmountNormalized) / -90f, 0f, 0.99f);
			ladderAudio.clip = ladderExtendSFX;
			ladderAudio.Play();
			float currentNormalizedTime = 0f;
			float speedMultiplier = 0.1f;
			while (currentNormalizedTime < ladderExtendAmountNormalized)
			{
				speedMultiplier += Time.deltaTime * 2f;
				currentNormalizedTime = Mathf.Min(currentNormalizedTime + Time.deltaTime * speedMultiplier, ladderExtendAmountNormalized);
				ladderAnimator.SetFloat("extensionAmount", currentNormalizedTime);
				yield return null;
			}
			extendAmount = currentNormalizedTime;
			interactCollider.enabled = true;
			bridgeCollider.enabled = false;
			killTrigger.enabled = false;
			ladderAudio.Stop();
			if (ladderExtendAmountNormalized == 1f)
			{
				((Component)ladderAudio).transform.position = ((Component)baseNode).transform.position + ((Component)baseNode).transform.up * 9.72f;
				ladderAudio.PlayOneShot(fullExtend, 0.7f);
				WalkieTalkie.TransmitOneShotAudio(ladderAudio, fullExtend, 0.7f);
				RoundManager.Instance.PlayAudibleNoise(((Component)ladderAudio).transform.position, 8f, 0.5f, 0, base.isInShipRoom, 0);
			}
			else
			{
				((Component)ladderAudio).transform.position = ((Component)baseNode).transform.position + ((Component)baseNode).transform.up * (ladderExtendAmountNormalized * 9.72f);
				ladderAudio.PlayOneShot(hitRoof);
				WalkieTalkie.TransmitOneShotAudio(ladderAudio, hitRoof, 1f);
				RoundManager.Instance.PlayAudibleNoise(((Component)ladderAudio).transform.position, 17f, 0.8f, 0, base.isInShipRoom, 0);
			}
			yield return (object)new WaitForSeconds(0.4f);
			ladderAudio.clip = ladderFallSFX;
			ladderAudio.Play();
			ladderAudio.volume = 0f;
			speedMultiplier = 0.15f;
			currentNormalizedTime = 0f;
			while (currentNormalizedTime < ladderRotateAmountNormalized)
			{
				speedMultiplier += Time.deltaTime * 2f;
				currentNormalizedTime = Mathf.Min(currentNormalizedTime + Time.deltaTime * speedMultiplier, ladderRotateAmountNormalized);
				if (ladderExtendAmountNormalized > 0.6f && currentNormalizedTime > 0.5f)
				{
					killTrigger.enabled = true;
				}
				ladderAudio.volume = Mathf.Min(ladderAudio.volume + Time.deltaTime * 1.75f, 1f);
				ladderRotateAnimator.SetFloat("rotationAmount", currentNormalizedTime);
				yield return null;
			}
			rotateAmount = ladderRotateAmountNormalized;
			ladderAudio.volume = 1f;
			ladderAudio.Stop();
			((Component)ladderAudio).transform.position = ((Component)moveableNode).transform.position;
			ladderAudio.PlayOneShot(hitWall, Mathf.Min(ladderRotateAmountNormalized + 0.3f, 1f));
			RoundManager.Instance.PlayAudibleNoise(((Component)ladderAudio).transform.position, 18f, 0.7f, 0, base.isInShipRoom, 0);
			if (ladderRotateAmountNormalized * 90f < 45f)
			{
				ladderScript.interactable = true;
				interactCollider.enabled = true;
			}
			else
			{
				bridgeCollider.enabled = true;
			}
			killTrigger.enabled = false;
		}

		private float GetLadderExtensionDistance()
		{
			//IL_000c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			if (Physics.Raycast(((Component)baseNode).transform.position, Vector3.up, ref hit, 9.72f, layerMask, (QueryTriggerInteraction)1))
			{
				return ((RaycastHit)(ref hit)).distance;
			}
			return 9.72f;
		}

		private float GetLadderRotationDegrees(float topOfLadder)
		{
			//IL_002e: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_005a: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_007a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0085: Unknown result type (might be due to invalid IL or missing references)
			//IL_0092: Unknown result type (might be due to invalid IL or missing references)
			float num = 90f;
			for (int num2 = 4; num2 >= 1; num2--)
			{
				float num3 = 2.43f * (float)num2;
				((Component)moveableNode).transform.localPosition = new Vector3(0f, num3, 0f);
				baseNode.localEulerAngles = Vector3.zero;
				for (int i = 1; (float)i < timerUntilFold; i++)
				{
					Vector3 position = ((Component)moveableNode).transform.position;
					baseNode.localEulerAngles = new Vector3((float)(-i) * 4.5f, 0f, 0f);
					if (Physics.Linecast(position, ((Component)moveableNode).transform.position, layerMask, (QueryTriggerInteraction)1))
					{
						float num4 = (float)(i - 1) * 4.5f;
						if (num4 < num)
						{
							num = num4;
						}
						break;
					}
				}
				if (num < 12f)
				{
					break;
				}
			}
			return 0f - num;
		}

		public override void DiscardItem()
		{
			previousPlayerHeldBy = base.playerHeldBy;
			((GrabbableObject)this).DiscardItem();
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
		}

		public override void DiscardItemFromEnemy()
		{
			((GrabbableObject)this).DiscardItemFromEnemy();
			ladderActivated = true;
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0026: Unknown result type (might be due to invalid IL or missing references)
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			ladderActivated = true;
			if (((NetworkBehaviour)this).IsOwner)
			{
				base.playerHeldBy.DiscardHeldObject(false, (NetworkObject)null, default(Vector3), true);
			}
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			((GrabbableObject)this).__initializeRpcs();
		}

		protected internal override string __getTypeName()
		{
			return "MLLadderItem";
		}
	}
	internal class MLObjectEviscerator : MonoBehaviour
	{
		public GameObject ObjectToDestroy;

		public void DestroyObject()
		{
			if ((Object)(object)ObjectToDestroy != (Object)null)
			{
				NetworkObject val = default(NetworkObject);
				if (ObjectToDestroy.TryGetComponent<NetworkObject>(ref val) && val.IsSpawned)
				{
					if (val.NetworkManager.IsHost)
					{
						val.Despawn(true);
					}
				}
				else
				{
					Object.Destroy((Object)(object)ObjectToDestroy);
				}
			}
			else
			{
				Plugin.ManuLogger.LogWarning((object)"Rejected destruction of a null gameobject.");
			}
		}
	}
	internal class MLObjectSpawner : MonoBehaviour
	{
		public GameObject gameObjectToSpawn = null;

		public bool spawnOnEnable = false;

		public void SpawnShit()
		{
			//IL_003b: 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)
			if ((Object)(object)RoundManager.Instance != (Object)null && (((NetworkBehaviour)RoundManager.Instance).IsHost || ((NetworkBehaviour)RoundManager.Instance).IsServer))
			{
				GameObject val = Object.Instantiate<GameObject>(gameObjectToSpawn, ((Component)this).transform.position, ((Component)this).transform.rotation, ((Object)(object)RoundManager.Instance.mapPropsContainer != (Object)null) ? RoundManager.Instance.mapPropsContainer.transform : null);
				val.GetComponent<NetworkObject>().Spawn(true);
			}
		}

		private void OnEnable()
		{
			if (spawnOnEnable)
			{
				SpawnShit();
			}
		}
	}
	public class MLPrintStewie : MonoBehaviour
	{
		public void PrintStewie()
		{
			ManualLogSource manuLogger = Plugin.ManuLogger;
			if (manuLogger != null)
			{
				manuLogger.LogInfo((object)" ");
			}
			ManualLogSource manuLogger2 = Plugin.ManuLogger;
			if (manuLogger2 != null)
			{
				manuLogger2.LogInfo((object)"                       gggÞÇÇ6ÞÇÇÞggg   ");
			}
			ManualLogSource manuLogger3 = Plugin.ManuLogger;
			if (manuLogger3 != null)
			{
				manuLogger3.LogInfo((object)"                 ggGÞü3llll****l****‡63Þg    ");
			}
			ManualLogSource manuLogger4 = Plugin.ManuLogger;
			if (manuLogger4 != null)
			{
				manuLogger4.LogInfo((object)"               GÞ6‡‡l*******************lüGg    ");
			}
			ManualLogSource manuLogger5 = Plugin.ManuLogger;
			if (manuLogger5 != null)
			{
				manuLogger5.LogInfo((object)"             gÞ3ül************************llÞg    ");
			}
			ManualLogSource manuLogger6 = Plugin.ManuLogger;
			if (manuLogger6 != null)
			{
				manuLogger6.LogInfo((object)"           gG3‡l***3l************************3g   ");
			}
			ManualLogSource manuLogger7 = Plugin.ManuLogger;
			if (manuLogger7 != null)
			{
				manuLogger7.LogInfo((object)"          g6‡‡l*******‡‡ü3*******************l*üg ");
			}
			ManualLogSource manuLogger8 = Plugin.ManuLogger;
			if (manuLogger8 != null)
			{
				manuLogger8.LogInfo((object)"        G6ü3‡l***‡üül*363**************3üü3‡ll**lG   ");
			}
			ManualLogSource manuLogger9 = Plugin.ManuLogger;
			if (manuLogger9 != null)
			{
				manuLogger9.LogInfo((object)"        Þü6‡‡l**ü‡l*****l6*************‡6l*l6‡***üÞ  ");
			}
			ManualLogSource manuLogger10 = Plugin.ManuLogger;
			if (manuLogger10 != null)
			{
				manuLogger10.LogInfo((object)"        ggÞ3‡l*lü***6GÞÞÇ63***********ü‡*****l6***6g ");
			}
			ManualLogSource manuLogger11 = Plugin.ManuLogger;
			if (manuLogger11 != null)
			{
				manuLogger11.LogInfo((object)"          G3‡l**6**\u00af\u00af\u00af\u00af\u00af\u00afül******ül**lü‡l‡Þ33üÇl***3Ç");
			}
			ManualLogSource manuLogger12 = Plugin.ManuLogger;
			if (manuLogger12 != null)
			{
				manuLogger12.LogInfo((object)"           Þ3‡l**ü‡\u00af\u00af\u00af\u00af*3l*******lü***3*\u00af\u00af\u00af\u00af\u00af\u00af6l**‡3Ç");
			}
			ManualLogSource manuLogger13 = Plugin.ManuLogger;
			if (manuLogger13 != null)
			{
				manuLogger13.LogInfo((object)"            g63l***l33‡******‡***3l***l6l\u00af\u00af\u00aflü***3G  ");
			}
			ManualLogSource manuLogger14 = Plugin.ManuLogger;
			if (manuLogger14 != null)
			{
				manuLogger14.LogInfo((object)"              gLJl************l3Þ63******lll***lÞg   ");
			}
			ManualLogSource manuLogger15 = Plugin.ManuLogger;
			if (manuLogger15 != null)
			{
				manuLogger15.LogInfo((object)"                gÞül*************************lÇG   ");
			}
			ManualLogSource manuLogger16 = Plugin.ManuLogger;
			if (manuLogger16 != null)
			{
				manuLogger16.LogInfo((object)"                   gÞ63l******************‡üÞg       ");
			}
			ManualLogSource manuLogger17 = Plugin.ManuLogger;
			if (manuLogger17 != null)
			{
				manuLogger17.LogInfo((object)"                     g63üÞÇü3‡‡‡ll‡‡‡3ü6Gg           ");
			}
			ManualLogSource manuLogger18 = Plugin.ManuLogger;
			if (manuLogger18 != null)
			{
				manuLogger18.LogInfo((object)"                     Þ‡‡‡3ÞÇÞ‡36üÞÇÇ**‡G      ");
			}
			ManualLogSource manuLogger19 = Plugin.ManuLogger;
			if (manuLogger19 != null)
			{
				manuLogger19.LogInfo((object)"                    gü‡l***3‡***6Ç63l**Ç        ");
			}
			ManualLogSource manuLogger20 = Plugin.ManuLogger;
			if (manuLogger20 != null)
			{
				manuLogger20.LogInfo((object)"                    g3‡‡*******‡Ç‡*****Þ    ");
			}
			ManualLogSource manuLogger21 = Plugin.ManuLogger;
			if (manuLogger21 != null)
			{
				manuLogger21.LogInfo((object)"                    g63663‡l‡üÇÇÞ‡ll‡üÞ     ");
			}
			ManualLogSource manuLogger22 = Plugin.ManuLogger;
			if (manuLogger22 != null)
			{
				manuLogger22.LogInfo((object)"                    GÞÞÞÇÇÞÞÇÇÇÇÇÇÇÇÇÇg    ");
			}
			ManualLogSource manuLogger23 = Plugin.ManuLogger;
			if (manuLogger23 != null)
			{
				manuLogger23.LogInfo((object)"                    GÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇ6g   ");
			}
			ManualLogSource manuLogger24 = Plugin.ManuLogger;
			if (manuLogger24 != null)
			{
				manuLogger24.LogInfo((object)"                    GÞÇÇÇÇÇÇÇÇÇÇÇÇÇÇ66g ");
			}
			ManualLogSource manuLogger25 = Plugin.ManuLogger;
			if (manuLogger25 != null)
			{
				manuLogger25.LogInfo((object)"                    gGÇÞÇÇÇÇÇÇÇÇÇÇÇÇüG    ");
			}
			ManualLogSource manuLogger26 = Plugin.ManuLogger;
			if (manuLogger26 != null)
			{
				manuLogger26.LogInfo((object)"                     gÞÇÇÇÇÇÇÇÇÞÇÇÇÇÇg   ");
			}
			ManualLogSource manuLogger27 = Plugin.ManuLogger;
			if (manuLogger27 != null)
			{
				manuLogger27.LogInfo((object)"                     gÞÞÇÇÇÇÇ6ÞÇÇÇÇÇÇg   ");
			}
			ManualLogSource manuLogger28 = Plugin.ManuLogger;
			if (manuLogger28 != null)
			{
				manuLogger28.LogInfo((object)"                     gÞÞÞÞÇ6üü6ÞÇ63‡llüG       ");
			}
			ManualLogSource manuLogger29 = Plugin.ManuLogger;
			if (manuLogger29 != null)
			{
				manuLogger29.LogInfo((object)"                     Þ333‡llllll6‡lllllüg    ");
			}
			ManualLogSource manuLogger30 = Plugin.ManuLogger;
			if (manuLogger30 != null)
			{
				manuLogger30.LogInfo((object)"                     gÞü3l‡ll‡‡3Þgggggg  ");
			}
			ManualLogSource manuLogger31 = Plugin.ManuLogger;
			if (manuLogger31 != null)
			{
				manuLogger31.LogInfo((object)" ");
			}
		}
	}
	public class MLRunOnHost : MonoBehaviour
	{
		public UnityEvent OnHost = new UnityEvent();

		public UnityEvent OnClient = new UnityEvent();

		public void CheckClient()
		{
			if ((Object)(object)RoundManager.Instance != (Object)null)
			{
				if (((NetworkBehaviour)RoundManager.Instance).IsHost || ((NetworkBehaviour)RoundManager.Instance).IsServer)
				{
					OnHost.Invoke();
				}
			}
			else
			{
				OnClient.Invoke();
			}
		}
	}
	internal class MLRunOnWakeup : MonoBehaviour
	{
		public bool runOnAwake = false;

		public bool runOnStart = false;

		public bool runOnEnable = false;

		public bool runOnDisable = false;

		public UnityEvent onWakeup;

		public UnityEvent onDisable;

		private void Awake()
		{
			if (runOnAwake && onWakeup != null)
			{
				onWakeup.Invoke();
				ManualLogSource manuLogger = Plugin.ManuLogger;
				if (manuLogger != null)
				{
					manuLogger.LogInfo((object)"Run on awake attempted.");
				}
			}
		}

		private void Start()
		{
			if (runOnStart && onWakeup != null)
			{
				onWakeup.Invoke();
				ManualLogSource manuLogger = Plugin.ManuLogger;
				if (manuLogger != null)
				{
					manuLogger.LogInfo((object)"Run on start attempted.");
				}
			}
		}

		private void OnEnable()
		{
			if (runOnEnable && onWakeup != null)
			{
				onWakeup.Invoke();
				ManualLogSource manuLogger = Plugin.ManuLogger;
				if (manuLogger != null)
				{
					manuLogger.LogInfo((object)"Run on enable attempted.");
				}
			}
		}

		private void OnDisable()
		{
			if (runOnDisable && onDisable != null)
			{
				onDisable.Invoke();
				ManualLogSource manuLogger = Plugin.ManuLogger;
				if (manuLogger != null)
				{
					manuLogger.LogInfo((object)"Run on disable attempted.");
				}
			}
		}
	}
	internal class MLTheRockAudio : MonoBehaviour
	{
		public AudioSource speedBasedAudio;

		public EnemyAI thumperAI;

		private double amountToMultiply = 0.07;

		public void Update()
		{
			if ((double)thumperAI.agent.speed * amountToMultiply < 1.0)
			{
				speedBasedAudio.volume = (float)((double)thumperAI.agent.speed * amountToMultiply);
			}
			else
			{
				speedBasedAudio.volume = 1f;
			}
		}
	}
	[BepInPlugin("GenericGMD.ManuLib", "ManuLib", "1.0.0")]
	public class Plugin : BaseUnityPlugin
	{
		internal static ManualLogSource ManuLogger;

		private void Awake()
		{
			ManuLogger = ((BaseUnityPlugin)this).Logger;
			ManuLogger.LogInfo((object)"ManuLib loaded. Printing Stewie.");
			ManuLogger.LogInfo((object)" ");
			ManuLogger.LogInfo((object)"                       gggÞÇÇ6ÞÇÇÞggg   ");
			ManuLogger.LogInfo((object)"                 ggGÞü3llll****l****‡63Þg    ");
			ManuLogger.LogInfo((object)"               GÞ6‡‡l*******************lüGg    ");
			ManuLogger.LogInfo((object)"             gÞ3ül************************llÞg    ");
			ManuLogger.LogInfo((object)"           gG3‡l***3l************************3g   ");
			ManuLogger.LogInfo((object)"          g6‡‡l*******‡‡ü3*******************l*üg ");
			ManuLogger.LogInfo((object)"        G6ü3‡l***‡üül*363**************3üü3‡ll**lG   ");
			ManuLogger.LogInfo((object)"        Þü6‡‡l**ü‡l*****l6*************‡6l*l6‡***üÞ  ");
			ManuLogger.LogInfo((object)"        ggÞ3‡l*lü***6GÞÞÇ63***********ü‡*****l6***6g ");
			ManuLogger.LogInfo((object)"          G3‡l**6**\u00af\u00af\u00af\u00af\u00af\u00afül******ül**lü‡l‡Þ33üÇl***3Ç");
			ManuLogger.LogInfo((object)"           Þ3‡l**ü‡\u00af\u00af\u00af\u00af*3l*******lü***3*\u00af\u00af\u00af\u00af\u00af\u00af6l**‡3Ç");
			ManuLogger.LogInfo((object)"            g63l***l33‡******‡***3l***l6l\u00af\u00af\u00aflü***3G  ");
			ManuLogger.LogInfo((object)"              gLJl************l3Þ63******lll***lÞg   ");
			ManuLogger.LogInfo((object)"                gÞül*************************lÇG   ");
			ManuLogger.LogInfo((object)"                   gÞ63l******************‡üÞg       ");
			ManuLogger.LogInfo((object)"                     g63üÞÇü3‡‡‡ll‡‡‡3ü6Gg           ");
			ManuLogger.LogInfo((object)"                     Þ‡‡‡3ÞÇÞ‡36üÞÇÇ**‡G      ");
			ManuLogger.LogInfo((object)"                    gü‡l***3‡***6Ç63l**Ç        ");
			ManuLogger.LogInfo((object)"                    g3‡‡*******‡Ç‡*****Þ    ");
			ManuLogger.LogInfo((object)"                    g63663‡l‡üÇÇÞ‡ll‡üÞ     ");
			ManuLogger.LogInfo((object)"                    GÞÞÞÇÇÞÞÇÇÇÇÇÇÇÇÇÇg    ");
			ManuLogger.LogInfo((object)"                    GÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇÇ6g   ");
			ManuLogger.LogInfo((object)"                    GÞÇÇÇÇÇÇÇÇÇÇÇÇÇÇ66g ");
			ManuLogger.LogInfo((object)"                    gGÇÞÇÇÇÇÇÇÇÇÇÇÇÇüG    ");
			ManuLogger.LogInfo((object)"                     gÞÇÇÇÇÇÇÇÇÞÇÇÇÇÇg   ");
			ManuLogger.LogInfo((object)"                     gÞÞÇÇÇÇÇ6ÞÇÇÇÇÇÇg   ");
			ManuLogger.LogInfo((object)"                     gÞÞÞÞÇ6üü6ÞÇ63‡llüG       ");
			ManuLogger.LogInfo((object)"                     Þ333‡llllll6‡lllllüg    ");
			ManuLogger.LogInfo((object)"                     gÞü3l‡ll‡‡3Þgggggg  ");
			ManuLogger.LogInfo((object)" ");
			ManuLogger.LogInfo((object)"Print sucessful. Enjoy your Stewie.");
		}
	}
	public class MLKeyItem : GrabbableObject
	{
		[Header("Extra stuff")]
		public bool hasLimitedUses = true;

		public int totalUses = 1;

		public bool destroyAfterUses = true;

		private int currentUses = 0;

		public UnityEvent OnUse = new UnityEvent();

		public UnityEvent OnFinalUse = new UnityEvent();

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_003c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0041: Unknown result type (might be due to invalid IL or missing references)
			RaycastHit val = default(RaycastHit);
			if ((Object)(object)base.playerHeldBy == (Object)null || !((NetworkBehaviour)this).IsOwner || !Physics.Raycast(new Ray(((Component)base.playerHeldBy.gameplayCamera).transform.position, ((Component)base.playerHeldBy.gameplayCamera).transform.forward), ref val, 3f, 2816))
			{
				return;
			}
			DoorLock val2 = ((Component)((RaycastHit)(ref val)).transform).GetComponent<DoorLock>();
			if ((Object)(object)val2 == (Object)null)
			{
				TriggerPointToDoor component = ((Component)((RaycastHit)(ref val)).transform).GetComponent<TriggerPointToDoor>();
				if ((Object)(object)component != (Object)null)
				{
					val2 = component.pointToDoor;
				}
			}
			if (!((Object)(object)val2 != (Object)null) || !val2.isLocked || val2.isPickingLock)
			{
				return;
			}
			if (currentUses < totalUses)
			{
				if (hasLimitedUses)
				{
					UseKeyRpc();
					currentUses++;
				}
				if (OnUse != null)
				{
					OnUse.Invoke();
				}
				val2.UnlockDoorSyncWithServer();
				if (currentUses == totalUses)
				{
					if (OnFinalUse != null)
					{
						OnFinalUse.Invoke();
					}
					if (destroyAfterUses)
					{
						base.playerHeldBy.DespawnHeldObject();
					}
				}
			}
			else
			{
				ManualLogSource manuLogger = Plugin.ManuLogger;
				if (manuLogger != null)
				{
					manuLogger.LogInfo((object)"Tried to unlock a door with no uses remaining.");
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		private void UseKeyRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0096: Invalid comparison between Unknown and I4
			//IL_0043: Unknown result type (might be due to invalid IL or missing references)
			//IL_004b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0064: 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)
			//IL_0077: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val3 = default(RpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendRpc(1872595951u, val3, val, (SendTo)5, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val2, 1872595951u, val3, val, (SendTo)5, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1)
				{
					((NetworkBehaviour)this).__rpc_exec_stage = (__RpcExecStage)0;
					currentUses++;
				}
			}
		}

		protected override void __initializeVariables()
		{
			((GrabbableObject)this).__initializeVariables();
		}

		protected override void __initializeRpcs()
		{
			//IL_000d: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1872595951u, new RpcReceiveHandler(__rpc_handler_1872595951), "UseKeyRpc");
			((GrabbableObject)this).__initializeRpcs();
		}

		private static void __rpc_handler_1872595951(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_003f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((MLKeyItem)(object)target).UseKeyRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "MLKeyItem";
		}
	}
}
namespace __GEN
{
	internal class NetworkVariableSerializationHelper
	{
		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeSerialization()
		{
		}
	}
}
namespace ManuLib.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}