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 BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
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]
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class DeferredNightVisionEffect : MonoBehaviour
{
[SerializeField]
[Tooltip("The main color of the NV effect")]
public Color m_NVColor = new Color(0f, 1f, 0.1724138f, 0f);
[SerializeField]
[Tooltip("The color that the NV effect will 'bleach' towards (white = default)")]
public Color m_TargetBleachColor = new Color(1f, 1f, 1f, 0f);
[Range(0f, 0.1f)]
[Tooltip("How much base lighting does the NV effect pick up")]
public float m_baseLightingContribution = 0.025f;
[Range(0f, 128f)]
[Tooltip("The higher this value, the more bright areas will get 'bleached out'")]
public float m_LightSensitivityMultiplier = 100f;
private Material m_Material;
private Shader m_Shader;
[Tooltip("Do we want to apply a vignette to the edges of the screen?")]
public bool useVignetting = true;
public Shader NightVisionShader => m_Shader;
private void DestroyMaterial(Material mat)
{
if (Object.op_Implicit((Object)(object)mat))
{
Object.DestroyImmediate((Object)(object)mat);
mat = null;
}
}
private void CreateMaterials()
{
if ((Object)(object)m_Shader == (Object)null)
{
m_Shader = Shader.Find("Custom/DeferredNightVisionShader");
}
if ((Object)(object)m_Material == (Object)null && (Object)(object)m_Shader != (Object)null && m_Shader.isSupported)
{
m_Material = CreateMaterial(m_Shader);
}
}
private Material CreateMaterial(Shader shader)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
if (!Object.op_Implicit((Object)(object)shader))
{
return null;
}
Material val = new Material(shader);
((Object)val).hideFlags = (HideFlags)61;
return val;
}
private void OnDisable()
{
DestroyMaterial(m_Material);
m_Material = null;
m_Shader = null;
}
[ContextMenu("UpdateShaderValues")]
public void UpdateShaderValues()
{
//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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)m_Material == (Object)null))
{
m_Material.SetVector("_NVColor", Color.op_Implicit(m_NVColor));
m_Material.SetVector("_TargetWhiteColor", Color.op_Implicit(m_TargetBleachColor));
m_Material.SetFloat("_BaseLightingContribution", m_baseLightingContribution);
m_Material.SetFloat("_LightSensitivityMultiplier", m_LightSensitivityMultiplier);
m_Material.shaderKeywords = null;
if (useVignetting)
{
Shader.EnableKeyword("USE_VIGNETTE");
}
else
{
Shader.DisableKeyword("USE_VIGNETTE");
}
}
}
private void OnEnable()
{
CreateMaterials();
UpdateShaderValues();
}
public void ReloadShaders()
{
OnDisable();
}
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
UpdateShaderValues();
CreateMaterials();
Graphics.Blit((Texture)(object)source, destination, m_Material);
}
}
namespace NGA
{
[ExecuteInEditMode]
[RequireComponent(typeof(Camera))]
public class DeferredNightVisionEffect2 : MonoBehaviour
{
[SerializeField]
[Tooltip("The main color of the NV effect")]
public Color m_NVColor = new Color(0f, 1f, 0.1724138f, 0f);
[SerializeField]
[Tooltip("The color that the NV effect will 'bleach' towards (white = default)")]
public Color m_TargetBleachColor = new Color(1f, 1f, 1f, 0f);
[Range(0f, 0.1f)]
[Tooltip("How much base lighting does the NV effect pick up")]
public float m_baseLightingContribution = 0.025f;
[Range(0f, 128f)]
[Tooltip("The higher this value, the more bright areas will get 'bleached out'")]
public float m_LightSensitivityMultiplier = 100f;
private Material m_Material;
private Shader m_Shader;
[Tooltip("Do we want to apply a vignette to the edges of the screen?")]
public bool useVignetting = true;
public Shader NightVisionShader => m_Shader;
private void DestroyMaterial(Material mat)
{
if (Object.op_Implicit((Object)(object)mat))
{
Object.DestroyImmediate((Object)(object)mat);
mat = null;
}
}
private void CreateMaterials()
{
if ((Object)(object)m_Shader == (Object)null)
{
m_Shader = Shader.Find("Custom/DeferredNightVisionShader");
}
if ((Object)(object)m_Material == (Object)null && (Object)(object)m_Shader != (Object)null && m_Shader.isSupported)
{
m_Material = CreateMaterial(m_Shader);
}
}
private Material CreateMaterial(Shader shader)
{
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_001a: Expected O, but got Unknown
if (!Object.op_Implicit((Object)(object)shader))
{
return null;
}
Material val = new Material(shader);
((Object)val).hideFlags = (HideFlags)61;
return val;
}
private void OnDisable()
{
DestroyMaterial(m_Material);
m_Material = null;
m_Shader = null;
}
[ContextMenu("UpdateShaderValues")]
public void UpdateShaderValues()
{
//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_003e: Unknown result type (might be due to invalid IL or missing references)
//IL_0043: Unknown result type (might be due to invalid IL or missing references)
if (!((Object)(object)m_Material == (Object)null))
{
m_Material.SetVector("_NVColor", Color.op_Implicit(m_NVColor));
m_Material.SetVector("_TargetWhiteColor", Color.op_Implicit(m_TargetBleachColor));
m_Material.SetFloat("_BaseLightingContribution", m_baseLightingContribution);
m_Material.SetFloat("_LightSensitivityMultiplier", m_LightSensitivityMultiplier);
m_Material.shaderKeywords = null;
if (useVignetting)
{
Shader.EnableKeyword("USE_VIGNETTE");
}
else
{
Shader.DisableKeyword("USE_VIGNETTE");
}
}
}
private void OnEnable()
{
CreateMaterials();
UpdateShaderValues();
}
public void ReloadShaders()
{
OnDisable();
}
private void OnRenderImage(RenderTexture source, RenderTexture destination)
{
UpdateShaderValues();
CreateMaterials();
Graphics.Blit((Texture)(object)source, destination, m_Material);
}
}
}
namespace NGA.IVAS
{
[BepInPlugin("NGA.IVAS", "IVAS", "0.1.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class IVASPlugin : 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(), "NGA.IVAS");
OtherLoader.RegisterDirectLoad(BasePath, "NGA.IVAS", "cityrobo-OpenScripts2-2.6.1", "", "ivas,ivasattc", "");
}
}
}
namespace NGA
{
public class HeadTracked : MonoBehaviour
{
public bool isTriggerPressed = false;
public Transform marriedObj = null;
public FVRPhysicalObject ThisObj = null;
public void FixedUpdate()
{
//IL_006b: 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)
if ((Object)(object)marriedObj == (Object)null)
{
FVRPlayerBody val = Object.FindObjectOfType<FVRPlayerBody>();
if (Object.op_Implicit((Object)(object)val) && Object.op_Implicit((Object)(object)val.Head))
{
marriedObj = val.Head;
}
}
if ((Object)(object)marriedObj != (Object)null)
{
((Component)ThisObj).transform.position = ((Component)marriedObj).transform.position;
((Component)ThisObj).transform.rotation = ((Component)marriedObj).transform.rotation;
}
}
private void OnTriggerStay(Collider other)
{
FVRViveHand component = ((Component)other).GetComponent<FVRViveHand>();
if ((Object)(object)component != (Object)null && component.Input.TriggerDown && !isTriggerPressed)
{
isTriggerPressed = true;
Transform val = ((Component)this).transform.Find("Geo");
if ((Object)(object)val != (Object)null)
{
((Component)val).gameObject.SetActive(!((Component)val).gameObject.activeSelf);
}
}
}
private void OnTriggerExit(Collider other)
{
FVRViveHand component = ((Component)other).GetComponent<FVRViveHand>();
if ((Object)(object)component != (Object)null)
{
Debug.Log((object)("Exited trigger zone with FVRViveHand: " + ((Object)component).name));
isTriggerPressed = false;
}
}
}
public class InputManipulator : FVRFireArmAttachmentInterface
{
public enum EDegreesOfFreedom
{
Linear,
Planar,
Spacial
}
[Serializable]
public class MovementMode
{
public string ModeText;
public EDegreesOfFreedom DegreesOfFreedom;
public Axis LimitingAxis;
}
[Header("Moving FireArm Attachment Interface Config")]
[Tooltip("One degree means linear movement, two degrees means movement on a plane, three degrees free spacial movement.")]
public EDegreesOfFreedom DegreesOfFreedom;
public Axis LimitingAxis;
public Vector2 XLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);
public Vector2 YLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);
public Vector2 ZLimits = new Vector2(float.NegativeInfinity, float.PositiveInfinity);
public bool OverridesDisableOnHoverOfMount;
[Tooltip("Something placed on this mount will disabled the hover on disable piece again.")]
public FVRFireArmAttachmentMount OverrideDisableOverrideMount;
[Tooltip("This transforms position will be vaulted as well")]
public Transform SecondaryPiece;
public bool CanRotate;
public float RotationStep = 45f;
public bool CanSwitchModes;
public Text ModeDisplay;
public MovementMode[] MovementModes;
private int _currentMode;
private Vector3 _lastPos;
private Vector3 _lastHandPos;
private Vector3 _startPos;
private Vector3 _lowerLimit;
private Vector3 _upperLimit;
[HideInInspector]
public GameObject DisableOnHover;
[HideInInspector]
public GameObject EnableOnHover;
public const string POSITION_FLAGDIC_KEY = "MovingFireArmAttachmentInterface Position";
public const string ROTATION_FLAGDIC_KEY = "MovingFireArmAttachmentInterface Rotation";
public const string SECONDARY_POSITION_FLAGDIC_KEY = "MovingFireArmAttachmentInterface Secondary Position";
public InputManipulator()
{
//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_0020: 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_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_0053: Unknown result type (might be due to invalid IL or missing references)
//IL_0059: Expected O, but got Unknown
//IL_0066: Unknown result type (might be due to invalid IL or missing references)
//IL_006d: Unknown result type (might be due to invalid IL or missing references)
//IL_0076: Unknown result type (might be due to invalid IL or missing references)
//IL_007c: Expected O, but got Unknown
//IL_0089: 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_0099: Unknown result type (might be due to invalid IL or missing references)
//IL_009f: Expected O, but got Unknown
//IL_00ac: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00bc: Unknown result type (might be due to invalid IL or missing references)
//IL_00c2: Expected O, but got Unknown
//IL_00cf: 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)
MovementMode[] array = new MovementMode[4];
MovementMode val = new MovementMode();
val.ModeText = "All";
val.DegreesOfFreedom = (EDegreesOfFreedom)2;
val.LimitingAxis = (Axis)0;
array[0] = val;
val = new MovementMode();
val.ModeText = "X Limited";
val.DegreesOfFreedom = (EDegreesOfFreedom)1;
val.LimitingAxis = (Axis)0;
array[1] = val;
val = new MovementMode();
val.ModeText = "Y Limited";
val.DegreesOfFreedom = (EDegreesOfFreedom)1;
val.LimitingAxis = (Axis)1;
array[2] = val;
val = new MovementMode();
val.ModeText = "Z Limited";
val.DegreesOfFreedom = (EDegreesOfFreedom)1;
val.LimitingAxis = (Axis)2;
array[3] = val;
MovementModes = (MovementMode[])(object)array;
((FVRFireArmAttachmentInterface)this)..ctor();
}
public override void Awake()
{
//IL_0029: 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_0055: 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_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).Awake();
_lowerLimit = new Vector3(XLimits.x, YLimits.x, ZLimits.x);
_upperLimit = new Vector3(XLimits.y, YLimits.y, ZLimits.y);
_startPos = ((Component)((AnvilAsset)((FVRPhysicalObject)base.Attachment).ObjectWrapper).GetGameObject().GetComponent<FVRFireArmAttachment>().AttachmentInterface).transform.localPosition;
if ((Object)(object)ModeDisplay != (Object)null)
{
ModeDisplay.text = MovementModes[_currentMode].ModeText;
}
}
public override void OnAttach()
{
((FVRFireArmAttachmentInterface)this).OnAttach();
if (OverridesDisableOnHoverOfMount && base.Attachment.curMount.HasHoverDisablePiece)
{
FVRPhysicalObject myObject = base.Attachment.curMount.MyObject;
CustomOpenScripts2Attachment val = (CustomOpenScripts2Attachment)(object)((myObject is CustomOpenScripts2Attachment) ? myObject : null);
if ((Object)(object)val != (Object)null)
{
FVRFireArmAttachmentInterface attachmentInterface = ((FVRFireArmAttachment)val).AttachmentInterface;
MovingFireArmAttachmentInterface val2 = (MovingFireArmAttachmentInterface)(object)((attachmentInterface is MovingFireArmAttachmentInterface) ? attachmentInterface : null);
if ((Object)(object)val2 != (Object)null)
{
DisableOnHover = val2.DisableOnHover;
val2.DisableOnHover = null;
GameObject disableOnHover = DisableOnHover;
if (!((Object)(object)disableOnHover == (Object)null))
{
disableOnHover.SetActive(true);
}
goto IL_00e1;
}
}
DisableOnHover = base.Attachment.curMount.DisableOnHover;
base.Attachment.curMount.DisableOnHover = null;
GameObject disableOnHover2 = DisableOnHover;
if ((Object)(object)disableOnHover2 != (Object)null)
{
disableOnHover2.SetActive(true);
}
}
goto IL_00e1;
IL_00e1:
if (!OverridesDisableOnHoverOfMount || !base.Attachment.curMount.HasHoverEnablePiece)
{
return;
}
FVRPhysicalObject myObject2 = base.Attachment.curMount.MyObject;
CustomOpenScripts2Attachment val3 = (CustomOpenScripts2Attachment)(object)((myObject2 is CustomOpenScripts2Attachment) ? myObject2 : null);
if ((Object)(object)val3 != (Object)null)
{
FVRFireArmAttachmentInterface attachmentInterface2 = ((FVRFireArmAttachment)val3).AttachmentInterface;
MovingFireArmAttachmentInterface val4 = (MovingFireArmAttachmentInterface)(object)((attachmentInterface2 is MovingFireArmAttachmentInterface) ? attachmentInterface2 : null);
if ((Object)(object)val4 != (Object)null)
{
EnableOnHover = val4.EnableOnHover;
val4.EnableOnHover = null;
GameObject enableOnHover = EnableOnHover;
if (!((Object)(object)enableOnHover == (Object)null))
{
enableOnHover.SetActive(false);
}
return;
}
}
EnableOnHover = base.Attachment.curMount.EnableOnHover;
base.Attachment.curMount.EnableOnHover = null;
GameObject enableOnHover2 = EnableOnHover;
if (!((Object)(object)enableOnHover2 == (Object)null))
{
enableOnHover2.SetActive(false);
}
}
public override void OnDetach()
{
FVRPhysicalObject myObject = base.Attachment.curMount.MyObject;
CustomOpenScripts2Attachment val = (CustomOpenScripts2Attachment)(object)((myObject is CustomOpenScripts2Attachment) ? myObject : null);
if ((Object)(object)val != (Object)null)
{
FVRFireArmAttachmentInterface attachmentInterface = ((FVRFireArmAttachment)val).AttachmentInterface;
MovingFireArmAttachmentInterface val2 = (MovingFireArmAttachmentInterface)(object)((attachmentInterface is MovingFireArmAttachmentInterface) ? attachmentInterface : null);
if ((Object)(object)val2 != (Object)null)
{
val2.DisableOnHover = DisableOnHover;
val2.EnableOnHover = EnableOnHover;
goto IL_0087;
}
}
base.Attachment.curMount.DisableOnHover = DisableOnHover;
base.Attachment.curMount.EnableOnHover = EnableOnHover;
goto IL_0087;
IL_0087:
DisableOnHover = null;
EnableOnHover = null;
((FVRFireArmAttachmentInterface)this).OnDetach();
}
public override void FVRUpdate()
{
((FVRInteractiveObject)this).FVRUpdate();
if (!OverridesDisableOnHoverOfMount || !((Object)(object)OverrideDisableOverrideMount != (Object)null))
{
return;
}
if (OverrideDisableOverrideMount.HasAttachmentsOnIt())
{
GameObject disableOnHover = DisableOnHover;
if ((Object)(object)disableOnHover != (Object)null)
{
disableOnHover.SetActive(false);
}
}
else
{
GameObject disableOnHover2 = DisableOnHover;
if ((Object)(object)disableOnHover2 != (Object)null)
{
disableOnHover2.SetActive(true);
}
}
if (OverrideDisableOverrideMount.HasAttachmentsOnIt())
{
GameObject enableOnHover = EnableOnHover;
if (!((Object)(object)enableOnHover == (Object)null))
{
enableOnHover.SetActive(true);
}
}
else
{
GameObject enableOnHover2 = EnableOnHover;
if (!((Object)(object)enableOnHover2 == (Object)null))
{
enableOnHover2.SetActive(false);
}
}
}
public override void BeginInteraction(FVRViveHand hand)
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: Unknown result type (might be due to invalid IL or missing references)
//IL_0020: 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)
((FVRInteractiveObject)this).BeginInteraction(hand);
_lastPos = ((Component)this).transform.position;
_lastHandPos = hand.Input.FilteredPos;
}
public override void UpdateInteraction(FVRViveHand hand)
{
//IL_0008: 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_0011: 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_002a: Invalid comparison between Unknown and I4
//IL_0038: Unknown result type (might be due to invalid IL or missing references)
//IL_003e: Invalid comparison between Unknown and I4
//IL_011b: 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_0072: 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_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_0093: 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_00ae: Unknown result type (might be due to invalid IL or missing references)
//IL_00b3: Unknown result type (might be due to invalid IL or missing references)
//IL_00ba: Unknown result type (might be due to invalid IL or missing references)
//IL_00bf: Unknown result type (might be due to invalid IL or missing references)
//IL_00c0: Unknown result type (might be due to invalid IL or missing references)
//IL_00c5: 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_00cb: 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)
//IL_00d2: Unknown result type (might be due to invalid IL or missing references)
//IL_00d4: Unknown result type (might be due to invalid IL or missing references)
//IL_0132: Unknown result type (might be due to invalid IL or missing references)
//IL_00f1: Unknown result type (might be due to invalid IL or missing references)
//IL_00db: Unknown result type (might be due to invalid IL or missing references)
//IL_00de: Invalid comparison between Unknown and I4
//IL_014e: Unknown result type (might be due to invalid IL or missing references)
//IL_020d: Unknown result type (might be due to invalid IL or missing references)
//IL_0212: 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_00fd: 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_00e6: Invalid comparison between Unknown and I4
//IL_019c: 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_0179: Unknown result type (might be due to invalid IL or missing references)
//IL_0180: Unknown result type (might be due to invalid IL or missing references)
//IL_0109: 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_01b1: 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_01c8: Unknown result type (might be due to invalid IL or missing references)
//IL_01d3: Unknown result type (might be due to invalid IL or missing references)
((FVRFireArmAttachmentInterface)this).UpdateInteraction(hand);
Vector3 zero = Vector3.zero;
((Vector3)(ref zero))..ctor((float)(((int)LimitingAxis == 0) ? 1 : 0), (float)(((int)LimitingAxis == 1) ? 1 : 0), (float)(((int)LimitingAxis == 2) ? 1 : 0));
if (hand.Input.TriggerFloat > 0f)
{
Vector3 val = (hand.Input.FilteredPos - _lastHandPos) * hand.Input.TriggerFloat;
Vector3 val2 = (((Component)this).transform.position - _lastPos) * hand.Input.TriggerFloat;
Vector3 newPosRaw = ((Component)this).transform.position + val - val2;
EDegreesOfFreedom degreesOfFreedom = DegreesOfFreedom;
if ((int)degreesOfFreedom != 0)
{
if ((int)degreesOfFreedom != 1)
{
if ((int)degreesOfFreedom == 2)
{
ThreeDegreesOfFreedom(newPosRaw);
}
}
else
{
TwoDegreesOfFreedom(newPosRaw);
}
}
else
{
OneDegreeOfFreedom(newPosRaw);
}
}
else if (OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.up))
{
((Component)this).transform.localPosition = _startPos;
}
else if (CanRotate && OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.left))
{
Console.WriteLine("Rotation Axis: " + zero);
((Component)this).transform.Rotate(zero * RotationStep);
}
else if (CanRotate && OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.right))
{
Console.WriteLine("Rotation Axis: " + zero);
((Component)this).transform.Rotate(-zero * RotationStep);
}
else if (CanSwitchModes && OpenScripts2_BasePlugin.TouchpadDirDown(hand, Vector2.down))
{
SwitchMode();
}
_lastPos = ((Component)this).transform.position;
_lastHandPos = hand.Input.FilteredPos;
}
private void OneDegreeOfFreedom(Vector3 newPosRaw)
{
//IL_0087: Unknown result type (might be due to invalid IL or missing references)
//IL_0088: Unknown result type (might be due to invalid IL or missing references)
//IL_008e: Unknown result type (might be due to invalid IL or missing references)
//IL_0093: 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_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_000e: Unknown result type (might be due to invalid IL or missing references)
//IL_0014: 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_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_0035: 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_0046: Unknown result type (might be due to invalid IL or missing references)
//IL_004b: Unknown result type (might be due to invalid IL or missing references)
//IL_0055: 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_005c: Unknown result type (might be due to invalid IL or missing references)
//IL_005d: Unknown result type (might be due to invalid IL or missing references)
//IL_0069: Unknown result type (might be due to invalid IL or missing references)
//IL_006a: Unknown result type (might be due to invalid IL or missing references)
//IL_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_00b1: Unknown result type (might be due to invalid IL or missing references)
Vector3 localPosition;
if (CanSwitchModes)
{
Vector3 val = UnityEngineExtensions.ApproximateInfiniteComponent(UnityEngineExtensions.GetCombinedAxisVector(_lowerLimit, LimitingAxis, ((Component)this).transform.localPosition), 100f);
Vector3 val2 = UnityEngineExtensions.ApproximateInfiniteComponent(UnityEngineExtensions.GetCombinedAxisVector(_upperLimit, LimitingAxis, ((Component)this).transform.localPosition), 100f);
localPosition = ((FVRInteractiveObject)this).GetClosestValidPoint(val, val2, ((Component)this).transform.parent.InverseTransformPoint(newPosRaw));
}
else
{
localPosition = UnityEngineExtensions.Clamp(UnityEngineExtensions.GetAxisVector(((Component)this).transform.parent.InverseTransformPoint(newPosRaw), LimitingAxis), _lowerLimit, _upperLimit);
}
((Component)this).transform.localPosition = localPosition;
}
private void TwoDegreesOfFreedom(Vector3 newPosRaw)
{
//IL_0047: 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_004e: 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_0058: 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_0014: 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_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_0065: 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_006c: 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)
//IL_0077: 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_0083: 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_008b: 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_009b: Unknown result type (might be due to invalid IL or missing references)
Vector3 val = ((!CanSwitchModes) ? UnityEngineExtensions.RemoveAxisValue(((Component)this).transform.parent.InverseTransformPoint(newPosRaw), LimitingAxis) : UnityEngineExtensions.ProjectOnPlaneThroughPoint(newPosRaw, ((Component)this).transform.position, UnityEngineExtensions.GetLocalDirAxis(((Component)this).transform.parent, LimitingAxis)));
Vector3 val2 = UnityEngineExtensions.Clamp(((Component)this).transform.parent.InverseTransformPoint(val), _lowerLimit, _upperLimit);
((Component)this).transform.localPosition = UnityEngineExtensions.ModifyAxisValue(val2, LimitingAxis, UnityEngineExtensions.GetAxisValue(_startPos, LimitingAxis));
}
private void ThreeDegreesOfFreedom(Vector3 newPosRaw)
{
//IL_0012: 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_0019: 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)
((Component)this).transform.localPosition = UnityEngineExtensions.Clamp(((Component)this).transform.parent.InverseTransformPoint(newPosRaw), _lowerLimit, _upperLimit);
}
[ContextMenu("Copy existing Interface's values")]
public void CopyAttachment()
{
FVRFireArmAttachmentInterface[] components = ((Component)this).GetComponents<FVRFireArmAttachmentInterface>();
FVRFireArmAttachmentInterface val = components.Single((FVRFireArmAttachmentInterface c) => (Object)(object)c != (Object)(object)this);
val.Attachment.AttachmentInterface = (FVRFireArmAttachmentInterface)(object)this;
UniversalCopy.CopyComponent<FVRFireArmAttachmentInterface>((Component)(object)this, val);
}
private void SwitchMode()
{
//IL_0056: 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)
//IL_006e: 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)
_currentMode = (_currentMode + 1) % MovementModes.Length;
if ((Object)(object)ModeDisplay != (Object)null)
{
ModeDisplay.text = MovementModes[_currentMode].ModeText;
}
DegreesOfFreedom = MovementModes[_currentMode].DegreesOfFreedom;
LimitingAxis = MovementModes[_currentMode].LimitingAxis;
}
}
public class IvasInputMan : MonoBehaviour
{
private int currentIndex = 0;
public List<Material> materialList;
private bool nv_on = true;
public Material specificMaterial;
public MeshRenderer meshRenderer;
public Light spotlight;
public int maxLightAngle = 110;
public int currLightAnle = 80;
private void Start()
{
}
private void Awake()
{
}
private void Update()
{
}
private void OnTriggerStay(Collider other)
{
FVRViveHand component = ((Component)other).GetComponent<FVRViveHand>();
if ((Object)(object)component != (Object)null)
{
if (component.Input.BYButtonDown)
{
SwapToNextMaterial();
SetLightAngle(80);
SetLight(onoff: true);
nv_on = true;
}
else if (component.Input.AXButtonDown)
{
SwapToSpecificMaterial();
SetLight(onoff: false);
nv_on = false;
}
else if (component.Input.TriggerDown)
{
ChangeLightAngle();
}
}
}
private void ChangeLightAngle()
{
if (!Object.op_Implicit((Object)(object)spotlight) || !nv_on)
{
return;
}
currLightAnle = (currLightAnle + 10) % maxLightAngle;
if (currLightAnle == 0)
{
SetLight(onoff: false);
return;
}
if (currLightAnle < 80)
{
currLightAnle = 80;
SetLight(onoff: true);
}
spotlight.spotAngle = currLightAnle;
}
private void SetLightAngle(int gnle)
{
if (Object.op_Implicit((Object)(object)spotlight))
{
spotlight.spotAngle = gnle;
currLightAnle = gnle;
}
}
private void SetLight(bool onoff)
{
if (Object.op_Implicit((Object)(object)spotlight))
{
((Behaviour)spotlight).enabled = onoff;
}
}
private void SwapToNextMaterial()
{
if ((Object)(object)meshRenderer == (Object)null)
{
Console.WriteLine("Mesh render NULL!");
}
if (materialList == null)
{
Console.WriteLine("Mat list NULL!");
}
if (materialList.Count == 0)
{
Console.WriteLine("Material List EMPTY!");
}
if ((Object)(object)meshRenderer != (Object)null && materialList != null && materialList.Count > 0)
{
if (nv_on)
{
currentIndex = (currentIndex + 1) % materialList.Count;
}
Material[] materials = ((Renderer)meshRenderer).materials;
materials[1] = materialList[currentIndex];
((Renderer)meshRenderer).materials = materials;
}
}
private void SwapToSpecificMaterial()
{
if ((Object)(object)meshRenderer != (Object)null && (Object)(object)specificMaterial != (Object)null)
{
Material[] materials = ((Renderer)meshRenderer).materials;
materials[1] = specificMaterial;
((Renderer)meshRenderer).materials = materials;
}
}
}
public class QBslotEnumerator : MonoBehaviour
{
public bool executedUpdate = false;
public int enumToSet = 1985;
private void Start()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
FVRPhysicalObject component = ((Component)this).GetComponent<FVRPhysicalObject>();
component.QBSlotType = (QuickbeltSlotType)enumToSet;
}
private void Update()
{
//IL_0025: 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_0045: Expected I4, but got Unknown
if (!executedUpdate)
{
FVRPhysicalObject component = ((Component)this).GetComponent<FVRPhysicalObject>();
Debug.Log((object)string.Concat("QB slot type ", component.QBSlotType, " int ", (int)component.QBSlotType));
executedUpdate = true;
}
}
}
public class RailEnumerator : MonoBehaviour
{
public bool executedUpdate = false;
public int enumToSet = 159;
private void Start()
{
//IL_000f: Unknown result type (might be due to invalid IL or missing references)
FVRFireArmAttachment component = ((Component)this).GetComponent<FVRFireArmAttachment>();
component.Type = (FVRFireArmAttachementMountType)enumToSet;
}
private void Update()
{
//IL_0025: 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_0045: Expected I4, but got Unknown
if (!executedUpdate)
{
FVRFireArmAttachment component = ((Component)this).GetComponent<FVRFireArmAttachment>();
Debug.Log((object)string.Concat("Mount type ", component.Type, " int ", (int)component.Type));
executedUpdate = true;
}
}
}
public class SingleEnemySpawn : FVRPhysicalObject
{
private static bool isSosigKillEventHandlerAdded = false;
private readonly SpawnOptions _spawnOptions;
private Sosig MySosig;
private int SosigObjcsID;
public int curr_Digit;
public List<Text> DigitsTexts;
public List<int> DigitsValues;
public Text enumName;
public SingleEnemySpawn()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
SpawnOptions val = new SpawnOptions();
val.SpawnState = (SosigOrder)7;
val.SpawnActivated = true;
val.EquipmentMode = (EquipmentSlots)7;
val.SpawnWithFullAmmo = true;
_spawnOptions = val;
MySosig = null;
SosigObjcsID = 0;
curr_Digit = 0;
DigitsTexts = new List<Text>();
DigitsValues = new List<int> { 0, 0, 0 };
enumName = null;
((FVRPhysicalObject)this)..ctor();
}
private void Start()
{
if (!FindDebugWand())
{
SpawnTheSosig();
}
}
private bool FindDebugWand()
{
return (Object)(object)GameObject.Find("DebugWand(Clone)") != (Object)null;
}
private void SpawnTheSosig()
{
//IL_0019: 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_0050: Unknown result type (might be due to invalid IL or missing references)
_spawnOptions.IFF = 1;
_spawnOptions.SosigTargetPosition = ((Component)this).transform.position;
MySosig = SosigAPI.Spawn(ManagerSingleton<IM>.Instance.odicSosigObjsByID[(SosigEnemyID)SosigObjcsID], _spawnOptions, ((Component)this).transform.position, ((Component)this).transform.rotation);
EnsureSosigKillEventHandler();
}
private void EnsureSosigKillEventHandler()
{
//IL_0018: Unknown result type (might be due to invalid IL or missing references)
//IL_0022: Expected O, but got Unknown
if (!isSosigKillEventHandlerAdded)
{
GM.CurrentSceneSettings.SosigKillEvent += new SosigKill(CurrentSceneSettingsOnSosigKillEvent);
isSosigKillEventHandlerAdded = true;
}
}
private void CurrentSceneSettingsOnSosigKillEvent(Sosig s)
{
if (Object.op_Implicit((Object)(object)s) && (Object)(object)s == (Object)(object)MySosig)
{
Object.Destroy((Object)(object)((Component)this).gameObject);
}
}
private void Update()
{
if (Object.op_Implicit((Object)(object)((FVRInteractiveObject)this).m_hand))
{
FVRViveHand hand = ((FVRInteractiveObject)this).m_hand;
if (hand.Input.BYButtonDown)
{
DigitsValues[curr_Digit] = (DigitsValues[curr_Digit] + 1) % 10;
}
if (hand.Input.BYButtonDown)
{
DigitsValues[curr_Digit] = (DigitsValues[curr_Digit] - 1) % 10;
}
if (hand.Input.TouchpadCenterDown)
{
curr_Digit = (curr_Digit + 1) % DigitsValues.Count;
}
}
UpdateTextCounters();
}
private void UpdateTextCounters()
{
for (int i = 0; i < DigitsValues.Count; i++)
{
if (i < DigitsTexts.Count)
{
DigitsTexts[i].text = DigitsValues[i].ToString();
}
}
int num = 0;
for (int j = 0; j < DigitsValues.Count; j++)
{
num += DigitsValues[j] * (int)Mathf.Pow(10f, (float)j);
}
SosigObjcsID = num;
if (Object.op_Implicit((Object)(object)enumName))
{
enumName.text = SosigObjcsID.ToString();
}
}
private void UpdateValuesFromID()
{
int num = SosigObjcsID;
for (int i = 0; i < DigitsValues.Count; i++)
{
int value = num % 10;
num /= 10;
DigitsValues[i] = value;
}
}
public override Dictionary<string, string> GetFlagDic()
{
Dictionary<string, string> flagDic = ((FVRPhysicalObject)this).GetFlagDic();
string key = "nga_sosigenemyid";
string value = SosigObjcsID.ToString();
flagDic.Add(key, value);
return flagDic;
}
public override void ConfigureFromFlagDic(Dictionary<string, string> f)
{
string key = "nga_sosigenemyid";
if (f.ContainsKey(key))
{
SosigObjcsID = int.Parse(f[key]);
UpdateValuesFromID();
UpdateTextCounters();
}
((FVRPhysicalObject)this).ConfigureFromFlagDic(f);
}
}
public class SingleObjectSpawn : FVRPhysicalObject
{
public string ObjectId = "P90";
public Text id_text = null;
private void Start()
{
((FVRInteractiveObject)this).Start();
if (!FindDebugWand())
{
Spawn();
}
}
private bool FindDebugWand()
{
return (Object)(object)GameObject.Find("DebugWand(Clone)") != (Object)null;
}
public void Spawn()
{
((MonoBehaviour)this).StartCoroutine(SpawnAsync());
}
private IEnumerator SpawnAsync()
{
if (!IM.OD.TryGetValue(ObjectId, out var obj))
{
Console.WriteLine("No object found with id '" + ObjectId + "'.");
yield break;
}
AnvilCallback<GameObject> callback = ((AnvilAsset)obj).GetGameObjectAsync();
yield return callback;
Object.Instantiate<GameObject>(callback.Result, ((Component)this).transform.position, ((Component)this).transform.rotation).SetActive(true);
}
private void OnTriggerEnter(Collider other)
{
FVRPhysicalObject component = ((Component)other).GetComponent<FVRPhysicalObject>();
if ((Object)(object)component != (Object)null)
{
FVRObject objectWrapper = component.ObjectWrapper;
if (Object.op_Implicit((Object)(object)objectWrapper))
{
ObjectId = objectWrapper.ItemID;
id_text.text = ObjectId;
Debug.Log((object)("Changed ObjectID to: " + ObjectId));
}
}
else
{
Debug.Log((object)"FVRPhysicalObject component not found!");
}
}
public override Dictionary<string, string> GetFlagDic()
{
Dictionary<string, string> flagDic = ((FVRPhysicalObject)this).GetFlagDic();
string key = "nga_objectidtospawn";
string objectId = ObjectId;
flagDic.Add(key, objectId);
return flagDic;
}
public override void ConfigureFromFlagDic(Dictionary<string, string> f)
{
string key = "nga_objectidtospawn";
if (f.ContainsKey(key))
{
ObjectId = f[key];
}
((FVRPhysicalObject)this).ConfigureFromFlagDic(f);
}
}
public class SingleSpawnPoint : MonoBehaviour
{
private void Start()
{
//IL_0018: 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_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)
if (!FindDebugWand())
{
GM.CurrentMovementManager.TeleportToPoint(((Component)this).transform.position, true, ((Component)this).transform.position + ((Component)this).transform.forward);
}
}
private bool FindDebugWand()
{
return (Object)(object)GameObject.Find("DebugWand(Clone)") != (Object)null;
}
}
}