Decompiled source of APEXBanking v0.1.0

ApexBanking.dll

Decompiled 2 days ago
using System;
using System.Collections;
using System.Collections.Generic;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Reflection.Emit;
using System.Runtime.CompilerServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using Photon.Pun;
using REPOLib.Modules;
using REPOLib.Objects.Sdk;
using UnityEngine;
using UnityEngine.Events;

[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("Nikki")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyCopyright("Copyright © 2025 Nikki")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyInformationalVersion("1.0.0")]
[assembly: AssemblyProduct("ApexBanking")]
[assembly: AssemblyTitle("ApexBanking")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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 ApexBanking
{
	[BepInPlugin("ApexBanking", "ApexBanking", "1.0.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class ApexBankingPlugin : BaseUnityPlugin
	{
		public static ConfigEntry<bool> physGrabPatch;

		public static ManualLogSource mls;

		private void Awake()
		{
			//IL_0006: Unknown result type (might be due to invalid IL or missing references)
			//IL_000c: Expected O, but got Unknown
			Harmony val = new Harmony("com.nikki.apexbanking");
			val.PatchAll();
			string directoryName = Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location);
			string text = Path.Combine(directoryName, "apexbanking_assets");
			AssetBundle val2 = AssetBundle.LoadFromFile(text);
			LevelContent val3 = val2.LoadAsset<LevelContent>("Apex Banking Level");
			Levels.RegisterLevel(val3);
			mls = Logger.CreateLogSource("ApexBanking");
			physGrabPatch = ((BaseUnityPlugin)this).Config.Bind<bool>("Technical", "Phys Grab Patch", true, "Should APEX Banking patch the Phys Grabber and ShouldHits LayerMask to prevent grabbing things through glass, and prevent enemies shooting through glass? This should only be disabled if incompatibilities arise.");
			if (physGrabPatch.Value)
			{
				mls.LogDebug((object)"Patching LayerMaskGetShouldHits() to prevent enemies from shooting through the glass!");
			}
		}

		public static LayerMask LayerMaskGetIntruders()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0031: Unknown result type (might be due to invalid IL or missing references)
			//IL_0034: Unknown result type (might be due to invalid IL or missing references)
			return LayerMask.op_Implicit(LayerMask.GetMask(new string[4] { "Player", "PhysGrabObject", "PhysGrabObjectCart", "Enemy" }));
		}
	}
	public class PhysGrabPatcher : MonoBehaviour
	{
		private void Awake()
		{
			//IL_002d: 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_0050: Unknown result type (might be due to invalid IL or missing references)
			if (!ApexBankingPlugin.physGrabPatch.Value)
			{
				return;
			}
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				item.physGrabber.mask = LayerMask.op_Implicit(LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) - LayerMask.GetMask(new string[1] { "Player" }));
			}
			ApexBankingPlugin.mls.LogDebug((object)"Applying patch to PhysGrabbers so that glass works properly!");
		}

		private void OnDestroy()
		{
			//IL_0030: Unknown result type (might be due to invalid IL or missing references)
			//IL_0062: Unknown result type (might be due to invalid IL or missing references)
			//IL_0067: Unknown result type (might be due to invalid IL or missing references)
			if (!ApexBankingPlugin.physGrabPatch.Value)
			{
				return;
			}
			foreach (PlayerAvatar item in SemiFunc.PlayerGetAll())
			{
				item.physGrabber.mask = LayerMask.op_Implicit(LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) - LayerMask.GetMask(new string[1] { "Player" }) - LayerMask.GetMask(new string[1] { "Other" }));
			}
			ApexBankingPlugin.mls.LogDebug((object)"Removing patch from PhysGrabbers to avoid conflicts.");
		}
	}
	[HarmonyPatch(typeof(SemiFunc), "LayerMaskGetVisionObstruct")]
	public class LayerMaskPatcher
	{
		private static bool Prefix(ref LayerMask __result)
		{
			//IL_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009d: Unknown result type (might be due to invalid IL or missing references)
			if (!ApexBankingPlugin.physGrabPatch.Value || ((Object)(object)LevelGenerator.Instance != (Object)null && (Object)(object)LevelGenerator.Instance.Level != (Object)null && LevelGenerator.Instance.Level.ResourcePath != "Bank"))
			{
				return true;
			}
			__result = LayerMask.op_Implicit(LayerMask.GetMask(new string[7] { "Default", "Player", "PhysGrabObject", "PhysGrabObjectCart", "PhysGrabObjectHinge", "StaticGrabObject", "Other" }));
			return false;
		}
	}
	[HarmonyPatch(typeof(Enemy), "Awake")]
	public class EnemyVisionMaskPatcher
	{
		private static IEnumerable<CodeInstruction> Transpiler(IEnumerable<CodeInstruction> instructions)
		{
			//IL_0130: Unknown result type (might be due to invalid IL or missing references)
			//IL_013a: Expected O, but got Unknown
			//IL_00e8: Unknown result type (might be due to invalid IL or missing references)
			//IL_00f2: Expected O, but got Unknown
			List<CodeInstruction> list = new List<CodeInstruction>(instructions);
			MethodInfo methodInfo = AccessTools.Method(typeof(EnemyVisionMaskPatcher), "LayerMaskGetVisionObstructGlassFixed", (Type[])null, (Type[])null);
			for (int i = 0; i < list.Count; i++)
			{
				if (list[i].opcode == OpCodes.Stfld && list[i].operand.Equals(AccessTools.Field(typeof(Enemy), "VisionMask")))
				{
					int num = i;
					while (num > 0 && !(list[num].opcode == OpCodes.Ldarg_0))
					{
						num--;
					}
					if (num > 0 && list[num].opcode == OpCodes.Ldarg_0)
					{
						list.RemoveRange(num + 1, i - num - 1);
						list.Insert(num + 1, new CodeInstruction(OpCodes.Call, (object)methodInfo));
					}
					break;
				}
			}
			if (list.Last().opcode != OpCodes.Ret)
			{
				list.Add(new CodeInstruction(OpCodes.Ret, (object)null));
			}
			return list;
		}

		public static LayerMask LayerMaskGetVisionObstructGlassFixed()
		{
			//IL_0001: 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_0091: 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)
			//IL_0074: Unknown result type (might be due to invalid IL or missing references)
			//IL_0094: Unknown result type (might be due to invalid IL or missing references)
			int num = LayerMask.op_Implicit(SemiFunc.LayerMaskGetVisionObstruct()) + LayerMask.GetMask(new string[1] { "HideTriggers" });
			if (!ApexBankingPlugin.physGrabPatch.Value || ((Object)(object)LevelGenerator.Instance != (Object)null && (Object)(object)LevelGenerator.Instance.Level != (Object)null && LevelGenerator.Instance.Level.ResourcePath != "Bank"))
			{
				return LayerMask.op_Implicit(num);
			}
			return LayerMask.op_Implicit(num - LayerMask.GetMask(new string[1] { "Other" }));
		}
	}
	public class LevelPointVisualizer : MonoBehaviour
	{
		private LevelPoint[] levelPoints;

		private BoxCollider levelPointTrigger;

		private Vector3 offset = new Vector3(0.1f, 0f, 0.1f);

		private void OnDrawGizmos()
		{
			//IL_006d: 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)
			//IL_007f: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			//IL_008f: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0170: Unknown result type (might be due to invalid IL or missing references)
			//IL_0182: Unknown result type (might be due to invalid IL or missing references)
			//IL_018d: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fb: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0113: Unknown result type (might be due to invalid IL or missing references)
			//IL_0118: Unknown result type (might be due to invalid IL or missing references)
			//IL_0123: Unknown result type (might be due to invalid IL or missing references)
			//IL_0129: Unknown result type (might be due to invalid IL or missing references)
			//IL_012e: Unknown result type (might be due to invalid IL or missing references)
			//IL_013f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0145: Unknown result type (might be due to invalid IL or missing references)
			//IL_014a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0156: Unknown result type (might be due to invalid IL or missing references)
			//IL_015c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0161: Unknown result type (might be due to invalid IL or missing references)
			levelPoints = ((Component)this).GetComponentsInChildren<LevelPoint>();
			if (levelPoints == null || levelPoints.Length == 0)
			{
				return;
			}
			LevelPoint[] array = levelPoints;
			foreach (LevelPoint val in array)
			{
				levelPointTrigger = ((Component)val).gameObject.GetComponent<BoxCollider>();
				if (val.ModuleConnect)
				{
					Gizmos.color = Color.yellow;
				}
				else
				{
					Gizmos.color = Color.green;
				}
				Gizmos.DrawCube(((Component)val).transform.position + levelPointTrigger.center, levelPointTrigger.size);
				if (val.ConnectedPoints == null || levelPoints.Length == 0)
				{
					continue;
				}
				foreach (LevelPoint connectedPoint in val.ConnectedPoints)
				{
					List<LevelPoint> connectedPoints = connectedPoint.ConnectedPoints;
					if (connectedPoints.Contains(val))
					{
						Gizmos.color = Color.green;
						Gizmos.DrawLine(((Component)connectedPoint).transform.position + offset, ((Component)val).transform.position + offset);
						Gizmos.DrawLine(((Component)val).transform.position - offset, ((Component)connectedPoint).transform.position - offset);
					}
					else
					{
						Gizmos.color = Color.red;
						Gizmos.DrawLine(((Component)connectedPoint).transform.position, ((Component)val).transform.position);
					}
				}
			}
		}
	}
	public static class MyPluginInfo
	{
		public const string PLUGIN_GUID = "ApexBanking";

		public const string PLUGIN_NAME = "ApexBanking";

		public const string PLUGIN_VERSION = "1.0.0";
	}
}
namespace ApexBanking.Scripts
{
	public class Alarm : MonoBehaviour
	{
		private float alarmTimer = 15f;

