Decompiled source of LethalGoat v1.0.6

LethalGoat.dll

Decompiled 10 months ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using GameNetcodeStuff;
using HarmonyLib;
using LethalLib.Extras;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using On;
using Unity.Netcode;
using Unity.Netcode.Components;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.InputSystem.Controls;
using UnityEngine.Video;

[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("LethalGoat")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("A plugin based around the vtuber Yuchi")]
[assembly: AssemblyFileVersion("1.0.6.0")]
[assembly: AssemblyInformationalVersion("1.0.6")]
[assembly: AssemblyProduct("LethalGoat")]
[assembly: AssemblyTitle("LethalGoat")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.6.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
internal class <Module>
{
	static <Module>()
	{
	}
}
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 LethalGoat
{
	public class Bongoat : GrabbableObject
	{
		private enum Clips
		{
			Pickup,
			PickupYuchi,
			Interact,
			InteractYuchi,
			Shower,
			ShowerYuchi,
			Rare,
			RareYuchi,
			HoarderBug,
			Fail,
			PickupSonack,
			PickupLeon
		}

		public AudioSource audioSource;

		public BoxCollider boxCollider;

		[Header("Base SFX")]
		public AudioClip[] pickupSFX;

		public AudioClip[] dropSFX;

		public AudioClip[] interactSFX;

		public AudioClip[] showerSFX;

		public AudioClip rareSFX;

		[Header("Yuchi SFX")]
		public AudioClip[] pickupYuchiSFX;

		public AudioClip[] dropYuchiSFX;

		public AudioClip[] interactYuchiSFX;

		public AudioClip[] showerYuchiSFX;

		public AudioClip rareYuchiSFX;

		[Space(3f)]
		public AudioClip yuchiBdayStartSFX;

		public AudioClip yuchiBdayEndSFX;

		public GameObject partyHat;

		[Header("Misc SFX")]
		public AudioClip[] hoarderBugSFX;

		public AudioClip sellSFX;

		public AudioClip[] quotaFailSFX;

		[Header("Special SFX")]
		public AudioClip sonackSFX;

		public AudioClip sinSFX;

		public AudioClip leonSFX;

		[Header("Sonack Toilet")]
		public AudioClip[] sonackToiletSFX;

		private Random random;

		private int lastRandomNumber = -1;

		private bool pickedUpFirstTime = false;

		private bool tookShower = false;

		private bool didBirthdayEvent = false;

		private bool blockingAudioSource = false;

		private int flushCount = 0;

		private VideoPlayer videoPlayer;

		private readonly Dictionary<Clips, AudioClip[]> clipMap = new Dictionary<Clips, AudioClip[]>();

		public override void Start()
		{
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_013c: Expected O, but got Unknown
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			//IL_014e: Expected O, but got Unknown
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_0160: Expected O, but got Unknown
			((GrabbableObject)this).Start();
			random = new Random(DateTime.Now.Millisecond);
			clipMap.Add(Clips.Interact, interactSFX);
			clipMap.Add(Clips.InteractYuchi, interactYuchiSFX);
			clipMap.Add(Clips.Pickup, pickupSFX);
			clipMap.Add(Clips.PickupYuchi, pickupYuchiSFX);
			clipMap.Add(Clips.Shower, showerSFX);
			clipMap.Add(Clips.ShowerYuchi, showerYuchiSFX);
			clipMap.Add(Clips.Fail, quotaFailSFX);
			clipMap.Add(Clips.HoarderBug, hoarderBugSFX);
			clipMap.Add(Clips.PickupSonack, (AudioClip[])(object)new AudioClip[1] { sonackSFX });
			clipMap.Add(Clips.PickupLeon, (AudioClip[])(object)new AudioClip[1] { leonSFX });
			clipMap.Add(Clips.Rare, (AudioClip[])(object)new AudioClip[1] { rareSFX });
			clipMap.Add(Clips.RareYuchi, (AudioClip[])(object)new AudioClip[1] { rareYuchiSFX });
			StartOfRound.playersFiredGameOver += new hook_playersFiredGameOver(OnPlayersFired);
			CleanPlayerBodyTrigger.OnTriggerStay += new hook_OnTriggerStay(ShowerTriggerStay);
			InteractTrigger.Interact += new hook_Interact(OnInteractTrigger);
		}

		public override void OnDestroy()
		{
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0019: Expected O, but got Unknown
			//IL_0021: Unknown result type (might be due to invalid IL or missing references)
			//IL_002b: Expected O, but got Unknown
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			//IL_003d: Expected O, but got Unknown
			((NetworkBehaviour)this).OnDestroy();
			StartOfRound.playersFiredGameOver -= new hook_playersFiredGameOver(OnPlayersFired);
			CleanPlayerBodyTrigger.OnTriggerStay -= new hook_OnTriggerStay(ShowerTriggerStay);
			InteractTrigger.Interact -= new hook_Interact(OnInteractTrigger);
		}

		private IEnumerator OnPlayersFired(orig_playersFiredGameOver orig, StartOfRound self, bool abridgedVersion)
		{
			PlayRandomAudio(Clips.Fail);
			yield return orig.Invoke(self, abridgedVersion);
		}

		private void ShowerTriggerStay(orig_OnTriggerStay orig, CleanPlayerBodyTrigger self, Collider other)
		{
			PlayerControllerB component = ((Component)other).gameObject.GetComponent<PlayerControllerB>();
			if (((NetworkBehaviour)this).IsOwner && (Object)(object)component != (Object)null && (Object)(object)other != (Object)null && (Object)(object)base.playerHeldBy != (Object)null && (Object)(object)((Component)other).gameObject == (Object)(object)((Component)base.playerHeldBy).gameObject)
			{
				if (Traverse.Create((object)self).Field<bool>("enableCleaning").Value)
				{
					PlayShowerSFX();
				}
				else
				{
					tookShower = false;
				}
			}
			orig.Invoke(self, other);
		}

		private void OnInteractTrigger(orig_Interact orig, InteractTrigger self, Transform playerTransform)
		{
			try
			{
				if (((NetworkBehaviour)this).IsOwner && (Object)(object)playerTransform != (Object)null && (Object)(object)((Component)self).transform.parent != (Object)null && ((Object)((Component)((Component)self).transform.parent).gameObject).name.Contains("Toilet"))
				{
					PlayerControllerB component = ((Component)playerTransform).gameObject.GetComponent<PlayerControllerB>();
					if ((Object)(object)component != (Object)null && ((NetworkBehaviour)this).IsOwner && (Object)(object)component == (Object)(object)base.playerHeldBy && IsHeldBySonack())
					{
						((MonoBehaviour)this).Invoke("ToiletFlushedServerRpc", 1.5f);
					}
				}
			}
			catch (Exception ex)
			{
				Plugin.Log.LogError((object)ex);
			}
			orig.Invoke(self, playerTransform);
		}

		[ServerRpc(RequireOwnership = false)]
		private void ToiletFlushedServerRpc()
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3814899577u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3814899577u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
			{
				if (flushCount < sonackToiletSFX.Length - 2)
				{
					ToiletFlushedClientRpc(flushCount);
					flushCount++;
				}
				else
				{
					ToiletSequenceClientRpc();
					flushCount = 0;
				}
			}
		}

		[ClientRpc]
		private void ToiletFlushedClientRpc(int count)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_0099: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a3: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_0089: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(374989997u, val, (RpcDelivery)0);
					BytePacker.WriteValueBitPacked(val2, count);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 374989997u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					PlayAudio(sonackToiletSFX[count]);
				}
			}
		}

		[ClientRpc]
		private void ToiletSequenceClientRpc()
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1339658752u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1339658752u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlayAudio(sonackToiletSFX[9]);
				if (((NetworkBehaviour)this).IsOwner)
				{
					((MonoBehaviour)this).StartCoroutine(ToiletSequence());
				}
			}
		}

		private IEnumerator ToiletSequence()
		{
			while (audioSource.isPlaying)
			{
				yield return null;
			}
			yield return (object)new WaitForSeconds(0.5f);
			base.playerHeldBy.inSpecialInteractAnimation = true;
			videoPlayer = ((Component)this).gameObject.AddComponent<VideoPlayer>();
			videoPlayer.renderMode = (VideoRenderMode)1;
			videoPlayer.clip = Content.sonackToiletVideo;
			videoPlayer.aspectRatio = (VideoAspectRatio)4;
			videoPlayer.targetCamera = base.playerHeldBy.gameplayCamera;
			HUDManager.Instance.HideHUD(true);
			GameObject playerCursor = GameObject.Find("PlayerCursor");
			playerCursor.SetActive(false);
			if (!videoPlayer.isPrepared)
			{
				videoPlayer.Prepare();
				while (!videoPlayer.isPrepared)
				{
					yield return (object)new WaitForSeconds(0.2f);
				}
			}
			yield return (object)new WaitForSeconds(0.1f);
			videoPlayer.Play();
			while (videoPlayer.isPlaying)
			{
				yield return null;
			}
			Object.Destroy((Object)(object)videoPlayer);
			HUDManager.Instance.HideHUD(false);
			playerCursor.SetActive(true);
			base.playerHeldBy.inSpecialInteractAnimation = false;
			KillSonackServerRpc();
			yield return null;
		}

		[ServerRpc(RequireOwnership = false)]
		private void KillSonackServerRpc()
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007c: 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 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2375906980u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2375906980u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					KillSonackClientRpc();
				}
			}
		}

		[ClientRpc]
		private void KillSonackClientRpc()
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00cb: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d5: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(2487262493u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2487262493u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					base.playerHeldBy.DamagePlayer(665, true, true, (CauseOfDeath)5, 0, false, Vector3.up * 5f);
				}
			}
		}

		private bool IsHeldByYuchi()
		{
			return Utilities.IsYuchi(base.playerHeldBy?.playerSteamId);
		}

		private bool IsHeldByLeon()
		{
			return Utilities.IsLeon(base.playerHeldBy?.playerSteamId);
		}

		private bool IsHeldBySonack()
		{
			return Utilities.IsSonack(base.playerHeldBy?.playerSteamId);
		}

		public override void GrabItem()
		{
			((GrabbableObject)this).GrabItem();
			if (!pickedUpFirstTime && ((NetworkBehaviour)this).IsOwner)
			{
				if (IsHeldByYuchi())
				{
					PlayRandomAudio(Clips.PickupYuchi);
				}
				else if (IsHeldBySonack())
				{
					PlayClip(Clips.PickupSonack);
				}
				else if (IsHeldByLeon())
				{
					PlayClip(Clips.PickupLeon);
				}
				else
				{
					PlayRandomAudio(Clips.Pickup);
				}
				pickedUpFirstTime = true;
			}
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			if (!((NetworkBehaviour)this).IsOwner)
			{
				return;
			}
			bool flag = random.Next(0, 100) < 5;
			if (IsHeldByYuchi())
			{
				if (didBirthdayEvent || !TryBirthdayEvent())
				{
					if (flag)
					{
						PlayClip(Clips.RareYuchi);
					}
					else
					{
						PlayRandomAudio(Clips.InteractYuchi);
					}
				}
			}
			else if (flag)
			{
				PlayClip(Clips.Rare);
			}
			else
			{
				PlayRandomAudio(Clips.Interact);
			}
		}

		private bool TryBirthdayEvent(bool force = false)
		{
			DateTime now = DateTime.Now;
			if ((now.Month == 12 && now.Day == 29) || force)
			{
				BirthdayEventServerRpc();
				return true;
			}
			return false;
		}

		[ServerRpc(RequireOwnership = false)]
		private void BirthdayEventServerRpc()
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007c: 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 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(4233559493u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 4233559493u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					BirthdayEventClientRpc();
				}
			}
		}

		[ClientRpc]
		private void BirthdayEventClientRpc()
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007c: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3181349829u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3181349829u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((MonoBehaviour)this).StartCoroutine(PlayBirthdayEvent());
				}
			}
		}

		private IEnumerator PlayBirthdayEvent()
		{
			blockingAudioSource = true;
			didBirthdayEvent = true;
			PlayAudio(yuchiBdayStartSFX, force: true);
			while (audioSource.isPlaying)
			{
				yield return null;
			}
			yield return (object)new WaitForSeconds(0.5f);
			partyHat.SetActive(true);
			PlayAudio(yuchiBdayEndSFX, force: true);
			while (audioSource.isPlaying)
			{
				yield return null;
			}
			blockingAudioSource = false;
		}

		public override void GrabItemFromEnemy(EnemyAI enemy)
		{
			((GrabbableObject)this).GrabItemFromEnemy(enemy);
			if (enemy is HoarderBugAI)
			{
				PlayRandomAudio(Clips.HoarderBug);
			}
		}

		public void PlayShowerSFX()
		{
			PlayShowerSFXServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		private void PlayShowerSFXServerRpc()
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007c: 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 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1878144494u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1878144494u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayShowerSFXClientRpc();
				}
			}
		}

		[ClientRpc]
		private void PlayShowerSFXClientRpc()
		{
			//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_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007c: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager == null || !networkManager.IsListening)
			{
				return;
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1325468976u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1325468976u, val, (RpcDelivery)0);
			}
			if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !tookShower)
			{
				if (IsHeldByYuchi())
				{
					PlayRandomAudio(Clips.ShowerYuchi);
				}
				else
				{
					PlayRandomAudio(Clips.Shower);
				}
				tookShower = true;
			}
		}

		private void PlayRandomAudio(Clips clip)
		{
			AudioClip[] array = clipMap[clip];
			int num;
			do
			{
				num = random.Next(0, array.Length);
			}
			while (num == lastRandomNumber);
			lastRandomNumber = num;
			PlayClipServerRpc(clip, num);
		}

		private void PlayClip(Clips clip)
		{
			PlayClipServerRpc(clip);
		}

		private void PlayAudio(AudioClip clip, bool force = false)
		{
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			if (!((Object)(object)clip == (Object)null) && (!blockingAudioSource || force))
			{
				audioSource.Stop(true);
				audioSource.PlayOneShot(clip, 1f);
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, audioSource.maxDistance, 1f, 0, base.isInElevator && StartOfRound.Instance.hangarDoorsClosed, 0);
			}
		}

		[ServerRpc(RequireOwnership = false)]
		private void PlayClipServerRpc(Clips clip, int i = 0)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3474782139u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<Clips>(ref clip, default(ForEnums));
					BytePacker.WriteValueBitPacked(val2, i);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3474782139u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					PlayClipClientRpc(clip, i);
				}
			}
		}

		[ClientRpc]
		private void PlayClipClientRpc(Clips clip, int i)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
			//IL_00be: Invalid comparison between Unknown and I4
			//IL_005f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0068: 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_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0083: Unknown result type (might be due to invalid IL or missing references)
			//IL_008c: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(72351418u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<Clips>(ref clip, default(ForEnums));
					BytePacker.WriteValueBitPacked(val2, i);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 72351418u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					PlayAudio(clipMap[clip][i]);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_Bongoat()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_001b: Expected O, but got Unknown
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Expected O, but got Unknown
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_006c: Expected O, but got Unknown
			//IL_007d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0087: Expected O, but got Unknown
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a2: Expected O, but got Unknown
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f3: Expected O, but got Unknown
			//IL_0104: Unknown result type (might be due to invalid IL or missing references)
			//IL_010e: Expected O, but got Unknown
			//IL_011f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(3814899577u, new RpcReceiveHandler(__rpc_handler_3814899577));
			NetworkManager.__rpc_func_table.Add(374989997u, new RpcReceiveHandler(__rpc_handler_374989997));
			NetworkManager.__rpc_func_table.Add(1339658752u, new RpcReceiveHandler(__rpc_handler_1339658752));
			NetworkManager.__rpc_func_table.Add(2375906980u, new RpcReceiveHandler(__rpc_handler_2375906980));
			NetworkManager.__rpc_func_table.Add(2487262493u, new RpcReceiveHandler(__rpc_handler_2487262493));
			NetworkManager.__rpc_func_table.Add(4233559493u, new RpcReceiveHandler(__rpc_handler_4233559493));
			NetworkManager.__rpc_func_table.Add(3181349829u, new RpcReceiveHandler(__rpc_handler_3181349829));
			NetworkManager.__rpc_func_table.Add(1878144494u, new RpcReceiveHandler(__rpc_handler_1878144494));
			NetworkManager.__rpc_func_table.Add(1325468976u, new RpcReceiveHandler(__rpc_handler_1325468976));
			NetworkManager.__rpc_func_table.Add(3474782139u, new RpcReceiveHandler(__rpc_handler_3474782139));
			NetworkManager.__rpc_func_table.Add(72351418u, new RpcReceiveHandler(__rpc_handler_72351418));
		}

		private static void __rpc_handler_3814899577(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;
				((Bongoat)(object)target).ToiletFlushedServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_374989997(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_0023: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Unknown result type (might be due to invalid IL or missing references)
			//IL_0050: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				int count = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref count);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Bongoat)(object)target).ToiletFlushedClientRpc(count);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1339658752(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)2;
				((Bongoat)(object)target).ToiletSequenceClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2375906980(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;
				((Bongoat)(object)target).KillSonackServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2487262493(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)2;
				((Bongoat)(object)target).KillSonackClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4233559493(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;
				((Bongoat)(object)target).BirthdayEventServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3181349829(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)2;
				((Bongoat)(object)target).BirthdayEventClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1878144494(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;
				((Bongoat)(object)target).PlayShowerSFXServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1325468976(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)2;
				((Bongoat)(object)target).PlayShowerSFXClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3474782139(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Clips clip = default(Clips);
				((FastBufferReader)(ref reader)).ReadValueSafe<Clips>(ref clip, default(ForEnums));
				int i = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref i);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((Bongoat)(object)target).PlayClipServerRpc(clip, i);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_72351418(NetworkBehaviour target, FastBufferReader reader, __RpcParams rpcParams)
		{
			//IL_002f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0035: Unknown result type (might be due to invalid IL or missing references)
			//IL_003e: 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_006f: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				Clips clip = default(Clips);
				((FastBufferReader)(ref reader)).ReadValueSafe<Clips>(ref clip, default(ForEnums));
				int i = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref i);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((Bongoat)(object)target).PlayClipClientRpc(clip, i);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "Bongoat";
		}
	}
	public class Content
	{
		public static AssetBundle Assets;

		public static Dictionary<string, GameObject> Prefabs = new Dictionary<string, GameObject>();

		public static VideoClip sonackToiletVideo;

		private static void TryLoadAssets()
		{
			if ((Object)(object)Assets == (Object)null)
			{
				Assets = AssetBundle.LoadFromFile(Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), "lethalgoat"));
			}
		}

		public static void Load()
		{
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			TryLoadAssets();
			Item val = Assets.LoadAsset<Item>("Assets/Bongoat.asset");
			TerminalNode val2 = Assets.LoadAsset<TerminalNode>("Assets/BongoatTerminalNode.asset");
			if ((Object)(object)val.spawnPrefab.GetComponent<NetworkTransform>() == (Object)null)
			{
				NetworkTransform val3 = val.spawnPrefab.AddComponent<NetworkTransform>();
				val3.SlerpPosition = false;
				val3.Interpolate = false;
				val3.SyncPositionX = false;
				val3.SyncPositionY = false;
				val3.SyncPositionZ = false;
				val3.SyncScaleX = false;
				val3.SyncScaleY = false;
				val3.SyncScaleZ = false;
				val3.UseHalfFloatPrecision = true;
			}
			Prefabs.Add("Bongoat", val.spawnPrefab);
			NetworkPrefabs.RegisterNetworkPrefab(val.spawnPrefab);
			Items.RegisterShopItem(val, (TerminalNode)null, (TerminalNode)null, val2, 69);
			sonackToiletVideo = Assets.LoadAsset<VideoClip>("Assets/toilet.mp4");
			UnlockableItemDef val4 = Assets.LoadAsset<UnlockableItemDef>("Assets/YuchiCutoutUnlockable.asset");
			TerminalNode val5 = Assets.LoadAsset<TerminalNode>("Assets/YuchiCutoutInfo.asset");
			NetworkPrefabs.RegisterNetworkPrefab(val4.unlockable.prefabObject);
			Unlockables.RegisterUnlockable(val4, val4.storeType, (TerminalNode)null, (TerminalNode)null, val5, 130);
			Plugin.Log.LogInfo((object)"Loaded assets");
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			Type[] array = types;
			foreach (Type type in array)
			{
				MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				MethodInfo[] array2 = methods;
				foreach (MethodInfo methodInfo in array2)
				{
					object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
					if (customAttributes.Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
		}
	}
	public class Debug
	{
		[CompilerGenerated]
		private static class <>O
		{
			public static hook_Update <0>__StartOfRound_Update;
		}

		public static void Load()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__StartOfRound_Update;
			if (obj == null)
			{
				hook_Update val = StartOfRound_Update;
				<>O.<0>__StartOfRound_Update = val;
				obj = (object)val;
			}
			StartOfRound.Update += (hook_Update)obj;
		}

		public static void Unload()
		{
			//IL_0011: Unknown result type (might be due to invalid IL or missing references)
			//IL_0016: Unknown result type (might be due to invalid IL or missing references)
			//IL_001c: Expected O, but got Unknown
			object obj = <>O.<0>__StartOfRound_Update;
			if (obj == null)
			{
				hook_Update val = StartOfRound_Update;
				<>O.<0>__StartOfRound_Update = val;
				obj = (object)val;
			}
			StartOfRound.Update -= (hook_Update)obj;
		}

		private static void StartOfRound_Update(orig_Update orig, StartOfRound self)
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			if (((ButtonControl)Keyboard.current[(Key)94]).wasPressedThisFrame)
			{
				Utilities.LoadPrefab("Bongoat", ((Component)self.localPlayerController.gameplayCamera).transform.position);
			}
			else if (((ButtonControl)Keyboard.current[(Key)95]).wasPressedThisFrame)
			{
				Object.FindObjectOfType<Terminal>().SyncGroupCreditsClientRpc(6969, 0);
			}
			else if (((ButtonControl)Keyboard.current[(Key)96]).wasPressedThisFrame)
			{
				Plugin.TriggerBirthdayNext = !Plugin.TriggerBirthdayNext;
			}
			orig.Invoke(self);
		}
	}
	[BepInPlugin("LethalGoat", "LethalGoat", "1.0.6")]
	public class Plugin : BaseUnityPlugin
	{
		public static ManualLogSource Log;

		public static bool TriggerBirthdayNext;

		private void Awake()
		{
			Log = ((BaseUnityPlugin)this).Logger;
			Content.Load();
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Plugin LethalGoat is loaded!");
		}
	}
	public class Utilities
	{
		public static void LoadPrefab(string name, Vector3 position)
		{
			//IL_0032: Unknown result type (might be due to invalid IL or missing references)
			//IL_0033: Unknown result type (might be due to invalid IL or missing references)
			if (Content.Prefabs.ContainsKey(name))
			{
				Plugin.Log.LogInfo((object)("Loading prefab " + name));
				GameObject val = Object.Instantiate<GameObject>(Content.Prefabs[name], position, Quaternion.identity);
				val.GetComponent<NetworkObject>().Spawn(false);
			}
			else
			{
				Plugin.Log.LogWarning((object)("Prefab " + name + " not found!"));
			}
		}

		public static bool IsYuchi(ulong? steamId)
		{
			return steamId == 76561198879298270L;
		}

		public static bool IsLeon(ulong? steamId)
		{
			return steamId == 76561197998258984L;
		}

		public static bool IsSonack(ulong? steamId)
		{
			return steamId == 76561198311162717L;
		}
	}
	public static class PluginInfo
	{
		public const string PLUGIN_GUID = "LethalGoat";

		public const string PLUGIN_NAME = "LethalGoat";

		public const string PLUGIN_VERSION = "1.0.6";
	}
}