Decompiled source of HotelInsanity v1.0.5

HotelInsanity.dll

Decompiled a week ago
using 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 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")]
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__26 : 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__26(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__24 : 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__24(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;

	public void Awake()
	{
		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;
	}

	public void GoUp()
	{
		floor = Mathf.Clamp(floor + 1, 1, 3);
		elevatorAnim.SetInteger("Floor", floor);
		elevatorAudio.PlayOneShot(elevatorMove);
		((MonoBehaviour)this).StartCoroutine(DisableButtons(7.333f));
		AnimationEvent_ElevatorStartFromBottom();
	}

	public void GoDown()
	{
		floor = Mathf.Clamp(floor - 1, 1, 3);
		elevatorAnim.SetInteger("Floor", floor);
		elevatorAudio.PlayOneShot(elevatorMove);
		((MonoBehaviour)this).StartCoroutine(DisableButtons(7.333f));
		((MonoBehaviour)this).StartCoroutine(AnimationEvent_ElevatorHitBottom(7f));
	}

	public void Call(int f)
	{
		if (f == floor || elevatorMoving)
		{
			return;
		}
		if (Mathf.Abs(floor - f) == 2)
		{
			elevatorAudio.PlayOneShot(elevatorMoveLong);
			((MonoBehaviour)this).StartCoroutine(DisableButtons(14.333f));
			if (floor > f)
			{
				((MonoBehaviour)this).StartCoroutine(AnimationEvent_ElevatorHitBottom(14f));
			}
			else
			{
				AnimationEvent_ElevatorStartFromBottom();
			}
		}
		else
		{
			elevatorAudio.PlayOneShot(elevatorMove);
			((MonoBehaviour)this).StartCoroutine(DisableButtons(7.333f));
			if (floor > f)
			{
				((MonoBehaviour)this).StartCoroutine(AnimationEvent_ElevatorHitBottom(7f));
			}
			else
			{
				AnimationEvent_ElevatorStartFromBottom();
			}
		}
		floor = Mathf.Clamp(f, 1, 3);
		elevatorAnim.SetInteger("Floor", floor);
	}

	[IteratorStateMachine(typeof(<DisableButtons>d__24))]
	private IEnumerator DisableButtons(float duration)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <DisableButtons>d__24(0)
		{
			<>4__this = this,
			duration = duration
		};
	}

	public void AnimationEvent_ElevatorStartFromBottom()
	{
		ShakePlayerCamera(shakeHard: false);
	}

	[IteratorStateMachine(typeof(<AnimationEvent_ElevatorHitBottom>d__26))]
	public IEnumerator AnimationEvent_ElevatorHitBottom(float duration)
	{
		//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
		return new <AnimationEvent_ElevatorHitBottom>d__26(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);
			}
		}
	}
}
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));
	}
}