		private Transform alarmPosition;

		public Transform alarmRallyPoint;

		public Sound alarm;

		public Sound alarmGlobal;

		private bool alarmActive = false;

		private float currentAlarmTime = 0f;

		private void Start()
		{
			alarmActive = false;
			alarmPosition = ((Component)this).transform;
		}

		private void Update()
		{
			//IL_005a: 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)
			if (currentAlarmTime >= 0f)
			{
				currentAlarmTime -= Time.deltaTime;
				if ((Object)(object)alarmRallyPoint != (Object)null)
				{
					SemiFunc.EnemyInvestigate(alarmRallyPoint.position, 75f, false);
				}
				else
				{
					SemiFunc.EnemyInvestigate(alarmPosition.position, 75f, false);
				}
			}
			else if (alarmActive)
			{
				AlarmStop();
			}
		}

		public void AlarmCall()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: Unknown result type (might be due to invalid IL or missing references)
			if (!alarmActive)
			{
				currentAlarmTime = alarmTimer;
				alarm.Play(alarmPosition.position, 1f, 1f, 1f, 1f);
				alarmGlobal.Play(alarmPosition.position, 1f, 1f, 1f, 1f);
				alarmActive = true;
			}
		}

		private void AlarmStop()
		{
			alarmActive = false;
		}
	}
	public class DisableButton : MonoBehaviour
	{
		public GameObject[] disableObjects;

		public AudioSource[] disableAudios;

		private StaticGrabObject grabObject;

		private PhotonView photon;

		private bool buttonActivated;

		private void Awake()
		{
			photon = ((Component)this).GetComponent<PhotonView>();
		}

		public void OnButtonTrigger()
		{
			if (!buttonActivated)
			{
				if (SemiFunc.IsMultiplayer())
				{
					photon.RPC("OnButtonTriggerRPC", (RpcTarget)0, Array.Empty<object>());
				}
				else
				{
					OnButtonTriggerRPC();
				}
			}
		}

		[PunRPC]
		private void OnButtonTriggerRPC()
		{
			GameObject[] array = disableObjects;
			foreach (GameObject val in array)
			{
				val.SetActive(false);
			}
			AudioSource[] array2 = disableAudios;
			foreach (AudioSource val2 in array2)
			{
				((Behaviour)val2).enabled = false;
			}
		}
	}
	public class DoorGlass : MonoBehaviour
	{
		private void Update()
		{
			if (ApexBankingPlugin.physGrabPatch.Value && ((Component)this).gameObject.layer != 3)
			{
				((Component)this).gameObject.layer = 3;
			}
		}
	}
	public class FloorTrap : MonoBehaviour
	{
		private Animator animator;

		private float trapTime = 15f;

		private float trapCooldownTime = 30f;

		private float currentTrapTime;

		private bool trapActive = false;

		public void Start()
		{
			animator = ((Component)this).GetComponent<Animator>();
		}

		public void Update()
		{
			if (currentTrapTime >= 0f)
			{
				currentTrapTime -= Time.deltaTime;
			}
			else if (trapActive)
			{
				TrapStop();
			}
		}

		public void TrapStart()
		{
			if (!(currentTrapTime > 0f))
			{
				currentTrapTime = trapTime;
				animator.SetTrigger("FloorTrap");
				trapActive = true;
			}
		}

		public void TrapStop()
		{
			currentTrapTime = trapCooldownTime;
			trapActive = false;
		}
	}
	public class LaserCulling : MonoBehaviour
	{
		public GameObject laserContainer;

		private float cullCheck = 0.5f;

		private void Start()
		{
			laserContainer.SetActive(false);
			cullCheck = 0.5f;
		}

		private void FixedUpdate()
		{
			//IL_0038: Unknown result type (might be due to invalid IL or missing references)
			//IL_0040: Unknown result type (might be due to invalid IL or missing references)
			//IL_0046: Unknown result type (might be due to invalid IL or missing references)
			cullCheck -= Time.deltaTime;
			if (cullCheck <= 0f)
			{
				if ((Object)(object)SemiFunc.PlayerGetNearestPlayerAvatarWithinRange(37.5f, laserContainer.transform.position, false, default(LayerMask)) != (Object)null)
				{
					laserContainer.SetActive(true);
				}
				else
				{
					laserContainer.SetActive(false);
				}
				cullCheck = 0.5f;
			}
		}
	}
	public class LaserMoving : MonoBehaviour
	{
		public LineRenderer laserRenderer;

		public float laserCooldown = 3f;

		public GameObject laserHitFX;

		public Transform laserStart;

		public Transform laserEnd;

		public UnityEvent onLaserHit;

		public bool areEnemiesAffected = false;

		private bool laserTriggered = false;

		private float laserTimer;

		private PhotonView photonView;

		private void Start()
		{
			laserTimer = laserCooldown;
			photonView = ((Component)this).GetComponent<PhotonView>();
		}

		private void Update()
		{
			//IL_001b: Unknown result type (might be due to invalid IL or missing references)
			laserRenderer.useWorldSpace = true;
			laserRenderer.SetPosition(0, laserStart.position);
			if (laserTriggered)
			{
				laserTimer -= Time.deltaTime;
				if (laserTimer <= 0f)
				{
					laserTimer = laserCooldown;
					laserTriggered = false;
				}
			}
		}

		public static bool IsInLayerMask(GameObject obj, LayerMask mask)
		{
			return (((LayerMask)(ref mask)).value & (1 << obj.layer)) != 0;
		}

		public static bool IsInLayerMask(int layer, LayerMask mask)
		{
			return (((LayerMask)(ref mask)).value & (1 << layer)) != 0;
		}

		private void FixedUpdate()
		{
			LaserRaycast();
		}

		private void LaserRaycast()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0180: Unknown result type (might be due to invalid IL or missing references)
			//IL_019c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = laserStart.position;
			Vector3 val = laserEnd.position - laserStart.position;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			val = laserStart.position - laserEnd.position;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(position, normalized, ref val2, ((Vector3)(ref val)).magnitude, LayerMask.op_Implicit(SemiFunc.LayerMaskGetShouldHits())))
			{
				laserHitFX.transform.position = ((RaycastHit)(ref val2)).point;
				laserRenderer.SetPosition(1, ((RaycastHit)(ref val2)).point);
				PhysGrabObjectCollider val3 = default(PhysGrabObjectCollider);
				if (IsInLayerMask(((Component)((RaycastHit)(ref val2)).collider).gameObject, ApexBankingPlugin.LayerMaskGetIntruders()) && !laserTriggered && (!((Component)((RaycastHit)(ref val2)).collider).gameObject.TryGetComponent<PhysGrabObjectCollider>(ref val3) || areEnemiesAffected || !val3.physGrabObject.hasNeverBeenGrabbed) && (!((Object)(object)((Component)((RaycastHit)(ref val2)).collider).GetComponentInParent<EnemyParent>() != (Object)null) || areEnemiesAffected) && (((Component)((RaycastHit)(ref val2)).collider).gameObject.layer != 10 || areEnemiesAffected))
				{
					onLaserHit.Invoke();
					laserTriggered = true;
				}
			}
			else
			{
				laserRenderer.SetPosition(1, laserEnd.position);
				laserHitFX.transform.position = laserEnd.position;
			}
		}

		[PunRPC]
		private void LaserRaycastRPC()
		{
			laserTriggered = true;
		}
	}
	public class LaserStationary : MonoBehaviour
	{
		public Collider laserTrigger;

		public LineRenderer laserRenderer;

		public float laserCooldown = 3f;

		public GameObject laserHitFX;

		public Transform laserStart;

		public Transform laserEnd;

		public UnityEvent onLaserHit;

		public bool areEnemiesAffected = false;

		private bool laserTriggered = false;

		private float laserTimer;

		private PhotonView photonView;

		private void Start()
		{
			laserTimer = laserCooldown;
			photonView = ((Component)this).GetComponent<PhotonView>();
		}

		private void Awake()
		{
			//IL_001b: 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)
			laserRenderer.useWorldSpace = true;
			laserRenderer.SetPosition(0, laserStart.position);
			laserRenderer.SetPosition(1, laserEnd.position);
			LaserRaycast();
		}

		private void Update()
		{
			if (laserTriggered)
			{
				laserTimer -= Time.deltaTime;
				if (laserTimer <= 0f)
				{
					laserTimer = laserCooldown;
					laserTriggered = false;
				}
			}
		}

		public static bool IsInLayerMask(GameObject obj, LayerMask mask)
		{
			return (((LayerMask)(ref mask)).value & (1 << obj.layer)) != 0;
		}

		public static bool IsInLayerMask(int layer, LayerMask mask)
		{
			return (((LayerMask)(ref mask)).value & (1 << layer)) != 0;
		}

		private void OnTriggerEnter()
		{
			LaserRaycast();
		}

		private void OnTriggerStay()
		{
			LaserRaycast();
		}

		private void OnTriggerExit()
		{
			LaserRaycast();
		}

		private void LaserRaycast()
		{
			//IL_0007: Unknown result type (might be due to invalid IL or missing references)
			//IL_0012: Unknown result type (might be due to invalid IL or missing references)
			//IL_001d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0022: Unknown result type (might be due to invalid IL or missing references)
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_002a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0037: Unknown result type (might be due to invalid IL or missing references)
			//IL_0042: Unknown result type (might be due to invalid IL or missing references)
			//IL_0047: Unknown result type (might be due to invalid IL or missing references)
			//IL_004c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0054: Unknown result type (might be due to invalid IL or missing references)
			//IL_0185: Unknown result type (might be due to invalid IL or missing references)
			//IL_01a1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0078: 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_00a3: Unknown result type (might be due to invalid IL or missing references)
			Vector3 position = laserStart.position;
			Vector3 val = laserEnd.position - laserStart.position;
			Vector3 normalized = ((Vector3)(ref val)).normalized;
			val = laserStart.position - laserEnd.position;
			RaycastHit val2 = default(RaycastHit);
			if (Physics.Raycast(position, normalized, ref val2, ((Vector3)(ref val)).magnitude, LayerMask.op_Implicit(SemiFunc.LayerMaskGetShouldHits())))
			{
				laserHitFX.transform.position = ((RaycastHit)(ref val2)).point;
				laserRenderer.SetPosition(1, ((RaycastHit)(ref val2)).point);
				PhysGrabObjectCollider val3 = default(PhysGrabObjectCollider);
				if (IsInLayerMask(((Component)((RaycastHit)(ref val2)).collider).gameObject, ApexBankingPlugin.LayerMaskGetIntruders()) && !laserTriggered && (!((Component)((RaycastHit)(ref val2)).collider).gameObject.TryGetComponent<PhysGrabObjectCollider>(ref val3) || areEnemiesAffected || !val3.physGrabObject.hasNeverBeenGrabbed) && (!((Object)(object)((Component)((RaycastHit)(ref val2)).collider).gameObject.GetComponentInParent<EnemyParent>() != (Object)null) || areEnemiesAffected) && (((Component)((RaycastHit)(ref val2)).collider).gameObject.layer != 10 || areEnemiesAffected))
				{
					onLaserHit.Invoke();
					laserTriggered = true;
				}
			}
			else
			{
				laserRenderer.SetPosition(1, laserEnd.position);
				laserHitFX.transform.position = laserEnd.position;
			}
		}

		[PunRPC]
		private void LaserRaycastRPC()
		{
			laserTriggered = true;
		}
	}
	public class SlidingPainting : MonoBehaviour
	{
		public enum BounceEffect
		{
			Light,
			Medium,
			Heavy
		}

		[CompilerGenerated]
		private sealed class <RigidBodyGet>d__50 : IEnumerator<object>, IEnumerator, IDisposable
		{
			private int <>1__state;

			private object <>2__current;

			public SlidingPainting <>4__this;

			object IEnumerator<object>.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			object IEnumerator.Current
			{
				[DebuggerHidden]
				get
				{
					return <>2__current;
				}
			}

			[DebuggerHidden]
			public <RigidBodyGet>d__50(int <>1__state)
			{
				this.<>1__state = <>1__state;
			}

			[DebuggerHidden]
			void IDisposable.Dispose()
			{
				<>1__state = -2;
			}

			private bool MoveNext()
			{
				//IL_0029: Unknown result type (might be due to invalid IL or missing references)
				//IL_0033: Expected O, but got Unknown
				switch (<>1__state)
				{
				default:
					return false;
				case 0:
					<>1__state = -1;
					break;
				case 1:
					<>1__state = -1;
					break;
				}
				if (!<>4__this.physGrabObject.spawned)
				{
					<>2__current = (object)new WaitForSeconds(0.1f);
					<>1__state = 1;
					return true;
				}
				((Component)<>4__this.hingePoint).transform.parent = ((Component)<>4__this).transform.parent;
				<>4__this.WallTagSet();
				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();
			}
		}

		private PhotonView photon;

		public HingeAudio hingeAudio;

		public AudioSource audioSource;

		[Space]
		public Transform hingePoint;

		private Rigidbody hingePointRb;

		private bool hingePointHasRb;

		public float hingeOffsetPositiveThreshold = 15f;

		public float hingeOffsetNegativeThreshold = -15f;

		public float hingeOffsetSpeed = 5f;

		public Vector3 hingeOffsetPositive;

		public Vector3 hingeOffsetNegative;

		private Vector3 hingePointPosition;

		[Space]
		public float hingeBreakShake = 3f;

		[Space]
		public float closeThreshold = 10f;

		public float closeMaxSpeed = 1f;

		public float closeHeavySpeed = 5f;

		public float closeShake = 3f;

		private bool closeHeavy;

		private float closeSpeed;

		internal bool closed = true;

		private float closedForceTimer;

		private bool closing;

		private float closeDisableTimer;

		[Space]
		private float openForceNeeded = 0.04f;

		public float openHeavyThreshold = 3f;

		public float openShake = 3f;

		internal ConfigurableJoint joint;

		private PhysGrabObject physGrabObject;

		private PhysGrabObjectImpactDetector impactDetector;

		private bool moveLoopActive;

		private float moveLoopEndDisableTimer;

		[HideInInspector]
		public Sound moveLoop;

		private Vector3 restPosition;

		private Quaternion restRotation;

		internal bool dead;

		private float deadTimer = 0.1f;

		internal bool broken;

		internal float brokenTimer;

		[Space]
		public float drag;

		[Space]
		public float bounceAmount = 0.2f;

		public BounceEffect bounceEffect = BounceEffect.Medium;

		private Vector3 bounceVelocity;

		private float bounceCooldown;

		[Space]
		public PhysGrabHinge[] wallTagHinges;

		public GameObject[] wallTagObjects;

		private float investigateDelay;

		private float investigateRadius;

		private bool fadeOutFast;

		private void Awake()
		{
			//IL_0071: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
			//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fa: Unknown result type (might be due to invalid IL or missing references)
			//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
			//IL_010b: Unknown result type (might be due to invalid IL or missing references)
			//IL_0110: Unknown result type (might be due to invalid IL or missing references)
			//IL_014d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0153: Expected O, but got Unknown
			photon = ((Component)this).GetComponent<PhotonView>();
			Sound.CopySound(hingeAudio.moveLoop, moveLoop);
			moveLoop.Source = audioSource;
			joint = ((Component)this).GetComponent<ConfigurableJoint>();
			physGrabObject = ((Component)this).GetComponent<PhysGrabObject>();
			impactDetector = ((Component)this).GetComponent<PhysGrabObjectImpactDetector>();
			impactDetector.particleDisable = true;
			((Joint)joint).anchor = hingePoint.localPosition;
			hingePointRb = ((Component)hingePoint).GetComponent<Rigidbody>();
			if (Object.op_Implicit((Object)(object)hingePointRb))
			{
				hingePointHasRb = true;
				hingePointPosition = hingePoint.position;
				hingePointRb.constraints = (RigidbodyConstraints)112;
			}
			if (SemiFunc.IsMultiplayer() && SemiFunc.IsNotMasterClient())
			{
				Object.Destroy((Object)(object)joint);
				joint = null;
				hingePointHasRb = false;
			}
			restPosition = ((Component)this).transform.position;
			restRotation = ((Component)this).transform.rotation;
			((MonoBehaviour)this).StartCoroutine(RigidBodyGet());
			((Component)this).gameObject.layer = LayerMask.NameToLayer("PhysGrabObjectHinge");
			foreach (Transform item in ((Component)this).transform)
			{
				Transform val = item;
				((Component)val).gameObject.layer = LayerMask.NameToLayer("PhysGrabObjectHinge");
			}
		}

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

		private void OnCollisionStay(Collision other)
		{
			if (other.gameObject.CompareTag("Player"))
			{
				closeDisableTimer = 0.1f;
			}
			else if (closing && other.gameObject.CompareTag("Phys Grab Object"))
			{
				closing = false;
			}
		}

		private void OnJointBreak(float breakForce)
		{
			//IL_0030: 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_003f: Unknown result type (might be due to invalid IL or missing references)
			//IL_0061: Unknown result type (might be due to invalid IL or missing references)
			//IL_0066: Unknown result type (might be due to invalid IL or missing references)
			//IL_0070: Unknown result type (might be due to invalid IL or missing references)
			if (GameManager.instance.gameMode == 0 || PhotonNetwork.IsMasterClient)
			{
				physGrabObject.rb.AddForce(-physGrabObject.rb.velocity * 2f, (ForceMode)1);
				physGrabObject.rb.AddTorque(-physGrabObject.rb.angularVelocity * 10f, (ForceMode)1);
				HingeBreakImpulse();
				broken = true;
			}
		}

		private void Update()
		{
			//IL_017c: Unknown result type (might be due to invalid IL or missing references)
			//IL_02b2: Unknown result type (might be due to invalid IL or missing references)
			if (dead)
			{
				deadTimer -= 1f * Time.deltaTime;
				if (deadTimer <= 0f)
				{
					impactDetector.DestroyObject(true);
				}
				return;
			}
			if (broken)
			{
				moveLoop.PlayLoop(false, 1f, 1f, 1f);
				return;
			}
			if (hingeAudio.moveLoopEnabled)
			{
				if (((Vector3)(ref physGrabObject.rbVelocity)).magnitude > hingeAudio.moveLoopThreshold)
				{
					if (!moveLoopActive)
					{
						fadeOutFast = false;
						moveLoopActive = true;
					}
					moveLoop.PlayLoop(true, hingeAudio.moveLoopFadeInSpeed, hingeAudio.moveLoopFadeOutSpeed, 1f);
					moveLoop.LoopPitch = Mathf.Max(moveLoop.Pitch + ((Vector3)(ref physGrabObject.rbVelocity)).magnitude * hingeAudio.moveLoopVelocityMult, 0.1f);
				}
				else
				{
					if (moveLoopActive)
					{
						if (moveLoopEndDisableTimer <= 0f)
						{
							hingeAudio.moveLoopEnd.Play(((Component)moveLoop.Source).transform.position, 1f, 1f, 1f, 1f);
							moveLoopEndDisableTimer = 3f;
						}
						moveLoopActive = false;
					}
					if (fadeOutFast)
					{
						moveLoop.PlayLoop(false, hingeAudio.moveLoopFadeInSpeed, 20f, 1f);
					}
					else
					{
						moveLoop.PlayLoop(false, hingeAudio.moveLoopFadeInSpeed, hingeAudio.moveLoopFadeOutSpeed, 1f);
					}
					moveLoopEndDisableTimer = 0.5f;
				}
				if (moveLoopEndDisableTimer > 0f)
				{
					moveLoopEndDisableTimer -= 1f * Time.deltaTime;
				}
			}
			if (SemiFunc.IsMasterClientOrSingleplayer() && investigateDelay > 0f)
			{
				investigateDelay -= 1f * Time.deltaTime;
				if (investigateDelay <= 0f && physGrabObject.enemyInteractTimer <= 0f)
				{
					EnemyDirector.instance.SetInvestigate(physGrabObject.midPoint, investigateRadius, false);
				}
			}
		}

		private void WallTagSet()
		{
			string text = "Untagged";
			if (closed && !broken && !dead)
			{
				text = "Wall";
			}
			if (text == "Wall" && wallTagHinges.Length != 0)
			{
				PhysGrabHinge[] array = wallTagHinges;
				PhysGrabHinge[] array2 = array;
				foreach (PhysGrabHinge val in array2)
				{
					if (!Object.op_Implicit((Object)(object)val) || !val.closed)
					{
						return;
					}
				}
			}
			if (wallTagObjects.Length == 0)
			{
				return;
			}
			GameObject[] array3 = wallTagObjects;
			GameObject[] array4 = array3;
			foreach (GameObject val2 in array4)
			{
				if (Object.op_Implicit((Object)(object)val2))
				{
					val2.tag = text;
				}
			}
		}

		private void EnemyInvestigate(float radius)
		{
			investigateDelay = 0.1f;
			investigateRadius = radius;
		}

		private void CloseImpulse(bool heavy)
		{
			EnemyInvestigate(1f);
			if (GameManager.instance.gameMode == 0)
			{
				CloseImpulseRPC(heavy);
			}
			else if (PhotonNetwork.IsMasterClient)
			{
				photon.RPC("CloseImpulseRPC", (RpcTarget)0, new object[1] { heavy });
			}
		}

		[PunRPC]
		private void CloseImpulseRPC(bool heavy)
		{
			//IL_002e: 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)
			//IL_00c3: Unknown result type (might be due to invalid IL or missing references)
			//IL_008a: Unknown result type (might be due to invalid IL or missing references)
			fadeOutFast = true;
			GameDirector.instance.CameraImpact.ShakeDistance(closeShake * 0.5f, 3f, 10f, ((Component)this).transform.position, 0.1f);
			GameDirector.instance.CameraShake.ShakeDistance(closeShake, 3f, 10f, ((Component)this).transform.position, 0.1f);
			if (heavy)
			{
				hingeAudio.CloseHeavy.Play(((Component)audioSource).transform.position, 1f, 1f, 1f, 1f);
			}
			else
			{
				hingeAudio.Close.Play(((Component)audioSource).transform.position, 1f, 1f, 1f, 1f);
			}
			moveLoopEndDisableTimer = 1f;
			closed = true;
			WallTagSet();
		}

		private void OpenImpulse()
		{
			EnemyInvestigate(0.5f);
			if (GameManager.instance.gameMode == 0)
			{
				OpenImpulseRPC();
			}
			else if (PhotonNetwork.IsMasterClient)
			{
				photon.RPC("OpenImpulseRPC", (RpcTarget)0, Array.Empty<object>());
			}
		}

		[PunRPC]
		private void OpenImpulseRPC()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
			//IL_009a: Unknown result type (might be due to invalid IL or missing references)
			GameDirector.instance.CameraImpact.ShakeDistance(openShake * 0.5f, 3f, 10f, ((Component)this).transform.position, 0.1f);
			GameDirector.instance.CameraShake.ShakeDistance(openShake, 3f, 10f, ((Component)this).transform.position, 0.1f);
			if (((Vector3)(ref physGrabObject.rbVelocity)).magnitude > openHeavyThreshold)
			{
				hingeAudio.OpenHeavy.Play(((Component)audioSource).transform.position, 1f, 1f, 1f, 1f);
			}
			else
			{
				hingeAudio.Open.Play(((Component)audioSource).transform.position, 1f, 1f, 1f, 1f);
			}
			closed = false;
			WallTagSet();
		}

		private void HingeBreakImpulse()
		{
			if (GameManager.instance.gameMode == 0)
			{
				HingeBreakRPC();
			}
			else if (PhotonNetwork.IsMasterClient)
			{
				photon.RPC("HingeBreakRPC", (RpcTarget)0, Array.Empty<object>());
			}
		}

		[PunRPC]
		private void HingeBreakRPC()
		{
			//IL_0027: Unknown result type (might be due to invalid IL or missing references)
			//IL_0057: 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_0107: Unknown result type (might be due to invalid IL or missing references)
			//IL_010d: Expected O, but got Unknown
			GameDirector.instance.CameraImpact.ShakeDistance(hingeBreakShake * 0.5f, 3f, 10f, ((Component)this).transform.position, 0.1f);
			GameDirector.instance.CameraShake.ShakeDistance(hingeBreakShake, 3f, 10f, ((Component)this).transform.position, 0.1f);
			hingeAudio.HingeBreak.Play(((Component)audioSource).transform.position, 1f, 1f, 1f, 1f);
			physGrabObject.heavyBreakImpulse = true;
			impactDetector.isHinge = false;
			impactDetector.isBrokenHinge = true;
			impactDetector.particleDisable = false;
			broken = true;
			WallTagSet();
			int layer = LayerMask.NameToLayer("PhysGrabObject");
			((Component)this).gameObject.layer = layer;
			foreach (Transform item in ((Component)this).transform)
			{
				Transform val = item;
				((Component)val).gameObject.layer = layer;
			}
			if (hingePointHasRb)
			{
				hingePointRb.useGravity = true;
				hingePointRb.constraints = (RigidbodyConstraints)0;
			}
		}

		public void DestroyHinge()
		{
			if (GameManager.instance.gameMode == 0)
			{
				DestroyHingeRPC();
			}
			else if (PhotonNetwork.IsMasterClient)
			{
				photon.RPC("DestroyHingeRPC", (RpcTarget)0, Array.Empty<object>());
			}
		}

		[PunRPC]
		private void DestroyHingeRPC()
		{
			dead = true;
			WallTagSet();
		}
	}
}
namespace System.Runtime.CompilerServices
{
	[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
	internal sealed class IgnoresAccessChecksToAttribute : Attribute
	{
		public IgnoresAccessChecksToAttribute(string assemblyName)
		{
		}
	}
}