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 Atlas;
using BepInEx;
using BepInEx.Bootstrap;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using OpenScripts2;
using OtherLoader;
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]
public class DSC_ChangeOnHeld : MonoBehaviour
{
public string[] primaryIDs;
public GameObject[] primaryGameObjects;
public bool checkPrimary;
public string[] secondaryIDs;
public GameObject[] secondaryGameObjects;
public bool checkSecondary;
private Dictionary<string, GameObject> primaryIDToGameObjectMap;
private Dictionary<string, GameObject> secondaryIDToGameObjectMap;
private Sosig mysosig;
private GameObject recentPrimaryObject;
private string recentPrimaryID;
private GameObject recentSecondaryObject;
private string recentSecondaryID;
public void Start()
{
if (checkPrimary)
{
primaryIDToGameObjectMap = new Dictionary<string, GameObject>();
for (int i = 0; i < primaryIDs.Length; i++)
{
if (i < primaryGameObjects.Length)
{
primaryIDToGameObjectMap[primaryIDs[i]] = primaryGameObjects[i];
}
}
}
if (checkSecondary)
{
secondaryIDToGameObjectMap = new Dictionary<string, GameObject>();
for (int j = 0; j < secondaryIDs.Length; j++)
{
if (j < secondaryGameObjects.Length)
{
secondaryIDToGameObjectMap[secondaryIDs[j]] = secondaryGameObjects[j];
}
}
}
mysosig = ((Component)this).GetComponent<SosigWearable>().S;
}
public void Update()
{
if (checkPrimary && (Object)(object)mysosig != (Object)null)
{
SosigHand hand_Primary = mysosig.Hand_Primary;
if (hand_Primary != null && (Object)(object)hand_Primary.HeldObject != (Object)null && (Object)(object)hand_Primary.HeldObject.O != (Object)null && (Object)(object)hand_Primary.HeldObject.O.ObjectWrapper != (Object)null)
{
string itemID = hand_Primary.HeldObject.O.ObjectWrapper.ItemID;
if (itemID != null && itemID != recentPrimaryID)
{
UpdatePrimary(itemID);
}
}
}
if (!checkSecondary || !((Object)(object)mysosig != (Object)null))
{
return;
}
SosigHand hand_Secondary = mysosig.Hand_Secondary;
if (hand_Secondary != null && (Object)(object)hand_Secondary.HeldObject != (Object)null && (Object)(object)hand_Secondary.HeldObject.O != (Object)null && (Object)(object)hand_Secondary.HeldObject.O.ObjectWrapper != (Object)null)
{
string itemID2 = hand_Secondary.HeldObject.O.ObjectWrapper.ItemID;
if (itemID2 != null && itemID2 != recentSecondaryID)
{
UpdateSecondary(itemID2);
}
}
}
public void UpdatePrimary(string input)
{
if (primaryIDToGameObjectMap.TryGetValue(input, out var value))
{
if ((Object)(object)recentPrimaryObject != (Object)null)
{
recentPrimaryObject.SetActive(false);
}
value.SetActive(true);
recentPrimaryObject = value;
recentPrimaryID = input;
}
}
public void UpdateSecondary(string input)
{
if (secondaryIDToGameObjectMap.TryGetValue(input, out var value))
{
if ((Object)(object)recentSecondaryObject != (Object)null)
{
recentSecondaryObject.SetActive(false);
}
value.SetActive(true);
recentSecondaryObject = value;
recentSecondaryID = input;
}
}
}
public class NewBehaviourScript : MonoBehaviour
{
private void Start()
{
}
private void Update()
{
}
}
public class PassiveSosigFixer : MonoBehaviour
{
private Sosig mySosig;
private void Awake()
{
mySosig = ((Component)this).GetComponent<SosigWearable>().S;
if ((Object)(object)mySosig != (Object)null)
{
mySosig.IgnoresNeedForWeapons = true;
}
}
}
public class FireAudioAddFromFile : MonoBehaviour
{
public string PluginDictionaryString;
public string fileName;
public AudioClip foundClip;
private void Awake()
{
PreloadAudioFile();
}
public void PreloadAudioFile()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
PluginInfo value = new PluginInfo();
Chainloader.PluginInfos.TryGetValue(PluginDictionaryString, out value);
string directoryName = Path.GetDirectoryName(value.Location);
((MonoBehaviour)this).StartCoroutine(LoadCustomAudio(directoryName));
}
public IEnumerator LoadCustomAudio(string filePath)
{
yield return (object)new WaitForSeconds(1f);
string audioClipPath = Path.Combine(filePath, fileName);
if (!File.Exists(audioClipPath))
{
Debug.LogError((object)("Valid audio file not found at: " + audioClipPath));
yield break;
}
string uri = "file:///" + audioClipPath;
WWW www = new WWW(uri);
foundClip = WWWAudioExtensions.GetAudioClip(www);
Debug.Log((object)("Sucessfully found an audio clip at: " + uri));
MuzzleNoiseMaker noiseMaker = ((Component)this).gameObject.GetComponent<MuzzleNoiseMaker>();
noiseMaker.AudEvent_SoundToPlay.Clips[0] = foundClip;
}
}
public class FireAudioFromFile : MonoBehaviour
{
public string PluginDictionaryString;
public string fileName;
public AudioClip foundClip;
private void Awake()
{
PreloadAudioFile();
}
public void PreloadAudioFile()
{
//IL_0001: Unknown result type (might be due to invalid IL or missing references)
//IL_0007: Expected O, but got Unknown
PluginInfo value = new PluginInfo();
Chainloader.PluginInfos.TryGetValue(PluginDictionaryString, out value);
string directoryName = Path.GetDirectoryName(value.Location);
((MonoBehaviour)this).StartCoroutine(LoadCustomAudio(directoryName));
}
public IEnumerator LoadCustomAudio(string filePath)
{
yield return (object)new WaitForSeconds(1f);
string audioClipPath = Path.Combine(filePath, fileName);
if (!File.Exists(audioClipPath))
{
Debug.LogError((object)("Valid audio file not found at: " + audioClipPath));
yield break;
}
string uri = "file:///" + audioClipPath;
WWW www = new WWW(uri);
foundClip = WWWAudioExtensions.GetAudioClip(www);
Debug.Log((object)("Sucessfully found an audio clip at: " + uri));
SuppressorAddSound muzzleDevice = ((Component)this).gameObject.GetComponent<SuppressorAddSound>();
muzzleDevice.AudEvent_SoundToPlay.Clips[0] = foundClip;
}
}
public class SuppressorAddSound : MuzzleDevice
{
public bool PlaysTail = true;
public AudioEvent AudEvent_SoundToPlay;
public override void OnShot(FVRFireArm f, FVRTailSoundClass tailClass)
{
//IL_0072: 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)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
FVRFirearmAudioSet audioClipSet = f.AudioClipSet;
if (PlaysTail)
{
f.PlayShotTail((FVRTailSoundClass)11, (FVRSoundEnvironment)12, 1f);
int playerIFF = GM.CurrentPlayerBody.GetPlayerIFF();
GM.CurrentSceneSettings.OnPerceiveableSound(200f, 80f, ((Component)this).transform.position, playerIFF, GM.CurrentPlayerBody.PlayerEntities[0]);
}
else
{
f.PlayAudioAsHandling(AudEvent_SoundToPlay, ((Component)this).transform.position);
}
((MuzzleDevice)this).OnShot(f, tailClass);
}
public override void OnShot(AttachableFirearm f, FVRTailSoundClass tailClass)
{
//IL_0072: 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)
//IL_0080: Unknown result type (might be due to invalid IL or missing references)
FVRFirearmAudioSet audioClipSet = f.AudioClipSet;
if (PlaysTail)
{
f.PlayShotTail((FVRTailSoundClass)11, (FVRSoundEnvironment)12, 1f);
int playerIFF = GM.CurrentPlayerBody.GetPlayerIFF();
GM.CurrentSceneSettings.OnPerceiveableSound(200f, 80f, ((Component)this).transform.position, playerIFF, GM.CurrentPlayerBody.PlayerEntities[0]);
}
else
{
f.PlayAudioAsHandling(AudEvent_SoundToPlay, ((Component)this).transform.position);
}
((MuzzleDevice)this).OnShot(f, tailClass);
}
[ContextMenu("Copy Suppressor")]
public void CopySuppressor()
{
Suppressor[] components = ((Component)this).GetComponents<Suppressor>();
Suppressor val = components.Single((Suppressor c) => (Object)(object)c != (Object)(object)this);
foreach (FVRFireArmAttachmentMount attachmentMount in ((FVRPhysicalObject)val).AttachmentMounts)
{
attachmentMount.MyObject = (FVRPhysicalObject)(object)this;
attachmentMount.Parent = (FVRPhysicalObject)(object)this;
}
((FVRFireArmAttachment)val).AttachmentInterface.Attachment = (FVRFireArmAttachment)(object)this;
((FVRFireArmAttachment)val).Sensor.Attachment = (FVRFireArmAttachment)(object)this;
UniversalCopy.CopyComponent<Suppressor>((Component)(object)this, val);
}
}
namespace H3VRUtils.FVRInteractiveObjects
{
internal class AutoRackOnMagLoad : MonoBehaviour
{
public FVRFireArm weapon;
private Handgun hg;
private ClosedBoltWeapon cbw;
private OpenBoltReceiver obr;
private bool WasLoaded;
public void Start()
{
if (weapon is Handgun)
{
ref Handgun reference = ref hg;
FVRFireArm obj = weapon;
reference = (Handgun)(object)((obj is Handgun) ? obj : null);
}
if (weapon is ClosedBoltWeapon)
{
ref ClosedBoltWeapon reference2 = ref cbw;
FVRFireArm obj2 = weapon;
reference2 = (ClosedBoltWeapon)(object)((obj2 is ClosedBoltWeapon) ? obj2 : null);
}
if (weapon is OpenBoltReceiver)
{
ref OpenBoltReceiver reference3 = ref obr;
FVRFireArm obj3 = weapon;
reference3 = (OpenBoltReceiver)(object)((obj3 is OpenBoltReceiver) ? obj3 : null);
}
}
public void FixedUpdate()
{
if ((Object)(object)weapon.Magazine != (Object)null)
{
if (!WasLoaded)
{
if ((Object)(object)hg != (Object)null)
{
hg.Slide.ImpartFiringImpulse();
}
if ((Object)(object)cbw != (Object)null)
{
cbw.Bolt.ImpartFiringImpulse();
}
if ((Object)(object)obr != (Object)null)
{
obr.Bolt.ImpartFiringImpulse();
}
}
WasLoaded = true;
}
else
{
WasLoaded = false;
}
}
}
}
public class SafetyAudio : MonoBehaviour
{
public AudioClip openClip;
public AudioClip closeClip;
private ClosedBoltWeapon mygun;
private void Start()
{
mygun = ((Component)this).GetComponent<ClosedBoltWeapon>();
}
private void Update()
{
//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)
if ((Object)(object)mygun != (Object)null)
{
float x = ((Component)mygun.FireSelectorSwitch).transform.localRotation.x;
if (x == 0f)
{
((FVRFireArm)mygun).AudioClipSet.FireSelector.Clips[0] = openClip;
}
if (x != 0f)
{
((FVRFireArm)mygun).AudioClipSet.FireSelector.Clips[0] = closeClip;
}
}
}
}
public class SceneLoaderObject : FVRPhysicalObject
{
[Header("Scene Loading")]
public string sceneToLoad = "";
private static readonly Collider[] Colliders = (Collider[])(object)new Collider[32];
private Rigidbody _rb;
public override void Awake()
{
((FVRPhysicalObject)this).Awake();
_rb = ((Component)this).GetComponent<Rigidbody>();
}
public override void UpdateInteraction(FVRViveHand hand)
{
//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_0021: Unknown result type (might be due to invalid IL or missing references)
//IL_0026: Unknown result type (might be due to invalid IL or missing references)
((FVRPhysicalObject)this).UpdateInteraction(hand);
int num = Physics.OverlapSphereNonAlloc(GM.CurrentPlayerBody.Head.position + Vector3.up * -0.1f, 0.1f, Colliders, -1, (QueryTriggerInteraction)1);
bool flag = false;
for (int i = 0; i < num; i++)
{
if ((Object)(object)Colliders[i].attachedRigidbody == (Object)(object)_rb)
{
flag = true;
}
}
if (flag)
{
LoadMap();
}
}
public void LoadMap()
{
AtlasPlugin.LoadCustomScene(sceneToLoad);
}
}
namespace Danny.Goauld_Staff
{
[BepInPlugin("Danny.Goauld_Staff", "Goauld_Staff", "1.0.1")]
[BepInProcess("h3vr.exe")]
[Description("Built with MeatKit")]
[BepInDependency("h3vr.otherloader", "1.3.0")]
public class Goauld_StaffPlugin : 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(), "Danny.Goauld_Staff");
OtherLoader.RegisterDirectLoad(BasePath, "Danny.Goauld_Staff", "", "", "goauldstaff", "");
}
}
}
public class ScopeEditingPanel : MonoBehaviour
{
public Text selectedItemText;
public Text baseMagnificationText;
public Text baseFOVText;
public Text reticleFOVText;
public Text lensDistortionText;
public Text stockZPositionText;
private bool isEditingScopes = true;
private int selectedFirearmIndex;
private int selectedScopeIndex;
private List<PIPScope> scopesInScene = new List<PIPScope>();
private List<FVRFireArm> firearmsInScene = new List<FVRFireArm>();
public void UpdateScopePanel()
{
//IL_0114: Unknown result type (might be due to invalid IL or missing references)
//IL_0119: Unknown result type (might be due to invalid IL or missing references)
PIPScope val = scopesInScene[selectedScopeIndex];
FVRFireArm val2 = firearmsInScene[selectedFirearmIndex];
if (isEditingScopes)
{
selectedItemText.text = ((FVRPhysicalObject)((Component)((Component)val).transform.root).GetComponent<FVRFireArmAttachment>()).ObjectWrapper.DisplayName;
baseMagnificationText.text = "Base Magnification: " + val.baseMagnification;
baseFOVText.text = "Base FOV: " + val.baseFOV;
reticleFOVText.text = "Reticle FOV: " + val.reticle.reticleFOV;
lensDistortionText.text = "Lens Distortion: " + val.distortion;
}
else if (!isEditingScopes)
{
selectedItemText.text = ((FVRPhysicalObject)val2).ObjectWrapper.DisplayName;
stockZPositionText.text = ((Component)val2.StockPos).transform.position.z.ToString();
}
}
public void GrabFirearmsInScene()
{
firearmsInScene.Clear();
firearmsInScene.AddRange(Object.FindObjectsOfType<FVRFireArm>());
selectedFirearmIndex = 0;
}
public void GrabScopesInScene()
{
scopesInScene.Clear();
scopesInScene.AddRange(Object.FindObjectsOfType<PIPScope>());
selectedScopeIndex = 0;
}
public void IndexForward()
{
if (isEditingScopes)
{
if (selectedScopeIndex == scopesInScene.Count)
{
selectedScopeIndex = 0;
}
else
{
selectedScopeIndex++;
}
}
else if (!isEditingScopes)
{
if (selectedFirearmIndex == firearmsInScene.Count)
{
selectedFirearmIndex = 0;
}
else
{
selectedFirearmIndex++;
}
}
UpdateScopePanel();
}
public void IndexBackward()
{
if (isEditingScopes)
{
if (selectedScopeIndex == 0)
{
selectedScopeIndex = scopesInScene.Count;
}
else
{
selectedScopeIndex--;
}
}
else if (!isEditingScopes)
{
if (selectedFirearmIndex == 0)
{
selectedFirearmIndex = firearmsInScene.Count;
}
else
{
selectedFirearmIndex--;
}
}
UpdateScopePanel();
}
public void IndexRefresh()
{
GrabFirearmsInScene();
GrabScopesInScene();
UpdateScopePanel();
}
}