Decompiled source of Galetry v2.0.2

WesleyMoons.dll

Decompiled 2 weeks ago
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using HarmonyLib;
using JLL;
using LethalModDataLib.Base;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.Events;
using WesleyMoons.NetcodePatcher;
using WesleyMoons.Patches;
using WesleyMoons.Save;

[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: IgnoresAccessChecksTo("")]
[assembly: AssemblyCompany("WesleyMoons")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("WesleyMoons")]
[assembly: AssemblyTitle("WesleyMoons")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: NetcodePatchedAssembly]
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.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 WesleyMoons
{
	[BepInPlugin("JacobG5.WesleyMoons", "WesleyMoons", "2.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class WesleyPlugin : BaseUnityPlugin
	{
		private const string modGUID = "JacobG5.WesleyMoons";

		private const string modName = "WesleyMoons";

		private const string modVersion = "2.0.0";

		internal static readonly Harmony Harmony = new Harmony("JacobG5.WesleyMoons");

		internal static ManualLogSource mls { get; private set; }

		public static WesleySaveFile CurrentFile { get; internal set; }

		private void Awake()
		{
			mls = Logger.CreateLogSource("JacobG5.WesleyMoons");
			JLL.HarmonyPatch(Harmony, mls, new Type[1] { typeof(SavePatches) });
			JLL.NetcodePatch(mls, Assembly.GetExecutingAssembly().GetTypes());
		}
	}
}
namespace WesleyMoons.Save
{
	public class WesleySaveFile : ModDataContainer
	{
		public enum Apparatus
		{
			Cosmic,
			Bloody,
			Royal
		}

		public enum Alters
		{
			Utril,
			Faith,
			Fission,
			Gloom,
			Etern,
			Filitrios
		}

		public bool HasCosmic = false;

		public bool HasBloody = false;

		public bool HasRoyal = false;

		public bool HasAllAppy = false;

		public List<int> InsertedApps = new List<int>();

		public List<int> PlantedAlters = new List<int>();

		public bool BerunahDoor = false;

		public void LegacyFix()
		{
			if (InsertedApps == null)
			{
				InsertedApps = new List<int>();
			}
			if (PlantedAlters == null)
			{
				PlantedAlters = new List<int>();
			}
			if (HasAllAppy)
			{
				foreach (Apparatus value in Enum.GetValues(typeof(Apparatus)))
				{
					InsertedApps.Add((int)value);
				}
			}
			else
			{
				if (HasCosmic)
				{
					InsertedApps.Add(0);
				}
				if (HasBloody)
				{
					InsertedApps.Add(1);
				}
				if (HasRoyal)
				{
					InsertedApps.Add(2);
				}
			}
			HasAllAppy = (HasCosmic = (HasBloody = (HasRoyal = false)));
		}

		public void Collect(Apparatus apparatus)
		{
			if (!InsertedApps.Contains((int)apparatus))
			{
				InsertedApps.Add((int)apparatus);
			}
		}

		public bool Get(Apparatus apparatus)
		{
			return InsertedApps.Contains((int)apparatus);
		}

		public bool HasAllApparatus()
		{
			foreach (Apparatus value in Enum.GetValues(typeof(Apparatus)))
			{
				if (!InsertedApps.Contains((int)value))
				{
					return false;
				}
			}
			return true;
		}

		public void Activate(Alters alter)
		{
			if (!PlantedAlters.Contains((int)alter))
			{
				PlantedAlters.Add((int)alter);
			}
		}

		public bool Get(Alters alter)
		{
			return PlantedAlters.Contains((int)alter);
		}

		public bool HasAllAlters()
		{
			foreach (Alters value in Enum.GetValues(typeof(Alters)))
			{
				if (!PlantedAlters.Contains((int)value))
				{
					return false;
				}
			}
			return true;
		}

		public void Reset()
		{
			if (!HasAllApparatus())
			{
				InsertedApps.Clear();
			}
			if (!HasAllAlters())
			{
				PlantedAlters.Clear();
			}
			((ModDataContainer)this).Save();
		}
	}
}
namespace WesleyMoons.Patches
{
	internal class SavePatches
	{
		[HarmonyPatch(typeof(StartOfRound), "Start")]
		[HarmonyPrefix]
		internal static void LoadFile(StartOfRound __instance)
		{
			if (((NetworkBehaviour)__instance).IsHost || ((NetworkBehaviour)__instance).IsServer)
			{
				WesleyPlugin.CurrentFile = new WesleySaveFile();
				WesleyPlugin.mls.LogInfo((object)"Loading Wesley Data.");
				((ModDataContainer)WesleyPlugin.CurrentFile).Load();
				WesleyPlugin.CurrentFile.LegacyFix();
			}
			else
			{
				WesleyPlugin.mls.LogInfo((object)"Not loading Wesley Data.");
			}
		}

		[HarmonyPatch(typeof(GameNetworkManager), "SaveGameValues")]
		[HarmonyPrefix]
		internal static void SaveFile(GameNetworkManager __instance)
		{
			if (__instance.isHostingGame && WesleyPlugin.CurrentFile != null)
			{
				WesleyPlugin.mls.LogInfo((object)"Saving Wesley Data.");
				((ModDataContainer)WesleyPlugin.CurrentFile).Save();
			}
		}

		[HarmonyPatch(typeof(GameNetworkManager), "ResetSavedGameValues")]
		[HarmonyPrefix]
		internal static void ResetFile(GameNetworkManager __instance)
		{
			if (__instance.isHostingGame && WesleyPlugin.CurrentFile != null)
			{
				WesleyPlugin.mls.LogInfo((object)"Resetting Wesley Data.");
				WesleyPlugin.CurrentFile.Reset();
			}
		}
	}
}
namespace WesleyMoons.Component
{
	public class AlterActivator : NetworkBehaviour
	{
		public WesleySaveFile.Alters Alter;

		private bool planted = false;

		public Collider InteractTrigger;

		public GameObject Seed;

		public AudioClip InsertSound;

		public AudioSource AudioSource;

		[Header("Start Of Day Events")]
		public UnityEvent Corrupt = new UnityEvent();

		public UnityEvent AllCorrupt = new UnityEvent();

		[Header("Warning")]
		public bool displayWarning = true;

		public string header = "WARNING";

		[TextArea(1, 5)]
		public string message = "A Cosmic Entity of unknown power has turned it's focus towards this planet.";

		public override void OnNetworkSpawn()
		{
			((NetworkBehaviour)this).OnNetworkSpawn();
			if ((((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) && WesleyPlugin.CurrentFile != null)
			{
				if (WesleyPlugin.CurrentFile.HasAllAlters())
				{
					CorruptStartClientRpc(all: true);
				}
				else if (WesleyPlugin.CurrentFile.Get(Alter))
				{
					CorruptStartClientRpc(all: false);
				}
			}
		}

		public void Activate()
		{
			ActivateServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		private void ActivateServerRpc()
		{
			//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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3343064730u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3343064730u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && WesleyPlugin.CurrentFile != null && !planted)
				{
					WesleyPlugin.CurrentFile.Activate(Alter);
					ActivateClientRpc();
				}
			}
		}

		[ClientRpc]
		private void ActivateClientRpc()
		{
			//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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3396333970u, val, (RpcDelivery)0);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3396333970u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlantSeed();
				if (displayWarning)
				{
					HUDManager.Instance.DisplayTip(header, message, true, false, "LC_Tip1");
				}
			}
		}

		[ClientRpc]
		private void CorruptStartClientRpc(bool all)
		{
			//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_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_0097: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(4018137756u, val, (RpcDelivery)0);
				((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref all, default(ForPrimitives));
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4018137756u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
			{
				PlantSeed();
				Corrupt.Invoke();
				if (all)
				{
					AllCorrupt.Invoke();
				}
			}
		}

		private void PlantSeed()
		{
			if (!planted)
			{
				planted = true;
				if ((Object)(object)InteractTrigger != (Object)null)
				{
					InteractTrigger.enabled = false;
				}
				AudioSource audioSource = AudioSource;
				if (audioSource != null)
				{
					audioSource.PlayOneShot(InsertSound);
				}
				GameObject seed = Seed;
				if (seed != null)
				{
					seed.SetActive(true);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_AlterActivator()
		{
			//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
			NetworkManager.__rpc_func_table.Add(3343064730u, new RpcReceiveHandler(__rpc_handler_3343064730));
			NetworkManager.__rpc_func_table.Add(3396333970u, new RpcReceiveHandler(__rpc_handler_3396333970));
			NetworkManager.__rpc_func_table.Add(4018137756u, new RpcReceiveHandler(__rpc_handler_4018137756));
		}

		private static void __rpc_handler_3343064730(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;
				((AlterActivator)(object)target).ActivateServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3396333970(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;
				((AlterActivator)(object)target).ActivateClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_4018137756(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 all = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref all, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((AlterActivator)(object)target).CorruptStartClientRpc(all);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "AlterActivator";
		}
	}
	public class AlterCheck : MonoBehaviour
	{
		public WesleySaveFile.Alters Location;

		public bool CheckOnStart;

		public UnityEvent Active = new UnityEvent();

		private void Start()
		{
			if (CheckOnStart)
			{
				Check();
			}
		}

		public void Check()
		{
			if ((((NetworkBehaviour)RoundManager.Instance).IsServer || ((NetworkBehaviour)RoundManager.Instance).IsHost) && WesleyPlugin.CurrentFile != null && !WesleyPlugin.CurrentFile.Get(Location))
			{
				Active.Invoke();
			}
		}
	}
	public class AppyInsert : MonoBehaviour
	{
		[Header("DO NOT SYNC INPUT \nIT GETS SYNCED BY THE BACKDOOR SCRIPT")]
		public WesleySaveFile.Apparatus apparatus;

		[HideInInspector]
		public BackDoor backDoor;

		public Animator? animator;

		public string animTrigger = "Insert";

		public AudioClip InsertSound;

		public AudioSource AudioSource;

		public Collider InteractTrigger;

		public void Insert()
		{
			backDoor?.InsertServerRpc((int)apparatus);
		}
	}
	public class BackDoor : NetworkBehaviour
	{
		private bool opened = false;

		public Animator? animator;

		public string animTrigger = "OpenDoor";

		public AppyInsert[] apparatusSockets = new AppyInsert[0];

		public override void OnNetworkSpawn()
		{
			if ((!((NetworkBehaviour)this).IsHost && !((NetworkBehaviour)this).IsServer) || WesleyPlugin.CurrentFile == null)
			{
				return;
			}
			bool flag = true;
			for (int i = 0; i < apparatusSockets.Length; i++)
			{
				AppyInsert appyInsert = apparatusSockets[i];
				appyInsert.backDoor = this;
				if (WesleyPlugin.CurrentFile.Get(appyInsert.apparatus))
				{
					InsertClientRpc(i);
				}
				else
				{
					flag = false;
				}
			}
			if (flag)
			{
				OpenDoor();
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void InsertServerRpc(int socket)
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
			{
				ServerRpcParams val = default(ServerRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(3721940294u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, socket);
				((NetworkBehaviour)this).__endSendServerRpc(ref val2, 3721940294u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage != 1 || (!networkManager.IsServer && !networkManager.IsHost) || WesleyPlugin.CurrentFile == null || !Enum.IsDefined(typeof(WesleySaveFile.Apparatus), socket))
			{
				return;
			}
			WesleyPlugin.CurrentFile.Collect((WesleySaveFile.Apparatus)socket);
			for (int i = 0; i < apparatusSockets.Length; i++)
			{
				if (apparatusSockets[i].apparatus == (WesleySaveFile.Apparatus)socket)
				{
					InsertClientRpc(i);
					break;
				}
			}
			if (!opened && WesleyPlugin.CurrentFile.HasAllApparatus())
			{
				OpenDoorClientRpc();
			}
		}

		[ClientRpc]
		private void InsertClientRpc(int index)
		{
			//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)
			{
				return;
			}
			if ((int)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
			{
				ClientRpcParams val = default(ClientRpcParams);
				FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3710956140u, val, (RpcDelivery)0);
				BytePacker.WriteValueBitPacked(val2, index);
				((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3710956140u, val, (RpcDelivery)0);
			}
			if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && index < apparatusSockets.Length)
			{
				AppyInsert appyInsert = apparatusSockets[index];
				if ((Object)(object)appyInsert.InteractTrigger != (Object)null)
				{
					appyInsert.InteractTrigger.enabled = false;
				}
				appyInsert.AudioSource.PlayOneShot(appyInsert.InsertSound);
				Animator? obj = appyInsert.animator;
				if (obj != null)
				{
					obj.SetTrigger(appyInsert.animTrigger);
				}
			}
		}

		[ClientRpc]
		private void OpenDoorClientRpc()
		{
			//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)base.__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(710637064u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 710637064u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					OpenDoor();
				}
			}
		}

		private void OpenDoor()
		{
			if (!opened)
			{
				opened = true;
				Animator? obj = animator;
				if (obj != null)
				{
					obj.SetTrigger(animTrigger);
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_BackDoor()
		{
			//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
			NetworkManager.__rpc_func_table.Add(3721940294u, new RpcReceiveHandler(__rpc_handler_3721940294));
			NetworkManager.__rpc_func_table.Add(3710956140u, new RpcReceiveHandler(__rpc_handler_3710956140));
			NetworkManager.__rpc_func_table.Add(710637064u, new RpcReceiveHandler(__rpc_handler_710637064));
		}

		private static void __rpc_handler_3721940294(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 socket = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref socket);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((BackDoor)(object)target).InsertServerRpc(socket);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3710956140(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 index = default(int);
				ByteUnpacker.ReadValueBitPacked(reader, ref index);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((BackDoor)(object)target).InsertClientRpc(index);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_710637064(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;
				((BackDoor)(object)target).OpenDoorClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "BackDoor";
		}
	}
	public class IndianaCubes : NetworkBehaviour
	{
		public Animator DoorAnim;

		public BoxCollider InteractBox;

		public BoxCollider TombTrigger;

		public override void OnNetworkSpawn()
		{
			if ((((NetworkBehaviour)this).IsHost || ((NetworkBehaviour)this).IsServer) && WesleyPlugin.CurrentFile != null && WesleyPlugin.CurrentFile.BerunahDoor)
			{
				OpenDoorClientRpc(startDay: true);
			}
		}

		public void OpenDoor()
		{
			OpenDoorServerRpc();
		}

		[ServerRpc(RequireOwnership = false)]
		private void OpenDoorServerRpc()
		{
			//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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1462909241u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1462909241u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost) && WesleyPlugin.CurrentFile != null && !WesleyPlugin.CurrentFile.BerunahDoor)
				{
					WesleyPlugin.CurrentFile.BerunahDoor = true;
					OpenDoorClientRpc(startDay: false);
				}
			}
		}

		[ClientRpc]
		private void OpenDoorClientRpc(bool startDay)
		{
			//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_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_0097: 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 != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1995980145u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref startDay, default(ForPrimitives));
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1995980145u, val, (RpcDelivery)0);
				}
				if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					((Collider)InteractBox).enabled = false;
					DoorAnim.SetTrigger("Open");
					((Collider)TombTrigger).enabled = !startDay;
				}
			}
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_IndianaCubes()
		{
			//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
			NetworkManager.__rpc_func_table.Add(1462909241u, new RpcReceiveHandler(__rpc_handler_1462909241));
			NetworkManager.__rpc_func_table.Add(1995980145u, new RpcReceiveHandler(__rpc_handler_1995980145));
		}

		private static void __rpc_handler_1462909241(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;
				((IndianaCubes)(object)target).OpenDoorServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1995980145(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 startDay = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref startDay, default(ForPrimitives));
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((IndianaCubes)(object)target).OpenDoorClientRpc(startDay);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "IndianaCubes";
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}
namespace WesleyMoons.NetcodePatcher
{
	[AttributeUsage(AttributeTargets.Module)]
	internal class NetcodePatchedAssemblyAttribute : Attribute
	{
	}
}