using System;
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 Sodalite.Api;
using UnityEngine;
[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);
}
}
}
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));
}
}
}
namespace Meat_banono.Meats_ModulAR2_Barrels
{
[BepInPlugin("Meat_banono.Meats_ModulAR2_Barrels", "Meats_ModulAR2_Barrels", "1.0.0")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.1.5")]
[BepInDependency("h3vr.OpenScripts2", "2.2.0")]
[BepInDependency("nrgill28.Sodalite", "1.3.6")]
public class Meats_ModulAR2_BarrelsPlugin : 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_ModulAR2_Barrels");
GameAPI.PreloadAllAssets(Path.Combine(BasePath, "mw_meats_modular2_barrels"));
}
}
}