using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Security;
using System.Security.Permissions;
using BepInEx;
using BepInEx.Logging;
using FistVR;
using HarmonyLib;
using Microsoft.CodeAnalysis;
using UnityEngine;
[assembly: CompilationRelaxations(8)]
[assembly: RuntimeCompatibility(WrapNonExceptionThrows = true)]
[assembly: Debuggable(DebuggableAttribute.DebuggingModes.Default | DebuggableAttribute.DebuggingModes.DisableOptimizations | DebuggableAttribute.DebuggingModes.IgnoreSymbolStoreSequencePoints | DebuggableAttribute.DebuggingModes.EnableEditAndContinue)]
[assembly: AssemblyCompany("NGA")]
[assembly: AssemblyConfiguration("Debug")]
[assembly: AssemblyDescription("Persistent player progression! Raid, stash loot, and deploy with seemless scene/loadout saving.")]
[assembly: AssemblyFileVersion("0.0.1.0")]
[assembly: AssemblyInformationalVersion("0.0.1")]
[assembly: AssemblyProduct("NGA.VaultSaveCompatibility")]
[assembly: AssemblyTitle("BepInEx Plugin Title")]
[assembly: SecurityPermission(SecurityAction.RequestMinimum, SkipVerification = true)]
[assembly: AssemblyVersion("0.0.1.0")]
[module: UnverifiableCode]
[module: RefSafetyRules(11)]
namespace Microsoft.CodeAnalysis
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
internal sealed class EmbeddedAttribute : Attribute
{
}
}
namespace System.Runtime.CompilerServices
{
[CompilerGenerated]
[Microsoft.CodeAnalysis.Embedded]
[AttributeUsage(AttributeTargets.Module, AllowMultiple = false, Inherited = false)]
internal sealed class RefSafetyRulesAttribute : Attribute
{
public readonly int Version;
public RefSafetyRulesAttribute(int P_0)
{
Version = P_0;
}
}
}
namespace BepInEx
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class BepInAutoPluginAttribute : Attribute
{
public BepInAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace BepInEx.Preloader.Core.Patching
{
[AttributeUsage(AttributeTargets.Class, Inherited = false, AllowMultiple = false)]
[Conditional("CodeGeneration")]
internal sealed class PatcherAutoPluginAttribute : Attribute
{
public PatcherAutoPluginAttribute(string id = null, string name = null, string version = null)
{
}
}
}
namespace NGA
{
[BepInPlugin("NGA.VaultSaveCompatibility", "VaultSaveCompatibility", "0.0.1")]
[BepInDependency("nrgill28.Sodalite", "1.4.1")]
[BepInProcess("h3vr.exe")]
public class VaultSaveCompatibility : BaseUnityPlugin
{
public struct MyWristButton
{
public Action<object> onclick;
public string name;
public int priority;
public MyWristButton(string name_, int priority_, Action<object> clickAction = null)
{
onclick = clickAction;
name = name_;
priority = priority_;
}
}
[HarmonyPatch(typeof(VaultSystem))]
[HarmonyPatch("SpawnVaultFile")]
private class VaultSystemSpawnVaultFileHook
{
private static bool Prefix(ref bool __result, VaultFile f, Transform SpawnRelativeTo, bool spawnRelativeTo, bool decodeAsLoadout, bool clearScene, out string ErrorMessage, Vector3 spawnOffset, ReturnObjectListDelegate del = null, bool displayFileLoad = false)
{
//IL_002a: Unknown result type (might be due to invalid IL or missing references)
//IL_02b8: 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_0602: Unknown result type (might be due to invalid IL or missing references)
//IL_02ef: Unknown result type (might be due to invalid IL or missing references)
//IL_02f4: Unknown result type (might be due to invalid IL or missing references)
//IL_0341: Unknown result type (might be due to invalid IL or missing references)
//IL_0346: Unknown result type (might be due to invalid IL or missing references)
//IL_0426: Unknown result type (might be due to invalid IL or missing references)
//IL_042b: Unknown result type (might be due to invalid IL or missing references)
//IL_0478: Unknown result type (might be due to invalid IL or missing references)
//IL_047d: Unknown result type (might be due to invalid IL or missing references)
ErrorMessage = string.Empty;
Debug.Log((object)("SpawnRelativeTo" + spawnRelativeTo + " " + spawnOffset));
if (f.Objects.Count < 1)
{
ErrorMessage = "No Objects Found in file";
Logger.LogMessage((object)"No Objects Found in file");
__result = false;
}
if (decodeAsLoadout && !GM.CurrentPlayerBody.DoesQuickbeltNameExist(f.QuickbeltLayoutName))
{
ErrorMessage = "Quickbelt Layout Not Found, Cannot Spawn";
Logger.LogMessage((object)"Quickbelt Layout Not Found, Cannot Spawn");
__result = false;
}
List<int> list = new List<int>();
for (int i = 0; i < f.Objects.Count; i++)
{
List<int> list2 = new List<int>();
for (int j = 0; j < f.Objects[i].Elements.Count; j++)
{
string objectID = f.Objects[i].Elements[j].ObjectID;
if (!IM.OD.ContainsKey(objectID))
{
Logger.LogMessage((object)("Cannot find FVRObject with ID: " + objectID + " and thus cannot spawn file"));
list2.Add(j);
}
else if (!IM.HasSpawnedID(IM.OD[objectID].SpawnedFromId))
{
Logger.LogMessage((object)("Cannot find ItemSpawnerID with ID: " + IM.OD[objectID].SpawnedFromId + " and thus cannot spawn file"));
list2.Add(j);
}
}
for (int num = list2.Count - 1; num >= 0; num--)
{
int index = list2[num];
f.Objects[i].Elements.RemoveAt(index);
}
if (f.Objects[i].Elements.Count < 1)
{
list.Add(i);
}
}
for (int num2 = list.Count - 1; num2 >= 0; num2--)
{
int index2 = list[num2];
f.Objects.RemoveAt(index2);
}
list.Clear();
for (int k = 0; k < f.Objects.Count; k++)
{
List<int> list3 = new List<int>();
for (int l = 0; l < f.Objects[k].Elements.Count; l++)
{
string objectID2 = f.Objects[k].Elements[l].ObjectID;
FVRObject val = IM.OD[objectID2];
FireArmRoundType roundType = val.RoundType;
List<int> list4 = new List<int>();
FireArmRoundClass val2;
for (int m = 0; m < f.Objects[k].Elements[l].LoadedRoundsInChambers.Count; m++)
{
if (!AM.DoesClassExistForType(f.Objects[k].Elements[l].LoadedRoundsInChambers[m], roundType))
{
ManualLogSource logger = Logger;
string? text = ((object)(FireArmRoundType)(ref roundType)).ToString();
val2 = f.Objects[k].Elements[l].LoadedRoundsInChambers[m];
logger.LogMessage((object)("Cannot find round of type: " + text + " and class: " + ((object)(FireArmRoundClass)(ref val2)).ToString()));
list4.Add(m);
}
}
for (int num3 = list4.Count - 1; num3 >= 0; num3--)
{
int index3 = list4[num3];
f.Objects[k].Elements[l].LoadedRoundsInChambers.RemoveAt(index3);
}
List<int> list5 = new List<int>();
for (int n = 0; n < f.Objects[k].Elements[l].LoadedRoundsInMag.Count; n++)
{
if (!AM.DoesClassExistForType(f.Objects[k].Elements[l].LoadedRoundsInMag[n], roundType))
{
ManualLogSource logger2 = Logger;
string? text2 = ((object)(FireArmRoundType)(ref roundType)).ToString();
val2 = f.Objects[k].Elements[l].LoadedRoundsInMag[n];
logger2.LogMessage((object)("Cannot find round of type: " + text2 + " and class: " + ((object)(FireArmRoundClass)(ref val2)).ToString()));
list5.Add(n);
}
}
for (int num4 = list5.Count - 1; num4 >= 0; num4--)
{
int index4 = list5[num4];
f.Objects[k].Elements[l].LoadedRoundsInMag.RemoveAt(index4);
}
}
}
for (int num5 = 0; num5 < f.Objects.Count; num5++)
{
f.Objects[num5].Index = num5;
for (int num6 = 0; num6 < f.Objects[num5].Elements.Count; num6++)
{
f.Objects[num5].Elements[num6].Index = num6;
}
}
AnvilManager.Run(VaultSystem.SpawnVaultFileRoutine(f, SpawnRelativeTo, spawnRelativeTo, decodeAsLoadout, clearScene, spawnOffset, del, displayFileLoad));
__result = true;
return false;
}
}
public static string raid_extracted_loadout_filename = "Loadout_Extracted_From_Raid";
public static string safehouse_persistent_filename = "Safehouse_Persitent_Filename";
public static string safehouse_deployment_loadout_filename = "Safehouse_Deployment_Filename";
public static string safehouse_scene_name = "GP_Hangar";
public static bool extracting_to_safehouse_need_loadout = false;
public static bool extracting_to_safehouse_need_map = false;
internal static ManualLogSource Logger { get; private set; }
private void Awake()
{
//IL_0012: Unknown result type (might be due to invalid IL or missing references)
//IL_0018: Expected O, but got Unknown
Logger = ((BaseUnityPlugin)this).Logger;
Harmony val = new Harmony("NGA.VaultSaveCompatibility");
val.PatchAll();
Logger.LogMessage((object)"Hello, world! Sent from NGA.VaultSaveCompatibility 0.0.1");
}
}
}