Please disclose if any significant portion of your mod was created using AI tools by adding the 'AI Generated' category. Failing to do so may result in the mod being removed from Thunderstore.
Decompiled source of HotelInsanity v1.0.6
HotelInsanity.dll
Decompiled 8 months agousing System; using System.Collections; using System.Collections.Generic; using System.Diagnostics; using System.Reflection; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Runtime.Versioning; using BepInEx; using BepInEx.Logging; using HarmonyLib; using HotelInsanity.NetcodePatcher; 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: AssemblyTitle("HotelInsanity")] [assembly: AssemblyDescription("")] [assembly: AssemblyConfiguration("")] [assembly: AssemblyCompany("")] [assembly: AssemblyProduct("HotelInsanity")] [assembly: AssemblyCopyright("Copyright © 2025")] [assembly: AssemblyTrademark("")] [assembly: ComVisible(false)] [assembly: Guid("050df474-407b-4e5f-b74b-1f18f5a9a8a1")] [assembly: AssemblyFileVersion("1.0.0.0")] [assembly: TargetFramework(".NETFramework,Version=v4.8", FrameworkDisplayName = ".NET Framework 4.8")] [assembly: AssemblyVersion("1.0.0.0")] [module: NetcodePatchedAssembly] internal class <Module> { static <Module>() { } } public class AppleMonsterAnimation : MonoBehaviour { public void Awake() { ((Component)this).GetComponent<Animation>()["idle"].speed = 0.3f; } } public class HIElevatorController : NetworkBehaviour { [CompilerGenerated] private sealed class <AnimationEvent_ElevatorHitBottom>d__30 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float duration; public HIElevatorController <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <AnimationEvent_ElevatorHitBottom>d__30(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_0027: Unknown result type (might be due to invalid IL or missing references) //IL_0031: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>2__current = (object)new WaitForSeconds(duration); <>1__state = 1; return true; case 1: <>1__state = -1; <>4__this.ShakePlayerCamera(shakeHard: true); return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } [CompilerGenerated] private sealed class <DisableButtons>d__28 : IEnumerator<object>, IDisposable, IEnumerator { private int <>1__state; private object <>2__current; public float duration; public HIElevatorController <>4__this; object IEnumerator<object>.Current { [DebuggerHidden] get { return <>2__current; } } object IEnumerator.Current { [DebuggerHidden] get { return <>2__current; } } [DebuggerHidden] public <DisableButtons>d__28(int <>1__state) { this.<>1__state = <>1__state; } [DebuggerHidden] void IDisposable.Dispose() { <>1__state = -2; } private bool MoveNext() { //IL_00e4: Unknown result type (might be due to invalid IL or missing references) //IL_00ee: Expected O, but got Unknown switch (<>1__state) { default: return false; case 0: <>1__state = -1; <>4__this.elevatorMoving = true; <>4__this.upButtonAnim.SetBool("Press", true); <>4__this.upTrigger.SetActive(false); <>4__this.upLight.SetActive(false); ((Renderer)<>4__this.upRenderer).material = <>4__this.buttonDisabled; <>4__this.downButtonAnim.SetBool("Press", true); <>4__this.downTrigger.SetActive(false); <>4__this.downLight.SetActive(false); ((Renderer)<>4__this.downRenderer).material = <>4__this.buttonDisabled; <>2__current = (object)new WaitForSeconds(duration); <>1__state = 1; return true; case 1: <>1__state = -1; if (<>4__this.floor != 3) { <>4__this.upButtonAnim.SetBool("Press", false); <>4__this.upTrigger.SetActive(true); <>4__this.upLight.SetActive(true); ((Renderer)<>4__this.upRenderer).material = <>4__this.buttonEnabled; } if (<>4__this.floor != 1) { <>4__this.downButtonAnim.SetBool("Press", false); <>4__this.downTrigger.SetActive(true); <>4__this.downLight.SetActive(true); ((Renderer)<>4__this.downRenderer).material = <>4__this.buttonEnabled; } <>4__this.elevatorMoving = false; return false; } } bool IEnumerator.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext return this.MoveNext(); } [DebuggerHidden] void IEnumerator.Reset() { throw new NotSupportedException(); } } public Animator upButtonAnim; public Animator downButtonAnim; public GameObject upTrigger; public GameObject downTrigger; public AudioClip elevatorMove; public AudioClip elevatorMoveLong; public AudioSource elevatorAudio; public Animator door1; public Animator door2; public Animator door3; public Material buttonEnabled; public Material buttonDisabled; public Transform elevatorPoint; public GameObject upLight; public GameObject downLight; private Animator elevatorAnim; private MeshRenderer upRenderer; private MeshRenderer downRenderer; private bool elevatorMoving; [SerializeField] private int floor; private static void NetcodePatcher() { 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 void Awake() { NetcodePatcher(); elevatorAnim = ((Component)this).GetComponent<Animator>(); upRenderer = ((Component)upButtonAnim).GetComponent<MeshRenderer>(); downRenderer = ((Component)downButtonAnim).GetComponent<MeshRenderer>(); downButtonAnim.SetBool("Press", true); downTrigger.SetActive(false); downLight.SetActive(false); ((Renderer)downRenderer).material = buttonDisabled; } [ServerRpc(RequireOwnership = false)] public void GoUpServerRpc() { //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(1353576708u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1353576708u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { GoUpClientRpc(); } } } [ClientRpc] public void GoUpClientRpc() { //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(1901964774u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1901964774u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { floor = Mathf.Clamp(floor + 1, 1, 3); elevatorAnim.SetInteger("Floor", floor); elevatorAudio.PlayOneShot(elevatorMove); ((MonoBehaviour)this).StartCoroutine(DisableButtons(7.333f)); AnimationEvent_ElevatorStartFromBottom(); ((MonoBehaviour)this).StartCoroutine(AnimationEvent_ElevatorHitBottom(7f)); } } } [ServerRpc(RequireOwnership = false)] public void GoDownServerRpc() { //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(2100814120u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2100814120u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { GoDownClientRpc(); } } } [ClientRpc] public void GoDownClientRpc() { //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(2392623393u, val, (RpcDelivery)0); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 2392623393u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost)) { floor = Mathf.Clamp(floor - 1, 1, 3); elevatorAnim.SetInteger("Floor", floor); elevatorAudio.PlayOneShot(elevatorMove); ((MonoBehaviour)this).StartCoroutine(DisableButtons(7.333f)); AnimationEvent_ElevatorStartFromBottom(); ((MonoBehaviour)this).StartCoroutine(AnimationEvent_ElevatorHitBottom(7f)); } } } [ServerRpc(RequireOwnership = false)] public void CallServerRpc(int f) { //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)base.__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost)) { ServerRpcParams val = default(ServerRpcParams); FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2271452072u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, f); ((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2271452072u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost)) { CallClientRpc(f); } } } [ClientRpc] public void CallClientRpc(int f) { //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(4117146631u, val, (RpcDelivery)0); BytePacker.WriteValueBitPacked(val2, f); ((NetworkBehaviour)this).__endSendClientRpc(ref val2, 4117146631u, val, (RpcDelivery)0); } if ((int)base.__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && f != floor && !elevatorMoving) { if (Mathf.Abs(floor - f) == 2) { elevatorAudio.PlayOneShot(elevatorMoveLong); ((MonoBehaviour)this).StartCoroutine(DisableButtons(14.333f)); ((MonoBehaviour)this).StartCoroutine(AnimationEvent_ElevatorHitBottom(14f)); AnimationEvent_ElevatorStartFromBottom(); } else { elevatorAudio.PlayOneShot(elevatorMove); ((MonoBehaviour)this).StartCoroutine(DisableButtons(7.333f)); ((MonoBehaviour)this).StartCoroutine(AnimationEvent_ElevatorHitBottom(7f)); AnimationEvent_ElevatorStartFromBottom(); } floor = Mathf.Clamp(f, 1, 3); elevatorAnim.SetInteger("Floor", floor); } } [IteratorStateMachine(typeof(<DisableButtons>d__28))] private IEnumerator DisableButtons(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <DisableButtons>d__28(0) { <>4__this = this, duration = duration }; } public void AnimationEvent_ElevatorStartFromBottom() { ShakePlayerCamera(shakeHard: false); } [IteratorStateMachine(typeof(<AnimationEvent_ElevatorHitBottom>d__30))] public IEnumerator AnimationEvent_ElevatorHitBottom(float duration) { //yield-return decompiler failed: Unexpected instruction in Iterator.Dispose() return new <AnimationEvent_ElevatorHitBottom>d__30(0) { <>4__this = this, duration = duration }; } private void ShakePlayerCamera(bool shakeHard) { //IL_0010: Unknown result type (might be due to invalid IL or missing references) //IL_001b: Unknown result type (might be due to invalid IL or missing references) if (Vector3.Distance(((Component)StartOfRound.Instance.audioListener).transform.position, elevatorPoint.position) < 4f) { if (shakeHard) { HUDManager.Instance.ShakeCamera((ScreenShakeType)1); } else { HUDManager.Instance.ShakeCamera((ScreenShakeType)2); } } } protected override void __initializeVariables() { ((NetworkBehaviour)this).__initializeVariables(); } [RuntimeInitializeOnLoadMethod] internal static void InitializeRPCS_HIElevatorController() { //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 NetworkManager.__rpc_func_table.Add(1353576708u, new RpcReceiveHandler(__rpc_handler_1353576708)); NetworkManager.__rpc_func_table.Add(1901964774u, new RpcReceiveHandler(__rpc_handler_1901964774)); NetworkManager.__rpc_func_table.Add(2100814120u, new RpcReceiveHandler(__rpc_handler_2100814120)); NetworkManager.__rpc_func_table.Add(2392623393u, new RpcReceiveHandler(__rpc_handler_2392623393)); NetworkManager.__rpc_func_table.Add(2271452072u, new RpcReceiveHandler(__rpc_handler_2271452072)); NetworkManager.__rpc_func_table.Add(4117146631u, new RpcReceiveHandler(__rpc_handler_4117146631)); } private static void __rpc_handler_1353576708(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; ((HIElevatorController)(object)target).GoUpServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_1901964774(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; ((HIElevatorController)(object)target).GoUpClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2100814120(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; ((HIElevatorController)(object)target).GoDownServerRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2392623393(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; ((HIElevatorController)(object)target).GoDownClientRpc(); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_2271452072(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 f = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref f); target.__rpc_exec_stage = (__RpcExecStage)1; ((HIElevatorController)(object)target).CallServerRpc(f); target.__rpc_exec_stage = (__RpcExecStage)0; } } private static void __rpc_handler_4117146631(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 f = default(int); ByteUnpacker.ReadValueBitPacked(reader, ref f); target.__rpc_exec_stage = (__RpcExecStage)2; ((HIElevatorController)(object)target).CallClientRpc(f); target.__rpc_exec_stage = (__RpcExecStage)0; } } protected internal override string __getTypeName() { return "HIElevatorController"; } } namespace HotelInsanity { [BepInPlugin("DrgnLrd.HotelInsanityInterior", "Hotel Insanity Interior", "1.0.0.0")] public class HotelInsanity : BaseUnityPlugin { private const string modGUID = "DrgnLrd.HotelInsanityInterior"; private const string modName = "Hotel Insanity Interior"; private const string modVersion = "1.0.0.0"; private readonly Harmony harmony = new Harmony("DrgnLrd.HotelInsanityInterior"); private static HotelInsanity Instance; internal ManualLogSource mls; private void Awake() { if ((Object)(object)Instance == (Object)null) { Instance = this; } mls = Logger.CreateLogSource("DrgnLrd.HotelInsanityInterior"); mls.LogInfo((object)"HotelInsanity has loaded"); harmony.PatchAll(typeof(HotelInsanity)); } } } namespace HotelInsanity.NetcodePatcher { [AttributeUsage(AttributeTargets.Module)] internal class NetcodePatchedAssemblyAttribute : Attribute { } }