using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Diagnostics;
using System.IO;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OpenScripts2;
using OtherLoader;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.VR;
[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 cityrobo.Fallout4FatMan
{
[BepInPlugin("cityrobo.Fallout4FatMan", "Fallout4FatMan", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class Fallout4FatManPlugin : 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()
{
OtherLoader.RegisterDirectLoad(BasePath, "cityrobo.Fallout4FatMan", "", "", "cityrobo.fatman", "");
}
}
}
public class ProjectileExtractor : MonoBehaviour
{
public FVRFireArmRound Round;
public BallisticProjectile Projectile;
[ContextMenu("Extract")]
public void Extract()
{
if ((Object)(object)Round != (Object)null && (Object)(object)Projectile == (Object)null)
{
Projectile = Object.Instantiate<GameObject>(Round.BallisticProjectilePrefab).GetComponent<BallisticProjectile>();
}
if ((Object)(object)Projectile.ExtraDisplay != (Object)null)
{
Object.Instantiate<GameObject>(Projectile.ExtraDisplay);
}
foreach (Submunition submunition in Projectile.Submunitions)
{
foreach (GameObject prefab in submunition.Prefabs)
{
Object.Instantiate<GameObject>(prefab);
}
}
}
}
namespace CityroboHelperScripts
{
public class MagazineGizmos : MonoBehaviour
{
public float GizmoSize;
public void OnDrawGizmos()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0011: Unknown result type (might be due to invalid IL or missing references)
Gizmos.color = Color.yellow;
Gizmos.DrawSphere(((Component)this).transform.position, GizmoSize);
}
}
}
namespace Cityrobo
{
public class FatmanBoltHandle : FVRInteractiveObject
{
public enum BoltPos
{
ForwardLocked,
Forward,
ForwardToMid,
Locked,
LockedToRear,
Rear
}
[Header("Fatman Bolt Handle")]
public OpenBoltReceiver Fatman;
public float Speed_Forward;
public float Speed_Held;
public BoltPos CurPos;
public BoltPos LastPos;
public Transform Point_Bolt_Forward;
public Transform Point_Bolt_LockPoint;
public Transform Point_Bolt_Rear;
public Transform BoltClosedAngle;
public Transform BoltMaxAngle;
public Transform Needle;
public float NeedleOff;
public float NeedleOn;
public Axis NeedleAxis;
public float NeedleJerk = 10f;
public float NeedleSpeed = 360f;
public Transform Ejector;
public Axis EjectorAxis;
public float EjectorOff;
public float EjectorOn;
public float EjectorLerp;
public FireArmRoundClass MirvRoundClass = (FireArmRoundClass)53;
private float _currentNeedleRotation;
private float _currentNeedleTarget;
private Collider _ejectorCollider;
private float m_handZOffset;
private float m_boltZ_current;
private float m_boltZ_heldTarget;
private float m_boltZ_forward;
private float m_boltZ_lock;
private float m_boltZ_rear;
private bool m_isHandleLocked;
private float _maxAngle;
private float _currentAngle;
private static bool _harmonyPatchApplied = false;
private static readonly Dictionary<OpenBoltReceiver, FatmanBoltHandle> _existingFatmans = new Dictionary<OpenBoltReceiver, FatmanBoltHandle>();
public override void Awake()
{
//IL_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0027: Unknown result type (might be due to invalid IL or missing references)
//IL_002c: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_0045: 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_0073: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0089: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).Awake();
m_boltZ_current = ((Component)this).transform.localPosition.z;
m_boltZ_forward = Point_Bolt_Forward.localPosition.z;
m_boltZ_lock = Point_Bolt_LockPoint.localPosition.z;
m_boltZ_rear = Point_Bolt_Rear.localPosition.z;
_maxAngle = SignedAngleBetween(BoltClosedAngle.up, BoltMaxAngle.up, ((Component)this).transform.forward);
_existingFatmans.Add(Fatman, this);
Fatman.Bolt.m_doesFiringPinStrikeOnArrivalAtFore = false;
_currentNeedleRotation = NeedleOff;
_currentNeedleTarget = NeedleOff;
_ejectorCollider = ((Component)Ejector).GetComponent<Collider>();
((MonoBehaviour)this).StartCoroutine(NeedleCoroutine());
if (!Application.isEditor && !_harmonyPatchApplied)
{
_harmonyPatchApplied = true;
Harmony.CreateAndPatchAll(typeof(FatmanBoltHandle), (string)null);
}
}
public override void OnDestroy()
{
((FVRInteractiveObject)this).OnDestroy();
_existingFatmans.Remove(Fatman);
}
private IEnumerator NeedleCoroutine()
{
while (true)
{
float randomJerk = ((!m_isHandleLocked) ? 0f : Random.Range(0f - NeedleJerk, NeedleJerk));
float currentAngle = _currentNeedleRotation;
float needleTarget = Mathf.MoveTowards(currentAngle, _currentNeedleTarget + randomJerk, NeedleSpeed * Time.deltaTime);
((Component)Needle).transform.localRotation = Quaternion.Euler(OpenScripts2_BasePlugin.GetVectorFromAxis(NeedleAxis) * needleTarget);
_currentNeedleRotation = needleTarget;
yield return null;
}
}
public override void BeginInteraction(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_001f: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).BeginInteraction(hand);
m_handZOffset = ((Component)this).transform.InverseTransformPoint(((HandInput)(ref hand.Input)).Pos).z;
}
public override void UpdateInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).UpdateInteraction(hand);
}
public override void EndInteraction(FVRViveHand hand)
{
((FVRInteractiveObject)this).EndInteraction(hand);
}
public override void FVRUpdate()
{
//IL_004e: Unknown result type (might be due to invalid IL or missing references)
//IL_0054: Invalid comparison between Unknown and I4
//IL_009d: Unknown result type (might be due to invalid IL or missing references)
//IL_013a: 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_01e2: Unknown result type (might be due to invalid IL or missing references)
//IL_0194: Unknown result type (might be due to invalid IL or missing references)
//IL_019a: 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_01b8: Unknown result type (might be due to invalid IL or missing references)
((FVRInteractiveObject)this).FVRUpdate();
UpdateHandle();
float num = Mathf.InverseLerp(m_boltZ_forward, m_boltZ_rear, m_boltZ_current);
if (!m_isHandleLocked)
{
Fatman.Bolt.ChargingHandleHeld(num);
}
if ((int)Fatman.Bolt.CurPos == 2 && CurPos == BoltPos.ForwardLocked)
{
LockHandle();
Fatman.Bolt.ChargingHandleReleased();
Fatman.Bolt.m_doesFiringPinStrikeOnArrivalAtFore = true;
}
else if ((int)Fatman.Bolt.CurPos == 0 && CurPos == BoltPos.ForwardLocked)
{
UnlockHandle();
}
float num2 = Mathf.InverseLerp(Fatman.Bolt.m_boltZ_forward, Fatman.Bolt.m_boltZ_rear, Fatman.Bolt.m_boltZ_current);
float num3 = Mathf.InverseLerp(0f, EjectorLerp, num2);
float num4 = Mathf.Lerp(EjectorOff, EjectorOn, num3);
if (Fatman.Chamber.IsFull && Fatman.Chamber.GetRound().RoundClass != MirvRoundClass)
{
_ejectorCollider.enabled = false;
UnityEngineExtensions.ModifyLocalRotationAxisValue(Ejector, EjectorAxis, num4);
}
else if (Fatman.Chamber.IsFull && Fatman.Chamber.GetRound().RoundClass == MirvRoundClass)
{
_ejectorCollider.enabled = false;
UnityEngineExtensions.ModifyLocalRotationAxisValue(Ejector, EjectorAxis, EjectorOff);
}
else
{
_ejectorCollider.enabled = true;
UnityEngineExtensions.ModifyLocalRotationAxisValue(Ejector, EjectorAxis, num4);
}
}
public float GetBoltLerpBetweenLockAndFore()
{
return Mathf.InverseLerp(m_boltZ_lock, m_boltZ_forward, m_boltZ_current);
}
public float GetBoltLerpBetweenRearAndFore()
{
return Mathf.InverseLerp(m_boltZ_rear, m_boltZ_forward, m_boltZ_current);
}
public void LockHandle()
{
m_isHandleLocked = true;
_currentNeedleTarget = NeedleOn;
}
public void UnlockHandle()
{
m_isHandleLocked = false;
_currentNeedleTarget = NeedleOff;
}
private float SignedAngleBetween(Vector3 a, Vector3 b, 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_0009: 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_000b: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: Unknown result type (might be due to invalid IL or missing references)
float num = Vector3.Angle(a, b);
float num2 = Mathf.Sign(Vector3.Dot(n, Vector3.Cross(a, b)));
return num * num2;
}
public void UpdateHandle()
{
//IL_0046: 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_0061: 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_0071: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_0091: Unknown result type (might be due to invalid IL or missing references)
//IL_0099: 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_00a8: 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_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)
//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_01df: 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_01f3: Unknown result type (might be due to invalid IL or missing references)
//IL_010d: Unknown result type (might be due to invalid IL or missing references)
//IL_011d: Unknown result type (might be due to invalid IL or missing references)
//IL_0128: Unknown result type (might be due to invalid IL or missing references)
//IL_012d: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: Unknown result type (might be due to invalid IL or missing references)
//IL_013d: 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_0182: Unknown result type (might be due to invalid IL or missing references)
float boltZ_current = m_boltZ_current;
float boltZ_current2 = m_boltZ_current;
boltZ_current = Mathf.MoveTowards(boltZ_current, m_boltZ_forward, Speed_Forward * Time.deltaTime);
if (((FVRInteractiveObject)this).IsHeld && !m_isHandleLocked)
{
Vector3 closestValidPoint = ((FVRInteractiveObject)this).GetClosestValidPoint(Point_Bolt_Forward.position, Point_Bolt_Rear.position, ((HandInput)(ref base.m_hand.Input)).Pos + -((Component)this).transform.forward * m_handZOffset * ((Component)Fatman).transform.localScale.x);
m_boltZ_heldTarget = ((Component)Fatman).transform.InverseTransformPoint(closestValidPoint).z;
boltZ_current2 = m_boltZ_heldTarget;
boltZ_current = Mathf.MoveTowards(m_boltZ_current, boltZ_current2, Speed_Held * Time.deltaTime);
if (Mathf.Abs(m_boltZ_forward - m_boltZ_current) < 0.001f)
{
float num = SignedAngleBetween(BoltClosedAngle.up, Vector3.ProjectOnPlane(((HandInput)(ref base.m_hand.Input)).Pos - ((Component)this).transform.position, ((Component)this).transform.forward), ((Component)this).transform.forward);
_currentAngle = Mathf.Clamp(num, _maxAngle, 0f);
((Component)this).transform.localEulerAngles = new Vector3(0f, 0f, _currentAngle);
}
}
if (Mathf.Abs(boltZ_current - m_boltZ_current) > Mathf.Epsilon && _currentAngle <= _maxAngle)
{
m_boltZ_current = boltZ_current;
((Component)this).transform.localPosition = new Vector3(((Component)this).transform.localPosition.x, ((Component)this).transform.localPosition.y, m_boltZ_current);
}
BoltPos curPos = CurPos;
curPos = ((Mathf.Abs(m_boltZ_current - m_boltZ_forward) < 0.001f) ? ((!Mathf.Approximately(_currentAngle, 0f)) ? BoltPos.Forward : BoltPos.ForwardLocked) : ((Mathf.Abs(m_boltZ_current - m_boltZ_lock) < 0.001f) ? BoltPos.Locked : ((Mathf.Abs(m_boltZ_current - m_boltZ_rear) < 0.001f) ? BoltPos.Rear : ((!(m_boltZ_current > m_boltZ_lock)) ? BoltPos.LockedToRear : BoltPos.ForwardToMid))));
int curPos2 = (int)CurPos;
CurPos = (BoltPos)Mathf.Clamp((int)curPos, curPos2 - 1, curPos2 + 1);
if (CurPos == BoltPos.ForwardLocked && LastPos > BoltPos.ForwardLocked)
{
HandleEvent_Locked();
}
else if (CurPos == BoltPos.Forward && LastPos == BoltPos.ForwardLocked)
{
HandleEvent_Unlocked();
}
else if (CurPos == BoltPos.Forward && LastPos > BoltPos.Forward)
{
HandleEvent_ArriveAtFore();
}
else if (CurPos == BoltPos.Rear && LastPos != BoltPos.Rear)
{
HandleEvent_SmackRear();
}
LastPos = CurPos;
}
private void HandleEvent_Locked()
{
((FVRFireArm)Fatman).PlayAudioEvent((FirearmAudioEventType)13, 1f);
}
private void HandleEvent_Unlocked()
{
((FVRFireArm)Fatman).PlayAudioEvent((FirearmAudioEventType)12, 1f);
}
private void HandleEvent_ArriveAtFore()
{
((FVRFireArm)Fatman).PlayAudioEvent((FirearmAudioEventType)11, 1f);
}
private void HandleEvent_SmackRear()
{
((FVRFireArm)Fatman).PlayAudioEvent((FirearmAudioEventType)10, 1f);
}
[HarmonyPatch(typeof(OpenBoltReceiverBolt), "UpdateBolt")]
[HarmonyPostfix]
private static void OpenBoltReceiverBolt_UpdateBolt_Patch(OpenBoltReceiverBolt __instance)
{
//IL_001a: Unknown result type (might be due to invalid IL or missing references)
if (_existingFatmans.TryGetValue(__instance.Receiver, out var _))
{
if ((int)__instance.CurPos == 0)
{
__instance.Receiver.Chamber.IsAccessible = true;
}
else
{
__instance.Receiver.Chamber.IsAccessible = true;
}
}
}
[HarmonyPatch(typeof(OpenBoltReceiverBolt), "BoltEvent_EjectRound")]
[HarmonyPrefix]
private static bool OpenBoltReceiver_BoltEvent_EjectRound_Patch(OpenBoltReceiverBolt __instance)
{
if (_existingFatmans.TryGetValue(__instance.Receiver, out var _))
{
return false;
}
return true;
}
[HarmonyPatch(typeof(OpenBoltReceiver), "Fire")]
[HarmonyPostfix]
private static void OpenBoltReceiver_Fire_Patch(OpenBoltReceiver __instance, ref bool __result)
{
if (_existingFatmans.TryGetValue(__instance, out var _) && __result)
{
if (GM.CurrentPlayerBody.IsInfiniteAmmo)
{
__instance.Chamber.IsSpent = false;
__instance.Chamber.UpdateProxyDisplay();
}
else
{
__instance.EjectExtractedRound();
}
__instance.Bolt.m_doesFiringPinStrikeOnArrivalAtFore = false;
}
}
}
[ExecuteInEditMode]
public class HolographicText : MonoBehaviour
{
public Transform VirtualQuad;
public float Scale = 1f;
public bool SizeCompensation = true;
private Material _material;
private void Awake()
{
_material = ((Graphic)((Component)this).GetComponent<Text>()).material;
}
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);
_material.SetVector("_Offset", Vector4.op_Implicit(val));
_material.SetFloat("_Scale", Scale);
_material.SetFloat("_SizeCompensation", SizeCompensation ? 1f : 0f);
}
}
public class ScopeCamera : MonoBehaviour
{
public Material PostMaterial;
public GameObject Reticule;
public Camera ScopeCam;
public float Magnification = 5f;
public int Resolution = 512;
public float AngleBlurStrength = 0.5f;
public float CutoffSoftness = 0.05f;
public float AngularOccludeSensitivity = 0.5f;
public float ReticuleScale = 1f;
public bool MagnificationEnabledAtStart;
[Range(0f, 1f)]
public float LensSpaceDistortion = 0.075f;
[Range(0f, 5f)]
public float LensChromaticDistortion = 0.075f;
private Renderer m_renderer;
private MaterialPropertyBlock m_block;
private Vector3 m_reticuleSize = new Vector3(0.1f, 0.1f, 0.1f);
private RenderTexture m_mainTex;
private RenderTexture m_blurTex;
private bool m_magnifcationEnabled;
public bool MagnificationEnabled
{
get
{
return m_magnifcationEnabled;
}
set
{
if (m_magnifcationEnabled == value)
{
return;
}
m_magnifcationEnabled = value;
if (m_magnifcationEnabled)
{
if ((Object)(object)Reticule != (Object)null)
{
Reticule.SetActive(true);
}
}
else if ((Object)(object)Reticule != (Object)null)
{
Reticule.SetActive(false);
}
if (!m_magnifcationEnabled && (Object)(object)m_mainTex != (Object)null)
{
ClearToBlack(m_mainTex);
ClearToBlack(m_blurTex);
}
}
}
private void ClearToBlack(RenderTexture tex)
{
//IL_0016: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)tex != (Object)null)
{
RenderTexture.active = tex;
GL.Clear(false, true, Color.black);
RenderTexture.active = null;
}
}
private void OnEnable()
{
//IL_0013: Unknown result type (might be due to invalid IL or missing references)
//IL_0019: Expected O, but got Unknown
//IL_003a: Unknown result type (might be due to invalid IL or missing references)
//IL_0040: Unknown result type (might be due to invalid IL or missing references)
//IL_004a: Expected O, but got Unknown
//IL_0093: Unknown result type (might be due to invalid IL or missing references)
//IL_009d: Expected O, but got Unknown
//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)
RenderTexture val = new RenderTexture(Resolution, Resolution, 24, (RenderTextureFormat)9, (RenderTextureReadWrite)2);
((Texture)val).wrapMode = (TextureWrapMode)1;
m_mainTex = val;
m_blurTex = new RenderTexture(Resolution, Resolution, 0, m_mainTex.format, (RenderTextureReadWrite)2);
m_mainTex.Create();
m_blurTex.Create();
((Behaviour)ScopeCam).enabled = false;
ScopeCam.allowHDR = true;
ScopeCam.allowMSAA = false;
m_renderer = ((Component)this).GetComponent<Renderer>();
m_block = new MaterialPropertyBlock();
if ((Object)(object)Reticule != (Object)null)
{
m_reticuleSize = Reticule.transform.localScale;
}
MagnificationEnabled = MagnificationEnabledAtStart;
}
private void OnWillRenderObject()
{
//IL_002d: 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_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_0041: Unknown result type (might be due to invalid IL or missing references)
//IL_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_0049: 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_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_0079: Unknown result type (might be due to invalid IL or missing references)
//IL_007e: Unknown result type (might be due to invalid IL or missing references)
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_008c: Unknown result type (might be due to invalid IL or missing references)
//IL_009b: Unknown result type (might be due to invalid IL or missing references)
//IL_00ab: Unknown result type (might be due to invalid IL or missing references)
//IL_00b0: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00c3: 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_00de: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: Unknown result type (might be due to invalid IL or missing references)
//IL_00f3: Unknown result type (might be due to invalid IL or missing references)
//IL_00fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0101: Unknown result type (might be due to invalid IL or missing references)
//IL_0110: Unknown result type (might be due to invalid IL or missing references)
//IL_0120: Unknown result type (might be due to invalid IL or missing references)
//IL_0125: Unknown result type (might be due to invalid IL or missing references)
//IL_012e: Unknown result type (might be due to invalid IL or missing references)
//IL_0133: Unknown result type (might be due to invalid IL or missing references)
//IL_0138: 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_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)
//IL_014b: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_0151: Unknown result type (might be due to invalid IL or missing references)
//IL_0217: 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_022a: Unknown result type (might be due to invalid IL or missing references)
//IL_0234: 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_023e: Unknown result type (might be due to invalid IL or missing references)
//IL_0240: Unknown result type (might be due to invalid IL or missing references)
//IL_024c: Unknown result type (might be due to invalid IL or missing references)
//IL_0256: Unknown result type (might be due to invalid IL or missing references)
//IL_025b: Unknown result type (might be due to invalid IL or missing references)
//IL_0260: Unknown result type (might be due to invalid IL or missing references)
//IL_0262: 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_026f: Unknown result type (might be due to invalid IL or missing references)
//IL_0274: Unknown result type (might be due to invalid IL or missing references)
//IL_0276: Unknown result type (might be due to invalid IL or missing references)
//IL_027e: Unknown result type (might be due to invalid IL or missing references)
//IL_0283: Unknown result type (might be due to invalid IL or missing references)
//IL_0288: 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_02a4: Unknown result type (might be due to invalid IL or missing references)
//IL_02a9: Unknown result type (might be due to invalid IL or missing references)
//IL_01ea: 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_02c7: Unknown result type (might be due to invalid IL or missing references)
//IL_02bd: Unknown result type (might be due to invalid IL or missing references)
//IL_0360: Unknown result type (might be due to invalid IL or missing references)
//IL_0365: Unknown result type (might be due to invalid IL or missing references)
//IL_0367: Unknown result type (might be due to invalid IL or missing references)
//IL_036c: Unknown result type (might be due to invalid IL or missing references)
//IL_02ca: Unknown result type (might be due to invalid IL or missing references)
//IL_02cc: Unknown result type (might be due to invalid IL or missing references)
//IL_02d1: Unknown result type (might be due to invalid IL or missing references)
//IL_02d6: Unknown result type (might be due to invalid IL or missing references)
//IL_02d8: Unknown result type (might be due to invalid IL or missing references)
//IL_02dd: Unknown result type (might be due to invalid IL or missing references)
//IL_02e2: 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_02f1: Unknown result type (might be due to invalid IL or missing references)
//IL_02f6: Unknown result type (might be due to invalid IL or missing references)
//IL_02fc: Unknown result type (might be due to invalid IL or missing references)
//IL_0301: Unknown result type (might be due to invalid IL or missing references)
//IL_0306: Unknown result type (might be due to invalid IL or missing references)
//IL_030a: Unknown result type (might be due to invalid IL or missing references)
//IL_030c: Unknown result type (might be due to invalid IL or missing references)
//IL_031b: Unknown result type (might be due to invalid IL or missing references)
//IL_0322: Unknown result type (might be due to invalid IL or missing references)
//IL_0324: Unknown result type (might be due to invalid IL or missing references)
//IL_0329: Unknown result type (might be due to invalid IL or missing references)
//IL_032e: Unknown result type (might be due to invalid IL or missing references)
//IL_0333: Unknown result type (might be due to invalid IL or missing references)
//IL_0340: Unknown result type (might be due to invalid IL or missing references)
//IL_04e2: Unknown result type (might be due to invalid IL or missing references)
//IL_04e7: Unknown result type (might be due to invalid IL or missing references)
//IL_0502: Unknown result type (might be due to invalid IL or missing references)
//IL_0507: Unknown result type (might be due to invalid IL or missing references)
//IL_0522: Unknown result type (might be due to invalid IL or missing references)
//IL_0527: Unknown result type (might be due to invalid IL or missing references)
//IL_0540: Unknown result type (might be due to invalid IL or missing references)
//IL_054b: Unknown result type (might be due to invalid IL or missing references)
//IL_0550: Unknown result type (might be due to invalid IL or missing references)
//IL_0555: Unknown result type (might be due to invalid IL or missing references)
//IL_03f8: Unknown result type (might be due to invalid IL or missing references)
//IL_03fa: Unknown result type (might be due to invalid IL or missing references)
//IL_0415: Unknown result type (might be due to invalid IL or missing references)
//IL_0435: Unknown result type (might be due to invalid IL or missing references)
//IL_043a: Unknown result type (might be due to invalid IL or missing references)
//IL_044f: Unknown result type (might be due to invalid IL or missing references)
//IL_045a: Unknown result type (might be due to invalid IL or missing references)
//IL_0464: Unknown result type (might be due to invalid IL or missing references)
//IL_0469: Unknown result type (might be due to invalid IL or missing references)
//IL_0495: Unknown result type (might be due to invalid IL or missing references)
//IL_04a0: Unknown result type (might be due to invalid IL or missing references)
//IL_04aa: Unknown result type (might be due to invalid IL or missing references)
//IL_04af: Unknown result type (might be due to invalid IL or missing references)
//IL_03bd: Unknown result type (might be due to invalid IL or missing references)
//IL_03c8: Unknown result type (might be due to invalid IL or missing references)
//IL_03d2: Unknown result type (might be due to invalid IL or missing references)
//IL_03d7: Unknown result type (might be due to invalid IL or missing references)
if ((Object)(object)Camera.current == (Object)(object)ScopeCam || !MagnificationEnabled)
{
return;
}
Bounds bounds = m_renderer.bounds;
Vector3 min = ((Bounds)(ref bounds)).min;
Bounds bounds2 = m_renderer.bounds;
Vector3 max = ((Bounds)(ref bounds2)).max;
min = ((Component)m_renderer).transform.position - ((Component)Camera.current).transform.right * ((Component)m_renderer).transform.localScale.x - ((Component)Camera.current).transform.up * ((Component)m_renderer).transform.localScale.x;
max = ((Component)m_renderer).transform.position + ((Component)Camera.current).transform.right * ((Component)m_renderer).transform.localScale.x + ((Component)Camera.current).transform.up * ((Component)m_renderer).transform.localScale.x;
Vector3 val = Camera.current.WorldToViewportPoint(min);
Vector3 val2 = Camera.current.WorldToViewportPoint(max);
float num = Mathf.Abs(Mathf.Clamp01(val2.x) - Mathf.Clamp01(val.x));
float num2 = Mathf.Abs(Mathf.Clamp01(val2.y) - Mathf.Clamp01(val.y));
float num3 = Mathf.Sqrt(num * num + num2 * num2);
ScopeCam.fieldOfView = Camera.current.fieldOfView * num3 / (Magnification * (float)Math.PI * 0.5f);
Vector3 val3;
if (!Camera.current.stereoEnabled)
{
val3 = ((Component)Camera.current).transform.position;
m_block.SetFloat("_EyeIndex", 0f);
}
else
{
Vector3 position = GM.CurrentPlayerBody.Head.position;
Vector3 val4 = position + GM.CurrentPlayerBody.Head.right * -0.022f;
Vector3 val5 = position + GM.CurrentPlayerBody.Head.right * 0.022f;
Vector3 val6 = val4 - ((Component)this).transform.position;
Vector3 val7 = val5 - ((Component)this).transform.position;
float num4 = Vector3.Angle(((Component)this).transform.forward, val6);
float num5 = Vector3.Angle(((Component)this).transform.forward, val7);
VRNode val8 = ((!(num5 < num4)) ? ((VRNode)1) : ((VRNode)0));
val3 = Quaternion.Inverse(InputTracking.GetLocalRotation(val8)) * InputTracking.GetLocalPosition(val8);
Matrix4x4 cameraToWorldMatrix = Camera.current.cameraToWorldMatrix;
Vector3 val9 = Quaternion.Inverse(InputTracking.GetLocalRotation((VRNode)3)) * InputTracking.GetLocalPosition((VRNode)3);
val3 = ((Matrix4x4)(ref cameraToWorldMatrix)).MultiplyPoint(val3) + (((Component)Camera.current).transform.position - ((Matrix4x4)(ref cameraToWorldMatrix)).MultiplyPoint(val9));
m_block.SetFloat("_EyeIndex", (float)(((int)val8 != 0) ? 1 : 0));
}
Vector3 val10 = ((Component)ScopeCam).transform.position - val3;
if (((Vector3)(ref val10)).magnitude >= Mathf.Epsilon)
{
ScopeCam.targetTexture = m_mainTex;
if ((Object)(object)Reticule != (Object)null)
{
Transform transform = Reticule.transform;
transform.position = ((Component)ScopeCam).transform.position + ((Component)this).transform.forward * 0.1f;
}
ScopeCam.Render();
PostMaterial.SetVector("_CamPos", Vector4.op_Implicit(val3));
PostMaterial.SetMatrix("_ScopeVisualToWorld", ((Component)this).transform.localToWorldMatrix);
PostMaterial.SetVector("_Forward", Vector4.op_Implicit(((Component)ScopeCam).transform.forward));
PostMaterial.SetVector("_Offset", Vector4.op_Implicit(Vector2.right * AngleBlurStrength * 0.01f));
Graphics.Blit((Texture)(object)m_mainTex, m_blurTex, PostMaterial);
PostMaterial.SetVector("_Offset", Vector4.op_Implicit(Vector2.up * AngleBlurStrength * 0.01f));
Graphics.Blit((Texture)(object)m_blurTex, m_mainTex, PostMaterial);
}
m_block.SetVector("_TubeCenter", Vector4.op_Implicit(((Component)this).transform.position));
m_block.SetVector("_TubeForward", Vector4.op_Implicit(((Component)this).transform.forward));
m_block.SetFloat("_TubeRadius", ((Component)this).transform.localScale.x);
Vector3 val11 = ((Component)ScopeCam).transform.position - ((Component)this).transform.position;
float magnitude = ((Vector3)(ref val11)).magnitude;
magnitude *= Mathf.Lerp(1f, Magnification, AngularOccludeSensitivity);
m_block.SetFloat("_TubeLength", magnitude);
m_block.SetFloat("_CutoffSoftness", CutoffSoftness);
m_block.SetFloat("_LensDistortion", 1f - LensSpaceDistortion);
m_block.SetFloat("_Chroma", LensChromaticDistortion);
m_block.SetTexture("_MainTex", (Texture)(object)m_mainTex);
m_renderer.SetPropertyBlock(m_block);
}
public void PointTowards(Vector3 p)
{
//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_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_0018: 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)
//IL_0029: 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_003c: 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)
Vector3 val = p - ((Component)ScopeCam).transform.position;
val = Vector3.ProjectOnPlane(val, ((Component)this).transform.right);
((Component)ScopeCam).transform.rotation = Quaternion.LookRotation(val, ((Component)this).transform.up);
}
private void RenderScopeTex(VRNode node, RenderTexture tex)
{
//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_0007: Unknown result type (might be due to invalid IL or missing references)
//IL_000c: 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_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_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_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_002f: 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)
//IL_0039: Unknown result type (might be due to invalid IL or missing references)
//IL_003c: 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_004c: Unknown result type (might be due to invalid IL or missing references)
//IL_0053: 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_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_0063: Unknown result type (might be due to invalid IL or missing references)
//IL_006f: Unknown result type (might be due to invalid IL or missing references)
//IL_0074: Unknown result type (might be due to invalid IL or missing references)
//IL_0075: Unknown result type (might be due to invalid IL or missing references)
//IL_007a: 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)
//IL_009f: Unknown result type (might be due to invalid IL or missing references)
//IL_00a4: 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_0130: Unknown result type (might be due to invalid IL or missing references)
//IL_0131: Unknown result type (might be due to invalid IL or missing references)
//IL_014c: Unknown result type (might be due to invalid IL or missing references)
//IL_016c: Unknown result type (might be due to invalid IL or missing references)
//IL_0171: Unknown result type (might be due to invalid IL or missing references)
//IL_0186: Unknown result type (might be due to invalid IL or missing references)
//IL_0191: Unknown result type (might be due to invalid IL or missing references)
//IL_019b: Unknown result type (might be due to invalid IL or missing references)
//IL_01a0: 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_01d2: Unknown result type (might be due to invalid IL or missing references)
//IL_01dc: Unknown result type (might be due to invalid IL or missing references)
//IL_01e1: Unknown result type (might be due to invalid IL or missing references)
//IL_00e3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ee: 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_010f: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = Quaternion.Inverse(InputTracking.GetLocalRotation(node)) * InputTracking.GetLocalPosition(node);
Matrix4x4 cameraToWorldMatrix = Camera.current.cameraToWorldMatrix;
Vector3 val2 = Quaternion.Inverse(InputTracking.GetLocalRotation((VRNode)3)) * InputTracking.GetLocalPosition((VRNode)3);
val = ((Matrix4x4)(ref cameraToWorldMatrix)).MultiplyPoint(val) + (((Component)Camera.current).transform.position - ((Matrix4x4)(ref cameraToWorldMatrix)).MultiplyPoint(val2));
Vector3 val3 = ((Component)ScopeCam).transform.position - val;
if (!(((Vector3)(ref val3)).magnitude < Mathf.Epsilon))
{
Quaternion val4 = Quaternion.LookRotation(((Vector3)(ref val3)).normalized, ((Component)this).transform.up);
ScopeCam.targetTexture = tex;
if ((Object)(object)Reticule != (Object)null)
{
Transform transform = Reticule.transform;
transform.position = ((Component)ScopeCam).transform.position + ((Component)this).transform.forward * 0.1f;
transform.rotation = ((Component)this).transform.rotation;
}
ScopeCam.Render();
PostMaterial.SetVector("_CamPos", Vector4.op_Implicit(val));
PostMaterial.SetMatrix("_ScopeVisualToWorld", ((Component)this).transform.localToWorldMatrix);
PostMaterial.SetVector("_Forward", Vector4.op_Implicit(((Component)ScopeCam).transform.forward));
PostMaterial.SetVector("_Offset", Vector4.op_Implicit(Vector2.right * AngleBlurStrength * 0.01f));
Graphics.Blit((Texture)(object)tex, m_blurTex, PostMaterial);
PostMaterial.SetVector("_Offset", Vector4.op_Implicit(Vector2.up * AngleBlurStrength * 0.01f));
Graphics.Blit((Texture)(object)m_blurTex, tex, PostMaterial);
}
}
private void OnDisable()
{
Object.DestroyImmediate((Object)(object)m_mainTex);
Object.DestroyImmediate((Object)(object)m_blurTex);
}
}
}