using System;
using System.Collections;
using System.Collections.Generic;
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.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[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.6.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.6.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;
public static string ModGUID => "florianbutz.lethallaser";
private void Awake()
{
//IL_00ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0105: 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();
Type[] array = types;
foreach (Type type in array)
{
MethodInfo[] methods = type.GetMethods(BindingFlags.Instance | BindingFlags.Static | BindingFlags.NonPublic);
MethodInfo[] array2 = methods;
foreach (MethodInfo methodInfo in array2)
{
object[] customAttributes = methodInfo.GetCustomAttributes(typeof(RuntimeInitializeOnLoadMethodAttribute), inherit: false);
if (customAttributes.Length != 0)
{
methodInfo.Invoke(null, null);
}
}
}
logSource.LogInfo((object)"Lethal Laser has started successfully!");
harmony.PatchAll();
}
}
public class LaserGun : GrabbableObject
{
[CompilerGenerated]
private sealed class <ApperatusSequence>d__48 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LungProp lungPropComponent;
public LaserGun <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <ApperatusSequence>d__48(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0047: Unknown result type (might be due to invalid IL or missing references)
//IL_0051: Expected O, but got Unknown
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Expected O, but got Unknown
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
RoundManager.Instance.FlickerLights(false, false);
<>2__current = (object)new WaitForSecondsRealtime(1.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
RoundManager.Instance.FlickerLights(false, false);
HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
<>2__current = (object)new WaitForSecondsRealtime(1.5f);
<>1__state = 2;
return true;
case 2:
<>1__state = -1;
RoundManager.Instance.SwitchPower(false);
<>2__current = (object)new WaitForSecondsRealtime(1f);
<>1__state = 3;
return true;
case 3:
<>1__state = -1;
HUDManager.Instance.RadiationWarningHUD();
RoundManager.Instance.SwitchPower(false);
RoundManager.Instance.powerOffPermanently = 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 <DelayedExplosion>d__50 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Vector3 explosionPoint;
public float multiplier;
public float seconds;
public LaserGun <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <DelayedExplosion>d__50(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
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSecondsRealtime(seconds);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
<>4__this.SpawnExplosion(explosionPoint, multiplier);
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 <Laser>d__43 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LaserGun <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <Laser>d__43(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0082: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (!((NetworkBehaviour)<>4__this).IsOwner)
{
return false;
}
<>4__this.anim.Play("Charging");
<>4__this.source.PlayOneShot(<>4__this.laserChargeSound);
HUDManager.Instance.ShakeCamera((ScreenShakeType)2);
<>2__current = (object)new WaitForSecondsRealtime(0.5f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
HUDManager.Instance.ShakeCamera((ScreenShakeType)2);
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 <SpawnExplosionEffect>d__49 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public Vector3 pos;
public LaserGun <>4__this;
private float <distance>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <SpawnExplosionEffect>d__49(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Expected O, but got Unknown
//IL_004c: 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_006c: 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)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
<>2__current = (object)new WaitForSecondsRealtime(3f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
Object.Instantiate<GameObject>(<>4__this.apperatusExplosionPrefab, pos, Quaternion.identity);
<distance>5__1 = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)<>4__this).transform.position);
if (<distance>5__1 <= 35f)
{
HUDManager.Instance.ShakeCamera((ScreenShakeType)3);
}
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 <StopVibrate>d__35 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public float duration;
public LaserGun <>4__this;
private Gamepad <gamepad>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <StopVibrate>d__35(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<gamepad>5__1 = null;
<>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;
<gamepad>5__1 = Gamepad.current;
<gamepad>5__1.SetMotorSpeeds(0f, 0f);
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 <UpdateBattery>d__32 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LaserGun <>4__this;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <UpdateBattery>d__32(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_0196: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: Expected O, but got Unknown
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (((GrabbableObject)<>4__this).insertedBattery.charge >= 1f && ((GrabbableObject)<>4__this).insertedBattery.empty)
{
<>4__this.source.PlayOneShot(<>4__this.laserRecharged);
}
if (((GrabbableObject)<>4__this).insertedBattery.charge < 1f && !<>4__this.isCharging)
{
if (Configuration.AutomaticRecharge)
{
Battery insertedBattery = ((GrabbableObject)<>4__this).insertedBattery;
insertedBattery.charge += Time.unscaledDeltaTime * (0.035f * Configuration.RechargeSpeed) / (<>4__this.lastTimerTime / 2f);
}
if ((Object)(object)<>4__this.reloadGlow != (Object)null)
{
<>4__this.reloadGlow.SetActive(true);
}
}
else if (((GrabbableObject)<>4__this).insertedBattery.charge >= 1f)
{
if ((Object)(object)<>4__this.reloadGlow != (Object)null)
{
<>4__this.reloadGlow.SetActive(false);
}
((GrabbableObject)<>4__this).insertedBattery.empty = false;
}
else if ((Object)(object)<>4__this.reloadGlow != (Object)null)
{
<>4__this.reloadGlow.SetActive(false);
}
<>2__current = (object)new WaitForEndOfFrame();
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.UpdateBattery());
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 <UpdateLaser>d__41 : IEnumerator<object>, IEnumerator, IDisposable
{
private int <>1__state;
private object <>2__current;
public LaserGun <>4__this;
private float <random>5__1;
object IEnumerator<object>.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
object IEnumerator.Current
{
[DebuggerHidden]
get
{
return <>2__current;
}
}
[DebuggerHidden]
public <UpdateLaser>d__41(int <>1__state)
{
this.<>1__state = <>1__state;
}
[DebuggerHidden]
void IDisposable.Dispose()
{
<>1__state = -2;
}
private bool MoveNext()
{
//IL_01b2: Unknown result type (might be due to invalid IL or missing references)
//IL_01b8: Unknown result type (might be due to invalid IL or missing references)
//IL_028e: Unknown result type (might be due to invalid IL or missing references)
//IL_0298: Expected O, but got Unknown
//IL_0279: Unknown result type (might be due to invalid IL or missing references)
//IL_027f: Unknown result type (might be due to invalid IL or missing references)
switch (<>1__state)
{
default:
return false;
case 0:
<>1__state = -1;
if (<>4__this.isCharging && !<>4__this.lastIsCharging)
{
<>4__this.chargeStartTime = Time.unscaledTime;
}
if (<>4__this.isCharging)
{
<>4__this.timerTime = Time.unscaledTime - <>4__this.chargeStartTime;
}
<>4__this.lastIsCharging = <>4__this.isCharging;
if ((Object)(object)<>4__this.displayNeedle != (Object)null)
{
<random>5__1 = Random.Range(0f - <>4__this.needleWiggleAmount, <>4__this.needleWiggleAmount);
<>4__this.needleTime = Mathf.Clamp(Mathf.Lerp(0f, 100f, (<>4__this.GetTimerTimeProcessed() / 1.5f + <random>5__1 * (<>4__this.GetTimerTimeProcessed() / 1.2f)) / 4.5f), 0f, 100f);
<>4__this.displayNeedle.SetBlendShapeWeight(0, <>4__this.needleTime);
}
else if (LethalLaserBase.DEBUG)
{
Debug.Log((object)"Display needle null!");
}
if (!<>4__this.IsChargeButtonHeld() && <>4__this.isCharging && ((NetworkBehaviour)<>4__this).IsOwner)
{
Debug.Log((object)"Cancled shoot with button");
<>4__this.CallCancleChargeClientServerRpc();
<>4__this.LaserShoot(didOvercharge: false);
}
if (<>4__this.timerTime >= 1f && !<>4__this.ovSoundTriggered && <>4__this.isCharging)
{
<>4__this.ovSoundTriggered = true;
<>4__this.source.PlayOneShot(<>4__this.laserOverchargeWarning);
}
if (<>4__this.timerTime >= 2f && !<>4__this.shTriggered && <>4__this.isCharging)
{
<>4__this.shTriggered = true;
if (<>4__this.isCharging)
{
<>4__this.LaserShoot(didOvercharge: true);
}
}
<>2__current = (object)new WaitForSecondsRealtime(0.05f);
<>1__state = 1;
return true;
case 1:
<>1__state = -1;
if (LethalLaserBase.DEBUG && !<>4__this.timerTime.ToString().Equals("0"))
{
Debug.Log((object)("Timer Time: " + <>4__this.timerTime));
}
((MonoBehaviour)<>4__this).StartCoroutine(<>4__this.UpdateLaser());
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 bool isItemInMainHand = false;
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 = false;
private float timerTime = 0f;
private float needleTime = 0f;
private float needleWiggleAmount = 0.15f;
private float lastTimerTime = 1f;
private Coroutine laserRoutine;
private bool ovSoundTriggered = false;
private bool shTriggered = false;
private float chargeStartTime = 0f;
private bool lastIsCharging = false;
private void OnEnable()
{
playerActions.Enable();
}
private void OnDisable()
{
playerActions.Disable();
}
public void Awake()
{
//IL_002d: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: 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_0120: 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_0102: 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);
}
}
}
[IteratorStateMachine(typeof(<UpdateBattery>d__32))]
private IEnumerator UpdateBattery()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <UpdateBattery>d__32(0)
{
<>4__this = this
};
}
private bool IsChargeButtonHeld()
{
return IngamePlayerSettings.Instance.playerInput.actions.FindAction("Movement/Use", false).IsPressed();
}
public void VibrateController(XRNode hand, float duration, float amplitude)
{
}
[IteratorStateMachine(typeof(<StopVibrate>d__35))]
private IEnumerator StopVibrate(float duration)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <StopVibrate>d__35(0)
{
<>4__this = this,
duration = duration
};
}
private float GetTimerTimeProcessed()
{
return timerTime * 3f;
}
[IteratorStateMachine(typeof(<UpdateLaser>d__41))]
private IEnumerator UpdateLaser()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <UpdateLaser>d__41(0)
{
<>4__this = this
};
}
public override void ItemActivate(bool used, bool buttonDown = true)
{
//IL_000b: 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, 0, 0f, (GameObject)null, false);
}
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();
}
[IteratorStateMachine(typeof(<Laser>d__43))]
private IEnumerator Laser()
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <Laser>d__43(0)
{
<>4__this = this
};
}
private void LaserShoot(bool didOvercharge, bool isServerRpc = false, Vector3 hitPositionSync = default(Vector3))
{
//IL_072f: Unknown result type (might be due to invalid IL or missing references)
//IL_073a: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_011e: 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_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0140: 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)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_04b8: Unknown result type (might be due to invalid IL or missing references)
//IL_01b0: Unknown result type (might be due to invalid IL or missing references)
//IL_06c2: Unknown result type (might be due to invalid IL or missing references)
//IL_0485: Unknown result type (might be due to invalid IL or missing references)
//IL_04a6: Unknown result type (might be due to invalid IL or missing references)
//IL_02a4: Unknown result type (might be due to invalid IL or missing references)
//IL_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_05b6: Unknown result type (might be due to invalid IL or missing references)
//IL_05d9: Unknown result type (might be due to invalid IL or missing references)
//IL_052f: Unknown result type (might be due to invalid IL or missing references)
//IL_0537: 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_0244: Unknown result type (might be due to invalid IL or missing references)
//IL_06a2: Unknown result type (might be due to invalid IL or missing references)
//IL_03f1: Unknown result type (might be due to invalid IL or missing references)
//IL_0426: Unknown result type (might be due to invalid IL or missing references)
//IL_0437: Unknown result type (might be due to invalid IL or missing references)
//IL_043c: Unknown result type (might be due to invalid IL or missing references)
//IL_0441: Unknown result type (might be due to invalid IL or missing references)
//IL_0445: 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 = default(Ray);
((Ray)(ref val))..ctor(((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 * GetTimerTimeProcessed(), 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);
Collider[] array2 = array;
DoorLock val5 = default(DoorLock);
GrabbableObject val6 = default(GrabbableObject);
LungProp val7 = default(LungProp);
Door val8 = default(Door);
Turret val9 = default(Turret);
TerminalAccessibleObject val10 = default(TerminalAccessibleObject);
Rigidbody val11 = default(Rigidbody);
IHittable val12 = default(IHittable);
foreach (Collider val4 in array2)
{
if (((Component)val4).gameObject.TryGetComponent<DoorLock>(ref val5))
{
if ((Object)(object)val5 != (Object)null && val5.isLocked && !val5.isPickingLock)
{
val5.UnlockDoorSyncWithServer();
Debug.Log((object)"Shot at locked door");
}
Object.Destroy((Object)(object)val5);
AddExplosionToObject(((Component)val5).gameObject, ((RaycastHit)(ref val3)).point, 45f, ((RaycastHit)(ref val3)).normal);
}
if (((Component)val4).gameObject.TryGetComponent<GrabbableObject>(ref val6))
{
if (val6.itemProperties.itemName.Equals("Apparatus"))
{
Object.Instantiate<GameObject>(apperatusExplosionChargePrefab, ((Component)val6).transform);
((MonoBehaviour)this).StartCoroutine(DelayedExplosion(((Component)val6).transform.position, 50f, 3f));
((MonoBehaviour)this).StartCoroutine(SpawnExplosionEffect(((Component)val6).transform.position));
((Behaviour)val6).enabled = false;
Object.Destroy((Object)(object)((Component)val6).gameObject, 3f);
Debug.Log((object)"Hit Apperatus!");
if (((Component)val6).TryGetComponent<LungProp>(ref val7))
{
if (val7.isLungDocked)
{
((MonoBehaviour)this).StartCoroutine(ApperatusSequence(val7));
}
val7.isLungDocked = false;
val7.isLungDockedInElevator = false;
val7.isLungPowered = false;
}
}
Debug.Log((object)"Hit Prop");
}
if (((Component)val4).gameObject.TryGetComponent<Door>(ref val8))
{
val8.SetDoorState(true);
Debug.Log((object)"Shot at small door");
}
if (((Component)val4).gameObject.TryGetComponent<Turret>(ref val9))
{
val9.ToggleTurretEnabled(false);
Debug.Log((object)"Shot at turret");
}
if (((Component)val4).gameObject.TryGetComponent<TerminalAccessibleObject>(ref val10))
{
val10.SetDoorToggleLocalClient();
Debug.Log((object)"Shot at locked big door");
}
if (((Component)val4).gameObject.TryGetComponent<Rigidbody>(ref val11))
{
val11.AddExplosionForce(2f * GetTimerTimeProcessed(), ((RaycastHit)(ref val3)).point, 1.5f);
}
if (((Component)val4).gameObject.TryGetComponent<IHittable>(ref val12))
{
IHittable obj = val12;
Vector3 val13 = ((Component)base.playerHeldBy).transform.position - ((Component)val4).gameObject.transform.position;
obj.Hit(100, ((Vector3)(ref val13)).normalized, base.playerHeldBy, false, -1);
}
Debug.Log((object)(((Object)val4).name + " was hit!"));
}
SpawnExplosion(((RaycastHit)(ref val3)).point, GetTimerTimeProcessed() / 2.25f);
CallShootServerRpc(didOvercharge, GetTimerTimeProcessed(), ((RaycastHit)(ref val3)).point);
}
else
{
Collider[] array3 = Physics.OverlapSphere(hitPositionSync, 1f);
Collider[] array4 = array3;
DoorLock val15 = default(DoorLock);
Turret val16 = default(Turret);
GrabbableObject val17 = default(GrabbableObject);
LungProp val18 = default(LungProp);
TerminalAccessibleObject val19 = default(TerminalAccessibleObject);
Rigidbody val20 = default(Rigidbody);
foreach (Collider val14 in array4)
{
if (((Component)val14).gameObject.TryGetComponent<DoorLock>(ref val15))
{
if ((Object)(object)val15 != (Object)null && val15.isLocked && !val15.isPickingLock)
{
val15.UnlockDoorSyncWithServer();
}
Object.Destroy((Object)(object)val15);
AddExplosionToObject(((Component)val15).gameObject, hitPositionSync, 45f, ((RaycastHit)(ref val3)).normal);
}
if (((Component)val14).gameObject.TryGetComponent<Turret>(ref val16))
{
val16.ToggleTurretEnabled(false);
}
if (((Component)val14).gameObject.TryGetComponent<GrabbableObject>(ref val17))
{
if (val17.itemProperties.itemName.Equals("Apparatus"))
{
Object.Instantiate<GameObject>(apperatusExplosionChargePrefab, ((Component)val17).transform);
((MonoBehaviour)this).StartCoroutine(DelayedExplosion(((Component)val17).transform.position, 50f, 3f));
((MonoBehaviour)this).StartCoroutine(SpawnExplosionEffect(((Component)val17).transform.position));
((Behaviour)val17).enabled = false;
Object.Destroy((Object)(object)((Component)val17).gameObject, 3.05f);
Debug.Log((object)"Hit Apperatus!");
if (((Component)val17).TryGetComponent<LungProp>(ref val18))
{
if (val18.isLungDocked)
{
((MonoBehaviour)this).StartCoroutine(ApperatusSequence(val18));
}
val18.isLungDocked = false;
val18.isLungDockedInElevator = false;
val18.isLungPowered = false;
}
}
Debug.Log((object)"Hit Prop");
}
if (((Component)val14).gameObject.TryGetComponent<TerminalAccessibleObject>(ref val19))
{
val19.SetDoorToggleLocalClient();
}
if (((Component)val14).gameObject.TryGetComponent<Rigidbody>(ref val20))
{
val20.AddExplosionForce(2f * GetTimerTimeProcessed(), hitPositionSync, 1.5f);
}
}
SpawnExplosion(hitPositionSync, GetTimerTimeProcessed() / 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");
}
float num = Vector3.Distance(((Component)GameNetworkManager.Instance.localPlayerController).transform.position, ((Component)this).transform.position);
if (num <= 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_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d8: 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_015e: Unknown result type (might be due to invalid IL or missing references)
//IL_0168: Unknown result type (might be due to invalid IL or missing references)
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
GameObject gameObject = ((Component)targetGo.transform.parent).gameObject;
Collider[] components = gameObject.GetComponents<Collider>();
foreach (Collider val in components)
{
Object.Destroy((Object)(object)val);
}
Collider[] componentsInChildren = gameObject.GetComponentsInChildren<Collider>();
foreach (Collider val2 in componentsInChildren)
{
Object.Destroy((Object)(object)val2);
}
MeshCollider val3 = targetGo.AddComponent<MeshCollider>();
val3.convex = true;
((Collider)val3).material.bounciness = 0.65f;
((Collider)val3).material.dynamicFriction = 0.25f;
((Collider)val3).material.staticFriction = 0.25f;
((Collider)val3).material.frictionCombine = (PhysicMaterialCombine)2;
((Collider)val3).material.bounceCombine = (PhysicMaterialCombine)3;
gameObject.transform.localScale = Vector3.one * 0.925f;
Rigidbody val4 = default(Rigidbody);
Rigidbody val5 = ((!gameObject.TryGetComponent<Rigidbody>(ref val4)) ? gameObject.AddComponent<Rigidbody>() : val4);
Animator val6 = default(Animator);
if (gameObject.TryGetComponent<Animator>(ref val6))
{
Object.Destroy((Object)(object)val6);
}
InteractTrigger val7 = default(InteractTrigger);
if (gameObject.TryGetComponent<InteractTrigger>(ref val7))
{
Object.Destroy((Object)(object)val7);
}
val5.constraints = (RigidbodyConstraints)0;
val5.useGravity = true;
val5.mass = 1.5f;
val5.isKinematic = false;
val5.WakeUp();
val5.velocity = -hitNormal * 20f;
val5.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());
}
[IteratorStateMachine(typeof(<ApperatusSequence>d__48))]
private IEnumerator ApperatusSequence(LungProp lungPropComponent)
{
//yield-return decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <ApperatusSequence>d__48(0)
{
<>4__this = this,
lungPropComponent = lungPropComponent
};
}
[IteratorStateMachine(typeof(<SpawnExplosionEffect>d__49))]
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 decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <SpawnExplosionEffect>d__49(0)
{
<>4__this = this,
pos = pos
};
}
[IteratorStateMachine(typeof(<DelayedExplosion>d__50))]
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 decompiler failed: Unexpected instruction in Iterator.Dispose()
return new <DelayedExplosion>d__50(0)
{
<>4__this = this,
explosionPoint = explosionPoint,
multiplier = multiplier,
seconds = seconds
};
}
private void SpawnExplosion(Vector3 explosionPoint, float multiplier = 1f)
{
//IL_0001: 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_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: 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)
Landmine.SpawnExplosion(explosionPoint, true, 0.4f * multiplier, 5.5f * multiplier, 0, 25f * multiplier, (GameObject)null, true);
Collider[] array = Physics.OverlapSphere(explosionPoint, 3f);
Rigidbody val2 = default(Rigidbody);
foreach (Collider val in array)
{
if (((Component)val).TryGetComponent<Rigidbody>(ref val2))
{
val2.AddExplosionForce(15f, explosionPoint, 5f);
}
}
Vector3 val3 = explosionPoint;
Debug.Log((object)("Explosion at Position: " + ((object)(Vector3)(ref val3)).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_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
if (NetworkManager.Singleton.IsHost || NetworkManager.Singleton.IsServer)
{
GameObject val = Object.Instantiate<GameObject>(networkPrefab, new Vector3(0f, -1500f, 0f), Quaternion.identity);
val.GetComponent<NetworkObject>().Spawn(false);
val.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_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001d: Expected O, but got Unknown
string text = Path.Combine(Paths.ConfigPath, "LethalLaser.cfg");
config = new ConfigFile(text, true);
automaticRecharge = config.Bind<bool>("Config", "Automatic Recharge", true, "Set to true if the gun automatically recharging should be allowed.");
rechargeSpeed = config.Bind<float>("Config", "Automatic Recharge Speed", 1f, "Changes the speed of the automatic recharge. Value between 0.25 and 5f");
}
}
}