using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using AndrewFTW;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using ModularWorkshop;
using OpenScripts2;
using OtherLoader;
using Sodalite.Api;
using UnityEngine;
using UnityEngine.UI;
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.0.0")]
[module: UnverifiableCode]
namespace MeatyScripts
{
public class CartridgeHolderAttachment : FVRFireArmAttachment
{
public FVRFireArmChamber[] Chambers;
private const string flagDicChamberRoundClassKey = "ChamberRoundClassConfig";
private const string flagDicChamberRotationKey = "ChamberRotationConfig";
public override GameObject DuplicateFromSpawnLock(FVRViveHand hand)
{
//IL_004d: Unknown result type (might be due to invalid IL or missing references)
GameObject val = ((FVRPhysicalObject)this).DuplicateFromSpawnLock(hand);
CartridgeHolderAttachment component = val.GetComponent<CartridgeHolderAttachment>();
for (int i = 0; i < Chambers.Length; i++)
{
component.Chambers[i].SetRound(Chambers[i].m_round, false);
((Component)component.Chambers[i]).transform.localRotation = ((Component)Chambers[i]).transform.localRotation;
}
return val;
}
public override Dictionary<string, string> GetFlagDic()
{
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_0113: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
//IL_013f: 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)
Dictionary<string, string> flagDic = ((FVRFireArmAttachment)this).GetFlagDic();
string text = string.Empty;
for (int i = 0; i < Chambers.Length; i++)
{
FVRFireArmRound round = Chambers[i].GetRound();
text = ((!((Object)(object)round != (Object)null)) ? (text + "None") : (text + round.RoundClass));
if (i != Chambers.Length - 1)
{
text += ";";
}
}
flagDic.Add("ChamberRoundClassConfig", text);
text = string.Empty;
for (int j = 0; j < Chambers.Length; j++)
{
string text2 = text;
text = text2 + ((Component)Chambers[j]).transform.localRotation.x + "," + ((Component)Chambers[j]).transform.localRotation.y + "," + ((Component)Chambers[j]).transform.localRotation.z + "," + ((Component)Chambers[j]).transform.localRotation.w;
if (j != Chambers.Length - 1)
{
text += ";";
}
}
flagDic.Add("ChamberRotationConfig", text);
return flagDic;
}
public override void ConfigureFromFlagDic(Dictionary<string, string> f)
{
//IL_017f: Unknown result type (might be due to invalid IL or missing references)
//IL_0077: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Invalid comparison between Unknown and I4
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00b8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArmAttachment)this).ConfigureFromFlagDic(f);
if (f.TryGetValue("ChamberRoundClassConfig", out var value))
{
string[] array = value.Split(new char[1] { ';' });
List<FireArmRoundClass> list = new List<FireArmRoundClass>();
string[] array2 = array;
foreach (string text in array2)
{
if (text == "None")
{
list.Add((FireArmRoundClass)int.MinValue);
}
else
{
list.Add((FireArmRoundClass)Enum.Parse(typeof(FireArmRoundClass), text));
}
}
for (int j = 0; j < Chambers.Length; j++)
{
if ((int)list[j] != int.MinValue)
{
GameObject gameObject = ((AnvilAsset)AM.GetRoundSelfPrefab(Chambers[j].RoundType, list[j])).GetGameObject();
FVRFireArmRound component = gameObject.GetComponent<FVRFireArmRound>();
Chambers[j].SetRound(component, false);
}
}
}
if (f.TryGetValue("ChamberRotationConfig", out value))
{
string[] array3 = value.Split(new char[1] { ';' });
List<Quaternion> list2 = new List<Quaternion>();
string[] array4 = array3;
foreach (string text2 in array4)
{
string[] array5 = text2.Split(new char[1] { ',' });
list2.Add(new Quaternion(float.Parse(array5[0]), float.Parse(array5[1]), float.Parse(array5[2]), float.Parse(array5[3])));
}
for (int l = 0; l < Chambers.Length; l++)
{
((Component)Chambers[l]).transform.localRotation = list2[l];
}
}
}
[ContextMenu("Copy existing Attachment's values")]
public void CopyAttachment()
{
FVRFireArmAttachment[] components = ((Component)this).GetComponents<FVRFireArmAttachment>();
FVRFireArmAttachment val = components.Single((FVRFireArmAttachment c) => (Object)(object)c != (Object)(object)this);
val.AttachmentInterface.Attachment = (FVRFireArmAttachment)(object)this;
val.Sensor.Attachment = (FVRFireArmAttachment)(object)this;
this.CopyComponent<FVRFireArmAttachment>((Component)(object)this, val);
}
public T CopyComponent<T>(Component target, T reference) where T : Component
{
Type type = ((object)reference).GetType();
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
PropertyInfo[] properties = type.GetProperties(bindingAttr);
PropertyInfo[] array = properties;
foreach (PropertyInfo propertyInfo in array)
{
if (propertyInfo.CanWrite)
{
try
{
propertyInfo.SetValue(target, propertyInfo.GetValue(reference, null), null);
}
catch
{
}
}
}
FieldInfo[] fields = type.GetFields(bindingAttr);
FieldInfo[] array2 = fields;
foreach (FieldInfo fieldInfo in array2)
{
fieldInfo.SetValue(target, fieldInfo.GetValue(reference));
}
return (T)(object)((target is T) ? target : null);
}
}
public class DirectionalFireArmChamber : FVRFireArmChamber
{
private static List<FVRFireArmChamber> _exsitingDirectionalFireArmChambers;
static DirectionalFireArmChamber()
{
_exsitingDirectionalFireArmChambers = new List<FVRFireArmChamber>();
Harmony.CreateAndPatchAll(typeof(DirectionalFireArmChamber), (string)null);
}
public override void Awake()
{
((FVRFireArmChamber)this).Awake();
_exsitingDirectionalFireArmChambers.Add((FVRFireArmChamber)(object)this);
}
public override void OnDestroy()
{
_exsitingDirectionalFireArmChambers.Remove((FVRFireArmChamber)(object)this);
((FVRInteractiveObject)this).OnDestroy();
}
[HarmonyPatch(typeof(FVRFireArmRound), "Chamber")]
[HarmonyPrefix]
public static void SetRoundPatch(FVRFireArmRound __instance, FVRFireArmChamber c)
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
if (_exsitingDirectionalFireArmChambers.Contains(c))
{
float num = Vector3.Angle(((Component)__instance).transform.forward, ((Component)c).transform.forward);
if (num > 90f)
{
((Component)c).transform.Rotate(180f, 0f, 0f);
}
}
}
[ContextMenu("Copy existing Chmaber's values")]
public void CopyChamber()
{
FVRFireArmChamber reference = ((Component)this).GetComponents<FVRFireArmChamber>().Single((FVRFireArmChamber c) => (Object)(object)c != (Object)(object)this);
this.CopyComponent<FVRFireArmChamber>((Component)(object)this, reference);
}
public T CopyComponent<T>(Component target, T reference) where T : Component
{
Type type = ((object)reference).GetType();
BindingFlags bindingAttr = BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.NonPublic;
PropertyInfo[] properties = type.GetProperties(bindingAttr);
PropertyInfo[] array = properties;
foreach (PropertyInfo propertyInfo in array)
{
if (propertyInfo.CanWrite)
{
try
{
propertyInfo.SetValue(target, propertyInfo.GetValue(reference, null), null);
}
catch
{
}
}
}
FieldInfo[] fields = type.GetFields(bindingAttr);
FieldInfo[] array2 = fields;
foreach (FieldInfo fieldInfo in array2)
{
fieldInfo.SetValue(target, fieldInfo.GetValue(reference));
}
return (T)(object)((target is T) ? target : null);
}
}
}
[RequireComponent(typeof(AudioLowPassFilter))]
[RequireComponent(typeof(AudioSource))]
public class DistanceEqualizer : MonoBehaviour
{
public bool Cutoff = true;
public bool VolumeDecrease = true;
public bool Debugging = true;
public float StartCutoffFrom = 10f;
[Range(0f, 1f)]
public float WallCutoff = 0.5f;
[Range(0.01f, 1f)]
public float DistanceCutoff = 0.3f;
[Range(0f, 1f)]
public float VolDecPerWall = 0.05f;
private float distance;
private float distcut;
private float wallcut;
private AudioListener AudioListener;
private AudioSource AudioSource;
private RaycastHit[] hits;
private Ray ray;
private void Start()
{
AudioListener = Object.FindObjectOfType<AudioListener>();
AudioSource = ((Component)this).gameObject.GetComponent<AudioSource>();
((Behaviour)((Component)this).gameObject.GetComponent<AudioLowPassFilter>()).enabled = true;
}
private void FixedUpdate()
{
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: 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_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_01ed: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_0202: Unknown result type (might be due to invalid IL or missing references)
distance = Vector3.Distance(((Component)this).transform.position, ((Component)AudioListener).transform.position);
if (distance < AudioSource.maxDistance)
{
ray = new Ray(((Component)this).transform.position, ((Component)AudioListener).transform.position - ((Component)this).transform.position);
hits = Physics.RaycastAll(ray, distance);
if (VolumeDecrease)
{
((Component)this).gameObject.GetComponent<AudioSource>().volume = 1f - VolDecPerWall * (float)hits.Length;
}
if (Cutoff)
{
distcut = 22000f * Mathf.Pow(0.6f, (distance - StartCutoffFrom) * Mathf.Pow(DistanceCutoff * 10f, 3f) / 1000f);
wallcut = Mathf.Atan((float)hits.Length * (1f + 10f * WallCutoff)) * distcut * WallCutoff;
((Component)this).gameObject.GetComponent<AudioLowPassFilter>().cutoffFrequency = distcut - wallcut;
}
if (Debugging)
{
Debug.Log((object)("Gameobject '" + ((Object)((Component)this).gameObject).name + "' :: Walls: " + hits.Length + "; current volume: " + ((Component)this).gameObject.GetComponent<AudioSource>().volume + "; current cutoff: " + ((Component)this).gameObject.GetComponent<AudioLowPassFilter>().cutoffFrequency));
Debug.DrawLine(((Component)this).transform.position, ((Component)AudioListener).transform.position, Color.green);
}
}
}
}
public class Cam : MonoBehaviour
{
private GameObject AudioSource;
public float speed = 10f;
private void Start()
{
speed = 0f - speed;
AudioSource = GameObject.Find("Turret");
}
private void Update()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
((Component)this).transform.LookAt(AudioSource.transform);
if (((Component)this).transform.position.z <= -100f || ((Component)this).transform.position.z >= 300f)
{
speed = 0f - speed;
}
((Component)this).transform.Translate(Vector3.forward * speed * Time.deltaTime, (Space)0);
}
}
public class Fire : MonoBehaviour
{
private float random;
private float curTime;
private AudioSource AudioSource;
private GameObject Flash1;
private GameObject Flash2;
private void Start()
{
AudioSource = ((Component)this).gameObject.GetComponent<AudioSource>();
Flash1 = GameObject.Find("Fire1");
Flash2 = GameObject.Find("Fire2");
}
private void FixedUpdate()
{
random = Random.Range(0, 100);
if (random > 95f && !AudioSource.isPlaying)
{
AudioSource.Play();
}
if (AudioSource.isPlaying)
{
curTime += Time.deltaTime;
if ((double)curTime > 0.1)
{
((Behaviour)Flash1.GetComponent<Light>()).enabled = !((Behaviour)Flash1.GetComponent<Light>()).enabled;
if (((Behaviour)Flash1.GetComponent<Light>()).enabled)
{
((Behaviour)Flash2.GetComponent<Light>()).enabled = false;
}
else
{
((Behaviour)Flash2.GetComponent<Light>()).enabled = true;
}
curTime = 0f;
}
}
else
{
((Behaviour)Flash1.GetComponent<Light>()).enabled = false;
((Behaviour)Flash2.GetComponent<Light>()).enabled = false;
}
}
}
public class Look : MonoBehaviour
{
private AudioListener AudioListener;
private void Start()
{
AudioListener = Object.FindObjectOfType<AudioListener>();
}
private void Update()
{
((Component)this).transform.LookAt(((Component)AudioListener).transform);
}
}
public class OrientationAxis : MonoBehaviour
{
public enum AxisEnum
{
None = -1,
X,
Y,
Z,
XY,
XZ,
YZ,
XYZ
}
public AxisEnum axis = AxisEnum.None;
public Transform directionObject;
public Vector3 worldDirection = Vector3.up;
private void Update()
{
//IL_001d: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Unknown result type (might be due to invalid IL or missing references)
//IL_002e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_0117: Unknown result type (might be due to invalid IL or missing references)
//IL_0118: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)directionObject.parent == (Object)null))
{
Vector3 val = worldDirection;
Quaternion rotation = directionObject.parent.rotation;
Vector3 eulerAngles = ((Quaternion)(ref rotation)).eulerAngles;
switch (axis)
{
case AxisEnum.X:
val.y = eulerAngles.y;
val.z = eulerAngles.z;
break;
case AxisEnum.Y:
val.x = eulerAngles.x;
val.z = eulerAngles.z;
break;
case AxisEnum.Z:
val.x = eulerAngles.x;
val.y = eulerAngles.y;
break;
case AxisEnum.XY:
val.z = eulerAngles.z;
break;
case AxisEnum.XZ:
val.y = eulerAngles.y;
break;
case AxisEnum.YZ:
val.x = eulerAngles.x;
break;
}
directionObject.rotation = Quaternion.Euler(val);
}
}
}
namespace MeatyScripts
{
public class PIPScopeLinkedReticleMagnification : MonoBehaviour
{
[Serializable]
public class ReticleSet
{
public string[] ReticleNames;
public Reticle[] Reticles;
}
public PIPScopeController ScopeController;
public ReticleSet[] ReticleSets;
private int _lastReticleIndex = -1;
private int _lastThermalZoomIndex = -1;
public void Start()
{
int reticleIndex = ScopeController.ReticleIndex;
int thermalZoomIndex = ScopeController.ThermalZoomIndex;
ReticleSet reticleSet = ReticleSets[reticleIndex];
string value = reticleSet.ReticleNames[thermalZoomIndex];
Reticle value2 = reticleSet.Reticles[thermalZoomIndex];
ScopeController.DisplayNames_Reticle[reticleIndex] = value;
ScopeController.Reticles[reticleIndex] = value2;
ScopeController.UpdateScopeParams();
if ((Object)(object)ScopeController.UI != (Object)null)
{
ScopeController.UI.RedrawUI();
}
}
public void Update()
{
int reticleIndex = ScopeController.ReticleIndex;
int currentThermalZoomIndex = ScopeController.ThermalZoomIndex;
bool flag = false;
if (reticleIndex != _lastReticleIndex || currentThermalZoomIndex != _lastThermalZoomIndex)
{
ReticleSet reticleSet = ReticleSets[reticleIndex];
string text = reticleSet.ReticleNames[currentThermalZoomIndex];
Reticle value = reticleSet.Reticles[currentThermalZoomIndex];
ScopeController.DisplayNames_Reticle = ReticleSets.Select((ReticleSet s) => s.ReticleNames[currentThermalZoomIndex]).ToList();
ScopeController.Reticles[reticleIndex] = value;
flag = true;
}
if (flag)
{
ScopeController.UpdateScopeParams();
if ((Object)(object)ScopeController.UI != (Object)null)
{
ScopeController.UI.RedrawUI();
}
}
_lastThermalZoomIndex = currentThermalZoomIndex;
_lastReticleIndex = reticleIndex;
}
}
}
public class AutoRotate : MonoBehaviour
{
public float m_Speed = 30f;
private void Update()
{
float num = Time.deltaTime * m_Speed;
((Component)this).transform.Rotate(num, num, 0f);
}
}
public class Demo : MonoBehaviour
{
private void Start()
{
QualitySettings.antiAliasing = 8;
}
private void OnGUI()
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
GUI.Box(new Rect(10f, 10f, 150f, 25f), "Heat Wave Demo");
}
}
[RequireComponent(typeof(Camera))]
public class FreeCamera : MonoBehaviour
{
public float m_MoveSpeed = 0f;
public float m_RotateSpeed = 0f;
public KeyCode m_ForwardButton = (KeyCode)119;
public KeyCode m_BackwardButton = (KeyCode)115;
public KeyCode m_RightButton = (KeyCode)100;
public KeyCode m_LeftButton = (KeyCode)97;
public KeyCode m_UpButton = (KeyCode)113;
public KeyCode m_DownButton = (KeyCode)101;
private void Update()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000a: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_0067: Unknown result type (might be due to invalid IL or missing references)
//IL_006c: Unknown result type (might be due to invalid IL or missing references)
//IL_0078: Unknown result type (might be due to invalid IL or missing references)
//IL_0085: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_009e: 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_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_00cf: Unknown result type (might be due to invalid IL or missing references)
//IL_00ed: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: 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)
Vector3 moveTo = Vector3.zero;
Move(m_ForwardButton, ref moveTo, ((Component)this).transform.forward);
Move(m_BackwardButton, ref moveTo, -((Component)this).transform.forward);
Move(m_RightButton, ref moveTo, ((Component)this).transform.right);
Move(m_LeftButton, ref moveTo, -((Component)this).transform.right);
Move(m_UpButton, ref moveTo, ((Component)this).transform.up);
Move(m_DownButton, ref moveTo, -((Component)this).transform.up);
Transform transform = ((Component)this).transform;
transform.position += moveTo * m_MoveSpeed * Time.deltaTime;
if (Input.GetMouseButton(0))
{
Vector3 eulerAngles = ((Component)this).transform.eulerAngles;
eulerAngles.x += (0f - Input.GetAxis("Mouse Y")) * 359f * m_RotateSpeed;
eulerAngles.y += Input.GetAxis("Mouse X") * 359f * m_RotateSpeed;
((Component)this).transform.eulerAngles = eulerAngles;
}
}
private void Move(KeyCode key, ref Vector3 moveTo, Vector3 dir)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_000d: Unknown result type (might be due to invalid IL or missing references)
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
if (Input.GetKey(key))
{
moveTo = dir;
}
}
}
[RequireComponent(typeof(Camera))]
public class HeatWave : MonoBehaviour
{
[Range(0.003f, 0.02f)]
public float m_Strength = 0.01f;
public Material m_MatHeatWave;
public bool m_ShowInternalMaps = false;
[Header("Internal")]
private LayerMask m_LmHeatWave;
public Shader m_SdrDepthOnly;
public RenderTexture m_RTMask;
public Camera m_RTCamera;
public GameObject m_RTCameraGo;
private void Start()
{
//IL_0023: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0044: Expected O, but got Unknown
if (!SystemInfo.supportsImageEffects)
{
((Behaviour)this).enabled = false;
return;
}
m_LmHeatWave = LayerMask.op_Implicit(LayerMask.NameToLayer("TransparentFX"));
m_RTMask = new RenderTexture(Screen.width, Screen.height, 16);
((Object)m_RTMask).hideFlags = (HideFlags)52;
m_SdrDepthOnly = Shader.Find("Heat Wave/Depth Only");
}
private void Update()
{
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e9: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: Expected O, but got Unknown
Camera main = Camera.main;
if ((Object)(object)m_RTCamera == (Object)null)
{
m_RTCameraGo = new GameObject("Mask Camera", new Type[1] { typeof(Camera) });
((Object)m_RTCameraGo).hideFlags = (HideFlags)52;
m_RTCamera = m_RTCameraGo.GetComponent<Camera>();
}
m_RTCamera.CopyFrom(main);
((Behaviour)m_RTCamera).enabled = false;
m_RTCamera.targetTexture = m_RTMask;
m_RTCamera.cullingMask = ~(1 << LayerMask.op_Implicit(m_LmHeatWave));
m_RTCamera.clearFlags = (CameraClearFlags)2;
m_RTCamera.backgroundColor = new Color(0.5f, 0.5f, 1f);
m_RTCamera.RenderWithShader(m_SdrDepthOnly, "");
m_RTCamera.cullingMask = 1 << LayerMask.op_Implicit(m_LmHeatWave);
m_RTCamera.clearFlags = (CameraClearFlags)4;
m_RTCamera.Render();
}
private void OnDisable()
{
if (Object.op_Implicit((Object)(object)m_RTCamera))
{
Object.DestroyImmediate((Object)(object)m_RTCamera);
m_RTCamera = null;
}
if (Object.op_Implicit((Object)(object)m_RTCameraGo))
{
Object.DestroyImmediate((Object)(object)m_RTCameraGo);
m_RTCameraGo = null;
}
}
private void OnRenderImage(RenderTexture src, RenderTexture dst)
{
m_MatHeatWave.SetFloat("_Strength", m_Strength);
m_MatHeatWave.SetTexture("_DistortionTex", (Texture)(object)m_RTMask);
Graphics.Blit((Texture)(object)src, dst, m_MatHeatWave);
}
private void OnGUI()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
if (m_ShowInternalMaps)
{
GUI.DrawTextureWithTexCoords(new Rect(10f, 10f, 128f, 128f), (Texture)(object)m_RTMask, new Rect(0f, 0f, 1f, 1f));
}
}
}
public class EnableObjOnSkinSelect : MonoBehaviour
{
[Header("Hover Over Variables To Read The Tooltips!!!")]
[Tooltip("Your weapon object.")]
public GameObject ModularWeapon;
[Tooltip("ID of the skin to enable/disable objects on.")]
public string skinID;
[Tooltip("All objects you want enabled when the skin is selected.")]
public GameObject[] objectsEnabled;
[Tooltip("All objects you want disabled when the skin is selected.")]
public GameObject[] objectsDisabled;
private IModularWeapon weapon;
private void Update()
{
if (weapon == null)
{
weapon = ModularWeapon.GetComponent<IModularWeapon>();
}
if (weapon.GetModularFVRFireArm.CurrentSelectedReceiverSkinID == skinID)
{
GameObject[] array = objectsEnabled;
foreach (GameObject val in array)
{
val.SetActive(true);
}
GameObject[] array2 = objectsDisabled;
foreach (GameObject val2 in array2)
{
val2.SetActive(false);
}
}
}
}
[ExecuteInEditMode]
public class HolographicSight : MonoBehaviour
{
public Transform VirtualQuad;
public float Scale = 1f;
public bool SizeCompensation = true;
private MaterialPropertyBlock m_block;
private void OnEnable()
{
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Expected O, but got Unknown
m_block = new MaterialPropertyBlock();
((Component)this).GetComponent<Renderer>().SetPropertyBlock(m_block);
}
private void OnWillRenderObject()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0017: Unknown result type (might be due to invalid IL or missing references)
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
//IL_0028: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((Component)this).transform.InverseTransformPoint(((Component)VirtualQuad).transform.position);
m_block.SetVector("_Offset", Vector4.op_Implicit(val));
m_block.SetFloat("_Scale", Scale);
m_block.SetFloat("_SizeCompensation", (!SizeCompensation) ? 0f : 1f);
((Component)this).GetComponent<Renderer>().SetPropertyBlock(m_block);
}
}
namespace Meat_banono.Meats_ModulGlock
{
[BepInPlugin("Meat_banono.Meats_ModulGlock", "Meats_ModulGlock", "1.0.1")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
[BepInDependency("h3vr.OpenScripts2", "2.2.0")]
[BepInDependency("nrgill28.Sodalite", "1.3.6")]
public class Meats_ModulGlockPlugin : BaseUnityPlugin
{
private static readonly string BasePath = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);
internal static ManualLogSource Logger;
private void Awake()
{
Logger = ((BaseUnityPlugin)this).Logger;
LoadAssets();
}
private void LoadAssets()
{
Harmony.CreateAndPatchAll(Assembly.GetExecutingAssembly(), "Meat_banono.Meats_ModulGlock");
OtherLoader.RegisterDirectLoad(BasePath, "Meat_banono.Meats_ModulGlock", "", "", "modulglock2", "");
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_meats_modulglock"));
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_meats_modulglock"));
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_meats_modulglock"));
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_meats_modulglock"));
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_meats_modulglock"));
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_meats_modulglock"));
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_meats_modulglock"));
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_meats_modulglock"));
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_meats_modulglock"));
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_meats_modulglock"));
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_meats_modulglock"));
}
}
}
namespace MeatyScripts
{
public class ReflexSightNVToggle : FVRInteractiveObject
{
public enum ReflexIncrementBehavior
{
Default,
ForceLoop,
ForceClamp
}
public ReflexSightController Controller;
public ReflexSightOptionType OptionType;
public ReflexIncrementBehavior IncrementBehavior;
public float RotationMagnitudePerOption = 15f;
public bool DoesFlickIncrement = true;
public bool ForceAlwaysInteractable;
private Vector3 lastHandRight = Vector3.zero;
private float m_curRot;
public override bool IsInteractable()
{
return ((Object)(object)((FVRFireArmAttachmentInterface)Controller).Attachment != (Object)null && ((Object)(object)((FVRFireArmAttachmentInterface)Controller).Attachment.curMount != (Object)null || ((FVRInteractiveObject)((FVRFireArmAttachmentInterface)Controller).Attachment).IsHeld)) || ((Object)(object)Controller.OverrideFireArm != (Object)null && ((FVRInteractiveObject)Controller.OverrideFireArm).IsHeld) || ForceAlwaysInteractable;
}
public override void SimpleInteraction(FVRViveHand hand)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Invalid comparison between Unknown and I4
//IL_003f: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: Invalid comparison between Unknown and I4
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Unknown result type (might be due to invalid IL or missing references)
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).SimpleInteraction(hand);
SM.PlayCoreSound((FVRPooledAudioType)10, ManagerSingleton<SM>.Instance.AudioEvent_AttachmentClick_Minor, ((Component)this).transform.position);
bool flag = false;
bool flag2 = false;
if ((int)IncrementBehavior == 2)
{
flag2 = true;
}
else if ((int)IncrementBehavior == 1)
{
flag = true;
}
bool flag3 = false;
if (DoesFlickIncrement)
{
Controller.IncrementOptionValue(OptionType, ref flag3, flag, flag2);
if (flag3)
{
SM.PlayCoreSound((FVRPooledAudioType)10, ManagerSingleton<SM>.Instance.AudioEvent_AttachmentClick_Minor, ((Component)this).transform.position);
hand.Buzz(hand.Buzzer.Buzz_OnHoverInteractive);
}
}
else
{
Controller.DecrementOptionValue(OptionType, ref flag3, flag, flag2);
if (flag3)
{
SM.PlayCoreSound((FVRPooledAudioType)10, ManagerSingleton<SM>.Instance.AudioEvent_AttachmentClick_Minor, ((Component)this).transform.position);
hand.Buzz(hand.Buzzer.Buzz_OnHoverInteractive);
}
}
}
public override void BeginInteraction(FVRViveHand hand)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).BeginInteraction(hand);
lastHandRight = Vector3.ProjectOnPlane(hand.Input.FilteredRight, ((Component)this).transform.up);
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0036: Unknown result type (might be due to invalid IL or missing references)
//IL_003b: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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_0059: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: 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_006b: Unknown result type (might be due to invalid IL or missing references)
//IL_00d6: Unknown result type (might be due to invalid IL or missing references)
//IL_00dc: Invalid comparison between Unknown and I4
//IL_0251: Unknown result type (might be due to invalid IL or missing references)
//IL_0252: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Invalid comparison between Unknown and I4
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f2: Invalid comparison between Unknown and I4
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cd: Invalid comparison between Unknown and I4
//IL_0109: Unknown result type (might be due to invalid IL or missing references)
//IL_01e4: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: 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)
//IL_0208: Unknown result type (might be due to invalid IL or missing references)
//IL_01f6: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: Unknown result type (might be due to invalid IL or missing references)
//IL_0232: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).UpdateInteraction(hand);
if (!((FVRInteractiveObject)this).IsHeld)
{
return;
}
float curRot = m_curRot;
Vector3 val = Vector3.ProjectOnPlane(base.m_hand.Input.FilteredRight, ((Component)this).transform.up);
Vector3 val2 = Vector3.ProjectOnPlane(lastHandRight, ((Component)this).transform.up);
float num = Mathf.Atan2(Vector3.Dot(((Component)this).transform.up, Vector3.Cross(val, val2)), Vector3.Dot(val, val2)) * 57.29578f;
if (RotationMagnitudePerOption < 0f)
{
num = 0f - num;
}
m_curRot += num;
if (m_curRot > Mathf.Abs(RotationMagnitudePerOption))
{
m_curRot -= Mathf.Abs(RotationMagnitudePerOption);
bool flag = false;
bool flag2 = false;
if ((int)IncrementBehavior == 2)
{
flag2 = true;
}
else if ((int)IncrementBehavior == 1)
{
flag = true;
}
bool flag3 = false;
if ((int)GM.Options.ControlOptions.ScopeAutoMenuOpen == 0)
{
Controller.OpenUIAndSetValue(OptionType);
}
Controller.IncrementOptionValue(OptionType, ref flag3, flag, flag2);
if (flag3)
{
SM.PlayCoreSound((FVRPooledAudioType)10, ManagerSingleton<SM>.Instance.AudioEvent_AttachmentClick_Minor, ((Component)this).transform.position);
hand.Buzz(hand.Buzzer.Buzz_OnHoverInteractive);
}
}
else if (m_curRot < 0f - Mathf.Abs(RotationMagnitudePerOption))
{
m_curRot += Mathf.Abs(RotationMagnitudePerOption);
bool flag4 = false;
bool flag5 = false;
if ((int)IncrementBehavior == 2)
{
flag5 = true;
}
else if ((int)IncrementBehavior == 1)
{
flag4 = true;
}
bool flag6 = false;
if ((int)GM.Options.ControlOptions.ScopeAutoMenuOpen == 0)
{
Controller.OpenUIAndSetValue(OptionType);
}
Controller.DecrementOptionValue(OptionType, ref flag6, flag4, flag5);
if (flag6)
{
SM.PlayCoreSound((FVRPooledAudioType)10, ManagerSingleton<SM>.Instance.AudioEvent_AttachmentClick_Minor, ((Component)this).transform.position);
hand.Buzz(hand.Buzzer.Buzz_OnHoverInteractive);
}
}
lastHandRight = val;
}
public override void EndInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).EndInteraction(hand);
}
}
public class AttachmentAxisScale : MonoBehaviour
{
public Vector3 CustomScale = Vector3.one;
static AttachmentAxisScale()
{
Harmony.CreateAndPatchAll(typeof(AttachmentAxisScale), (string)null);
}
[HarmonyPatch(typeof(FVRFireArmAttachment), "ScaleToMount")]
[HarmonyPostfix]
private static void ScaleToMount_Patch(FVRFireArmAttachment __instance, FVRFireArmAttachmentMount mount)
{
//IL_001c: Unknown result type (might be due to invalid IL or missing references)
AttachmentAxisScale component = ((Component)mount).GetComponent<AttachmentAxisScale>();
if ((Object)(object)component != (Object)null)
{
((Component)__instance).transform.localScale = component.CustomScale;
}
}
[HarmonyPatch(typeof(FVRFireArmAttachmentSensor), "SetHoveredMount")]
[HarmonyPostfix]
private static void SetHoveredMount_Patch(FVRFireArmAttachmentSensor __instance, FVRFireArmAttachmentMount newMount)
{
//IL_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_0094: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)newMount != (Object)null))
{
return;
}
AttachmentAxisScale component = ((Component)newMount).GetComponent<AttachmentAxisScale>();
if (!((Object)(object)component != (Object)null))
{
return;
}
if (__instance.Attachment.CanScaleToMount && (Object)(object)__instance.CurHoveredMount != (Object)null && __instance.CurHoveredMount.CanThisRescale())
{
FVRFireArmAttachmentMount rootMount = __instance.CurHoveredMount.GetRootMount();
if (__instance.m_storedScaleMagnified != ((Vector3)(ref component.CustomScale)).magnitude)
{
__instance.m_storedScaleMagnified = ((Vector3)(ref component.CustomScale)).magnitude;
((Component)__instance.Attachment).transform.localScale = component.CustomScale;
}
}
else if (__instance.m_storedScaleMagnified != 1f)
{
__instance.m_storedScaleMagnified = 1f;
((Component)__instance.Attachment).transform.localScale = new Vector3(__instance.m_storedScaleMagnified, __instance.m_storedScaleMagnified, __instance.m_storedScaleMagnified);
}
}
}
[RequireComponent(typeof(ModularWeaponPart))]
public class ReloadTriggerWellRelocatorAddon : MonoBehaviour, IPartFireArmRequirement
{
private enum EColliderType
{
Sphere,
Capsule,
Box
}
public GameObject ColliderReference;
private TransformProxy _colliderReferenceProxy;
public bool ReplaceExistingCollider = true;
private FVRFireArm _firearm;
private Collider _origCollider;
private Collider _addedCollider;
private Vector3 _addedColliderCenter = default(Vector3);
private Vector3 _addedColliderSize = default(Vector3);
private EColliderType _addedColliderType = EColliderType.Sphere;
private Axis _addedColliderAxis = (Axis)0;
public FVRFireArm FireArm
{
set
{
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_003d: Unknown result type (might be due to invalid IL or missing references)
//IL_0048: Unknown result type (might be due to invalid IL or missing references)
//IL_004d: 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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_005e: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0064: Unknown result type (might be due to invalid IL or missing references)
//IL_00c6: Unknown result type (might be due to invalid IL or missing references)
//IL_0108: Unknown result type (might be due to invalid IL or missing references)
//IL_0150: Unknown result type (might be due to invalid IL or missing references)
//IL_015a: Expected I4, but got Unknown
//IL_017b: Unknown result type (might be due to invalid IL or missing references)
//IL_018d: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)value != (Object)null)
{
_firearm = value;
Transform transform = ((Component)((Component)_firearm).GetComponentInChildren<FVRFireArmReloadTriggerWell>()).transform;
Vector3 val = _colliderReferenceProxy.parent.TransformPoint(_colliderReferenceProxy.localPosition + UnityEngineExtensions.MultiplyComponentWise(_addedColliderCenter, _colliderReferenceProxy.localScale));
Vector3 center = transform.InverseTransformPoint(val);
if (ReplaceExistingCollider)
{
_origCollider = ((Component)transform).GetComponent<Collider>();
_origCollider.enabled = false;
}
switch (_addedColliderType)
{
case EColliderType.Sphere:
{
_addedCollider = (Collider)(object)((Component)transform).gameObject.AddComponent<SphereCollider>();
Collider addedCollider7 = _addedCollider;
((SphereCollider)((addedCollider7 is SphereCollider) ? addedCollider7 : null)).center = center;
Collider addedCollider8 = _addedCollider;
((SphereCollider)((addedCollider8 is SphereCollider) ? addedCollider8 : null)).radius = _addedColliderSize.x;
break;
}
case EColliderType.Capsule:
{
_addedCollider = (Collider)(object)((Component)transform).gameObject.AddComponent<CapsuleCollider>();
Collider addedCollider3 = _addedCollider;
((CapsuleCollider)((addedCollider3 is CapsuleCollider) ? addedCollider3 : null)).center = center;
Collider addedCollider4 = _addedCollider;
((CapsuleCollider)((addedCollider4 is CapsuleCollider) ? addedCollider4 : null)).radius = _addedColliderSize.x;
Collider addedCollider5 = _addedCollider;
((CapsuleCollider)((addedCollider5 is CapsuleCollider) ? addedCollider5 : null)).height = _addedColliderSize.y;
Collider addedCollider6 = _addedCollider;
((CapsuleCollider)((addedCollider6 is CapsuleCollider) ? addedCollider6 : null)).direction = (int)_addedColliderAxis;
break;
}
case EColliderType.Box:
{
_addedCollider = (Collider)(object)((Component)transform).gameObject.AddComponent<BoxCollider>();
Collider addedCollider = _addedCollider;
((BoxCollider)((addedCollider is BoxCollider) ? addedCollider : null)).center = center;
Collider addedCollider2 = _addedCollider;
((BoxCollider)((addedCollider2 is BoxCollider) ? addedCollider2 : null)).size = _addedColliderSize;
break;
}
}
_addedCollider.isTrigger = true;
}
else if ((Object)(object)value == (Object)null && (Object)(object)_firearm != (Object)null)
{
if (ReplaceExistingCollider)
{
_origCollider.enabled = true;
}
Object.Destroy((Object)(object)_addedCollider);
_firearm = null;
}
}
}
public void Awake()
{
//IL_0020: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Expected O, but got Unknown
//IL_005a: Unknown result type (might be due to invalid IL or missing references)
//IL_005f: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007b: Unknown result type (might be due to invalid IL or missing references)
//IL_00ec: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00f8: Unknown result type (might be due to invalid IL or missing references)
//IL_00fd: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
//IL_00b5: Unknown result type (might be due to invalid IL or missing references)
//IL_00c1: 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_0123: Unknown result type (might be due to invalid IL or missing references)
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_013e: Unknown result type (might be due to invalid IL or missing references)
//IL_00cd: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)ColliderReference != (Object)null))
{
return;
}
_colliderReferenceProxy = new TransformProxy(ColliderReference.transform, false);
Collider component = ColliderReference.GetComponent<Collider>();
CapsuleCollider val = (CapsuleCollider)(object)((component is CapsuleCollider) ? component : null);
BoxCollider val2 = (BoxCollider)(object)((component is BoxCollider) ? component : null);
SphereCollider val3 = (SphereCollider)(object)((component is SphereCollider) ? component : null);
if ((Object)(object)val != (Object)null)
{
_addedColliderCenter = val.center;
_addedColliderSize = new Vector3(val.radius, val.height, 0f);
_addedColliderType = EColliderType.Capsule;
switch (val.direction)
{
case 0:
_addedColliderAxis = (Axis)0;
break;
case 1:
_addedColliderAxis = (Axis)1;
break;
case 2:
_addedColliderAxis = (Axis)2;
break;
default:
_addedColliderAxis = (Axis)0;
break;
}
}
else if ((Object)(object)val2 != (Object)null)
{
_addedColliderCenter = val2.center;
_addedColliderSize = val2.size;
_addedColliderType = EColliderType.Box;
}
else if ((Object)(object)val3 != (Object)null)
{
_addedColliderCenter = val3.center;
_addedColliderSize = new Vector3(val3.radius, 0f, 0f);
_addedColliderType = EColliderType.Sphere;
}
Object.Destroy((Object)(object)ColliderReference);
}
}
public class FlipSightRemastered : FlipSight
{
public float RotationSpeedOpening;
public float RotationSpeedClosing;
public AudioEvent FlipOpen;
public AudioEvent FlipClosed;
public override void Awake()
{
((FlipSight)this).Awake();
Harmony.CreateAndPatchAll(typeof(FlipSightRemastered), (string)null);
}
[HarmonyPatch(typeof(FlipSight), "FVRFixedUpdate")]
[HarmonyPrefix]
public static bool FlipSight_FVRFixedUpdate_Patch(FlipSight __instance)
{
//IL_0139: Unknown result type (might be due to invalid IL or missing references)
//IL_00a9: Unknown result type (might be due to invalid IL or missing references)
if (__instance is FlipSightRemastered)
{
FlipSightRemastered flipSightRemastered = __instance as FlipSightRemastered;
if ((Object)(object)((FVRFireArmAttachmentInterface)flipSightRemastered).Attachment.curMount != (Object)null)
{
if (((FlipSight)flipSightRemastered).IsUp)
{
((FlipSight)flipSightRemastered).m_tarFlipLerp = 1f;
((FlipSight)flipSightRemastered).m_curFlipLerp = Mathf.MoveTowards(((FlipSight)flipSightRemastered).m_curFlipLerp, ((FlipSight)flipSightRemastered).m_tarFlipLerp, Time.deltaTime * flipSightRemastered.RotationSpeedOpening);
if (Mathf.Abs(((FlipSight)flipSightRemastered).m_curFlipLerp - ((FlipSight)flipSightRemastered).m_lastFlipLerp) > 0.001f)
{
((FlipSight)flipSightRemastered).FlipPart.localEulerAngles = new Vector3(Mathf.Lerp(((FlipSight)flipSightRemastered).XRotDown, ((FlipSight)flipSightRemastered).XRotUp, ((FlipSight)flipSightRemastered).m_curFlipLerp), 0f, 0f);
}
((FlipSight)flipSightRemastered).m_lastFlipLerp = ((FlipSight)flipSightRemastered).m_curFlipLerp;
}
else
{
((FlipSight)flipSightRemastered).m_tarFlipLerp = 0f;
((FlipSight)flipSightRemastered).m_curFlipLerp = Mathf.MoveTowards(((FlipSight)flipSightRemastered).m_curFlipLerp, ((FlipSight)flipSightRemastered).m_tarFlipLerp, Time.deltaTime * flipSightRemastered.RotationSpeedClosing);
if (Mathf.Abs(((FlipSight)flipSightRemastered).m_curFlipLerp - ((FlipSight)flipSightRemastered).m_lastFlipLerp) > 0.001f)
{
((FlipSight)flipSightRemastered).FlipPart.localEulerAngles = new Vector3(Mathf.Lerp(((FlipSight)flipSightRemastered).XRotDown, ((FlipSight)flipSightRemastered).XRotUp, ((FlipSight)flipSightRemastered).m_curFlipLerp), 0f, 0f);
}
((FlipSight)flipSightRemastered).m_lastFlipLerp = ((FlipSight)flipSightRemastered).m_curFlipLerp;
}
}
if (((FVRInteractiveObject)flipSightRemastered).IsHeld)
{
((FVRInteractiveObject)flipSightRemastered).TestHandDistance();
}
return false;
}
return true;
}
[HarmonyPatch(typeof(FlipSight), "Flip")]
[HarmonyPostfix]
public static void FlipSight_Flip_Patch(FlipSight __instance)
{
//IL_0049: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
if (__instance is FlipSightRemastered)
{
FlipSightRemastered flipSightRemastered = __instance as FlipSightRemastered;
if (((FlipSight)flipSightRemastered).IsUp)
{
SM.PlayGenericSound(flipSightRemastered.FlipOpen, ((Component)flipSightRemastered).transform.position);
}
else
{
SM.PlayGenericSound(flipSightRemastered.FlipClosed, ((Component)flipSightRemastered).transform.position);
}
}
}
}
public class NGSW_FC : FVRInteractiveObject
{
[Header("NGSW FireControl Config")]
public PIPScopeController PIPScopeController;
public Transform PostZeroReticleParent;
public Transform RaycastOrigin;
public LayerMask RangeFinderHitLayers;
public GameObject OneEcksReticle;
public float OneEcksReticleBaseScale = 1f;
public GameObject PreZeroReticle;
public float PreZeroReticleBaseScale = 1f;
public GameObject PostZeroReticle;
public float PostZeroReticleBaseScale = 1f;
public Text HeadingText;
private float _currentHeading;
public float RangeFinderRange = 5000f;
public Text ZeroRangeText;
public int BulletDropCalculationSingleFrameLimit = 0;
public float AsynchAbortEpsilon = 0.1f;
public int MaxAsynchIterationsPerFrame = 100;
public float ArtificialCalculationDelay = 0.1f;
public float IncompleteZeroBlinkInterval = 0.25f;
[Header("Zoom Ring")]
public float OneEcksThreshold = 0.1f;
private bool _isOneEcks = false;
private bool _isZeroed = false;
private FVRFireArm _fireArm;
private RaycastHit _lastHit;
private bool _stillCalculatingDrop;
private float _consineAdjustedRange;
private float _calculatedDrop;
private bool _compassEnabled = true;
private float _currentMagnification;
public bool CompassEnabled => _compassEnabled;
public override void Start()
{
((FVRInteractiveObject)this).Start();
base.IsSimpleInteract = true;
CheckMagnificationLevel();
UpdateReticles();
ResetZero();
}
public void Update()
{
if (Application.isEditor)
{
UpdateHeading();
CheckMagnificationLevel();
UpdateReticles();
}
}
public override void FVRUpdate()
{
((FVRInteractiveObject)this).FVRUpdate();
UpdateHeading();
CheckMagnificationLevel();
UpdateReticles();
}
public void ToggleCompass()
{
_compassEnabled = !_compassEnabled;
}
private void FindCurrentFirearm()
{
if ((Object)(object)((FVRFireArmAttachmentInterface)PIPScopeController).Attachment != (Object)null && (Object)(object)((FVRFireArmAttachmentInterface)PIPScopeController).Attachment.curMount != (Object)null && (Object)(object)((FVRFireArmAttachmentInterface)PIPScopeController).Attachment.curMount.Parent != (Object)null && ((FVRFireArmAttachmentInterface)PIPScopeController).Attachment.curMount.Parent is FVRFireArm)
{
ref FVRFireArm fireArm = ref _fireArm;
FVRPhysicalObject parent = ((FVRFireArmAttachmentInterface)PIPScopeController).Attachment.curMount.Parent;
fireArm = (FVRFireArm)(object)((parent is FVRFireArm) ? parent : null);
}
else if ((Object)(object)PIPScopeController.OverrideFireArm != (Object)null)
{
_fireArm = PIPScopeController.OverrideFireArm;
}
else if ((Object)(object)PIPScopeController.OverrideFireArm == (Object)null && (Object)(object)((FVRFireArmAttachmentInterface)PIPScopeController).Attachment != (Object)null && (Object)(object)((FVRFireArmAttachmentInterface)PIPScopeController).Attachment.curMount == (Object)null)
{
_fireArm = null;
}
}
private void CheckMagnificationLevel()
{
_currentMagnification = ((PIPScopeController.PScope.currentMagnification == 0f) ? PIPScopeController.PScope.baseMagnification : PIPScopeController.PScope.currentMagnification);
if (!_isOneEcks && _currentMagnification < 1f + OneEcksThreshold)
{
_isOneEcks = true;
ResetZero();
}
else if (_isOneEcks && !Mathf.Approximately(_currentMagnification, 1f))
{
_isOneEcks = false;
ResetZero();
}
}
private void UpdateReticles()
{
//IL_00a5: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00cc: Unknown result type (might be due to invalid IL or missing references)
//IL_00d1: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_010f: Unknown result type (might be due to invalid IL or missing references)
//IL_011a: Unknown result type (might be due to invalid IL or missing references)
//IL_011f: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: 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_00e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_016e: Unknown result type (might be due to invalid IL or missing references)
//IL_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_017e: Unknown result type (might be due to invalid IL or missing references)
//IL_018a: Unknown result type (might be due to invalid IL or missing references)
//IL_018f: Unknown result type (might be due to invalid IL or missing references)
//IL_0146: Unknown result type (might be due to invalid IL or missing references)
//IL_01a5: Unknown result type (might be due to invalid IL or missing references)
if (_isOneEcks)
{
OneEcksReticle.SetActive(true);
PreZeroReticle.SetActive(false);
PostZeroReticle.SetActive(false);
}
else if (!_stillCalculatingDrop)
{
OneEcksReticle.SetActive(false);
if (_isZeroed)
{
PreZeroReticle.SetActive(false);
PostZeroReticle.SetActive(true);
}
else
{
PreZeroReticle.SetActive(true);
PostZeroReticle.SetActive(false);
}
}
if (OneEcksReticle.activeSelf)
{
Vector3 val = Vector3.one * OneEcksReticleBaseScale * _currentMagnification;
if (OneEcksReticle.transform.localScale != val)
{
OneEcksReticle.transform.localScale = val;
}
}
else if (PreZeroReticle.activeSelf)
{
Vector3 val = Vector3.one * PreZeroReticleBaseScale * _currentMagnification;
if (PreZeroReticle.transform.localScale != val)
{
PreZeroReticle.transform.localScale = val;
}
}
else if (PostZeroReticle.activeSelf)
{
Vector3 val = Vector3.one * PostZeroReticleBaseScale * _currentMagnification;
if (PostZeroReticle.transform.localScale != val)
{
PostZeroReticle.transform.localScale = val;
}
}
}
public override void SimpleInteraction(FVRViveHand hand)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: 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)
((FVRInteractiveObject)this).SimpleInteraction(hand);
if (_isOneEcks)
{
return;
}
if (Physics.Raycast(RaycastOrigin.position, RaycastOrigin.forward, ref _lastHit, RangeFinderRange, LayerMask.op_Implicit(RangeFinderHitLayers)))
{
FindCurrentFirearm();
if ((Object)(object)_fireArm != (Object)null)
{
CalculateBulletDrop();
}
if (_stillCalculatingDrop)
{
ResetZero();
((MonoBehaviour)this).StopCoroutine("WaitForCalculation");
((MonoBehaviour)this).StartCoroutine("WaitForCalculation");
}
else
{
Zero();
}
}
else
{
ResetZero();
}
}
public void TriggerRangeFinderZeroing()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0062: Unknown result type (might be due to invalid IL or missing references)
//IL_0072: Unknown result type (might be due to invalid IL or missing references)
if (_isOneEcks)
{
return;
}
if (Physics.Raycast(RaycastOrigin.position, RaycastOrigin.forward, ref _lastHit, RangeFinderRange, LayerMask.op_Implicit(RangeFinderHitLayers)))
{
FindCurrentFirearm();
if ((Object)(object)_fireArm != (Object)null)
{
float num = 90f - Vector3.Angle(Vector3.up, _fireArm.GetMuzzle().forward);
_consineAdjustedRange = ((RaycastHit)(ref _lastHit)).distance * Mathf.Cos(num * ((float)Math.PI / 180f));
CalculateBulletDrop();
}
if (_stillCalculatingDrop)
{
ResetZero();
((MonoBehaviour)this).StopCoroutine("WaitForCalculation");
((MonoBehaviour)this).StartCoroutine("WaitForCalculation");
}
else
{
Zero();
}
}
else
{
ResetZero();
}
}
private IEnumerator WaitForCalculation()
{
((MonoBehaviour)this).StopCoroutine("DisplayBlinker");
((MonoBehaviour)this).StartCoroutine("DisplayBlinker");
while (_stillCalculatingDrop)
{
yield return null;
}
Zero();
}
private IEnumerator DisplayBlinker()
{
if ((Object)(object)ZeroRangeText != (Object)null)
{
ZeroRangeText.text = $"{Mathf.RoundToInt(((RaycastHit)(ref _lastHit)).distance)}m";
}
while (_stillCalculatingDrop)
{
if ((Object)(object)ZeroRangeText != (Object)null)
{
((Component)ZeroRangeText).gameObject.SetActive(false);
}
PreZeroReticle.SetActive(false);
yield return (object)new WaitForSeconds(IncompleteZeroBlinkInterval);
if ((Object)(object)ZeroRangeText != (Object)null)
{
((Component)ZeroRangeText).gameObject.SetActive(true);
}
PreZeroReticle.SetActive(true);
yield return (object)new WaitForSeconds(IncompleteZeroBlinkInterval);
}
}
private void UpdateHeading()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0025: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_002b: Unknown result type (might be due to invalid IL or missing references)
//IL_0030: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_0034: Unknown result type (might be due to invalid IL or missing references)
if (_compassEnabled)
{
Vector3 forward = ((Component)this).transform.forward;
forward.y = 0f;
Vector3 forward2 = Vector3.forward;
Vector3 up = Vector3.up;
float currentHeading = AngleSigned(forward2, forward, up);
_currentHeading = currentHeading;
if (_currentHeading < 0f)
{
_currentHeading += 360f;
}
if ((Object)(object)HeadingText != (Object)null)
{
HeadingText.text = FormatHeadingText();
}
}
else if ((Object)(object)HeadingText != (Object)null)
{
HeadingText.text = string.Empty;
}
}
private string FormatHeadingText()
{
string text = $"{Mathf.RoundToInt(_currentHeading)}°";
string empty = string.Empty;
empty = ((_currentHeading < 22.5f || _currentHeading > 337.5f) ? "N " : ((_currentHeading >= 22.5f && _currentHeading < 67.5f) ? "NE " : ((_currentHeading >= 67.5f && _currentHeading < 112.5f) ? "E " : ((_currentHeading >= 112.5f && _currentHeading < 157.5f) ? "SE " : ((_currentHeading >= 157.5f && _currentHeading < 202.5f) ? "S " : ((_currentHeading >= 202.5f && _currentHeading < 247.5f) ? "SW " : ((!(_currentHeading >= 247.5f) || !(_currentHeading < 292.5f)) ? "NW " : "W ")))))));
return empty + text;
}
private float AngleSigned(Vector3 v1, Vector3 v2, Vector3 n)
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0002: Unknown result type (might be due to invalid IL or missing references)
//IL_0003: Unknown result type (might be due to invalid IL or missing references)
//IL_0004: Unknown result type (might be due to invalid IL or missing references)
//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)
return Mathf.Atan2(Vector3.Dot(n, Vector3.Cross(v1, v2)), Vector3.Dot(v1, v2)) * 57.29578f;
}
public void Zero()
{
//IL_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b4: Unknown result type (might be due to invalid IL or missing references)
//IL_00b9: Unknown result type (might be due to invalid IL or missing references)
//IL_00be: Unknown result type (might be due to invalid IL or missing references)
//IL_00c8: Unknown result type (might be due to invalid IL or missing references)
//IL_00c9: Unknown result type (might be due to invalid IL or missing references)
//IL_00ce: Unknown result type (might be due to invalid IL or missing references)
//IL_00d3: Unknown result type (might be due to invalid IL or missing references)
//IL_0086: Unknown result type (might be due to invalid IL or missing references)
//IL_0041: 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_0057: Unknown result type (might be due to invalid IL or missing references)
//IL_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_0061: Unknown result type (might be due to invalid IL or missing references)
//IL_0068: 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_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_0153: Unknown result type (might be due to invalid IL or missing references)
//IL_015d: Unknown result type (might be due to invalid IL or missing references)
//IL_0162: Unknown result type (might be due to invalid IL or missing references)
//IL_0167: Unknown result type (might be due to invalid IL or missing references)
//IL_0175: Unknown result type (might be due to invalid IL or missing references)
//IL_0188: Unknown result type (might be due to invalid IL or missing references)
//IL_01a3: Unknown result type (might be due to invalid IL or missing references)
//IL_01a8: Unknown result type (might be due to invalid IL or missing references)
//IL_01ad: Unknown result type (might be due to invalid IL or missing references)
//IL_01af: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_01b6: Unknown result type (might be due to invalid IL or missing references)
//IL_01bb: Unknown result type (might be due to invalid IL or missing references)
//IL_01be: Unknown result type (might be due to invalid IL or missing references)
//IL_01c3: Unknown result type (might be due to invalid IL or missing references)
//IL_01c7: Unknown result type (might be due to invalid IL or missing references)
//IL_01cc: Unknown result type (might be due to invalid IL or missing references)
//IL_01d1: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01dd: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0223: Unknown result type (might be due to invalid IL or missing references)
//IL_02aa: Unknown result type (might be due to invalid IL or missing references)
//IL_010b: Unknown result type (might be due to invalid IL or missing references)
float distance = ((RaycastHit)(ref _lastHit)).distance;
if ((Object)(object)_fireArm == (Object)null)
{
if ((Object)(object)PIPScopeController.OverrideMuzzle != (Object)null)
{
Vector3 val = PIPScopeController.OverrideMuzzle.position + PIPScopeController.OverrideMuzzle.forward * distance;
PostZeroReticleParent.LookAt(val, Vector3.up);
_isZeroed = true;
}
else
{
PostZeroReticleParent.localRotation = Quaternion.identity;
_isZeroed = false;
}
return;
}
Transform muzzle = _fireArm.GetMuzzle();
Vector3 val2 = ((RaycastHit)(ref _lastHit)).point - muzzle.position;
float magnitude = ((Vector3)(ref val2)).magnitude;
Vector3 val3 = Vector3.ProjectOnPlane(val2, Vector3.up);
float magnitude2 = ((Vector3)(ref val3)).magnitude;
if ((Object)(object)_fireArm != (Object)null)
{
float calculatedDrop = _calculatedDrop;
if (calculatedDrop == float.MinValue)
{
PostZeroReticleParent.localPosition = Vector3.zero;
if ((Object)(object)ZeroRangeText != (Object)null)
{
ZeroRangeText.text = "Out of range!";
}
_isZeroed = false;
return;
}
Vector3 val4 = Vector2.op_Implicit(_fireArm.GetCombinedFixedDrift(_fireArm.AccuracyClass) * 0.0166667f);
float num = _fireArm.GetCombinedFixedDrop(_fireArm.AccuracyClass) * 0.0166667f;
Quaternion val5 = muzzle.rotation * Quaternion.Euler(val4.y + num, val4.x, 0f);
Vector3 val6 = val5 * Vector3.forward;
Vector3 val7 = muzzle.position + val6 * magnitude + Vector3.up * calculatedDrop;
Camera scopeCam = PIPScopeController.PScope.scopeCam;
float num2 = scopeCam.fieldOfView / 2f;
float num3 = (float)scopeCam.pixelHeight / 2f;
Vector3 val8 = ((Component)scopeCam).transform.InverseTransformPoint(val7);
float num4 = Mathf.Atan2(val8.x, val8.z) * 57.29578f;
float num5 = Mathf.Atan2(val8.y, val8.z) * 57.29578f;
float num6 = Mathf.Tan(num4 * ((float)Math.PI / 180f)) / Mathf.Tan(num2 * ((float)Math.PI / 180f)) * num3;
float num7 = Mathf.Tan(num5 * ((float)Math.PI / 180f)) / Mathf.Tan(num2 * ((float)Math.PI / 180f)) * num3;
PostZeroReticleParent.localPosition = new Vector3(num6, num7, 0f);
}
if ((Object)(object)ZeroRangeText != (Object)null)
{
ZeroRangeText.text = $"{Mathf.RoundToInt(distance)}m";
}
_isZeroed = true;
}
private void ResetZero()
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
PostZeroReticleParent.localPosition = Vector3.zero;
if ((Object)(object)ZeroRangeText != (Object)null)
{
ZeroRangeText.text = string.Empty;
}
_isZeroed = false;
}
public void CalculateBulletDrop()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0033: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0143: Unknown result type (might be due to invalid IL or missing references)
//IL_0148: Unknown result type (might be due to invalid IL or missing references)
//IL_0239: Unknown result type (might be due to invalid IL or missing references)
//IL_023b: Unknown result type (might be due to invalid IL or missing references)
//IL_01b5: Unknown result type (might be due to invalid IL or missing references)
//IL_01b7: Unknown result type (might be due to invalid IL or missing references)
//IL_01c4: Unknown result type (might be due to invalid IL or missing references)
//IL_01cb: Unknown result type (might be due to invalid IL or missing references)
//IL_01d0: Unknown result type (might be due to invalid IL or missing references)
//IL_01d5: Unknown result type (might be due to invalid IL or missing references)
//IL_01d8: Unknown result type (might be due to invalid IL or missing references)
//IL_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_01e7: Unknown result type (might be due to invalid IL or missing references)
//IL_01e9: Unknown result type (might be due to invalid IL or missing references)
//IL_01eb: Unknown result type (might be due to invalid IL or missing references)
//IL_01ef: Unknown result type (might be due to invalid IL or missing references)
//IL_01f4: Unknown result type (might be due to invalid IL or missing references)
//IL_01f9: Unknown result type (might be due to invalid IL or missing references)
//IL_01fd: Unknown result type (might be due to invalid IL or missing references)
//IL_01ff: Unknown result type (might be due to invalid IL or missing references)
//IL_0209: Unknown result type (might be due to invalid IL or missing references)
//IL_020b: Unknown result type (might be due to invalid IL or missing references)
FVRFireArmChamber currentChamber = OpenScripts2_BasePlugin.GetCurrentChamber(_fireArm);
FireArmRoundType roundType = _fireArm.RoundType;
FVRFireArmRoundDisplayData val = AM.SRoundDisplayDataDic[roundType];
float num = ((!((Object)(object)currentChamber != (Object)null)) ? 1f : AM.GetChamberVelMult(currentChamber.RoundType, Vector3.Distance(((Component)currentChamber).transform.position, _fireArm.GetMuzzle().position)));
float airDensity = 1.225f;
float num2 = 0.012f;
num2 = Time.fixedDeltaTime;
float num3 = val.ZeroingVel;
float num4 = val.ZeroingMass;
float num5 = val.ZeroingXDim;
BallisticProjectile val2 = null;
if ((Object)(object)currentChamber != (Object)null && currentChamber.IsFull && !currentChamber.IsSpent)
{
FVRFireArmRound round = currentChamber.GetRound();
if ((Object)(object)round != (Object)null)
{
val2 = round.BallisticProjectilePrefab.GetComponent<BallisticProjectile>();
if ((Object)(object)val2 != (Object)null)
{
num3 = val2.MuzzleVelocityBase;
num4 = val2.Mass;
num5 = val2.Dimensions.x;
}
}
}
Vector3 val3 = default(Vector3);
((Vector3)(ref val3))..ctor(0f, 0f, num3 * num);
float num6 = (float)Math.PI * Mathf.Pow(num5 * 0.5f, 2f);
Vector3 val4 = Vector3.zero;
float num7 = 0f;
bool flag = false;
int currentKeyframe = 0;
bool flag2 = false;
int i;
for (i = 0; i < BulletDropCalculationSingleFrameLimit; i++)
{
if (val4.z >= _consineAdjustedRange)
{
break;
}
if (!flag && ((Vector3)(ref val3)).magnitude < 430f)
{
flag = true;
}
if (!flag2 && val4.y < 0f)
{
flag2 = true;
}
val3 += Vector3.down * GetGravity(val2) * num2;
val3 = ApplyDrag(val3, airDensity, num2, num6, num4);
Vector3 val5 = val4 + val3 * num2;
num7 += Vector3.Distance(val5, val4);
val4 = val5;
}
if (i == BulletDropCalculationSingleFrameLimit)
{
((MonoBehaviour)this).StopAllCoroutines();
((MonoBehaviour)this).StartCoroutine(ContinueDropCalculationAfterBreak(currentKeyframe, val4, val3, num4, num6, val2));
}
else
{
_calculatedDrop = val4.y;
_stillCalculatingDrop = false;
}
}
private IEnumerator ContinueDropCalculationAfterBreak(int currentKeyframe, Vector3 startingBulletPosition, Vector3 startingBulletVelocity, float ZeroingMass, float ZeroingCrossSectionArea, BallisticProjectile projectile)
{
//IL_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_0008: Unknown result type (might be due to invalid IL or missing references)
//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)
_stillCalculatingDrop = true;
Vector3 bulletPosition = startingBulletPosition;
Vector3 velocityVector2 = startingBulletVelocity;
float physicsDeltaTime2 = 0.012f;
physicsDeltaTime2 = Time.fixedDeltaTime;
float airDensity = 1.225f;
Vector3 positionLastFrame;
do
{
positionLastFrame = bulletPosition;
for (int i = 0; i < MaxAsynchIterationsPerFrame; i++)
{
if (bulletPosition.z >= _consineAdjustedRange)
{
break;
}
velocityVector2 += Vector3.down * GetGravity(projectile) * physicsDeltaTime2;
velocityVector2 = ApplyDrag(velocityVector2, airDensity, physicsDeltaTime2, ZeroingCrossSectionArea, ZeroingMass);
Vector3 nextPosition = bulletPosition + velocityVector2 * physicsDeltaTime2;
if (Mathf.Abs(nextPosition.z - bulletPosition.z) < AsynchAbortEpsilon / (float)MaxAsynchIterationsPerFrame)
{
break;
}
bulletPosition = nextPosition;
}
if (bulletPosition.z >= _consineAdjustedRange)
{
break;
}
yield return (object)new WaitForSeconds(ArtificialCalculationDelay);
}
while (Mathf.Abs(bulletPosition.z - positionLastFrame.z) > AsynchAbortEpsilon);
if (bulletPosition.z < _consineAdjustedRange)
{
_calculatedDrop = float.MinValue;
}
else
{
_calculatedDrop = bulletPosition.y;
}
_stillCalculatingDrop = false;
}
private Vector3 ApplyDrag(Vector3 velocityVector, float airDensity, float deltaTime, float frontArea, float Mass)
{
//IL_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_0010: Unknown result type (might be due to invalid IL or missing references)
//IL_0031: Unknown result type (might be due to invalid IL or missing references)
//IL_0032: Unknown result type (might be due to invalid IL or missing references)
//IL_0037: Unknown result type (might be due to invalid IL or missing references)
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_004f: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Unknown result type (might be due to invalid IL or missing references)
//IL_005b: Unknown result type (might be due to invalid IL or missing references)
float magnitude = ((Vector3)(ref velocityVector)).magnitude;
Vector3 normalized = ((Vector3)(ref velocityVector)).normalized;
float currentDragCoefficient = GetCurrentDragCoefficient(((Vector3)(ref velocityVector)).magnitude);
Vector3 val = (0f - 0.5f * currentDragCoefficient * airDensity * (frontArea / Mass) * magnitude) * velocityVector;
return normalized * Mathf.Clamp(magnitude - ((Vector3)(ref val)).magnitude * deltaTime, 0f, magnitude);
}
private float GetCurrentDragCoefficient(float velocityInMS)
{
float num = velocityInMS * 0.00291545f;
return AM.BDCC.Evaluate(num);
}
private float GetGravity(BallisticProjectile projectile)
{
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
//IL_0029: Unknown result type (might be due to invalid IL or missing references)
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Expected I4, but got Unknown
float num = 1f;
if ((Object)(object)projectile != (Object)null)
{
num = projectile.GravityMultiplier;
}
GravityMode ballisticGravityMode = GM.Options.SimulationOptions.BallisticGravityMode;
return (int)ballisticGravityMode switch
{
0 => 9.81f * num,
1 => 5f * num,
2 => 1.622f * num,
3 => 0f * num,
_ => 0f * num,
};
}
}
public class NGSW_FC_Button : FVRInteractiveObject
{
public enum EButtonType
{
Center,
Up,
Down,
Left,
Right
}
[Header("NGS-FC Button Config")]
public NGSW_FC_ScreenController NGSW_FC_ScreenController;
public EButtonType ButtonType;
public AudioEvent ButtonAudio;
public override void Awake()
{
((FVRInteractiveObject)this).Awake();
base.IsSimpleInteract = true;
}
public override void SimpleInteraction(FVRViveHand hand)
{
//IL_008a: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).SimpleInteraction(hand);
switch (ButtonType)
{
case EButtonType.Center:
NGSW_FC_ScreenController.ButtonCenter();
break;
case EButtonType.Up:
NGSW_FC_ScreenController.ButtonUp();
break;
case EButtonType.Down:
NGSW_FC_ScreenController.ButtonDown();
break;
case EButtonType.Left:
NGSW_FC_ScreenController.ButtonLeft();
break;
case EButtonType.Right:
NGSW_FC_ScreenController.ButtonRight();
break;
}
SM.PlayGenericSound(ButtonAudio, ((Component)this).transform.position);
}
}
public class NGSW_FC_Interaction : FVRInteractiveObject
{
[Header("NGSW FC Interaction Config")]
public NGSW_FC_ScreenController ScreenController;
public float RotationMagnitudePerOption = 15f;
private Vector3 _lastHandRight = Vector3.zero;
private float m_curRot;
public override void BeginInteraction(FVRViveHand hand)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_001f: Unknown result type (might be due to invalid IL or missing references)
//IL_0024: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).BeginInteraction(hand);
_lastHandRight = Vector3.ProjectOnPlane(hand.Input.FilteredRight, ((Component)this).transform.up);
ScreenController.EnableScreen();
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0015: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
//IL_012b: Unknown result type (might be due to invalid IL or missing references)
//IL_0136: Unknown result type (might be due to invalid IL or missing references)
//IL_013b: 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_0142: 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_0152: Unknown result type (might be due to invalid IL or missing references)
//IL_0157: 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_0163: Unknown result type (might be due to invalid IL or missing references)
//IL_0164: Unknown result type (might be due to invalid IL or missing references)
//IL_0165: Unknown result type (might be due to invalid IL or missing references)
//IL_016f: Unknown result type (might be due to invalid IL or missing references)
//IL_0170: Unknown result type (might be due to invalid IL or missing references)
//IL_0035: Unknown result type (might be due to invalid IL or missing references)
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0060: Unknown result type (might be due to invalid IL or missing references)
//IL_0065: Unknown result type (might be due to invalid IL or missing references)
//IL_008b: Unknown result type (might be due to invalid IL or missing references)
//IL_0090: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0261: Unknown result type (might be due to invalid IL or missing references)
//IL_00b6: Unknown result type (might be due to invalid IL or missing references)
//IL_00bb: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).UpdateInteraction(hand);
if (!((FVRInteractiveObject)this).IsHeld)
{
return;
}
HandInput input = hand.Input;
if (!hand.IsInStreamlinedMode && input.TouchpadDown)
{
if (Vector2.Angle(input.TouchpadAxes, Vector2.up) < 45f)
{
ScreenController.ButtonUp();
}
else if (Vector2.Angle(input.TouchpadAxes, Vector2.down) < 45f)
{
ScreenController.ButtonDown();
}
else if (Vector2.Angle(input.TouchpadAxes, Vector2.left) < 45f)
{
ScreenController.ButtonLeft();
}
else if (Vector2.Angle(input.TouchpadAxes, Vector2.right) < 45f)
{
ScreenController.ButtonRight();
}
}
else if (hand.IsInStreamlinedMode)
{
if (input.AXButtonDown)
{
ScreenController.ButtonRight();
}
else if (input.BYButtonDown)
{
ScreenController.ButtonLeft();
}
}
Vector3 val = Vector3.ProjectOnPlane(base.m_hand.Input.FilteredRight, ((Component)this).transform.up);
Vector3 val2 = Vector3.ProjectOnPlane(_lastHandRight, ((Component)this).transform.up);
float num = Mathf.Atan2(Vector3.Dot(((Component)this).transform.up, Vector3.Cross(val, val2)), Vector3.Dot(val, val2)) * 57.29578f;
if (RotationMagnitudePerOption < 0f)
{
num = 0f - num;
}
m_curRot += num;
if (m_curRot > Mathf.Abs(RotationMagnitudePerOption))
{
m_curRot -= Mathf.Abs(RotationMagnitudePerOption);
if (!hand.IsInStreamlinedMode)
{
ScreenController.IncrementBrightness();
}
else
{
ScreenController.ButtonUp();
}
}
else if (m_curRot < 0f - Mathf.Abs(RotationMagnitudePerOption))
{
m_curRot += Mathf.Abs(RotationMagnitudePerOption);
if (!hand.IsInStreamlinedMode)
{
ScreenController.DecrementBrightness();
}
else
{
ScreenController.ButtonDown();
}
}
_lastHandRight = val;
}
public override void EndInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).EndInteraction(hand);
ScreenController.DisableScreen();
}
}
public class NGSW_FC_PressurePad : FVRFireArmAttachmentInterface
{
[Header("NGSW-FC Pressure Pad Config")]
public float DoubleTapWaitTime = 0.333f;
public AudioEvent ButtonPress;
private bool _isLightToggle = false;
private bool _isLaserToggle = false;
private FVRAlternateGrip _altGrip;
private bool _wasAltGripGrabbed = false;
private float _timeWaited = 0f;
private bool _waitingForDoubleTap = false;
private bool _irActive = false;
private bool _strobeActive = false;
private List<TacticalFlashlight> _flashlights = new List<TacticalFlashlight>();
private List<LaserPointer> _lasers = new List<LaserPointer>();
private List<AdvancedLaserController> _advancedLaserControllers = new List<AdvancedLaserController>();
private Dictionary<AdvancedLaserController, List<int>> _advancedLights = new Dictionary<AdvancedLaserController, List<int>>();
private Dictionary<AdvancedLaserController, List<int>> _advancedLasers = new Dictionary<AdvancedLaserController, List<int>>();
private Dictionary<AdvancedLaserController, List<int>> _advancedIRLights = new Dictionary<AdvancedLaserController, List<int>>();
private Dictionary<AdvancedLaserController, List<int>> _advancedIRLasers = new Dictionary<AdvancedLaserController, List<int>>();
private Dictionary<AdvancedLaserController, List<int>> _advancedStrobes = new Dictionary<AdvancedLaserController, List<int>>();
private List<NGSW_FC> _ngsw_fcs = new List<NGSW_FC>();
private static Dictionary<FVRAlternateGrip, NGSW_FC_PressurePad> _existingPressurePadAttachments;
private static IntPtr _baseUpdateInteractionPointer;
private static FieldInfo _advancedLasersCurrentEmmitterIndex;
static NGSW_FC_PressurePad()
{
_existingPressurePadAttachments = new Dictionary<FVRAlternateGrip, NGSW_FC_PressurePad>();
Harmony.CreateAndPatchAll(typeof(NGSW_FC_PressurePad), (string)null);
_baseUpdateInteractionPointer = typeof(FVRAlternateGrip).BaseType.GetMethod("UpdateInteraction").MethodHandle.GetFunctionPointer();
_advancedLasersCurrentEmmitterIndex = typeof(AdvancedLaserController).GetField("_currentEmitterIndex", BindingFlags.Instance | BindingFlags.NonPublic);
}
public override void OnDestroy()
{
((FVRInteractiveObject)this).OnDestroy();
if ((Object)(object)_altGrip != (Object)null)
{
_existingPressurePadAttachments.Remove(_altGrip);
}
}
public override void OnAttach()
{
((FVRFireArmAttachmentInterface)this).OnAttach();
if ((Object)(object)base.Attachment.curMount != (Object)null && base.Attachment.curMount.GetRootMount().MyObject is FVRFireArm)
{
FVRPhysicalObject myObject = base.Attachment.curMount.GetRootMount().MyObject;
if ((Object)(object)((FVRFireArm)((myObject is FVRFireArm) ? myObject : null)).Foregrip != (Object)null)
{
ref FVRAlternateGrip altGrip = ref _altGrip;
FVRPhysicalObject myObject2 = base.Attachment.curMount.GetRootMount().MyObject;
altGrip = ((FVRFireArm)((myObject2 is FVRFireArm) ? myObject2 : null)).Foregrip.GetComponent<FVRAlternateGrip>();
}
else
{
_altGrip = ((Component)base.Attachment.curMount.GetRootMount().MyObject).GetComponentInChildren<FVRAlternateGrip>(true);
}
}
}
public override void OnDetach()
{
if ((Object)(object)_altGrip != (Object)null)
{
_existingPressurePadAttachments.Remove(_altGrip);
_altGrip = null;
}
ToggleLights(on: false);
ToggleLasers(on: false);
((FVRFireArmAttachmentInterface)this).OnDetach();
}
public override void FVRUpdate()
{
//IL_00c5: Unknown result type (might be due to invalid IL or missing references)
//IL_00ca: Unknown result type (might be due to invalid IL or missing references)
//IL_01b1: Unknown result type (might be due to invalid IL or missing references)
//IL_012a: Unknown result type (might be due to invalid IL or missing references)
//IL_012f: Unknown result type (might be due to invalid IL or missing references)
//IL_01f7: Unknown result type (might be due to invalid IL or missing references)
//IL_0104: Unknown result type (might be due to invalid IL or missing references)
//IL_0219: Unknown result type (might be due to invalid IL or missing references)
//IL_021e: Unknown result type (might be due to invalid IL or missing references)
//IL_0169: Unknown result type (might be due to invalid IL or missing references)
//IL_0290: Unknown result type (might be due to invalid IL or missing references)
//IL_0295: Unknown result type (might be due to invalid IL or missing references)
//IL_026a: Unknown result type (might be due to invalid IL or missing references)
//IL_02bc: Unknown result type (might be due to invalid IL or missing references)
//IL_02e9: Unknown result type (might be due to invalid IL or missing references)
//IL_02ee: Unknown result type (might be due to invalid IL or missing references)
//IL_03a0: Unknown result type (might be due to invalid IL or missing references)
//IL_03a5: Unknown result type (might be due to invalid IL or missing references)
//IL_0457: Unknown result type (might be due to invalid IL or missing references)
//IL_045c: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).FVRUpdate();
if (!((Object)(object)_altGrip != (Object)null))
{
return;
}
if (!_existingPressurePadAttachments.ContainsKey(_altGrip))
{
_existingPressurePadAttachments.Add(_altGrip, this);
}
FVRViveHand hand = ((FVRInteractiveObject)_altGrip).m_hand;
if (!_wasAltGripGrabbed && (Object)(object)hand != (Object)null)
{
_wasAltGripGrabbed = true;
CreateDictionaries();
}
else if (_wasAltGripGrabbed && (Object)(object)hand == (Object)null)
{
_wasAltGripGrabbed = false;
}
if (!((Object)(object)hand != (Object)null))
{
return;
}
if (!hand.IsInStreamlinedMode)
{
if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45f)
{
if (!_waitingForDoubleTap)
{
((MonoBehaviour)this).StartCoroutine(WaitForDoubleTap(up: true));
}
SM.PlayGenericSound(ButtonPress, ((Component)this).transform.position);
}
else if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) < 45f)
{
if (!_waitingForDoubleTap)
{
((MonoBehaviour)this).StartCoroutine(WaitForDoubleTap(up: false));
}
SM.PlayGenericSound(ButtonPress, ((Component)this).transform.position);
}
}
else if (hand.Input.BYButtonDown)
{
if (!_waitingForDoubleTap)
{
((MonoBehaviour)this).StartCoroutine(WaitForDoubleTap(up: true));
}
SM.PlayGenericSound(ButtonPress, ((Component)this).transform.position);
}
else if (hand.Input.AXButtonDown)
{
if (!_waitingForDoubleTap)
{
((MonoBehaviour)this).StartCoroutine(WaitForDoubleTap(up: false));
}
SM.PlayGenericSound(ButtonPress, ((Component)this).transform.position);
}
if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f)
{
_irActive = !_irActive;
ToggleLights(on: false);
ToggleLasers(on: false);
_isLightToggle = false;
_isLaserToggle = false;
SM.PlayGenericSound(ButtonPress, ((Component)this).transform.position);
}
else if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f)
{
ToggleStrobe();
SM.PlayGenericSound(ButtonPress, ((Component)this).transform.position);
}
if (!hand.IsInStreamlinedMode)
{
if (hand.Input.TouchpadPressed && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.up) < 45f)
{
ToggleLights(on: true);
}
else if (hand.Input.TouchpadUp && !_isLightToggle)
{
ToggleLights(on: false);
}
}
else if (hand.Input.BYButtonPressed)
{
ToggleLights(on: true);
}
else if (hand.Input.BYButtonUp && !_isLightToggle)
{
ToggleLights(on: false);
}
if (!hand.IsInStreamlinedMode)
{
if (hand.Input.TouchpadPressed && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) < 45f)
{
ToggleLasers(on: true);
}
else if (hand.Input.TouchpadUp && !_isLaserToggle)
{
ToggleLasers(on: false);
}
}
else if (hand.Input.AXButtonPressed)
{
ToggleLasers(on: true);
}
else if (hand.Input.AXButtonUp && !_isLaserToggle)
{
ToggleLasers(on: false);
}
if (!hand.IsInStreamlinedMode)
{
if (!hand.Input.TouchpadDown || !(Vector2.Angle(hand.Input.TouchpadAxes, Vector2.down) < 45f))
{
return;
}
{
foreach (NGSW_FC ngsw_fc in _ngsw_fcs)
{
ngsw_fc.TriggerRangeFinderZeroing();
}
return;
}
}
if (!hand.Input.AXButtonDown)
{
return;
}
foreach (NGSW_FC ngsw_fc2 in _ngsw_fcs)
{
ngsw_fc2.TriggerRangeFinderZeroing();
}
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_001e: Unknown result type (might be due to invalid IL or missing references)
//IL_0023: 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_0084: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArmAttachmentInterface)this).UpdateInteraction(hand);
if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.left) < 45f)
{
_irActive = !_irActive;
ToggleLights(on: false);
ToggleLasers(on: false);
_isLightToggle = false;
_isLaserToggle = false;
}
else if (hand.Input.TouchpadDown && Vector2.Angle(hand.Input.TouchpadAxes, Vector2.right) < 45f)
{
ToggleStrobe();
}
}
public void CreateDictionaries()
{
//IL_021c: Unknown result type (might be due to invalid IL or missing references)
//IL_0226: Expected O, but got Unknown
//IL_0249: Unknown result type (might be due to invalid IL or missing references)
//IL_0253: Expected O, but got Unknown
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Invalid comparison between Unknown and I4
//IL_030a: Unknown result type (might be due to invalid IL or missing references)
//IL_0310: Invalid comparison between Unknown and I4
//IL_036e: Unknown result type (might be due to invalid IL or missing references)
//IL_0374: Invalid comparison between Unknown and I4
//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
//IL_03d8: Invalid comparison between Unknown and I4
//IL_0436: Unknown result type (might be due to invalid IL or missing references)
//IL_043c: Invalid comparison between Unknown and I4
//IL_049a: Unknown result type (might be due to invalid IL or missing references)
//IL_04a0: Invalid comparison between Unknown and I4
foreach (KeyValuePair<AdvancedLaserController, List<int>> advancedLight in _advancedLights)
{
advancedLight.Value.Clear();
}
foreach (KeyValuePair<AdvancedLaserController, List<int>> advancedLaser in _advancedLasers)
{
advancedLaser.Value.Clear();
}
foreach (KeyValuePair<AdvancedLaserController, List<int>> advancedIRLight in _advancedIRLights)
{
advancedIRLight.Value.Clear();
}
foreach (KeyValuePair<AdvancedLaserController, List<int>> advancedIRLaser in _advancedIRLasers)
{
advancedIRLaser.Value.Clear();
}
foreach (KeyValuePair<AdvancedLaserController, List<int>> advancedStrobe in _advancedStrobes)
{
advancedStrobe.Value.Clear();
}
_ngsw_fcs.Clear();
_flashlights.Clear();
_lasers.Clear();
_advancedLaserControllers.Clear();
_advancedLights.Clear();
_advancedLasers.Clear();
_advancedIRLights.Clear();
_advancedIRLasers.Clear();
_advancedStrobes.Clear();
foreach (FVRFireArmAttachment attachments in base.Attachment.curMount.GetRootMount().MyObject.AttachmentsList)
{
if (attachments.AttachmentInterface is TacticalFlashlight)
{
_flashlights.Add((TacticalFlashlight)attachments.AttachmentInterface);
continue;
}
if (attachments.AttachmentInterface is LaserPointer)
{
_lasers.Add((LaserPointer)attachments.AttachmentInterface);
continue;
}
AdvancedLaserController componentInChildren = ((Component)attachments).GetComponentInChildren<AdvancedLaserController>(true);
NGSW_FC componentInChildren2 = ((Component)attachments).GetComponentInChildren<NGSW_FC>(true);
if ((Object)(object)componentInChildren != (Object)null)
{
_advancedLaserControllers.Add(componentInChildren);
}
else if ((Object)(object)componentInChildren2 != (Object)null)
{
_ngsw_fcs.Add(componentInChildren2);
}
}
foreach (AdvancedLaserController advancedLaserController in _advancedLaserControllers)
{
for (int i = 0; i < advancedLaserController.ListOfEmitterObjects.Count; i++)
{
List<int> value;
if ((int)advancedLaserController.ListOfEmitterTypes[i] == 1 || (int)advancedLaserController.ListOfEmitterTypes[i] == 6)
{
if (_advancedLasers.TryGetValue(advancedLaserController, out value))
{
value.Add(i);
continue;
}
List<int> list = new List<int>();
list.Add(i);
value = list;
_advancedLasers.Add(advancedLaserController, value);
}
else if ((int)advancedLaserController.ListOfEmitterTypes[i] == 3)
{
if (_advancedLights.TryGetValue(advancedLaserController, out value))
{
value.Add(i);
continue;
}
List<int> list = new List<int>();
list.Add(i);
value = list;
_advancedLights.Add(advancedLaserController, value);
}
else if ((int)advancedLaserController.ListOfEmitterTypes[i] == 2)
{
if (_advancedIRLasers.TryGetValue(advancedLaserController, out value))
{
value.Add(i);
continue;
}
List<int> list = new List<int>();
list.Add(i);
value = list;
_advancedIRLasers.Add(advancedLaserController, value);
}
else if ((int)advancedLaserController.ListOfEmitterTypes[i] == 4)
{
if (_advancedIRLights.TryGetValue(advancedLaserController, out value))
{
value.Add(i);
continue;
}
List<int> list = new List<int>();
list.Add(i);
value = list;
_advancedIRLights.Add(advancedLaserController, value);
}
else if ((int)advancedLaserController.ListOfEmitterTypes[i] == 5)
{
if (_advancedStrobes.TryGetValue(advancedLaserController, out value))
{
value.Add(i);
continue;
}
List<int> list = new List<int>();
list.Add(i);
value = list;
_advancedStrobes.Add(advancedLaserController, value);
}
}
}
}
public void ToggleLights(bool on)
{
if (on)
{
if (!_irActive)
{
foreach (TacticalFlashlight flashlight in _flashlights)
{
if (!flashlight.IsOn)
{
flashlight.ToggleOn();
}
}
{
foreach (KeyValuePair<AdvancedLaserController, List<int>> advancedLight in _advancedLights)
{
foreach (int item in advancedLight.Value)
{
int num = (int)_advancedLasersCurrentEmmitterIndex.GetValue(advancedLight.Key);
_advancedLasersCurrentEmmitterIndex.SetValue(advancedLight.Key, item);
advancedLight.Key.ToggleRight();
_advancedLasersCurrentEmmitterIndex.SetValue(advancedLight.Key, num);
}
}
return;
}
}
{
foreach (KeyValuePair<AdvancedLaserController, List<int>> advancedIRLight in _advancedIRLights)
{
foreach (int item2 in advancedIRLight.Value)
{
int num2 = (int)_advancedLasersCurrentEmmitterIndex.GetValue(advancedIRLight.Key);
_advancedLasersCurrentEmmitterIndex.SetValue(advancedIRLight.Key, item2);
advancedIRLight.Key.ToggleRight();
_advancedLasersCurrentEmmitterIndex.SetValue(advancedIRLight.Key, num2);
}
}
return;
}
}
foreach (TacticalFlashlight flashlight2 in _flashlights)
{
if (flashlight2.IsOn)
{
flashlight2.ToggleOn();
}
}
foreach (KeyValuePair<AdvancedLaserController, List<int>> advancedLight2 in _advancedLights)
{
foreach (int item3 in advancedLight2.Value)
{
int num3 = (int)_advancedLasersCurrentEmmitterIndex.GetValue(advancedLight2.Key);
_advancedLasersCurrentEmmitterIndex.SetValue(advancedLight2.Key, item3);
advancedLight2.Key.ToggleLeft();
_advancedLasersCurrentEmmitterIndex.SetValue(advancedLight2.Key, num3);
}
}
foreach (KeyValuePair<AdvancedLaserController, List<int>> advancedIRLight2 in _advancedIRLights)
{
foreach (int item4 in advancedIRLight2.Valu