Decompiled source of LethalLaser v1.3.5

BepInEx/plugins/LethalLaser.dll

Decompiled 10 months ago
using System;
using System.Collections;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using System.Runtime.Versioning;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Configuration;
using BepInEx.Logging;
using DunGen;
using HarmonyLib;
using LethalLib.Modules;
using Microsoft.CodeAnalysis;
using Unity.Netcode;
using UnityEngine;
using UnityEngine.InputSystem;
using UnityEngine.XR;

[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: AssemblyTitle("LethalLaser")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("")]
[assembly: AssemblyProduct("LethalLaser")]
[assembly: AssemblyCopyright("Copyright ©  2024")]
[assembly: AssemblyTrademark("")]
[assembly: ComVisible(false)]
[assembly: Guid("497e627b-738e-467c-b3ba-445cee0a5f8f")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: TargetFramework(".NETStandard,Version=v2.1", FrameworkDisplayName = ".NET Standard 2.1")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("1.0.0.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
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.Module, AllowMultiple = false, Inherited = false)]
	internal sealed class RefSafetyRulesAttribute : Attribute
	{
		public readonly int Version;

		public RefSafetyRulesAttribute(int P_0)
		{
			Version = P_0;
		}
	}
}
namespace LethalLaser
{
	[BepInPlugin("florianbutz.lethallaser", "Lethal Laser", "1.3.5.0")]
	[BepInDependency(/*Could not decode attribute arguments.*/)]
	public class LethalLaserBase : BaseUnityPlugin
	{
		private const string modGUID = "florianbutz.lethallaser";

		private const string modName = "Lethal Laser";

		private const string modVersion = "1.3.5.0";

		private static string bundlePath = "";

		private readonly Harmony harmony = new Harmony("florianbutz.lethallaser");

		public static LethalLaserBase instance;

		internal ManualLogSource logSource;

		public static GameObject itemPrefab;

		public static bool DEBUG = false;

