Decompiled source of 57 Harbringer v2.6.1

HarbringerScripts.dll

Decompiled a week ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using BepInEx;
using HarbringerScripts.NetcodePatcher;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
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: AssemblyVersion("0.0.0.0")]
[module: NetcodePatchedAssembly]
namespace Microsoft.CodeAnalysis
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	internal sealed class EmbeddedAttribute : Attribute
	{
	}
}
namespace System.Runtime.CompilerServices
{
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Property | AttributeTargets.Field | AttributeTargets.Event | AttributeTargets.Parameter | AttributeTargets.ReturnValue | AttributeTargets.GenericParameter, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableAttribute : Attribute
	{
		public readonly byte[] NullableFlags;

		public NullableAttribute(byte P_0)
		{
			NullableFlags = new byte[1] { P_0 };
		}

		public NullableAttribute(byte[] P_0)
		{
			NullableFlags = P_0;
		}
	}
	[CompilerGenerated]
	[Microsoft.CodeAnalysis.Embedded]
	[AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Method | AttributeTargets.Interface | AttributeTargets.Delegate, AllowMultiple = false, Inherited = false)]
	internal sealed class NullableContextAttribute : Attribute
	{
		public readonly byte Flag;

		public NullableContextAttribute(byte P_0)
		{
			Flag = P_0;
		}
	}
}
namespace HarbringerScripts
{
	public class BoatManager : NetworkBehaviour
	{
		public static BoatManager Instance;

		public bool IsShipMoving = false;

		[Header("Animators")]
		public Animator BoatAnimator;

		public Animator BellAnimator;

		[Space]
		[Header("AudioSource")]
		public AudioSource MotorAudioSource;

		public AudioSource BoatHornAudioSource;

		public AudioSource BellAudioSource;

		public AudioSource Boombox;

		[Space]
		[Header("AudioClips")]
		public AudioClip BellSound;

		[Space]
		[Header("InteractTriggers")]
		public InteractTrigger TriggerBoat;

		public InteractTrigger TriggerBell;

		[Space]
		[Header("Proppelers")]
		public ParticleSystem LeftProppelerParticle;

		public ParticleSystem RightProppelerParticle;

		private void Awake()
		{
			Instance = this;
		}

		public void MoveShipToMain()
		{
			if (!BridgeManager.Instance.isBridgeOpen)
			{
				MoveShipToMainRpc();
			}
			else
			{
				HUDManager.Instance.DisplayTip("Boat", "Unable to ride boat to main (Bridge Is Open)", true, false, "LC_Tip1");
			}
		}

		public void SwingBell()
		{
			if (!BridgeManager.Instance.isBridgeOpen)
			{
				SwingBellRpc();
				Debug.Log((object)"[57-Harbringer] CalledBellServerRpc");
			}
			else
			{
				HUDManager.Instance.DisplayTip("Boat Bell", "Unable to call the boat (Bridge Is Open)", true, false, "LC_Tip1");
			}
		}

		public void SetBoombox()
		{
			SetBoomboxRpc();
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SetBoomboxRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e4: 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)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(26888076u, val2, val, (SendTo)6, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 26888076u, val2, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1)
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (Boombox.isPlaying)
				{
					Boombox.Stop();
					return;
				}
				RoundManager.Instance.PlayAudibleNoise(((Component)this).transform.position, 10f, 0.5f, 0, false, 0);
				Boombox.Play();
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void SwingBellRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(2613373859u, val2, val, (SendTo)6, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 2613373859u, val2, val, (SendTo)6, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					RoundManager.Instance.PlayAudibleNoise(((Component)BellAudioSource).gameObject.transform.position, 65f, 15f, 0, false, 0);
					BellAnimator.SetTrigger("BellSwing");
					Debug.Log((object)$"[57-Harbringer] Got Responce From client: {((NetworkBehaviour)this).NetworkManager.LocalClientId}");
				}
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void MoveShipToMainRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_00b3: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = new RpcAttributeParams
					{
						RequireOwnership = false
					};
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1311439250u, val2, val, (SendTo)6, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendRpc(ref val3, 1311439250u, val2, val, (SendTo)6, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					IsShipMoving = !IsShipMoving;
					BoatAnimator.SetTrigger("MoveToMain");
					Debug.Log((object)$"[57-Harbringer] Got Responce From client: {((NetworkBehaviour)this).NetworkManager.LocalClientId}");
				}
			}
		}

		public void SetShipMoving()
		{
			IsShipMoving = !IsShipMoving;
		}

		public void PlayMotorSounds()
		{
			MotorAudioSource.Play();
		}

		public void StopMotorSounds()
		{
			MotorAudioSource.Stop();
		}

		public void PlayHornSound()
		{
			BoatHornAudioSource.Play();
		}

		public void PlayBellSound()
		{
			BellAudioSource.PlayOneShot(BellSound);
		}

		public void DisableInteractTrigger()
		{
			TriggerBell.interactable = false;
			TriggerBoat.interactable = false;
		}

		public void EnableInteractTrigger()
		{
			TriggerBell.interactable = true;
			TriggerBoat.interactable = true;
		}

		public void PlayProppelerAnims()
		{
			LeftProppelerParticle.Play();
			RightProppelerParticle.Play();
		}

		public void StopProppelerAnims()
		{
			LeftProppelerParticle.Stop();
			RightProppelerParticle.Stop();
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)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
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			//IL_0045: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(26888076u, new RpcReceiveHandler(__rpc_handler_26888076), "SetBoomboxRpc");
			((NetworkBehaviour)this).__registerRpc(2613373859u, new RpcReceiveHandler(__rpc_handler_2613373859), "SwingBellRpc");
			((NetworkBehaviour)this).__registerRpc(1311439250u, new RpcReceiveHandler(__rpc_handler_1311439250), "MoveShipToMainRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_26888076(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;
				((BoatManager)(object)target).SetBoomboxRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2613373859(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;
				((BoatManager)(object)target).SwingBellRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1311439250(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;
				((BoatManager)(object)target).MoveShipToMainRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "BoatManager";
		}
	}
	public class BridgeManager : NetworkBehaviour
	{
		public static BridgeManager Instance;

		public bool isBridgeOpen = false;

		[Space]
		[Header("Refrences")]
		public AudioClip BridgeAudioClip;

		public AudioSource BridgeAudioSource;

		public InteractTrigger InteractTrigger;

		public AudioClip InteractAudio;

		public AudioSource InteractAudioSource;

		[Space]
		[Header("Animators")]
		public Animator BridgeAnimator;

		public Animator LeverAnimator;

		private void Awake()
		{
			Instance = this;
		}

		public void ToggleBridge()
		{
			if (!BoatManager.Instance.IsShipMoving)
			{
				ToggleBridgeRpc();
			}
			else
			{
				HUDManager.Instance.DisplayTip("Bridge", "Unable to toggle bridge (Boat is moving)", true, false, "LC_Tip1");
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void ToggleBridgeRpc()
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_00a4: 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_005f: 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_0072: Unknown result type (might be due to invalid IL or missing references)
			//IL_0081: 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_00b3: 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)base.__rpc_exec_stage != 1)
			{
				RpcAttributeParams val = new RpcAttributeParams
				{
					RequireOwnership = false
				};
				RpcParams val2 = default(RpcParams);
				FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(1701324552u, val2, val, (SendTo)6, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendRpc(ref val3, 1701324552u, val2, val, (SendTo)6, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 1)
			{
				base.__rpc_exec_stage = (__RpcExecStage)0;
				if (isBridgeOpen)
				{
					InteractAudioSource.PlayOneShot(InteractAudio);
					LeverAnimator.SetBool("leverUp", false);
					BridgeAnimator.SetTrigger("OpenBridge");
					BridgeAudioSource.PlayOneShot(BridgeAudioClip);
				}
				else if (!isBridgeOpen)
				{
					InteractAudioSource.PlayOneShot(InteractAudio);
					LeverAnimator.SetBool("leverUp", true);
					BridgeAnimator.SetTrigger("CloseBridge");
					BridgeAudioSource.PlayOneShot(BridgeAudioClip);
				}
				isBridgeOpen = !isBridgeOpen;
			}
		}

		[Rpc(/*Could not decode attribute arguments.*/)]
		public void UpdateValuesClientRpc(bool Value)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b1: 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_0074: 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_008e: 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)
			//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)base.__rpc_exec_stage != 1)
				{
					RpcAttributeParams val = default(RpcAttributeParams);
					RpcParams val2 = default(RpcParams);
					FastBufferWriter val3 = ((NetworkBehaviour)this).__beginSendRpc(3394486299u, val2, val, (SendTo)6, (RpcDelivery)0);
					((FastBufferWriter)(ref val3)).WriteValueSafe<bool>(ref Value, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendRpc(ref val3, 3394486299u, val2, val, (SendTo)6, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1)
				{
					base.__rpc_exec_stage = (__RpcExecStage)0;
					isBridgeOpen = Value;
				}
			}
		}

		public void DisableInteractTrigger()
		{
			InteractTrigger.interactable = false;
		}

		public void EnableInteractTrigger()
		{
			InteractTrigger.interactable = true;
		}

		protected override void __initializeVariables()
		{
			((NetworkBehaviour)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
			//IL_0029: Unknown result type (might be due to invalid IL or missing references)
			//IL_0038: Expected O, but got Unknown
			((NetworkBehaviour)this).__registerRpc(1701324552u, new RpcReceiveHandler(__rpc_handler_1701324552), "ToggleBridgeRpc");
			((NetworkBehaviour)this).__registerRpc(3394486299u, new RpcReceiveHandler(__rpc_handler_3394486299), "UpdateValuesClientRpc");
			((NetworkBehaviour)this).__initializeRpcs();
		}

		private static void __rpc_handler_1701324552(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;
				((BridgeManager)(object)target).ToggleBridgeRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3394486299(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_0044: Unknown result type (might be due to invalid IL or missing references)
			//IL_005e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool value = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref value, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BridgeManager)(object)target).UpdateValuesClientRpc(value);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "BridgeManager";
		}
	}
	[BepInPlugin("WaterGun.HarbringerScripts", "HarbringerScripts", "2.6.1")]
	public class Plugin : BaseUnityPlugin
	{
		private const string GUID = "WaterGun.HarbringerScripts";

		private const string NAME = "HarbringerScripts";

		private const string VER = "2.6.1";

		private void Awake()
		{
			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);
					}
				}
			}
			((BaseUnityPlugin)this).Logger.LogInfo((object)"Loaded!");
		}
	}
	public class ShaderRestorer : MonoBehaviour
	{
		public List<Material> grassMaterials = new List<Material>();

		public void Awake()
		{
			Shader val = Shader.Find("Shader Graphs/WavingGrass");
			foreach (Material grassMaterial in grassMaterials)
			{
				if ((Object)(object)val == (Object)null)
				{
					Debug.LogError((object)"Shader missing");
				}
				else
				{
					grassMaterial.shader = val;
				}
			}
		}
	}
	public class ShipBellManager : NetworkBehaviour
	{
		public void PlayShipBellSound()
		{
			BoatManager.Instance.PlayBellSound();
		}

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

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

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