		private void Awake()
		{
			//IL_00f6: Unknown result type (might be due to invalid IL or missing references)
			//IL_00fc: Expected O, but got Unknown
			if (Object.op_Implicit((Object)(object)(instance = null)))
			{
				instance = this;
			}
			logSource = Logger.CreateLogSource("Lethal Laser");
			Configuration.Init();
			bundlePath = Path.Combine(Path.GetDirectoryName(((BaseUnityPlugin)this).Info.Location), "laser");
			Assets.LoadAssetBundle(bundlePath);
			AssetBundle bundle = Assets.GetBundle();
			Item val = bundle.LoadAsset<Item>("laseritem");
			LaserGun laserGun = val.spawnPrefab.AddComponent<LaserGun>();
			((GrabbableObject)laserGun).itemProperties = val;
			laserGun.laserChargeSound = bundle.LoadAsset<AudioClip>("lasercharge");
			laserGun.laserShootSound = bundle.LoadAsset<AudioClip>("lasershoot");
			laserGun.laserInvalidShootSound = bundle.LoadAsset<AudioClip>("invalidshoot");
			laserGun.laserOverchargeWarning = bundle.LoadAsset<AudioClip>("laseroverchargewarning");
			laserGun.laserRecharged = bundle.LoadAsset<AudioClip>("laserrecharged");
			laserGun.apperatusExplosionChargePrefab = bundle.LoadAsset<GameObject>("ApparatusExplode");
			laserGun.apperatusExplosionPrefab = bundle.LoadAsset<GameObject>("ApparatusExplodeForReal");
			TerminalNode val2 = (TerminalNode)ScriptableObject.CreateInstance("TerminalNode");
			Items.RegisterShopItem(val, (TerminalNode)null, (TerminalNode)null, val2, 1300);
			itemPrefab = val.spawnPrefab;
			Type[] types = Assembly.GetExecutingAssembly().GetTypes();
			for (int i = 0; i < types.Length; i++)
			{
				MethodInfo[] methods = types[i].GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
				foreach (MethodInfo methodInfo in methods)
				{
					if (methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false).Length != 0)
					{
						methodInfo.Invoke(null, null);
					}
				}
			}
			logSource.LogInfo((object)"Lethal Laser has started successfully!");
			harmony.PatchAll();
		}
	}
	public class LaserGun : GrabbableObject
	{
		private bool isItemInMainHand;

		public LineRenderer lineRenderer;

		public Animator anim;

		public AudioSource source;

		public AudioClip laserChargeSound;

		public AudioClip laserShootSound;

		public AudioClip laserInvalidShootSound;

		public AudioClip laserOverchargeWarning;

		public AudioClip laserRecharged;

		public SkinnedMeshRenderer displayNeedle;

		public GameObject reloadGlow;

		public GameObject laserPointer;

		public GameObject apperatusExplosionChargePrefab;

		public GameObject apperatusExplosionPrefab;

		public PlayerActions playerActions = new PlayerActions();

		private bool isCharging;

		private float timerTime;

		private float needleTime;

		private float needleWiggleAmount = 0.15f;

		private float lastTimerTime = 1f;

		private Coroutine laserRoutine;

		private bool ovSoundTriggered;

		private bool shTriggered;

		private void OnEnable()
		{
			playerActions.Enable();
		}

		private void OnDisable()
		{
			playerActions.Disable();
		}

		public void Awake()
		{
			//IL_002c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0036: Expected O, but got Unknown
			base.grabbable = true;
			base.grabbableToEnemies = false;
			base.mainObjectRenderer = ((Component)this).GetComponentInChildren<MeshRenderer>();
			base.useCooldown = 5f;
			base.insertedBattery = new Battery(false, 1f);
			anim = ((Component)this).GetComponent<Animator>();
			source = ((Component)this).GetComponent<AudioSource>();
			lineRenderer = ((Component)this).gameObject.GetComponentInChildren<LineRenderer>();
			lineRenderer.useWorldSpace = true;
			SkinnedMeshRenderer[] componentsInChildren = ((Component)this).gameObject.GetComponentsInChildren<SkinnedMeshRenderer>();
			foreach (SkinnedMeshRenderer val in componentsInChildren)
			{
				if (((Object)((Component)val).gameObject).name.Equals("ChargeLevelEnergyDisplay"))
				{
					displayNeedle = val;
				}
			}
			for (int j = 0; j < ((Component)this).transform.childCount; j++)
			{
				if (((Object)((Component)((Component)this).transform.GetChild(j)).gameObject).name.Equals("ReloadGlow"))
				{
					reloadGlow = ((Component)((Component)this).transform.GetChild(j)).gameObject;
				}
				if (((Object)((Component)((Component)this).transform.GetChild(j)).gameObject).name.Equals("LaserPointer"))
				{
					laserPointer = ((Component)((Component)this).transform.GetChild(j)).gameObject;
				}
			}
			((MonoBehaviour)this).StartCoroutine(UpdateLaser());
			((MonoBehaviour)this).StartCoroutine(UpdateBattery());
		}

		[ClientRpc]
		public void ChargeClientRpc()
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1780404827u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1780404827u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner)
				{
					Debug.Log((object)"Charge!");
					timerTime = 0f;
					isCharging = true;
					anim.Play("Charging");
					source.PlayOneShot(laserChargeSound);
				}
			}
		}

		[ClientRpc]
		public void ShootClientRpc(bool didOvercharge, float chargeTime, Vector3 hitPosition)
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_011b: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1388071734u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref didOvercharge, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref chargeTime, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref hitPosition);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1388071734u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost) && !((NetworkBehaviour)this).IsOwner)
				{
					Debug.Log((object)"Shoot!");
					timerTime = chargeTime;
					LaserShoot(didOvercharge, isServerRpc: true, hitPosition);
				}
			}
		}

		[ClientRpc]
		public void CancleChargeClientRpc()
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(1660911668u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 1660911668u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					Debug.Log((object)"Cancle Shoot!");
					isCharging = false;
					source.Stop();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void CallChargeServerRpc()
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(114478777u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 114478777u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ChargeClientRpc();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void CallShootServerRpc(bool didOvercharge, float chargeTime, Vector3 hitPosition = default(Vector3))
		{
			//IL_0024: Unknown result type (might be due to invalid IL or missing references)
			//IL_002e: Invalid comparison between Unknown and I4
			//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d9: 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_0098: Unknown result type (might be due to invalid IL or missing references)
			//IL_009e: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0101: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = ((NetworkBehaviour)this).NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(1900954662u, val, (RpcDelivery)0);
					((FastBufferWriter)(ref val2)).WriteValueSafe<bool>(ref didOvercharge, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe<float>(ref chargeTime, default(ForPrimitives));
					((FastBufferWriter)(ref val2)).WriteValueSafe(ref hitPosition);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 1900954662u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					ShootClientRpc(didOvercharge, chargeTime, hitPosition);
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void CallCancleChargeClientServerRpc()
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(2525251059u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 2525251059u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					CancleChargeClientRpc();
				}
			}
		}

		[ServerRpc(RequireOwnership = false)]
		public void DischargeEffectServerRpc()
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 1 && (networkManager.IsClient || networkManager.IsHost))
				{
					ServerRpcParams val = default(ServerRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendServerRpc(975004685u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendServerRpc(ref val2, 975004685u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 1 && (networkManager.IsServer || networkManager.IsHost))
				{
					DischargeEffectClientRpc();
				}
			}
		}

		[ClientRpc]
		public void DischargeEffectClientRpc()
		{
			//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)((NetworkBehaviour)this).__rpc_exec_stage != 2 && (networkManager.IsServer || networkManager.IsHost))
				{
					ClientRpcParams val = default(ClientRpcParams);
					FastBufferWriter val2 = ((NetworkBehaviour)this).__beginSendClientRpc(3291581789u, val, (RpcDelivery)0);
					((NetworkBehaviour)this).__endSendClientRpc(ref val2, 3291581789u, val, (RpcDelivery)0);
				}
				if ((int)((NetworkBehaviour)this).__rpc_exec_stage == 2 && (networkManager.IsClient || networkManager.IsHost))
				{
					isCharging = false;
					timerTime = 0f;
					anim.Play("Discharge");
					source.Stop();
					source.PlayOneShot(laserInvalidShootSound);
				}
			}
		}

		private IEnumerator UpdateBattery()
		{
			if (base.insertedBattery.charge >= 1f && base.insertedBattery.empty)
			{
				source.PlayOneShot(laserRecharged);
			}
			if (base.insertedBattery.charge < 1f && !isCharging)
			{
				if (Configuration.AutomaticRecharge)
				{
					Battery insertedBattery = base.insertedBattery;
					insertedBattery.charge += Time.unscaledDeltaTime * (0.035f * Configuration.RechargeSpeed) / (lastTimerTime / 2f);
				}
				if ((Object)(object)reloadGlow != (Object)null)
				{
					reloadGlow.SetActive(true);
				}
			}
			else if (base.insertedBattery.charge >= 1f)
			{
				if ((Object)(object)reloadGlow != (Object)null)
				{
					reloadGlow.SetActive(false);
				}
				base.insertedBattery.empty = false;
			}
			else if ((Object)(object)reloadGlow != (Object)null)
			{
				reloadGlow.SetActive(false);
			}
			yield return (object)new WaitForEndOfFrame();
			((MonoBehaviour)this).StartCoroutine(UpdateBattery());
		}

		private bool IsChargeButtonHeld()
		{
			return IngamePlayerSettings.Instance.playerInput.actions.FindAction("Movement/Use", false).IsPressed();
		}

		public void VibrateController(XRNode hand, float duration, float amplitude)
		{
		}

		private IEnumerator StopVibrate(float duration)
		{
			yield return (object)new WaitForSeconds(duration);
			Gamepad.current.SetMotorSpeeds(0f, 0f);
		}

		private IEnumerator UpdateLaser()
		{
			if (isCharging)
			{
				timerTime += 0.075f;
			}
			if ((Object)(object)displayNeedle != (Object)null)
			{
				float num = Random.Range(0f - needleWiggleAmount, needleWiggleAmount);
				needleTime = Mathf.Clamp(Mathf.Lerp(0f, 100f, (timerTime + num * (timerTime / 1.5f)) / 4f), 0f, 100f);
				displayNeedle.SetBlendShapeWeight(0, needleTime);
			}
			else if (LethalLaserBase.DEBUG)
			{
				Debug.Log((object)"Display needle null!");
			}
			if (!IsChargeButtonHeld() && isCharging && ((NetworkBehaviour)this).IsOwner)
			{
				Debug.Log((object)"Cancled shoot with button");
				CallCancleChargeClientServerRpc();
				LaserShoot(didOvercharge: false);
			}
			if (timerTime >= 2f && !ovSoundTriggered && isCharging)
			{
				ovSoundTriggered = true;
				source.PlayOneShot(laserOverchargeWarning);
			}
			if (timerTime >= 7f && !shTriggered && isCharging)
			{
				shTriggered = true;
				if (isCharging)
				{
					LaserShoot(didOvercharge: true);
				}
			}
			yield return (object)new WaitForSecondsRealtime(0.05f);
			if (LethalLaserBase.DEBUG && !timerTime.ToString().Equals("0"))
			{
				Debug.Log((object)("Timer Time: " + timerTime));
			}
			((MonoBehaviour)this).StartCoroutine(UpdateLaser());
		}

		public override void ItemActivate(bool used, bool buttonDown = true)
		{
			//IL_0008: Unknown result type (might be due to invalid IL or missing references)
			((GrabbableObject)this).ItemActivate(used, buttonDown);
			try
			{
				Landmine.SpawnExplosion(Vector3.negativeInfinity, false, 0f, 0f);
			}
			catch (Exception)
			{
				Debug.LogWarning((object)"Could not find instance of Landmine class. Laser can't be fired");
				return;
			}
			ovSoundTriggered = false;
			shTriggered = false;
			Debug.Log((object)"Charge!");
			VibrateController((XRNode)5, 1f, 0.35f);
			if (base.insertedBattery.empty)
			{
				DischargeEffectServerRpc();
				Debug.Log((object)"Battery empty!");
				return;
			}
			timerTime = 0f;
			isCharging = true;
			laserRoutine = ((MonoBehaviour)this).StartCoroutine(Laser());
			CallChargeServerRpc();
		}

		private IEnumerator Laser()
		{
			if (((NetworkBehaviour)this).IsOwner)
			{
				anim.Play("Charging");
				source.PlayOneShot(laserChargeSound);
				HUDManager.Instance.ShakeCamera((ScreenShakeType)2);
				yield return (object)new WaitForSecondsRealtime(0.5f);
				HUDManager.Instance.ShakeCamera((ScreenShakeType)2);
			}
		}

		private void LaserShoot(bool didOvercharge, bool isServerRpc = false, Vector3 hitPositionSync = default(Vector3))
		{
			//IL_05c6: Unknown result type (might be due to invalid IL or missing references)
			//IL_05d1: Unknown result type (might be due to invalid IL or missing references)
			//IL_0069: Unknown result type (might be due to invalid IL or missing references)
			//IL_00e5: 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_0105: Unknown result type (might be due to invalid IL or missing references)
			//IL_010a: Unknown result type (might be due to invalid IL or missing references)
			//IL_0119: Unknown result type (might be due to invalid IL or missing references)
			//IL_008d: 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_0160: Unknown result type (might be due to invalid IL or missing references)
			//IL_03b6: Unknown result type (might be due to invalid IL or missing references)
			//IL_0172: Unknown result type (might be due to invalid IL or missing references)
			//IL_0565: Unknown result type (might be due to invalid IL or missing references)
			//IL_0387: Unknown result type (might be due to invalid IL or missing references)
			//IL_03a7: Unknown result type (might be due to invalid IL or missing references)
			//IL_040d: Unknown result type (might be due to invalid IL or missing references)
			//IL_0415: Unknown result type (might be due to invalid IL or missing references)
			//IL_01d9: Unknown result type (might be due to invalid IL or missing references)
			//IL_01e5: Unknown result type (might be due to invalid IL or missing references)
			//IL_0238: Unknown result type (might be due to invalid IL or missing references)
			//IL_025b: Unknown result type (might be due to invalid IL or missing references)
			//IL_047f: Unknown result type (might be due to invalid IL or missing references)
			//IL_04a2: Unknown result type (might be due to invalid IL or missing references)
			//IL_054c: Unknown result type (might be due to invalid IL or missing references)
			//IL_0354: Unknown result type (might be due to invalid IL or missing references)
			if (laserRoutine != null)
			{
				((MonoBehaviour)this).StopCoroutine(laserRoutine);
				laserRoutine = null;
			}
			source.Stop();
			anim.Play("Idle");
			lastTimerTime = timerTime;
			isCharging = false;
			VibrateController((XRNode)5, 1f, 1.5f);
			try
			{
				if (didOvercharge)
				{
					SpawnExplosion(((Component)this).gameObject.transform.position, 4f);
					if (!isServerRpc)
					{
						CallShootServerRpc(didOvercharge: true, 4f, ((Component)this).gameObject.transform.position);
					}
					DischargeEffectServerRpc();
					return;
				}
				if (timerTime < 1f)
				{
					DischargeEffectServerRpc();
					HUDManager.Instance.DisplayTip("TIP:", "Charge the laser for a longer time to be able to fire.", false, true, "LLTip_Undercharge");
					return;
				}
				Ray val = new Ray(((Component)lineRenderer).gameObject.transform.position, ((Component)lineRenderer).gameObject.transform.forward);
				LayerMask val2 = LayerMask.op_Implicit(-1);
				RaycastHit val3 = default(RaycastHit);
				if (Physics.Raycast(val, ref val3, 15f * timerTime, LayerMask.op_Implicit(val2), (QueryTriggerInteraction)1))
				{
					Debug.Log((object)"Hit!");
					if (LethalLaserBase.DEBUG)
					{
						lineRenderer.SetPosition(0, ((Component)lineRenderer).transform.position);
						lineRenderer.SetPosition(1, ((RaycastHit)(ref val3)).point);
					}
					if (!isServerRpc)
					{
						Collider[] array = Physics.OverlapSphere(((RaycastHit)(ref val3)).point, 1f);
						DoorLock val4 = default(DoorLock);
						GrabbableObject val5 = default(GrabbableObject);
						LungProp val6 = default(LungProp);
						Door val7 = default(Door);
						Turret val8 = default(Turret);
						TerminalAccessibleObject val9 = default(TerminalAccessibleObject);
						Rigidbody val10 = default(Rigidbody);
						foreach (Collider obj in array)
						{
							if (((Component)obj).gameObject.TryGetComponent<DoorLock>(ref val4))
							{
								if ((Object)(object)val4 != (Object)null && val4.isLocked && !val4.isPickingLock)
								{
									val4.UnlockDoorSyncWithServer();
									Debug.Log((object)"Shot at locked door");
								}
								Object.Destroy((Object)(object)val4);
								AddExplosionToObject(((Component)val4).gameObject, ((RaycastHit)(ref val3)).point, 45f, ((RaycastHit)(ref val3)).normal);
							}
							if (((Component)obj).gameObject.TryGetComponent<GrabbableObject>(ref val5))
							{
								if (val5.itemProperties.itemName.Equals("Apparatus"))
								{
									Object.Instantiate<GameObject>(apperatusExplosionChargePrefab, ((Component)val5).transform);
									((MonoBehaviour)this).StartCoroutine(DelayedExplosion(((Component)val5).transform.position, 50f, 3f));
									((MonoBehaviour)this).StartCoroutine(SpawnExplosionEffect(((Component)val5).transform.position));
									((Behaviour)val5).enabled = false;
									Object.Destroy((Object)(object)((Component)val5).gameObject, 3f);
									Debug.Log((object)"Hit Apperatus!");
									if (((Component)val5).TryGetComponent<LungProp>(ref val6))
									{
										if (val6.isLungDocked)
										{
											((MonoBehaviour)this).StartCoroutine(ApperatusSequence(val6));
										}
										val6.isLungDocked = false;
										val6.isLungDockedInElevator = false;
										val6.isLungPowered = false;
									}
								}
								Debug.Log((object)"Hit Prop");
							}
							if (((Component)obj).gameObject.TryGetComponent<Door>(ref val7))
							{
								val7.SetDoorState(true);
								Debug.Log((object)"Shot at small door");
							}
							if (((Component)obj).gameObject.TryGetComponent<Turret>(ref val8))
							{
								val8.ToggleTurretEnabled(false);
								Debug.Log((object)"Shot at turret");
							}
							if (((Component)obj).gameObject.TryGetComponent<TerminalAccessibleObject>(ref val9))
							{
								val9.SetDoorToggleLocalClient();
								Debug.Log((object)"Shot at locked big door");
							}
							if (((Component)obj).gameObject.TryGetComponent<Rigidbody>(ref val10))
							{
								val10.AddExplosionForce(2f * timerTime, ((RaycastHit)(ref val3)).point, 1.5f);
							}
							Debug.Log((object)(((Object)obj).name + " was hit!"));
						}
						SpawnExplosion(((RaycastHit)(ref val3)).point, timerTime / 2.25f);
						CallShootServerRpc(didOvercharge, timerTime, ((RaycastHit)(ref val3)).point);
					}
					else
					{
						Collider[] array = Physics.OverlapSphere(hitPositionSync, 1f);
						DoorLock val11 = default(DoorLock);
						Turret val12 = default(Turret);
						GrabbableObject val13 = default(GrabbableObject);
						LungProp val14 = default(LungProp);
						TerminalAccessibleObject val15 = default(TerminalAccessibleObject);
						Rigidbody val16 = default(Rigidbody);
						foreach (Collider obj2 in array)
						{
							if (((Component)obj2).gameObject.TryGetComponent<DoorLock>(ref val11))
							{
								if ((Object)(object)val11 != (Object)null && val11.isLocked && !val11.isPickingLock)
								{
									val11.UnlockDoorSyncWithServer();
								}
								Object.Destroy((Object)(object)val11);
								AddExplosionToObject(((Component)val11).gameObject, hitPositionSync, 45f, ((RaycastHit)(ref val3)).normal);
							}
							if (((Component)obj2).gameObject.TryGetComponent<Turret>(ref val12))
							{
								val12.ToggleTurretEnabled(false);
							}
							if (((Component)obj2).gameObject.TryGetComponent<GrabbableObject>(ref val13))
							{
								if (val13.itemProperties.itemName.Equals("Apparatus"))
								{
									Object.Instantiate<GameObject>(apperatusExplosionChargePrefab, ((Component)val13).transform);
									((MonoBehaviour)this).StartCoroutine(DelayedExplosion(((Component)val13).transform.position, 50f, 3f));
									((MonoBehaviour)this).StartCoroutine(SpawnExplosionEffect(((Component)val13).transform.position));
									((Behaviour)val13).enabled = false;
									Object.Destroy((Object)(object)((Component)val13).gameObject, 3.05f);
									Debug.Log((object)"Hit Apperatus!");
									if (((Component)val13).TryGetComponent<LungProp>(ref val14))
									{
										if (val14.isLungDocked)
										{
											((MonoBehaviour)this).StartCoroutine(ApperatusSequence(val14));
										}
										val14.isLungDocked = false;
										val14.isLungDockedInElevator = false;
										val14.isLungPowered = false;
									}
								}
								Debug.Log((object)"Hit Prop");
							}
							if (((Component)obj2).gameObject.TryGetComponent<TerminalAccessibleObject>(ref val15))
							{
								val15.SetDoorToggleLocalClient();
							}
							if (((Component)obj2).gameObject.TryGetComponent<Rigidbody>(ref val16))
							{
								val16.AddExplosionForce(2f * timerTime, hitPositionSync, 1.5f);
							}
						}
						SpawnExplosion(hitPositionSync, timerTime / 2.25f);
					}
				}
				else
				{
					Debug.Log((object)"No Hit");
				}
			}
			catch (Exception ex)
			{
				Debug.LogException(ex);
				HUDManager.Instance.DisplayTip("ERROR!", "An error has occured. Stacktrace: " + ex.StackTrace, true, false, "LC_Tip1");
			}
			if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) <= 35f)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
			}
			timerTime = 0f;
			anim.Play("Shoot");
			source.PlayOneShot(laserShootSound);
		}

		private void AddExplosionToObject(GameObject targetGo, Vector3 position, float force, Vector3 hitNormal)
		{
			//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
			//IL_0126: Unknown result type (might be due to invalid IL or missing references)
			//IL_0128: Unknown result type (might be due to invalid IL or missing references)
			//IL_0132: Unknown result type (might be due to invalid IL or missing references)
			//IL_0144: Unknown result type (might be due to invalid IL or missing references)
			GameObject gameObject = ((Component)targetGo.transform.parent).gameObject;
			Collider[] components = gameObject.GetComponents<Collider>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.Destroy((Object)(object)components[i]);
			}
			components = gameObject.GetComponentsInChildren<Collider>();
			for (int i = 0; i < components.Length; i++)
			{
				Object.Destroy((Object)(object)components[i]);
			}
			MeshCollider obj = targetGo.AddComponent<MeshCollider>();
			obj.convex = true;
			((Collider)obj).material.bounciness = 0.65f;
			((Collider)obj).material.dynamicFriction = 0.25f;
			((Collider)obj).material.staticFriction = 0.25f;
			((Collider)obj).material.frictionCombine = (PhysicMaterialCombine)2;
			((Collider)obj).material.bounceCombine = (PhysicMaterialCombine)3;
			gameObject.transform.localScale = Vector3.one * 0.925f;
			Rigidbody val = default(Rigidbody);
			Rigidbody val2 = ((!gameObject.TryGetComponent<Rigidbody>(ref val)) ? gameObject.AddComponent<Rigidbody>() : val);
			Animator val3 = default(Animator);
			if (gameObject.TryGetComponent<Animator>(ref val3))
			{
				Object.Destroy((Object)(object)val3);
			}
			InteractTrigger val4 = default(InteractTrigger);
			if (gameObject.TryGetComponent<InteractTrigger>(ref val4))
			{
				Object.Destroy((Object)(object)val4);
			}
			val2.constraints = (RigidbodyConstraints)0;
			val2.useGravity = true;
			val2.mass = 1.5f;
			val2.isKinematic = false;
			val2.WakeUp();
			val2.velocity = -hitNormal * 20f;
			val2.AddExplosionForce(force * 15f, position, 25f);
		}

		public override void PocketItem()
		{
			((GrabbableObject)this).PocketItem();
			isItemInMainHand = false;
			if ((Object)(object)anim != (Object)null)
			{
				anim.Play("Idle");
			}
			if ((Object)(object)source != (Object)null)
			{
				source.Stop();
			}
			if ((Object)(object)laserPointer != (Object)null)
			{
				laserPointer.SetActive(false);
			}
			if (isCharging)
			{
				DischargeEffectServerRpc();
			}
			((MonoBehaviour)this).StopAllCoroutines();
			((MonoBehaviour)this).StartCoroutine(UpdateBattery());
		}

		public override void EquipItem()
		{
			((GrabbableObject)this).EquipItem();
			isItemInMainHand = true;
			if ((Object)(object)anim != (Object)null)
			{
				anim.Play("Idle");
			}
			if ((Object)(object)laserPointer != (Object)null)
			{
				laserPointer.SetActive(true);
			}
			((MonoBehaviour)this).StartCoroutine(UpdateLaser());
		}

		private IEnumerator ApperatusSequence(LungProp lungPropComponent)
		{
			RoundManager.Instance.FlickerLights(false, false);
			yield return (object)new WaitForSecondsRealtime(1.5f);
			RoundManager.Instance.FlickerLights(false, false);
			HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
			yield return (object)new WaitForSecondsRealtime(1.5f);
			RoundManager.Instance.SwitchPower(false);
			yield return (object)new WaitForSecondsRealtime(1f);
			HUDManager.Instance.RadiationWarningHUD();
		}

		private IEnumerator SpawnExplosionEffect(Vector3 pos)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			yield return (object)new WaitForSecondsRealtime(3f);
			Object.Instantiate<GameObject>(apperatusExplosionPrefab, pos, Quaternion.identity);
			if (Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position) <= 35f)
			{
				HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
			}
		}

		private IEnumerator DelayedExplosion(Vector3 explosionPoint, float multiplier = 1f, float seconds = 1f)
		{
			//IL_000e: Unknown result type (might be due to invalid IL or missing references)
			//IL_000f: Unknown result type (might be due to invalid IL or missing references)
			yield return (object)new WaitForSecondsRealtime(seconds);
			SpawnExplosion(explosionPoint, multiplier);
		}

		private void SpawnExplosion(Vector3 explosionPoint, float multiplier = 1f)
		{
			//IL_0000: Unknown result type (might be due to invalid IL or missing references)
			//IL_0015: Unknown result type (might be due to invalid IL or missing references)
			//IL_0051: Unknown result type (might be due to invalid IL or missing references)
			//IL_0052: 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)
			Landmine.SpawnExplosion(explosionPoint, true, 0.4f * multiplier, 5.5f * multiplier);
			Collider[] array = Physics.OverlapSphere(explosionPoint, 3f);
			Rigidbody val = default(Rigidbody);
			for (int i = 0; i < array.Length; i++)
			{
				if (((Component)array[i]).TryGetComponent<Rigidbody>(ref val))
				{
					val.AddExplosionForce(15f, explosionPoint, 5f);
				}
			}
			Vector3 val2 = explosionPoint;
			Debug.Log((object)("Explosion at Position: " + ((object)(Vector3)(ref val2)).ToString()));
		}

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

		[RuntimeInitializeOnLoadMethod]
		internal static void InitializeRPCS_LaserGun()
		{
			//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
			//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
			//IL_00bd: Expected O, but got Unknown
			//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
			//IL_00d8: Expected O, but got Unknown
			NetworkManager.__rpc_func_table.Add(1780404827u, new RpcReceiveHandler(__rpc_handler_1780404827));
			NetworkManager.__rpc_func_table.Add(1388071734u, new RpcReceiveHandler(__rpc_handler_1388071734));
			NetworkManager.__rpc_func_table.Add(1660911668u, new RpcReceiveHandler(__rpc_handler_1660911668));
			NetworkManager.__rpc_func_table.Add(114478777u, new RpcReceiveHandler(__rpc_handler_114478777));
			NetworkManager.__rpc_func_table.Add(1900954662u, new RpcReceiveHandler(__rpc_handler_1900954662));
			NetworkManager.__rpc_func_table.Add(2525251059u, new RpcReceiveHandler(__rpc_handler_2525251059));
			NetworkManager.__rpc_func_table.Add(975004685u, new RpcReceiveHandler(__rpc_handler_975004685));
			NetworkManager.__rpc_func_table.Add(3291581789u, new RpcReceiveHandler(__rpc_handler_3291581789));
		}

		private static void __rpc_handler_1780404827(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;
				((LaserGun)(object)target).ChargeClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1388071734(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_004a: 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)
			//IL_006c: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool didOvercharge = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref didOvercharge, default(ForPrimitives));
				float chargeTime = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref chargeTime, default(ForPrimitives));
				Vector3 hitPosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref hitPosition);
				target.__rpc_exec_stage = (__RpcExecStage)2;
				((LaserGun)(object)target).ShootClientRpc(didOvercharge, chargeTime, hitPosition);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1660911668(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;
				((LaserGun)(object)target).CancleChargeClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_114478777(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;
				((LaserGun)(object)target).CallChargeServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_1900954662(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_004a: 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)
			//IL_006c: 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_008e: Unknown result type (might be due to invalid IL or missing references)
			NetworkManager networkManager = target.NetworkManager;
			if (networkManager != null && networkManager.IsListening)
			{
				bool didOvercharge = default(bool);
				((FastBufferReader)(ref reader)).ReadValueSafe<bool>(ref didOvercharge, default(ForPrimitives));
				float chargeTime = default(float);
				((FastBufferReader)(ref reader)).ReadValueSafe<float>(ref chargeTime, default(ForPrimitives));
				Vector3 hitPosition = default(Vector3);
				((FastBufferReader)(ref reader)).ReadValueSafe(ref hitPosition);
				target.__rpc_exec_stage = (__RpcExecStage)1;
				((LaserGun)(object)target).CallShootServerRpc(didOvercharge, chargeTime, hitPosition);
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_2525251059(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;
				((LaserGun)(object)target).CallCancleChargeClientServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_975004685(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;
				((LaserGun)(object)target).DischargeEffectServerRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		private static void __rpc_handler_3291581789(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;
				((LaserGun)(object)target).DischargeEffectClientRpc();
				target.__rpc_exec_stage = (__RpcExecStage)0;
			}
		}

		protected internal override string __getTypeName()
		{
			return "LaserGun";
		}
	}
	[HarmonyPatch]
	public class NetworkObjectManager
	{
		private static GameObject networkPrefab;

		[HarmonyPostfix]
		[HarmonyPatch(typeof(GameNetworkManager), "Start")]
		public static void Init()
		{
			if (!((Object)(object)networkPrefab != (Object)null))
			{
				networkPrefab = LethalLaserBase.itemPrefab;
				NetworkManager.Singleton.AddNetworkPrefab(networkPrefab);
			}
		}

		[HarmonyPostfix]
		[HarmonyPatch(typeof(StartOfRound), "Awake")]
		private static void SpawnNetworkHandler()
		{
			//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)
			if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
			{
				GameObject obj = Object.Instantiate<GameObject>(networkPrefab, new Vector3(0f, -1500f, 0f), Quaternion.identity);
				obj.GetComponent<NetworkObject>().Spawn(false);
				obj.SetActive(false);
			}
		}
	}
	internal class Assets
	{
		internal static AssetBundle mainAssetBundle;

		private static string[] assetNames = new string[0];

		internal static void LoadAssetBundle(string assetbundlePath)
		{
			if ((Object)(object)mainAssetBundle == (Object)null)
			{
				mainAssetBundle = AssetBundle.LoadFromFile(assetbundlePath);
			}
			assetNames = mainAssetBundle.GetAllAssetNames();
		}

		internal static AssetBundle GetBundle()
		{
			if (!Object.op_Implicit((Object)(object)mainAssetBundle))
			{
				Debug.LogError((object)"There is no AssetBundle to load assets from.");
				return null;
			}
			return mainAssetBundle;
		}
	}
	internal static class Configuration
	{
		private const string CONFIG_FILE_NAME = "LethalLaser.cfg";

		private static ConfigFile config;

		private static ConfigEntry<bool> automaticRecharge;

		private static ConfigEntry<float> rechargeSpeed;

		public static bool AutomaticRecharge => automaticRecharge.Value;

		public static float RechargeSpeed => Mathf.Clamp(rechargeSpeed.Value, 0.25f, 5f);

		public static void Init()
		{
			//IL_0010: Unknown result type (might be due to invalid IL or missing references)
			//IL_001a: Expected O, but got Unknown
			config = new ConfigFile(Path.Combine(Paths.ConfigPath, "LethalLaser.cfg"), true);
			automaticRecharge = config.Bind<bool>("Config", "Automatic Recharge", true, "Set to true if the gun automatically rechargin after every fire is wanted.");
			rechargeSpeed = config.Bind<float>("Config", "Automatic Recharge Speed", 1f, "Changes the speed of the automatic recharge. Value between 0.25 and 5f");
		}
	}
}